Repository navigation
feat(mcp): query same-repository worktrees per tool call - #561
Frankie-Xu wants to merge 5 commits into
Conversation
🌱 graft blast radius3 areas changed → 4 areas can be affected. 6 dependent symbols, depth 2. flowchart TB
A0(("Dependency Graph Building<br/>3 symbols"))
A1(("CLI Entry Point<br/>1 symbol"))
A2(("Context File Discovery<br/>1 symbol"))
A3(("MCP Server<br/>1 symbol"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0,A1,A2,A3 reached;
Who knows this code — 4 people across 7 areas
Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no All 6 dependent symbols, grouped by areaDependency Graph Building — 3 symbols in 3 files
CLI Entry Point — 1 symbol in 1 file
Context File Discovery — 1 symbol in 1 file
MCP Server — 1 symbol in 1 file
Test signal per changed area — 1 ✓ · 2 ✗Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
6 test suites also reference this code7 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
A shared MCP server currently answers every tool call from its startup root, so an agent reviewing a linked worktree can receive code and spans from the parent checkout. This adds an optional
rootto all six tools and routes refresh/query/cache access through the selected checkout. Results include the root and current full HEAD, including calls that omitroot.Fixes #515.
This is a proposed interface in Draft; no upstream agreement on
rootsemantics is assumed. Relative paths resolve against the server root, checkout subdirectories normalize to their Git top-level, and the canonical Git common directory defines the access boundary. Linked worktrees are accepted; separate clones, submodules and unrelated/non-Git roots are refused before graph access. A pinned--dirretains both the server's source scope and graph directory, and refuses another checkout. Existing no-root/workspace dispatch and old tool aliases remain supported.Graph and ask-index caches already use graph paths as keys; distinct checkout roots now select distinct paths and reuse those caches. HEAD is read on each response, and represents checkout identity rather than a content snapshot: uncommitted source edits still participate in freshness. Shared Git probes/enumeration receive a copied environment without inherited repository overrides, and session pricing is assigned after asynchronous freshness before query formatting.
Validation:
current-checkoutsource.--dirsource scope, non-Git defaults and target-only files under inherited Git overrides.npm run buildpassed (core + viewer TypeScript compilation and viewer/query bundles).test/generic-node24.test.tspassed (all breadth grammars).Cross-platform fixtures expand Windows DOS 8.3 temporary paths with
realpathSync.nativewhile checking the complete resolved root and full HEAD. The shared CodeQL workflow initializes and analyzes with the same officially verified v4.38.1 commit.Hosted CI passed on exact head
8d906bbb338427948a53b75193004d7012b65843: Ubuntu, Windows, Node 24 WASM, CodeQL analysis/aggregate, blast radius and blast viewer. The cleanup job is intentionally skipped. Local validation uses macOS arm64. This does not change implicit startup root discovery (#454) or implement the separate custom graph refresh guard (#443).