diff --git a/docs/PLUGINS.md b/docs/PLUGINS.md index 5b5e26c..c89de70 100644 --- a/docs/PLUGINS.md +++ b/docs/PLUGINS.md @@ -147,18 +147,47 @@ single port. ### Uninstalling -`claude plugin uninstall ccam@claude-code-agent-monitor-plugins` removes the hooks -and the cached source. It does not touch the state the plugin created outside -the cache — remove those by hand if you want a clean machine: +`claude plugin uninstall ccam@claude-code-agent-monitor-plugins` only removes +the plugin from the enabled list — verified against a real install/uninstall, +not assumed. It does **not**: + +- stop the running server (it keeps serving from the now-uninstalled cache dir) +- remove the cached source under `~/.claude/plugins/cache/.../ccam//` +- remove the hook entries `claude plugin install` wrote into + `~/.claude/settings.json` (still pointing at that cache dir — they keep + firing, and keep working, until the cache directory is eventually GC'd by + Claude Code, at which point they silently start failing) +- remove `~/.local/bin/ccam` or `~/.claude/agent-dashboard/runtime/` + +For a clean machine, do all of this yourself: ```bash -kill "$(node -e 'console.log(JSON.parse(require("fs").readFileSync(require("os").homedir()+"/.claude/.agent-dashboard.json","utf8")).servers[0].pid)')" +# 1. Stop the server (skip if ~/.claude/.agent-dashboard.json is already gone) +kill "$(node -e 'console.log(JSON.parse(require("fs").readFileSync(require("os").homedir()+"/.claude/.agent-dashboard.json","utf8")).pid)')" + +# 2. Runtime state and the CLI launcher rm -rf ~/.claude/agent-dashboard/runtime # deps, UI bundle, logs, state -rm -f ~/.local/bin/ccam # the CLI launcher -# ~/.claude/agent-dashboard/ still holds the database — delete it only if you -# want the recorded history gone too. +rm -f ~/.local/bin/ccam + +# 3. The hook entries claude plugin install wrote (settings.json is not +# ours to fully own — back it up first and only drop entries mentioning +# hook-handler.js) +node -e ' +const fs = require("fs"); +const p = require("os").homedir() + "/.claude/settings.json"; +const d = JSON.parse(fs.readFileSync(p, "utf8")); +fs.copyFileSync(p, p + ".ccam-bak2"); +for (const [type, entries] of Object.entries(d.hooks || {})) { + const kept = entries.filter((e) => !JSON.stringify(e).includes("hook-handler.js")); + if (kept.length) d.hooks[type] = kept; else delete d.hooks[type]; +} +fs.writeFileSync(p, JSON.stringify(d, null, 2) + "\n"); +' ``` +`~/.claude/agent-dashboard/` still holds the SQLite database after all of the +above — delete that directory too only if you want the recorded history gone. + ## Available Plugins ### 1. `ccam-analytics` — Analytics & Monitoring