projscan 3.5.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +27 -21
  2. package/dist/cli/commands/claim.d.ts +5 -0
  3. package/dist/cli/commands/claim.js +139 -0
  4. package/dist/cli/commands/claim.js.map +1 -0
  5. package/dist/cli/commands/collision.d.ts +5 -0
  6. package/dist/cli/commands/collision.js +62 -0
  7. package/dist/cli/commands/collision.js.map +1 -0
  8. package/dist/cli/commands/coordinate.d.ts +7 -0
  9. package/dist/cli/commands/coordinate.js +98 -0
  10. package/dist/cli/commands/coordinate.js.map +1 -0
  11. package/dist/cli/commands/mergeRisk.d.ts +5 -0
  12. package/dist/cli/commands/mergeRisk.js +58 -0
  13. package/dist/cli/commands/mergeRisk.js.map +1 -0
  14. package/dist/cli/commands/route.d.ts +5 -0
  15. package/dist/cli/commands/route.js +53 -0
  16. package/dist/cli/commands/route.js.map +1 -0
  17. package/dist/cli/index.js +10 -0
  18. package/dist/cli/index.js.map +1 -1
  19. package/dist/core/agentBrief.js +32 -2
  20. package/dist/core/agentBrief.js.map +1 -1
  21. package/dist/core/claims.d.ts +60 -0
  22. package/dist/core/claims.js +139 -0
  23. package/dist/core/claims.js.map +1 -0
  24. package/dist/core/collisionDetector.d.ts +65 -0
  25. package/dist/core/collisionDetector.js +222 -0
  26. package/dist/core/collisionDetector.js.map +1 -0
  27. package/dist/core/coordination.d.ts +62 -0
  28. package/dist/core/coordination.js +121 -0
  29. package/dist/core/coordination.js.map +1 -0
  30. package/dist/core/embeddings.js +30 -17
  31. package/dist/core/embeddings.js.map +1 -1
  32. package/dist/core/intentRouter.d.ts +40 -0
  33. package/dist/core/intentRouter.js +213 -0
  34. package/dist/core/intentRouter.js.map +1 -0
  35. package/dist/core/mergeRisk.d.ts +42 -0
  36. package/dist/core/mergeRisk.js +71 -0
  37. package/dist/core/mergeRisk.js.map +1 -0
  38. package/dist/core/preflight.js +50 -0
  39. package/dist/core/preflight.js.map +1 -1
  40. package/dist/core/roadmapCatalog.js +50 -50
  41. package/dist/core/roadmapCatalog.js.map +1 -1
  42. package/dist/mcp/tools/claim.d.ts +7 -0
  43. package/dist/mcp/tools/claim.js +69 -0
  44. package/dist/mcp/tools/claim.js.map +1 -0
  45. package/dist/mcp/tools/collision.d.ts +7 -0
  46. package/dist/mcp/tools/collision.js +38 -0
  47. package/dist/mcp/tools/collision.js.map +1 -0
  48. package/dist/mcp/tools/coordinate.d.ts +7 -0
  49. package/dist/mcp/tools/coordinate.js +24 -0
  50. package/dist/mcp/tools/coordinate.js.map +1 -0
  51. package/dist/mcp/tools/coordinateWatch.d.ts +4 -0
  52. package/dist/mcp/tools/coordinateWatch.js +138 -0
  53. package/dist/mcp/tools/coordinateWatch.js.map +1 -0
  54. package/dist/mcp/tools/mergeRisk.d.ts +7 -0
  55. package/dist/mcp/tools/mergeRisk.js +24 -0
  56. package/dist/mcp/tools/mergeRisk.js.map +1 -0
  57. package/dist/mcp/tools/route.d.ts +7 -0
  58. package/dist/mcp/tools/route.js +24 -0
  59. package/dist/mcp/tools/route.js.map +1 -0
  60. package/dist/mcp/tools.js +12 -0
  61. package/dist/mcp/tools.js.map +1 -1
  62. package/dist/projscan-sbom.cdx.json +6 -6
  63. package/dist/tool-manifest.json +132 -3
  64. package/dist/types.d.ts +12 -2
  65. package/dist/utils/formatSupport.d.ts +9 -0
  66. package/dist/utils/formatSupport.js +9 -0
  67. package/dist/utils/formatSupport.js.map +1 -1
  68. package/package.json +1 -1
@@ -76,23 +76,23 @@ const ROADMAP_3_2_CATALOG = {
76
76
  '3.5.x': {
77
77
  line: '3.5.x',
78
78
  track: {
79
- theme: 'First 10 Minutes UX',
80
- outcome: 'A new user gets a single guided path from trust boundary to first PR evidence.',
79
+ theme: 'Plugin Trust',
80
+ outcome: 'The surfaces that touch untrusted repositories cannot execute their code without explicit approval.',
81
81
  includedInPlan: true,
82
- scope: ['first-ten-minutes command path', 'start report guidance', 'adoption docs alignment'],
83
- successCriteria: ['start output includes the guided path', 'docs lead with the same path', 'MCP and CLI onboarding stay consistent'],
82
+ scope: ['fix-layer --ignore-scripts', 'plugin trust-on-first-use', 'embedding model graceful degradation'],
83
+ successCriteria: ['projscan fix never runs a scanned repo lifecycle script', 'plugins execute only after projscan plugin trust', 'an embedding model-load failure degrades to BM25 instead of throwing'],
84
84
  },
85
85
  tasks: [
86
86
  {
87
- id: 'rt-3-5-first-10-minutes-ux',
87
+ id: 'rt-3-5-plugin-trust',
88
88
  priority: 'p1',
89
- title: 'Add first-ten-minutes guidance',
90
- why: 'The broad command catalog should not be the first experience for a new team.',
89
+ title: 'Gate untrusted-repo code execution',
90
+ why: 'A scanned repo is untrusted input; fix-layer installs and local plugins must not execute its code without explicit, per-artifact approval.',
91
91
  track: '3.5.x',
92
- files: ['src/core/start.ts', 'src/core/adoption.ts', 'docs/FIRST-10-MINUTES.md'],
92
+ files: ['src/fixes/eslintFix.ts', 'src/core/pluginTrust.ts', 'src/core/plugins.ts'],
93
93
  verification: {
94
- commands: ['projscan start --mode before_edit --format json', 'projscan first-run --format json'],
95
- expected: 'Start and first-run surfaces point to the same first-ten-minutes path.',
94
+ commands: ['npm test', 'projscan plugin trust --all'],
95
+ expected: 'Fix installs use --ignore-scripts and plugins run only once trusted.',
96
96
  },
97
97
  },
98
98
  ],
@@ -100,23 +100,23 @@ const ROADMAP_3_2_CATALOG = {
100
100
  '3.6.x': {
101
101
  line: '3.6.x',
102
102
  track: {
103
- theme: 'Maintainability Hardening',
104
- outcome: 'Future roadmap and evidence changes land in smaller focused modules instead of growing hotspots.',
103
+ theme: 'Swarm Collision Detection',
104
+ outcome: 'When two in-flight worktrees have overlapping blast radius, an agent learns before the changes collide.',
105
105
  includedInPlan: true,
106
- scope: ['roadmap catalog extraction', 'evidence formatting boundaries', 'stable public exports'],
107
- successCriteria: ['core orchestration remains small and readable', 'public API exports remain stable', 'focused tests cover extracted helpers'],
106
+ scope: ['per-worktree changed-symbol blast radius', 'pairwise overlap detection', 'projscan_collision MCP + CLI'],
107
+ successCriteria: ['collision report names overlapping worktree pairs with the files and symbols at risk', 'blast radius reuses the impact graph', 'stays local-first over sibling git worktrees'],
108
108
  },
109
109
  tasks: [
110
110
  {
111
- id: 'rt-3-6-maintainability-hardening',
111
+ id: 'rt-3-6-collision-detection',
112
112
  priority: 'p1',
113
- title: 'Extract planning and evidence helpers',
114
- why: 'The product surface is large enough that static planning data and formatting helpers need clear ownership.',
113
+ title: 'Detect cross-worktree change collisions',
114
+ why: 'Parallel agents editing one repo collide when their blast radii overlap; surfacing that pre-merge is the flagship coordination value.',
115
115
  track: '3.6.x',
116
- files: ['src/core/roadmapCatalog.ts', 'src/core/releaseTrain.ts', 'src/core/releaseEvidence.ts', 'src/types.ts'],
116
+ files: ['src/core/collisionDetector.ts', 'src/mcp/tools/collision.ts', 'src/cli/commands/collision.ts'],
117
117
  verification: {
118
- commands: ['npm run build', 'npm test'],
119
- expected: 'Extraction preserves stable exports, output schemas, and test behavior.',
118
+ commands: ['projscan collisions --format json'],
119
+ expected: 'Report lists worktree pairs whose changed-symbol blast radii overlap.',
120
120
  },
121
121
  },
122
122
  ],
@@ -124,23 +124,23 @@ const ROADMAP_3_2_CATALOG = {
124
124
  '3.7.x': {
125
125
  line: '3.7.x',
126
126
  track: {
127
- theme: 'Graph And Dataflow Precision',
128
- outcome: 'Dataflow catches one more real framework source pattern while keeping false positives narrow.',
127
+ theme: 'Claims And Leases',
128
+ outcome: 'An agent can claim a file, symbol, or subsystem so the swarm sees who owns what and warns on contention.',
129
129
  includedInPlan: true,
130
- scope: ['framework request-source precision', 'review-time dataflow calibration', 'false-positive guard tests'],
131
- successCriteria: ['new source pattern is detected', 'unrelated helpers are not treated as request data', 'generated and test filters remain quiet by default'],
130
+ scope: ['local claim store under .projscan-cache', 'contention warnings', 'projscan_claim MCP + CLI'],
131
+ successCriteria: ['claims persist locally and are scoped to the active repo', 'overlapping claims surface a contention warning', 'claims can be released explicitly'],
132
132
  },
133
133
  tasks: [
134
134
  {
135
- id: 'rt-3-7-graph-dataflow-precision',
135
+ id: 'rt-3-7-claims-leases',
136
136
  priority: 'p1',
137
- title: 'Add a narrow framework dataflow precision pass',
138
- why: 'The graph/dataflow moat improves only when new precision comes with false-positive guardrails.',
137
+ title: 'Add local claims / leases for swarm work',
138
+ why: 'Coordination needs a lightweight ownership signal so two agents do not silently take the same file or symbol.',
139
139
  track: '3.7.x',
140
- files: ['src/core/frameworkSources.ts', 'src/core/dataflow.ts', 'tests/core/dataflow.test.ts'],
140
+ files: ['src/core/claims.ts', 'src/mcp/tools/claim.ts', 'src/cli/commands/claim.ts'],
141
141
  verification: {
142
- commands: ['projscan dataflow --format json', 'npm test'],
143
- expected: 'Dataflow reports the new framework source pattern and avoids unrelated helper calls.',
142
+ commands: ['projscan claim add src/auth.ts --agent a', 'projscan claim list --format json'],
143
+ expected: 'Claims persist locally and overlapping claims warn on contention.',
144
144
  },
145
145
  },
146
146
  ],
@@ -148,23 +148,23 @@ const ROADMAP_3_2_CATALOG = {
148
148
  '3.8.x': {
149
149
  line: '3.8.x',
150
150
  track: {
151
- theme: 'Plugin Ecosystem',
152
- outcome: 'Teams can validate local policy plugins with clearer trust and context-readiness guidance.',
151
+ theme: 'Merge-Risk Preflight',
152
+ outcome: 'Given the set of in-flight worktrees, preflight returns the safe integration order and where conflict risk concentrates.',
153
153
  includedInPlan: true,
154
- scope: ['plugin test result guidance', 'trust reminder', 'gallery and authoring docs'],
155
- successCriteria: ['plugin test output names trust boundaries', 'graph/dataflow context needs are visible', 'docs show copyable validation commands'],
154
+ scope: ['multi-branch preflight verdict', 'integration order', 'conflict-risk concentration'],
155
+ successCriteria: ['preflight accepts multiple in-flight worktrees', 'returns a safe integration order', 'flags files where multiple branches and blast radii concentrate'],
156
156
  },
157
157
  tasks: [
158
158
  {
159
- id: 'rt-3-8-plugin-ecosystem',
159
+ id: 'rt-3-8-merge-risk-preflight',
160
160
  priority: 'p1',
161
- title: 'Improve local plugin authoring feedback',
162
- why: 'Plugins are useful when teams can test local policy safely before enabling execution.',
161
+ title: 'Extend preflight to a multi-branch integration verdict',
162
+ why: 'Once collisions and claims exist, teams need an ordering: which in-flight branch is safe to merge first.',
163
163
  track: '3.8.x',
164
- files: ['src/core/pluginDx.ts', 'tests/core/pluginDx.test.ts', 'docs/PLUGIN-AUTHORING.md', 'docs/PLUGIN-GALLERY.md'],
164
+ files: ['src/core/preflight.ts', 'src/core/collisionDetector.ts'],
165
165
  verification: {
166
- commands: ['projscan plugin test docs/examples/plugins/policy.projscan-plugin.json --format json'],
167
- expected: 'Plugin test output includes trust guidance, validation commands, and context capability notes.',
166
+ commands: ['projscan preflight --mode before_merge --format json'],
167
+ expected: 'Preflight returns integration order and conflict-risk concentration across in-flight worktrees.',
168
168
  },
169
169
  },
170
170
  ],
@@ -172,23 +172,23 @@ const ROADMAP_3_2_CATALOG = {
172
172
  '3.9.x': {
173
173
  line: '3.9.x',
174
174
  track: {
175
- theme: 'Multi-Agent Coordination',
176
- outcome: 'Agents can tell current worktree risk from remembered session context before parallel edits continue.',
175
+ theme: 'Agent Ergonomics And Coordination Proof',
176
+ outcome: 'Agents reach the right capability through one budget-shaped entry point, and the coordination layer is measured for outcome value.',
177
177
  includedInPlan: true,
178
- scope: ['coordination hints', 'session resource clarity', 'agent brief handoff commands'],
179
- successCriteria: ['resources explain current-vs-remembered risk', 'agent briefs include conflict-resolution commands', 'start output keeps the distinction visible'],
178
+ scope: ['adaptive intent router over the tool surface', 'budget-shaped next actions', 'with/without coordination outcome metrics'],
179
+ successCriteria: ['a single entry tool routes to the right capability', 'router output is budget-shaped and shrinks the tool-list footprint', 'dogfood/trial reports compare task success and token cost with vs without coordination'],
180
180
  },
181
181
  tasks: [
182
182
  {
183
- id: 'rt-3-9-multi-agent-coordination',
183
+ id: 'rt-3-9-agent-ergonomics-and-proof',
184
184
  priority: 'p1',
185
- title: 'Add compact multi-agent coordination hints',
186
- why: 'Shared session state helps only when agents understand whether a signal is current worktree evidence or older remembered context.',
185
+ title: 'Add an intent router and coordination outcome proof',
186
+ why: 'A 41-tool surface costs context every turn; one adaptive entry point plus measured outcomes proves the coordination arc earns its keep.',
187
187
  track: '3.9.x',
188
- files: ['src/core/sessionResources.ts', 'src/core/agentBrief.ts', 'src/core/start.ts'],
188
+ files: ['src/mcp/tools', 'src/core/dogfood.ts', 'src/core/trial.ts'],
189
189
  verification: {
190
- commands: ['projscan agent-brief --format json', 'projscan session current --format json'],
191
- expected: 'Coordination surfaces include current-vs-remembered hints and exact follow-up commands.',
190
+ commands: ['projscan dogfood --format json'],
191
+ expected: 'Routing shrinks the tool footprint and proof reports compare with/without coordination.',
192
192
  },
193
193
  },
194
194
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"roadmapCatalog.js","sourceRoot":"","sources":["../../src/core/roadmapCatalog.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAU,CAAC;AACnH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,CAAU,CAAC;AAEpD,MAAM,mBAAmB,GAAwC;IAC/D,OAAO,EAAE;QACP,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,KAAK,EAAE,0BAA0B;YACjC,OAAO,EAAE,mGAAmG;YAC5G,cAAc,EAAE,IAAI;YACpB,KAAK,EAAE,CAAC,8BAA8B,EAAE,iCAAiC,EAAE,6BAA6B,CAAC;YACzG,eAAe,EAAE,CAAC,0DAA0D,EAAE,4CAA4C,EAAE,mCAAmC,CAAC;SACjK;QACD,KAAK,EAAE;YACL;gBACE,EAAE,EAAE,iCAAiC;gBACrC,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,oCAAoC;gBAC3C,GAAG,EAAE,8FAA8F;gBACnG,KAAK,EAAE,OAAO;gBACd,KAA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AC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,YAAY,EAAE,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACxL,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { McpTool } from './_shared.js';
2
+ /**
3
+ * `projscan_claim` (4.x coordination arc) — advisory claims / leases so parallel
4
+ * agents see who owns which file, directory, or symbol. Shared across the
5
+ * repo's git worktrees; local-first.
6
+ */
7
+ export declare const claimTool: McpTool;
@@ -0,0 +1,69 @@
1
+ import { addClaim, listClaims, releaseClaim, pruneClaims } from '../../core/claims.js';
2
+ /**
3
+ * `projscan_claim` (4.x coordination arc) — advisory claims / leases so parallel
4
+ * agents see who owns which file, directory, or symbol. Shared across the
5
+ * repo's git worktrees; local-first.
6
+ */
7
+ export const claimTool = {
8
+ name: 'projscan_claim',
9
+ description: "Coordinate parallel agents with advisory claims/leases over files, directories, or symbols, shared across the repo's git worktrees. action:\"add\" records a claim (optionally a lease with `ttl_seconds`) and returns any `contention` (another agent already holding an overlapping, non-expired claim); \"list\" returns claims; \"release\" drops a claim by `id`, by `target`, or all of an `agent`'s; \"prune\" removes expired-lease claims. Local-first and advisory — claiming an already-claimed target still succeeds, but surfaces contention so the swarm can coordinate.",
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {
13
+ action: {
14
+ type: 'string',
15
+ enum: ['add', 'list', 'release', 'prune'],
16
+ description: 'Default "list". "add" records a claim; "release" drops one; "prune" removes expired leases.',
17
+ },
18
+ target: {
19
+ type: 'string',
20
+ description: '"add"/"release" — a repo-relative file or directory path, or a symbol name.',
21
+ },
22
+ agent: {
23
+ type: 'string',
24
+ description: '"add" — who holds the claim. "release" — scope the release to this agent.',
25
+ },
26
+ note: { type: 'string', description: '"add" — optional human-readable note.' },
27
+ ttl_seconds: { type: 'number', description: '"add" — lease duration in seconds; the claim expires after it. Omit for a permanent claim.' },
28
+ id: { type: 'string', description: '"release" — the claim id to drop.' },
29
+ },
30
+ },
31
+ handler: async (args, rootPath) => {
32
+ const action = typeof args.action === 'string' ? args.action : 'list';
33
+ switch (action) {
34
+ case 'add': {
35
+ const target = typeof args.target === 'string' ? args.target : '';
36
+ const agent = typeof args.agent === 'string' ? args.agent : '';
37
+ if (!target || !agent) {
38
+ throw new Error('projscan_claim add requires both `target` and `agent`.');
39
+ }
40
+ const note = typeof args.note === 'string' && args.note.length > 0 ? args.note : undefined;
41
+ const ttlSeconds = typeof args.ttl_seconds === 'number' && args.ttl_seconds > 0 ? args.ttl_seconds : undefined;
42
+ return addClaim(rootPath, {
43
+ target,
44
+ agent,
45
+ ...(note ? { note } : {}),
46
+ ...(ttlSeconds !== undefined ? { ttlSeconds } : {}),
47
+ });
48
+ }
49
+ case 'release': {
50
+ const selector = {
51
+ id: typeof args.id === 'string' && args.id.length > 0 ? args.id : undefined,
52
+ target: typeof args.target === 'string' && args.target.length > 0 ? args.target : undefined,
53
+ agent: typeof args.agent === 'string' && args.agent.length > 0 ? args.agent : undefined,
54
+ };
55
+ if (!selector.id && !selector.target && !selector.agent) {
56
+ throw new Error('projscan_claim release requires one of `id`, `target`, or `agent`.');
57
+ }
58
+ return { released: await releaseClaim(rootPath, selector) };
59
+ }
60
+ case 'prune':
61
+ return { pruned: await pruneClaims(rootPath) };
62
+ case 'list':
63
+ return { claims: await listClaims(rootPath) };
64
+ default:
65
+ throw new Error(`Unknown action "${action}". Known: add, list, release, prune.`);
66
+ }
67
+ },
68
+ };
69
+ //# sourceMappingURL=claim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim.js","sourceRoot":"","sources":["../../../src/mcp/tools/claim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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AC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;iBACxF,CAAC;gBACF,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;oBACxD,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;gBACxF,CAAC;gBACD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;YAC9D,CAAC;YACD,KAAK,OAAO;gBACV,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjD,KAAK,MAAM;gBACT,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChD;gBACE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,sCAAsC,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { McpTool } from './_shared.js';
2
+ /**
3
+ * `projscan_collision` (4.x coordination arc) — detect change collisions across
4
+ * the repo's in-flight git worktrees, so parallel agents see overlaps before
5
+ * their branches merge. Local-first; reads `git worktree list` only.
6
+ */
7
+ export declare const collisionTool: McpTool;
@@ -0,0 +1,38 @@
1
+ import { detectCollisions } from '../../core/collisionDetector.js';
2
+ /**
3
+ * `projscan_collision` (4.x coordination arc) — detect change collisions across
4
+ * the repo's in-flight git worktrees, so parallel agents see overlaps before
5
+ * their branches merge. Local-first; reads `git worktree list` only.
6
+ */
7
+ export const collisionTool = {
8
+ name: 'projscan_collision',
9
+ description: "Detect change collisions across the repo's in-flight git worktrees (parallel agents). Reports same-file edits (two worktrees changed the same file) and dependency overlaps (one worktree changed a file another's change imports, via the import graph) BEFORE the branches merge. Local-first; needs at least two worktrees. Each collision has `kind` (same-file | dependency), `severity` (high | medium), the two worktree paths, and the files at risk. Use this when coordinating multiple agents/sub-agents working the same repo.",
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {
13
+ base_ref: {
14
+ type: 'string',
15
+ description: 'Base ref each worktree is diffed against to compute its changed files. Default: origin/main → main → master → HEAD~1, then the working tree.',
16
+ },
17
+ transitive: {
18
+ type: 'boolean',
19
+ description: 'Also report multi-hop dependency overlaps (one worktree changed a file another transitively imports), each with a `distance`. Default false — the 1-hop default stays precise; this trades precision for deeper recall.',
20
+ },
21
+ max_distance: {
22
+ type: 'number',
23
+ description: 'Max import hops when `transitive` is set. Default 5.',
24
+ },
25
+ },
26
+ },
27
+ handler: async (args, rootPath) => {
28
+ const baseRef = typeof args.base_ref === 'string' && args.base_ref.length > 0 ? args.base_ref : undefined;
29
+ const transitive = args.transitive === true;
30
+ const maxDistance = typeof args.max_distance === 'number' && args.max_distance > 0 ? args.max_distance : undefined;
31
+ return detectCollisions(rootPath, {
32
+ ...(baseRef ? { baseRef } : {}),
33
+ ...(transitive ? { transitive: true } : {}),
34
+ ...(maxDistance !== undefined ? { maxDistance } : {}),
35
+ });
36
+ },
37
+ };
38
+ //# sourceMappingURL=collision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collision.js","sourceRoot":"","sources":["../../../src/mcp/tools/collision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAY;IACpC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,4gBAA4gB;IAC9gB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,8IAA8I;aACjJ;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,SAAS;gBACf,WAAW,EACT,yNAAyN;aAC5N;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sDAAsD;aACpE;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1G,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC;QAC5C,MAAM,WAAW,GAAG,OAAO,IAAI,CAAC,YAAY,KAAK,QAAQ,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;QACnH,OAAO,gBAAgB,CAAC,QAAQ,EAAE;YAChC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/B,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACtD,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { McpTool } from './_shared.js';
2
+ /**
3
+ * `projscan_coordinate` (4.x arc, epic 5 — capstone) — one-call coordination
4
+ * read across the repo's in-flight worktrees, composing collisions, claims, and
5
+ * merge-risk into a single readiness verdict + counts. Local-first.
6
+ */
7
+ export declare const coordinateTool: McpTool;
@@ -0,0 +1,24 @@
1
+ import { computeCoordination } from '../../core/coordination.js';
2
+ /**
3
+ * `projscan_coordinate` (4.x arc, epic 5 — capstone) — one-call coordination
4
+ * read across the repo's in-flight worktrees, composing collisions, claims, and
5
+ * merge-risk into a single readiness verdict + counts. Local-first.
6
+ */
7
+ export const coordinateTool = {
8
+ name: 'projscan_coordinate',
9
+ description: "One-call coordination read across the repo's in-flight git worktrees (parallel agents). Composes collisions, claims, and merge-risk into a `readiness` verdict (clear | caution | conflicted) plus counts (collisions by severity, contended claim targets, merge hotspots) and the recommended integration order. The single entry point for swarm coordination — use it before continuing parallel work. Local-first; needs at least two worktrees.",
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {
13
+ base_ref: {
14
+ type: 'string',
15
+ description: 'Base ref each worktree is diffed against. Default: origin/main → main → master → HEAD~1.',
16
+ },
17
+ },
18
+ },
19
+ handler: async (args, rootPath) => {
20
+ const baseRef = typeof args.base_ref === 'string' && args.base_ref.length > 0 ? args.base_ref : undefined;
21
+ return computeCoordination(rootPath, baseRef ? { baseRef } : {});
22
+ },
23
+ };
24
+ //# sourceMappingURL=coordinate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinate.js","sourceRoot":"","sources":["../../../src/mcp/tools/coordinate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAY;IACrC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EACT,ubAAub;IACzb,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0FAA0F;aACxG;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1G,OAAO,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACnE,CAAC;CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { McpTool } from './_shared.js';
2
+ export declare const coordinateWatchTool: McpTool;
3
+ /** Test-only: cancel all timers and drop watch state. */
4
+ export declare function __resetCoordinateWatchesForTests(): void;
@@ -0,0 +1,138 @@
1
+ import { computeCoordination, coordinationSignature } from '../../core/coordination.js';
2
+ const watches = new Map();
3
+ const DEFAULT_INTERVAL_S = 15;
4
+ const MIN_INTERVAL_S = 5;
5
+ const MAX_INTERVAL_S = 600;
6
+ export const coordinateWatchTool = {
7
+ name: 'projscan_coordinate_watch',
8
+ description: "Long-running swarm coordination watch across the repo's in-flight git worktrees. Polls on an interval and emits a `notifications/projscan/coordination_changed` notification whenever the coordination state changes — readiness (clear/caution/conflicted), collision counts, contended claims, or merge hotspots. Pairs with projscan_coordinate (one-shot): use this when an agent wants to react to other agents' changes without re-asking. Local-first. Actions: \"start\" (returns the initial summary + a watchId), \"stop\" (by watchId), \"list\".",
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ action: {
13
+ type: 'string',
14
+ enum: ['start', 'stop', 'list'],
15
+ description: '"start" begins polling (returns initial summary + watchId). "stop" cancels by id. "list" enumerates active watches.',
16
+ },
17
+ base_ref: { type: 'string', description: 'Base ref each worktree is diffed against. (start only)' },
18
+ interval_seconds: {
19
+ type: 'number',
20
+ description: `Poll interval in seconds. Default ${DEFAULT_INTERVAL_S}, min ${MIN_INTERVAL_S}, max ${MAX_INTERVAL_S}. (start only)`,
21
+ },
22
+ watchId: { type: 'string', description: 'Watch id from a previous "start". (stop only)' },
23
+ },
24
+ },
25
+ handler: async (args, rootPath, context) => {
26
+ const action = typeof args.action === 'string' ? args.action : 'start';
27
+ if (action === 'list')
28
+ return listWatches();
29
+ if (action === 'stop')
30
+ return stopWatch(args, context);
31
+ if (action === 'start')
32
+ return startWatch(args, rootPath, context);
33
+ throw new Error(`Unknown action "${action}". Valid actions: start, stop, list.`);
34
+ },
35
+ };
36
+ function clamp(value, min, max) {
37
+ return Math.min(max, Math.max(min, value));
38
+ }
39
+ async function startWatch(args, rootPath, context) {
40
+ const baseRef = typeof args.base_ref === 'string' && args.base_ref ? args.base_ref : undefined;
41
+ const detectOptions = baseRef ? { baseRef } : {};
42
+ const requested = typeof args.interval_seconds === 'number' && Number.isFinite(args.interval_seconds)
43
+ ? args.interval_seconds
44
+ : DEFAULT_INTERVAL_S;
45
+ const intervalSeconds = clamp(requested, MIN_INTERVAL_S, MAX_INTERVAL_S);
46
+ const intervalMs = Math.round(intervalSeconds * 1000);
47
+ const initial = await computeCoordination(rootPath, detectOptions);
48
+ const initialSignature = coordinationSignature(initial);
49
+ if (!context?.registerWatch || !context.notify) {
50
+ return {
51
+ action: 'start',
52
+ watchId: null,
53
+ registered: false,
54
+ reason: 'No notify channel — server was started without one (or this is a non-MCP caller). Initial summary attached; subscribe to the MCP notify channel for incremental updates.',
55
+ intervalSeconds,
56
+ report: initial,
57
+ };
58
+ }
59
+ const watchId = context.registerWatch(() => {
60
+ const state = watches.get(watchId);
61
+ if (state?.timer)
62
+ clearInterval(state.timer);
63
+ watches.delete(watchId);
64
+ });
65
+ const state = {
66
+ watchId,
67
+ intervalMs,
68
+ startedAt: new Date().toISOString(),
69
+ ticks: 0,
70
+ lastSignature: initialSignature,
71
+ inFlight: false,
72
+ timer: null,
73
+ };
74
+ state.timer = setInterval(() => void runTick(watchId, rootPath, detectOptions, context), intervalMs);
75
+ watches.set(watchId, state);
76
+ return { action: 'start', watchId, registered: true, intervalSeconds, report: initial };
77
+ }
78
+ async function runTick(watchId, rootPath, detectOptions, context) {
79
+ const state = watches.get(watchId);
80
+ // Drop overlapping ticks: one computeCoordination at a time per watch.
81
+ if (!state || state.inFlight)
82
+ return;
83
+ state.inFlight = true;
84
+ try {
85
+ const report = await computeCoordination(rootPath, detectOptions);
86
+ const signature = coordinationSignature(report);
87
+ state.ticks += 1;
88
+ if (signature !== state.lastSignature) {
89
+ state.lastSignature = signature;
90
+ context.notify?.('notifications/projscan/coordination_changed', { watchId, report });
91
+ }
92
+ }
93
+ catch (err) {
94
+ context.notify?.('notifications/projscan/coordination_error', {
95
+ watchId,
96
+ error: err instanceof Error ? err.message : String(err),
97
+ });
98
+ }
99
+ finally {
100
+ const current = watches.get(watchId);
101
+ if (current)
102
+ current.inFlight = false;
103
+ }
104
+ }
105
+ function stopWatch(args, context) {
106
+ const watchId = typeof args.watchId === 'string' ? args.watchId : '';
107
+ if (!watchId)
108
+ throw new Error('stop action requires a `watchId` from a previous "start".');
109
+ // unregisterWatch runs the registered cancel (clears the timer + drops state).
110
+ const stopped = context?.unregisterWatch ? context.unregisterWatch(watchId) : false;
111
+ if (!stopped) {
112
+ const state = watches.get(watchId);
113
+ if (state?.timer)
114
+ clearInterval(state.timer);
115
+ watches.delete(watchId);
116
+ }
117
+ return { action: 'stop', watchId, stopped };
118
+ }
119
+ function listWatches() {
120
+ return {
121
+ action: 'list',
122
+ watches: [...watches.values()].map((w) => ({
123
+ watchId: w.watchId,
124
+ startedAt: w.startedAt,
125
+ intervalSeconds: w.intervalMs / 1000,
126
+ ticks: w.ticks,
127
+ })),
128
+ };
129
+ }
130
+ /** Test-only: cancel all timers and drop watch state. */
131
+ export function __resetCoordinateWatchesForTests() {
132
+ for (const state of watches.values()) {
133
+ if (state.timer)
134
+ clearInterval(state.timer);
135
+ }
136
+ watches.clear();
137
+ }
138
+ //# sourceMappingURL=coordinateWatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinateWatch.js","sourceRoot":"","sources":["../../../src/mcp/tools/coordinateWatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AA4BxF,MAAM,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AAC,CAAC;QAC7C,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,WAAW;IAClB,OAAO;QACL,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACzC,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,eAAe,EAAE,CAAC,CAAC,UAAU,GAAG,IAAI;YACpC,KAAK,EAAE,CAAC,CAAC,KAAK;SACf,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,gCAAgC;IAC9C,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QACrC,IAAI,KAAK,CAAC,KAAK;YAAE,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { McpTool } from './_shared.js';
2
+ /**
3
+ * `projscan_merge_risk` (4.x coordination arc, epic 3) — given the repo's
4
+ * in-flight worktrees and their collisions, return a safe integration order and
5
+ * the files where conflict risk concentrates. Builds on `projscan_collision`.
6
+ */
7
+ export declare const mergeRiskTool: McpTool;
@@ -0,0 +1,24 @@
1
+ import { computeMergeRisk } from '../../core/mergeRisk.js';
2
+ /**
3
+ * `projscan_merge_risk` (4.x coordination arc, epic 3) — given the repo's
4
+ * in-flight worktrees and their collisions, return a safe integration order and
5
+ * the files where conflict risk concentrates. Builds on `projscan_collision`.
6
+ */
7
+ export const mergeRiskTool = {
8
+ name: 'projscan_merge_risk',
9
+ description: "Merge-risk preflight across the repo's in-flight git worktrees (parallel agents). Given each worktree's changes and the collisions between them, returns `integrationOrder` (merge the least-entangled branch first, each with a risk score) and `hotFiles` (files changed by two or more worktrees — where merge conflict risk concentrates). Builds on projscan_collision; local-first; needs at least two worktrees.",
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {
13
+ base_ref: {
14
+ type: 'string',
15
+ description: 'Base ref each worktree is diffed against. Default: origin/main → main → master → HEAD~1.',
16
+ },
17
+ },
18
+ },
19
+ handler: async (args, rootPath) => {
20
+ const baseRef = typeof args.base_ref === 'string' && args.base_ref.length > 0 ? args.base_ref : undefined;
21
+ return computeMergeRisk(rootPath, baseRef ? { baseRef } : {});
22
+ },
23
+ };
24
+ //# sourceMappingURL=mergeRisk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeRisk.js","sourceRoot":"","sources":["../../../src/mcp/tools/mergeRisk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAY;IACpC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EACT,yZAAyZ;IAC3Z,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0FAA0F;aACxG;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1G,OAAO,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAChE,CAAC;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { McpTool } from './_shared.js';
2
+ /**
3
+ * `projscan_route` (4.x agent-ergonomics, epic 4) — map a stated goal to the
4
+ * right projscan tool, so an agent can find the one tool it needs without
5
+ * reasoning over the whole surface. Deterministic (no LLM).
6
+ */
7
+ export declare const routeTool: McpTool;