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:
2026-08-10 16:05:37 +07:00
parent 5a793e70cc
commit 8a82895c65
59 changed files with 5982 additions and 44 deletions
+29
View File
@@ -0,0 +1,29 @@
/**
* @file remote-tools.ts
* @description MCP tools for Remote Data Sources — list configured SSH sources
* and trigger on-demand syncs so agents can operate remotes without the UI/CLI.
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
*/
import { z } from "zod";
import { createToolRegistrar } from "../../core/tool-registry.js";
import { assertMutationsEnabled } from "../../policy/tool-guards.js";
/**
* Registers remote-source tools against `/api/remote-sources/*`.
* List is read-only; sync tools require the mutations policy gate.
*/
export function registerRemoteTools(context) {
const { api, logger, server, config } = context;
const register = createToolRegistrar(server, logger);
register("dashboard_list_remote_sources", "List configured Remote Data Sources (SSH machines) with status and last sync.", {}, async () => api.get("/api/remote-sources"));
register("dashboard_sync_remote_source", "Trigger an immediate SSH pull+import for one Remote Data Source by id.", {
source_id: z.string().min(1).describe("Remote source id (src_…)"),
}, async (args) => {
assertMutationsEnabled(config);
const id = encodeURIComponent(args.source_id);
return api.post(`/api/remote-sources/${id}/sync`);
});
register("dashboard_sync_all_remote_sources", "Trigger an immediate SSH pull+import for every enabled Remote Data Source.", {}, async () => {
assertMutationsEnabled(config);
return api.post("/api/remote-sources/sync-all");
});
}