3.3 KiB
3.3 KiB
Plan: the CLI
Ordered, dependency-first tasks for architecture/cli.md, each mapped to the
gate(s)/test(s) it satisfies.
Foundations
- Add
clap_complete+clap_mangenworkspace deps; create thecbd-clicrate (clap defs default;clientfeature adds the gRPC executor). cbd-cli:Role,RemoteArgs,Connection, the command enums, the three top-levelClis,generate_assets,print_completions, and arun_remotestub. Compiles with and withoutclient.
Remote executor (cbd-cli client feature)
- Implement
run_remote: dispatch everyLibraryCmd/QueueCmd/GlobalCmdto its RPC via the generated client; pretty-print listings and the queue; concise messages for mutations. Add the missingStopcall. (Gates: remote commands. Tests: a request-mapping unit test per group against a fake tonic server, or at least argument-parse tests for the clap tree.) - Map gRPC
Status/transport errors to a shortcolor-eyre/eyrereport (no chain dump for "unreachable"). (Gate: remote errors.)
Config writers
- Server:
ServerSettings::store(config_dir)round-trips[auth](preserve other roles, flat shape). (Gate: guard config write. Test: set one role, reload, other roles intact.) - Client: a
Configwriter (load/modify/savecbd-tui.toml/cbd.toml). (Gate: auth. Test: round-trip user/password/address.)
Server binary (crabidy-server)
- Replace the
Cli/HashPasswordwithcbd_cli::ServerCli. No subcommand →serve()(unchanged). (Gate: no-subcommand default.) guard: hash (stdin fallback), print PHC, write config unless--no-config. Removehash-password. (Gate: guard.)scan: walk + write tomls;--capture/--movevia a newCrabidyStore::ingest_file(path, move) -> StoreName(factor the local-source half of the D4 capture flow). (Gate: scan. Tests: toml written; capture dedups; move removes source; existing toml skipped.)library/queue/global→cbd_cli::run_remote(enablecbd-cliclient).completions→print_completions.
Client binary (cbd-tui) and cbd
- Replace ClapSerde parsing: parse
cbd_cli::TuiCli; load the TOML config and applyremote/spectrumoverrides; no subcommand →run(config). (Gate: parsing/defaults. Tests: flag overrides file; first-run writes file.) authwrites the client config;library/queue/global→run_remote;completionsprints.cbd: parsecbd_cli::CbdCli; no subcommand → server + TUI (unchanged); subcommands dispatch to the server (guard/scan), client (auth), or remote (library/queue/global) paths. (Gate: cbd union.)
Assets + build
build.rsin each binary: build-depcbd-cli(default features), callgenerate_assetsfor itsCommandintoOUT_DIRand, whenCBD_ASSET_DIRis set, into that dir. (Gate: assets.)- devenv
gen-cli-assetsscript:CBD_ASSET_DIR=$PWD/dist cargo build. (Gate: assets.)
Docs + verification
- README: a CLI section (subcommands per binary, completions/man, the
password-in-argv note); update the config section for
auth/guard. plan/summary.md: what was built + deviations.cargo test --workspacegreen; clippy-D warnings, fmt, markdownlint clean (viadevenv shell).