projscan 3.6.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.
package/README.md CHANGED
@@ -9,9 +9,9 @@
9
9
 
10
10
  **Agent-first code intelligence.** An MCP server that lets AI coding agents (Claude Code, Codex, Cursor, Gemini, Windsurf, Cline, Continue, Zed — any MCP-aware client) query your codebase — with a CLI for humans and a local plugin layer for team-specific policy and reporting.
11
11
 
12
- [AI Agent Quick Start](#ai-agent-integration-mcp) · [CLI Quick Start](#quick-start) · [Commands](#commands) · [Full Guide](https://github.com/abhiyoheswaran1/projscan/blob/v3.6.0/docs/GUIDE.md) · [Roadmap](https://github.com/abhiyoheswaran1/projscan/blob/v3.6.0/docs/ROADMAP.md)
12
+ [AI Agent Quick Start](#ai-agent-integration-mcp) · [CLI Quick Start](#quick-start) · [Commands](#commands) · [Full Guide](https://github.com/abhiyoheswaran1/projscan/blob/v3.7.0/docs/GUIDE.md) · [Roadmap](https://github.com/abhiyoheswaran1/projscan/blob/v3.7.0/docs/ROADMAP.md)
13
13
 
14
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/projscan-reporter-plugin.png" alt="projscan reporter plugin running in a macOS-style terminal window with a team health summary" width="700">
14
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/projscan-reporter-plugin.png" alt="projscan reporter plugin running in a macOS-style terminal window with a team health summary" width="700">
15
15
 
16
16
  </div>
17
17
 
@@ -33,7 +33,7 @@ The local plugin platform lets teams add project-specific findings and render `d
33
33
  npx projscan
34
34
  ```
35
35
 
36
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/projscan-reporter-plugin.gif" alt="projscan doctor rendered through a local reporter plugin in a macOS-style terminal window" width="700">
36
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/projscan-reporter-plugin.gif" alt="projscan doctor rendered through a local reporter plugin in a macOS-style terminal window" width="700">
37
37
 
38
38
  Run `projscan doctor` for a focused health check:
39
39
 
@@ -41,7 +41,7 @@ Run `projscan doctor` for a focused health check:
41
41
  npx projscan doctor
42
42
  ```
43
43
 
44
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/npx%20projscan%20doctor.gif" alt="npx projscan doctor" width="700">
44
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/npx%20projscan%20doctor.gif" alt="npx projscan doctor" width="700">
45
45
 
46
46
  ## Install
47
47
 
@@ -94,9 +94,9 @@ npm run test:trust-smoke
94
94
 
95
95
  The full command catalog is below. Most users should start with the five-command path above instead of scanning the catalog.
96
96
 
97
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/npx%20projscan%20--help.gif" alt="npx projscan --help" width="700">
97
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/npx%20projscan%20--help.gif" alt="npx projscan --help" width="700">
98
98
 
99
- For a comprehensive walkthrough, see the **[Full Guide](https://github.com/abhiyoheswaran1/projscan/blob/v3.6.0/docs/GUIDE.md)**.
99
+ For a comprehensive walkthrough, see the **[Full Guide](https://github.com/abhiyoheswaran1/projscan/blob/v3.7.0/docs/GUIDE.md)**.
100
100
 
101
101
  ## Repo Understanding
102
102
 
@@ -177,31 +177,31 @@ projscan --help
177
177
  <details>
178
178
  <summary><strong>projscan structure</strong> - Directory tree with file counts</summary>
179
179
 
180
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/npx%20projscan%20structure.gif" alt="npx projscan structure" width="700">
180
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/npx%20projscan%20structure.gif" alt="npx projscan structure" width="700">
181
181
  </details>
182
182
 
183
183
  <details>
184
184
  <summary><strong>projscan diagram</strong> - Architecture visualization</summary>
185
185
 
186
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/npx%20projscan%20diagram.gif" alt="npx projscan diagram" width="700">
186
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/npx%20projscan%20diagram.gif" alt="npx projscan diagram" width="700">
187
187
  </details>
188
188
 
189
189
  <details>
190
190
  <summary><strong>projscan dependencies</strong> - Dependency analysis</summary>
191
191
 
192
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/npx%20projscan%20dependencies.gif" alt="npx projscan dependencies" width="700">
192
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/npx%20projscan%20dependencies.gif" alt="npx projscan dependencies" width="700">
193
193
  </details>
194
194
 
195
195
  <details>
196
196
  <summary><strong>projscan explain</strong> - File explanation</summary>
197
197
 
198
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/npx%20projscan%20explain.gif" alt="npx projscan explain" width="700">
198
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/npx%20projscan%20explain.gif" alt="npx projscan explain" width="700">
199
199
  </details>
200
200
 
201
201
  <details>
202
202
  <summary><strong>projscan badge</strong> - Health badge generation</summary>
203
203
 
204
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/npx%20projscan%20badge.gif" alt="npx projscan badge" width="700">
204
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/npx%20projscan%20badge.gif" alt="npx projscan badge" width="700">
205
205
  </details>
206
206
 
207
207
  ### Output Formats
@@ -223,7 +223,7 @@ Run `projscan help` for the generated command-by-command support matrix.
223
223
 
224
224
  projscan can load local plugins from `.projscan-plugins/` when `PROJSCAN_PLUGINS_PREVIEW=1` is set. The environment flag is kept for explicit local-code opt-in. Analyzer plugins emit normal projscan issues; reporter plugins render supported CLI commands with team-specific output.
225
225
 
226
- **2.0 upgrade notes:** migrating from 1.x or authoring plugins? Start with the [2.0 Migration Guide](https://github.com/abhiyoheswaran1/projscan/blob/v3.6.0/docs/2.0-MIGRATION.md), then use [Plugin Authoring](https://github.com/abhiyoheswaran1/projscan/blob/v3.6.0/docs/PLUGIN-AUTHORING.md), the [Plugin Gallery](https://github.com/abhiyoheswaran1/projscan/blob/v3.6.0/docs/PLUGIN-GALLERY.md), and the [manifest schema](https://github.com/abhiyoheswaran1/projscan/blob/v3.6.0/docs/plugin.schema.json) as the stable contract.
226
+ **2.0 upgrade notes:** migrating from 1.x or authoring plugins? Start with the [2.0 Migration Guide](https://github.com/abhiyoheswaran1/projscan/blob/v3.7.0/docs/2.0-MIGRATION.md), then use [Plugin Authoring](https://github.com/abhiyoheswaran1/projscan/blob/v3.7.0/docs/PLUGIN-AUTHORING.md), the [Plugin Gallery](https://github.com/abhiyoheswaran1/projscan/blob/v3.7.0/docs/PLUGIN-GALLERY.md), and the [manifest schema](https://github.com/abhiyoheswaran1/projscan/blob/v3.7.0/docs/plugin.schema.json) as the stable contract.
227
227
 
228
228
  ```bash
229
229
  projscan plugin list
@@ -234,9 +234,9 @@ PROJSCAN_PLUGINS_PREVIEW=1 projscan doctor --reporter team-radar
234
234
  PROJSCAN_PLUGINS_PREVIEW=1 projscan ci --reporter team-radar --min-score 80
235
235
  ```
236
236
 
237
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/projscan-reporter-plugin.gif" alt="projscan local reporter plugin rendering a team health report" width="700">
237
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/projscan-reporter-plugin.gif" alt="projscan local reporter plugin rendering a team health report" width="700">
238
238
 
239
- Reporter plugins are intentionally CLI-only. MCP tools keep returning structured JSON-compatible payloads so agents can reason over stable data, while humans can get a polished local report for their team. Custom presentation, team-branded summaries, and white-label reports belong in reporter plugins rather than new core HTML theming flags. See [Plugin Authoring](https://github.com/abhiyoheswaran1/projscan/blob/v3.6.0/docs/PLUGIN-AUTHORING.md) for manifest shape, `render(context)`, validation, and the trust model.
239
+ Reporter plugins are intentionally CLI-only. MCP tools keep returning structured JSON-compatible payloads so agents can reason over stable data, while humans can get a polished local report for their team. Custom presentation, team-branded summaries, and white-label reports belong in reporter plugins rather than new core HTML theming flags. See [Plugin Authoring](https://github.com/abhiyoheswaran1/projscan/blob/v3.7.0/docs/PLUGIN-AUTHORING.md) for manifest shape, `render(context)`, validation, and the trust model.
240
240
 
241
241
  ### Options
242
242
 
@@ -401,7 +401,7 @@ If you read projscan's [Socket report](https://socket.dev/npm/package/projscan),
401
401
  ### Audit it yourself
402
402
 
403
403
  - **Source is open** at [github.com/abhiyoheswaran1/projscan](https://github.com/abhiyoheswaran1/projscan). The npm tarball matches the `dist/` produced by `npm run build` at the matching tag.
404
- - **Public API surface is locked** by `scripts/check-stability.mjs`, which runs in CI on every PR and fails on any rename or removal of an MCP tool, CLI command, or exit code. See [`docs/STABILITY.md`](https://github.com/abhiyoheswaran1/projscan/blob/v3.6.0/docs/STABILITY.md).
404
+ - **Public API surface is locked** by `scripts/check-stability.mjs`, which runs in CI on every PR and fails on any rename or removal of an MCP tool, CLI command, or exit code. See [`docs/STABILITY.md`](https://github.com/abhiyoheswaran1/projscan/blob/v3.7.0/docs/STABILITY.md).
405
405
  - **Run it offline:** `npm install -g projscan` followed by anything except `audit` and `--mode semantic` works without network.
406
406
  - **Drop privilege further:** in CI, run projscan in a sandbox that disallows network egress; everything except `audit` will pass.
407
407
 
@@ -452,7 +452,7 @@ projscan ci --changed-only # Gate only on this PR's diff
452
452
  projscan ci --format sarif > projscan.sarif # SARIF for Code Scanning
453
453
  ```
454
454
 
455
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/npx%20projscan%20ci%20--min-score%2070.gif" alt="npx projscan ci --min-score 70" width="700">
455
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/npx%20projscan%20ci%20--min-score%2070.gif" alt="npx projscan ci --min-score 70" width="700">
456
456
 
457
457
  ### GitHub Action (recommended)
458
458
 
@@ -529,7 +529,7 @@ Fields:
529
529
  - `hotspots.limit` / `hotspots.since` - defaults for the `hotspots` command
530
530
  - `monorepo.importPolicy` - cross-package import allow/deny rules in monorepos *(0.14+)*
531
531
 
532
- See [`docs/GUIDE.md` → Configuration](https://github.com/abhiyoheswaran1/projscan/blob/v3.6.0/docs/GUIDE.md#configuration-projscanrc) for the full reference (field types, validation behavior, embedding config in `package.json`, monorepo `importPolicy` semantics).
532
+ See [`docs/GUIDE.md` → Configuration](https://github.com/abhiyoheswaran1/projscan/blob/v3.7.0/docs/GUIDE.md#configuration-projscanrc) for the full reference (field types, validation behavior, embedding config in `package.json`, monorepo `importPolicy` semantics).
533
533
 
534
534
  ## Tracking Health Over Time
535
535
 
@@ -542,7 +542,7 @@ projscan diff # Compare against baseline
542
542
  projscan diff --format markdown # Markdown diff for PRs
543
543
  ```
544
544
 
545
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/npx%20projscan%20diff%20--save-baseline.gif" alt="npx projscan diff --save-baseline" width="700">
545
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/npx%20projscan%20diff%20--save-baseline.gif" alt="npx projscan diff --save-baseline" width="700">
546
546
 
547
547
  ## Hotspots - Where to Fix First
548
548
 
@@ -631,7 +631,7 @@ Coverage is also automatically joined into `projscan hotspots` when one of those
631
631
 
632
632
  **This is the primary way to use projscan.** `projscan mcp` starts an [MCP](https://modelcontextprotocol.io) server over stdio so AI coding agents can query your codebase with real structural accuracy - not regex, not grep.
633
633
 
634
- <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.6.0/docs/projscan-agent-demo.gif" alt="projscan answering two agent questions: what breaks if I rename buildCodeGraph (impact analysis with definitions, direct callers, transitive reach), and where should I fix first (ranked hotspots with cyclomatic complexity)" width="700">
634
+ <img src="https://raw.githubusercontent.com/abhiyoheswaran1/projscan/v3.7.0/docs/projscan-agent-demo.gif" alt="projscan answering two agent questions: what breaks if I rename buildCodeGraph (impact analysis with definitions, direct callers, transitive reach), and where should I fix first (ranked hotspots with cyclomatic complexity)" width="700">
635
635
 
636
636
  Two questions an agent asks; structural answers in milliseconds. *"What breaks if I rename `buildCodeGraph`?"* → 31 direct callers, 97 files reachable. *"Where should I fix first?"* → ranked hotspots with AST cyclomatic complexity, churn, and ownership signals.
637
637
 
@@ -777,7 +777,7 @@ Capability is advertised under `experimental.fileChanged` on `initialize` so cli
777
777
  - *"How do I plan the next six product lines?"* → `projscan_release_train`
778
778
  - *"How do I wire projscan into this MCP client?"* → `projscan_adoption { action: "mcp_config", client: "codex" }`
779
779
 
780
- ### The 46 MCP tools
780
+ ### The 47 MCP tools
781
781
 
782
782
  **Structural (0.6.0 / 0.11 / 0.13 / 0.14 / 0.15 - agent-native):**
783
783
  - **`projscan_start`** *(3.0.4)* - first-60-seconds repo orientation. Composes setup diagnostics, `firstTenMinutes`, workflow recipes, workplan, quality scorecard, top risks, adoption gaps, next commands, and optional handoff payload.
@@ -805,6 +805,7 @@ Capability is advertised under `experimental.fileChanged` on `initialize` so cli
805
805
  - **`projscan_merge_risk`** *(3.6)* - merge-risk preflight across in-flight worktrees: a safe integration order (merge the least-entangled branch first) plus conflict hotspots (files changed by 2+ worktrees). Builds on `projscan_collision`. Local-first.
806
806
  - **`projscan_route`** *(3.6)* - map a stated goal (e.g. "what breaks if I rename X") to the right projscan tool with the exact call, or list the full capability catalog. A discovery entry point over the tool surface; deterministic, no LLM.
807
807
  - **`projscan_coordinate`** *(3.6)* - one-call swarm coordination read: composes collisions, claims, and merge-risk into a `readiness` verdict (clear / caution / conflicted) with counts and the recommended integration order. The single entry point for the coordination arc. Local-first.
808
+ - **`projscan_coordinate_watch`** *(3.7)* - long-running coordination watch: polls the in-flight worktrees and emits a `notifications/projscan/coordination_changed` notification whenever the swarm state changes. Pairs with `projscan_coordinate`. `start` / `stop` / `list`.
808
809
 
809
810
  **Analysis:**
810
811
  - `projscan_analyze` - full project report
@@ -835,7 +836,7 @@ Capability is advertised under `experimental.fileChanged` on `initialize` so cli
835
836
  - **`projscan_apply_fix`** *(1.6)* - mechanically execute the safe fix templates. Default is dry-run; pass `confirm: true` to write. Atomic writes, per-apply rollback record at `.projscan-cache/rollbacks/<id>.json`. Reverse with `action: "rollback", rollback_id: ...`. Six templates supported at this release: `unused-dependency-*`, `missing-test-framework`, `missing-eslint`, `missing-prettier`, `missing-editorconfig`, `missing-readme`.
836
837
  - **`projscan_taint`** *(1.6)* - source-to-sink reachability over the per-function call graph. Built-in defaults cover common JS / Python sources (`process.env`, `req.body`, etc.) and sinks (`exec`, `eval`, `db.query`, etc.). Project-specific names go in `.projscanrc.json` `taint`. `projscan_review` automatically diffs taint flows between base and head and **blocks any PR that introduces a new flow**. In 3.0.2, review surfaces hardened `newDataflowRisks`, compact `graphEvidence`, and graph-readiness gates for safer handoff.
837
838
 
838
- Analyzer plugins can optionally read graph/dataflow context through `check(rootPath, files, context)` while staying on manifest schema v1. The packaged `graph-context` example shows `context.getSemanticGraph()` and `context.getDataflow()` in a real analyzer. For analyzer and reporter plugin authoring, manifest validation, `--reporter <name>`, and the trust model, see [Plugin Authoring](https://github.com/abhiyoheswaran1/projscan/blob/v3.6.0/docs/PLUGIN-AUTHORING.md).
839
+ Analyzer plugins can optionally read graph/dataflow context through `check(rootPath, files, context)` while staying on manifest schema v1. The packaged `graph-context` example shows `context.getSemanticGraph()` and `context.getDataflow()` in a real analyzer. For analyzer and reporter plugin authoring, manifest validation, `--reporter <name>`, and the trust model, see [Plugin Authoring](https://github.com/abhiyoheswaran1/projscan/blob/v3.7.0/docs/PLUGIN-AUTHORING.md).
839
840
 
840
841
  ### Context-window budgeting
841
842
 
@@ -11,12 +11,19 @@ export function registerCollision() {
11
11
  .command('collisions')
12
12
  .description('Detect change collisions across in-flight git worktrees (parallel agents)')
13
13
  .option('--base-ref <ref>', 'base ref each worktree is diffed against')
14
+ .option('--transitive', 'also report multi-hop dependency overlaps (less precise)')
15
+ .option('--max-distance <n>', 'max import hops for --transitive (default 5)')
14
16
  .action(async (cmdOpts) => {
15
17
  setupLogLevel();
16
18
  maybeCompactBanner();
17
19
  const format = assertFormatSupported('collisions');
18
20
  const rootPath = getRootPath();
19
- const report = await detectCollisions(rootPath, cmdOpts.baseRef ? { baseRef: cmdOpts.baseRef } : {});
21
+ const maxDistance = cmdOpts.maxDistance !== undefined ? Number.parseInt(cmdOpts.maxDistance, 10) : undefined;
22
+ const report = await detectCollisions(rootPath, {
23
+ ...(cmdOpts.baseRef ? { baseRef: cmdOpts.baseRef } : {}),
24
+ ...(cmdOpts.transitive ? { transitive: true } : {}),
25
+ ...(maxDistance !== undefined && Number.isFinite(maxDistance) && maxDistance > 0 ? { maxDistance } : {}),
26
+ });
20
27
  if (format === 'json') {
21
28
  console.log(JSON.stringify(report, null, 2));
22
29
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"collision.js","sourceRoot":"","sources":["../../../src/cli/commands/collision.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC/G,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO;SACJ,OAAO,CAAC,YAAY,CAAC;SACrB,WAAW,CAAC,2EAA2E,CAAC;SACxF,MAAM,CAAC,kBAAkB,EAAE,0CAA0C,CAAC;SACtE,MAAM,CAAC,KAAK,EAAE,OAA6B,EAAE,EAAE;QAC9C,aAAa,EAAE,CAAC;QAChB,kBAAkB,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;QA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C,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACrF,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,5 +1,7 @@
1
1
  /**
2
- * `projscan coordinate` (4.x) — one-call coordination read across in-flight
3
- * worktrees: collisions + claims + merge-risk folded into a readiness verdict.
2
+ * `projscan coordinate` (4.x) — one-call swarm coordination read across
3
+ * in-flight worktrees: collisions + claims + merge-risk folded into a readiness
4
+ * verdict. `--watch` re-evaluates on an interval and re-emits only when the
5
+ * coordination state changes (polling, since the state spans all worktrees).
4
6
  */
5
7
  export declare function registerCoordinate(): void;
@@ -1,43 +1,98 @@
1
1
  import chalk from 'chalk';
2
2
  import { program, getRootPath, setupLogLevel, maybeCompactBanner, assertFormatSupported } from '../_shared.js';
3
- import { computeCoordination } from '../../core/coordination.js';
3
+ import { computeCoordination, coordinationSignature, } from '../../core/coordination.js';
4
4
  const VERDICT_COLOR = {
5
5
  clear: chalk.green,
6
6
  caution: chalk.yellow,
7
7
  conflicted: chalk.red,
8
8
  };
9
+ const WATCH_DEFAULT_SECONDS = 5;
10
+ const WATCH_MIN_SECONDS = 2;
11
+ const WATCH_MAX_SECONDS = 600;
9
12
  /**
10
- * `projscan coordinate` (4.x) — one-call coordination read across in-flight
11
- * worktrees: collisions + claims + merge-risk folded into a readiness verdict.
13
+ * `projscan coordinate` (4.x) — one-call swarm coordination read across
14
+ * in-flight worktrees: collisions + claims + merge-risk folded into a readiness
15
+ * verdict. `--watch` re-evaluates on an interval and re-emits only when the
16
+ * coordination state changes (polling, since the state spans all worktrees).
12
17
  */
13
18
  export function registerCoordinate() {
14
19
  program
15
20
  .command('coordinate')
16
21
  .description('One-call swarm coordination read (collisions + claims + merge-risk)')
17
22
  .option('--base-ref <ref>', 'base ref each worktree is diffed against')
23
+ .option('--watch', 're-evaluate on an interval; re-emit only when coordination state changes')
24
+ .option('--interval <seconds>', `poll interval for --watch (default ${WATCH_DEFAULT_SECONDS})`)
18
25
  .action(async (cmdOpts) => {
19
26
  setupLogLevel();
20
27
  maybeCompactBanner();
21
28
  const format = assertFormatSupported('coordinate');
22
29
  const rootPath = getRootPath();
23
- const report = await computeCoordination(rootPath, cmdOpts.baseRef ? { baseRef: cmdOpts.baseRef } : {});
24
- if (format === 'json') {
25
- console.log(JSON.stringify(report, null, 2));
30
+ const detectOptions = cmdOpts.baseRef ? { baseRef: cmdOpts.baseRef } : {};
31
+ if (!cmdOpts.watch) {
32
+ render(await computeCoordination(rootPath, detectOptions), format, false);
26
33
  return;
27
34
  }
28
- console.log('');
29
- console.log(chalk.bold('Swarm coordination'));
30
- console.log(chalk.dim('────────────────────────────────────────'));
31
- if (!report.available) {
32
- console.log(chalk.dim(` ${report.reason}`));
33
- return;
34
- }
35
- const color = VERDICT_COLOR[report.readiness];
36
- console.log(` Readiness: ${color(report.readiness.toUpperCase())}`);
37
- console.log('');
38
- for (const line of report.summary) {
39
- console.log(` • ${line}`);
35
+ const intervalMs = resolveIntervalMs(cmdOpts.interval, format);
36
+ if (format === 'console') {
37
+ console.log(chalk.dim(`Watching swarm coordination (every ${intervalMs / 1000}s; Ctrl+C to stop)…`));
40
38
  }
39
+ let lastSignature = '';
40
+ const tick = async () => {
41
+ try {
42
+ const report = await computeCoordination(rootPath, detectOptions);
43
+ const signature = coordinationSignature(report);
44
+ if (signature !== lastSignature) {
45
+ lastSignature = signature;
46
+ render(report, format, true);
47
+ }
48
+ }
49
+ catch (err) {
50
+ // Keep watching across transient errors (e.g. mid-rebase git state).
51
+ process.stderr.write(`[projscan] coordinate watch tick failed: ${err instanceof Error ? err.message : String(err)}\n`);
52
+ }
53
+ };
54
+ await tick();
55
+ const timer = setInterval(() => void tick(), intervalMs);
56
+ const stop = () => {
57
+ clearInterval(timer);
58
+ process.exit(0);
59
+ };
60
+ process.on('SIGINT', stop);
61
+ process.on('SIGTERM', stop);
41
62
  });
42
63
  }
64
+ function resolveIntervalMs(raw, format) {
65
+ if (raw === undefined)
66
+ return WATCH_DEFAULT_SECONDS * 1000;
67
+ const seconds = Number.parseInt(raw, 10);
68
+ if (!Number.isFinite(seconds) || seconds < WATCH_MIN_SECONDS || seconds > WATCH_MAX_SECONDS) {
69
+ const message = `--interval must be ${WATCH_MIN_SECONDS}–${WATCH_MAX_SECONDS} seconds.`;
70
+ if (format === 'json')
71
+ console.log(JSON.stringify({ ok: false, error: message }, null, 2));
72
+ else
73
+ console.error(chalk.red(message));
74
+ process.exit(1);
75
+ }
76
+ return seconds * 1000;
77
+ }
78
+ function render(report, format, watch) {
79
+ if (format === 'json') {
80
+ // NDJSON in watch mode (one object per change), pretty once otherwise.
81
+ console.log(watch ? JSON.stringify(report) : JSON.stringify(report, null, 2));
82
+ return;
83
+ }
84
+ console.log('');
85
+ const heading = watch ? `Swarm coordination · ${new Date().toLocaleTimeString()}` : 'Swarm coordination';
86
+ console.log(chalk.bold(heading));
87
+ console.log(chalk.dim('────────────────────────────────────────'));
88
+ if (!report.available) {
89
+ console.log(chalk.dim(` ${report.reason}`));
90
+ return;
91
+ }
92
+ console.log(` Readiness: ${VERDICT_COLOR[report.readiness](report.readiness.toUpperCase())}`);
93
+ console.log('');
94
+ for (const line of report.summary) {
95
+ console.log(` • ${line}`);
96
+ }
97
+ }
43
98
  //# sourceMappingURL=coordinate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"coordinate.js","sourceRoot":"","sources":["../../../src/cli/commands/coordinate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC/G,OAAO,EAAE,m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AAE,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
@@ -5,6 +5,7 @@ import { buildSemanticGraph } from './semanticGraph.js';
5
5
  import { collectIssues } from './issueEngine.js';
6
6
  import { scanRepository } from './repositoryScanner.js';
7
7
  import { buildRiskNow } from './sessionResources.js';
8
+ import { computeCoordination, coordinationHints as toCoordinationHints } from './coordination.js';
8
9
  import { applyConfigToIssues, loadConfig } from '../utils/config.js';
9
10
  import { calculateScore } from '../utils/scoreCalculator.js';
10
11
  const DEFAULT_MAX_ITEMS = 6;
@@ -15,10 +16,11 @@ export async function computeAgentBrief(rootPath, options = {}) {
15
16
  const scan = await scanRepository(rootPath, { ignore: configResult.config.ignore });
16
17
  const issues = applyConfigToIssues(await collectIssues(rootPath, scan.files), configResult.config);
17
18
  const health = calculateScore(issues);
18
- const [riskNow, hotspots, graphContext] = await Promise.all([
19
+ const [riskNow, hotspots, graphContext, coordination] = await Promise.all([
19
20
  safeRiskNow(rootPath),
20
21
  safeHotspots(rootPath, scan.files, issues, maxItems),
21
22
  safeGraphContext(rootPath, scan.files),
23
+ safeCoordination(rootPath),
22
24
  ]);
23
25
  const allFocus = rankFocus([
24
26
  ...issues.slice(0, maxItems * 2).map(issueToFocus),
@@ -38,7 +40,7 @@ export async function computeAgentBrief(rootPath, options = {}) {
38
40
  topDirectories: topDirectories(scan.files),
39
41
  touchedFiles: riskNow.touchedFiles.slice(0, 12),
40
42
  conflicts: riskNow.conflicts.length,
41
- coordinationHints: riskNow.coordinationHints,
43
+ coordinationHints: [...riskNow.coordinationHints, ...swarmCoordinationHints(coordination)],
42
44
  ...(graphContext ? { graph: graphContext } : {}),
43
45
  },
44
46
  focus,
@@ -72,6 +74,34 @@ function topPackagesByImporters(graph) {
72
74
  .slice(0, 5)
73
75
  .map((entry) => entry.name);
74
76
  }
77
+ async function safeCoordination(rootPath) {
78
+ try {
79
+ return await computeCoordination(rootPath);
80
+ }
81
+ catch {
82
+ return null;
83
+ }
84
+ }
85
+ /**
86
+ * Fold the swarm coordination read into a single structured brief hint. Empty
87
+ * when coordination is unavailable or clear (the common single-worktree case),
88
+ * so the brief is unchanged unless there's real cross-worktree signal.
89
+ */
90
+ function swarmCoordinationHints(summary) {
91
+ if (!summary)
92
+ return [];
93
+ const hints = toCoordinationHints(summary);
94
+ if (hints.length === 0)
95
+ return [];
96
+ return [
97
+ {
98
+ id: 'swarm-coordination',
99
+ label: 'Swarm coordination',
100
+ message: hints.join(' '),
101
+ command: 'projscan coordinate --format json',
102
+ },
103
+ ];
104
+ }
75
105
  async function safeRiskNow(rootPath) {
76
106
  try {
77
107
  return await buildRiskNow(rootPath);
@@ -1 +1 @@
1
- {"version":3,"file":"agentBrief.js","sourceRoot":"","sources":["../../src/core/agentBrief.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAqB7D,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAgB,EAChB,UAAoC,EAAE;IAEtC,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,MAAM,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CAAC;IACtC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,YAAY,CAAC,QAA0B;IAC9C,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,CAAC,CAAC;IAChC,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,IAAI,CAAC,KAAa;IACzB,OAAO,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC;AAC9F,CAAC"}
@@ -26,6 +26,8 @@ export interface Collision {
26
26
  worktreeB: string;
27
27
  fileB: string;
28
28
  reason: string;
29
+ /** Import hops for a dependency collision (1 = direct, >=2 = transitive). */
30
+ distance?: number;
29
31
  }
30
32
  export interface CollisionWorktreeSummary {
31
33
  path: string;
@@ -43,6 +45,14 @@ export interface CollisionReport {
43
45
  export interface DetectCollisionsOptions {
44
46
  /** Base ref each worktree is diffed against. Defaults to the usual fallbacks. */
45
47
  baseRef?: string;
48
+ /**
49
+ * Also report transitive (multi-hop) dependency overlaps, not just direct
50
+ * imports. Default false — the 1-hop default stays precise (low false
51
+ * positives); transitive recall is opt-in for deeper but noisier coverage.
52
+ */
53
+ transitive?: boolean;
54
+ /** Max import hops for transitive recall (default 5). */
55
+ maxDistance?: number;
46
56
  }
47
57
  /** Parse `git worktree list --porcelain` into structured refs. Local-first. */
48
58
  export declare function listWorktrees(rootPath: string): Promise<WorktreeRef[]>;
@@ -2,6 +2,7 @@ import { execFile } from 'node:child_process';
2
2
  import { promisify } from 'node:util';
3
3
  import { scanRepository } from './repositoryScanner.js';
4
4
  import { buildCodeGraph, importersOf } from './codeGraph.js';
5
+ import { computeImpact } from './impact.js';
5
6
  import { getChangedFiles } from '../utils/changedFiles.js';
6
7
  const execFileAsync = promisify(execFile);
7
8
  /** Parse `git worktree list --porcelain` into structured refs. Local-first. */
@@ -114,6 +115,7 @@ export async function detectCollisions(rootPath, options = {}) {
114
115
  fileA: file,
115
116
  worktreeB: b.ref.path,
116
117
  fileB: other,
118
+ distance: 1,
117
119
  reason: `${other} (changed in the other worktree) imports ${file} (changed here).`,
118
120
  });
119
121
  }
@@ -134,11 +136,53 @@ export async function detectCollisions(rootPath, options = {}) {
134
136
  fileA: other,
135
137
  worktreeB: b.ref.path,
136
138
  fileB: file,
139
+ distance: 1,
137
140
  reason: `${other} (changed here) imports ${file} (changed in the other worktree).`,
138
141
  });
139
142
  }
140
143
  }
141
144
  }
145
+ // Transitive overlap (opt-in) — multi-hop dependency edges via the impact
146
+ // graph. Only distance >= 2 here; distance 1 is the precise pass above.
147
+ if (options.transitive) {
148
+ const maxDistance = options.maxDistance ?? 5;
149
+ for (const file of aFiles) {
150
+ if (bSet.has(file))
151
+ continue;
152
+ for (const node of computeImpact(graph, { kind: 'file', value: file }, { maxDistance }).reachable) {
153
+ if (node.distance >= 2 && bSet.has(node.file) && !aSet.has(node.file)) {
154
+ collisions.push({
155
+ kind: 'dependency',
156
+ severity: 'medium',
157
+ worktreeA: a.ref.path,
158
+ fileA: file,
159
+ worktreeB: b.ref.path,
160
+ fileB: node.file,
161
+ distance: node.distance,
162
+ reason: `${node.file} (changed in the other worktree) transitively imports ${file} (changed here), ${node.distance} hops away.`,
163
+ });
164
+ }
165
+ }
166
+ }
167
+ for (const file of b.files) {
168
+ if (aSet.has(file))
169
+ continue;
170
+ for (const node of computeImpact(graph, { kind: 'file', value: file }, { maxDistance }).reachable) {
171
+ if (node.distance >= 2 && aSet.has(node.file) && !bSet.has(node.file)) {
172
+ collisions.push({
173
+ kind: 'dependency',
174
+ severity: 'medium',
175
+ worktreeA: a.ref.path,
176
+ fileA: node.file,
177
+ worktreeB: b.ref.path,
178
+ fileB: file,
179
+ distance: node.distance,
180
+ reason: `${node.file} (changed here) transitively imports ${file} (changed in the other worktree), ${node.distance} hops away.`,
181
+ });
182
+ }
183
+ }
184
+ }
185
+ }
142
186
  }
143
187
  }
144
188
  return {
@@ -150,7 +194,29 @@ export async function detectCollisions(rootPath, options = {}) {
150
194
  changedFileCount: c.files.length,
151
195
  baseRef: c.baseRef,
152
196
  })),
153
- collisions,
197
+ collisions: dedupeCollisions(collisions),
154
198
  };
155
199
  }
200
+ /**
201
+ * Same-file collisions pass through; dependency collisions are deduped per
202
+ * oriented (worktreeA, fileA, worktreeB, fileB) pair, keeping the shortest
203
+ * distance — so a transitive path can't re-report a pair the direct (distance
204
+ * 1) pass already found.
205
+ */
206
+ function dedupeCollisions(list) {
207
+ const sameFile = [];
208
+ const bestDependency = new Map();
209
+ for (const c of list) {
210
+ if (c.kind === 'same-file') {
211
+ sameFile.push(c);
212
+ continue;
213
+ }
214
+ const key = `${c.worktreeA}|${c.fileA}|${c.worktreeB}|${c.fileB}`;
215
+ const existing = bestDependency.get(key);
216
+ if (!existing || (c.distance ?? Infinity) < (existing.distance ?? Infinity)) {
217
+ bestDependency.set(key, c);
218
+ }
219
+ }
220
+ return [...sameFile, ...bestDependency.values()];
221
+ }
156
222
  //# sourceMappingURL=collisionDetector.js.map