mirror of
https://github.com/Dasemu/Synapse.git
synced 2026-11-27 15:56:43 +00:00
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:
commit
40631362b3
2016 files changed
+543898
No files matched your search
@@ -0,0 +1,26 @@
|
||||
# Spec Layout
|
||||
|
||||
The spec virtual library is organized by capability boundary instead of an
|
||||
abstract layer number.
|
||||
|
||||
Dependency direction:
|
||||
|
||||
```text
|
||||
core -> domain -> runtime/formatting -> commands -> cli
|
||||
```
|
||||
|
||||
Rules:
|
||||
|
||||
- `core` contains primitive shared contracts and must not depend on other spec
|
||||
groups.
|
||||
- `domain` contains Logseq domain model contracts and may depend on `core`.
|
||||
- `runtime` contains external runtime boundaries such as transport, server, and
|
||||
auth state. It may depend on `core` and `domain`.
|
||||
- `formatting` contains presentation and shared formatting contracts. It may
|
||||
depend on `core` and `domain`.
|
||||
- `commands` contains command contracts. It may depend on `core`, `domain`,
|
||||
`runtime`, and `formatting`.
|
||||
- `cli` contains top-level CLI assembly contracts. It may depend on lower groups.
|
||||
- Command modules should not depend on each other. Move shared command data to
|
||||
`domain` or a clearly named shared contract before adding cross-command
|
||||
dependencies.
|
||||
@@ -0,0 +1,68 @@
|
||||
type run_input = {
|
||||
argv : string Rrbvec.t;
|
||||
env : (string * string) Rrbvec.t;
|
||||
cwd : Cli_primitive.path;
|
||||
stdin : string option;
|
||||
}
|
||||
(** Top-level CLI lifecycle contract. *)
|
||||
|
||||
val env_lookup : (string * string) Rrbvec.t -> Cli_config.env
|
||||
|
||||
type raw_argv
|
||||
type parsed_argv
|
||||
type resolved_config
|
||||
type built_action
|
||||
type executed_action
|
||||
type error
|
||||
type final
|
||||
type not_final
|
||||
|
||||
type app_context = private {
|
||||
registry : Command_registry.t;
|
||||
defaults : Cli_config.defaults;
|
||||
}
|
||||
|
||||
type ('phase, 'final) state = private
|
||||
| Raw_argv_state : run_input -> (raw_argv, not_final) state
|
||||
| Parsed_argv_state :
|
||||
(run_input * Cli_request.t)
|
||||
-> (parsed_argv, not_final) state
|
||||
| Resolved_config_state :
|
||||
(Cli_config.t * Cli_request.t)
|
||||
-> (resolved_config, not_final) state
|
||||
| Built_action_state :
|
||||
(Cli_config.t * Cli_action.t)
|
||||
-> (built_action, not_final) state
|
||||
| Executed_action_state :
|
||||
(Cli_config.t * Cli_result.t)
|
||||
-> (executed_action, final) state
|
||||
| Error_state : Error.t -> (error, final) state
|
||||
|
||||
val make_app_context : ?version:string -> unit -> app_context
|
||||
val make_error_state : Error.t -> (error, final) state
|
||||
|
||||
val make_raw_argv_state :
|
||||
app_context -> run_input -> (raw_argv, not_final) state
|
||||
|
||||
val parse_args :
|
||||
app_context ->
|
||||
(raw_argv, _) state ->
|
||||
(parsed_argv, not_final) state Error.build_result
|
||||
|
||||
val resolve_config :
|
||||
app_context ->
|
||||
(parsed_argv, _) state ->
|
||||
(resolved_config, not_final) state Error.build_result Cli_effect.t
|
||||
|
||||
val build_action :
|
||||
app_context ->
|
||||
(resolved_config, _) state ->
|
||||
(built_action, not_final) state Error.build_result Cli_effect.t
|
||||
|
||||
val execute_action :
|
||||
app_context ->
|
||||
(built_action, _) state ->
|
||||
(executed_action, final) state Error.build_result Cli_effect.t
|
||||
|
||||
val format_result : app_context -> (executed_action, final) state -> string
|
||||
val final_effect : (_, final) state -> int Cli_effect.t
|
||||
@@ -0,0 +1,24 @@
|
||||
type t =
|
||||
| Version
|
||||
| Graph of Graph.action
|
||||
| List of List_command.action
|
||||
| Upsert of Upsert.action
|
||||
| Remove of Remove.action
|
||||
| Search of Search.action
|
||||
| Query of Query.action
|
||||
| Show of Show.action
|
||||
| Server of Server_command.action
|
||||
| Sync of Sync.action
|
||||
| Auth of Auth_command.action
|
||||
| Agent of Agent.action
|
||||
| Doctor of Doctor.action
|
||||
| Debug of Debug.action
|
||||
| Skill of Skill.action
|
||||
| Completion of Completion.action
|
||||
| Example of Example.action
|
||||
|
||||
val build : Cli_config.t -> Cli_request.t -> t Error.build_result Cli_effect.t
|
||||
val execute : t -> Cli_config.t -> Cli_result.t Cli_effect.t
|
||||
val requires_missing_graph : t -> bool
|
||||
val repo : t -> Cli_primitive.repo option
|
||||
val graph : t -> Cli_primitive.graph option
|
||||
@@ -0,0 +1,64 @@
|
||||
type env = string -> string option
|
||||
|
||||
type defaults = {
|
||||
timeout_span : Time.span;
|
||||
login_timeout_span : Time.span;
|
||||
logout_timeout_span : Time.span;
|
||||
list_title_max_display_width : int;
|
||||
root_dir : Cli_primitive.path;
|
||||
ws_url : Cli_primitive.url;
|
||||
http_base : Cli_primitive.url;
|
||||
}
|
||||
|
||||
type t = {
|
||||
graph : Cli_primitive.graph option;
|
||||
repo : Cli_primitive.repo option;
|
||||
root_dir : Cli_primitive.path;
|
||||
config_path : Cli_primitive.path;
|
||||
timeout_span : Time.span;
|
||||
login_timeout_span : Time.span;
|
||||
logout_timeout_span : Time.span;
|
||||
list_title_max_display_width : int;
|
||||
output_format : Output.Mode.packed option;
|
||||
verbose : bool;
|
||||
profile : bool;
|
||||
ws_url : Cli_primitive.url option;
|
||||
http_base : Cli_primitive.url option;
|
||||
auth_path : Cli_primitive.path option;
|
||||
id_token : string option;
|
||||
access_token : string option;
|
||||
refresh_token : string option;
|
||||
base_url : Cli_primitive.url option;
|
||||
owner_source : Cli_primitive.owner_source;
|
||||
project_dir : Cli_primitive.path option;
|
||||
raw_file_config : Melange_edn_melange.any option;
|
||||
profile_session : Profile_types.session option;
|
||||
}
|
||||
|
||||
type source = Defaults | Env | File of Cli_primitive.path | Argv
|
||||
type resolved = { config : t; sources : source Rrbvec.t }
|
||||
|
||||
val default_root_dir : unit -> Cli_primitive.path
|
||||
val default_config_path : Cli_primitive.path -> Cli_primitive.path
|
||||
val defaults : unit -> defaults
|
||||
|
||||
val read_config_file :
|
||||
Cli_primitive.path -> Melange_edn_melange.any option Error.build_result
|
||||
|
||||
val env_config : env -> Melange_edn_melange.map Melange_edn_melange.t
|
||||
val sanitize_file_config : Melange_edn_melange.any -> Melange_edn_melange.any
|
||||
|
||||
val resolve :
|
||||
defaults:defaults ->
|
||||
env:env ->
|
||||
Global_opts.t ->
|
||||
resolved Error.build_result Cli_effect.t
|
||||
|
||||
val update_config :
|
||||
t ->
|
||||
Melange_edn_melange.any ->
|
||||
Melange_edn_melange.map Melange_edn_melange.t Error.build_result Cli_effect.t
|
||||
|
||||
val graph_to_repo : Cli_primitive.graph -> Cli_primitive.repo
|
||||
val repo_to_graph : Cli_primitive.repo -> Cli_primitive.graph
|
||||
val pick_graph : t -> Global_opts.t -> Cli_primitive.graph option
|
||||
@@ -0,0 +1,34 @@
|
||||
type parsed_command =
|
||||
| Version
|
||||
| Graph of Graph.parsed
|
||||
| List of List_command.parsed
|
||||
| Upsert of Upsert.parsed
|
||||
| Remove of Remove.parsed
|
||||
| Search of Search.parsed
|
||||
| Query of Query.parsed
|
||||
| Show of Show.parsed
|
||||
| Server of Server_command.parsed
|
||||
| Sync of Sync.parsed
|
||||
| Auth of Auth_command.parsed
|
||||
| Agent of Agent.parsed
|
||||
| Doctor of Doctor.parsed
|
||||
| Debug of Debug.parsed
|
||||
| Skill of Skill.parsed
|
||||
| Completion of Completion.parsed
|
||||
| Example of Example.parsed
|
||||
|
||||
type t = {
|
||||
globals : Global_opts.t;
|
||||
path : string Rrbvec.t;
|
||||
command : parsed_command;
|
||||
raw_args : string Rrbvec.t;
|
||||
}
|
||||
|
||||
val make :
|
||||
globals:Global_opts.t ->
|
||||
path:string Rrbvec.t ->
|
||||
command:parsed_command ->
|
||||
raw_args:string Rrbvec.t ->
|
||||
t
|
||||
|
||||
val command_id : t -> Command_id.t
|
||||
@@ -0,0 +1,42 @@
|
||||
type status = Ok | Error
|
||||
|
||||
type ok_data =
|
||||
| Message of string
|
||||
| Items of Melange_edn_melange.any Rrbvec.t
|
||||
| Entity of Melange_edn_melange.any
|
||||
| Query_result of Melange_edn_melange.any
|
||||
| Raw of Melange_edn_melange.any
|
||||
| Empty
|
||||
|
||||
type error_data = Error.t
|
||||
|
||||
type t = private {
|
||||
status : status;
|
||||
data : ok_data option;
|
||||
error : error_data option;
|
||||
command : Command_id.t option;
|
||||
context : Melange_edn_melange.any option;
|
||||
output : 'o. 'o Output.Mode.t -> 'o Output.t;
|
||||
exit_code : int option;
|
||||
human_table_headers_order : string Rrbvec.t;
|
||||
}
|
||||
|
||||
val ok :
|
||||
?command:Command_id.t ->
|
||||
?context:Melange_edn_melange.any ->
|
||||
'o Output.Mode.t ->
|
||||
ok_data ->
|
||||
t
|
||||
|
||||
val error :
|
||||
?command:Command_id.t ->
|
||||
?context:Melange_edn_melange.any ->
|
||||
'o Output.Mode.t ->
|
||||
Error.t ->
|
||||
t
|
||||
|
||||
val is_error : t -> bool
|
||||
val exit_code : t -> int
|
||||
val data_value : t -> Melange_edn_melange.any option
|
||||
val with_command : Command_id.t -> t -> t
|
||||
val with_human_table_headers_order : string Rrbvec.t -> t -> t
|
||||
@@ -0,0 +1,69 @@
|
||||
type t =
|
||||
| Version
|
||||
| Graph_list
|
||||
| Graph_create
|
||||
| Graph_switch
|
||||
| Graph_remove
|
||||
| Graph_validate
|
||||
| Graph_info
|
||||
| Graph_backup_list
|
||||
| Graph_backup_create
|
||||
| Graph_backup_restore
|
||||
| Graph_backup_remove
|
||||
| Graph_export
|
||||
| Graph_import
|
||||
| Server_list
|
||||
| Server_cleanup
|
||||
| Server_start
|
||||
| Server_stop
|
||||
| Server_restart
|
||||
| List_page
|
||||
| List_tag
|
||||
| List_property
|
||||
| List_task
|
||||
| List_node
|
||||
| List_asset
|
||||
| Search_block
|
||||
| Search_page
|
||||
| Search_property
|
||||
| Search_tag
|
||||
| Upsert_block
|
||||
| Upsert_page
|
||||
| Upsert_task
|
||||
| Upsert_asset
|
||||
| Upsert_tag
|
||||
| Upsert_property
|
||||
| Remove_block
|
||||
| Remove_page
|
||||
| Remove_tag
|
||||
| Remove_property
|
||||
| Query
|
||||
| Query_list
|
||||
| Show
|
||||
| Debug_pull
|
||||
| Doctor
|
||||
| Sync_status
|
||||
| Sync_start
|
||||
| Sync_stop
|
||||
| Sync_upload
|
||||
| Sync_download
|
||||
| Sync_asset_download
|
||||
| Sync_remote_graphs
|
||||
| Sync_ensure_keys
|
||||
| Sync_grant_access
|
||||
| Sync_config_get
|
||||
| Sync_config_set
|
||||
| Sync_config_unset
|
||||
| Login
|
||||
| Logout
|
||||
| Completion
|
||||
| Skill_show
|
||||
| Skill_install
|
||||
| Example
|
||||
| Agent_bridge
|
||||
|
||||
val to_string : t -> string
|
||||
val to_path : t -> string Rrbvec.t
|
||||
val is_write : t -> bool
|
||||
val requires_graph : t -> bool
|
||||
val requires_auth : t -> bool
|
||||
@@ -0,0 +1,51 @@
|
||||
type category =
|
||||
| Graph_inspect_and_edit
|
||||
| Graph_management
|
||||
| Authentication
|
||||
| Utilities
|
||||
| Hidden
|
||||
|
||||
type option_arity = Flag | Required_value of string | Optional_value of string
|
||||
|
||||
type option_meta = {
|
||||
names : string Rrbvec.t;
|
||||
arity : option_arity;
|
||||
doc : string;
|
||||
required : bool;
|
||||
repeatable : bool;
|
||||
choices : string Rrbvec.t;
|
||||
(* value is a comma-separated list; choices complete each list element *)
|
||||
multi : bool;
|
||||
default : string option;
|
||||
}
|
||||
|
||||
type command_meta = {
|
||||
id : Command_id.t;
|
||||
path : string Rrbvec.t;
|
||||
doc : string;
|
||||
long_doc : string option;
|
||||
examples : string Rrbvec.t;
|
||||
options : option_meta Rrbvec.t;
|
||||
category : category;
|
||||
requires_graph : bool;
|
||||
requires_auth : bool;
|
||||
write_command : bool;
|
||||
(* headers order when print table in human output *)
|
||||
human_table_headers_order : string Rrbvec.t;
|
||||
}
|
||||
|
||||
type group_meta = {
|
||||
name : string;
|
||||
doc : string;
|
||||
category : category;
|
||||
children : string Rrbvec.t Rrbvec.t;
|
||||
}
|
||||
|
||||
type t = { commands : command_meta Rrbvec.t; groups : group_meta Rrbvec.t }
|
||||
|
||||
val empty : t
|
||||
val make : command_meta Rrbvec.t -> t
|
||||
val add : command_meta -> t -> t
|
||||
val find_by_path : string Rrbvec.t -> t -> command_meta option
|
||||
val global_options : option_meta Rrbvec.t
|
||||
val render_help : ?group:string Rrbvec.t -> t -> string
|
||||
@@ -0,0 +1,19 @@
|
||||
(** Shared command lifecycle signature for CLI command families. *)
|
||||
|
||||
module type S = sig
|
||||
type parsed
|
||||
type action
|
||||
|
||||
val command_id : parsed -> Command_id.t
|
||||
val validate_parsed : parsed -> unit Error.build_result
|
||||
|
||||
val build :
|
||||
?registry:Command_registry.t ->
|
||||
Cli_config.t ->
|
||||
Global_opts.t ->
|
||||
parsed ->
|
||||
action Error.build_result
|
||||
|
||||
val execute : action -> Cli_config.t -> Cli_result.t Cli_effect.t
|
||||
val metadata : unit -> Command_registry.command_meta Rrbvec.t
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
type t = private {
|
||||
graph : Cli_primitive.graph option;
|
||||
root_dir : Cli_primitive.path option;
|
||||
config_path : Cli_primitive.path option;
|
||||
timeout_span : Time.span option;
|
||||
output_format : Output.Mode.packed option;
|
||||
verbose : bool;
|
||||
profile : bool;
|
||||
}
|
||||
|
||||
val create :
|
||||
?graph:Cli_primitive.graph ->
|
||||
?root_dir:Cli_primitive.path ->
|
||||
?config_path:Cli_primitive.path ->
|
||||
?timeout_span:Time.span ->
|
||||
?output_format:Output.Mode.packed ->
|
||||
?verbose:bool ->
|
||||
?profile:bool ->
|
||||
unit ->
|
||||
t
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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 *)
|
||||
@@ -0,0 +1,27 @@
|
||||
type position = First_child | Last_child | Sibling
|
||||
|
||||
type t = {
|
||||
id : Cli_primitive.db_id option;
|
||||
uuid : Cli_primitive.uuid option;
|
||||
title : string option;
|
||||
name : string option;
|
||||
order : int option;
|
||||
parent : Selector.block option;
|
||||
page : Selector.page option;
|
||||
tags : Selector.tag Rrbvec.t;
|
||||
properties : Property.assignment Rrbvec.t;
|
||||
children : t Rrbvec.t;
|
||||
raw : Melange_edn_melange.any;
|
||||
}
|
||||
|
||||
type tree = { root : t }
|
||||
|
||||
val position_of_string : string -> position option
|
||||
|
||||
val make :
|
||||
?uuid:Cli_primitive.uuid -> ?title:string -> ?children:t Rrbvec.t -> unit -> t
|
||||
|
||||
val of_value : Melange_edn_melange.any -> t
|
||||
val to_value : t -> Melange_edn_melange.map Melange_edn_melange.t
|
||||
val flatten : t Rrbvec.t -> t Rrbvec.t
|
||||
val label : t -> string option
|
||||
@@ -0,0 +1,17 @@
|
||||
type kind = Page | Block | Tag | Property | Task | Asset | Unknown
|
||||
|
||||
type t = {
|
||||
id : Cli_primitive.db_id option;
|
||||
uuid : Cli_primitive.uuid option;
|
||||
ident : Cli_primitive.keyword option;
|
||||
name : string option;
|
||||
title : string option;
|
||||
kind : kind;
|
||||
tags : Cli_primitive.keyword Rrbvec.t;
|
||||
created_at : Time.date option;
|
||||
updated_at : Time.date option;
|
||||
deleted_at : Time.date option;
|
||||
raw : Melange_edn_melange.any;
|
||||
}
|
||||
|
||||
val of_value : Melange_edn_melange.any -> t
|
||||
@@ -0,0 +1,11 @@
|
||||
type graph_item_kind = Canonical | Legacy | Legacy_undecodable
|
||||
|
||||
type graph_item = {
|
||||
kind : graph_item_kind;
|
||||
graph_name : Cli_primitive.graph option;
|
||||
graph_dir : Cli_primitive.path option;
|
||||
legacy_dir : Cli_primitive.path option;
|
||||
target_graph_dir : Cli_primitive.path option;
|
||||
conflict : bool;
|
||||
reason : Cli_primitive.keyword option;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
type parsed = { ids : Cli_primitive.db_id Rrbvec.t; multi : bool }
|
||||
|
||||
val valid_id : Cli_primitive.db_id -> bool
|
||||
val parse_id_string : string -> parsed Error.build_result
|
||||
val to_single : parsed -> Cli_primitive.db_id option
|
||||
@@ -0,0 +1,42 @@
|
||||
type key =
|
||||
| Key_ident of Cli_primitive.keyword
|
||||
| Key_id of Cli_primitive.db_id
|
||||
| Key_name of string
|
||||
|
||||
type cardinality = One | Many
|
||||
|
||||
type kind =
|
||||
| Default
|
||||
| Page
|
||||
| Class
|
||||
| Property
|
||||
| Entity
|
||||
| Node
|
||||
| Date
|
||||
| Url
|
||||
| Checkbox
|
||||
| Number
|
||||
| Template
|
||||
| Other of Cli_primitive.keyword
|
||||
|
||||
type schema = {
|
||||
kind : kind option;
|
||||
cardinality : cardinality option;
|
||||
hidden : bool option;
|
||||
public : bool option;
|
||||
}
|
||||
|
||||
type assignment = { key : key; value : Melange_edn_melange.any }
|
||||
|
||||
type update_plan = {
|
||||
update_tags : Selector.tag Rrbvec.t;
|
||||
remove_tags : Selector.tag Rrbvec.t;
|
||||
update_properties : assignment Rrbvec.t;
|
||||
remove_properties : key Rrbvec.t;
|
||||
}
|
||||
|
||||
val empty_update_plan : update_plan
|
||||
val parse_key : Melange_edn_melange.any -> key option
|
||||
val kind_of_string : string -> kind option
|
||||
val string_of_kind : kind -> string
|
||||
val cardinality_of_string : string -> cardinality option
|
||||
@@ -0,0 +1,26 @@
|
||||
type block =
|
||||
| Block_id of Cli_primitive.db_id
|
||||
| Block_uuid of Cli_primitive.uuid
|
||||
|
||||
type page =
|
||||
| Page_id of Cli_primitive.db_id
|
||||
| Page_name of string
|
||||
| Page_uuid of Cli_primitive.uuid
|
||||
|
||||
type property =
|
||||
| Property_id of Cli_primitive.db_id
|
||||
| Property_ident of Cli_primitive.keyword
|
||||
| Property_name of string
|
||||
| Property_uuid of Cli_primitive.uuid
|
||||
|
||||
type tag =
|
||||
| Tag_id of Cli_primitive.db_id
|
||||
| Tag_name of string
|
||||
| Tag_ident of Cli_primitive.keyword
|
||||
| Tag_uuid of Cli_primitive.uuid
|
||||
|
||||
type entity =
|
||||
| Entity_id of Cli_primitive.db_id
|
||||
| Entity_uuid of Cli_primitive.uuid
|
||||
| Entity_ident of Cli_primitive.keyword
|
||||
| Entity_name of string
|
||||
@@ -0,0 +1,12 @@
|
||||
type status = { ident : Cli_primitive.keyword; value : string }
|
||||
|
||||
val status_closed_values_query :
|
||||
Melange_edn_melange.vector Melange_edn_melange.t
|
||||
|
||||
val normalize_available_statuses :
|
||||
Melange_edn_melange.any Rrbvec.t -> status Rrbvec.t
|
||||
|
||||
val resolve_status_ident :
|
||||
string -> status Rrbvec.t -> Cli_primitive.keyword option
|
||||
|
||||
val invalid_status_message : string -> status Rrbvec.t -> string
|
||||
@@ -0,0 +1,79 @@
|
||||
(include_subdirs unqualified)
|
||||
|
||||
(library
|
||||
(name logseq_cli_platform_spec)
|
||||
(wrapped false)
|
||||
(modes melange)
|
||||
(libraries melange-fetch rrbvec)
|
||||
(modules Cli_effect Cli_platform Cli_unix)
|
||||
(virtual_modules Cli_effect Cli_platform Cli_unix))
|
||||
|
||||
(library
|
||||
(name logseq_cli_spec)
|
||||
(wrapped false)
|
||||
(modes melange)
|
||||
(libraries
|
||||
melange.js
|
||||
melange-fetch
|
||||
melange-edn-melange
|
||||
rrbvec
|
||||
logseq_cli_platform_spec)
|
||||
(modules
|
||||
(:standard \ Cli_effect Cli_platform Cli_unix))
|
||||
(modules_without_implementation Command_spec)
|
||||
(virtual_modules
|
||||
; core
|
||||
Cli_primitive
|
||||
Error
|
||||
Output
|
||||
Time
|
||||
Ustring
|
||||
; domain
|
||||
Selector
|
||||
Property
|
||||
Entity
|
||||
Block
|
||||
Id_parse
|
||||
Task_status
|
||||
Graph_types
|
||||
; runtime
|
||||
Transport
|
||||
Server_runtime
|
||||
Auth_state
|
||||
; formatting
|
||||
Profile_types
|
||||
Log_types
|
||||
Style_types
|
||||
Humanize_types
|
||||
Root_dir_types
|
||||
Uuid_refs_types
|
||||
Tree_text_types
|
||||
Db_worker_types
|
||||
Common_cli_types
|
||||
Pretty_print
|
||||
; cli
|
||||
Global_opts
|
||||
Cli_config
|
||||
Cli_result
|
||||
Cli_request
|
||||
Cli_action
|
||||
Cli
|
||||
Command_id
|
||||
Command_registry
|
||||
; commands
|
||||
Graph
|
||||
List_command
|
||||
Upsert
|
||||
Remove
|
||||
Search
|
||||
Query
|
||||
Show
|
||||
Server_command
|
||||
Sync
|
||||
Auth_command
|
||||
Agent
|
||||
Doctor
|
||||
Debug
|
||||
Skill
|
||||
Completion
|
||||
Example))
|
||||
Whitespace-only changes.
@@ -0,0 +1,19 @@
|
||||
type list_options = Melange_edn_melange.any
|
||||
|
||||
type page_filter = {
|
||||
expand : bool;
|
||||
include_hidden : bool;
|
||||
include_built_in : bool;
|
||||
include_journal : bool;
|
||||
journal_only : bool;
|
||||
created_after : Time.date option;
|
||||
updated_after : Time.date option;
|
||||
}
|
||||
|
||||
type node_filter = {
|
||||
tag_ids : Cli_primitive.db_id Rrbvec.t;
|
||||
property_idents : Cli_primitive.keyword Rrbvec.t;
|
||||
}
|
||||
|
||||
val minimal_list_item :
|
||||
Entity.t -> Melange_edn_melange.map Melange_edn_melange.t
|
||||
@@ -0,0 +1,5 @@
|
||||
val format_count : int -> string
|
||||
val pluralize_noun : int -> string -> string
|
||||
val format_count_with_noun : int -> string -> string
|
||||
val datetime : now:int64 -> ?suffix:string -> ?prefix:string -> int64 -> string
|
||||
val relative_datetime : then_time:Time.date -> now_time:Time.date -> string
|
||||
@@ -0,0 +1,13 @@
|
||||
type preview = { preview : string; length : int; truncated : bool }
|
||||
type level = Debug | Info | Warn | Error
|
||||
|
||||
type record = {
|
||||
time : Time.date option;
|
||||
level : level;
|
||||
logger : string option;
|
||||
message : string;
|
||||
exception_ : string option;
|
||||
}
|
||||
|
||||
val truncate_preview : ?max_len:int -> Melange_edn_melange.any -> preview
|
||||
val install_stderr_handler : unit -> unit
|
||||
@@ -0,0 +1,2 @@
|
||||
val pprint_edn : Melange_edn_melange.any -> string
|
||||
val pprint_json : Js.Json.t -> string
|
||||
@@ -0,0 +1,33 @@
|
||||
type span = {
|
||||
stage : string;
|
||||
span_id : int;
|
||||
start_time : Time.date;
|
||||
end_time : Time.date;
|
||||
elapsed_span : Time.span;
|
||||
}
|
||||
|
||||
type stage_summary = {
|
||||
stage : string;
|
||||
count : int;
|
||||
total_span : Time.span;
|
||||
avg_span : Time.span;
|
||||
}
|
||||
|
||||
type session
|
||||
|
||||
type report = {
|
||||
command : string;
|
||||
status : Cli_primitive.keyword;
|
||||
total_span : Time.span;
|
||||
spans : span Rrbvec.t;
|
||||
stages : stage_summary Rrbvec.t;
|
||||
}
|
||||
|
||||
val create_session : bool -> session option
|
||||
|
||||
val time :
|
||||
session option -> string -> (unit -> 'a Cli_effect.t) -> 'a Cli_effect.t
|
||||
|
||||
val record_span : session -> span -> unit
|
||||
val report : session -> command:string -> status:Cli_primitive.keyword -> report
|
||||
val render_lines : report -> string Rrbvec.t
|
||||
@@ -0,0 +1,5 @@
|
||||
val default_root_dir : unit -> Cli_primitive.path
|
||||
val normalize_root_dir : Cli_primitive.path option -> Cli_primitive.path
|
||||
|
||||
val ensure_root_dir :
|
||||
Cli_primitive.path option -> Cli_primitive.path Error.build_result
|
||||
Whitespace-only changes.
@@ -0,0 +1,6 @@
|
||||
type render_options = {
|
||||
uuid_labels : (Cli_primitive.uuid * string) Rrbvec.t;
|
||||
property_titles : (Cli_primitive.keyword * string) Rrbvec.t;
|
||||
property_value_labels : (Melange_edn_melange.any * string) Rrbvec.t;
|
||||
show_ids : bool;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
type uuid_label = {
|
||||
uuid : Cli_primitive.uuid;
|
||||
id : Cli_primitive.db_id option;
|
||||
label : string option;
|
||||
}
|
||||
|
||||
val unique_preserve_order : 'a Rrbvec.t -> 'a Rrbvec.t
|
||||
val extract_wiki_refs : string -> string Rrbvec.t
|
||||
val extract_uuid_refs : string -> Cli_primitive.uuid Rrbvec.t
|
||||
|
||||
val replace_uuid_refs :
|
||||
string -> (Cli_primitive.uuid * string) Rrbvec.t -> string
|
||||
|
||||
val collect_uuid_refs_from_strings :
|
||||
string Rrbvec.t -> Cli_primitive.uuid Rrbvec.t
|
||||
|
||||
val collect_uuid_refs_from_items :
|
||||
Entity.t Rrbvec.t ->
|
||||
Cli_primitive.keyword Rrbvec.t ->
|
||||
Cli_primitive.uuid Rrbvec.t
|
||||
|
||||
val normalize_item_string_fields :
|
||||
Entity.t Rrbvec.t ->
|
||||
Cli_primitive.keyword Rrbvec.t ->
|
||||
(Cli_primitive.uuid * string) Rrbvec.t ->
|
||||
Entity.t Rrbvec.t
|
||||
|
||||
val fetch_uuid_entities :
|
||||
Cli_config.t ->
|
||||
Cli_primitive.repo ->
|
||||
Cli_primitive.uuid Rrbvec.t ->
|
||||
uuid_label Rrbvec.t Cli_effect.t
|
||||
|
||||
val fetch_uuid_labels :
|
||||
Cli_config.t ->
|
||||
Cli_primitive.repo ->
|
||||
Cli_primitive.uuid Rrbvec.t ->
|
||||
(Cli_primitive.uuid * string) Rrbvec.t Cli_effect.t
|
||||
@@ -0,0 +1,24 @@
|
||||
(** Runtime effect abstraction. *)
|
||||
|
||||
type 'a t
|
||||
type 'a resolver
|
||||
|
||||
val pure : 'a -> 'a t
|
||||
val error : exn -> 'a t
|
||||
val map : ('a -> 'b) -> 'a t -> 'b t
|
||||
val map_s : ('a -> 'b t) -> 'a Rrbvec.t -> 'b Rrbvec.t t
|
||||
val bind : 'a t -> ('a -> 'b t) -> 'b t
|
||||
val both : 'a t -> 'b t -> ('a * 'b) t
|
||||
val all : 'a t Rrbvec.t -> 'a Rrbvec.t t
|
||||
val catch : 'a t -> (exn -> 'a t) -> 'a t
|
||||
val finally : 'a t -> (unit -> unit t) -> 'a t
|
||||
val sleep : float -> unit t
|
||||
val wait : unit -> 'a t * 'a resolver
|
||||
val wakeup : 'a resolver -> 'a -> unit
|
||||
val is_pending : 'a t -> bool
|
||||
val async : (unit -> unit t) -> unit
|
||||
val on_any : 'a t -> ('a -> unit) -> (exn -> unit) -> unit
|
||||
|
||||
module Infix : sig
|
||||
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
|
||||
end
|
||||
@@ -0,0 +1,50 @@
|
||||
val hostname : unit -> string
|
||||
val argv : unit -> string array
|
||||
|
||||
type login_callback_request = { target : string option }
|
||||
type login_callback_response = { status : int; body : string }
|
||||
|
||||
type login_callback_server_error =
|
||||
| Login_callback_timeout
|
||||
| Login_callback_server_start_failed of string
|
||||
| Login_callback_server_aborted of string
|
||||
|
||||
val login_callback_server :
|
||||
host:string ->
|
||||
port:int ->
|
||||
timeout_span:float ->
|
||||
on_listen:(unit -> (unit, string) result Cli_effect.t) ->
|
||||
handle_request:(login_callback_request -> login_callback_response * 'result) ->
|
||||
('result, login_callback_server_error) result Cli_effect.t
|
||||
|
||||
module Symbols : sig
|
||||
val ellipsis : string
|
||||
val linked_arrow : string
|
||||
val tree_last : string
|
||||
val tree_middle : string
|
||||
val tree_pipe : string
|
||||
end
|
||||
|
||||
module HTTP : sig
|
||||
val request :
|
||||
?timeout_span:float ->
|
||||
Fetch.requestMethod ->
|
||||
string ->
|
||||
headers:(string * string) Rrbvec.t ->
|
||||
body:string ->
|
||||
(Fetch.Response.t * string) Cli_effect.t
|
||||
end
|
||||
|
||||
module Crypto : sig
|
||||
val sha256_hex : string -> string
|
||||
val sha256_base64url : string -> string
|
||||
val random_base64url : int -> string
|
||||
val base64url_decode : string -> string
|
||||
end
|
||||
|
||||
module Events : sig
|
||||
type subscription = { close : unit -> unit Cli_effect.t }
|
||||
|
||||
val connect :
|
||||
url:string -> on_chunk:(string -> unit) -> subscription Cli_effect.t
|
||||
end
|
||||
@@ -0,0 +1,53 @@
|
||||
type error = EAGAIN | EWOULDBLOCK | ETIMEDOUT | ESRCH | EPERM
|
||||
type access_permission = R_OK | W_OK
|
||||
type open_flag = O_RDWR
|
||||
type file_descr = int
|
||||
type stats = { st_size : int; st_mtime : float }
|
||||
type process_result = { status : int; stdout : string; stderr : string }
|
||||
type mkdir_result = Created | Already_exists
|
||||
|
||||
exception Cli_unix_error of error * string * string
|
||||
|
||||
val mkdir : string -> int -> unit
|
||||
val rmdir : string -> unit
|
||||
val mkdir_exclusive : string -> int -> mkdir_result
|
||||
val file_exists : string -> bool
|
||||
val is_directory : string -> bool
|
||||
val readdir : string -> string array
|
||||
val mkdir_p : string -> unit
|
||||
val write_text_file : string -> string -> unit
|
||||
val read_text_file : string -> string
|
||||
val read_stdin_all : unit -> string
|
||||
val write_binary_file : string -> string -> unit
|
||||
val read_binary_file : string -> string
|
||||
val copy_file : string -> string -> unit
|
||||
val remove_tree : string -> unit
|
||||
val rename : string -> string -> unit
|
||||
val getpid : unit -> int
|
||||
val process_running : int -> bool
|
||||
val chmod : string -> int -> unit
|
||||
val access : string -> access_permission Rrbvec.t -> unit
|
||||
val stat : string -> stats
|
||||
val environment : unit -> string array
|
||||
val gethostname : unit -> string
|
||||
val openfile : string -> open_flag Rrbvec.t -> int -> file_descr
|
||||
val close : file_descr -> unit
|
||||
|
||||
val create_process_env :
|
||||
string ->
|
||||
string array ->
|
||||
string array ->
|
||||
file_descr ->
|
||||
file_descr ->
|
||||
file_descr ->
|
||||
int
|
||||
|
||||
val run_process_capture :
|
||||
string -> string Rrbvec.t -> string array -> process_result
|
||||
|
||||
val start_process_capture_session_line :
|
||||
string -> string Rrbvec.t -> string array -> process_result
|
||||
|
||||
val kill : int -> int -> unit
|
||||
val open_url : string -> bool
|
||||
val write_stdout : string -> unit
|
||||
@@ -0,0 +1,46 @@
|
||||
type auth_data = {
|
||||
provider : string;
|
||||
id_token : string option;
|
||||
access_token : string option;
|
||||
refresh_token : string option;
|
||||
expires_at : Time.date option;
|
||||
sub : string option;
|
||||
email : Cli_primitive.email option;
|
||||
updated_at : Time.date;
|
||||
}
|
||||
|
||||
type login_result = {
|
||||
auth_path : Cli_primitive.path;
|
||||
authorize_url : Cli_primitive.url;
|
||||
opened : bool;
|
||||
email : Cli_primitive.email option;
|
||||
sub : string option;
|
||||
updated_at : Time.date;
|
||||
}
|
||||
|
||||
type logout_result = {
|
||||
auth_path : Cli_primitive.path;
|
||||
deleted : bool;
|
||||
logout_url : Cli_primitive.url;
|
||||
opened : bool;
|
||||
logout_completed : bool;
|
||||
}
|
||||
|
||||
val default_auth_path : unit -> Cli_primitive.path
|
||||
val auth_path : Cli_config.t -> Cli_primitive.path
|
||||
|
||||
val read_auth_file :
|
||||
Cli_config.t -> auth_data option Error.build_result Cli_effect.t
|
||||
|
||||
val write_auth_file :
|
||||
Cli_config.t -> auth_data -> auth_data Error.build_result Cli_effect.t
|
||||
|
||||
val delete_auth_file : Cli_config.t -> unit Error.build_result Cli_effect.t
|
||||
val expired_auth : auth_data -> bool
|
||||
|
||||
val refresh_auth :
|
||||
Cli_config.t -> auth_data -> auth_data Error.build_result Cli_effect.t
|
||||
|
||||
val resolve_auth : Cli_config.t -> auth_data Error.build_result Cli_effect.t
|
||||
val login : Cli_config.t -> login_result Error.build_result Cli_effect.t
|
||||
val logout : Cli_config.t -> logout_result Error.build_result Cli_effect.t
|
||||
@@ -0,0 +1,74 @@
|
||||
type server_status = Starting | Ready | Error | Unknown
|
||||
|
||||
type server = {
|
||||
repo : Cli_primitive.repo;
|
||||
graph : Cli_primitive.graph option;
|
||||
pid : Cli_primitive.pid;
|
||||
host : string;
|
||||
port : Cli_primitive.port;
|
||||
base_url : Cli_primitive.url;
|
||||
status : server_status;
|
||||
revision : string option;
|
||||
root_dir : Cli_primitive.path option;
|
||||
owner_source : Cli_primitive.owner_source;
|
||||
owned : bool;
|
||||
raw : Melange_edn_melange.any option;
|
||||
}
|
||||
|
||||
type start_result = {
|
||||
repo : Cli_primitive.repo;
|
||||
owner_source : Cli_primitive.owner_source;
|
||||
owned : bool;
|
||||
}
|
||||
|
||||
type stop_result = { repo : Cli_primitive.repo }
|
||||
type revision_mismatch = { cli_revision : string; servers : server Rrbvec.t }
|
||||
|
||||
type cleanup_result = {
|
||||
cli_revision : string;
|
||||
checked : int;
|
||||
mismatched : int;
|
||||
eligible : int;
|
||||
skipped_owner : int;
|
||||
killed : server Rrbvec.t;
|
||||
failed : (server * Error.t) Rrbvec.t;
|
||||
}
|
||||
|
||||
val resolve_root_dir : Cli_config.t -> Cli_primitive.path
|
||||
val graphs_dir : Cli_config.t -> Cli_primitive.path
|
||||
|
||||
val lock_path :
|
||||
root_dir:Cli_primitive.path -> Cli_primitive.repo -> Cli_primitive.path
|
||||
|
||||
val db_worker_runtime_script_path : unit -> Cli_primitive.path
|
||||
|
||||
val ensure_server :
|
||||
Cli_config.t ->
|
||||
Cli_primitive.repo ->
|
||||
create_empty_db:bool ->
|
||||
Transport.invoke_config Error.build_result Cli_effect.t
|
||||
|
||||
val start_server :
|
||||
Cli_config.t ->
|
||||
Cli_primitive.repo ->
|
||||
create_empty_db:bool ->
|
||||
start_result Error.build_result Cli_effect.t
|
||||
|
||||
val stop_server :
|
||||
Cli_config.t ->
|
||||
Cli_primitive.repo ->
|
||||
stop_result Error.build_result Cli_effect.t
|
||||
|
||||
val restart_server :
|
||||
Cli_config.t ->
|
||||
Cli_primitive.repo ->
|
||||
start_result Error.build_result Cli_effect.t
|
||||
|
||||
val list_servers : Cli_config.t -> server Rrbvec.t Cli_effect.t
|
||||
val list_graph_items : Cli_config.t -> Graph_types.graph_item Rrbvec.t
|
||||
val list_graphs : Cli_config.t -> Cli_primitive.graph Rrbvec.t
|
||||
|
||||
val cleanup_revision_mismatched_servers :
|
||||
Cli_config.t ->
|
||||
cli_revision:string ->
|
||||
cleanup_result Error.build_result Cli_effect.t
|
||||
@@ -0,0 +1,188 @@
|
||||
type invoke_config = {
|
||||
base_url : Cli_primitive.url;
|
||||
timeout_span : Time.span;
|
||||
profile_session : Profile_types.session option;
|
||||
}
|
||||
|
||||
type event_type = Cli_primitive.keyword
|
||||
type event_payload = Melange_edn_melange.any
|
||||
type event_subscription = { close : unit -> unit Cli_effect.t }
|
||||
|
||||
val connect_events :
|
||||
invoke_config ->
|
||||
(event_type -> event_payload -> unit Cli_effect.t) ->
|
||||
event_subscription Cli_effect.t
|
||||
|
||||
val write_output :
|
||||
format:Cli_primitive.keyword ->
|
||||
path:Cli_primitive.path ->
|
||||
data:Melange_edn_melange.any ->
|
||||
unit Error.build_result Cli_effect.t
|
||||
|
||||
val read_input :
|
||||
format:Cli_primitive.keyword ->
|
||||
path:Cli_primitive.path ->
|
||||
Melange_edn_melange.any Error.build_result Cli_effect.t
|
||||
|
||||
val thread_api_apply_outliner_ops :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
ops:Melange_edn_melange.vector Melange_edn_melange.t ->
|
||||
options:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_backup_db_sqlite :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
path:Cli_primitive.path ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_cli_list_nodes :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
options:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_cli_list_pages :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
options:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_cli_list_properties :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
options:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_cli_list_tags :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
options:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_cli_list_tasks :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
options:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_create_or_open_db :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
options:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_db_sync_download_graph_by_id :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
graph_id:Cli_primitive.uuid ->
|
||||
graph_e2ee:bool ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_db_sync_ensure_user_rsa_keys :
|
||||
?options:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
invoke_config ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_db_sync_grant_graph_access :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
graph_id:Cli_primitive.uuid ->
|
||||
email:Cli_primitive.email ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_db_sync_list_remote_graphs :
|
||||
invoke_config -> Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_db_sync_request_asset_download :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
asset_uuid:Cli_primitive.uuid ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_db_sync_start :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_db_sync_status :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_db_sync_stop :
|
||||
invoke_config -> Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_db_sync_upload_graph :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_export_edn :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
options:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_get_block_parents :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
block_id:Cli_primitive.db_id ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_get_block_refs :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
block_id:Cli_primitive.db_id ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_get_e2ee_password :
|
||||
invoke_config -> refresh_token:string -> Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_import_db_binary :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
data:Melange_edn_melange.any ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_import_edn :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
data:Melange_edn_melange.any ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_pull :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
selector:Melange_edn_melange.vector Melange_edn_melange.t ->
|
||||
lookup:Melange_edn_melange.any ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_q :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
query:Melange_edn_melange.vector Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_set_db_sync_config :
|
||||
invoke_config ->
|
||||
config:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_sync_app_state :
|
||||
invoke_config ->
|
||||
auth_state:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_validate_db :
|
||||
invoke_config ->
|
||||
repo:Cli_primitive.repo ->
|
||||
options:Melange_edn_melange.map Melange_edn_melange.t ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
|
||||
val thread_api_verify_and_save_e2ee_password :
|
||||
invoke_config ->
|
||||
refresh_token:string ->
|
||||
password:string ->
|
||||
Melange_edn_melange.any Cli_effect.t
|
||||
Reference in new issue
Block a user