Expand description
Memstead CLI library — the command modules, utility modules, and
the shared CliError behind the memstead binary (src/main.rs).
One crate, two build configs. The default build (mem-repo
feature on) is the full memstead: every subcommand, including the
multi-mem / mem-repo lifecycle (mem, workspace, install,
batch-update, recover). --no-default-features drops the git-branch
backend and the mem-repo-only subcommands, yielding the lean
engine-agnostic surface (a CI / wasm-adjacent config, not shipped).
Modules§
- auth
- Auth plumbing for the registry commands.
- cli
- Clap derive for the
memsteadbinary, lifted out ofmain.rsso the xtask doc generator can callCli::command()against the same tree the binary exposes — no duplicated declarations, no drift. - commands
- outer_
gitignore - Shared helper: detect the enclosing git repo and append a path to
its
.gitignore. - output
- Output rendering and exit codes.
- registry
- HTTP client for the Memstead registry (memstead.io).
- setup
- Engine setup from global CLI flags. Produces an
Enginesynchronously (no tokio) for the CLI to call into directly.
Structs§
- CliError
- Typed CLI error that carries an exit-code kind, a stable
UPPER_SNAKE_CASEcode (matchingEngineError::code()for engine-sourced errors), and an optional structured details payload. Wrap withanyhow::Errorvia.into()ormap_errto propagate up tomain, which renders the error throughoutput::print_cli_errorin the documented{code, message, details}shape (ormemstead: ERROR [<CODE>]: <message>on the text channel).
Constants§
- ARCHIVE_
VALIDATION_ FAILED_ CODE memstead install <archive>refusal: archive failed strict validation (any of the variants the strict-archive validator can produce).- CHUNK_
OUT_ OF_ RANGE_ CODE memstead overview --chunk <N>refusal: requested chunk index is beyond the actual chunk count.- HASH_
FLAG_ REQUIRED_ CODE - Argument-validation refusal: mutating commands require one of
--auto-hash,--expected-hash, or--force. The typed code lets agents branch on the wire token rather than parsing the message. - INTERNAL_
CODE - Stable wire token for genuinely-systemic failures the agent can’t
recover from (I/O panic, store corruption, unreachable branch).
The
codefield is non-optional, so this constant exists for callsites that explicitly choose it — defaulting to it is not possible. Adding a new callsite using this constant should carry a comment explaining why no recoverable typed code applies. - TARGET_
NOT_ EMPTY_ CODE memstead init <target>refusal: target directory is non-empty (the init refuses to scribble over existing files / pre-existing workspaces).- WORKSPACE_
ALREADY_ EXISTS_ ABOVE_ CODE memstead initrefusal: ancestor walk found an existing.memstead/workspace.tomlabove the target. Without this guard a standalone init would silently nest a fresh filesystem-mem workspace inside an existing one, with neither workspace aware of the other.