Skip to main content

Module install

Module install 

Source
Expand description

mushroomdb install / uninstall — wire the /mushroom skill, the MCP server, the prompt hooks and the git hooks into an assistant.

§Design notes

  • Idempotent: running install twice is a no-op (exit 0).
  • Non-destructive: refuses to overwrite user files install didn’t create.
  • Manifest-driven uninstall: tracks every file, key, hook, ignore line and external registration it wrote; removes exactly that.
  • The only network access is the optional pre-warm, which is a best-effort warm cache and never fails the install.

§User-scope MCP config location (verified 2026-09-02 by live inspection)

Claude Code user-level MCP servers live in ~/.claude.json under the top-level "mcpServers" key. This was verified empirically on a live Claude Code install: ~/.claude/settings.json holds env/permissions/hooks but NO mcpServers key. Cursor uses ~/.cursor/mcp.json (same format as project-level .cursor/mcp.json). Codex keeps its own config and is written through the codex CLI rather than by editing a file.

Structs§

Externals
The world outside the two directories install is given: the programs it shells out to (codex, npx) and how long it will wait for them.
InstallOpts
Options parsed from mushroomdb install [flags] or mushroomdb uninstall [flags].
StoreRef
How the config an install writes names the store.
ToggleOpts
Options parsed from mushroomdb enable [flags] or mushroomdb disable [flags].

Enums§

Delivery
Which door an install opens onto the graph.
McpCommand
How the MCP server entry (and the skill’s bootstrap commands) invoke mushroomdb.
Platform
Which assistant platform(s) to wire up.
Scope
Where the install lives: alongside one repository, or once for the user.

Constants§

AUTO_ARG
The argument every written command uses in place of a store path when the store is to be resolved at run time.
HOOK_BEGIN
Opening marker of the region this module owns inside a git hook.
HOOK_END
Closing marker of that region.

Functions§

classify_mcp_command
Pure classifier behind detect_mcp_command: decide whether the mushroomdb that PATH resolves to is the executable now running.
default_db
The store directory an install with no --db uses.
delivery_for_store
The door an install opened for the store at db_dir.
detect_mcp_command
Decide how the MCP entry should invoke mushroomdb, from an explicit --command (if any) and the real environment.
git_hook_block
The block a git hook runs: one backgrounded, silenced sync.
merge_git_hook
Put the sync block in hook_file, creating the file (mode 755, with a #!/bin/sh line) if it is not there. Returns whether anything changed.
remove_git_hook
Take the sync block back out of hook_file. Returns whether anything changed.
render_template
Substitute both template placeholders and keep only the delivery regions this install wants. bin_cmd is the pre-quoted shell form, so the templates carry {{BIN}} unquoted.
run_disable
Turn an install off: remove the MCP entry, the three Claude Code hooks, the git hook blocks and the Codex registration; leave the skill/rules file, the store, and the .gitignore line untouched. Idempotent.
run_disable_with
Like run_disable, with the external environment supplied by the caller (Codex removal shells out to the codex CLI).
run_enable
Turn a disabled install back on. Re-adds the MCP entry, the three Claude Code hooks and the git hook blocks using the store a stashed entry named and the command install would resolve right now — not a replay of what disable took out, which may no longer be the fastest path to the published package. Idempotent, and a no-op (not an error) when the install is not disabled.
run_enable_with
Like run_enable, with the server command and the external environment supplied by the caller. Tests use this to stay deterministic and offline.
run_install
Install the /mushroom skill and MCP server entry for the resolved platforms.
run_install_with
Like run_install, but with the server command and the external environment supplied by the caller instead of detected. Tests use this to stay deterministic and offline; run_install is the real-environment wrapper.
run_uninstall
Uninstall: remove exactly what install wrote. Reads the manifest.
run_uninstall_with
Like run_uninstall, with the external environment supplied by the caller (Codex removal shells out to the codex CLI).