Skip to main content

ai_memory/cli/
mod.rs

1// Copyright 2026 AlphaOne LLC
2// SPDX-License-Identifier: Apache-2.0
3
4//! CLI command modules. Wave 5a (v0.6.3) extracted these out of
5//! `main.rs` so each handler can be unit-tested by capturing output
6//! into a `Vec<u8>` via `CliOutput` instead of literal `println!`s.
7//!
8//! ## Public surface
9//!
10//! - `CliOutput` (re-exported at `cli::CliOutput`): output abstraction.
11//! - `helpers::{id_short, auto_namespace, human_age}`: pure helpers.
12//! - `store::run`, `update::run`, `io::{export, import, mine}`:
13//!   handler entry points called by `main.rs`'s dispatch arm.
14//!
15//! Each handler takes `&mut CliOutput<'_>` and routes every emit
16//! through `writeln!` so tests can assert on captured bytes.
17
18pub mod agents;
19pub mod archive;
20pub mod audit;
21pub mod backup;
22pub mod boot;
23/// v0.7.0 QW-1 — new-format CLI command modules (return exit codes
24/// rather than calling `process::exit`).
25pub mod commands;
26pub mod consolidate;
27pub mod crud;
28pub mod curator;
29pub mod doctor;
30/// v0.7.0 L2-5 (issue #670) — `ai-memory export-forensic-bundle` and
31/// `ai-memory verify-forensic-bundle` subcommands.
32pub mod export;
33pub mod forget;
34pub mod gc;
35pub mod governance;
36/// v0.7.0 issue #863 — `ai-memory governance check-action` subcommand.
37/// Shell-side parity for the MCP tool `memory_check_agent_action` so
38/// operators can dry-run a substrate rule from a terminal without
39/// driving JSON-RPC over stdio.
40pub mod governance_check_action;
41/// v0.7.0 7th-form (issue #760) — `ai-memory governance install-defaults`
42/// subcommand. Bulk-flip seed rules R001-R004 to `enabled = 1` after
43/// operator confirmation (interactive prompt; `--yes` overrides).
44pub mod governance_install_defaults;
45pub mod governance_migrate;
46pub mod helpers;
47pub mod identity;
48pub mod install;
49pub mod io;
50pub mod io_writer;
51pub mod link;
52pub mod logs;
53/// v0.7.0 (issue #800) — `ai-memory namespace` subcommand. CRUD over
54/// the per-namespace standard policy memory pointer. Closes Crack 1
55/// from the Batman Mode acceptance review by giving operators a
56/// first-class CLI verb instead of forcing them into an MCP-stdio
57/// JSON-RPC dance just to bind a `GovernancePolicy` to a namespace.
58pub mod namespace;
59/// v0.7.0 QW-3 — `ai-memory offload` / `ai-memory deref` subcommands.
60/// Substrate-only wrappers over `crate::offload::ContextOffloader`.
61pub mod offload;
62pub mod promote;
63pub mod recall;
64/// v0.7.0 (issue #691) — `ai-memory rules` subcommand. CRUD for the
65/// substrate-level agent-action rules engine. Mutation verbs (add /
66/// enable / disable / remove) require the operator keypair on disk.
67pub mod rules;
68#[cfg(feature = "sal")]
69pub mod schema_init;
70pub mod search;
71pub mod serve_banner;
72/// v0.7.0 #1095 — `ai-memory share` subcommand. Closes the SR-4
73/// three-surface-parity gap by shipping the CLI counterpart to the
74/// MCP tool `memory_share` and the HTTP route `POST /api/v1/share`.
75/// All three surfaces dispatch through the same substrate primitive
76/// (`crate::mcp::tools::share::handle_share`).
77pub mod share;
78pub mod shell;
79pub mod store;
80pub mod sync;
81pub mod update;
82pub mod verify;
83pub mod verify_signed_events;
84pub mod wrap;
85
86#[cfg(test)]
87pub mod test_utils;
88
89// Convenience re-export so callers can `use ai_memory::cli::CliOutput`
90// without a deeper path.
91pub use io_writer::CliOutput;