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].

Enums§

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§

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.
detect_mcp_command
Decide how the MCP entry should invoke mushroomdb, from the options 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.
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).