Extend extraction to index two additional categories of symbols
that were previously invisible:
1. Type aliases (e.g. `export type X = ...` in TypeScript,
`type X` in Go, `type X = ...` in Rust, `typealias X` in Swift,
`type_alias` in Kotlin). Adds `typeAliasTypes` to the
LanguageExtractor interface with values for all 13 languages.
2. Exported variable declarations that aren't functions, including:
- Zustand stores: `export const useX = create(...)`
- XState machines: `export const xMachine = createMachine(...)`
- Zod schemas: `export const schema = z.object(...)`
- Config objects: `export const config = { ... }`
- Constants: `export const MAX = 3`
- Arrays: `export const NAMES = [...] as const`
The extractExportedVariables() method is called when visiting
export_statement nodes. It skips variable_declarator values that
are already handled by functionTypes (arrow_function,
function_expression) to avoid duplicate extraction.
Adds 11 new test cases (59 total extraction tests, 215 total).
Tested on production monorepo: nodes increased from 958 to 1,172
(+22%), with 109 new variable nodes and 105 new type_alias nodes.
Only 4 files remain at 0 nodes — all are re-export barrels or
ambient declaration files with no extractable symbols.
Arrow functions and function expressions assigned to variables
(e.g. `export const useAuth = () => { ... }`) were not being indexed
because the arrow_function AST node has no `name` field — the name
lives on the parent variable_declarator node.
Additionally, `isExported()` for TypeScript and JavaScript extractors
only checked 10 characters back from the node's start position, which
missed `export` for deeply nested nodes like arrow functions inside
variable declarations inside export statements.
Changes:
- extractFunction(): When an arrow_function or function_expression
resolves to '<anonymous>', look up the parent variable_declarator
for the name before skipping.
- isExported() (TS + JS): Walk the parent chain to find an
export_statement ancestor instead of substring matching.
- Add 6 test cases covering arrow function exports, function
expression exports, non-exported arrow functions, anonymous
arrow functions, multiple exports, and JavaScript files.
Tested on a real monorepo (238 files): node count increased from
779 to 958 (+23%), with 94 new nodes in packages/ that previously
had 0 coverage.
The nomic-ai model is now downloaded during npm install via a postinstall
script and stored globally in ~/.codegraph/models (shared across projects)
instead of per-project in .codegraph/models.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add note that installer updates ~/.claude/CLAUDE.md in Quick Start
- Rename "Recommended: Add Global Instructions" to "Global Instructions Reference"
- Clarify that instructions are added automatically, shown for reference
- Bump version to 0.2.7
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The hybrid approach (Claude's native Explore agents using codegraph tools)
is more effective than a custom explore tool because Explore agents already
know what format the main session needs.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add 'liquid' to Language type and default include patterns
- Create LiquidExtractor with regex-based extraction (tree-sitter-liquid has ABI issues)
- Extract render/include/section references as component nodes
- Extract schema blocks as constant nodes with parsed names
- Extract assign statements as variable nodes
- Create file relationship edges for snippet/section references
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added claude-md-template.ts with the instructions template
- Installer writes to ~/.claude/CLAUDE.md (global) or ./.claude/CLAUDE.md (local)
- Smart detection: updates existing CodeGraph section or appends if not found
- Uses HTML comment markers for reliable section replacement on upgrades
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The installer runs `npm install -g @colbymchenry/codegraph` so users
can simply run `codegraph init -i` instead of the full npx command.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Users running via npx don't have the codegraph command installed
globally. Update installer message and README to use
npx @colbymchenry/codegraph init -i instead.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change static import to dynamic import() for @xenova/transformers
which is an ESM-only package. This fixes ERR_REQUIRE_ESM when
running via npx in CommonJS environments.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace placeholder metrics with actual benchmark results (29% fewer tokens, 25% fewer tool calls)
- Add full benchmark data table in collapsible section
- Add ASCII architecture diagram showing how CodeGraph integrates with Explore agents
- Explain the hybrid approach: agents query the graph instead of scanning files
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add centered npx command in hero section (Next.js style)
- Simplify Quick Start to 3 steps using interactive installer
- Move manual setup and global instructions to collapsible details
- Add install command to CLI usage and commands sections
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- New `codegraph install` command and auto-run when invoked with no args
- Beautiful ASCII banner using figlet
- Interactive prompts for global (~/.claude) or local (./.claude) installation
- Writes MCP server config to claude.json
- Writes auto-allow permissions to settings.json
- For local installs: auto-initializes project, indexes, and installs git hooks
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated documentation to recommend instructing Explore agents to use
CodeGraph tools (search, callers, callees, context) for faster code
exploration instead of file scanning.
Benchmark results show ~30% fewer tokens and ~25% fewer tool calls
when Explore agents leverage CodeGraph for graph-based lookups.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of returning file paths for Claude to read separately,
codegraph_explore now:
- Reads relevant files internally using fs
- Extracts code snippets for key symbols (functions, types, APIs)
- Includes the code directly in the response
- Returns a synthesis with data flow and key code included
This matches native explore agent behavior where file reading
happens in the sub-agent context, keeping main context clean.
Bump version to 0.1.8
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move warnings to TOP of output so Claude sees them first
- If existing implementations found: "STOP: Similar implementations exist!"
- If feature request: "BEFORE PLANNING: Use AskUserQuestion to clarify..."
- Update tool description to emphasize checking existing code first
- Fixes issue where Claude listed questions but never asked them
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Pattern generation now uses multiple naming conventions:
PascalCase, snake_case, and camelCase
- Common suffixes/prefixes work across languages (Service,
Handler, Controller, handle_, create_, etc.)
- Removed JS/React-specific patterns like useBundle, SwapDialog
- Bump version to 0.1.6
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add codegraph_explore MCP tool for deep exploration with condensed output
- Expand default exclude patterns for framework build outputs (.next, .nuxt, .expo, etc.)
- Increase node ID hash length from 16 to 32 chars to prevent collisions
- Add feature request detection with UX clarification reminders
- Update README with MCP tools reference and best practices
- Update CLAUDE.md with context usage guidelines
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add centered hero with key metrics (2x faster, 40% fewer tokens, zero API costs)
- Add side-by-side comparison table showing before/after CodeGraph
- Add real-world benchmark results from Sign in with Apple test
- Add 6-feature grid highlighting key capabilities
- Update all section headers with emojis
- Add badges for npm, license, and Node.js version
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add evaluation test suite with TypeScript and Python fixtures
- Fix MCP server to defer CodeGraph init until rootUri received
- Fix call edge extraction by calling resolveReferences() after indexAll/sync
- Fix glob matching for root-level files (e.g., **/*.py now matches auth.py)
- Fix duplicate node extraction for methods inside classes
- Update context tests to use buildContext for semantic search + graph traversal
- Export unused formatter functions to fix build
Evaluation results:
- TypeScript: 96% precision, 79% recall, 85% F1
- Python: 99% precision, 80% recall, 85% F1
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>