Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4b5cb19
perf(cli): V8's new space stays at 16 MB a side, so a sync peaks wher…
colbymchenry Nov 1, 2026
3b37fb0
perf(index): start the parse workers a project needs, and let them pa…
colbymchenry Nov 1, 2026
3ee5994
perf(db): read node rows as arrays, and a source file through one ope…
colbymchenry Nov 1, 2026
1f188da
perf(cpp): read C and C++ text by char codes, and ask each question o…
colbymchenry Nov 1, 2026
221d80c
fix(rust): a use through a module with a file per cfg reaches the ite…
colbymchenry Nov 1, 2026
608487e
fix(go): an implementer's methods must take and return the interface'…
colbymchenry Nov 1, 2026
45ea680
fix(swift): a closure reaches the overload that takes a function, a v…
colbymchenry Nov 1, 2026
be06c5e
fix(java): a call's arguments pick its overload, and a lambda's param…
colbymchenry Nov 1, 2026
fab65e9
fix(java): what a class inherits doesn't depend on resolve order, or …
colbymchenry Nov 1, 2026
c344366
fix(java): reading another class's constant doesn't read the file's o…
colbymchenry Nov 1, 2026
41587d3
fix(kotlin): a chain reads through a holder of its type argument (#3190)
colbymchenry Nov 1, 2026
59bfe6d
fix(kotlin): a Multiplatform import reaches what the caller compiles …
colbymchenry Nov 1, 2026
afa1e14
perf(resolution): resolver workers take the main thread's C++ project…
colbymchenry Nov 1, 2026
1548371
perf(resolution): run the resolver workers the main thread can keep b…
colbymchenry Nov 1, 2026
4e96d75
fix(resolution): a large run waits for its pool, so the main thread d…
colbymchenry Nov 1, 2026
6aa358c
fix(java): a lambda or method reference reaches the overload that tak…
colbymchenry Nov 1, 2026
47a9c7d
fix(python): whether a name is a local goes by the line reading it, n…
colbymchenry Nov 1, 2026
483a098
fix(ruby): a call on a parameter takes its class from the method's ca…
colbymchenry Nov 1, 2026
f72c9d2
fix(resolution): what a resolver keeps goes when what it was read fro…
colbymchenry Nov 1, 2026
01a4931
fix(cpp): a call through a template parameter links to each class wri…
colbymchenry Nov 15, 2026
329dd12
fix(resolution): what a walk answers doesn't depend on who asked firs…
colbymchenry Nov 16, 2026
5214384
Merge upstream 329dd12 into the fork, and release as 1.6.2-fmagent.4
Dshuishui Nov 16, 2026
0232fec
FORK.md: describe the regression cases without linking them
Dshuishui Nov 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ The public API surface is `src/index.ts` — the `CodeGraph` class wires all the
**It must stay light to load:** a read command, a query worker and the prompt hook all load it, and never index. What only indexing needs (extraction, resolution, the watcher) goes through `engine()` (`src/lazy-engine.ts`, listed in `src/engine.ts`), never an import of its own; `__tests__/lazy-engine.test.ts` fails otherwise.
- `src/db/` — `DatabaseConnection`, `QueryBuilder` (prepared statements), `schema.sql`, `sqlite-adapter.ts`. Backed by Node's built-in **`node:sqlite`** (`DatabaseSync`) — real SQLite with WAL + FTS5, exposed through a thin better-sqlite3-shaped adapter. The bundled runtime always ships Node ≥22.5, so `node:sqlite` is always available: **no native build step and no wasm fallback**. (Running from source needs Node ≥22.5.) `codegraph status` reports the live backend (`node-sqlite`, the sole backend).
- `src/extraction/` — `ExtractionOrchestrator`, tree-sitter wrappers, per-language extractors under `languages/` (one file per language), plus standalone extractors for non-tree-sitter formats (`svelte-extractor.ts`, `vue-extractor.ts`, `liquid-extractor.ts`, `dfm-extractor.ts` for Delphi). `parse-worker.ts` runs heavy parsing off the main thread.
- `src/resolution/` — `ReferenceResolver` orchestrates `import-resolver.ts` (with `path-aliases.ts` for tsconfig path aliases + cargo workspace member globs), `name-matcher.ts`, and `frameworks/` (Express, Laravel, CodeIgniter 3, Rails, FastAPI, Django, Flask, Spring, Gin, Axum, ASP.NET, Vapor, React Router, Next.js — `nextjs.ts`: pages and `route.ts` handlers from files, `router.push` / `redirect` / `NextResponse.redirect` as `navigates` edges, with `next-router-synthesizer.ts` for `<Link href>` and for the routes a proxy's `config.matcher` accepts, read by `next-proxy.ts` — Expo Router, SvelteKit, Vue/Nuxt, Cargo workspaces). Frameworks emit `route` nodes and `references` edges. `callback-synthesizer.ts` holds the whole-graph synthesis passes (`SYNTH_PASSES`, merged in registry order — first-seen wins a duplicate pair) with the language gates; `tier-synthesizer.ts` is the cross-tier pass (a client's literal `fetch`/`axios` path onto its own route, a queue job onto its consumer, a bus / socket event onto its handler — `channel`, `tier`, `registeredAt` on every edge; registered before the in-process emitter pass so its more specific edge wins); `synth-utils.ts` has the helpers they share (`enclosingFn`, `enclosingValue`, `makeLineAt`). Express's `postExtract` composes `app.use('/prefix', router)` mounts onto a mounted file's route names, idempotently (the original path stays in `qualifiedName`).
- `src/resolution/` — `ReferenceResolver` orchestrates `import-resolver.ts` (with `path-aliases.ts` for tsconfig path aliases + cargo workspace member globs), `name-matcher.ts`, and `frameworks/` (Express, Laravel, CodeIgniter 3, Rails, FastAPI, Django, Flask, Spring, Gin, Axum, ASP.NET, Vapor, React Router, Next.js — `nextjs.ts`: pages and `route.ts` handlers from files, `router.push` / `redirect` / `NextResponse.redirect` as `navigates` edges, with `next-router-synthesizer.ts` for `<Link href>` and for the routes a proxy's `config.matcher` accepts, read by `next-proxy.ts` — Expo Router, SvelteKit, Vue/Nuxt, Cargo workspaces). Frameworks emit `route` nodes and `references` edges. `parameter-flow.ts` (the engine, its SQL in `db/parameter-flow-queries.ts`) and `ruby-parameter-flow.ts` (one language's adapter) move a call on a parameter to the method of the one class every call site passes, after the calls edges persist. A sync looks only as far as what it changed reaches, from a record the last pass left in one metadata key, and whatever it can't settle from that falls back to a pass over the project. `callback-synthesizer.ts` holds the whole-graph synthesis passes (`SYNTH_PASSES`, merged in registry order — first-seen wins a duplicate pair) with the language gates; `cpp-template-instantiations.ts` is the pass for a C++ call through a template parameter, onto each class the project writes as the argument (read from `Name<Foo>`, `f<Foo>()`, a deduced call or a gtest type list), capped per parameter and by how widely a template is written; `tier-synthesizer.ts` is the cross-tier pass (a client's literal `fetch`/`axios` path onto its own route, a queue job onto its consumer, a bus / socket event onto its handler — `channel`, `tier`, `registeredAt` on every edge; registered before the in-process emitter pass so its more specific edge wins); `synth-utils.ts` has the helpers they share (`enclosingFn`, `enclosingValue`, `makeLineAt`). Express's `postExtract` composes `app.use('/prefix', router)` mounts onto a mounted file's route names, idempotently (the original path stays in `qualifiedName`).
- `src/graph/` — `GraphTraverser` (BFS/DFS, impact radius, path finding) and `GraphQueryManager` (high-level queries), plus the shared query-time derivations more than one surface renders: `named-symbol-flow.ts` (the one path finder, behind `codegraph_explore`'s Flow section and the viewer's Flow strip), `dynamic-boundary-report.ts` (where the graph stops), `type-hierarchy.ts` (ancestors/subtypes and the implementation count explore prints and the viewer draws),
`dead-code.ts` (unreferenced symbols, and every reason a candidate is NOT claimed), `synthesized-hop.ts` (how a synthesized hop reads, in explore's Flow, the `codegraph_node` trail and ContextBuilder's call paths — a new synthesizer's wording goes here), `file-cycles.ts` (circular imports, in `codegraph cycles` and the viewer's map). A derivation that two callers render must live here, not in `ToolHandler` — two derivations eventually disagree.
- `src/context/` — `ContextBuilder` + formatter for markdown/JSON output.
Expand Down Expand Up @@ -158,7 +158,7 @@ Two functions in `src/mcp/tools.ts` scale explore with indexed file count. This

### Dynamic-dispatch coverage — the flow must EXIST in the graph end-to-end

Static tree-sitter extraction misses computed/indirect calls, so flows break at dynamic dispatch and the agent reads to reconstruct them. Synthesizers/resolvers bridge these so `codegraph_explore` connects them end-to-end (`src/resolution/callback-synthesizer.ts`, `src/resolution/frameworks/`). Channels today: callback/observer, EventEmitter, **React re-render** (`setState`→`render`), **JSX child** (`render`→child component), **React Native native→JS events** (`sendEvent(withName:)` / JVM `emit` → the `addListener` handler, named or inline, `rn-event-channel`), django ORM descriptor. The JS→native direction is a *resolver* (`frameworks/react-native.ts`: `RCT_EXPORT_METHOD`, `RCT_EXTERN_MODULE` Swift shims, TurboModules), which trusts receiver evidence — an alias bound to `NativeModules.X` — over the import resolver. All synthesized edges are `provenance:'heuristic'` with `metadata.synthesizedBy` + `registeredAt` (the wiring site), surfaced inline in `codegraph_explore`'s Flow section and the `codegraph_node` trail.
Static tree-sitter extraction misses computed/indirect calls, so flows break at dynamic dispatch and the agent reads to reconstruct them. Synthesizers/resolvers bridge these so `codegraph_explore` connects them end-to-end (`src/resolution/callback-synthesizer.ts`, `src/resolution/frameworks/`). Channels today: callback/observer, EventEmitter, **React re-render** (`setState`→`render`), **JSX child** (`render`→child component), **React Native native→JS events** (`sendEvent(withName:)` / JVM `emit` → the `addListener` handler, named or inline, `rn-event-channel`), django ORM descriptor, **C++ template arguments** (`Txn::Put` or `shard.Clear()` in a template → that member of each class the project instantiates it with). The JS→native direction is a *resolver* (`frameworks/react-native.ts`: `RCT_EXPORT_METHOD`, `RCT_EXTERN_MODULE` Swift shims, TurboModules), which trusts receiver evidence — an alias bound to `NativeModules.X` — over the import resolver. All synthesized edges are `provenance:'heuristic'` with `metadata.synthesizedBy` + `registeredAt` (the wiring site), surfaced inline in `codegraph_explore`'s Flow section and the `codegraph_node` trail.

**Principle: partial coverage is WORSE than none.** Bridging one boundary but not the next reveals a hop the agent then drills + reads to finish. Measured on excalidraw: react-render alone *raised* reads to 5–7; only completing the flow (adding the jsx-child hop) dropped it to 0–1. **Always close the flow end-to-end and re-measure** — never ship a half-bridged flow.

Expand All @@ -179,6 +179,7 @@ Tests live in `__tests__/` and mirror the module they cover. Notable ones beyond
- `installer-targets.test.ts` — parameterized contract suite across every registered target (`ALL_TARGETS`); see the installer notes above.
- `evaluation/` — `runner.ts` + `test-cases.ts` exercise codegraph against synthetic projects and score the results; run via `npm run eval` (builds first). Not part of `npm test`.
- `sqlite-backend.test.ts` / `node-sqlite-backend.test.ts` — pin that `node:sqlite` is the sole backend: `getBackend()` reports `node-sqlite` and the DB comes up in WAL.
- `name-matcher-memo-clears.test.ts` — every module-level memo in `name-matcher.ts` is dropped by `clearNameMatcherMemos` or named in its short allow-list. A resolver outlives a sync, so a memo that isn't dropped goes stale in a long-lived server alone, where no single-index test sees it (`sync-memo-lifetime.test.ts` edits and syncs on one object). A project-level read too large to repeat (a Cargo workspace, a compile database) stays out of the clear functions and joins the module-config snapshot instead.
- `pr19-improvements.test.ts`, `frameworks-integration.test.ts` — regression coverage for specific past PRs/incidents; don't rename these, the names anchor to git history.

Tests create temp dirs with `fs.mkdtempSync` and clean up in `afterEach`. They write real files and exercise real SQLite — there is no DB mocking.
Expand Down
Loading