Lines 1-36javascript
1// codebase-memory-mcp integration — the starterkit's code-intelligence engine.
3// Replaces codegraph: codebase-memory-mcp is a pure-C single static binary
4// that indexes a codebase into a persistent knowledge graph (tree-sitter +
5// Hybrid LSP type resolution across 158 languages). It exposes 14 MCP tools
6// including Cypher queries, trace_path (call graphs), dead-code detection,
7// architecture overview, and ADR management — capabilities codegraph lacked.
9// Like webclaw.mjs, this module is the integration glue: detect the binary,
10// auto-download it if missing, merge its MCP entry into the host config,
11// and record enablement state. The binary itself is never vendored — it is
12// fetched from upstream GitHub releases (SLSA-3 + sigstore + checksummed).
14import fs from 'node:fs'
15import os from 'node:os'
16import path from 'node:path'
17import { spawnSync } from 'node:child_process'
18import { ensureDir, exists } from './fs-utils.mjs'
19import { GLOBAL_STARTERKIT_STATE_PATH } from './constants.mjs'
21export const CODEBASE_MEMORY_REPO = 'DeusData/codebase-memory-mcp'
22export const CODEBASE_MEMORY_INSTALL_DIR = path.join(os.homedir(), '.local', 'bin')
23export const CODEBASE_MEMORY_MCP_CONFIG = {
24 command: ['codebase-memory-mcp'],
30// --- starterkit-state read/write (mirrors webclaw.mjs) ---
32function readJsonIfExists(filePath, fallback = {}) {
34 if (!exists(filePath)) return fallback
35 return JSON.parse(fs.readFileSync(filePath, 'utf8'))
36 } catch {
HighSandbox Evasion Gated Capability
Source gates dangerous network, credential, or execution behavior behind CI, host, platform, time, or geo fingerprint checks.
src/codebase-memory.mjsView on unpkg · L16