diff --git a/plugins/codebase-memory/dashboard/.gitignore b/plugins/codebase-memory/dashboard/.gitignore new file mode 100644 index 000000000000..3cb2f0a9a55c --- /dev/null +++ b/plugins/codebase-memory/dashboard/.gitignore @@ -0,0 +1,11 @@ +__pycache__/ +*.pyc +*.db +*.db-journal +*.db-wal +*.db-shm +*.log +.pytest_cache/ +.coverage +node_modules/ +.DS_Store \ No newline at end of file diff --git a/plugins/codebase-memory/dashboard/README.md b/plugins/codebase-memory/dashboard/README.md new file mode 100644 index 000000000000..03ea378b02c3 --- /dev/null +++ b/plugins/codebase-memory/dashboard/README.md @@ -0,0 +1,119 @@ +# codebase-memory (dashboard plugin) + +A native dashboard plugin for Hermes that embeds the local +[`codebase-memory-mcp`](https://github.com/DeusData/codebase-memory-mcp) +graph UI inside the existing `/codebase-memory` tab. Browse, search and +explore indexed code repositories without leaving the dashboard. + +The plugin is intentionally thin: it draws the chrome (status, project +picker, open-in-new-tab), and delegates all graph rendering to the +native codebase-memory-mcp UI via an iframe. + +## Architecture + +``` +┌─────────── Hermes dashboard (port 9119) ──────────┐ +│ ┌──────────── plugin: codebase-memory ───────────┐ │ +│ │ dist/index.js + style.css (IIFE) │ │ +│ │ plugin_api.py (FastAPI auto-mounted) │ │ +│ │ /health, /projects, /project/{n}/health, │ │ +│ │ /iframe-url, /open │ │ +│ └────────────────────────────────────────────────┘ │ +│ │ │ +│ ▼ iframe │ +│ ┌──────── codebase-memory-mcp UI (port 9749) ────┐ │ +│ │ WebGL/canvas graph renderer (Cytoscape-free │ │ +│ │ custom rendering — DeusData) │ │ +│ │ + REST + JSON-RPC at /api/* and /rpc │ │ +│ └────────────────────────────────────────────────┘ │ +└────────────────────────────────────────────────────┘ +``` + +We deliberately do **not** re-implement the codebase-memory-mcp graph +view. DeusData updates their renderer independently and the iframe keeps +us in sync automatically. + +## Configuration + +Optional `config.yaml` block: + +```yaml +plugins: + codebase_memory: + binary_path: ~/.local/bin/codebase-memory-mcp # default + ui_port: 9749 # default + ui_host: 127.0.0.1 # default (loopback only) +``` + +All keys are optional — the plugin probes `~/.local/bin/codebase-memory-mcp` +and port 9749 by default. + +## Endpoints + +| Path | Purpose | +|-----------------------------------|-------------------------------------------------| +| `GET /api/plugins/codebase-memory/health` | binary + UI status (always 200) | +| `GET /api/plugins/codebase-memory/projects` | list indexed projects (proxied CLI) | +| `GET /api/plugins/codebase-memory/project/{n}/health` | per-project node/edge counts | +| `GET /api/plugins/codebase-memory/iframe-url?project=` | URL for the frontend iframe | +| `GET /api/plugins/codebase-memory/open?project=` | URL for "Open in new tab" | + +## Operational requirements + +1. **Install the binary** (if not already present). Pin to a known release: + + ```bash + curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/v0.8.1/install.sh | bash + ``` + + Check the [upstream releases](https://github.com/DeusData/codebase-memory-mcp/releases) + for the latest version and update the URL accordingly. We test against + `v0.8.1`; the plugin relies only on the stable CLI verbs (`list_projects`, + `index_status`, `index_repository`) and the JSON shape of their output. + +2. **Bring up the UI server** (the plugin embeds this): + + ```bash + codebase-memory-mcp --ui=true --port=9749 + ``` + + The dashboard plugin surfaces this requirement as a help card if the + UI is not reachable. The binary's `~/.cache/codebase-memory-mcp/` + directory stores the indexed data. + +3. **Restart the Hermes dashboard** so it picks up the new plugin directory: + + ```bash + pkill -f "hermes dashboard.*--port 9119" + cd ~/.hermes/hermes-agent + nohup ./venv/bin/hermes dashboard --no-open --port 9119 \ + > /tmp/dashboard.log 2>&1 & + ``` + +## Verification + +`plugin_api.py` embeds three pytest tests at the bottom of the file: + +```bash +pytest plugins/codebase-memory/dashboard/plugin_api.py -v +``` + +These verify: + +- `test_plugin_self_check` — module imports without side effects +- `test_health_endpoint_shape` — `/health` returns all documented keys +- `test_iframe_url_endpoint_shape` — `/iframe-url` returns a valid URL + +## Roadmap + +- **PR #7** (this one) — iframe wrapper + minimal sidebar +- **PR #8** — project picker inside the iframe (postMessage bridge with + the DeusData UI to select a project without reload) +- **PR #9** — optional export of indexed nodes to the `mcp_gbrain_*` + catalog so the graph shows up alongside the Obsidian vault + +## License + +MIT (this plugin's source). The embedded UI is the property of DeusData — +the plugin does not redistribute any of its code; the iframe fetches +the bundle from the locally running binary at runtime. \ No newline at end of file diff --git a/plugins/codebase-memory/dashboard/dist/index.js b/plugins/codebase-memory/dashboard/dist/index.js new file mode 100644 index 000000000000..07ba1f038d9d --- /dev/null +++ b/plugins/codebase-memory/dashboard/dist/index.js @@ -0,0 +1,494 @@ +/* codebase-memory plugin — dashboard IIFE + +This plugin embeds the local codebase-memory-mcp UI (DeusData) inside +the Hermes dashboard. Layout: + + ┌─────────────────────────────────────────────────────────┐ + │ Header: status pill + project selector + Open in new tab │ + ├──────────────┬──────────────────────────────────────────┤ + │ │ │ + │ Sidebar │