Files

2.1 KiB

mnote-cli

当前 crate 是 Phase 2 的最小 CLI 协议入口。

注意:旧 page / block / tool run doc_* 执行面曾连接 Convex documents.* 兼容路径;该执行链已退役,只保留 JSON 计划输出和历史迁移对照。 local-first 普通 Markdown 正文主链应优先走本地文件引用、Page Aggregate、 Rust Web local_folder source 和 agent 原生 patch/diff,不应把本 CLI 视为正文真源入口。

当前目标不是直接替代全部执行链,而是先冻结这五类命令面的命名和 --json 输出协议:

  • page
  • block
  • search
  • sidebar
  • tool

当前最小子命令面:

  • page get
  • page title
  • page save
  • block insert
  • block patch
  • search documents
  • search blocks
  • sidebar dataset
  • tool run

最小示例:

cargo run --manifest-path /mnt/Data1T/mnote/rust/Cargo.toml -p mnote-cli -- --json page get --page-id page_demo --workspace-id ws_demo
cargo run --manifest-path /mnt/Data1T/mnote/rust/Cargo.toml -p mnote-cli -- --json page title --page-id page_demo --workspace-id ws_demo --title "新标题"
cargo run --manifest-path /mnt/Data1T/mnote/rust/Cargo.toml -p mnote-cli -- --json page save --page-id page_demo --workspace-id ws_demo --content-json '[{\"id\":\"block_1\"}]'
cargo run --manifest-path /mnt/Data1T/mnote/rust/Cargo.toml -p mnote-cli -- --json sidebar dataset --workspace-id ws_demo
cargo run --manifest-path /mnt/Data1T/mnote/rust/Cargo.toml -p mnote-cli -- --json tool run --tool-name doc_get --kind query --mode explain-plan --args-json '{"pageId":"page_demo"}'

当前输出的重点字段:

  • domain / action
  • context.requestId / context.traceId
  • operation.kind
  • operation.nameoperation.toolName
  • operation.executionMode / operation.toolsetId / operation.effect
  • operation.transport.functionName
  • operation.transport.payloadJson
  • operation.transport.argsJson

tool run 当前会先校验 Rust 内置 tool registry,并统一暴露 validateOnly / dryRun / explain-plan 等安全模式字段。后续阶段会继续把这些 CLI 面接到真实执行器,但命令命名和 JSON 契约应尽量保持稳定。