Expand description
mushroomdb CLI library: hand-rolled arg parsing and the demo dataset builder.
The binary in main.rs stays thin — it dispatches on parse_args and
prints what the lib functions return.
Modules§
- doctor
mushroomdb doctor— verify an install end to end: the config entry, the store, the hooks, and a real stdio handshake with the configured MCP command.- enrich
mushroomdb enrich— the optionalPostToolUsehook body forGrep.- export
- Export writer for
mushroomdb export. - impact_
hook mushroomdb impact-hook— the optionalPreToolUsehook body for edits.- ingest_
git mushroomdb ingest-git <db> <repo>: build and maintain a graph of a git repository. First run ingests the whole history; later runs apply only the commits after the recordedGitSynchead, so deletes and renames retract or move derived edges instead of leaving them stale.- install
mushroomdb install/uninstall— wire the /mushroom skill, the MCP server, the prompt hooks and the git hooks into an assistant.- intercept
mushroomdb intercept— the optionalPreToolUsehook body (experimental).- recall
mushroomdb recall <db>: the body of the UserPromptSubmit hook.- structure
- Structure ingest: the working tree, read as graph.
Structs§
- CliError
- CLI-facing error. [
Display] is the message printed to stderr. - Demo
Outcome - Outcome of
run_demo. Counts are deterministic.
Enums§
- Algo
Subcmd - Algorithm subcommand for
mushroomdb algo. - Command
- Parsed
mushroomdbinvocation. - Restore
Outcome - Re-exported where it has always been named:
cli::RestoreOutcome. Whatrestore_if_emptydid. - ServeUi
- How
serveshould mount a UI. Precedence:--ui dir> embedded >--no-ui. - WalDisposition
- What a snapshot does with the WAL it folds in.
Constants§
- AUTOMATIC_
SNAPSHOT - What every snapshot mushroomdb takes on its own does with the WAL.
- AUTO_
SNAPSHOT_ RETENTION - How many WAL archives a snapshot mushroomdb takes on its own keeps.
None= all of them. Retention is configured, never defaulted: deleting history nobody asked to delete is not a default worth having. - N_ORGS
- Deterministic demo: 10 Orgs, 20 Projects, 30 People.
- N_
PEOPLE - N_
PROJECTS - SAMPLE_
QUERY - Sample query printed by
mushroomdb demoand executed against the fresh store. - SNAPSHOT_
LOCK_ WAIT - How long a server-initiated snapshot waits for the store’s cross-process write lock before giving up.
- VERSION
- Build version, printed by
mushroomdb --version.
Functions§
- build_
index_ on run_build_indexagainst an already-open handle.- format_
backup - Format a
BackupReportfor display. - format_
demo - Render a
DemoOutcomethe waymushroomdb demoprints it. - format_
stats - Pretty-print
Statsformushroomdb statsand the demo smoke test. - format_
suggest - Pretty-print a list of
RuleSuggestions formushroomdb suggest. - maybe_
run_ demo_ if_ empty - Run
run_demowhendiris missing or empty; otherwise leave it alone. - parse_
args - Parse argv after the binary name. Hand-rolled — no clap.
- read_
stats - Open
dirand return live stats. - resolve_
auto_ db - Where
--autolooks for a database, in order. - restore_
if_ empty core_api::restore::restore_if_empty, in the CLI’s error type.- run_
algo - Run a graph algorithm and return a formatted string.
- run_
asof - Execute an as-of query at the given commit and print results.
- run_
backup - Create a consistent, verified backup of
db_dirtodest. - run_
brief - Body of
mushroomdb brief <db-dir>|--auto, theSessionStarthook. - run_
build_ index - Pump every outstanding vector-index build to completion, one slice per call, printing a line per slice.
- run_
context - Body of
mushroomdb context <db-dir> <target> [--full]. - run_
demo - Build the deterministic demo dataset in an empty
dir. - run_
explore - Body of
mushroomdb explore <db-dir> <target> [--depth …] [--full]. - run_
export - Export all data from
db_dirtodestinformat. - run_
impact - Body of
mushroomdb impact <db-dir> <file>.... - run_map
- Body of
mushroomdb map <db-dir> [--json]. - run_
migrate - Migrate the snapshot at
db_dirto the current format version. - run_
owners - Body of
mushroomdb owners <db-dir> <path>. - run_
query - Run a Cypher read or write and print columns/rows like
run_asof. - run_
schema_ apply - Read
schema_file, opendb_dir, apply the schema, and return the diff as one line per entry:"created rule:x","updated view:y", etc. - run_
snapshot - Open
dirand writesnapshot.bin, archiving the WAL by default. - run_
suggest - Profile the database at
dirand return all rule suggestions. - run_
verify - Validate the CRC32 integrity of every section in a V8 snapshot.
- run_why
- Body of
mushroomdb why <db-dir> <a> <b>. - snapshot_
automatically - Take
AUTOMATIC_SNAPSHOTunder a held write lock, keepingAUTO_SNAPSHOT_RETENTIONarchives. - snapshot_
shared - Take the snapshot
servetakes — on a--snapshot-everytick, and once more on a graceful shutdown. - usage
- Usage text for no-args /
--help/-h. - validate_
ui_ dir --ui <dir>must be a directory that containsindex.html.- version_
string - The one line
--versionand theversionsubcommand print. - worktree_
root - The root of the working tree
dirsits in: the nearest ancestor holding a.gitentry, orNoneoutside a checkout.