@diffci.com/diffci 0.3.2 → 0.3.4

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 (51) hide show
  1. package/.agents/plugins/marketplace.json +12 -0
  2. package/README.md +25 -5
  3. package/action.yml +3 -3
  4. package/dist-client/src/client/agent-selection.js +67 -0
  5. package/dist-client/src/client/cli.js +42 -13
  6. package/dist-client/src/client/full-command.js +30 -0
  7. package/dist-client/src/client/mcp.js +74 -7
  8. package/dist-client/src/client/observe.js +1 -0
  9. package/dist-client/src/client/verify-savings.js +24 -7
  10. package/dist-client/src/client/verify.js +29 -24
  11. package/docs/adoption-metrics.md +31 -5
  12. package/docs/adoption-outreach.md +43 -8
  13. package/docs/agent-adoption-kit.md +3 -3
  14. package/docs/agent-plugin.md +80 -0
  15. package/docs/claude-code.md +4 -4
  16. package/docs/codex.md +4 -4
  17. package/docs/cursor.md +5 -4
  18. package/docs/distribution.md +6 -4
  19. package/docs/mcp.md +4 -0
  20. package/docs/npm-adoption.md +3 -3
  21. package/node_modules/@diffci.com/core/README.md +41 -2
  22. package/node_modules/@diffci.com/core/dist/cache/graph-cache.d.ts +1 -1
  23. package/node_modules/@diffci.com/core/dist/cache/graph-cache.js +1 -1
  24. package/node_modules/@diffci.com/core/dist/planner/test-command.js +76 -0
  25. package/node_modules/@diffci.com/core/dist/planner/test-command.js.map +1 -1
  26. package/node_modules/@diffci.com/core/dist/repo/analyzer.js +19 -1
  27. package/node_modules/@diffci.com/core/dist/repo/analyzer.js.map +1 -1
  28. package/node_modules/@diffci.com/core/dist/repo/graph.js +34 -6
  29. package/node_modules/@diffci.com/core/dist/repo/graph.js.map +1 -1
  30. package/node_modules/@diffci.com/core/dist/repo/test-discovery.d.ts +7 -0
  31. package/node_modules/@diffci.com/core/dist/repo/test-discovery.js +58 -0
  32. package/node_modules/@diffci.com/core/dist/repo/test-discovery.js.map +1 -1
  33. package/node_modules/@diffci.com/core/dist/repo/types.d.ts +5 -0
  34. package/node_modules/@diffci.com/core/dist/repo/workspaces.d.ts +2 -0
  35. package/node_modules/@diffci.com/core/dist/repo/workspaces.js +37 -0
  36. package/node_modules/@diffci.com/core/dist/repo/workspaces.js.map +1 -0
  37. package/node_modules/@diffci.com/core/src/cache/graph-cache.ts +1 -1
  38. package/node_modules/@diffci.com/core/src/planner/test-command.ts +59 -0
  39. package/node_modules/@diffci.com/core/src/repo/analyzer.ts +18 -1
  40. package/node_modules/@diffci.com/core/src/repo/graph.ts +33 -6
  41. package/node_modules/@diffci.com/core/src/repo/test-discovery.ts +54 -0
  42. package/node_modules/@diffci.com/core/src/repo/types.ts +2 -0
  43. package/node_modules/@diffci.com/core/src/repo/workspaces.ts +29 -0
  44. package/package.json +10 -4
  45. package/packaging/agent-plugin/.claude-plugin/plugin.json +6 -0
  46. package/packaging/agent-plugin/.codex-plugin/plugin.json +8 -0
  47. package/packaging/agent-plugin/.mcp.json +13 -0
  48. package/packaging/agent-plugin/skills/diffci-verify/SKILL.md +35 -0
  49. package/server.json +2 -2
  50. package/site/assets/calcom-runtime-evidence.svg +11 -0
  51. package/site/llms.txt +44 -0
@@ -87,30 +87,7 @@ async function executeObservation(options, scope, before, observation) {
87
87
  report.snapshot.after_tree_sha = afterAnalysis.treeSha;
88
88
  return report;
89
89
  }
90
- let selection;
91
- let command;
92
- let reason;
93
- if (result.mode === "SELECTIVE" && !result.commandRefusalReason && result.proposedCommands.length === 1) {
94
- const selected = inferSelectedCommand(options.repoPath, result.proposedCommands[0], result.selectedTests);
95
- if (selected.command) {
96
- selection = "selected";
97
- command = selected.command;
98
- reason = "dependency impact";
99
- }
100
- else {
101
- selection = "full";
102
- const full = inferFullCommand(options.repoPath);
103
- command = full.command;
104
- reason = `selected verification was not executable (${selected.reason}); broadened to full verification`;
105
- }
106
- }
107
- else {
108
- selection = "full";
109
- const full = inferFullCommand(options.repoPath);
110
- command = full.command;
111
- const fallback = result.fallbackReasons[0] ?? result.commandRefusalReason;
112
- reason = fallback ? `full verification required: ${fallback}` : "full verification required";
113
- }
90
+ const { selection, command, reason } = executableSelection(options.repoPath, result);
114
91
  if (!command) {
115
92
  const inferred = inferFullCommand(options.repoPath);
116
93
  return blocked(before, scope, `no executable verification command is available: ${inferred.reason}`, analysis, counts, boundRange);
@@ -263,3 +240,31 @@ export function formatVerificationSummary(report) {
263
240
  lines.push(` command: ${report.command}`);
264
241
  return lines.join("\n");
265
242
  }
243
+ /** Shared executable plan for read-only agent selection and verification. */
244
+ export function executableSelection(repoPath, result) {
245
+ let selection;
246
+ let command;
247
+ let reason;
248
+ if (result.mode === "SELECTIVE" && !result.commandRefusalReason && result.proposedCommands.length === 1) {
249
+ const selected = inferSelectedCommand(repoPath, result.proposedCommands[0], result.selectedTests);
250
+ if (selected.command) {
251
+ selection = "selected";
252
+ command = selected.command;
253
+ reason = "dependency impact";
254
+ }
255
+ else {
256
+ selection = "full";
257
+ const full = inferFullCommand(repoPath);
258
+ command = full.command;
259
+ reason = `selected verification was not executable (${selected.reason}); broadened to full verification`;
260
+ }
261
+ }
262
+ else {
263
+ selection = "full";
264
+ const full = inferFullCommand(repoPath);
265
+ command = full.command;
266
+ const fallback = result.fallbackReasons[0] ?? result.commandRefusalReason;
267
+ reason = fallback ? `full verification required: ${fallback}` : "full verification required";
268
+ }
269
+ return { selection, command, reason };
270
+ }
@@ -23,6 +23,30 @@ community posts:
23
23
  Route maintainers who have already run it to the
24
24
  [`Share a first DiffCI report`](../.github/ISSUE_TEMPLATE/first-diffci-report.yml) issue template.
25
25
 
26
+ ## Adoption definitions
27
+
28
+ Count independently owned repositories, excluding DiffCI-owned repositories, internal dogfood runs,
29
+ and benchmark-only sandbox replays. Deduplicate by repository; retain the evidence link and date.
30
+
31
+ | Metric | Evidence required |
32
+ | --- | --- |
33
+ | First successful report | Maintainer-shared completed analysis or verification receipt. Record selective and full-fallback results separately; refusals/errors are attempts, not activation. |
34
+ | Recurring installation | Maintainer-approved installation plus executions on at least two distinct days within seven days. A merged PR alone is an installation milestone. |
35
+ | Known active repositories | Distinct independent repositories with an evidenced completed execution in the trailing seven days, through public workflow activity or consenting pilot reports. Report observation and verification separately. |
36
+ | Four-week retention | Activated repositories with an evidenced completed execution in days 22–28 after activation, divided by activated repositories whose full 28-day window has elapsed. Report numerator and denominator. |
37
+ | Measured net runtime savings | Comparable full/selected runs including analysis overhead, with checkout identity, command coverage, exit codes, cache conditions, and repeated timings recorded. Include zero/negative results; do not infer runtime from selection counts. |
38
+ | External contributors | Distinct independent people with an accepted code, fixture, documentation, or reproducible benchmark contribution during the reporting period. |
39
+
40
+ Maintain one weekly row per consenting pilot or publicly evidenced repository in the canonical
41
+ [DiffCI Outreach Tracker](https://docs.google.com/spreadsheets/d/1TvZo9YnDawOLR75WTyPSAf95vQ5VdoBx6iBeqJF_d60/edit):
42
+ repository, acquisition channel, first attempt/report dates, outcome, installation evidence,
43
+ latest execution evidence/date, observation or verification, retention eligibility/result,
44
+ runtime evidence, blocker, and next action. Use consented identifiers for private pilots.
45
+ Unknown activity stays unknown; do not interpret unavailable evidence as confirmed inactivity.
46
+
47
+ Known active repositories is a lower bound on evidenced usage, not total active repositories.
48
+ Current anonymous opt-in events cannot establish unique repositories or retention.
49
+
26
50
  ## Opt-in CLI usage
27
51
 
28
52
  Users can run `diffci check --share-usage` or set `DIFFCI_SHARE_USAGE=1` for `check` and
@@ -80,8 +104,9 @@ track conversion signals, not only application status:
80
104
 
81
105
  Weekly loop:
82
106
 
83
- 1. Check npm version/downloads, GitHub traffic, Marketplace/listing signals, stars, issues, and opt-in
84
- usage events.
107
+ 1. Review first reports, recurring installations, known active repositories, mature four-week
108
+ retention cohorts, measured savings, and external contributions. Record evidence and denominators.
109
+ Review downloads, traffic, directory listings, and anonymous usage separately as discovery signals.
85
110
  2. Label first-run reports with `first-report` and record whether they are selective, full fallback,
86
111
  refused, or errored.
87
112
  3. Reply to every first-report issue with one next step: inspect fallback/refusal, repeat with controlled
@@ -97,7 +122,7 @@ They are supporting signals only.
97
122
 
98
123
  | Signal | Value | Interpretation |
99
124
  | --- | ---: | --- |
100
- | npm latest version | `0.3.2` | Current CLI and MCP binaries are publicly available. |
125
+ | npm latest version | `0.3.4` | Current CLI and MCP binaries are publicly available. |
101
126
  | npm downloads, last complete registry week (`2026-09-15`–`2026-09-21`) | 1,929 | Distribution activity; not unique users or repositories. |
102
127
  | GitHub stars / forks / watchers | 0 / 0 / 0 | No repository-level community conversion yet. |
103
128
  | GitHub views, available 14-day window | 18 views / 4 unique visitors | Early discovery signal. |
@@ -131,5 +156,6 @@ Existing outreach log:
131
156
  | 2026-09-22 | Glama | Directory | TBD | Planned | Submit repository URL. |
132
157
  | 2026-09-22 | Smithery | Directory | TBD | Blocked | Needs Smithery account/API key. |
133
158
 
134
- Use merged PRs and accepted directory listings as the primary adoption signal. Use stars, downloads,
135
- and page views as supporting indicators, not proof that agents are actually using DiffCI.
159
+ Use independently evidenced subsequent executions and retention as the primary adoption signals.
160
+ Merged installation PRs are installation milestones; accepted directory listings are distribution
161
+ milestones. Stars, downloads, and page views support discovery analysis and do not prove usage.
@@ -4,13 +4,25 @@ Use this page as the canonical copy source for directory submissions, issues, an
4
4
 
5
5
  ## One-Line Description
6
6
 
7
- DiffCI is an observation-only CI/CD validation tool and MCP server for AI coding agents.
7
+ DiffCI is open-source test-impact analysis for faster CI.
8
8
 
9
9
  ## Short Description
10
10
 
11
- DiffCI gives coding agents a safe validation lens before they call work PR-ready. It analyzes the
12
- current checkout, explains affected tests, can run inferred local validation through `diffci check`,
13
- and leaves required CI authoritative.
11
+ DiffCI finds tests affected by a code change and measures full versus selected runtime so maintainers
12
+ can evaluate CI savings. Run `check` locally without an account; it sends nothing by default.
13
+ Existing required CI remains authoritative. Test selection counts alone do not prove runtime savings.
14
+
15
+ ## Choose the entry point
16
+
17
+ Use the CI description above for npm, CI communities, and maintainer outreach. For coding-agent
18
+ communities and MCP directories, use this separate description:
19
+
20
+ > DiffCI verifies a coding agent's current changes with affected tests or conservative full fallback,
21
+ > and returns a receipt bound to the tested snapshot. Required CI remains authoritative.
22
+
23
+ Use `check` for a first CI savings evaluation and `verify --changed --json` for agent verification.
24
+ Only `observe` and the Marketplace Action are observation-only; do not describe the entire product
25
+ that way. See the [adoption kit](agent-adoption-kit.md) for installation and MCP setup.
14
26
 
15
27
  ## Links
16
28
 
@@ -60,7 +72,25 @@ Please paste only the DiffCI summary or a sanitized report excerpt. Do not paste
60
72
  source, tokens, or credential-bearing CI logs.
61
73
  ~~~
62
74
 
63
- ## Issue Template
75
+ ## CI maintainer issue template
76
+
77
+ Suggested title: **Evaluate affected-test runtime on this repository**
78
+
79
+ ~~~md
80
+ DiffCI finds tests affected by a code change and compares full versus selected runtime locally:
81
+
82
+ ```bash
83
+ npx "@diffci.com/diffci@latest" check
84
+ ```
85
+
86
+ It requires Git and Node.js 22.5+, sends nothing by default, and leaves required CI authoritative.
87
+ A full fallback or setup error is useful feedback too. Would a local evaluation be useful here?
88
+
89
+ Please share a summary or sanitized excerpt using:
90
+ https://github.com/DiffCI/DiffCI.com/issues/new?template=first-diffci-report.yml
91
+ ~~~
92
+
93
+ ## Agent issue template
64
94
 
65
95
  Title:
66
96
 
@@ -76,9 +106,9 @@ DiffCI now ships an npm CLI and stdio MCP server for AI coding agents:
76
106
  - CLI: `npx "@diffci.com/diffci@latest" check`
77
107
  - MCP: `npx -p "@diffci.com/diffci@latest" diffci-mcp`
78
108
 
79
- It is intended as an optional validation lens before agents mark work PR-ready. DiffCI analyzes the
80
- current checkout, explains affected tests, can run inferred local validation through `diffci check`,
81
- and does not skip, cancel, reorder, or modify required CI.
109
+ For current working-tree verification, run `npx "@diffci.com/diffci@latest" verify --changed --json`.
110
+ It executes selected verification or conservative full fallback and returns a snapshot-bound receipt.
111
+ Use `check` separately to compare runtimes. Required CI remains authoritative.
82
112
 
83
113
  Docs:
84
114
 
@@ -100,6 +130,11 @@ When someone shares a first report, reply with exactly one next step:
100
130
  | Error | Ask for the sanitized error and open a bug if it is reproducible. |
101
131
  | Paired runtime result | Check command coverage, cache state, exit codes, and checkout provenance before discussing savings. |
102
132
 
133
+ After a useful local evaluation, offer `init --install --workflow` for a pinned installation and a
134
+ separate non-blocking observation pilot. Review the generated changes with the maintainer. Observation
135
+ does not measure runtime savings; use repeated paired comparisons for that evidence. Record a merged
136
+ installation as a milestone, then verify subsequent executions before counting recurring adoption.
137
+
103
138
  ## PR Snippet
104
139
 
105
140
  ~~~md
@@ -38,13 +38,13 @@ permissions:
38
38
  contents: read
39
39
  jobs:
40
40
  diffci:
41
- runs-on: ubuntu-latest
41
+ runs-on: ubuntu-24.04
42
42
  continue-on-error: true
43
43
  steps:
44
- - uses: actions/checkout@v4
44
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # immutable checkout pin
45
45
  with:
46
46
  fetch-depth: 0
47
- - uses: DiffCI/DiffCI.com@edac0ad48ae4bbdcf7e7839cf0bb371201a46872 # v0.3.2
47
+ - uses: DiffCI/DiffCI.com@cc870c9258adf8a278d7fe678f0d793ff65cdae6 # v0.3.4
48
48
  ```
49
49
 
50
50
  Run `npx "@diffci.com/diffci@latest" verify-workflow` before starting a pilot. The Action uploads a
@@ -0,0 +1,80 @@
1
+ # DiffCI coding-agent plugin
2
+
3
+ One package in `packaging/agent-plugin` supports Claude Code and Codex through
4
+ their respective manifests, a shared skill, and the same local stdio MCP server.
5
+ It uses the existing CLI and core engine. No additional engine or cloud service
6
+ is required. Node 22.5+ and Git are required.
7
+
8
+ ## Install after release
9
+
10
+ ```bash
11
+ npm install --save-dev @diffci.com/diffci
12
+ ```
13
+
14
+ Claude Code:
15
+
16
+ ```bash
17
+ claude --plugin-dir ./node_modules/@diffci.com/diffci/packaging/agent-plugin
18
+ ```
19
+
20
+ Codex:
21
+
22
+ ```bash
23
+ codex plugin marketplace add ./node_modules/@diffci.com/diffci
24
+ codex plugin add diffci@diffci-local
25
+ ```
26
+
27
+ Both integrations use the shared skill automatically when applicable, and it can
28
+ also be invoked explicitly (`/diffci:diffci-verify` in Claude Code).
29
+ These commands require an npm release containing this implementation; use the
30
+ local development steps below before release.
31
+
32
+ ## Local development
33
+
34
+ Build the checkout with `npm run build:client`. For testing unreleased tools, copy
35
+ the plugin directory outside the repository and change the copy's `.mcp.json`
36
+ server to `command: "node"` with `args` containing the absolute path to
37
+ `dist-client/src/client/mcp.js` in this checkout. The checked-in npm configuration
38
+ pins the package version; new tools become available through npm after release.
39
+
40
+ Claude Code can load the copy with `claude --plugin-dir /absolute/path/to/plugin`.
41
+ For Codex, this checkout includes a repo marketplace at
42
+ `.agents/plugins/marketplace.json`. Register the checkout with
43
+ `codex plugin marketplace add /absolute/path/to/DiffCI.com`, then install
44
+ `diffci@diffci-local` with `codex plugin add diffci@diffci-local` or use the
45
+ Plugins UI. The marketplace entry does not enable the plugin automatically.
46
+ For an unreleased build, use the copied plugin in a separate local marketplace
47
+ with its `source.path` pointing to that copy. Otherwise register the MCP server directly
48
+ and copy `skills/diffci-verify` into your personal Codex skills directory.
49
+ Always pass the edited repository's absolute path as the tool's `repo` argument;
50
+ the server process may start outside that repository.
51
+
52
+ Installing an npm package alone does not install an agent plugin. Install or load
53
+ the plugin explicitly to enable skill discovery. This first version uses skill
54
+ discovery and explicit invocation; it does not impose automatic lifecycle hooks.
55
+ The package has not been submitted to either public plugin directory.
56
+
57
+ ## Tools
58
+
59
+ `diffci_changed_files` returns `diffci.agent-changes.v1` with current paths and
60
+ tree identity, without building a dependency graph.
61
+ `diffci_select_tests` and `diffci_explain_selection`
62
+ return `diffci.agent-selection.v1`: current changed paths, tree identity,
63
+ selected test files, executable command, and fallback reasons. They do not run
64
+ tests. A full fallback's test count describes the discovered universe; its
65
+ `selected_tests` list is empty because no narrower selection is claimed.
66
+
67
+ `diffci_run_affected_tests` delegates to `verify --changed --json`, returning
68
+ `diffci.verification.v1`. It reanalyzes rather than trusting a previous plan and
69
+ checks the snapshot before and after execution. Unknown analysis blocks;
70
+ uncertain selection broadens to the repository's full command when available.
71
+ Required CI checks remain authoritative. All four tools operate on uncommitted
72
+ changes relative to HEAD. Use `diffci_verify` for committed ranges.
73
+
74
+ The server accepts standard newline-delimited MCP stdio messages and retains
75
+ legacy Content-Length framing for existing clients. No telemetry is sent by these
76
+ four tools. Repository-defined test commands may write generated files or use the
77
+ network as they normally would.
78
+
79
+ Manifest references: [Codex packaging](https://developers.openai.com/plugins/build/plugins)
80
+ and [Claude Code plugins](https://code.claude.com/docs/en/plugins-reference).
@@ -9,10 +9,10 @@ npx "@diffci.com/diffci@latest" init
9
9
  Default validation command:
10
10
 
11
11
  ```bash
12
- npx "@diffci.com/diffci@latest" check
12
+ npx "@diffci.com/diffci@latest" verify --changed --json
13
13
  ```
14
14
 
15
- Use DiffCI before PR-ready answers. `check` analyzes the change and runs inferred full and selected
16
- test commands to measure time. It writes reports outside the checkout and sends nothing by default.
17
- Test commands may write generated files. Use `observe --no-send` for analysis only.
15
+ Use DiffCI before PR-ready answers. Continue only when `safe_to_continue` is true. Verification covers
16
+ the current staged, unstaged, and untracked snapshot, uses full fallback when uncertain, and sends
17
+ nothing by default. If tests change files, review them and rerun. Use `observe --no-send` for analysis only.
18
18
  Keep the repository's required checks authoritative.
package/docs/codex.md CHANGED
@@ -9,10 +9,10 @@ npx "@diffci.com/diffci@latest" init
9
9
  Default validation command:
10
10
 
11
11
  ```bash
12
- npx "@diffci.com/diffci@latest" check
12
+ npx "@diffci.com/diffci@latest" verify --changed --json
13
13
  ```
14
14
 
15
- Use DiffCI before PR-ready answers. `check` analyzes the change and runs inferred full and selected
16
- test commands to measure time. It writes reports outside the checkout and sends nothing by default.
17
- Test commands may write generated files. Use `observe --no-send` for analysis only.
15
+ Use DiffCI before PR-ready answers. Continue only when `safe_to_continue` is true. Verification covers
16
+ the current staged, unstaged, and untracked snapshot, uses full fallback when uncertain, and sends
17
+ nothing by default. If tests change files, review them and rerun. Use `observe --no-send` for analysis only.
18
18
  Keep the repository's required checks authoritative.
package/docs/cursor.md CHANGED
@@ -9,10 +9,11 @@ npx "@diffci.com/diffci@latest" init
9
9
  Default validation command:
10
10
 
11
11
  ```bash
12
- npx "@diffci.com/diffci@latest" check
12
+ npx "@diffci.com/diffci@latest" verify --changed --json
13
13
  ```
14
14
 
15
- Use DiffCI before PR-ready changes. `init` writes `.cursor/rules/diffci.mdc`; `check` analyzes the
16
- change and runs inferred full and selected test commands to measure time. It sends nothing by
17
- default. Test commands may write generated files; use `observe --no-send` for analysis only. Keep
15
+ Use DiffCI before PR-ready changes. `init` writes `.cursor/rules/diffci.mdc`; verification covers the
16
+ current staged, unstaged, and untracked snapshot and uses full fallback when uncertain. Continue only
17
+ when `safe_to_continue` is true. It sends nothing by default. If tests change files, review them and
18
+ rerun; use `observe --no-send` for analysis only. Keep
18
19
  the repository's required checks authoritative.
@@ -1,5 +1,7 @@
1
1
  # DiffCI Distribution
2
2
 
3
+ Open-source campaigns should lead to [DiffCI/core](https://github.com/DiffCI/core). The npm CLI and MCP wrapper retain their actual source-repository metadata. Use a Core star link after a valid positive runtime comparison, and link to the engine from directory copy. See [the October execution plan](growth/30-day-execution.md) for pilot and launch drafts.
4
+
3
5
  DiffCI has complementary install surfaces: a fail-closed agent verifier, a blocking CI verification
4
6
  workflow, and an observation-only Action for measuring opportunities without changing required CI.
5
7
 
@@ -61,18 +63,18 @@ continue-on-error job:
61
63
  ```yaml
62
64
  jobs:
63
65
  diffci:
64
- runs-on: ubuntu-latest
66
+ runs-on: ubuntu-24.04
65
67
  continue-on-error: true
66
68
  permissions:
67
69
  contents: read
68
70
  steps:
69
- - uses: actions/checkout@v4
71
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # immutable checkout pin
70
72
  with:
71
73
  fetch-depth: 0
72
- - uses: DiffCI/DiffCI.com@edac0ad48ae4bbdcf7e7839cf0bb371201a46872
74
+ - uses: DiffCI/DiffCI.com@cc870c9258adf8a278d7fe678f0d793ff65cdae6
73
75
  ```
74
76
 
75
- The example pins release `v0.3.2` to its qualified feature commit SHA. `npx "@diffci.com/diffci@latest" verify-workflow`
77
+ The example pins release `v0.3.4` to its qualified feature commit SHA. `npx "@diffci.com/diffci@latest" verify-workflow`
76
78
  checks that the job is dedicated, read-only, not required by other jobs, and unable to alter the rest
77
79
  of CI.
78
80
 
package/docs/mcp.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # DiffCI MCP Servers
2
2
 
3
+ The open-source engine is [DiffCI/core](https://github.com/DiffCI/core). Star it to support the project; watch Releases and Discussions for support and benchmark updates. [Volunteer a pilot repository](https://diffci.com/#pilot).
4
+
3
5
  DiffCI provides a public Streamable HTTP endpoint for read-only validation guidance:
4
6
 
5
7
  ```text
@@ -98,3 +100,5 @@ Short description:
98
100
 
99
101
  > Fail-closed, change-aware verification for AI coding agents. DiffCI selects the minimum justified
100
102
  > test command, broadens to full verification on uncertainty, and returns a machine-readable receipt.
103
+
104
+ See [agent-plugin.md](agent-plugin.md) for Claude Code and Codex installation.
@@ -30,15 +30,15 @@ Use the GitHub Action when someone wants the normal non-blocking CI installation
30
30
  ```yaml
31
31
  jobs:
32
32
  diffci:
33
- runs-on: ubuntu-latest
33
+ runs-on: ubuntu-24.04
34
34
  continue-on-error: true
35
35
  permissions:
36
36
  contents: read
37
37
  steps:
38
- - uses: actions/checkout@v4
38
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # immutable checkout pin
39
39
  with:
40
40
  fetch-depth: 0
41
- - uses: DiffCI/DiffCI.com@edac0ad48ae4bbdcf7e7839cf0bb371201a46872
41
+ - uses: DiffCI/DiffCI.com@cc870c9258adf8a278d7fe678f0d793ff65cdae6
42
42
  ```
43
43
 
44
44
  ## Outreach Copy
@@ -1,9 +1,26 @@
1
1
  # DiffCI Core
2
2
 
3
- **An open-source engine for understanding changes and planning less CI work conservatively.** Licensed under AGPL-3.0-only.
3
+ **Open-source test-impact analysis for faster CI.** For developers and maintainers evaluating which tests a change affects, with conservative full-run fallbacks. Licensed under AGPL-3.0-only.
4
+
5
+ Try the published CLI in an existing Git checkout with Git and Node.js 22.5+:
6
+
7
+ ```sh
8
+ npx "@diffci.com/diffci@latest" check
9
+ ```
10
+
11
+ It compares full and selected runtime when safe to measure, writes reports outside the checkout, and sends nothing by default. Test commands can generate files; keep required CI authoritative.
12
+
13
+ **Measured example:** one controlled Cal.com sandbox replay measured **44.2% net reduction** in install + pretest + test runtime including analysis overhead. This is a job-equivalent comparison, not production savings or a forecast for your repository. [Method and limitations](https://diffci.com/case-studies/calcom).
14
+
15
+ ![Recorded Cal.com sandbox comparison](docs/calcom-runtime-evidence.svg)
16
+
17
+ [Star Core](https://github.com/DiffCI/core) · [Volunteer a pilot repository](https://diffci.com/#pilot) · [Find a first contribution](https://github.com/DiffCI/core/issues?q=is%3Aopen+label%3A%22good+first+issue%22).
18
+ Watch → Custom → Releases and Discussions for benchmark results and support updates. [Public roadmap](docs/roadmap.md).
4
19
 
5
20
  This is the standalone Core engine. It analyzes local JavaScript/TypeScript repositories, supported Vue components, root Go modules and conventional Maven reactors, traces dependency impact, infers GitHub Actions structure and proposes test selections with evidence and full-run fallbacks. It works without a DiffCI account, hosted service or API key. See [the release boundary](docs/release-boundary.md) for support limits.
6
21
 
22
+ **Want to try DiffCI in an existing repository?** Use the published CLI: `npx @diffci.com/diffci@latest check`. See [the CLI quickstart](docs/using-diffci.md) for a no-execution analysis option, prerequisites, and result interpretation. The commands below build the standalone engine from source.
23
+
7
24
  ## Run locally
8
25
 
9
26
  Requires Git and Node.js 22.5 or later.
@@ -19,6 +36,8 @@ node dist/cli.js plan --repo /path/to/clean-checkout --base HEAD~1 --head HEAD
19
36
 
20
37
  The target must be a clean Git repository root checked out at `--head`. Fetch the base commit beforehand if using a shallow clone. JSON goes to stdout; analysis errors exit nonzero and recommend full CI. Core does not execute repository scripts, contact a DiffCI backend or send telemetry. Installation requires the npm registry.
21
38
 
39
+ To evaluate the same command on pull requests without changing required jobs, copy the [advisory GitHub Actions example](examples/README.md).
40
+
22
41
  **Plans are advisory.** This release does not execute, skip or cancel CI jobs. `SKIP_CANDIDATE` is a candidate, not permission to bypass a check. Keep full CI authoritative while evaluating Core. Missing command synthesis, unsupported configuration and incomplete evidence must not be treated as an empty test suite. Static analysis is not proof that a test can safely be omitted.
23
42
 
24
43
  For Maven jobs whose CI runs a lifecycle goal or profiles other than `test`, declare them in `diffci.json` (or the `diffci` key in `package.json`):
@@ -31,6 +50,8 @@ This changes the proposed command, such as `mvn -pl tools -am verify -P run-its`
31
50
 
32
51
  ## What is included
33
52
 
53
+ Declared pnpm workspaces with a single Vitest test phase can receive package-local command plans. Each selected path must belong to a discovered test in a declared package. Runtime selections are batched to keep commands below Windows limits; packages declaring `--typecheck` retain a separate full type-test phase. Packages with compound scripts, lifecycle hooks, overlapping ownership or discovery blind spots refuse selective execution. Commands remain advisory and must be executed separately; CLI automatic timing of multiple commands requires additional integration.
54
+
34
55
  | Area | Implementation |
35
56
  | --- | --- |
36
57
  | Changes and dependencies | Git deltas, repository inventory, JS/TS dependency graph, impact traversal |
@@ -47,7 +68,23 @@ npm run audit:boundary
47
68
  npm run benchmark
48
69
  ```
49
70
 
50
- The benchmark constructs 100 modules and 100 tests locally, then measures three graph builds. It does not measure CI savings. Carbon and energy outputs are modeled estimates using caller-supplied assumptions, not physical measurements or verified avoided emissions.
71
+ The benchmark constructs one temporary synthetic repository containing 100 chained modules and 100 importing test files. In one Node.js process it builds that same dependency graph three times, sequentially, and removes the fixture afterward. Install dependencies first with `npm ci`, then run `npm run benchmark` under Node.js 22.5 or later. Record the emitted `node` and `platform` alongside the machine CPU, memory, operating system, and competing workload when comparing runs. The three builds share process, operating-system, and compiler warmup effects; they are not independent repetitions with controlled cold caches.
72
+
73
+ Each entry in `runs` has these fields:
74
+
75
+ | Field | Interpretation |
76
+ | --- | --- |
77
+ | `basis: "measured"` | The process counters were observed rather than estimated. |
78
+ | `scope: "current-process"` | Only the benchmark's Node.js process is covered, not the whole host, container, or CI job. |
79
+ | `wallSeconds` | Elapsed wall-clock time around one `buildDependencyGraph` call. |
80
+ | `cpuSeconds` | User plus system CPU time consumed by the current process during that call; it can differ from wall time. |
81
+ | `rssBytesAtEnd` | Resident-set size sampled after the call. It is neither peak memory nor the memory allocated by that call alone. |
82
+ | `nodes`, `edges` | Graph size. The current fixture should produce 200 nodes and 199 dependency edges. |
83
+ | `confidence` | Dependency-graph confidence for this synthetic fixture. `COMPLETE` does not prove that a real repository can safely skip tests. |
84
+
85
+ For example, `wallSeconds: 0.79`, `cpuSeconds: 0.84`, and `rssBytesAtEnd: 327868416` mean that one graph build elapsed for about 0.79 seconds, consumed about 0.84 current-process CPU seconds, and ended with roughly 328 MB RSS. They do **not** mean that CI became 0.79 seconds faster or saved 328 MB. The script does not execute tests, installation, builds, or a full-versus-selected comparison, so its timings must not be reported as CI savings.
86
+
87
+ The separate `estimateImpact` API can calculate `estimatedUsd`, `estimatedKwh`, and `estimatedKgCo2e` only from caller-supplied `computeSeconds`, price, power, and grid-intensity assumptions. Those values have `basis: "estimated"`; they are modeled scenarios, not benchmark output, physical measurements, billing records, or verified avoided emissions.
51
88
 
52
89
  ## Core and Cloud
53
90
 
@@ -64,3 +101,5 @@ Only the explicitly extracted Core files and standalone tooling are in this repo
64
101
  See [LICENSE](LICENSE), [NOTICE](NOTICE) and [CONTRIBUTING.md](CONTRIBUTING.md). AGPL permits commercial use; it is not a non-commercial license. Its obligations, including those applicable to modified versions used over a network, are defined by the license. Grant eligibility depends on the particular grant agreement. No eligibility or legal separation is guaranteed by this repository layout.
65
102
 
66
103
  See [the release boundary](docs/release-boundary.md) for scope and current limitations.
104
+
105
+ Useful? [Star the engine](https://github.com/DiffCI/core) and [share a reproducible pilot result](https://diffci.com/#pilot).
@@ -1,5 +1,5 @@
1
1
  import type { DependencyGraphResult } from "../repo/types.js";
2
- export declare const GRAPH_CACHE_SCHEMA_VERSION = "1";
2
+ export declare const GRAPH_CACHE_SCHEMA_VERSION = "2";
3
3
  export interface GraphCacheKeyInputs {
4
4
  commitSha: string;
5
5
  tsconfigHash?: string;
@@ -2,7 +2,7 @@
2
2
  import { createHash } from "node:crypto";
3
3
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
4
  import { resolve } from "node:path";
5
- export const GRAPH_CACHE_SCHEMA_VERSION = "1";
5
+ export const GRAPH_CACHE_SCHEMA_VERSION = "2";
6
6
  export function buildGraphCacheKey(inputs) {
7
7
  const payload = JSON.stringify({
8
8
  schema: GRAPH_CACHE_SCHEMA_VERSION,
@@ -61,6 +61,80 @@ export function planSelectiveTestCommands(profile, selectedPaths) {
61
61
  const blockers = profile.adapterBlockers ?? profile.adapters?.flatMap((adapter) => adapter.blockers) ?? [];
62
62
  if (blockers.length)
63
63
  return { commands: [], groups: [], unroutedPaths: [...selectedPaths], refusalReason: blockers.join("; ") };
64
+ if (profile.workspaceTestPackages?.length) {
65
+ const suites = profile.workspaceTestPackages;
66
+ const refuse = (reason) => ({ commands: [], groups: [], unroutedPaths: [...selectedPaths], refusalReason: reason });
67
+ if (!["pnpm", "npm"].includes(profile.packageManager) || suites.some(s => suites.some(other => other !== s && s.packageRoot.startsWith(`${other.packageRoot}/`))))
68
+ return refuse("Workspace routing requires non-overlapping declared npm or pnpm packages");
69
+ if (selectedPaths.some(path => !suites.some(s => path.startsWith(`${s.packageRoot}/`) && s.profile.testFilePaths.includes(path.slice(s.packageRoot.length + 1)))))
70
+ return refuse("A selected test has no verified workspace owner");
71
+ const groups = [];
72
+ for (const suite of suites) {
73
+ const child = suite.profile;
74
+ const script = child.packageJson.scripts.test?.trim();
75
+ if (!/^vitest(?: run)?(?: --typecheck)?$/.test(script ?? "") || child.packageJson.scripts.pretest || child.packageJson.scripts.posttest || child.testUniverse?.blindSpot || child.testUniverse?.declaredFrameworks.length !== 1 || child.testUniverse.declaredFrameworks[0] !== "vitest" || child.workspaceTestPackages?.length)
76
+ return refuse("Workspace test scripts require a single declared Vitest phase without lifecycle hooks or discovery blind spots");
77
+ const paths = selectedPaths.filter(path => path.startsWith(`${suite.packageRoot}/`)).map(path => path.slice(suite.packageRoot.length + 1));
78
+ const wrap = (args) => profile.packageManager === "npm"
79
+ ? { executable: "npm", args: ["exec", "--offline", `--workspace=${suite.packageRoot}`, "--", "vitest", ...args] }
80
+ : { executable: "pnpm", args: ["--dir", suite.packageRoot, "exec", "vitest", ...args] };
81
+ const projectConfigs = child.testRunnerConfigs?.filter(config => config.projects !== undefined) ?? [];
82
+ if (projectConfigs.length) {
83
+ if (projectConfigs.length !== 1 || child.testRunnerConfigs?.length !== 1 || !projectConfigs[0].projects)
84
+ return refuse("Vitest projects must be statically declared inline in one configuration");
85
+ const config = projectConfigs[0];
86
+ const projects = config.projects;
87
+ if (paths.some(path => !projects.some(project => project.includes.some(glob => matchesGlob(path, glob)))))
88
+ return refuse("Selected test has no declared Vitest project");
89
+ for (const project of projects) {
90
+ // Only conventional runtime-only globs are narrowed. Type/property or
91
+ // unfamiliar projects always retain their full original configuration.
92
+ const runtimeOnly = project.runtimeSelectionSafe && project.includes.every(glob => glob.endsWith(".test.ts"));
93
+ const selected = paths.filter(path => project.includes.some(glob => matchesGlob(path, glob)));
94
+ if (runtimeOnly && !selected.length)
95
+ continue;
96
+ const args = ["run", "--config", config.file, "--project", project.name, ...(runtimeOnly ? selected : [])];
97
+ if (args.join(" ").length > 3500)
98
+ return refuse("Vitest project selection exceeds the safe command length");
99
+ groups.push({ runnerId: `${suite.packageRoot}:project:${project.name}`, label: runtimeOnly ? "Selected runtime project" : "Full auxiliary project", paths: runtimeOnly ? selected.map(path => `${suite.packageRoot}/${path}`) : [], commandSpec: wrap(args) });
100
+ }
101
+ continue;
102
+ }
103
+ if (child.testRunnerConfigs?.some(config => config.runtimeSelectionUnsafe)) {
104
+ // Preserve state-sharing files together in the original package process.
105
+ // Only whole unaffected packages may be omitted, never files within it.
106
+ if (paths.length)
107
+ groups.push({ runnerId: `${suite.packageRoot}:full`, label: "Full non-isolated workspace suite", paths: child.testFilePaths.map(path => `${suite.packageRoot}/${path}`), commandSpec: wrap(["run", ...(script?.endsWith(" --typecheck") ? ["--typecheck"] : [])]) });
108
+ else if (script?.endsWith(" --typecheck"))
109
+ groups.push({ runnerId: `${suite.packageRoot}:types`, label: "Full workspace type tests", paths: [], commandSpec: wrap(["run", "--typecheck.only", "--passWithNoTests"]) });
110
+ continue;
111
+ }
112
+ const local = planSelectiveTestCommands({ ...child, packageManager: "pnpm" }, paths);
113
+ if (local.refusalReason)
114
+ return refuse(local.refusalReason);
115
+ for (const group of local.groups) {
116
+ const prefix = group.commandSpec.args.slice(0, group.commandSpec.args.length - group.paths.length);
117
+ const batches = [[]];
118
+ for (const path of group.paths) {
119
+ if (path.length > 3000)
120
+ return refuse("Workspace test path exceeds the safe command length");
121
+ const batch = batches[batches.length - 1];
122
+ if (batch.length && batch.join(" ").length + path.length > 3500)
123
+ batches.push([path]);
124
+ else
125
+ batch.push(path);
126
+ }
127
+ for (const [index, batch] of batches.entries())
128
+ groups.push({ ...group, runnerId: `${suite.packageRoot}:${group.runnerId}:${index}`, paths: batch.map(path => `${suite.packageRoot}/${path}`), commandSpec: wrap([...prefix.slice(2), ...batch]) });
129
+ }
130
+ // Type-test files are not runtime selection candidates. Retain the entire type suite.
131
+ if (script?.endsWith(" --typecheck"))
132
+ groups.push({ runnerId: `${suite.packageRoot}:types`, label: "Full workspace type tests", paths: [], commandSpec: wrap(["run", "--typecheck.only", "--passWithNoTests"]) });
133
+ }
134
+ if (!groups.some(group => group.paths.length))
135
+ return refuse("No workspace runtime suite can be safely narrowed; full validation is required");
136
+ return { commands: groups.map(g => g.commandSpec), groups, unroutedPaths: [] };
137
+ }
64
138
  if (profile.vueScope) {
65
139
  const scope = profile.vueScope;
66
140
  const known = new Set(profile.testFilePaths);
@@ -118,6 +192,8 @@ export function planSelectiveTestCommands(profile, selectedPaths) {
118
192
  return { commands: [], groups: [], unroutedPaths: [] };
119
193
  const frameworks = profile.testUniverse?.declaredFrameworks ?? [];
120
194
  const configs = profile.testRunnerConfigs ?? [];
195
+ if (configs.some(config => config.runtimeSelectionUnsafe))
196
+ return { commands: [], groups: [], unroutedPaths: paths, refusalReason: "Non-isolated or ambiguous Vitest isolation requires full validation" };
121
197
  if (frameworks.length === 0 && configs.length === 0) {
122
198
  return {
123
199
  commands: [],