feat: 完成 rust cutover phase 8 收口

This commit is contained in:
lix-2026
2026-04-15 20:01:12 +08:00
parent 822c730cd6
commit 98db79b301
104 changed files with 18777 additions and 3025 deletions
+46
View File
@@ -0,0 +1,46 @@
# mnote-cli
当前 crate 是 Phase 2 的最小 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`
最小示例:
```bash
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.name``operation.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 契约应尽量保持稳定。