Initial import of LogDarioSeq baseline

Establishes version control for the personal Logseq DB fork before
starting the server-client architecture migration and domain features
described in docs/agent-guide and the approved implementation plan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-25 15:32:15 +02:00
commit 40631362b3
2016 changed files with 543898 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
(** Shared primitive aliases used by every layer. *)
type keyword = Melange_edn_melange.keyword Melange_edn_melange.t
type graph = private string
type repo = private string
type db_id = int64
type uuid = string
type path = string
type url = string
type email = string
type shell = Bash | Zsh
type port = int
type pid = int
type owner_source = Cli | Electron | Unknown | Other of string
type ds_where_clause =
| V of Melange_edn_melange.vector Melange_edn_melange.t
| L of Melange_edn_melange.list_ Melange_edn_melange.t
type datascript_query = private {
find : Melange_edn_melange.any Rrbvec.t;
in_ : Melange_edn_melange.symbol Melange_edn_melange.t Rrbvec.t option;
where : ds_where_clause Rrbvec.t;
}
val create_graph : string -> graph
val create_repo : string -> repo
(** repo is a string with prefix "logseq_db_" *)
val string_of_graph : graph -> string
val string_of_repo : repo -> string
val non_empty : string -> string option
val is_uuid_string : string -> bool
val shell_of_string : string -> shell option
val string_of_owner_source : owner_source -> string
val make_datascript_query :
find:Melange_edn_melange.any Rrbvec.t ->
?in_:Melange_edn_melange.symbol Melange_edn_melange.t Rrbvec.t ->
where:ds_where_clause Rrbvec.t ->
unit ->
datascript_query
val datascript_query_to_edn :
datascript_query -> Melange_edn_melange.vector Melange_edn_melange.t

176
cli/spec/core/error.mli Normal file
View File

@@ -0,0 +1,176 @@
(** Shared error model. *)
type code =
| Add_id_resolution_failed
| Agent_bridge_already_running
| Agent_bridge_lock_failed
| Agent_master_prompt_invalid
| Agent_name_invalid
| Agent_prompt_template_invalid
| Ambiguous_page_name
| Ambiguous_property_name
| Ambiguous_tag_name
| Asset_checksum_failed
| Asset_checksum_missing
| Asset_create_failed
| Asset_file_copy_failed
| Asset_file_not_found
| Asset_not_found
| Asset_not_remote
| Asset_tag_not_found
| Asset_type_missing
| Asset_uuid_missing
| Auth_code_exchange_failed
| Auth_file_delete_failed
| Auth_file_write_failed
| Auth_refresh_failed
| Backup_create_failed
| Backup_not_found
| Block_link_cycle
| Block_link_target_not_found
| Block_not_found
| Browser_open_failed
| Codex_not_found
| Codex_session_id_missing
| Codex_start_failed
| Config_write_failed
| Doctor_error
| Doctor_script_missing
| Doctor_script_unreadable
| Doctor_server_not_ready
| E2ee_password_failed
| E2ee_password_not_found
| Entity_not_found
| Exception
| External_asset
| Graph_already_exists
| Graph_db_not_empty
| Graph_exists
| Graph_not_exists
| Graph_not_removed
| Graph_validation_failed
| Invalid_auth_file
| Invalid_auth_token
| Invalid_blocks
| Invalid_callback_request
| Invalid_callback_state
| Invalid_config
| Invalid_options
| Invalid_property_target
| Invalid_query
| Invalid_source
| Invalid_tag_target
| Invalid_target
| Login_callback_error
| Login_callback_not_found
| Login_callback_server_start_failed
| Login_not_configured
| Login_timeout
| Logout_not_configured
| Missing_asset_selector
| Missing_auth
| Missing_callback_code
| Missing_content
| Missing_dst
| Missing_examples
| Missing_graph
| Missing_id_token
| Missing_page_name
| Missing_property_name
| Missing_query
| Missing_query_text
| Missing_repo
| Missing_snapshot
| Missing_source
| Missing_tag_name
| Missing_target
| Missing_template_code_block
| Missing_template_vars
| Not_asset
| Not_implemented
| Page_hierarchy_parent_cycle
| Page_not_found
| Property_built_in
| Property_hidden
| Property_not_found
| Recycled_page
| Remote_graph_not_found
| Root_dir_permission
| Server_cleanup_failed
| Server_not_found
| Server_owned_by_other
| Server_revision_mismatch_after_restart
| Server_script_missing
| Server_start_failed
| Server_start_timeout_orphan
| Server_stop_timeout
| Skill_home_dir_unavailable
| Skill_install_failed
| Skill_show_failed
| Skill_source_not_found
| Source_not_found
| Spec_blocker
| Sync_not_started
| Sync_remote_graphs_failed
| Sync_start_runtime_error
| Sync_start_timeout
| Sync_upload_failed
| Tag_built_in
| Tag_create_not_tag
| Tag_hidden
| Tag_name_conflict
| Tag_not_found
| Tag_rename_conflict
| Target_not_found
| Task_tag_not_found
| Unknown_command
| Unknown_query
| Unknown_template_vars
| Unsupported_input_format
| Unsupported_output_format
| Upsert_id_not_found
| Upsert_id_type_mismatch
val code_to_string : code -> string
val code_to_keyword : code -> Cli_primitive.keyword
type candidate = { id : Cli_primitive.db_id option; name : string option }
type t = {
code : code;
message : string;
hint : string option;
candidates : candidate Rrbvec.t;
context : Melange_edn_melange.any option;
}
type 'a build_result = ('a, t) result
type source =
| Cli_parse
| Config
| Build_action
| Transport
| Server
| Auth
| Sync
| Db_worker
| Filesystem
| Unknown
val make :
?hint:string ->
?candidates:candidate Rrbvec.t ->
?context:Melange_edn_melange.any ->
code ->
string ->
t
val invalid_options : string -> t
val missing_graph : unit -> t
val missing_repo : string -> t
val missing_target : string -> t
val unknown_command : string -> t
val exception_error : ?context:Melange_edn_melange.any -> exn -> t
val map : ('a -> 'b) -> 'a build_result -> 'b build_result
val bind : 'a build_result -> ('a -> 'b build_result) -> 'b build_result

35
cli/spec/core/output.mli Normal file
View File

@@ -0,0 +1,35 @@
type human
type json
type edn
module Mode : sig
type _ t = Human : human t | Json : json t | Edn : edn t
and packed = Packed : _ t -> packed
val default : human t
val of_string : string -> packed option
val to_string : 'a t -> string
val structured : 'a t -> bool
end
module Human_output : sig
type t
val create :
?headers:string Rrbvec.t ->
?footer:string ->
rows:string Rrbvec.t Rrbvec.t ->
unit ->
t
val to_string : t -> string
(** format as table.
- columns need to be aligned
- empty row value display as '-'
- humanize created-at/updated-at *)
end
type _ t =
| Human : Human_output.t -> human t
| Edn : Melange_edn_melange.any -> edn t
| Json : Melange_edn_melange.any -> json t

25
cli/spec/core/time.mli Normal file
View File

@@ -0,0 +1,25 @@
type span = float
type date = Js.Date.t
val now : unit -> date
val epoch : date
val max_time : date
val time_of_epoch_ms : int64 -> date
val time_to_epoch_ms : date -> int64
val time_to_epoch_seconds : date -> int64
val time_to_epoch_seconds_float : date -> float
val compare_time : date -> date -> int
val span_of_ms : int64 -> span
val span_to_ms : span -> int64
val zero_span : span
val compare_span : span -> span -> int
val add_span_value : span -> span -> span
val add_span : date -> span -> date option
val local_date : date -> int * int * int
val utc_date_time : date -> int * int * int * int * int * int
val non_negative_diff : start_time:date -> end_time:date -> span
val avg_span : span -> int -> span
val rfc3339_millis : date -> string
val parse_rfc3339 : string -> date option
val parse_date_as_utc : string -> date option
val parse_time : string -> date option

View File

@@ -0,0 +1,8 @@
type t = private string
(** unicode string *)
val of_string : string -> t
(** convert utf8-encoded byte string to unicode string *)
val to_string : t -> string
(** identity *)