@diffci.com/diffci 0.3.10 → 0.3.12

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 (53) hide show
  1. package/LICENSE +7 -5
  2. package/README.md +18 -422
  3. package/dist-client/src/client/cli.js +1 -49
  4. package/dist-client/src/client/mcp.js +2 -1
  5. package/dist-client/src/client/package-identity.js +69 -0
  6. package/dist-client/src/client/workflow-guard.js +1 -1
  7. package/node_modules/@diffci.com/core/README.md +33 -0
  8. package/package.json +17 -131
  9. package/.agents/plugins/marketplace.json +0 -12
  10. package/.claude-plugin/marketplace.json +0 -17
  11. package/COMMERCIAL.md +0 -35
  12. package/SECURITY.md +0 -61
  13. package/SUPPORT.md +0 -47
  14. package/action.yml +0 -155
  15. package/docs/adoption-metrics.md +0 -161
  16. package/docs/adoption-outreach.md +0 -156
  17. package/docs/agent-adoption-kit.md +0 -97
  18. package/docs/agent-adoption-targets.md +0 -62
  19. package/docs/agent-plugin.md +0 -145
  20. package/docs/ai-agents.md +0 -123
  21. package/docs/claude-code.md +0 -18
  22. package/docs/codex.md +0 -18
  23. package/docs/copilot.md +0 -18
  24. package/docs/cursor.md +0 -19
  25. package/docs/distribution.md +0 -153
  26. package/docs/grok.md +0 -18
  27. package/docs/language-support.md +0 -118
  28. package/docs/mcp.md +0 -116
  29. package/docs/npm-adoption.md +0 -165
  30. package/glama.json +0 -12
  31. package/llms.txt +0 -41
  32. package/packaging/agent-plugin/.claude-plugin/plugin.json +0 -26
  33. package/packaging/agent-plugin/.codex-plugin/plugin.json +0 -47
  34. package/packaging/agent-plugin/.mcp.json +0 -13
  35. package/packaging/agent-plugin/README.md +0 -36
  36. package/packaging/agent-plugin/assets/diffci-mark.svg +0 -14
  37. package/packaging/agent-plugin/mcp.json +0 -15
  38. package/packaging/agent-plugin/plugin.json +0 -51
  39. package/packaging/agent-plugin/skills/diffci-verify/SKILL.md +0 -35
  40. package/packaging/public-plugin/README.md +0 -12
  41. package/packaging/public-plugin/SUBMISSION.md +0 -21
  42. package/packaging/public-plugin/assets/icon-dark.png +0 -0
  43. package/packaging/public-plugin/assets/icon.png +0 -0
  44. package/packaging/public-plugin/assets/logo-dark.png +0 -0
  45. package/packaging/public-plugin/assets/logo.png +0 -0
  46. package/packaging/public-plugin/mcp.json +0 -16
  47. package/packaging/public-plugin/plugin.json +0 -114
  48. package/packaging/public-plugin/review/refusal-observation.json +0 -41
  49. package/packaging/public-plugin/skills/diffci-remote/SKILL.md +0 -19
  50. package/packaging/public-plugin/skills/get-started/SKILL.md +0 -26
  51. package/server.json +0 -43
  52. package/site/assets/calcom-runtime-evidence.svg +0 -11
  53. package/site/llms.txt +0 -44
package/LICENSE CHANGED
@@ -1,10 +1,12 @@
1
- DiffCI repository licensing notice
1
+ DiffCI CLI licensing notice
2
2
 
3
- DiffCI has two separate licensing boundaries.
3
+ This package and its bundled DiffCI Core dependency are licensed under the GNU
4
+ Affero General Public License version 3.0 only (AGPL-3.0-only). Their public
5
+ source and release boundary are documented at
6
+ https://github.com/DiffCI/core/blob/main/docs/release-boundary.md.
4
7
 
5
- 1. DiffCI Core, the installable open-source package published as `@diffci.com/diffci`, is licensed under the GNU Affero General Public License version 3.0 only (AGPL-3.0-only). The OSS package boundary is defined in `docs/oss-boundary.md` and enforced by `npm run check:oss-boundary`.
6
-
7
- 2. Commercial DiffCI, including hosted-service, product, billing, runner, research, operations, site, deployment, and control-plane source outside the OSS package boundary, is proprietary software. Those files are not open source and are not licensed under the AGPL unless they are deliberately moved into the OSS package boundary in a later change.
8
+ Hosted DiffCI services, operational systems, and other product components are
9
+ not included in this package or this public source repository.
8
10
 
9
11
  The AGPL-3.0 license text for DiffCI Core follows.
10
12
  GNU AFFERO GENERAL PUBLIC LICENSE
package/README.md CHANGED
@@ -1,430 +1,26 @@
1
- # DiffCI
1
+ # DiffCI CLI
2
2
 
3
- **Open-source test-impact analysis for faster CI.** DiffCI finds tests affected by a code change and measures full versus selected runtime for teams evaluating CI savings.
3
+ `@diffci.com/diffci` provides change-aware CI observation and verification for
4
+ coding agents. It analyzes a local Git checkout, conservatively selects affected
5
+ tests when evidence is complete, and falls back to a full run when it is not.
4
6
 
5
- ```bash
6
- npx "@diffci.com/diffci@latest" check
7
+ ```sh
8
+ npx --yes @diffci.com/diffci@latest observe --no-send
7
9
  ```
8
10
 
9
- Requires Git and Node.js 22.5+. Runs tests locally and sends nothing by default; keep required CI authoritative.
11
+ The command writes reports locally and sends nothing unless an explicit
12
+ destination is configured. Keep required project CI authoritative.
10
13
 
11
- **Measured example:** a controlled Cal.com sandbox replay measured **44.2% net reduction** in an install + pretest + test workload, including analysis overhead. This is one job-equivalent comparison, not production savings or a forecast.
12
- [Timings and limitations](docs/research/2026-08-24-calcom-execution-observability/11-frozen-identity-and-complete-job-savings.md).
14
+ ## MCP for coding agents
13
15
 
14
- ![Recorded Cal.com sandbox runtime comparison](site/assets/calcom-runtime-evidence.svg)
16
+ The `diffci-mcp` binary exposes the same local analysis through MCP. Install
17
+ the public Codex, Claude Code, Cursor, Grok, or Meta Muse Code integration from
18
+ the [cross-agent installation guide](https://github.com/DiffCI/core/blob/main/docs/agent-installation.md).
15
19
 
16
- [Star the open-source engine](https://github.com/DiffCI/core) · [Volunteer a pilot repository](https://diffci.com/#pilot).
17
- Watch → Custom → Releases and Discussions on Core to follow support and benchmark updates.
20
+ ## Source and license
18
21
 
19
- The engine lives in **[DiffCI/core](https://github.com/DiffCI/core)**. This repository contains the CLI, integrations, website, and product surfaces.
20
-
21
- [Website](https://diffci.com/) · [Test impact analysis guide](https://diffci.com/test-impact-analysis/github-actions) · [Open evidence study](https://diffci.com/research/diffci-open-evidence-2026)
22
-
23
-
24
- [![npm version](https://img.shields.io/npm/v/@diffci.com/diffci.svg)](https://www.npmjs.com/package/@diffci.com/diffci)
25
- [![npm provenance](https://img.shields.io/badge/npm-provenance-blue)](https://docs.npmjs.com/generating-provenance-statements)
26
- [![MCP server](https://img.shields.io/badge/MCP-server-5f6fff)](https://diffci.com/mcp-server)
27
- [![Agent verification](https://img.shields.io/badge/agent--verification-fail--closed-0f766e)](docs/ai-agents.md)
28
- [![GitHub Marketplace](https://img.shields.io/badge/GitHub-Marketplace-blue)](https://github.com/marketplace/actions/diffci-observer)
29
-
30
- **The verification layer between AI-generated code and shipping.** DiffCI snapshots an agent's staged,
31
- unstaged, and non-ignored untracked changes, determines the minimum executable test verification, and
32
- runs it. Uncertainty broadens to full verification; a failed, incomplete, or changed snapshot blocks.
33
- The `check` command remains the paired-runtime evaluation surface. `observe` and the Marketplace Action
34
- remain observation-only; DiffCI also generates a separate blocking verification workflow.
35
-
36
- ## Try DiffCI
37
-
38
- From a Git repository checkout, with Node.js 22.5+ and Git installed, run:
39
-
40
- ```bash
41
- npx "@diffci.com/diffci@latest" verify --changed --json
42
- ```
43
-
44
- `verify --changed` covers staged, unstaged, and non-ignored untracked content. It runs the selected
45
- command when DiffCI can prove one, otherwise the inferred full test command. Exit zero means that exact
46
- content-addressed snapshot passed and remained unchanged while tests ran. The JSON receipt includes
47
- `verification`, `safe_to_continue`, selection counts, the command result, and tree identities.
48
-
49
- For paired full-versus-selected runtime measurement, use `check`. For analysis without test execution,
50
- use `npx "@diffci.com/diffci@latest" observe --no-send`.
51
-
52
- To prepare a maintainer-reviewable pilot without changing the target repository or running its tests:
53
-
54
- ```bash
55
- npx "@diffci.com/diffci@latest" pilot-packet --repo /path/to/checkout \
56
- --label owner/repository --repository-url https://github.com/owner/repository
57
- ```
58
-
59
- The command writes `pilot-packet.md`, the raw observation, and a pinned non-blocking GitHub Actions
60
- workflow to `../diffci-output` by default. The packet describes compatibility and planned selection;
61
- it does not present planned reduction as measured runtime savings.
62
-
63
- To add instructions for coding agents, run:
64
-
65
- ```bash
66
- npx "@diffci.com/diffci@latest" init
67
- ```
68
-
69
- To also pin DiffCI as a development dependency and update the detected npm, pnpm, Yarn, or Bun
70
- lockfile, pass `--install`. Add `--workflow` for a non-blocking observation job and
71
- `--verification-workflow` for a blocking commit-range gate:
72
-
73
- ```bash
74
- npx "@diffci.com/diffci@latest" init --install --workflow --verification-workflow
75
- ```
76
-
77
- `--install` also adds `diffci:verify`, `diffci:check`, and `diffci:observe` package scripts. It preserves same-named
78
- scripts that the project already owns. After installation, CI or contributors can run
79
- `npm run diffci:verify`, `npm run diffci:check`, or `npm run diffci:observe` without knowing the package name or version.
80
- Generated agent rules use the detected package manager's local script when DiffCI is installed.
81
-
82
- In CI, `diffci verify --json` resolves the pull-request or push range automatically. It requires a
83
- clean checkout, refuses when the analyzed head differs from executed `HEAD`, and binds the receipt to
84
- both the resolved range and checkout tree. Use `--base` and `--head` for an explicit range.
85
-
86
- On Windows PowerShell, quote the package name:
87
-
88
- ```powershell
89
- npx "@diffci.com/diffci@latest" verify --changed --json
90
- ```
91
-
92
- The [copyable adoption kit](docs/agent-adoption-kit.md) includes an `AGENTS.md` instruction and
93
- maintainer PR text. AI-readable documentation is on [Context7 CLI](https://context7.com/diffci/diffci.com)
94
- and [Context7 Core](https://context7.com/diffci/core). Use the [GitHub Marketplace Action](https://github.com/marketplace/actions/diffci-observer)
95
- for a separate, non-blocking observation job. Required project CI remains authoritative.
96
-
97
- One paired run is preliminary evidence. `verify-savings` can repeat comparisons, alternate arm order,
98
- record declared cache state, and run an explicit cache-preparation command before every arm. A result is
99
- labelled controlled only after at least three alternating, cache-prepared repetitions. On a
100
- full-validation fallback, `check` runs the full command once and reports 0% reduction.
101
-
102
- **Upgrade from 0.1.3:** tests excluded by a source-only `tsconfig.json` could be discovered without
103
- their dependency edges, producing an incomplete selection. This is fixed in **0.1.4**. Revalidate
104
- affected observations before using them as opportunity evidence; see the
105
- [historical validation](docs/evidence/growth-history-01/README.md) and
106
- [release qualification](docs/evidence/release-0.1.4/README.md).
107
-
108
- The local default compares `HEAD` with its first parent; both commits must be available. For a specific
109
- comparison, add `--base <base-sha> --head <head-sha>`. DiffCI prints the selection, fallback reasons,
110
- and the path to a JSON report outside your checkout. `REFUSED` or `ERROR` is not a successful analysis;
111
- check the reported status even when the command exits successfully. See the
112
- [support matrix](docs/language-support.md) for setup requirements and supported workloads.
113
- `check` runs inferred full and selected commands in the checkout and sends nothing by default.
114
- The commands may write generated files. Use `observe --no-send` for analysis without execution.
115
- See [`docs/ai-agents.md`](docs/ai-agents.md) for Claude Code, Codex,
116
- Cursor, GitHub Copilot, and similar tools.
117
-
118
- **Measured example:** a controlled Cal.com replay showed **44.2% net reduction in a job-equivalent
119
- install + pretest + test workload**, including analysis overhead. This is one sandbox comparison,
120
- not Cal.com's production savings or a prediction for your repository.
121
- [Read the timings and method](docs/research/2026-08-24-calcom-execution-observability/11-frozen-identity-and-complete-job-savings.md).
122
-
123
- Selection counts alone do not establish runtime savings. `check` reports a measured percentage only
124
- when both commands pass and the checked-out commit and worktree remain identical across both arms.
125
- The savings artifact embeds the base/head SHAs, observation SHA-256, commands, timings, and checkout
126
- snapshots. Snapshots use byte-level fingerprints for dirty files, manifests, lockfiles, and available
127
- resolved-dependency markers; the report also records the runner identity. A mismatch invalidates the
128
- comparison. `observe` does not execute tests.
129
-
130
- For an advanced paired runtime check, you can still run `observe` first and then run `verify-savings`
131
- against the observation report. It compares your normal full command with
132
- DiffCI's proposed selected command and writes JSON plus Markdown evidence; see
133
- [`docs/npm-adoption.md`](docs/npm-adoption.md#self-serve-runtime-pilot).
134
-
135
- For stronger evidence, run repeated measurements with an explicit cache preparation command:
136
-
137
- ```bash
138
- npx "@diffci.com/diffci@latest" verify-savings \
139
- --repo . --full "npm test" --selected-from-report ../diffci-observation.json \
140
- --out ../diffci-savings.json --repetitions 3 --cache-state warm \
141
- --cache-prepare "node scripts/prepare-ci-cache.mjs"
142
- ```
143
-
144
- DiffCI alternates full/selected order, reports min/median/max timings, and conservatively classifies
145
- stable selection misses, likely flakes, shared/pre-existing failures, infrastructure failures, and
146
- inconclusive results. Cache preparation is user-supplied because DiffCI must not delete repository or
147
- tool caches on its own.
148
-
149
- ## Validate same-turn change specifications
150
-
151
- When an agent or build tool supplies explicit specification IDs and logical targets, DiffCI can block
152
- two specifications from silently changing the same target:
153
-
154
- ```json
155
- {
156
- "specifications": [
157
- { "id": "SPEC-API", "logicalTarget": "com.example.Widget#run" },
158
- { "id": "SPEC-BEHAVIOR", "logicalTarget": "com.example.Widget#run" }
159
- ]
160
- }
161
- ```
162
-
163
- ```bash
164
- npx "@diffci.com/diffci@latest" validate-specs --file change-specifications.json
165
- ```
166
-
167
- The command exits non-zero and names every conflicting specification ID. This surface is opt-in and
168
- does not infer semantic targets from source code; callers must provide stable logical target names.
169
-
170
- ## Block in GitHub Actions
171
-
172
- Generate a dedicated verification check with:
173
-
174
- ```bash
175
- npx "@diffci.com/diffci@latest" init --verification-workflow
176
- ```
177
-
178
- The generated `.github/workflows/diffci-verify.yml` checks out the exact pull-request head with full
179
- history, runs `diffci verify --json`, and uploads the commit-bound receipt even when verification
180
- fails. It has no `continue-on-error`: configure its **DiffCI verification** job as a required check
181
- after a successful pilot. A zero exit means the selected verification (or conservative full fallback)
182
- passed for the exact analyzed commit and checkout tree.
183
-
184
- ## Observe in GitHub Actions
185
-
186
- Save this as `.github/workflows/diffci.yml` to add a dedicated, non-blocking observation job:
187
-
188
- ```yaml
189
- name: DiffCI observation
190
- on: [push, pull_request]
191
- permissions:
192
- contents: read
193
- jobs:
194
- diffci:
195
- runs-on: ubuntu-24.04
196
- continue-on-error: true
197
- steps:
198
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # immutable checkout pin
199
- with:
200
- fetch-depth: 0
201
- - uses: DiffCI/DiffCI.com@b35f55c1b6ba9c092f3ad623efd8baa0422c450a
202
- ```
203
-
204
- Then check the workflow locally with `npx "@diffci.com/diffci@latest" verify-workflow`. Keep the observer
205
- out of required checks and other jobs' `needs` lists. The Action adds a job summary and a
206
- `diffci-observation` artifact to the run; it does not alter which tests your other jobs execute.
207
- The example pins release `v0.3.10` to its qualified feature commit SHA for reproducibility.
208
-
209
- The CLI sends no report with `--no-send`. The Action uploads a GitHub artifact by default; sending to
210
- DiffCI's hosted service requires an explicitly configured endpoint and token.
211
- [Installation details](docs/distribution.md) · [Seven-day pilot](docs/shadow-pilot-runbook.md)
212
-
213
- ## Use DiffCI
214
-
215
- | Surface | Use it for | Current distribution |
216
- | --- | --- | --- |
217
- | [`@diffci.com/diffci`](https://www.npmjs.com/package/@diffci.com/diffci) | Try `observe` locally, run an opt-in runtime pilot, or install the GitHub Action from this repository | Published npm CLI and Action |
218
-
219
- The CLI bundles a pinned revision of the [Core engine](https://github.com/DiffCI/core) from GitHub. Users install only
220
- `@diffci.com/diffci`; the `check` command above uses it directly. Core performs Git analysis,
221
- dependency graphs, impact, path baseline, and selected-command planning. The report format and
222
- non-interfering GitHub Action remain in this repository. See
223
- [`docs/package-relationship.md`](docs/package-relationship.md) for the source relationship.
224
- For evaluation results and their limits, start with
225
- [`docs/adoption-evidence.md`](docs/adoption-evidence.md).
226
-
227
- ## Agent Adoption
228
-
229
- Add DiffCI instructions to a repository:
230
-
231
- ```bash
232
- npx "@diffci.com/diffci@latest" init
233
- ```
234
-
235
- Then ask your coding agent to run:
236
-
237
- ```bash
238
- npx "@diffci.com/diffci@latest" verify --changed --json
239
- ```
240
-
241
- Agent-specific docs:
242
- [`Codex`](docs/codex.md) ·
243
- [`Claude Code`](docs/claude-code.md) ·
244
- [`Cursor`](docs/cursor.md) ·
245
- [`GitHub Copilot`](docs/copilot.md) ·
246
- [`Grok`](docs/grok.md).
247
-
248
- For installable Codex and Claude Code plugins, see the
249
- [DiffCI agent-plugin guide](docs/agent-plugin.md). Other MCP-compatible
250
- clients can use the local or hosted configurations in [the MCP guide](docs/mcp.md).
251
-
252
- Live discovery files:
253
- [`llms.txt`](https://diffci.com/llms.txt) ·
254
- [`AI agents`](https://diffci.com/docs/ai-agents).
255
-
256
- Adoption materials:
257
- [`outreach copy`](docs/adoption-outreach.md) ·
258
- [`metrics`](docs/adoption-metrics.md) ·
259
- [`targets`](docs/agent-adoption-targets.md).
260
-
261
- For native agent integrations, DiffCI provides a stateless, read-only HTTPS MCP endpoint for validation
262
- guidance:
263
-
264
- ```text
265
- https://diffci.com/mcp
266
- ```
267
-
268
- Use the stdio MCP server when tools need to inspect the local checkout or run tests:
269
-
270
- ```bash
271
- npx -p "@diffci.com/diffci@latest" diffci-mcp
272
- ```
273
-
274
- See the [MCP server page](https://diffci.com/mcp-server) for Codex, Claude Code, Cursor, and VS Code setup, or [`docs/mcp.md`](docs/mcp.md) for repository documentation.
275
-
276
- ## Project background
277
-
278
- ## Public Core and private Cloud
279
-
280
- DiffCI's public-good analysis engine is released separately from its commercial hosted product.
281
- The project lives in the [DiffCI GitHub organization](https://github.com/DiffCI).
282
- This repository was transferred to `DiffCI/DiffCI.com` on 2026-09-16.
283
-
284
- | Component | Scope | Licensing |
285
- | --- | --- | --- |
286
- | [DiffCI Core](https://github.com/DiffCI/core) | Standalone dependency/change analysis, CI graph inference, safety/fallback, advisory test selection, synthetic benchmarking and local compute measurement | AGPL-3.0-only; public |
287
- | DiffCI Cloud | Hosted infrastructure, billing, enterprise dashboard, organization management, proprietary data/services, and managed acceleration | Proprietary |
288
- | Optional enterprise code | Separately scoped, visible and auditable enterprise capabilities | Source available, with commercial production rights controlled by DiffCI |
289
-
290
- **This mixed repository is public.** The reviewed Core extraction was published separately, with
291
- fresh Git history. This repository retains its existing engine snapshot while package integration is
292
- migrated separately. No blanket AGPL license applies to this repository. Public Core is advisory-only;
293
- energy/carbon/cost are modeled estimates, not verified environmental savings. The exact extraction is
294
- recorded in [the Core release audit](docs/core-release-audit.md).
295
-
296
- The funded Core should run independently of DiffCI Cloud. AGPL permits commercial use and competing
297
- hosting; it adds source-sharing obligations for covered modifications, including qualifying remote
298
- network use. Grant eligibility depends on each grant's agreement and funded deliverables.
299
-
300
- See the [licensing boundaries](docs/licensing.md), [organization and migration plan](docs/github-organization.md),
301
- and [prepared organization profile](docs/github-org/profile/README.md).
302
-
303
-
304
-
305
- **This repository moved out of the [DentalPresence.in](https://github.com/adityankale190895/DentalPresence.in)
306
- monorepo** (previously `diffci/` there) into its own repo on 2026-08-21, once the project outgrew being a
307
- subfolder. DentalPresence.in remains DiffCI's original dogfooding target - some code (the `planner`
308
- DentalPresence-specific PATH baseline/task registry, a few fixture tests) still reflects that origin - but
309
- the research and shadow-validation pipelines are generic and have been exercised against dozens of
310
- real third-party repositories.
311
-
312
- ## Current state
313
-
314
- Language expansion: initial Vue SFC, Go package-level, and conventional Maven reactor analysis is implemented through repository
315
- adapters. See [the support matrix and setup requirements](docs/language-support.md) for exact scope,
316
- fallback behavior, and validation boundaries.
317
-
318
- Three completed research stages plus an in-progress prospective-validation stage, in order:
319
-
320
- - **Stage 0** - a 2,000-delta historical benchmark across 20 real repositories, run through a real
321
- Cloudflare orchestrator. Verdict: **GO WITH CONDITIONS**.
322
- - **Stage 1A** - forensic root-cause investigation of every repository/delta where Stage 0's confidence
323
- model degraded to UNSAFE, and of every historical "unsafe miss" candidate. Identified the top 3
324
- highest-leverage fixes.
325
- - **Stage 1B** - implemented those 3 fixes (reachability-aware confidence narrowing, an improved
326
- historical safety-measurement methodology, a tsconfig-scope + package.json-diffing fix), validated them
327
- live against real repositories (coverage improved, zero contradicted safety cases), and ran a real
328
- wall-clock FULL/PATH/DiffCI runtime pilot.
329
- - **Stage 2** (current) - prospective shadow validation on real, currently-arriving CI events, not more
330
- historical benchmarking. A live pipeline (Cloudflare Sandbox Containers + Worker, D1 + R2) observes real
331
- repositories, predicts *before* their outcome is known, and later reconciles against the real CI result.
332
- Current verdict: **EXTEND SHADOW VALIDATION** - the pipeline is real and defect-free, and since
333
- 2026-08-21 it runs **autonomously**: a Cron Trigger polls enrolled repositories every 10 minutes
334
- (`src/research/cloudflare/shadow-cron.ts`), and the registered **DiffCI Shadow GitHub App**
335
- (read-only; see [`docs/github-app-registration.md`](docs/github-app-registration.md)) delivers
336
- push/workflow events to `/v1/shadow/webhook` for instant predictions and exactly-on-time
337
- reconciliation - this repository shadow-observes itself through that App. See
338
- [`docs/research/2026-08-21-stage2-final-report.md`](docs/research/2026-08-21-stage2-final-report.md)
339
- for the full picture; what's honestly still missing is real observation volume, working GitHub
340
- Actions on our own repositories (account billing), and real design-partner repositories.
341
-
342
- Every dated report behind these stages lives in [`docs/research/`](docs/research/) - start with
343
- `2026-08-21-stage2-architecture.md` for the fullest current picture of what's built vs not, or the
344
- Stage 0/1A/1B reports for the historical-validation story.
345
-
346
- For the next product milestone, see [`docs/alpha-readiness.md`](docs/alpha-readiness.md). It tracks the
347
- private-alpha bar: install DiffCI, keep CI unchanged, collect real shadow observations, and render a
348
- trustworthy potential-savings report.
349
-
350
- ## Architecture
351
-
352
- DiffCI is now framed as an open-core product:
353
-
354
- ```text
355
- DiffCI
356
- |
357
- ├── Open-source core
358
- | ├── DiffCI engine
359
- | ├── CLI / npm package
360
- | ├── Local analysis
361
- | └── Basic GitHub Action
362
- | |
363
- | └── Tidelift package support
364
- |
365
- └── Commercial DiffCI
366
- ├── Hosted service / DiffCI Cloud
367
- ├── Organization dashboard
368
- ├── Historical analytics
369
- ├── Advanced CI/CD optimization
370
- ├── Enterprise policies
371
- ├── Managed runners
372
- ├── Team features
373
- └── Support / enterprise services
374
- ```
375
-
376
- The open-source core is the trust and adoption surface. It runs locally or in the host repository's own
377
- CI, writes a report, and changes nothing about CI execution. Commercial DiffCI adds hosted history,
378
- organization views, policy, managed operations, runners, and support. Tidelift belongs to the supported
379
- open-source package path, not the hosted product feature boundary. See
380
- [`docs/open-core-packaging.md`](docs/open-core-packaging.md) and
381
- [`docs/tidelift-package-support.md`](docs/tidelift-package-support.md).
382
-
383
- The source tree follows that split:
384
-
385
- - `src/git/`, `src/repo/`, `src/planner/`, and `src/client/` are the installable OSS observer path.
386
- - `action.yml` wraps the observer as a basic non-blocking GitHub Action.
387
- - `src/research/` and `src/shadow/` run validation, GitHub App shadow observation, and reconciliation.
388
- - `src/product/`, `src/auth/`, `src/billing/`, `src/ingest/`, `src/ledger/`, `src/runner/`, and
389
- `src/usage/` are the commercial/control-plane layer.
390
- - `docs/oss-boundary.md` records what is allowed into the npm package.
391
-
392
- ## Commands
393
-
394
- ```bash
395
- # Type-check and run the full test suite
396
- npm run check
397
-
398
- # Generate an example delta / impact / plan for the current repo's latest commit
399
- npm run diffci
400
- npm run impact
401
-
402
- # Run a real Stage 0-style historical benchmark locally
403
- npm run research:stage0
404
-
405
- # Deploy the Cloudflare research/shadow Worker (D1 + R2 + Sandbox Containers)
406
- npm run research:sandbox:deploy
407
- ```
408
-
409
- ## Install Surfaces
410
-
411
- DiffCI is intended to be installable as infrastructure, not only as a hosted shadow experiment:
412
-
413
- ```yaml
414
- - uses: DiffCI/DiffCI.com@b35f55c1b6ba9c092f3ad623efd8baa0422c450a
415
- ```
416
-
417
- ```bash
418
- npx "@diffci.com/diffci@latest" observe
419
- npx "@diffci.com/diffci@latest" check
420
- npx "@diffci.com/diffci@latest" init
421
- npx "@diffci.com/diffci@latest" verify-workflow
422
- ```
423
-
424
- The GitHub Action and npm CLI establish the OSS/package distribution path. The hosted GitHub App and
425
- DiffCI Cloud build on that trust boundary for teams that want shared reports and history. See
426
- [`docs/distribution.md`](docs/distribution.md) for the package and Action positioning,
427
- [`docs/open-core-packaging.md`](docs/open-core-packaging.md) for the commercial split, and
428
- [`docs/npm-adoption.md`](docs/npm-adoption.md) for copy-paste pilot material.
429
-
430
- Useful? [Star DiffCI/core](https://github.com/DiffCI/core), watch Releases and Discussions, or [volunteer a pilot repository](https://diffci.com/#pilot).
22
+ This package is AGPL-3.0-only. Its current source lives in
23
+ [`DiffCI/core`](https://github.com/DiffCI/core/tree/main/packages/diffci-cli).
24
+ The corresponding source for the previously published `0.3.10` package is
25
+ preserved at [tagged Core commit `4c76be14`](https://github.com/DiffCI/core/tree/4c76be14cec37d94eb7df93922f3c29d202f4e65/packages/diffci-cli)
26
+ (`cli-v0.3.10-source`).
@@ -41,6 +41,7 @@ import { formatVerificationSummary, verificationExitCode, verifyChanged, verifyR
41
41
  import { formatGrowthPrompt, formatVerifySavingsSummary, measureCommand, runVerifySavings, writeVerifySavingsReport } from "./verify-savings.js";
42
42
  import { auditWorkflows, isNonInterfering } from "./workflow-guard.js";
43
43
  import { buildPilotWorkflow, renderPilotPacket } from "./pilot-packet.js";
44
+ import { observerIdentity } from "./package-identity.js";
44
45
  function parseArgs(argv) {
45
46
  const args = argv.slice(2);
46
47
  const flags = {};
@@ -63,55 +64,6 @@ function parseArgs(argv) {
63
64
  }
64
65
  return { command, flags };
65
66
  }
66
- /**
67
- * The observer's own version and commit. Found by walking up from this file rather than by a fixed
68
- * relative path, because this module runs both from source (tsx, depth src/client) and from compiled
69
- * output (node, depth dist-client/src/client) and a hardcoded `../..` is right in exactly one of them.
70
- */
71
- function observerIdentity() {
72
- let current = dirname(import.meta.filename);
73
- for (let depth = 0; depth < 8; depth++) {
74
- const candidate = join(current, "package.json");
75
- if (existsSync(candidate)) {
76
- try {
77
- const parsed = JSON.parse(readFileSync(candidate, "utf8"));
78
- if (parsed.name === "@diffci/observer")
79
- return { version: parsed.version ?? "0.0.0", root: current };
80
- if (parsed.name === "@diffci.com/diffci" || parsed.name === "diffci") {
81
- let sha;
82
- try {
83
- const gitRoot = execFileSync("git", ["rev-parse", "--show-toplevel"], {
84
- cwd: current,
85
- encoding: "utf8",
86
- stdio: ["ignore", "pipe", "ignore"],
87
- }).trim();
88
- const packageRoot = resolve(current);
89
- const normalizedGitRoot = resolve(gitRoot);
90
- const rootsMatch = process.platform === "win32"
91
- ? packageRoot.toLowerCase() === normalizedGitRoot.toLowerCase()
92
- : packageRoot === normalizedGitRoot;
93
- if (rootsMatch) {
94
- sha = execFileSync("git", ["rev-parse", "HEAD"], { cwd: current, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
95
- }
96
- }
97
- catch {
98
- // Installed from a tarball rather than a checkout: there is no commit to report, and
99
- // inventing one would be worse than the field being absent.
100
- }
101
- return { version: parsed.version ?? "0.0.0", root: current, sha };
102
- }
103
- }
104
- catch {
105
- // Keep walking - an unreadable package.json above us says nothing about ours.
106
- }
107
- }
108
- const parent = dirname(current);
109
- if (parent === current)
110
- break;
111
- current = parent;
112
- }
113
- return { version: "0.0.0" };
114
- }
115
67
  function defaultReportPath(env) {
116
68
  // RUNNER_TEMP is outside GITHUB_WORKSPACE on every GitHub-hosted runner, which is the property that
117
69
  // matters: the report cannot become an untracked file in the repository being observed.
@@ -3,7 +3,8 @@ import { execFile } from "node:child_process";
3
3
  import { dirname, join, resolve } from "node:path";
4
4
  import { StringDecoder } from "node:string_decoder";
5
5
  import { agentChangedFiles, agentSelection } from "./agent-selection.js";
6
- const SERVER_INFO = { name: "diffci-mcp", version: "0.1.0" };
6
+ import { requireDiffciPackageIdentity } from "./package-identity.js";
7
+ const SERVER_INFO = { name: "diffci-mcp", version: requireDiffciPackageIdentity().version };
7
8
  const tools = [
8
9
  ...["diffci_changed_files", "diffci_select_tests", "diffci_explain_selection", "diffci_run_affected_tests"].map((name) => ({
9
10
  name,
@@ -0,0 +1,69 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { existsSync, readFileSync } from "node:fs";
3
+ import { dirname, join, resolve } from "node:path";
4
+ function checkoutSha(packageRoot) {
5
+ try {
6
+ const gitRoot = execFileSync("git", ["rev-parse", "--show-toplevel"], {
7
+ cwd: packageRoot,
8
+ encoding: "utf8",
9
+ stdio: ["ignore", "pipe", "ignore"],
10
+ }).trim();
11
+ const normalizedPackageRoot = resolve(packageRoot);
12
+ const normalizedGitRoot = resolve(gitRoot);
13
+ const rootsMatch = process.platform === "win32"
14
+ ? normalizedPackageRoot.toLowerCase() === normalizedGitRoot.toLowerCase()
15
+ : normalizedPackageRoot === normalizedGitRoot;
16
+ if (!rootsMatch)
17
+ return undefined;
18
+ return execFileSync("git", ["rev-parse", "HEAD"], {
19
+ cwd: packageRoot,
20
+ encoding: "utf8",
21
+ stdio: ["ignore", "pipe", "ignore"],
22
+ }).trim();
23
+ }
24
+ catch {
25
+ // Installed tarballs intentionally have no checkout SHA.
26
+ return undefined;
27
+ }
28
+ }
29
+ /**
30
+ * Find package metadata without assuming whether this code is running from
31
+ * source, a build directory, or an installed npm tarball.
32
+ */
33
+ export function findDiffciPackageIdentity() {
34
+ let current = dirname(import.meta.filename);
35
+ for (let depth = 0; depth < 8; depth++) {
36
+ const candidate = join(current, "package.json");
37
+ if (existsSync(candidate)) {
38
+ try {
39
+ const parsed = JSON.parse(readFileSync(candidate, "utf8"));
40
+ if (parsed.name === "@diffci/observer") {
41
+ return { version: parsed.version ?? "0.0.0", root: current };
42
+ }
43
+ if (parsed.name === "@diffci.com/diffci" || parsed.name === "diffci") {
44
+ return { version: parsed.version ?? "0.0.0", root: current, sha: checkoutSha(current) };
45
+ }
46
+ }
47
+ catch {
48
+ // An unreadable ancestor says nothing about this package; keep walking.
49
+ }
50
+ }
51
+ const parent = dirname(current);
52
+ if (parent === current)
53
+ break;
54
+ current = parent;
55
+ }
56
+ return undefined;
57
+ }
58
+ /** Preserve the CLI's historical unknown-version fallback for diagnostics. */
59
+ export function observerIdentity() {
60
+ return findDiffciPackageIdentity() ?? { version: "0.0.0" };
61
+ }
62
+ /** MCP negotiation must never advertise an invented release version. */
63
+ export function requireDiffciPackageIdentity() {
64
+ const identity = findDiffciPackageIdentity();
65
+ if (!identity) {
66
+ throw new Error("DiffCI MCP must run from an installed @diffci.com/diffci package.");
67
+ }
68
+ return identity;
69
+ }
@@ -71,7 +71,7 @@ function listWorkflowFiles(repoPath) {
71
71
  */
72
72
  /**
73
73
  * Does this step run DiffCI? Two forms have to be recognised, and only one of them has "diffci" in the
74
- * string: a third-party repository writes `uses: owner/DiffCI.com@<sha>`, while this repository (and
74
+ * string: a third-party repository writes `uses: DiffCI/core@<sha>`, while this repository (and
75
75
  * anyone vendoring the action) writes `uses: ./`, which names a directory. A guard that missed the
76
76
  * local form would report "no job runs the DiffCI action" for the one installation we control - and
77
77
  * silently check nothing.
@@ -2,6 +2,39 @@
2
2
 
3
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
4
 
5
+ ## Coding-agent plugins
6
+
7
+ The public [`integrations/agent-plugin`](integrations/agent-plugin) package
8
+ makes the published DiffCI CLI available as a checkout-aware local MCP plugin.
9
+ It contains only public marketplace metadata, skills, and a pinned npm
10
+ launcher; it does not include product services or private source.
11
+
12
+ ```sh
13
+ # Codex
14
+ codex plugin marketplace add DiffCI/core
15
+ codex plugin add diffci@diffci-local
16
+
17
+ # Claude Code
18
+ claude plugin marketplace add DiffCI/core
19
+ claude plugin install diffci@diffci-marketplace
20
+ ```
21
+
22
+ Cursor Marketplace reads [`.cursor-plugin/marketplace.json`](.cursor-plugin/marketplace.json)
23
+ from this repository. Before the public listing is approved, use the local MCP
24
+ configuration in the agent-plugin package or visit https://diffci.com/mcp-server.
25
+
26
+ ## GitHub Action
27
+
28
+ The public [`action.yml`](action.yml) is an observation-only GitHub Action
29
+ wrapper. It runs the pinned published DiffCI CLI outside the observed checkout,
30
+ retains existing CI jobs, and uploads an advisory report. See the
31
+ [observer Action guide](docs/github-action-observer.md) and
32
+ [workflow example](examples/github-actions-observer.yml).
33
+
34
+ The [v0.3.10 CLI source archive](packages/diffci-cli/SOURCE-ARCHIVE.md) keeps
35
+ the corresponding public source available for the already-published npm
36
+ executable while distribution migrates to Core.
37
+
5
38
  Try the published CLI in an existing Git checkout with Git and Node.js 22.5+:
6
39
 
7
40
  ```sh