feat: cross-repo impact analysis (#794) — @repo MCP routing + group resources#984
Conversation
Expand MCP dispatch model, contracts (GroupImpactResult, GroupContextResult), service semantics, timeout/safeLocalImpact, resolveGroupRepo placement, safeParseMeta behavior, Phase 3.3a/3.3b test split, parseUri rules, Phase 5 mapping, risks, and final verification commands. Made-with: Cursor
- Extend GroupImpactResult with timeoutMs, truncationReason, crossDepthWarning - Add GroupContextResult and per-repo context aggregation - Implement runGroupImpact (local impact + bridge Cypher fan-out) in cross-impact.ts - Resilient contracts.json parsing with skippedCorrupt metadata - Extend GroupToolPort with context; wire LocalBackend - Unit tests for cross-impact and GroupService Made-with: Cursor
Made-with: Cursor
…ool cleanup Phase 3: Add integration tests for groupImpact and CLI group impact; add unit tests for GroupService group-mode API and LocalBackend @group routing. Phase 4: Remove MCP tools group_contracts, group_query, and group_status; extend impact, query, and context schemas and descriptions for @group repo syntax, optional service, and numeric bounds aligned with validation. Phase 5: Route impact/query/context in LocalBackend.callTool when repo starts with @ before resolveRepo; narrow handleGroupTool to group_list and group_sync; add resolveAtGroupMemberRepoPath helper and groupQuery service path filtering. Made-with: Cursor
- Add subgroupExact to groupQuery/groupContext so @group/member does not prefix-match nested member paths (Codex/OpenCode HIGH). - Build explicit param payloads in callToolAtGroupRepo; map context tool symbol name to target so group name is not overwritten (correctness). - Narrow MCP tool copy: service applies in @ group mode only; align text. - Refresh ai-context cross-repo section (remove retired group_* tools). - Extend unit tests for exact filter, routing errors, removed tools, MCP name. Made-with: Cursor
- Register `gitnexus://group/{name}/contracts` and
`gitnexus://group/{name}/status` MCP resources backed by GroupService
(resources.ts + LocalBackend resource handlers).
- Cover the new resources with unit tests in test/unit/resources.test.ts.
- Convert the Phase 5.4 manual smoke into a table-driven test in
test/unit/mcp/group-repo-routing.test.ts: `impact` / `query` / `context`
with `repo: "@myProduct"` + `service: "app/backend"` route to the
matching GroupService method and the leading `@` is stripped before
delegation.
- Ignore local agent scratch dirs (.tmp/, .agents/) so review prompts
and generated skill mirrors never leak into a commit.
Refs #794
Made-with: Cursor
…CP surface - Mark Phases 1–7 in docs/superpowers/plans/2026-04-16-issue-794-implementation.md as complete, fold in the Issue #794 traceability map, and record the Final verification snapshot (tsc clean + 9 vitest files / 111 tests). - Update docs/superpowers/specs/2026-03-31-cross-index-impact-design.md to match the Issue #794 MCP model: * `group_impact` / `group_contracts` / `group_query` / `group_status` are NOT MCP tools. * `impact` / `query` / `context` accept `repo: "@<groupName>"` and optional `service` for monorepo boundary filtering. * Group state is exposed via `gitnexus://group/{name}/contracts` and `gitnexus://group/{name}/status` resources. * Add MCP migration table and refresh AI-context guidance. - Restate execution handoff: Phases 4 + 5 + 6 share one branch and must ship as a single squash-merge to avoid a half-migrated MCP surface. Closes #794 Made-with: Cursor
|
@ivkond is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
Sync with upstream — picks up RFC #909 Ring 1/Ring 2 (scope-resolution SHARED + ingestion PKG), MCP context/impact disambiguation hints (#888), ai-context CLAUDE.md dedup (#904), Docker/release pipeline (#848 / #978 / #983), `analyze --name <alias>` (#955) and the v1.6.2 release line. Conflicts and how they were resolved: - .gitignore — kept both upstream's `docker/.env` and our local `.tmp/` + `.agents/` ignore block. - gitnexus/src/mcp/local/local-backend.ts — kept the new `resolveAtGroupMemberRepoPath` import alongside upstream's `collectBestChunks` / embedding / `PhaseTimer` imports. Auto-merged but verified manually: - gitnexus/src/mcp/tools.ts — Phase 4 cleanup intact (no `group_contracts` / `group_query` / `group_status` / `group_impact` tools), Phase 4/5 `repo: "@<groupName>"` + `service` descriptions still present on `impact` / `query` / `context`. - gitnexus/src/cli/ai-context.ts — Phase 7 guidance kept; agents are still pointed at `impact` / `query` / `context` with `@<groupName>`. Verification after merge: - `npx tsc --noEmit` (in gitnexus/) — clean (after rebuilding `gitnexus-shared` with `npm run build` for new RFC #909 exports). - `npx vitest run --pool=forks` over the Issue #794 Final-verification block — 9 files passed / 111 tests passed. Refs #794 Made-with: Cursor
|
@magyargergo when you have a moment, could you take a look at this one? It closes #794 (cross-repo impact analysis) and is the final piece of that workstream — |
CI Report✅ All checks passed Pipeline Status
Test Results
✅ All 6883 tests passed 98 test(s) skipped — expand for details
Code CoverageTests
📋 View full run · Generated by CI |
Fixes the `quality / format` CI job. `npx prettier --check .` reported
29 files repo-wide; this commit reformats only the 9 files that this PR
authored/modified:
- gitnexus/src/cli/group.ts
- gitnexus/src/core/group/{cross-impact,service}.ts
- gitnexus/src/mcp/{tools,resources}.ts
- gitnexus/src/mcp/local/local-backend.ts
- gitnexus/test/unit/group/{cross-impact,service}.test.ts
- gitnexus/test/unit/mcp/group-repo-routing.test.ts
The remaining 20 prettier offenders are pre-existing on `main`
(`.claude-plugin/marketplace.json`, `.mcp.json`, several
`gitnexus-claude-plugin/**/*.json`, `gitnexus-cursor-integration/hooks/hooks.json`,
`gitnexus/test/unit/{ast-cache,embedder,lazy-action,pipeline-exports}.test.ts`,
`gitnexus/test/utils/hook-test-helpers.ts`, `gitnexus/tsconfig.test.json`,
`gitnexus-web/tsconfig.node.json`, `.github/FUNDING.yml`) and out of
scope for this PR.
Re-verified after format:
- `npx tsc --noEmit` (in gitnexus/) — clean.
- `npx vitest run --pool=forks` over the #794 verification block —
9 files / 111 tests passed.
Refs #794
Made-with: Cursor
|
@claude Act as a senior reviewer for GitNexus. Your job is to determine whether this PR is production-ready for this repo, not to give a generic code review. You are reviewing a PR in the GitNexus monorepo:
Your task has 2 phases, in this exact order: PHASE 1 — DEFINE THE BAR PHASE 2 — REVIEW THE PR AGAINST THAT BAR CONTEXT TO LOAD FIRST
Additional context:
PRIMARY OBJECTIVE Do not optimize for completeness at the expense of signal. REVIEW RULES
For each finding, assign one severity:
REPO-SPECIFIC REVIEW CHECKLIST 1. Correctness & functional completenessCheck:
2. Code clarity & clean codeCheck:
3. Test coverage & change safetyEvaluate against TESTING.md:
4. PerformanceInspect for:
5. Operational riskCheck:
6. MaintainabilityCheck:
NON-NEGOTIABLES TO VERIFY
OUTPUT FORMAT Production-ready bar for this PRGive a concise repo-specific definition in 5–10 bullets. FindingsFor each finding, use this structure exactly: [BLOCKING|NON-BLOCKING|NIT] Short title
Only include findings that are real and supported.
What I could not fully verifyList any behavior you could not prove from the diff, tests, or available context. Final verdictChoose exactly one:
If verdict is not ready, list the blocking items in priority order. IMPORTANT REVIEW BEHAVIOR
|
|
Claude finished @magyargergo's task in 5m 4s —— View job PR Review: feat/cross-repo impact analysis (#794)
|
|
@ivkond can you please look into this? |
- Extract `repoInSubgroup` to `group-path-utils.ts` so `cross-impact.ts` and `service.ts` share a single implementation; the file-prefix helpers now also accept Windows-style backslashes by normalizing to POSIX before comparison (NB#1, NB#5). - `groupStatus` no longer redundantly `await import()`s `node:fs/promises` and `node:path` — the static imports at the top of `service.ts` are reused, removing the local-shadow risk (NB#2). - `groupContext` and `groupQuery` now fan their per-repo work out via `Promise.all` instead of a sequential `for...of` await loop. Errors remain isolated per repo and the result order matches the filtered member list (NB#3). - `runGroupImpact` now derives a single shared `deadline` from the caller-supplied `timeoutMs` before Phase 1, and Phase 2's fan-out reuses it instead of starting a fresh budget — total wall-clock can no longer exceed `timeoutMs` (NB#4). - New unit suite `test/unit/group/group-path-utils.test.ts` covers the shared helpers, including Windows-path normalization. Made-with: Cursor
…ting The PR #984 reviewer flagged that both top-level docs still listed the removed `group_query`, `group_contracts`, and `group_status` MCP tools. Bring them in line with the actual MCP surface introduced by #794: - `AGENTS.md` Tools Quick Reference now lists `query`/`context`/`impact` in group mode (`repo: "@<groupName>"`) and drops the three removed group_* tools. Adds the two new resources (`gitnexus://group/{name}/contracts` + `/status`) to the Resources table and a 1.5.0 changelog entry. - `ARCHITECTURE.md` MCP tools table is trimmed to `group_list` and `group_sync`, with a paragraph + resource table describing the group-aware behaviour of `query`/`context`/`impact` and the bridge fan-out for cross-repo impact. "Where to change what" now points at `src/core/group/` for cross-repo work. Made-with: Cursor
|
@ivkond please make sure the CI i heatlhy |
Move the 5 `CREATE_FTS_INDEX` calls out of the analyze pipeline and into lazy first-use initialisation, restoring CI headroom against the 30 s e2e test budget. Why --- LadybugDB's `CREATE_FTS_INDEX` costs ~440 ms per call regardless of table size — so on a 7-file mini-repo the 5 indexes (File, Function, Class, Method, Interface) added ~2.2 s of fixed overhead, ~3× that on slower Windows CI runners. This made `analyze` sit at ~18.7 s out of a 30 s budget on Windows: a normal runner spike was enough to push the `analyze command runs pipeline on mini-repo` e2e test (cli-e2e.test.ts:175) into a timeout flake (PR #984 run 24631480424). How --- * `lbug-adapter.ts`: add `ensureFTSIndex(table, indexName, props)` with an in-process `Set` cache (`ensuredFTSIndexes`). First call per `(table, indexName)` pays the LadybugDB cost; subsequent calls are a Set lookup. Cache is cleared by `closeLbug` so re-init starts fresh. * `bm25-index.ts`: introduce a single `FTS_INDEXES` schema constant, call `ensureFTSIndex` (single-process) or `ensureFTSIndexViaExecutor` (MCP pool, with its own per-repo `ensuredPoolFTS` cache) before each query. Indexes that already exist on disk just re-register cheaply through the cache; failures are best-effort and fall back to `[]`. * `run-analyze.ts`: drop the eager FTS phase block; replace with a comment explaining the new lazy strategy. * `CHANGELOG.md`: add Performance entry under Unreleased. Effect (mini-repo, Windows, warm runs) -------------------------------------- | Run | Before | After | Δ | |------------|---------|---------|---------| | Cold | 10.55 s | 4.37 s | -58 % | | Warm | 6.37 s | 4.00 s | -37 % | CI projection (Windows, ~3× ratio): 18.7 s → ~11.7 s, doubling the margin against the 30 s test budget from +60 % to +156 %. Verification ------------ * `tsc --noEmit` clean. * All 42 FTS-dependent integration tests pass: `search-core`, `search-pool`, `lbug-core-adapter`, `bm25-search`, `augmentation`. * `cli-e2e.test.ts` `analyze` test passes locally; two unrelated pre-existing failures in `wiki`/`status` (outdated error-message expectations) reproduce on the prior commit and are out of scope. Refs: #794, #984 Made-with: Cursor
|
@magyargergo, non blocking items addressed in c829f2a + ac69a08; out-of-scope perf follow-up in 5aef74c after the Windows CI flake. Review (c829f2a + ac69a08)
Perf flake fix (5aef74c) — out of scope, happy to split
Moved FTS creation to lazy first-use init via a new Why it's safe:
Effect (mini-repo, Windows warm): Verified: PTAL — and let me know if you'd prefer 5aef74c as a separate PR. |
|
@claude Act as a senior reviewer for GitNexus. Your job is to determine whether this PR is production-ready for this repo, not to give a generic code review. You are reviewing a PR in the GitNexus monorepo:
Your task has 2 phases, in this exact order: PHASE 1 — DEFINE THE BAR PHASE 2 — REVIEW THE PR AGAINST THAT BAR CONTEXT TO LOAD FIRST
Additional context:
PRIMARY OBJECTIVE Do not optimize for completeness at the expense of signal. REVIEW RULES
For each finding, assign one severity:
REPO-SPECIFIC REVIEW CHECKLIST 1. Correctness & functional completenessCheck:
2. Code clarity & clean codeCheck:
3. Test coverage & change safetyEvaluate against TESTING.md:
4. PerformanceInspect for:
5. Operational riskCheck:
6. MaintainabilityCheck:
NON-NEGOTIABLES TO VERIFY
OUTPUT FORMAT Production-ready bar for this PRGive a concise repo-specific definition in 5–10 bullets. FindingsFor each finding, use this structure exactly: [BLOCKING|NON-BLOCKING|NIT] Short title
Only include findings that are real and supported.
What I could not fully verifyList any behavior you could not prove from the diff, tests, or available context. Final verdictChoose exactly one:
If verdict is not ready, list the blocking items in priority order. IMPORTANT REVIEW BEHAVIOR
|
|
Claude finished @magyargergo's task in 4m 32s —— View job PR Review: feat/cross-repo impact analysis (#794)Tasks:
Production-ready bar for this PRBased on AGENTS.md, GUARDRAILS.md, CONTRIBUTING.md, TESTING.md, ARCHITECTURE.md, and the affected area (
Findings1. Correctness & functional completeness
Cypher queries are label-scoped and exact-match (
Shared deadline (
Graph schema integrity: No changes to node labels, edge types, or
2. Code clarity & clean codeNON-BLOCKING:
|
| Check | Status |
|---|---|
| No secrets, tokens, or machine paths committed | ✅ |
| No blind find-and-replace renames | ✅ |
| No HIGH/CRITICAL impact left unaddressed | ✅ |
PR title follows conventional commit format (feat: …) |
✅ |
| PolyForm Noncommercial license metadata untouched | ✅ |
| AGENTS.md updated for removed/changed MCP surface | ✅ (ac69a08) |
| ARCHITECTURE.md updated for removed/changed MCP surface | ✅ (ac69a08) |
All previous review's BLOCKING item (doc update) and NON-BLOCKING items (NB#1–#5) have been addressed in c829f2a + ac69a08. The 5aef74c perf commit is in-scope because it was required to fix the Windows CI timeout regression introduced by this PR's group-mode changes.
What I could not fully verify
- CI for post-review commits (
c829f2a,ac69a08,5aef74c): CI is currently in progress (run/24637816347). The earlier run (24631480424) was clean; these commits address review feedback and an unrelated FTS timing issue, so breakage is low probability — but green CI should be confirmed before merge. - Pool reconnect behavior after analyze: Cannot verify whether
pool-adapter.tsclears or reinitializes the connection when the underlying DB is recreated, which affects whether theensuredPoolFTSstale-cache scenario is reachable. - Bridge Cypher semantics end-to-end: Verified column order matches
rowToNeighborfallback indices, but cannot execute against a livebridge.lbugto confirm query plan correctness. openBridgeDbReadOnlynull conditions: The conditions under which it returnsnullvs. throws are internal tobridge-db.ts, which is not in this diff.
Final verdict
✅ Ready to merge — no blocking issues, contingent on CI passing for the latest commits.
The previous review's single BLOCKING item (doc update required by CONTRIBUTING.md) was addressed in ac69a08. All five NON-BLOCKING items were also resolved. The implementation is correct, well-tested, and operationally conservative. The remaining findings are either NITs or unverifiable without pool internals.
Confirm before merging:
- CI passes for branch HEAD (
5aef74c) — currently in progress.
|
@ivkond before I merge your PR in, please address this comment and also remove the other docs from you changes. 🙏
|
Addresses @magyargergo's review feedback on PR #984: these superpowers planning artefacts are internal to our workflow and should not live in the public repo. Removed: - docs/superpowers/plans/2026-04-16-issue-794-implementation.md - docs/superpowers/specs/2026-03-31-cross-index-impact-design.md Made-with: Cursor
|
Thanks for getting this through and for your patience! Feel free to join to our community on Discord! |
…uting + group resources (abhigyanpatwari#984)


Summary
Closes #794. Implements the cross-repo impact analysis surface defined in the linked issue and the refreshed RFC at
docs/superpowers/specs/2026-03-31-cross-index-impact-design.md.The MCP surface is now group-aware without introducing parallel
group_*tools:impact,query,contextacceptrepo: "@<groupName>"(optionally"@<groupName>/<memberPath>") and an optionalserviceparameter for monorepo-boundary filtering.gitnexus://group/{name}/contractsgitnexus://group/{name}/statusgroup_impact,group_contracts,group_query,group_statusMCP tools are intentionally not introduced —group_listandgroup_syncremain.What changed
gitnexus/src/core/group/cross-impact.tsimplements the two-phase traversal (local impact walk → cross-repo fan-out viabridge.lbugCypher) with UID-based symbol resolution (impactByUid) to suppress false positives on common symbol names. Types ingitnexus/src/core/group/types.ts(GroupImpactResult,GroupContextResult).GroupService+ CLI.GroupService.{groupImpact,groupContext,groupQuery,groupContracts,groupStatus,groupList}plusgitnexus group impact(gitnexus/src/cli/group.ts).safeParseMetamakes the contract registry resilient to corrupt rows.gitnexus/src/mcp/tools.tsremovesgroup_contracts,group_query,group_statusand extendsimpact/query/contextdescriptions for@<groupName>+service.@reporouting.gitnexus/src/mcp/local/local-backend.tsdispatchesrepo: "@..."calls onimpact/query/contexttoGroupService, stripping the@prefix before delegation and forwardingservice.gitnexus/src/mcp/resources.tsandLocalBackendregistergitnexus://group/{name}/contractsandgitnexus://group/{name}/statusand route reads throughGroupService.gitnexus/src/cli/ai-context.tsupdated to advertise the new surface.Tests
New / updated test files (all green locally on
mainbaseline + this branch):gitnexus/test/unit/group/cross-impact.test.tsgitnexus/test/unit/group/service.test.tsgitnexus/test/unit/group/group-service-group-mode.test.tsgitnexus/test/unit/group/group-tools.test.tsgitnexus/test/integration/group/group-impact.test.tsgitnexus/test/integration/group/group-cli.test.tsgitnexus/test/unit/tools.test.ts(adjusted for removed/extended tools)gitnexus/test/unit/resources.test.ts(new group resources)gitnexus/test/unit/mcp/group-repo-routing.test.ts(includes table-driven Issue [group] Cross-repo impact analysis, CLI and MCP tool (split 5/5 of #606) #794 manual smoke checklist (automated) coveringimpact/query/contextwithrepo: "@myproduct"+service: "app/backend")Test plan
npx tsc --noEmit— cleannpx vitest run test/unit/group/cross-impact.test.ts --pool=forksnpx vitest run test/unit/group/service.test.ts --pool=forksnpx vitest run test/unit/group/group-service-group-mode.test.ts --pool=forksnpx vitest run test/integration/group/group-impact.test.ts --pool=forksnpx vitest run test/integration/group/group-cli.test.ts --pool=forksnpx vitest run test/unit/group/group-tools.test.ts --pool=forksnpx vitest run test/unit/tools.test.ts --pool=forksnpx vitest run test/unit/resources.test.ts --pool=forksnpx vitest run test/unit/mcp/group-repo-routing.test.ts --pool=forksLocal Final-verification snapshot: 9 files passed, 111 tests passed, tsc clean.
Migration notes for MCP consumers
group_impact { name, target, service? }impact { repo: "@<name>", target, service? }group_query { name, query, service? }query { repo: "@<name>", query, service? }group_context { name, target, service? }context { repo: "@<name>", target, service? }group_contracts { name }gitnexus://group/{name}/contractsgroup_status { name }gitnexus://group/{name}/statusgroup_list,group_sync