Skip to content

Commit 4407046

Browse files
committed
feat(cli): persist install hook opt-out
Signed-off-by: Andy11-cpu <canada11@duck.com>
1 parent b0a3ca2 commit 4407046

7 files changed

Lines changed: 482 additions & 25 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ The `install` command automatically strips macOS quarantine attributes and ad-ho
109109

110110
The `install` command auto-detects installed coding agents and configures their documented MCP entries plus durable instructions, skills, and lifecycle hooks where supported.
111111

112+
Hooks are enabled by default. Run `codebase-memory-mcp install --no-hooks` to remove CBM-managed hooks while keeping MCP registration and other integration files; the choice persists for later installs and updates. Run `codebase-memory-mcp install --hooks` to re-enable them, or inspect the current preference with `codebase-memory-mcp config get install_hooks`.
113+
112114
### Session Coordination Daemon
113115

114116
CBM automatically shares one per-account coordination daemon across Claude Code, Codex, OpenCode, and every other configured client. There is no opt-in setting for MCP servers or hook clients: the first daemon-backed CBM session starts it, each session registers its own work, and the final session shuts it down. The daemon owns long-lived background services such as watchers, shared indexing jobs, and the optional UI. Closing one session cancels work owned only by that session, while work still needed by another session continues.

‎docs/CONFIGURATION.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ codebase-memory-mcp config set auto_index true
7979
codebase-memory-mcp config set auto_index_limit 50000
8080
codebase-memory-mcp config set watcher_enabled false
8181
codebase-memory-mcp config reset auto_index
82+
codebase-memory-mcp config get install_hooks
8283
```
8384

8485
Current keys:
@@ -89,6 +90,9 @@ Current keys:
8990
| `auto_index_limit` | `50000` | Maximum file count allowed for automatic indexing of a new project. |
9091
| `auto_watch` | `true` | Register the session's project with the background git watcher on connect. Set `false` to keep a session from registering its project (the watcher still runs for other projects). |
9192
| `watcher_enabled` | `true` | Master switch for the background watcher subsystem. Set `false` to stop the watcher from starting at all — no poll thread and no project registration. Reindex manually with `index_repository` when disabled. |
93+
| `install_hooks` | `true` | Install CBM-managed client hooks. `install --no-hooks` persists `false`; `install --hooks` restores `true`. |
94+
95+
Bare installs and updates respect the stored hook preference. MCP registration, skills, instructions, and profiles remain installed when hooks are disabled.
9296

9397
> **`watcher_enabled` vs `auto_watch`.** `watcher_enabled` controls whether the
9498
> watcher *subsystem* starts at all (the background poll thread). `auto_watch` is

‎scripts/smoke-test.sh‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,21 @@ if ! grep -q 'hook-augment' "$GATE_SCRIPT"; then
16891689
fi
16901690
echo "OK 8e: shim installed, non-blocking, delegates to hook-augment"
16911691

1692+
HOME="$FAKE_HOME" XDG_CONFIG_HOME="$FAKE_HOME/.config" APPDATA="$FAKE_HOME/AppData/Roaming" LOCALAPPDATA="$FAKE_HOME/AppData/Local" PATH="$FAKE_HOME/.local/bin:$PATH" \
1693+
"$BINARY" install --no-hooks --skip-binary --clients=claude -y >/dev/null
1694+
if grep -qE 'cbm-(code-discovery-gate|session-reminder|subagent-reminder)' "$FAKE_HOME/.claude/settings.json" 2>/dev/null ||
1695+
! grep -q 'codebase-memory-mcp' "$FAKE_HOME/.claude.json" 2>/dev/null; then
1696+
echo "FAIL 8e-i: --no-hooks did not remove owned Claude hooks while preserving MCP"
1697+
exit 1
1698+
fi
1699+
HOME="$FAKE_HOME" XDG_CONFIG_HOME="$FAKE_HOME/.config" APPDATA="$FAKE_HOME/AppData/Roaming" LOCALAPPDATA="$FAKE_HOME/AppData/Local" PATH="$FAKE_HOME/.local/bin:$PATH" \
1700+
"$BINARY" install --hooks --skip-binary --clients=claude -y >/dev/null
1701+
if ! grep -q 'cbm-code-discovery-gate' "$FAKE_HOME/.claude/settings.json" 2>/dev/null; then
1702+
echo "FAIL 8e-i: --hooks did not restore owned Claude hooks"
1703+
exit 1
1704+
fi
1705+
echo "OK 8e-i: Claude hook opt-out and re-enable preserve MCP"
1706+
16921707
# 8f-8h: Codex TOML
16931708
if ! grep -q '\[mcp_servers.codebase-memory-mcp\]' "$FAKE_HOME/.codex/config.toml"; then
16941709
echo "FAIL 8f: Codex TOML missing MCP section"

0 commit comments

Comments
 (0)