refactor(cli,host): finish command, dispatch and package module split

This commit is contained in:
Marqdo Agent committed 2026-11-21 08:59:50 +08:00
1 parent 8a0c068856
commit 7859c26213
9 files changed
+546 -504

No files matched your search

+4 -4
View File
@@ -242,10 +242,10 @@ This is still a **local VM lane**, not a self-hosted GitHub Actions security URL
`0d40de7`; later docs-only commits keep code/test bytes identical. Evidence:
[`docs-and-test-migration`](evidence/2026-11-21-docs-and-test-migration.md).
- Module-boundary refactor (review RFC-CM P1): CLI split into
`commands/{sandbox,run,check,inspect}.rs`; host split into
`host/{resource_ops,providers,effects}.rs` plus `process.rs`. `commands.rs`
still owns init/fmt/lock/sync/package/tool and `host.rs` still owns the
`Host::invoke` dispatch and capability checks; this is a behavior-preserving
`commands/{sandbox,run,check,inspect,init,package,tool}.rs`; host split into
`host/{resource_ops,providers,effects,dispatch}.rs` plus `process.rs`.
`commands.rs` keeps shared project/runtime helpers and `host.rs` keeps the
`Host` trait methods and capability checks; this is a behavior-preserving
split, not a new crate or backend.
- Minimal structure observation/construction (RFC-CM CM-A04, ADR-0023):
value-semantics `list.append/concat`, `map.keys/has/get/set/remove`,
+5 -5
View File
@@ -62,10 +62,10 @@ Layer rules:
human/machine output. It is not a semantic policy centre.
5. Callable Plugin and Resource Provider share one registry/authorization/audit
mechanism, but keep different capability types.
6. CLI policy/commands are `commands/{sandbox,run,check,inspect}.rs`; host
open-path/providers/effects are `host/{resource_ops,providers,effects}.rs`;
process execution is `process.rs`. These are child modules, not new crates
or a second backend.
6. CLI policy/commands are `commands/{sandbox,run,check,inspect,init,package,tool}.rs`;
host open-path/providers/effects/dispatch are
`host/{resource_ops,providers,effects,dispatch}.rs`; process execution is
`process.rs`. These are child modules, not new crates or a second backend.
## 3. Dependency direction and public contracts
@@ -128,7 +128,7 @@ that a phase is complete.
| P1 | `std:fs/file` read/write/copy and `resource.request` fs metadata/directory operations are implemented; append/seek/watch/recursive walk remain open | open |
| P1 | No file append/seek/watch/recursive directory walk | open; future Resource Operation extension |
| P1 | JSON/CSV product parsers are implemented; no streaming/multi-line CSV or depth-bounded JSON walker | open |
| P1 | CLI split into `commands/{sandbox,run,check,inspect}.rs`; host split into `host/{resource_ops,providers,effects}.rs` plus `process.rs`; `commands.rs` still owns init/fmt/lock/sync/package/tool and `host.rs` still owns `Host::invoke` dispatch | mostly split; package/tool/lock/sync and invoke dispatch remain |
| P1 | CLI split into `commands/{sandbox,run,check,inspect,init,package,tool}.rs`; host split into `host/{resource_ops,providers,effects,dispatch}.rs` plus `process.rs`; `commands.rs` keeps shared project/runtime helpers and `host.rs` keeps the `Host` trait methods and capability checks | split; shared helpers and trait methods remain by design |
| P2 | HTTP parsing is Unicode-codepoint oriented; a general byte body is not the only path | open; convert before a general network release |
| P2 | No DNS, TLS, listener or UDP provider | open |
| P2 | `std:path`, a regex subset, `std:datetime`, `std:clock`, `std:env` and `std:process` are implemented; no secure random or compression | open |
+10 -6
View File
@@ -13,15 +13,19 @@ RFC item: P1 module boundaries
| `crates/cli/src/commands/run.rs` | `execute` run-session assembly and `read_stdin` |
| `crates/cli/src/commands/check.rs` | `check` command |
| `crates/cli/src/commands/inspect.rs` | `inspect` command and `InspectFlags` |
| `crates/cli/src/commands/init.rs` | `init` command |
| `crates/cli/src/commands/package.rs` | `lock`/`sync`/`add`/`remove` and atomic writes |
| `crates/cli/src/commands/tool.rs` | `fmt` and `plugin-inspect` commands |
| `crates/marqdo-host/src/host/resource_ops.rs` | `open_resource_stream` stdio/file/tcp/provider dispatch; child module of `host` |
| `crates/marqdo-host/src/host/providers.rs` | trusted in-process/worker/C-ABI/package provider registration |
| `crates/marqdo-host/src/host/effects.rs` | `next_seq` and `record_resource_effect` trace helpers |
| `crates/marqdo-host/src/host/dispatch.rs` | `Host::invoke` argument/effect wrapper and `StdHost::dispatch` match |
| `crates/marqdo-host/src/process.rs` | explicitly granted `process.run` execution, timeout and output caps |
This is a **behavior-preserving** refactor: no public CLI flag, host trait
method, builtin, spec or stdlib API changed. No new crate was added.
`commands.rs` still owns init/fmt/lock/sync/package/tool and `host.rs` still
owns `Host::invoke` dispatch and capability checks.
`commands.rs` keeps shared project/runtime helpers and `parse_named_args`;
`host.rs` keeps the `Host` trait methods and capability checks.
## Commands
@@ -36,7 +40,7 @@ python3 tools/pack-stdlib.py PASS
## Not covered
`commands.rs` still contains init/fmt/lock/sync/package/tool command bodies
and `host.rs` still contains `Host::invoke` dispatch, capability checks and
register entry points. A complete split needs a later behavior-preserving
change; it is not claimed here.
`commands.rs` still contains shared project/runtime helpers and
`parse_named_args`; `host.rs` still contains the `Host` trait methods,
capability checks and struct definitions. That is intentional module surface,
not a second backend.