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,36 @@
type parsed = Parsed_bridge
type action =
| Agent_bridge of { repo : Cli_primitive.repo; graph : Cli_primitive.graph }
type routable_reason =
| Missing_stable_uuid
| Missing_task_tag
| Not_todo
| Assignee_mismatch
| Already_routed
type routable_decision = Routable | Not_routable of routable_reason
type template_kind = Task | Comment
type prompt_template = {
kind : template_kind;
body : string;
required_vars : string Rrbvec.t;
allowed_vars : string Rrbvec.t;
}
type bridge_result = {
mode : Cli_primitive.keyword;
graph : Cli_primitive.graph;
agent_name : string;
routed : Melange_edn_melange.any Rrbvec.t;
}
include Command_spec.S with type parsed := parsed and type action := action
val resolve_agent_name :
Cli_config.t -> string option -> string Error.build_result
val routable_task_decision : Entity.t -> agent_name:string -> routable_decision
val validate_prompt_template : prompt_template -> unit Error.build_result

View File

@@ -0,0 +1,4 @@
type parsed = Parsed_login | Parsed_logout
type action = Login | Logout
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,12 @@
type opts = { shell : Cli_primitive.shell option }
type parsed = Parsed_completion of opts
type action =
| Completion of {
shell : Cli_primitive.shell;
registry : Command_registry.t option;
}
val generate : Cli_primitive.shell -> Command_registry.t -> string
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,25 @@
type selector =
| By_id of Cli_primitive.db_id
| By_uuid of Cli_primitive.uuid
| By_ident of Cli_primitive.keyword
type opts = {
id : Cli_primitive.db_id option;
uuid : Cli_primitive.uuid option;
ident : Cli_primitive.keyword option;
}
type parsed = Parsed_pull of opts
type action =
| Debug_pull of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
lookup : selector;
selector : Melange_edn_melange.any;
}
val parse_ident_option : string -> Cli_primitive.keyword Error.build_result
val resolve_selector : opts -> selector Error.build_result
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,22 @@
type opts = { dev_script : bool }
type parsed = Parsed_doctor of opts
type action = Doctor of { script_path : Cli_primitive.path option }
type check_status = Ok | Warning | Error
type check = {
id : Cli_primitive.keyword;
status : check_status;
code : Error.code option;
message : string;
path : Cli_primitive.path option;
servers : Melange_edn_melange.any Rrbvec.t;
raw : Melange_edn_melange.any option;
}
type report = { status : check_status; checks : check Rrbvec.t }
val check_db_worker_script : action -> check
val check_root_dir : Cli_config.t -> check
val check_running_servers : Cli_config.t -> check Cli_effect.t
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,15 @@
type opts = { selector : string Rrbvec.t }
type parsed = Parsed_example of opts
type action = {
selector : string;
selector_path : string Rrbvec.t;
matched_commands : string Rrbvec.t;
examples : string Rrbvec.t;
message : string;
}
val resolve_selector :
Command_registry.t -> string Rrbvec.t -> action Error.build_result
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,92 @@
type export_type = Edn | Sqlite
type import_type = Import_edn | Import_sqlite
type create_opts = { enable_sync : bool; e2ee_password : string option }
type validate_opts = { fix : bool }
type backup_create_opts = { name : string option }
type backup_restore_opts = { src : string; dst : Cli_primitive.graph }
type backup_remove_opts = { src : string }
type export_opts = {
export_type : export_type;
file : Cli_primitive.path option;
edn_options : Melange_edn_melange.any option;
pretty_print : bool;
include_timestamps : bool;
exclude_built_in_pages : bool;
exclude_namespaces : string Rrbvec.t;
}
type import_opts = { import_type : import_type; input : Cli_primitive.path }
type parsed =
| Parsed_list
| Parsed_create of create_opts
| Parsed_switch
| Parsed_remove
| Parsed_validate of validate_opts
| Parsed_info
| Parsed_backup_list
| Parsed_backup_create of backup_create_opts
| Parsed_backup_restore of backup_restore_opts
| Parsed_backup_remove of backup_remove_opts
| Parsed_export of export_opts
| Parsed_import of import_opts
type action =
| Graph_list
| Graph_create of {
graph : Cli_primitive.graph;
repo : Cli_primitive.repo;
opts : create_opts;
}
| Graph_switch of { graph : Cli_primitive.graph; repo : Cli_primitive.repo }
| Graph_remove of { graph : Cli_primitive.graph; repo : Cli_primitive.repo }
| Graph_validate of {
graph : Cli_primitive.graph;
repo : Cli_primitive.repo;
fix : bool;
}
| Graph_info of { graph : Cli_primitive.graph; repo : Cli_primitive.repo }
| Graph_backup_list of {
graph : Cli_primitive.graph;
repo : Cli_primitive.repo;
}
| Graph_backup_create of {
graph : Cli_primitive.graph;
repo : Cli_primitive.repo;
name : string option;
backup_name : string option;
}
| Graph_backup_restore of {
source_repo : Cli_primitive.repo;
source_graph : Cli_primitive.graph;
dst_repo : Cli_primitive.repo;
dst_graph : Cli_primitive.graph;
src : string;
dst : string;
}
| Graph_backup_remove of {
graph : Cli_primitive.graph;
repo : Cli_primitive.repo;
src : string;
}
| Graph_export of {
graph : Cli_primitive.graph;
repo : Cli_primitive.repo;
opts : export_opts;
}
| Graph_import of {
graph : Cli_primitive.graph;
repo : Cli_primitive.repo;
opts : import_opts;
require_missing_graph : bool;
}
val normalize_export_type : string -> export_type option
val normalize_import_type : string -> import_type option
val string_of_import_type : import_type -> string
include Command_spec.S with type parsed := parsed and type action := action
val repo : action -> Cli_primitive.repo option
val graph : action -> Cli_primitive.graph option

View File

@@ -0,0 +1,79 @@
type order = Asc | Desc
type common_opts = {
fields : string Rrbvec.t option;
limit : int option;
offset : int option;
sort : string option;
order : order option;
}
type page_opts = {
common : common_opts;
expand : bool;
include_built_in : bool option;
include_journal : bool option;
journal_only : bool;
include_hidden : bool;
updated_after : Time.date option;
created_after : Time.date option;
}
type tag_opts = {
common : common_opts;
expand : bool;
include_built_in : bool option;
with_properties : bool;
with_extends : bool;
}
type property_opts = {
common : common_opts;
expand : bool;
include_built_in : bool option;
with_classes : bool;
with_type : bool;
}
type task_opts = {
common : common_opts;
status : string option;
priority : string option;
content : string option;
}
type node_opts = {
common : common_opts;
tags : string Rrbvec.t;
properties : string Rrbvec.t;
}
type asset_opts = { common : common_opts }
type parsed =
| Parsed_page of page_opts
| Parsed_tag of tag_opts
| Parsed_property of property_opts
| Parsed_task of task_opts
| Parsed_node of node_opts
| Parsed_asset of asset_opts
type kind = Page | Tag | Property | Task | Node | Asset
type action = {
kind : kind;
command : Command_id.t;
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
options : Melange_edn_melange.any;
}
type list_result = { items : Entity.t Rrbvec.t }
val order_of_string : string -> order option
val string_of_order : order -> string
val kind_of_parsed : parsed -> kind
val normalize_options : parsed -> parsed Error.build_result
val apply_offset_limit : common_opts -> Entity.t Rrbvec.t -> Entity.t Rrbvec.t
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,48 @@
type input_spec = {
name : string;
optional : bool;
default : Melange_edn_melange.any option;
}
type source = Built_in | Custom
type query_entry = {
name : string;
source : source;
doc : string option;
inputs : input_spec Rrbvec.t;
query : Melange_edn_melange.any;
}
type opts = {
query_edn : string option;
name : string option;
inputs_edn : string option;
}
type parsed = Parsed_run of opts | Parsed_list
type action =
| Run of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
query : Melange_edn_melange.any;
inputs : Melange_edn_melange.any Rrbvec.t;
name : string option;
}
| List
val built_in_queries : query_entry Rrbvec.t
val normalize_query_name : string -> string option
val list_queries : Cli_config.t -> query_entry Rrbvec.t
val find_query : Cli_config.t -> string -> query_entry option
val validate_query :
Melange_edn_melange.any -> Melange_edn_melange.any Error.build_result
val normalize_inputs :
query_entry option ->
Melange_edn_melange.any Rrbvec.t ->
Melange_edn_melange.any Rrbvec.t Error.build_result
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,45 @@
type block_opts = { id_raw : string option; uuid : Cli_primitive.uuid option }
type page_opts = { id : Cli_primitive.db_id option; page : string option }
type named_entity_opts = {
id : Cli_primitive.db_id option;
name : string option;
}
type parsed =
| Parsed_block of block_opts
| Parsed_page of page_opts
| Parsed_tag of named_entity_opts
| Parsed_property of named_entity_opts
type action =
| Remove_block of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
id : Cli_primitive.db_id option;
ids : Cli_primitive.db_id Rrbvec.t;
multi_id : bool;
uuid : Cli_primitive.uuid option;
}
| Remove_page of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
id : Cli_primitive.db_id option;
page : string option;
}
| Remove_tag of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
id : Cli_primitive.db_id option;
name : string option;
}
| Remove_property of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
id : Cli_primitive.db_id option;
name : string option;
}
val invalid_options : parsed -> string option
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,20 @@
type scope = Block | Page | Property | Tag
type opts = { content : string }
type parsed =
| Parsed_block of opts
| Parsed_page of opts
| Parsed_property of opts
| Parsed_tag of opts
type action = {
scope : scope;
command : Command_id.t;
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
query : string;
}
val scope_of_parsed : parsed -> scope
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,15 @@
type parsed =
| Parsed_list
| Parsed_cleanup
| Parsed_start
| Parsed_stop
| Parsed_restart
type action =
| Server_list
| Server_cleanup
| Server_start of { repo : Cli_primitive.repo; graph : Cli_primitive.graph }
| Server_stop of { repo : Cli_primitive.repo; graph : Cli_primitive.graph }
| Server_restart of { repo : Cli_primitive.repo; graph : Cli_primitive.graph }
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,45 @@
type target =
| By_id of Cli_primitive.db_id
| By_ids of Cli_primitive.db_id Rrbvec.t
| By_uuid of Cli_primitive.uuid
| By_page of string
type opts = {
id_raw : string option;
uuid : Cli_primitive.uuid option;
page : string option;
page_hierarchy : bool;
linked_references : bool option;
ref_id_footer : bool option;
level : int option;
stdin_id : string option;
}
type parsed = Parsed_show of opts
type action = {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
target : target;
multi_id : bool;
linked_references : bool;
ref_id_footer : bool;
page_hierarchy : bool;
level : int option;
}
type linked_references = { count : int; blocks : Block.t Rrbvec.t }
type tree_data = {
root : Block.t;
linked_references : linked_references option;
referenced_uuids : Cli_primitive.uuid Rrbvec.t;
uuid_to_entity : (Cli_primitive.uuid * Entity.t) Rrbvec.t;
breadcrumb_line : string option;
}
val normalize_stdin_id : string option -> string option
val resolve_target : opts -> target Error.build_result
val invalid_options : opts -> string option
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,37 @@
type install_opts = { global : bool }
type parsed = Parsed_show | Parsed_install of install_opts
type action =
| Skill_show of { source_path : Cli_primitive.path option }
| Skill_install of {
global : bool;
source_path : Cli_primitive.path option;
destination_dir : Cli_primitive.path option;
destination_file : Cli_primitive.path option;
}
type install_target = {
scope : Cli_primitive.keyword;
path : Cli_primitive.path;
update_command : string;
}
type update_status = {
installed : bool;
outdated : bool;
outdated_targets : install_target Rrbvec.t;
error : Error.t option;
}
val resolve_install_target :
global:bool ->
cwd:Cli_primitive.path ->
home_dir:Cli_primitive.path option ->
install_target Error.build_result
val installed_skill_targets :
cwd:Cli_primitive.path ->
home_dir:Cli_primitive.path option ->
install_target Rrbvec.t
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,93 @@
type config_key = Ws_url | Http_base
type start_opts = { e2ee_password : string option }
type upload_opts = { e2ee_password : string option }
type download_opts = { progress : bool option; e2ee_password : string option }
type asset_download_opts = {
id : Cli_primitive.db_id option;
uuid : Cli_primitive.uuid option;
}
type ensure_keys_opts = { e2ee_password : string option; upload_keys : bool }
type grant_access_opts = {
graph_id : Cli_primitive.uuid option;
email : Cli_primitive.email option;
}
type config_get_opts = { key : config_key option }
type config_set_opts = { key : config_key option; value : string option }
type config_unset_opts = { key : config_key option }
type parsed =
| Parsed_status
| Parsed_start of start_opts
| Parsed_stop
| Parsed_upload of upload_opts
| Parsed_download of download_opts
| Parsed_asset_download of asset_download_opts
| Parsed_remote_graphs
| Parsed_ensure_keys of ensure_keys_opts
| Parsed_grant_access of grant_access_opts
| Parsed_config_get of config_get_opts
| Parsed_config_set of config_set_opts
| Parsed_config_unset of config_unset_opts
type action =
| Sync_status of { repo : Cli_primitive.repo; graph : Cli_primitive.graph }
| Sync_start of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
e2ee_password : string option;
}
| Sync_stop of { repo : Cli_primitive.repo; graph : Cli_primitive.graph }
| Sync_upload of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
e2ee_password : string option;
}
| Sync_download of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
progress : bool;
progress_explicit : bool;
e2ee_password : string option;
allow_missing_graph : bool;
require_missing_graph : bool;
}
| Sync_asset_download of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
id : Cli_primitive.db_id option;
uuid : Cli_primitive.uuid option;
}
| Sync_remote_graphs
| Sync_ensure_keys of { e2ee_password : string option; upload_keys : bool }
| Sync_grant_access of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
graph_id : Cli_primitive.uuid;
email : Cli_primitive.email;
}
| Sync_config_get of { key : config_key }
| Sync_config_set of { key : config_key; value : string }
| Sync_config_unset of { key : config_key }
type remote_graph = {
graph_id : Cli_primitive.uuid;
graph_name : Cli_primitive.graph;
graph_e2ee : bool;
raw : Melange_edn_melange.any;
}
type sync_status = {
ws_state : Cli_primitive.keyword option;
graph_id : Cli_primitive.uuid option;
last_error : Melange_edn_melange.any option;
raw : Melange_edn_melange.any;
}
val config_key_of_string : string -> config_key option
val string_of_config_key : config_key -> string
include Command_spec.S with type parsed := parsed and type action := action

View File

@@ -0,0 +1,180 @@
type mode = Create | Update | Page
type block_opts = {
id : Cli_primitive.db_id option;
uuid : Cli_primitive.uuid option;
target_id : Cli_primitive.db_id option;
target_uuid : Cli_primitive.uuid option;
target_page : string option;
pos : Block.position option;
content : string option;
blocks_edn : string option;
blocks_file : Cli_primitive.path option;
update_tags_edn : string option;
update_properties_edn : string option;
remove_tags_edn : string option;
remove_properties_edn : string option;
}
type page_opts = {
id : Cli_primitive.db_id option;
page : string option;
restore : bool;
update_tags_edn : string option;
update_properties_edn : string option;
remove_tags_edn : string option;
remove_properties_edn : string option;
}
type task_opts = {
id : Cli_primitive.db_id option;
uuid : Cli_primitive.uuid option;
page : string option;
content : string option;
target_id : Cli_primitive.db_id option;
target_uuid : Cli_primitive.uuid option;
target_page : string option;
pos : Block.position option;
status : string option;
priority : string option;
scheduled : Time.date option;
deadline : Time.date option;
no_status : bool;
no_priority : bool;
no_scheduled : bool;
no_deadline : bool;
}
type asset_opts = {
id : Cli_primitive.db_id option;
uuid : Cli_primitive.uuid option;
path : Cli_primitive.path option;
target_id : Cli_primitive.db_id option;
target_uuid : Cli_primitive.uuid option;
target_page : string option;
pos : Block.position option;
content : string option;
}
type tag_opts = {
id : Cli_primitive.db_id option;
name : string option;
add_properties_edn : string option;
remove_properties_edn : string option;
}
type property_opts = {
id : Cli_primitive.db_id option;
name : string option;
kind : Property.kind option;
cardinality : Property.cardinality option;
hide : bool option;
public : bool option;
}
type parsed =
| Parsed_block of block_opts
| Parsed_page of page_opts
| Parsed_task of task_opts
| Parsed_asset of asset_opts
| Parsed_tag of tag_opts
| Parsed_property of property_opts
type block_target =
| Target_id of Cli_primitive.db_id
| Target_uuid of Cli_primitive.uuid
| Target_page of string
type block_source =
| Source_id of Cli_primitive.db_id
| Source_uuid of Cli_primitive.uuid
type block_create = {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
target : block_target;
pos : Block.position;
status : Cli_primitive.keyword option;
tags : Selector.tag Rrbvec.t;
properties : Property.assignment Rrbvec.t;
blocks : Block.t Rrbvec.t;
update_plan : Property.update_plan;
}
type block_update = {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
source : block_source;
target : block_target option;
pos : Block.position option;
update_tags : Selector.tag Rrbvec.t;
update_properties : Property.assignment Rrbvec.t;
remove_tags : Selector.tag Rrbvec.t;
remove_properties : Property.key Rrbvec.t;
content : string option;
source_label : string option;
target_label : string option;
}
type block_action =
| Block_create of block_create
| Block_update of block_update
type action =
| Upsert_block of block_action
| Upsert_page of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
mode : mode;
id : Cli_primitive.db_id option;
page : string option;
restore : bool;
plan : Property.update_plan;
}
| Upsert_task of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
mode : mode;
id : Cli_primitive.db_id option;
uuid : Cli_primitive.uuid option;
page : string option;
content : string option;
update_properties : Property.assignment Rrbvec.t;
clear_properties : Property.key Rrbvec.t;
status_input : string option;
}
| Upsert_asset of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
mode : mode;
id : Cli_primitive.db_id option;
uuid : Cli_primitive.uuid option;
path : Cli_primitive.path option;
content : string option;
create_action : block_create option;
}
| Upsert_tag of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
mode : mode;
id : Cli_primitive.db_id option;
name : string option;
add_properties : Property.key Rrbvec.t;
remove_properties : Property.key Rrbvec.t;
}
| Upsert_property of {
repo : Cli_primitive.repo;
graph : Cli_primitive.graph;
mode : mode;
id : Cli_primitive.db_id option;
name : string option;
schema : Property.schema;
}
val update_mode : block_opts -> bool
val invalid_options : parsed -> string option
include Command_spec.S with type parsed := parsed and type action := action
val repo : action -> Cli_primitive.repo
val graph : action -> Cli_primitive.graph