Skip to content

archdex-art/CodeGraph-Extension

Repository files navigation

CodeGraph Local — Standalone Code Intelligence

A self-contained, in-process code analysis engine for VS Code.

CodeGraph Local brings symbol-level code intelligence, a blast-radius-weighted health score, and a deterministic 7-agent remediation swarm directly into your editor sidebar. It is fully standalone. No external server, no network calls, no SQLite database, no LLM API keys. Install it, and it analyzes whatever TypeScript/JavaScript workspace you have open.

Overview Network Graph Agent Swarm
Overview tab: health score and dimension breakdown Network tab: force-directed symbol call graph Agent Swarm tab: prioritized findings from 7 specialist agents

Install

From the Marketplace: search "CodeGraph Local" in the Extensions view (Ctrl+Shift+X / Cmd+Shift+X), or:

code --install-extension codegraph-local.codegraph-local

From a .vsix (GitHub Releases): download the latest .vsix from Releases, then:

code --install-extension codegraph-local-<version>.vsix

Open the CodeGraph Local icon in the Activity Bar, run CodeGraph Local: Scan Workspace, done.

What it does

Feature Command / UI
Health score (0–100) Auto-scans on open → Status bar (bottom-left) + Dashboard sidebar
Agent swarm (Security, Perf, Refactor, Dead code, Deps, Architecture, Test) CodeGraph Local: Run Agent Swarm → Problems panel + Dashboard sidebar
Interactive network graph Dashboard sidebar → Network tab (zoom, pan, search-to-focus, hover-to-highlight)
Symbol search (ranked by fan-in / connectivity) CodeGraph Local: Search Symbols
Callers / Callees / Impact at cursor CodeGraph Local: Show Callers/Callees/Impact
Graph-RAG context generation CodeGraph Local: Generate Context for Task
Find circular dependencies CodeGraph Local: Find Circular Dependencies
Find dead code (0 callers) CodeGraph Local: Find Dead Code
Generate a verified fix CodeGraph Local: Generate Verified Fix

Architecture

This extension contains its own custom-built analysis engine (src/engine/):

  1. File Scanner: fast filesystem walker that strictly honors glob excludes (and the workspace's .gitignore) to skip node_modules and build directories.
  2. Symbol Extractor: uses the TypeScript Compiler API to walk the AST, extracting functions, methods, classes, and types, along with all call expressions and import bindings.
  3. Graph Builder: resolves raw calls across files using a TypeScript NodeNext-compatible module resolver, building a SymbolGraph with fanIn/fanOut metrics.
  4. Health Score: penalizes structural and textual smells (eval, hardcoded secrets, empty catch blocks, missing lockfiles, god files) weighted by their blast radius in the graph.
  5. Query Engine: deterministic graph traversals (Tarjan SCC for cycles, BFS for impact analysis).
  6. Agent Orchestrator: runs 7 deterministic specialists over the graph, dedupes findings via a Critic, scores them via a Judge, and assigns P0–P3 priorities.
  7. Fix Executor: clones the workspace to an OS temp directory sandbox, applies regex-safe line deletions, re-scans the sandbox to verify the health score didn't regress, and generates a unified diff.

Setup & Development

npm install
npm run build      # tsc typecheck
npm run bundle     # esbuild bundle -> bundle/extension.js
npm test           # vitest over the engine logic
npm run lint

Press F5 in VS Code to launch the Extension Development Host.

Known Limitations

  • TS/JS only: The engine is tightly bound to the TypeScript compiler API for accurate call extraction.
  • Single-root workspaces: The extension operates against workspaceFolders[0].
  • Heuristic resolution: Call resolution does not run a full TypeScript typechecker program (which would be too slow for large workspaces). It relies on name-based matching through import bindings — a deliberate speed/precision tradeoff.
  • Symbol at cursor is a heuristic: The AST extractor records line numbers but not column spans; "Show Callers at Cursor" picks the smallest symbol range enclosing the cursor line.

License

Apache License 2.0 — see LICENSE.

About

Standalone VS Code extension: local, in-process code intelligence — symbol graph, health score, and a deterministic 7-agent remediation swarm, docked in a sidebar dashboard. No server, no network.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors