Skip to content

refactor(codegraph): make the code graph a fully native engine (no external tool)#94

Merged
FJRG2007 merged 1 commit into
mainfrom
feat/codegraph-native
Jul 2, 2026
Merged

refactor(codegraph): make the code graph a fully native engine (no external tool)#94
FJRG2007 merged 1 commit into
mainfrom
feat/codegraph-native

Conversation

@FJRG2007

@FJRG2007 FJRG2007 commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Follow-up to #91. That PR shipped codebase memory as a wrapper around an external MCP; this replaces it with a fully native, zero-dependency engine, as requested - no external binary, no npx, no third-party package, and no upstream project name anywhere.

What

src/codegraph.ts is now an in-process TypeScript code-graph engine:

  • Scans a project, extracts symbols + imports per language (regex; TS/JS, Python, Go, Rust, Java, C#, Kotlin, Ruby, PHP, C/C++).
  • Resolves intra-project import edges, counts cross-file symbol references (best-effort call graph).
  • Persists per project as JSON under ~/.enigma/codegraph.
  • Answers architecture / search / schema queries. Verified on enigma's own src: 173 files, 2421 symbols, 606 import edges.

Integration

  • Exposed through enigma's own MCP server (enigma_codegraph_index/projects/search/architecture), gated by codeGraph; folded into mcpEnabled(). Reverted the second-managed-server generalization in mcp-deploy.ts (unused now).
  • Dashboard Code graph tab: a real sliding switch (data-kind="bool", not a text button), an "Index a project" action, native rendering. The toggle hits enigma's own backend, so the previous "Could not reach the server" is gone.
  • CLI: enigma codegraph <status|on|off|index|projects|arch|search>.
  • Tests rewritten for the engine; docs + CLAUDE.md updated.

Verified

npm run verify clean; codegraph.test.ts 5/5; mcp.test.ts 7/7; headless dashboard smoke (switch renders as a switch, no JS errors).

Opt-in, default off.

…rnal tool)

Replace the external-MCP wrapper with a zero-dependency TypeScript code-graph
engine: scan a project, extract symbols + imports per language (regex, 12
languages), resolve intra-project import edges, count cross-file references, and
answer architecture / search / schema queries in-process. Verified on enigma's
own src (173 files, 2421 symbols, 606 import edges).

- Expose it through enigma's own MCP server (enigma_codegraph_index/projects/
  search/architecture), gated by codeGraph; fold codeGraph into mcpEnabled().
- Revert the second-managed-server generalization in mcp-deploy.ts (unused now).
- Dashboard: real sliding switch (data-kind=bool, not a text button), an
  "Index a project" action, native rendering; the toggle now hits enigma's own
  backend so the previous "Could not reach the server" is gone.
- CLI: enigma codegraph <status|on|off|index|projects|arch|search>.
- Rewrite tests for the native engine; update docs + CLAUDE.md.

No external binary, npx, or third-party package - and no upstream project name.
@FJRG2007 FJRG2007 merged commit 0316eb9 into main Jul 2, 2026
2 checks passed
@FJRG2007 FJRG2007 deleted the feat/codegraph-native branch July 2, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant