Commit Graph
100 Commits
Author SHA1 Message Date
e176062c56 fix(cli): ASCII glyph fallback for Windows console mojibake (#168) (#178)
The shimmer progress renderer writes from a worker thread via
`fs.writeSync(1, ...)` to keep the animation smooth while the main
thread is busy in SQLite. That path bypasses Node's TTY-aware
UTF-8->codepage conversion on Windows, so glyphs like `|`/`<>`/`-`
were emitted as raw UTF-8 bytes and reinterpreted by the console's
OEM codepage (CP437, CP936, ...), producing strings like
`鋍?[0m 鉒?[0m Scanning files 鈥?N found`.

Add `src/ui/glyphs.ts` with `supportsUnicode()` detection plus
matched Unicode + ASCII glyph sets, and route all CLI/shimmer
output through `getGlyphs()`. Defaults: ASCII on Windows and on
Linux kernel consoles (`TERM=linux`), Unicode everywhere else.
`CODEGRAPH_UNICODE=1` and `CODEGRAPH_ASCII=1` are escape hatches.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 10:45:20 -05:00
36c8dbc404 fix(mcp): don't block initialize handshake on heavy init (#172) (#177)
The MCP `initialize` handler was awaiting `tryInitializeDefault` —
which opens the SQLite DB and runs `await initGrammars()` (tree-sitter
WASM bootstrap) — before sending the JSON-RPC response. On slow
filesystems (Docker Desktop VirtioFS on macOS, WSL2) this could exceed
Claude Code's ~30s handshake timeout, leaving the codegraph child
process alive and unresponsive with no tools visible in the client.

Send the response first; defer the open to a tracked background
promise. The lazy retry path used by `tools/list` and `tools/call`
now awaits that promise instead of racing it with `openSync`, so we
never double-open the SQLite file.

Adds a subprocess-based regression test that asserts the JSON-RPC
response arrives on stdout before `startWatching()` logs to stderr.
This ordering check catches the regression on any filesystem, not
just slow ones where the timing matters in practice.

Reported by @sashanclrp; isolated by @sgrimm's wire capture.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 10:20:02 -05:00
Colby McHenry 9b6a917d32 Merge remote-tracking branch 'origin/main' 2026-05-18 08:29:18 -05:00
Colby McHenry 662bb1ece8 release: 0.7.9 2026-05-18 08:29:16 -05:00
Colby MchenryandGitHub c811237db8 Update README.md 2026-05-17 20:52:13 -05:00
58c1414ce5 fix(installer): opencode .jsonc + AGENTS.md (0.7.8) (#163)
* release: 0.7.7 (multi-agent installer — Cursor, Codex, opencode)

* fix(installer): opencode .jsonc + AGENTS.md (0.7.8)

v0.7.7 wrote ~/.config/opencode/opencode.json, but opencode reads
opencode.jsonc by default — so the codegraph MCP entry never appeared
in any opencode session. Also installs AGENTS.md so opencode's model
reaches for codegraph_* tools instead of native Grep.

- Prefer existing .jsonc, fall back to .json, default new installs
  to .jsonc.
- Surgical edits via jsonc-parser preserve user comments and
  formatting across install / re-install / uninstall round-trips.
- Install AGENTS.md (global ~/.config/opencode/AGENTS.md, local
  ./AGENTS.md) with the shared INSTRUCTIONS_TEMPLATE — same
  marker-delimited approach Codex uses.
- +9 opencode-specific tests covering filename precedence, comment
  preservation, AGENTS.md install + sibling-content preservation,
  uninstall reverses both files.

575/575 tests pass. Hand-verified end-to-end: opencode session calls
codegraph_node + codegraph_callers for a structural query, zero Grep
calls.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs: overhaul CLAUDE.md and add scripts/release.sh + Cursor rules file

Replaces the old Claude-only CLAUDE.md with a comprehensive guide covering
the full project architecture, multi-agent installer, test conventions,
NodeKind/EdgeKind reference, and release workflow. Key additions:

- Documents the layered pipeline, all module paths, and the multi-target
  installer (targets/, registry.ts, AgentTarget interface).
- Adds the Cursor `--path` quirk and the "update all three surfaces" rule
  when changing MCP tool guidance.
- Documents `npm run eval`, `test:eval`, and the full set of build/test
  commands including single-file patterns.
- `scripts/release.sh` — idempotent bash script that tags the current
  commit, pushes the tag, and creates a GitHub Release whose notes are
  extracted from the matching `## [X.Y.Z]` block in CHANGELOG.md. Safe
  to re-run after partial failure.
- `.cursor/rules/codegraph.mdc` — Cursor-specific agent instructions
  (tool decision table, rules of thumb, index-lag warning) written by
  the installer and kept in sync with server-instructions.ts and
  instructions-template.ts.

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 20:26:49 -05:00
Colby McHenry 7d87126ee8 release: 0.7.7 (multi-agent installer — Cursor, Codex, opencode) 2026-05-17 19:27:05 -05:00
a447e1d430 feat(installer): multi-target — Claude Code, Cursor, Codex CLI, opencode (#162)
* feat(installer): multi-target — Claude Code, Cursor, Codex CLI, opencode

Closes the Claude-locked installer behind issue #137. The runtime MCP
server was already agent-agnostic (stdio); only the installer was
locked. After this refactor, `codegraph install` can write per-agent
MCP config + instructions for any combination of supported agents.

## What ships

Four agent targets, each implementing the new `AgentTarget` interface:

- **Claude Code** — `~/.claude.json`, `~/.claude/settings.json`,
  `~/.claude/CLAUDE.md` (or local equivalents). Behavior preserved
  from the original installer; existing installs upgrade in place.
- **Cursor** — `~/.cursor/mcp.json` (g) or `./.cursor/mcp.json` (l)
  + project-local `./.cursor/rules/codegraph.mdc`.
- **Codex CLI** — `~/.codex/config.toml` with `[mcp_servers.codegraph]`
  + `~/.codex/AGENTS.md`. Global only. Hand-rolled TOML serializer
  scoped to the table we own — siblings + array-of-tables preserved.
- **opencode** — `~/.config/opencode/opencode.json` (XDG) or
  `./opencode.json`.

Adding a 5th agent is a new file in `src/installer/targets/` plus
one entry in `registry.ts`.

## CLI changes

```
codegraph install                                   # interactive multi-select
codegraph install --yes                             # auto-detect, install global
codegraph install --target=cursor,claude --yes     # explicit list
codegraph install --target=auto --location=local   # detected, project-local
codegraph install --target=none                    # skip agent writes entirely
codegraph install --print-config codex             # dump snippet, no writes
```

## Backwards compat

Every export from the old `config-writer.ts` (`writeMcpConfig`,
`writePermissions`, `writeClaudeMd`, `hasMcpConfig`, `hasPermissions`,
`hasClaudeMdSection`) is preserved as a `@deprecated` shim that
delegates to per-file helpers in `targets/claude.ts`. Existing Claude
users see byte-identical on-disk layout — `detect()` reports
`alreadyConfigured: true`, re-running is a no-op.

## Tests

+47 new tests in `__tests__/installer-targets.test.ts`:
- Parameterized contract test across all 4 targets × supported
  locations (install → unchanged on re-run, sibling preservation,
  uninstall reverses install, printConfig writes nothing).
- Codex partial-state recovery, locked-block contract for the
  codegraph table, full TOML serializer suite.
- Registry: getTarget, resolveTargetFlag (auto/all/none/csv).

`__tests__/installer.test.ts` relaxed one assertion: the new code
returns `unchanged` for byte-identical re-runs instead of `updated`;
the surrounding-custom-content contract is unchanged.

## Uninstall behavior change

`bin/uninstall.ts` now loops `ALL_TARGETS.uninstall('global')` on
`npm uninstall -g`. A user who manually configured
`~/.codex/config.toml` with our block will have only that block
removed on package uninstall — we only touch the dotted-key table
we own.

Based on andreinknv/codegraph@c5165e4. Issue #137.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(scripts): add local-install.sh for hands-on branch testing

Builds the current branch and `npm link`s it as the global
`codegraph` binary. `--undo` unlinks and reinstalls the published
version. Mirrors the style of scripts/release.sh.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(installer): move agent picker to the first prompt

Reorders runInstallerWithOptions so the multi-select for agents
(Claude / Cursor / Codex / opencode) is step 1 — before the
global-npm-install confirm and before the location prompt. Bare
`npx @colbymchenry/codegraph` now opens with "Which agents should
CodeGraph configure?", which is the answer most users want first.

Side effects of the reorder:

- Early exit if zero targets selected — skips global-install and
  location prompts entirely, exits with "nothing to do."
- Multiselect labels drop the per-location "will skip" hint (location
  isn't known yet) and replace it with a static "global only" badge
  for targets like Codex that have no project-local config concept.
- If every selected target is global-only, the location prompt is
  skipped and global is forced (no point asking).
- Detection probes the user-provided location if known via flag,
  else 'global' as the most common default — labels are a hint
  about what's installed locally, not load-bearing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(installer): disambiguate "global" wording in install prompts

Two prompts both said "global" but meant different things — users
read them as duplicates. Renamed for clarity:

- Step 2 (npm install -g): "Install codegraph globally?" →
  "Install the codegraph CLI on your PATH? (Required so agents can
  launch the MCP server)". Spinner messages match.
- Step 3 (config location): "Where would you like to install?" with
  "Global"/"Local" → "Apply agent configs to all your projects, or
  just this one?" with "All projects" (~/.claude, ~/.cursor, etc.)
  / "Just this project" (./.claude, ./.cursor, etc.).
- All-global-only fallback: "Using global install" → "Writing
  user-wide configs (selected agents have no project-local config)."

Underlying `Location` values ('global' / 'local') unchanged; only
the UI strings shift, so no test or flag breakage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(installer/cursor): inject --path so workspace-aware queries work

Cursor launches MCP-server subprocesses with cwd != workspace root,
AND does not pass rootUri or workspaceFolders in the MCP initialize
call. The codegraph MCP server's process.cwd() fallback misses the
workspace's .codegraph/ and reports "not initialized" on every tool
call. Codex and Claude don't have this issue (Codex launches with
cwd=workspace, Claude passes rootUri).

Fix: inject `--path` into the args we write for Cursor.

- local install (./.cursor/mcp.json): hardcode the absolute project
  path — known at install time.
- global install (~/.cursor/mcp.json): use `${workspaceFolder}` so
  Cursor expands it per-workspace. One global config now drives
  every project the user opens, without per-project re-install.

No test breakage — the parameterized contract tests check
idempotency / sibling preservation, not the exact args content.
File-header comment documents the rationale so the next person
doesn't strip the arg as boilerplate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(init): auto-wire project-local agent surfaces

Closes the global-Cursor UX gap: `~/.cursor/mcp.json` registers the
MCP server, but Cursor's agent only learns to *prefer* codegraph
over native grep when it sees `.cursor/rules/codegraph.mdc` — a
project-local file that global install can't write. Previously the
user had to re-run `codegraph install --target=cursor --location=local`
for every new project. Now `codegraph init` does it automatically.

## What changed

- New optional `AgentTarget.wireProjectSurfaces()` returning a
  WriteResult of project-local files to drop. Most targets omit
  it (their global config is complete). Cursor implements it to
  write the rules file.
- New `wireProjectSurfacesForGlobalAgents()` orchestrator in
  installer/index.ts — iterates ALL_TARGETS, detects which are
  configured globally, calls their wireProjectSurfaces, returns
  what was written.
- `codegraph init` calls the orchestrator in both branches:
  - Fresh init: write surfaces after CodeGraph.init succeeds.
  - Already-initialized re-init: write surfaces too, so re-running
    `init` is the documented recovery path for a project missing
    its rules file.

## Steady-state UX

  1. Once, ever: `codegraph install` (writes global agent configs)
  2. Per project: `codegraph init -i` (builds the index + auto-wires
     project-local agent surfaces — currently Cursor's rules file)

No new tests — wireProjectSurfaces delegates to writeRulesEntry,
which is already covered by the parameterized contract tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(installer): agent-agnostic instructions template

The old template was inherited from the Claude-only era and
prescribed "ALWAYS spawn an Explore agent" — a Claude Code-specific
concept (subagents via the Task tool). When Cursor's agent read
this it had no Explore agent to spawn, got confused, and fell back
to native grep/read even for structural queries the codegraph MCP
tools answer in one call.

This rewrite:

- Frames each tool by the question it answers (search vs callers
  vs impact vs context vs explore vs node vs files vs status).
- Tells the agent explicitly to TRUST codegraph results and not
  re-verify them with grep — the over-grep-after-codegraph
  behavior was the main symptom we saw on Cursor.
- Reframes "spawn Explore agent" as an OPTIONAL pattern for
  harnesses that support parallel subagents — Claude Code still
  gets the hint, Cursor / Codex / opencode just skip it.
- Trims the "if not initialized" section to one prescriptive line.

Same marker delimiters (`<!-- CODEGRAPH_START/END -->`) so existing
installs upgrade in place via the marker-based section swap. No
test changes needed — the parameterized contract tests check
marker placement + sibling preservation, not the literal body.

Effective surfaces: ~/.claude/CLAUDE.md (Claude), .cursor/rules/
codegraph.mdc (Cursor, project-local), ~/.codex/AGENTS.md (Codex).
Users get the new copy by re-running `codegraph install` for
global writes, or `codegraph init` for Cursor's project rules.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(readme): reflect multi-agent support at the top + accurate flow

- Tagline now reads "Supercharge Claude Code, Cursor & Codex" instead
  of Claude-only — multi-agent support is what the PR is about, the
  README should say so above the fold.
- New badge row (Claude Code / Cursor / Codex CLI / opencode) in the
  same shields.io style as the OS row.
- Install-flow bullets reordered to match the actual prompt order
  (agent picker first, then PATH install, then location).
- `codegraph init -i` step now mentions that init wires up
  project-local agent surfaces (Cursor rules file etc.) so global
  install works in every project without a re-run.
- Agent-agnostic phrasing in the closing line ("your agent" not
  "Claude Code").

Headline-level brand decision left intentionally in this PR — the
existing Claude-only positioning predates multi-agent support.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: andreinknv <andrei.nknv@outlook.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 19:26:09 -05:00
Colby McHenry 7e617d819b release: 0.7.6 (fix permission denied on global install)
The 0.7.5 tarball shipped `dist/bin/codegraph.js` without the executable
bit set, causing `zsh: permission denied: codegraph` after a fresh global
install. The build script now `chmod +x`'s the binary before packing.

Also adds CHANGELOG.md and documents the release workflow in CLAUDE.md.
2026-05-13 09:00:41 -05:00
1cbd5a8123 fix(extraction): recurse into git submodules when listing files (#150)
`git ls-files -co --exclude-standard` only sees the submodule pointer in
the main repo's index, so projects using submodules indexed 0 files. Now
the tracked list runs with `-c --recurse-submodules` so submodule
contents are included; untracked files are gathered with a separate
`-o --exclude-standard` call (the two flags can't be combined — git only
supports --recurse-submodules with --cached/--stage).

Fixes #147.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 09:05:44 -05:00
b47c9562ec fix(cli): hard-exit on Node 25.x instead of soft warning + crash (#149)
The Node 25.x V8 turboshaft WASM JIT Zone allocator bug
(https://github.com/colbymchenry/codegraph/issues/81) reliably crashes
CodeGraph mid-indexing with `Fatal process out of memory: Zone` when
tree-sitter grammars get JIT-compiled. We already had:

- `engines: "node": ">=18.0.0 <25.0.0"` in package.json
- Lazy grammar loading (#61)
- A startup `console.warn` when Node 25+ is detected

But the recurring duplicates (#54, #81, #140, plus comments from
multiple unique users) show those defenses aren't enough:

- npm `engines` is a soft warning by default, so `npm install -g`
  doesn't block.
- The startup `console.warn` is a single yellow line that scrolls
  off-screen before the OOM 30 seconds later, so users connect the
  crash to "CodeGraph is broken" rather than "I'm on the wrong Node
  version" and file a fresh issue.

This patch turns the soft warning into a hard exit. On Node 25+ we
print a bordered banner that names the V8 root cause, embeds the
detected version, gives Node 22 LTS install commands (nvm + Homebrew),
and links to #81 — then exit(1) BEFORE any tree-sitter import
triggers WASM JIT. The previous behaviour is preserved behind
`CODEGRAPH_ALLOW_UNSAFE_NODE=1` for anyone who patched V8 themselves
or wants to test a future Node 25 fix.

The banner builder is extracted to `src/bin/node-version-check.ts` so
the test can import it without triggering CLI bootstrap. Five unit
tests pin the version interpolation, root-cause explanation, recovery
commands (nvm + brew), override env var, and #81 link — these are
load-bearing and shouldn't get edited away silently.

Suite: 509 → 514, all passing. Verified both paths manually by
flipping the threshold to 22 in dist and running on Node 22.20.0:
without the env var the CLI prints the banner and exits 1; with
`CODEGRAPH_ALLOW_UNSAFE_NODE=1` it prints the banner and continues.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 08:54:32 -05:00
55daeffe13 fix(db): surface SQLite backend in status + actionable WASM-fallback banner (#148)
Closes the visibility gap behind issues #138 (WASM-on-macOS) and #139
(MCP "database is locked"). `better-sqlite3` is in optionalDependencies,
so when the native build fails npm install still succeeds and the
runtime silently falls back to node-sqlite3-wasm — 5-10x slower and
without WAL, so writers block readers (which is what makes the MCP
server appear to "lock the DB" in #139). The only existing signal was
a one-line `console.warn` to stderr that MCP transports typically
swallow.

This patch does NOT change install behavior — better-sqlite3 stays in
optionalDependencies so cross-platform installs keep working. It just
makes the substitution observable + recoverable.

## Visibility (4 surfaces)

- CLI `codegraph status`: new `Backend:` line under Index Statistics.
  `native` rendered green; `wasm` rendered yellow with an inline
  `npm rebuild better-sqlite3` nudge. Also exposed in `--json` as
  `backend: 'native' | 'wasm'`.
- MCP `codegraph_status`: new `**Backend:**` line. Native form reads
  `native (better-sqlite3)`; wasm form prepends a warning glyph and
  includes the full fix recipe.
- Stderr banner on fallback (`buildWasmFallbackBanner`): replaces the
  bare one-line `console.warn` with a multi-line bordered banner
  covering macOS + Linux fix steps and optionally appending the
  native load error.
- README troubleshooting: new "Indexing is slow / MCP database is
  locked / WASM fallback active" entry that walks users to the
  `Backend:` line and the fix.

## Per-instance backend tracking

`createDatabase` previously set a module-level `activeBackend` global.
MCP can open multiple project DBs in one process via the
`getCodeGraph()` cache, so the global would race / overwrite. Refactor:
`createDatabase` now returns `{db, backend}`, `DatabaseConnection`
carries `private backend` and exposes `getBackend()`, and
`CodeGraph.getBackend()` is the public surface. The CLI and MCP both
call `cg.getBackend()`.

## What this does NOT fix

The root cause of users landing on WASM is environment-specific (Mac
without Xcode CLT, Node version mismatch, etc.) and not fixable in
code without changing the optionalDependencies design. The README
entry tells users what to run; `Backend: native` after rebuild is the
confirmation signal.

## Tests

New `__tests__/sqlite-backend.test.ts` (6 tests) pins the banner
recipe content (so future edits can't strip the recovery commands),
the `WASM_FALLBACK_FIX_RECIPE` constant, and per-instance
`DatabaseConnection.getBackend()` / `CodeGraph.getBackend()` reporting.
Suite: 503 → 509, all passing.

Credit to @andreinknv whose analysis on #138 (and patches on his fork
at 6d0e7a2 + 69f7001) framed the visibility approach.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 08:27:53 -05:00
af7abd50cb docs(readme): move Initialize Projects above the gif + add Scala to languages (#146)
- Reorder Get Started so the per-project init code block sits between
  the npx install and the GIF — visually contiguous code blocks read
  better than code → image → code.
- Add Scala (`.scala`, `.sc`) to the Supported Languages table now
  that #91 has landed.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 22:11:41 -05:00
00b298966f docs(readme): add Initialize Projects snippet to Get Started (#145)
The top-level Get Started section showed the install command but not
the per-project init step. Adding the same `cd your-project /
codegraph init -i` block that lives in Quick Start so users see the
full happy path before scrolling.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 22:06:40 -05:00
181b180881 docs(readme): add Vue to the Supported Languages table (#144)
Followup to #66 — Vue support shipped but the README languages table
was never updated.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 22:04:31 -05:00
804ab671d4 feat(mcp): emit server-level instructions in initialize response (#143)
Adds a universal tool-selection playbook surfaced by MCP clients
(Claude Code, Cursor, opencode, LangChain, OpenAI Agent SDK) in the
agent's system prompt automatically. Without this, agents have to
infer tool composition from individual tool descriptions and tend to
walk callers manually instead of reaching for codegraph_impact, etc.

Scoped tight: only the 9 tools that exist on main today
(search/context/callers/callees/impact/node/explore/files/status), no
"(when present)" references to unmerged tools, no per-language
guidance. ~40 lines of useful guidance.

Salvaged from #121, which bundled the instructions with #117's MCP
tool-registry refactor and referenced many tools that don't exist on
main.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 21:33:32 -05:00
a460b856c2 perf(db): drop redundant idx_edges_source / idx_edges_target (#142)
Both narrow indexes are fully covered by the existing (source, kind)
and (target, kind) composites via SQLite's left-prefix scan, so
they're dead weight on every write. Empirical measurements (from the
spike script in PR #122 on a 50K-node / 250K-edge synthetic DB):

  - DB size: 34.7 MB → 27.0 MB (-22.2%)
  - Bulk insert (250K edges): 590ms → 431ms (1.37× faster)
  - source/target lookup latency: no regression

Adds migration v4 to drop both on existing databases; fresh-DB schema
no longer creates them.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 21:29:00 -05:00
Colby MchenryandGitHub 2dc4bc3968 Merge pull request #84 from colbymchenry/colbymchenry-patch-1
Update README.md
2026-04-14 18:31:46 -05:00
Colby MchenryandGitHub 1cf5ccf925 Update README.md 2026-04-14 18:31:36 -05:00
Colby McHenry 19532a81a5 Enhance search result merging and Svelte component extraction
Changes search result deduplication to use max scores across channels instead of first-seen prioritization, adds template component usage extraction for Svelte files, exempts exact matches from single-term score dampening, prioritizes structural edges in graph traversal, and increases explore tool node budget while including edge source locations in file clustering.
2026-04-08 17:27:35 -05:00
Colby McHenry 88fa716418 Add Svelte language support and improve codegraph_explore tool guidance
Adds Svelte to the list of supported languages and enhances the codegraph_explore tool description with specific guidance to use symbol names and file names rather than natural language queries. Recommends using codegraph_search first to discover relevant names for more effective exploration.
2026-04-07 23:47:45 -05:00
Colby McHenry 39c9b6cf7a Improve search relevance by refining scoring and filtering algorithms
Removes overly generic stopwords that were filtering useful terms like "connection" and "process". Adjusts scoring to be less harsh on single-term matches and more aggressive on multi-term CamelCase matches. Expands CamelCase matching to handle acronym boundaries (e.g., RPCProtocol) and caps entry points to prevent spreading traversal budget too thin across many results.
2026-04-07 17:28:47 -05:00
Colby McHenry 789158bfd4 Bump version to 0.7.2
Updates Swift and Kotlin language support from basic to full in documentation and reduces explore budget thresholds to optimize performance for smaller codebases.
2026-04-07 16:56:41 -05:00
Colby McHenry 884b6c7fb5 Bump version to 0.7.0 2026-04-07 16:17:26 -05:00
Colby McHenry 32f9cd460e docs: Clean up README formatting and remove deprecated CLI hook commands
Removes crystal ball emoji and bullet formatting inconsistencies from README headers. Eliminates mark-dirty and sync-if-dirty CLI commands and related hook configuration code, simplifying the codebase after transitioning to file watcher-based auto-sync.
2026-04-07 16:14:58 -05:00
Colby McHenry a0a18b1913 Update package description with improved performance metrics
Replaces token reduction claims with concrete performance improvements: 94% fewer tool calls and 77% faster exploration. Reflects actual measured benefits of the code intelligence system.
2026-04-07 16:03:29 -05:00
Colby McHenry 3da5c96a0b feat: Add file watcher with debounced auto-sync and comprehensive test coverage
Addresses the need for automatic graph synchronization on file changes. Implements FileWatcher using native OS file events (FSEvents/inotify/ReadDirectoryChangesW) with 2-second debouncing to prevent thrashing on rapid saves. Filters changes against include/exclude patterns and ignores .codegraph directory modifications. Integrates with CodeGraph API (watch/unwatch/isWatching methods) and MCP server for automatic activation. Updates documentation to reflect shift from semantic to full-text search and removal of manual hook installation requirements.
2026-04-07 16:02:15 -05:00
Colby McHenry 453c39d774 refactor: Remove semantic search and vector embedding functionality
Removes @xenova/transformers dependency, vector storage tables, embedding generation, and semantic search APIs. Simplifies context building to use only FTS search. Eliminates visualizer server, postinstall model download, and related CLI commands. Reduces package size and complexity while maintaining core static analysis capabilities.
2026-04-07 14:59:48 -05:00
Colby McHenry 7507605be5 fix: Add Node.js 25+ compatibility warning for V8 WASM compiler bugs
Addresses potential crashes on Node.js 25+ due to V8 turboshaft WASM compiler issues. Adds runtime version check with warning to recommend Node.js 22 LTS and sets upper bound engine constraint to
2026-04-07 14:02:19 -05:00
Colby McHenry f402ab8363 feat: Add complete PHP language support with trait handling and property extraction
Addresses PHP traits extracted as classes, missing class properties, skipped constants, and invisible trait usage. Adds classifyClassNode to distinguish traits from classes, fixes property extraction for PHP's property_element AST structure (added 4,366 field nodes), and adds visitNode hook for class constants and trait use declarations (increased trait edges from 636 to 1,514). Also improves Liquid schema name handling and file path reference resolution. Verified against Laravel codebase.
2026-04-07 13:44:14 -05:00
Colby McHenry 1b279dcf94 fix: Handle JavaScript class inheritance parsing differences from TypeScript
Addresses JavaScript `class extends` producing zero inheritance edges due to tree-sitter grammar differences. JavaScript uses `class_heritage → identifier` (bare) while TypeScript wraps with `extends_clause`. Updates extractInheritance to handle bare identifier/type_identifier children when parent is class_heritage.
2026-04-07 13:03:47 -05:00
Colby McHenry 2ae9a465ec feat: Add complete Svelte language support with template call extraction
Addresses Svelte function calls invisible in template expressions and ugly destructured variable names. Adds SvelteExtractor that delegates `
2026-04-07 12:27:50 -05:00
Colby McHenry b872459f19 fix: Handle Kotlin fun interface edge cases with annotated methods and nested interfaces
Addresses two tree-sitter misparse patterns: (1) fun interfaces with @Throws annotations parse as function_declaration > ERROR instead of user_type, (2) parent interface bodies become ERROR nodes when containing nested fun interfaces, causing methods to be skipped. Updates isFunInterfaceNode to check ERROR-nested user_type children and resolveBody to prefer ERROR bodies starting with `{`.
2026-04-07 12:09:43 -05:00
Colby McHenry 0cad147859 feat: Add complete Kotlin language support with fun interface handling
Addresses Kotlin interfaces/enums extracted as classes, zero function calls, and missing `fun interface` declarations. Adds classifyClassNode to distinguish interfaces/enums from classes, resolveBody hook for non-field grammar, navigation_expression call handling, getReceiverType for extension functions, and visitNode hook to detect `fun interface` misparse patterns from tree-sitter-kotlin's lack of Kotlin 1.4+ syntax support. Verified against Koin and LeakCanary codebases.
2026-04-07 11:54:52 -05:00
Colby McHenry bf3e6a82ff docs: Update Dart language support status to completed
Marks Dart bare call extraction as verified against Flutter codebase. Completes the language-specific getReceiverType implementation tracking by documenting that Dart methods are properly nested in class bodies and selector-based method calls are now handled.
2026-04-07 11:11:32 -05:00
Colby McHenry a2ed181055 feat: Add Dart bare call extraction for selector-based method calls
Addresses Dart method calls like `obj.method()` and `runApp()` that parse as identifier+selector combinations instead of dedicated call nodes. Adds extractBareCall hook to detect selector nodes with argument_part, handling simple function calls, method chains, constructor calls (new/const), and super/this method calls. Enables proper call relationship tracking for Dart's selector-based call syntax.
2026-04-07 11:01:53 -05:00
Colby McHenry 8a2f158dd4 feat: Add per-file and non-production diversity caps to context building
Addresses single files monopolizing the node budget when BFS traverses from multiple entry points in the same class. Caps each file to ~20% of maxNodes and limits test/sample/integration files to 15% to ensure cross-file diversity in context results. Expands isTestFile detection to include integration, sample, example, and other non-production directories.
2026-04-07 10:28:01 -05:00
Colby McHenry afcb9fa3e5 feat: Add TypeScript abstract class extraction and fix arrow function naming
Addresses TypeScript abstract classes missing by adding abstract_class_declaration to classTypes. Fixes single-expression arrow functions being silently dropped by preventing extractName from searching identifiers in arrow_function/function_expression bodies, ensuring they return  for proper parent name resolution instead of incorrectly using body identifiers.
2026-04-07 09:57:51 -05:00
Colby McHenry 49e670c223 feat: Add resolveBody hook for JS/TS class field function extraction
Addresses arrow function class fields like `field = () => { ... }` where the function body is nested inside field_definition nodes. Adds resolveBody method to traverse field_definition → arrow_function/function_expression → body and handles HOF wrapper patterns like `field = throttle(() => { ... })` by searching call_expression arguments. Enables proper function body extraction for class field functions in both JavaScript and TypeScript.
2026-04-07 09:40:50 -05:00
Colby McHenry 9382a087f4 feat: Add Ruby bare method call extraction for identifier nodes
Addresses Ruby bare method calls like `reset` that parse as identifier nodes instead of call expressions. Adds extractBareCall hook to detect statement-level identifiers that represent method calls, filtering out keywords, literals, and constants. Enables proper call relationship tracking for Ruby's parentheses-optional method syntax.
2026-04-07 09:27:00 -05:00
Colby McHenry 59ea5a43be feat: Add Ruby module extraction with containment and qualified names
Addresses Ruby methods inside modules missing owner in qualified_name by adding visitNode hook to extract module AST nodes. Methods inside modules now get Module::method qualified names with proper containment relationships. Includes ExtractorContext wiring with pushScope/popScope for language hooks and updates isInsideClassLikeNode to include module kind for nested method handling.
2026-04-07 09:17:34 -05:00
Colby McHenry 07d899b735 feat: Promote "extends" to "implements" for class-to-interface relationships in edge creation
Addresses semantic accuracy in inheritance relationships where classes use "extends" syntax to implement interfaces. Adds target node inspection to detect interface/protocol targets and promotes the edge kind from "extends" to "implements" when the source is a concrete class or struct, ensuring proper representation of implementation vs inheritance relationships in the code graph.
2026-04-07 00:02:47 -05:00
Colby McHenry b712e4de63 feat: Add C# property/field extraction and inheritance support
Addresses C#'s property_declaration nodes (public string Name { get; set; }) by adding propertyTypes support and extractProperty method. Improves field extraction to handle C#'s nested variable_declaration > variable_declarator structure. Adds base_list handling in extractInheritance for C#'s `: Parent, IInterface` syntax where base class and interfaces are combined in a single colon-separated list.
2026-04-06 23:53:30 -05:00
Colby McHenry 4a8d2f0396 feat: Add content-based C++ detection for .h headers
Addresses C++ classes missing from .h files where extension-based detection defaults to 'c' language which has no class extraction support. Adds looksLikeCpp() heuristic that scans first 8KB for C++-specific patterns (namespace, class, template, access specifiers) to promote .h files to 'cpp' language when C++ constructs are detected. Ensures cpp grammar is loaded alongside c to handle potential .h promotion during parsing.
2026-04-06 23:38:13 -05:00
Colby McHenry 237fb3b206 feat: Add C++ macro misparse handling and structural node extraction in function bodies
Addresses C++ macros like NLOHMANN_JSON_NAMESPACE_BEGIN that cause tree-sitter to misparse namespace blocks as function_definitions. Adds isMisparsedFunction hook to filter macro artifacts while still visiting their bodies to extract legitimate class/struct/enum definitions hidden inside the misparsed "function" scope.
2026-04-06 23:24:26 -05:00
Colby McHenry 6f34be38aa feat: Add C/C++ typedef enum and struct extraction with inner type resolution
Addresses C/C++ typedef syntax where anonymous enum/struct definitions are wrapped in typedef declarations (e.g. `typedef enum { A, B } MyEnum;`). Adds resolveTypeAliasKind to identify inner enum_specifier and struct_specifier nodes within typedefs, enabling proper extraction of enum members and struct fields from the inner anonymous definitions rather than treating them as simple type aliases.
2026-04-06 22:58:35 -05:00
Colby McHenry da248f9a8e feat: Improve C/C++ name extraction and skip forward declarations in struct/enum processing
Addresses C/C++ pointer declarator unwrapping where pointer_declarator nodes need to be resolved to find the actual function/variable name. Adds forward declaration filtering by checking for body field presence before processing struct and enum definitions, preventing extraction of incomplete type declarations.
2026-04-06 22:49:09 -05:00
Colby McHenry e848e6f22f feat: Add PHP inheritance extraction and improve method call handling
Addresses PHP's base_clause syntax for class inheritance (extends) and implements clause for interface implementation. Adds trait_declaration support and separates property_declaration into fieldTypes. Improves PHP method call extraction by handling member_call_expression and scoped_call_expression with proper receiver name processing, including $ prefix stripping and self/this/parent/static receiver filtering.
2026-04-06 22:10:23 -05:00
Colby McHenry 2d14503258 feat: Add Rust trait inheritance and impl block extraction with method receiver type support
Addresses Rust's impl block syntax where trait implementations (`impl Trait for Type`) and trait supertraits (`trait Sub: Super`) create inheritance relationships. Adds getReceiverType to extract method receiver types from impl blocks, enabling proper method-to-struct relationships and qualified name resolution. Verified against Deno codebase and moved from "Needs Verification" to completed language support.
2026-04-06 21:50:03 -05:00
Colby McHenry ce7b7684db feat: Fix TypeScript inheritance extraction by properly handling class_heritage wrapper nodes
Addresses TypeScript's AST structure where class_heritage nodes wrap extends_clause and implements_clause rather than directly indicating inheritance relationships. Moves class_heritage from direct inheritance extraction to recursive container processing to properly traverse the wrapped inheritance syntax.
2026-04-06 21:13:57 -05:00
Colby McHenry 5046c760cb feat: Add Swift inheritance extraction for class, struct, enum, and protocol relationships
Addresses Swift's inheritance_specifier syntax where type relationships are specified after colons (e.g. `class UploadRequest: DataRequest, Sendable`). Extracts user_type > type_identifier children from inheritance_specifier nodes as 'extends' references to properly model Swift's inheritance, protocol conformance, and struct conformance patterns in the code graph.
2026-04-06 20:52:42 -05:00
Colby McHenry 80fd0f8381 feat: Mark Python as verified for method extraction without receiver type handling
Addresses tree-sitter AST structure verification where Python methods are nested within class bodies like Java and Swift, eliminating the need for getReceiverType extraction. Verified against Flask codebase and moved from "Needs Verification" to completed language support.
2026-04-06 20:39:51 -05:00
Colby McHenry e12bd7ce91 feat: Include receiver names in method call extraction and improve built-in filtering
Addresses method call resolution ambiguity where bare method names couldn't be distinguished from function calls. Modifies tree-sitter extraction to include receiver names (e.g., "console.log" instead of just "log") while skipping common instance references like self/this. Updates built-in filtering to be language-specific and adds Python built-in method detection based on receiver types and method names.
2026-04-06 20:31:37 -05:00
Colby McHenry a0f599e00b feat: Add Python class inheritance extraction for superclass relationships
Addresses Python's class definition syntax where parent classes are specified in argument_list nodes (e.g. `class Child(Parent, Mixin):`). Extracts identifier and attribute children from argument_list as 'extends' references to properly model Python's inheritance patterns in the code graph.
2026-04-06 20:13:25 -05:00
Colby McHenry 392c146810 feat: Add optional stem control to search term extraction and improve name match scoring
Addresses path relevance scoring inflation where stem variants created many near-duplicate terms that all matched the same path segments. Adds stems option to extractSearchTerms (default true) and disables stems for path scoring while keeping them for FTS matching. Also improves name match bonus scoring with length-based prefix matching and higher exact match scores.
2026-04-06 19:50:53 -05:00
Colby McHenry 902cb0ef9d feat: Add Go selector_expression support to function call extraction
Addresses Go's tree-sitter parsing where method calls use selector_expression nodes with 'field' children instead of member_expression nodes with 'property' children. Extends function call extraction to handle Go's obj.method() syntax alongside existing JavaScript/TypeScript support.
2026-04-06 19:13:57 -05:00
Colby McHenry b1224bcc6a feat: Remove file path from qualified names to prevent FTS pollution and add Go import reference tracking
Addresses qualified name pollution where file paths contaminated full-text search results. Removes file path prefix from buildQualifiedName output and method qualified names, keeping semantic hierarchy only. Also adds unresolved reference creation for Go imports to enable proper import edge resolution in the dependency graph.
2026-04-06 18:59:35 -05:00
Colby McHenry 1244c62193 feat: Add Go struct and interface embedding extraction for inheritance relationships
Addresses Go's embedding mechanism where structs can embed other types without field names (e.g. `type DB struct { *Head; Queryable }`) and interfaces can embed other interfaces via constraint_elem nodes. Extracts these embedded types as 'extends' relationships to properly model Go's composition-based inheritance patterns in the code graph.
2026-04-06 18:47:12 -05:00
Colby McHenry 982d987349 feat: Fix Go struct/interface extraction by refactoring type_spec handling through type alias resolver
Addresses Go's tree-sitter parsing where structs and interfaces are wrapped in type_spec nodes rather than appearing as direct node types. Moves struct_type and interface_type detection from direct node type matching to a new resolveTypeAliasKind resolver that examines the inner type field, ensuring proper extraction with field visiting and inheritance detection.
2026-04-06 18:33:37 -05:00
Colby McHenry 630053f3a3 feat: Improve exact name match scoring and expand stop word filtering
Uses max FTS score as baseline for exact name matches to ensure nameMatchBonus differentiation during rescoring, increases exact match limit from 5 to 20 candidates, and adds common conversational terms to stop words to reduce query noise.
2026-04-06 16:55:09 -05:00
Colby McHenry f3a0fd402f feat: Add exact name match supplement to prevent BM25 burial in search results
Addresses cases where BM25 can bury short exact-match names (e.g. "Query") under hundreds of compound names (e.g. "QueryParserTokenManager") in large codebases, pushing them past the FTS fetch limit before post-hoc scoring can help. Supplements primary search results with direct case-insensitive name lookups for each query term, ensuring exact matches are always candidates for scoring.
2026-04-06 16:35:20 -05:00
Colby McHenry e41431abc2 feat: Fix stem variant inflation in multi-term search boosting by grouping related terms
Addresses cases where stem variants like "index", "indexed", "indexe" were counted as separate term matches, artificially inflating match counts and giving false multi-term boosts to symbols matching one root word multiple times. Groups terms that are substrings of each other before counting matches to ensure each conceptual term contributes only once to the boost calculation.
2026-04-06 16:16:25 -05:00
Colby McHenry d9e973cffc feat: Add edge recovery to restore connectivity after node trimming in context building
Addresses cases where BFS with multiple entry points leaves most nodes disconnected after trimming. Discovers edges between already-selected nodes using specific relationship types (calls, extends, implements, references, overrides) to recover inter-node connectivity that would otherwise be lost during the node selection process.
2026-04-06 16:08:42 -05:00
Colby McHenry f668b2cd1c feat: Add stem variants to search term extraction for broader definition matching
Expands symbol lookup with morphological variants (e.g., "caching"→"cache", "eviction"→"evict") to find related class definitions that FTS prefix matching would otherwise miss. Includes comprehensive stemming rules for common English suffixes (-ing, -tion, -ed, -er, etc.) and integrates stem expansion into definition prefix search for improved symbol discovery.
2026-04-06 15:56:31 -05:00
Colby McHenry c626dfa989 feat: Improve multi-term search ranking with co-occurrence boosting and compound matching
Addresses cases where multi-word queries like "search execution from request to shard" return generic single-term matches instead of highly relevant classes matching multiple terms. Applies co-occurrence boosting before truncation to prioritize nodes matching 2+ query terms, adds compound term matching to catch classes like "SearchShardsRequest" that contain multiple query terms at any position, and widens per-term accumulation pools to prevent relevant multi-term matches from being filtered out early.
2026-04-06 14:27:13 -05:00
Colby McHenry 88d9c2a2f4 feat: Add CamelCase substring search and type hierarchy expansion to context building
Introduces LIKE-based substring matching to find symbols like "Search" within "TransportSearchAction" that FTS cannot match due to tokenization boundaries. Adds dedicated type hierarchy traversal to ensure parent/child classes and interfaces are included in context results, preventing BFS budget exhaustion on method-level nodes before reaching inheritance relationships.
2026-04-06 14:00:03 -05:00
Colby McHenry 13d3ff3613 feat: Add comprehensive evaluation framework for CodeGraph API testing
Introduces automated testing infrastructure to measure CodeGraph performance across searchNodes and findRelevantContext APIs. Includes recall/MRR scoring metrics, predefined test cases for symbol lookup and context exploration, and JSON report generation. Enhances context building with acronym extraction, definition prefix matching, and improved FTS filtering to exclude imports by default.
2026-04-06 13:24:27 -05:00
Colby McHenry d4258b1651 docs: Simplify getImpactRadius API call in verification guide
Updates example code to use the simplified two-parameter form of getImpactRadius instead of the options object pattern, making the documentation consistent with current API usage.
2026-04-06 13:07:38 -05:00
Colby McHenry e5663c5952 feat: Enhance search ranking with name matching and field extraction improvements
Adds nameMatchBonus scoring to prioritize results where node names exactly or partially match query terms. Implements dedicated field extraction for Java/C# to properly categorize class fields vs variables. Optimizes BM25 search with column weights favoring name matches and increased result fetching before post-processing. Refines stop words list to preserve common programming terms like "get", "find", "list".
2026-04-06 12:20:44 -05:00
Colby McHenry b04ee9f9bb docs: Replace search quality loop guide with comprehensive language verification framework
Replaces the focused search quality improvement loop with a complete language verification system. The new guide provides a systematic battery of tests (explore, search, call chains, impact analysis, edge extraction, node completeness, and real-world LLM prompts) to verify CodeGraph fully supports a programming language before marking it as production-ready.
2026-04-06 12:04:31 -05:00
Colby McHenry fba9da53cd docs: Mark Swift as completed for receiver type extraction
Swift methods in extension blocks are already parsed correctly by tree-sitter, which treats `extension Type { }` as `class_declaration` and automatically includes the owner type in qualified names. No getReceiverType implementation needed.
2026-04-06 11:49:25 -05:00
Colby McHenry c0c8a3bb43 feat: Add enum member extraction support across all language extractors
Extends AST parsing to identify and extract individual enum members/cases for better code analysis. Adds enumMemberTypes configuration to each language extractor with language-specific node types (e.g., 'enum_variant' for Rust, 'enum_case' for PHP, 'enum_entry' for Swift/Kotlin). Implements flexible member name resolution supporting both field-based and identifier-based extraction patterns.
2026-04-06 11:32:56 -05:00
Colby McHenry 6598904d06 docs: Add search quality improvement guide for CodeGraph language extractors
Documents the systematic process for testing and improving search result relevance when LLMs query CodeGraph. Provides step-by-step loop for diagnosing issues with method search ranking, implementing getReceiverType hooks for languages where methods appear outside their owner type in the AST, and validating fixes with real codebases.
2026-04-06 11:20:37 -05:00
Colby McHenry 7a3afc9124 feat: Enhance symbol search with co-location boosting and receiver type support
Improves search accuracy by boosting results when multiple query symbols appear in the same file, addressing cases where common names like "run" return too many results. Adds Go method receiver type extraction to qualified names for better searchability (e.g., "scrapeLoop.run"). Optimizes database queries with two-pass approach to handle distinctive vs common symbol names efficiently.
2026-04-06 11:16:56 -05:00
Colby McHenry d256af3a23 feat: Optimize reference resolution with indexed queries and built-in filtering
Replaces O(n) file scanning with O(log n) indexed database lookups by adding getAllNodeNames query and caching node lookups by name/qualified name. Pre-filters references against known symbol names to skip expensive resolution for non-existent symbols. Consolidates Go resolver helper functions into a unified resolveByNameAndKind function and moves built-in symbol sets to module-level constants for better performance.
2026-04-06 10:45:14 -05:00
Colby McHenry cacc213f09 feat: Remove unused 'finalizing' phase from indexing progress
Eliminates the intermediate 'finalizing' phase that was added as a progress bar transition state but served no functional purpose. Simplifies the progress flow by going directly from 'storing' to 'resolving' phases, removing associated UI labels and progress callbacks.
2026-04-06 09:57:53 -05:00
Colby McHenry 9a2d3d9a13 feat: Fix progress bar hanging and improve UI responsiveness during indexing
Adds strategic yield points and direct stdout writes to prevent progress animation from freezing when the main thread is blocked by synchronous operations. Introduces 'finalizing' phase to smooth transition between parsing and resolving steps, ensuring progress reaches 100% completion.
2026-04-06 09:50:30 -05:00
Colby McHenry b768a9aa18 feat: Improve benchmark results presentation and add average performance metrics
Restructures the benchmark table for better readability by separating queries into a details section and highlighting the overall 92% fewer tool calls and 71% faster performance. Makes the compelling efficiency gains more prominent while maintaining all detailed information in an expandable section.
2026-04-06 09:24:53 -05:00
Colby McHenry 77432fe4ea feat: Add dynamic codegraph_explore call budgets based on project size
Replaces fixed 6-call limit with adaptive budgets that scale from 2 calls for small projects (
2026-04-06 09:21:49 -05:00
Colby McHenry 8e8759ff13 feat: Add Swift Compiler benchmark and increase codegraph_explore call limit to 6
Updates benchmark results with the largest tested codebase (25,874 files, 272,898 nodes) demonstrating CodeGraph's scalability. Increases the recommended call limit from 3 to 6 to accommodate more complex cross-cutting queries while maintaining efficiency gains over traditional file-reading approaches.
2026-04-04 23:21:47 -05:00
Colby McHenry 9249c4692a feat: Add comment-stripping fallback for WASM memory failures and improve retry strategy
Recycles workers before each retry attempt instead of once per batch to maximize WASM memory headroom. Adds final fallback that strips comment-only lines from files that still crash on clean workers, reducing memory pressure from compiler test files with extensive CHECK directives while preserving line numbers for accurate node positions.
2026-04-04 23:08:50 -05:00
Colby McHenry 1271ad9161 feat: Add adaptive timeouts and WASM memory error recovery for robust parsing
Implements file-size-based timeouts (base 10s + 10s per 100KB), more frequent worker recycling (250 files), and automatic retry logic for WASM memory corruption failures. Workers now crash immediately on memory errors to prevent cascading failures, with failed files automatically retried on fresh workers with clean heaps.
2026-04-04 22:49:36 -05:00
Colby McHenry c19c0ca8fd feat: Add verbose mode with worker lifecycle monitoring and improved error handling
Adds --verbose flag to init and index commands that shows timestamped progress output instead of animated progress bars. Implements worker timeout protection (10s per file) and periodic worker recycling (every 500 files) to prevent WASM memory crashes from hanging the entire indexing process. Includes detailed logging of worker lifecycle events and memory usage for debugging large repository indexing issues.
2026-04-04 22:28:25 -05:00
Colby McHenry 64d844c938 feat: Move parsing to worker threads for smooth progress animation
Offloads tree-sitter parsing to a dedicated worker thread, keeping the main thread unblocked so shimmer progress animations render smoothly during indexing. Refactors shimmer progress renderer into separate worker for consistent 50ms animation updates. Falls back to in-process parsing when worker compilation unavailable (e.g., tests).
2026-04-04 11:36:20 -05:00
Colby McHenry ed35d65f4c feat: Replace figlet with @clack/prompts for polished CLI experience
Replaces ASCII art banner and basic readline prompts with @clack/prompts for a modern interactive CLI. Adds animated shimmer progress bars with spinner glyphs during indexing operations. Improves installer UX with structured prompts, better error handling, and cleaner output formatting throughout all CLI commands.
2026-04-04 11:07:18 -05:00
Colby McHenry 3a44d5c4d1 fix: Improve CLI progress display and prevent tree-sitter WASM memory crashes
Replaces fixed-width padding with terminal escape sequences for proper progress line clearing across different terminal widths. Adds periodic parser reset every 5000 parses per language to prevent WASM heap fragmentation that causes "memory access out of bounds" crashes in large repositories. Includes filename truncation to fit available terminal width.
2026-04-04 10:28:07 -05:00
Colby McHenry e4908e1270 feat: Add database schema v3 with optimized node lookups and improved error handling
Adds expression index on lower(name) for memory-efficient case-insensitive searches, replacing in-memory caches that caused OOM on large codebases. Includes batched reference resolution, enhanced error reporting with detailed breakdown by error type, and improved CLI progress display for scanning phases.
2026-04-04 10:19:08 -05:00
Colby MchenryandGitHub 9cd5ef9870 Merge pull request #78 from colbymchenry/fix/explore-depth-and-qualified-symbol-lookup
fix: Improve explore depth and qualified symbol lookups
2026-04-03 19:58:34 -05:00
Colby McHenryandClaude Opus 4.6 b986b78fa9 fix: Increase explore traversal depth and support qualified symbol lookups
Two fixes discovered while benchmarking Swift (Alamofire):

1. codegraph_explore traversalDepth 2→3: Deep call chains (e.g., Alamofire's
   9-step Session.request()→URLSession flow) couldn't be followed in a single
   explore call, forcing agents to fall back to file reads.

2. findSymbol/findAllSymbols now support "Parent.child" notation (e.g.,
   "Session.request") by matching against qualified names (::Parent::child).
   Previously only checked node.name === symbol, which never matched qualified
   queries since node names are unqualified.

Also adds Alamofire Swift benchmark data to README (91% fewer tool calls,
78% faster with CodeGraph).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 19:56:58 -05:00
Colby McHenry 0d6f460b15 fix: Reduce codegraph_explore output limit to stay under MCP client token limits
Decreases maximum output from 50,000 to 35,000 characters to prevent exceeding ~10k token limits in MCP clients that could cause truncation or errors when processing exploration results.
2026-04-03 19:34:56 -05:00
Colby MchenryandGitHub eefa622965 Merge pull request #77 from colbymchenry/refactor/extract-language-configs
refactor: Extract per-language configs from tree-sitter.ts
2026-04-03 19:26:32 -05:00
Colby McHenryandClaude Opus 4.6 c8407ad007 refactor: Extract per-language configs and standalone extractors from tree-sitter.ts
Splits the monolithic tree-sitter.ts (3,358 lines) into modular files:
- 14 language config files under src/extraction/languages/
- 3 standalone extractors (Liquid, Svelte, DFM)
- Shared helpers and types modules to avoid circular imports

Also fixes a bug where Java's extractImport hook incorrectly set
handledRefs: true, preventing unresolved reference creation and
degrading codegraph_explore results for Java codebases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 19:25:59 -05:00
Colby McHenry 0d63166f9d docs: Update benchmark results with comprehensive multi-codebase testing data
Replaces limited 3-test benchmark with results from 4 real-world codebases (VS Code, Excalidraw, Claude Code) showing 94% fewer tool calls and 77% faster exploration. Updates performance claims and adds detailed breakdown of tool usage patterns with and without CodeGraph.
2026-04-03 17:23:21 -05:00
Colby McHenry 2edc939245 fix: Handle gitignored project directories in git file detection
When a project directory is gitignored by a parent git repository, `git ls-files` returns no results even though files exist. Added detection for this scenario using `git rev-parse` and `git check-ignore` to fall back to filesystem walking when the project directory is ignored by an ancestor repo.
2026-04-03 17:17:31 -05:00
Colby McHenry 4d65d60ded feat: Update Claude instructions to discourage direct codegraph tool usage in main session
Changes guidance to recommend spawning Explore agents for exploration questions instead of using codegraph_explore/codegraph_context directly in main session to avoid filling up context with large amounts of source code. Adds completeness signal to codegraph_explore output so agents know not to re-read files that already have source code included.
2026-04-03 17:03:03 -05:00
Colby McHenry b927492bc0 feat: Add codegraph_explore tool for comprehensive single-call code exploration
Introduces a new MCP tool that performs deep code exploration in a single call, returning comprehensive context with full source code sections grouped by file and relationship mapping. Designed to replace multiple codegraph_node + file read operations for thorough understanding of code topics. Updates documentation to position explore as the primary tool for deep exploration questions.
2026-04-03 16:35:27 -05:00
Colby McHenry 4af51f565b feat: Extract type references from annotations and improve symbol query matching
Adds type annotation parsing to create references edges for parameter types, return types, and variable type annotations in TypeScript and other typed languages. Expands symbol extraction from queries to capture lowercase identifiers and filters out more common English words. Removes obsolete search utility tests.
2026-04-03 16:15:44 -05:00
Colby McHenry d575c945d9 chore: Add test_frameworks to .gitignore 2026-04-03 15:03:01 -05:00
Colby MchenryandGitHub f98dadc2c2 Merge pull request #76 from colbymchenry/fix/liquid-callers-and-context-relevance
fix: Fix Liquid template callers and context relevance
2026-04-03 13:31:55 -05:00
Colby McHenryandClaude Opus 4.6 68ec482bf4 fix: Fix callers/callees for Liquid templates and improve context relevance
Three issues discovered testing CodeGraph against a Shopify Liquid theme:

1. Callers/callees only traversed 'calls' edges, missing 'references' and
   'imports' edges that Liquid extraction creates for {% render %} and
   {% section %} tags. Expanded edge filter in getCallers/getCallees.

2. Context builder only ran text search as a fallback when semantic search
   returned nothing. For template-heavy codebases, semantic search returns
   irrelevant results (e.g., "Toast" for a header navigation query) while
   text/path-based matching would find the right files. Now always runs
   text search alongside semantic search with multi-term boosting.

3. MCP findAllSymbols only matched nodes by exact name, missing file nodes
   whose basename (without extension) matched the symbol. This caused
   callers to find zero results even with correct edges, since references
   edges point to file nodes (e.g., "product-card.liquid") not component
   nodes (e.g., "product-card").

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 13:31:14 -05:00