feat(plugins): make CCAM installable straight from a Claude Code plugin
Adds a root `ccam` plugin (`.claude-plugin/plugin.json`, `"source": "./"`) so
`/plugin marketplace add` + `/plugin install ccam@...` is enough on a machine
with nothing but Claude Code: no clone, no npm run setup, no manual npm start.
- scripts/plugin-bootstrap.js: SessionStart hook. Fast-path exit, Node >=22.5
gate (node:sqlite), mkdir lock with stale reclaim, deps installed into
~/.claude/agent-dashboard/runtime/ (never the plugin cache), legacy
checkout-hook cleanup (backed up), ~/.local/bin/ccam launcher, eager UI
build so client routes like /run work immediately, detached server spawn.
- scripts/plugin-open.js, scripts/plugin-doctor.js: /ccam-open, /ccam-doctor.
- server/index.js: DASHBOARD_CLIENT_DIST override (plugin cache is read-only).
- mcp/build/ is committed (plugin MCP servers start before any bootstrap could
build them) and kept honest by scripts/check-mcp-build.js (content hash,
not mtime), enforced by pre-commit when mcp/src changes.
- plugins/ccam-dashboard/.mcp.json moved under plugins/ccam/ with a working
${CLAUDE_PLUGIN_ROOT} path (the old relative path never resolved from a
marketplace-cached subdir).
- Docs: README, INSTALL, SETUP, ARCHITECTURE, CLAUDE.md, docs/PLUGINS.md,
docs/MCP.md, docs/CLI.md, docs/HOOKS.md.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -22,10 +22,12 @@ keep the dashboard running and observable. You query the dashboard API at
|
||||
data-backed output, and you guide the user through starting, restarting, and
|
||||
feeding data into the dashboard.
|
||||
|
||||
This plugin also ships a bundled MCP server (`ccam-dashboard`, configured in
|
||||
`.mcp.json` against `CCAM_DASHBOARD_URL=http://localhost:4820`). When the MCP
|
||||
server is connected, you have direct tool access to the same dashboard
|
||||
operations — mention this to the user as a faster alternative to raw `curl`.
|
||||
The MCP server (`ccam`, pointed at `CCAM_DASHBOARD_URL=http://localhost:4820`)
|
||||
ships with the root `ccam` plugin, not with this one — a marketplace subdirectory
|
||||
plugin is cached without `mcp/`, so it cannot carry the server binary. When that
|
||||
plugin is installed and the MCP server is connected, you have direct tool access
|
||||
to the same dashboard operations — mention it to the user as a faster
|
||||
alternative to raw `curl`.
|
||||
|
||||
## Available Data Sources
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"ccam-dashboard": {
|
||||
"ccam": {
|
||||
"command": "node",
|
||||
"args": ["../../mcp/build/index.js"],
|
||||
"args": ["${CLAUDE_PLUGIN_ROOT}/mcp/build/index.js"],
|
||||
"env": {
|
||||
"CCAM_DASHBOARD_URL": "http://localhost:4820"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
description: Diagnose a plugin-installed CCAM — Node, bootstrap, server, hooks, CLI, MCP build
|
||||
---
|
||||
|
||||
Run the diagnostic and report what it found. Do not fix anything unless the user
|
||||
asks.
|
||||
|
||||
```bash
|
||||
node "${CLAUDE_PLUGIN_ROOT}/scripts/plugin-doctor.js"
|
||||
```
|
||||
|
||||
Print the output verbatim, then add at most three lines of guidance based on the
|
||||
`FAIL` and `WARN` rows:
|
||||
|
||||
- `FAIL Node` → the installed Node is too old for `node:sqlite`; the server
|
||||
cannot start until Node is upgraded.
|
||||
- `FAIL Hooks` → duplicate hook entries double every token and cost figure.
|
||||
Starting a new Claude Code session removes them automatically (the bootstrap
|
||||
backs the file up as `settings.json.ccam-bak` first).
|
||||
- `FAIL Server` or `FAIL Runtime deps` → run `/ccam-update`, then check
|
||||
`~/.claude/agent-dashboard/runtime/bootstrap.log` and `server.log`.
|
||||
- `FAIL MCP build` → `mcp/build/` is out of date; run `npm run mcp:build` in a
|
||||
checkout and commit it.
|
||||
- `WARN ccam CLI` → print the exact `export PATH=...` line from the output.
|
||||
- `WARN Dashboard UI` → run `/ccam-open` to build the bundle.
|
||||
|
||||
No preamble, no summary of things that passed.
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
description: Build the dashboard UI if needed and print its URL
|
||||
---
|
||||
|
||||
Build the dashboard bundle if it is not there yet, then print the URL. The
|
||||
bootstrap already builds it on session start, so this is usually a no-op — use
|
||||
it to force a rebuild, or to finish the build if the bootstrap's own attempt
|
||||
failed (check `~/.claude/agent-dashboard/runtime/client-build.log`).
|
||||
|
||||
```bash
|
||||
node "${CLAUDE_PLUGIN_ROOT}/scripts/plugin-open.js"
|
||||
```
|
||||
|
||||
The first run installs the client toolchain and takes a few minutes; later runs
|
||||
print the URL immediately. No server restart is needed — the server already
|
||||
serves from that directory.
|
||||
|
||||
Then help the user open it:
|
||||
|
||||
```bash
|
||||
uname -s
|
||||
```
|
||||
|
||||
- `Darwin` → `open <url>`
|
||||
- `Linux` → `xdg-open <url>`
|
||||
- otherwise → tell them to open the URL in a browser.
|
||||
|
||||
Keep the output to a few lines. Pass `--force` to the script only if the user
|
||||
asks for a rebuild.
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
description: Refresh CCAM's runtime dependencies and restart the dashboard server
|
||||
---
|
||||
|
||||
Reinstall the runtime dependencies and restart the dashboard server against the
|
||||
currently installed plugin version. Use this after a plugin update, or when
|
||||
`/ccam-doctor` reports missing dependencies or a dead server.
|
||||
|
||||
This stops the running dashboard server before starting the new one. Say so, then
|
||||
run:
|
||||
|
||||
```bash
|
||||
node "${CLAUDE_PLUGIN_ROOT}/scripts/plugin-bootstrap.js" --force
|
||||
```
|
||||
|
||||
It runs in the foreground and can take a few minutes on a cold cache. When it
|
||||
finishes, verify:
|
||||
|
||||
```bash
|
||||
node "${CLAUDE_PLUGIN_ROOT}/scripts/plugin-doctor.js"
|
||||
```
|
||||
|
||||
Report the final state in a few lines. If the bootstrap failed, quote the
|
||||
decisive line from `~/.claude/agent-dashboard/runtime/bootstrap.log`.
|
||||
Reference in New Issue
Block a user