Skip to content

Port quality improvements from PR #15 - #20

Merged
colbymchenry merged 6 commits into
mainfrom
pr-19
Feb 10, 2026
Merged

colbymchenry merged 6 commits into
mainfrom
pr-19

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

Summary

  • Phase 1: Bug fixes & stability — pin tree-sitter grammars, fix Float32Array vector search, schema v2 migration, batch upserts, warm resolution caches
  • Phase 2: Performance — lazy grammar loading (load only needed parsers instead of all 17 upfront)
  • Phase 3: Extraction quality — arrow function body traversal, best-candidate resolution with confidence scoring, graph traversal 'both' direction fix
  • Phase 4: CLI uninit command to cleanly remove CodeGraph from a project
  • Phase 5: MCP improvements — symbol disambiguation across callers/callees/impact/node tools, output truncation (15K char cap)
  • Tests: 33 new tests covering all changes (16 pass, 17 skip due to better-sqlite3 native bindings)

Inspired by @rickross's work in #15 — selectively ported and adapted the most impactful changes.

Test plan

  • All new tests pass (npx vitest run __tests__/pr19-improvements.test.ts)
  • No regressions in existing test suite
  • CLI uninit command works with --force flag and confirmation prompt
  • MCP tools properly disambiguate symbols and truncate large outputs

🤖 Generated with Claude Code

colbymchenry and others added 6 commits February 9, 2026 23:40
- Fix Float32Array embedder bug: was creating zero-filled array instead
  of copying data from TypedArray-like objects
- Fix VSS search query: use subquery pattern so LIMIT applies before JOIN
- Pin tree-sitter versions: remove caret ranges for ABI stability, add
  overrides to lock tree-sitter core at 0.22.4
- Lazy grammar loading: load native bindings on first use per language
  instead of all at startup, so one missing grammar doesn't affect others
- Remove stale src/extraction/queries copy from copy-assets script

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- SQLite performance pragmas: synchronous=NORMAL, 64MB cache,
  memory temp store, 256MB mmap (safe with WAL mode)
- Batch insert for unresolved refs: single transaction instead of
  N individual inserts per file
- Symbol caching (warmCaches): pre-load all nodes into memory maps
  before resolution, eliminating repeated SQLite queries per ref
- Async file I/O: fs.stat/readFile in indexFile() are now non-blocking
- Denormalize filePath/language onto UnresolvedReference: avoids N
  node lookups during resolution, with schema migration v2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix arrow function extraction: explicitly call extractFunction() for
  arrow functions/function expressions in variable declarations instead
  of silently skipping them (all 6 arrow function tests now pass)
- Best-candidate resolution: collect candidates from all strategies and
  return highest confidence match instead of first match
- Fix graph traversal 'both' direction: correctly determine next node
  for mixed incoming/outgoing edges in BFS and DFS

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Exposes the existing uninitialize() method via `codegraph uninit [path]`.
Includes confirmation prompt (skippable with --force) before deleting
the .codegraph/ directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add findSymbol() helper that prefers exact name matches and notes
  alternatives when multiple symbols share the same name
- Add output truncation (15K char cap) to prevent context window bloat
- Apply to callers, callees, impact, node, search, and files tools

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers arrow function extraction, best-candidate resolution, graph
traversal direction fix, MCP symbol disambiguation, output truncation,
CLI uninit command, and more. Tests requiring better-sqlite3 native
bindings are conditionally skipped.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@colbymchenry
colbymchenry merged commit 5e2d3d6 into main Feb 10, 2026
@colbymchenry
colbymchenry deleted the pr-19 branch February 10, 2026 22:48
jorgerobles pushed a commit to jorgerobles/codegraph that referenced this pull request Jun 1, 2026
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