Skip to main content

Module cli

Module cli 

Source
Expand description

CLI command modules. Wave 5a (v0.6.3) extracted these out of main.rs so each handler can be unit-tested by capturing output into a Vec<u8> via CliOutput instead of literal println!s.

§Public surface

  • CliOutput (re-exported at cli::CliOutput): output abstraction.
  • helpers::{id_short, auto_namespace, human_age}: pure helpers.
  • store::run, update::run, io::{export, import, mine}: handler entry points called by main.rs’s dispatch arm.

Each handler takes &mut CliOutput<'_> and routes every emit through writeln! so tests can assert on captured bytes.

Re-exports§

pub use io_writer::CliOutput;

Modules§

agents
cmd_agents and cmd_pending migrations. See cli::store for the design pattern.
archive
cmd_archive migration. See cli::store for the design pattern.
backup
cmd_backup and cmd_restore migrations. See cli::store for the design pattern.
consolidate
cmd_consolidate and cmd_auto_consolidate migrations. See cli::store for the design pattern.
crud
cmd_get, cmd_list, cmd_delete migrations. See cli::store for the design pattern.
curator
cmd_curator migration. The daemon-mode body delegates to daemon_runtime::run_curator_daemon_with_primitives (W3 work); this module owns only the outer wrapper and the report printer.
forget
cmd_forget migration. See cli::store for the design pattern.
gc
cmd_gc, cmd_stats, and cmd_namespaces migrations. See cli::store for the design pattern.
governance
Shared governance enforcement helper. Wave 5b (v0.6.3) lifted the match db::enforce_governance(...) block out of every governed cmd_* so the printing-side of governance decisions has a single testable home and the call-sites collapse to a 3-arm match on the returned GovernanceOutcome.
helpers
Public API
io
cmd_export, cmd_import, cmd_mine migrations.
io_writer
Public API
link
cmd_link and cmd_resolve migrations. See cli::store for the design pattern.
promote
cmd_promote migration. See cli::store for the design pattern.
recall
cmd_recall migration. See cli::store for the design pattern.
search
cmd_search migration. See cli::store for the design pattern.
shell
cmd_shell REPL migration. The line-handling logic is extracted into handle_command(parts, conn, out) so unit tests can drive command parsing/dispatch without spawning a subprocess. The outer stdin loop is intentionally minimal and is not covered by unit tests — its read_line blocking call would deadlock a buffer-driven test fixture.
store
cmd_store migration. Handler writes through CliOutput so unit tests can capture stdout/stderr into Vec<u8> buffers.
sync
cmd_sync and cmd_sync_daemon migrations. The daemon-mode body delegates to daemon_runtime::run_sync_daemon_with_shutdown_using_client (W3 work); this module owns only the wrapper + the in-process sync body (pull/push/merge/dry-run).
update
cmd_update migration. See cli::store for the design pattern.