@diffci.com/diffci 0.1.11 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +295 -229
  3. package/action.yml +154 -154
  4. package/dist-client/src/client/cli.js +213 -95
  5. package/dist-client/src/client/economics.js +31 -0
  6. package/dist-client/src/client/full-command.js +46 -0
  7. package/dist-client/src/client/mcp.js +196 -0
  8. package/dist-client/src/client/observe.js +40 -9
  9. package/dist-client/src/client/verify-savings.js +8 -2
  10. package/docs/agent-adoption-kit.md +96 -0
  11. package/docs/agent-adoption-targets.md +52 -0
  12. package/docs/ai-agents.md +27 -3
  13. package/docs/claude-code.md +3 -2
  14. package/docs/codex.md +3 -2
  15. package/docs/copilot.md +4 -4
  16. package/docs/cursor.md +4 -4
  17. package/docs/grok.md +3 -2
  18. package/docs/language-support.md +118 -70
  19. package/docs/mcp.md +21 -0
  20. package/docs/npm-adoption.md +6 -0
  21. package/llms.txt +3 -0
  22. package/node_modules/@babel/parser/bin/babel-parser.js +0 -0
  23. package/node_modules/@diffci.com/core/README.md +9 -1
  24. package/node_modules/@diffci.com/core/dist/cache/economics-context.d.ts +2 -0
  25. package/node_modules/@diffci.com/core/dist/cache/economics-context.js +21 -0
  26. package/node_modules/@diffci.com/core/dist/cache/economics-context.js.map +1 -0
  27. package/node_modules/@diffci.com/core/dist/cache/vue-analysis-cache.d.ts +5 -0
  28. package/node_modules/@diffci.com/core/dist/cache/vue-analysis-cache.js +100 -0
  29. package/node_modules/@diffci.com/core/dist/cache/vue-analysis-cache.js.map +1 -0
  30. package/node_modules/@diffci.com/core/dist/planner/test-command.js +32 -0
  31. package/node_modules/@diffci.com/core/dist/planner/test-command.js.map +1 -1
  32. package/node_modules/@diffci.com/core/dist/repo/adapters/go.d.ts +3 -0
  33. package/node_modules/@diffci.com/core/dist/repo/adapters/go.js +24 -6
  34. package/node_modules/@diffci.com/core/dist/repo/adapters/go.js.map +1 -1
  35. package/node_modules/@diffci.com/core/dist/repo/adapters/index.js +2 -1
  36. package/node_modules/@diffci.com/core/dist/repo/adapters/index.js.map +1 -1
  37. package/node_modules/@diffci.com/core/dist/repo/adapters/maven.d.ts +3 -0
  38. package/node_modules/@diffci.com/core/dist/repo/adapters/maven.js +65 -0
  39. package/node_modules/@diffci.com/core/dist/repo/adapters/maven.js.map +1 -0
  40. package/node_modules/@diffci.com/core/dist/repo/adapters/types.d.ts +11 -0
  41. package/node_modules/@diffci.com/core/dist/repo/adapters/types.js.map +1 -1
  42. package/node_modules/@diffci.com/core/dist/repo/adapters/vue.js +142 -14
  43. package/node_modules/@diffci.com/core/dist/repo/adapters/vue.js.map +1 -1
  44. package/node_modules/@diffci.com/core/dist/repo/graph.d.ts +4 -0
  45. package/node_modules/@diffci.com/core/dist/repo/graph.js +169 -19
  46. package/node_modules/@diffci.com/core/dist/repo/graph.js.map +1 -1
  47. package/node_modules/@diffci.com/core/dist/repo/impact.js +22 -5
  48. package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
  49. package/node_modules/@diffci.com/core/dist/repo/repo-config.d.ts +15 -0
  50. package/node_modules/@diffci.com/core/dist/repo/repo-config.js +13 -2
  51. package/node_modules/@diffci.com/core/dist/repo/repo-config.js.map +1 -1
  52. package/node_modules/@diffci.com/core/dist/repo/test-discovery.js +2 -0
  53. package/node_modules/@diffci.com/core/dist/repo/test-discovery.js.map +1 -1
  54. package/node_modules/@diffci.com/core/dist/repo/types.d.ts +17 -0
  55. package/node_modules/@diffci.com/core/dist/repo/vue-scope.d.ts +4 -0
  56. package/node_modules/@diffci.com/core/dist/repo/vue-scope.js +157 -0
  57. package/node_modules/@diffci.com/core/dist/repo/vue-scope.js.map +1 -0
  58. package/node_modules/@diffci.com/core/src/cache/economics-context.ts +19 -0
  59. package/node_modules/@diffci.com/core/src/cache/vue-analysis-cache.ts +80 -0
  60. package/node_modules/@diffci.com/core/src/planner/test-command.ts +28 -0
  61. package/node_modules/@diffci.com/core/src/repo/adapters/go.ts +24 -5
  62. package/node_modules/@diffci.com/core/src/repo/adapters/index.ts +2 -1
  63. package/node_modules/@diffci.com/core/src/repo/adapters/maven.ts +38 -0
  64. package/node_modules/@diffci.com/core/src/repo/adapters/types.ts +5 -0
  65. package/node_modules/@diffci.com/core/src/repo/adapters/vue.ts +120 -15
  66. package/node_modules/@diffci.com/core/src/repo/graph.ts +146 -20
  67. package/node_modules/@diffci.com/core/src/repo/impact.ts +20 -4
  68. package/node_modules/@diffci.com/core/src/repo/repo-config.ts +20 -2
  69. package/node_modules/@diffci.com/core/src/repo/test-discovery.ts +2 -0
  70. package/node_modules/@diffci.com/core/src/repo/types.ts +11 -0
  71. package/node_modules/@diffci.com/core/src/repo/vue-scope.ts +122 -0
  72. package/node_modules/nanoid/bin/nanoid.cjs +0 -0
  73. package/node_modules/typescript/bin/tsc +0 -0
  74. package/node_modules/typescript/bin/tsserver +0 -0
  75. package/node_modules/yaml/bin.mjs +0 -0
  76. package/package.json +155 -138
package/LICENSE CHANGED
@@ -668,4 +668,4 @@ specific requirements.
668
668
  if any, to sign a "copyright disclaimer" for the program, if necessary.
669
669
  For more information on this, and how to apply and follow the GNU AGPL, see
670
670
  <https://www.gnu.org/licenses/>.
671
-
671
+
package/README.md CHANGED
@@ -1,237 +1,303 @@
1
- # DiffCI
2
-
3
- [![npm version](https://img.shields.io/npm/v/@diffci.com/diffci.svg)](https://www.npmjs.com/package/@diffci.com/diffci)
4
- [![npm provenance](https://img.shields.io/badge/npm-provenance-blue)](https://docs.npmjs.com/generating-provenance-statements)
5
- [![GitHub Action](https://img.shields.io/badge/action-DiffCI%2FDiffCI.com%40v0.1.4-blue)](https://github.com/DiffCI/DiffCI.com)
6
-
1
+ # DiffCI
2
+
3
+
4
+ [![npm version](https://img.shields.io/npm/v/@diffci.com/diffci.svg)](https://www.npmjs.com/package/@diffci.com/diffci)
5
+ [![npm provenance](https://img.shields.io/badge/npm-provenance-blue)](https://docs.npmjs.com/generating-provenance-statements)
6
+ [![GitHub Action](https://img.shields.io/badge/action-DiffCI%2FDiffCI.com%40v0.1.4-blue)](https://github.com/DiffCI/DiffCI.com)
7
+
7
8
  **Find test-selection opportunities in your CI before changing what it runs.** DiffCI analyzes a
8
9
  commit's changes and dependency graph, then reports which test files it would select, why it falls
9
- back to a full run, and whether it can propose a test command. The `observe` command and Action are observation-only;
10
- the opt-in `pilot` and `verify-savings` commands execute tests.
11
-
12
- From an existing repository checkout, with Node.js 22.5+ and Git installed:
10
+ back to a full run, and whether it can propose a test command. `check` also runs paired full and
11
+ selected commands when it can infer them. The `observe` command and Action remain observation-only.
12
+
13
+ **For AI coding agents:** DiffCI gives Codex, Claude Code, Cursor, GitHub Copilot, Grok, and similar
14
+ tools a safe default CI/CD validation command.
15
+
16
+ From an existing repository checkout, with Node.js 22.5+ and Git installed:
17
+
18
+ ```bash
19
+ npx @diffci.com/diffci@latest check
20
+ ```
21
+
22
+ For AI coding agents, seed the repository with default instructions:
23
+
24
+ ```bash
25
+ npx @diffci.com/diffci@latest init
26
+ ```
27
+
28
+ For a self-serve runtime comparison, run one command from the repository root:
13
29
 
14
30
  ```bash
15
31
  npx @diffci.com/diffci@latest check
16
32
  ```
17
-
18
- For AI coding agents, seed the repository with default instructions:
19
-
20
- ```bash
21
- npx @diffci.com/diffci@latest init
22
- ```
23
-
24
- For the fastest self-serve runtime pilot, run one paired check from the repository root:
25
-
26
- ```bash
27
- npx @diffci.com/diffci@latest pilot --full "npm test"
28
- ```
29
-
30
- On Windows PowerShell, quote the package name:
31
-
32
- ```powershell
33
- npx '@diffci.com/diffci@latest' pilot --full "npm test"
34
- ```
35
-
36
- This executes the full and selected commands sequentially, and writes `diffci-observe.json`,
37
- `diffci-savings.json`, and `diffci-savings.md` to a sibling `diffci-output` folder outside the checkout.
38
- The commands you supply may create files or otherwise change the checkout. One paired run is preliminary
39
- timing evidence; repeat comparisons and account for cache effects before claiming savings.
40
-
41
- **Upgrade from 0.1.3:** tests excluded by a source-only `tsconfig.json` could be discovered without
42
- their dependency edges, producing an incomplete selection. This is fixed in **0.1.4**. Revalidate
43
- affected observations before using them as opportunity evidence; see the
44
- [historical validation](docs/evidence/growth-history-01/README.md) and
45
- [release qualification](docs/evidence/release-0.1.4/README.md).
46
-
47
- The local default compares `HEAD` with its first parent; both commits must be available. For a specific
48
- comparison, add `--base <base-sha> --head <head-sha>`. DiffCI prints the selection, fallback reasons,
49
- and the path to a JSON report outside your checkout. `REFUSED` or `ERROR` is not a successful analysis;
50
- check the reported status even when the command exits successfully. See the
51
- [support matrix](docs/language-support.md) for setup requirements and supported workloads.
52
- `check` is an agent-friendly alias for `observe --no-send`: it runs no tests, changes no CI behavior,
53
- and sends nothing by default. See [`docs/ai-agents.md`](docs/ai-agents.md) for Claude Code, Codex,
54
- Cursor, GitHub Copilot, and similar tools.
55
-
56
- **Measured example:** a controlled Cal.com replay showed **44.2% net reduction in a job-equivalent
57
- install + pretest + test workload**, including analysis overhead. This is one sandbox comparison,
58
- not Cal.com's production savings or a prediction for your repository.
59
- [Read the timings and method](docs/research/2026-08-24-calcom-execution-observability/11-frozen-identity-and-complete-job-savings.md).
60
-
61
- Selection counts alone do not establish runtime savings. Observation mode measures neither the
62
- selected test execution nor realized savings.
63
-
64
- For an advanced paired runtime check, you can still run `observe` first and then run `verify-savings`
65
- against the observation report. It compares your normal full command with
66
- DiffCI's proposed selected command and writes JSON plus Markdown evidence; see
67
- [`docs/npm-adoption.md`](docs/npm-adoption.md#self-serve-runtime-pilot).
68
-
69
- ## Observe in GitHub Actions
70
-
71
- Save this as `.github/workflows/diffci.yml` to add a dedicated, non-blocking observation job:
72
-
73
- ```yaml
74
- name: DiffCI observation
75
- on: [push, pull_request]
76
- permissions:
77
- contents: read
78
- jobs:
79
- diffci:
80
- runs-on: ubuntu-latest
81
- continue-on-error: true
82
- steps:
83
- - uses: actions/checkout@v4
84
- with:
85
- fetch-depth: 0
86
- - uses: DiffCI/DiffCI.com@dee4f7b938a7720d077c1124ef2ea050aa2625d6
87
- ```
88
-
89
- Then check the workflow locally with `npx @diffci.com/diffci@latest verify-workflow`. Keep the observer
90
- out of required checks and other jobs' `needs` lists. The Action adds a job summary and a
91
- `diffci-observation` artifact to the run; it does not alter which tests your other jobs execute.
92
- The example pins release `v0.1.4` to its full commit SHA for reproducibility.
93
-
94
- The CLI sends no report with `--no-send`. The Action uploads a GitHub artifact by default; sending to
95
- DiffCI's hosted service requires an explicitly configured endpoint and token.
96
- [Installation details](docs/distribution.md) · [Seven-day pilot](docs/shadow-pilot-runbook.md)
97
-
98
- ## Use DiffCI
99
-
100
- | Surface | Use it for | Current distribution |
101
- | --- | --- | --- |
102
- | [`@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 |
103
-
104
- The CLI bundles a pinned revision of the [Core engine](https://github.com/DiffCI/core) from GitHub. Users install only
105
- `@diffci.com/diffci`; the `pilot` command above stays the same. Core performs Git analysis,
106
- dependency graphs, impact, path baseline, and selected-command planning. The report format and
107
- non-interfering GitHub Action remain in this repository. See
108
- [`docs/package-relationship.md`](docs/package-relationship.md) for the source relationship.
109
- For evaluation results and their limits, start with
110
- [`docs/adoption-evidence.md`](docs/adoption-evidence.md).
111
-
112
- ## Project background
113
-
114
- **This repository moved out of the [DentalPresence.in](https://github.com/adityankale190895/DentalPresence.in)
115
- monorepo** (previously `diffci/` there) into its own repo on 2026-08-21, once the project outgrew being a
116
- subfolder. DentalPresence.in remains DiffCI's original dogfooding target - some code (the `planner`
117
- DentalPresence-specific PATH baseline/task registry, a few fixture tests) still reflects that origin - but
118
- the research and shadow-validation pipelines are generic and have been exercised against dozens of
119
- real third-party repositories.
120
-
121
- ## Current state
122
-
123
- Language expansion: initial Vue SFC and Go package-level analysis is implemented through repository
124
- adapters. See [the support matrix and setup requirements](docs/language-support.md) for exact scope,
125
- fallback behavior, and validation boundaries.
126
-
127
- Three completed research stages plus an in-progress prospective-validation stage, in order:
128
-
129
- - **Stage 0** - a 2,000-delta historical benchmark across 20 real repositories, run through a real
130
- Cloudflare orchestrator. Verdict: **GO WITH CONDITIONS**.
131
- - **Stage 1A** - forensic root-cause investigation of every repository/delta where Stage 0's confidence
132
- model degraded to UNSAFE, and of every historical "unsafe miss" candidate. Identified the top 3
133
- highest-leverage fixes.
134
- - **Stage 1B** - implemented those 3 fixes (reachability-aware confidence narrowing, an improved
135
- historical safety-measurement methodology, a tsconfig-scope + package.json-diffing fix), validated them
136
- live against real repositories (coverage improved, zero contradicted safety cases), and ran a real
137
- wall-clock FULL/PATH/DiffCI runtime pilot.
138
- - **Stage 2** (current) - prospective shadow validation on real, currently-arriving CI events, not more
139
- historical benchmarking. A live pipeline (Cloudflare Sandbox Containers + Worker, D1 + R2) observes real
140
- repositories, predicts *before* their outcome is known, and later reconciles against the real CI result.
141
- Current verdict: **EXTEND SHADOW VALIDATION** - the pipeline is real and defect-free, and since
142
- 2026-08-21 it runs **autonomously**: a Cron Trigger polls enrolled repositories every 10 minutes
143
- (`src/research/cloudflare/shadow-cron.ts`), and the registered **DiffCI Shadow GitHub App**
144
- (read-only; see [`docs/github-app-registration.md`](docs/github-app-registration.md)) delivers
145
- push/workflow events to `/v1/shadow/webhook` for instant predictions and exactly-on-time
146
- reconciliation - this repository shadow-observes itself through that App. See
147
- [`docs/research/2026-08-21-stage2-final-report.md`](docs/research/2026-08-21-stage2-final-report.md)
148
- for the full picture; what's honestly still missing is real observation volume, working GitHub
149
- Actions on our own repositories (account billing), and real design-partner repositories.
150
-
151
- Every dated report behind these stages lives in [`docs/research/`](docs/research/) - start with
152
- `2026-08-21-stage2-architecture.md` for the fullest current picture of what's built vs not, or the
153
- Stage 0/1A/1B reports for the historical-validation story.
154
-
155
- For the next product milestone, see [`docs/alpha-readiness.md`](docs/alpha-readiness.md). It tracks the
156
- private-alpha bar: install DiffCI, keep CI unchanged, collect real shadow observations, and render a
157
- trustworthy potential-savings report.
158
-
159
- ## Architecture
160
-
161
- DiffCI is now framed as an open-core product:
162
-
163
- ```text
164
- DiffCI
165
- |
166
- ├── Open-source core
167
- | ├── DiffCI engine
168
- | ├── CLI / npm package
169
- | ├── Local analysis
170
- | └── Basic GitHub Action
171
- | |
172
- | └── Tidelift package support
173
- |
174
- └── Commercial DiffCI
175
- ├── Hosted service / DiffCI Cloud
176
- ├── Organization dashboard
177
- ├── Historical analytics
178
- ├── Advanced CI/CD optimization
179
- ├── Enterprise policies
180
- ├── Managed runners
181
- ├── Team features
182
- └── Support / enterprise services
183
- ```
184
-
185
- The open-source core is the trust and adoption surface. It runs locally or in the host repository's own
186
- CI, writes a report, and changes nothing about CI execution. Commercial DiffCI adds hosted history,
187
- organization views, policy, managed operations, runners, and support. Tidelift belongs to the supported
188
- open-source package path, not the hosted product feature boundary. See
189
- [`docs/open-core-packaging.md`](docs/open-core-packaging.md) and
190
- [`docs/tidelift-package-support.md`](docs/tidelift-package-support.md).
191
-
192
- The source tree follows that split:
193
-
194
- - `src/git/`, `src/repo/`, `src/planner/`, and `src/client/` are the installable OSS observer path.
195
- - `action.yml` wraps the observer as a basic non-blocking GitHub Action.
196
- - `src/research/` and `src/shadow/` run validation, GitHub App shadow observation, and reconciliation.
197
- - `src/product/`, `src/auth/`, `src/billing/`, `src/ingest/`, `src/ledger/`, `src/runner/`, and
198
- `src/usage/` are the commercial/control-plane layer.
199
- - `docs/oss-boundary.md` records what is allowed into the npm package.
200
-
201
- ## Commands
202
-
203
- ```bash
204
- # Type-check and run the full test suite
205
- npm run check
206
-
207
- # Generate an example delta / impact / plan for the current repo's latest commit
208
- npm run diffci
209
- npm run impact
210
-
211
- # Run a real Stage 0-style historical benchmark locally
212
- npm run research:stage0
213
-
214
- # Deploy the Cloudflare research/shadow Worker (D1 + R2 + Sandbox Containers)
215
- npm run research:sandbox:deploy
216
- ```
217
-
218
- ## Install Surfaces
219
-
220
- DiffCI is intended to be installable as infrastructure, not only as a hosted shadow experiment:
221
-
222
- ```yaml
223
- - uses: DiffCI/DiffCI.com@dee4f7b938a7720d077c1124ef2ea050aa2625d6
224
- ```
225
-
226
- ```bash
227
- npx @diffci.com/diffci@latest observe
228
- npx @diffci.com/diffci@latest check
229
- npx @diffci.com/diffci@latest init
230
- npx @diffci.com/diffci@latest verify-workflow
33
+
34
+ On Windows PowerShell, quote the package name:
35
+
36
+ ```powershell
37
+ npx '@diffci.com/diffci@latest' check
231
38
  ```
232
39
 
233
- The GitHub Action and npm CLI establish the OSS/package distribution path. The hosted GitHub App and
234
- DiffCI Cloud build on that trust boundary for teams that want shared reports and history. See
235
- [`docs/distribution.md`](docs/distribution.md) for the package and Action positioning,
236
- [`docs/open-core-packaging.md`](docs/open-core-packaging.md) for the commercial split, and
237
- [`docs/npm-adoption.md`](docs/npm-adoption.md) for copy-paste pilot material.
40
+ `check` infers a full test command, runs it and DiffCI's selected command, and prints gross test-time
41
+ and net runtime changes when both pass. It writes observation and savings reports outside the checkout.
42
+ Test commands may create files or change the checkout. One paired run is preliminary evidence; repeat
43
+ comparisons and account for cache effects before claiming CI savings. On a full-validation fallback,
44
+ `check` runs the full command once and reports 0% reduction.
45
+
46
+ **Upgrade from 0.1.3:** tests excluded by a source-only `tsconfig.json` could be discovered without
47
+ their dependency edges, producing an incomplete selection. This is fixed in **0.1.4**. Revalidate
48
+ affected observations before using them as opportunity evidence; see the
49
+ [historical validation](docs/evidence/growth-history-01/README.md) and
50
+ [release qualification](docs/evidence/release-0.1.4/README.md).
51
+
52
+ The local default compares `HEAD` with its first parent; both commits must be available. For a specific
53
+ comparison, add `--base <base-sha> --head <head-sha>`. DiffCI prints the selection, fallback reasons,
54
+ and the path to a JSON report outside your checkout. `REFUSED` or `ERROR` is not a successful analysis;
55
+ check the reported status even when the command exits successfully. See the
56
+ [support matrix](docs/language-support.md) for setup requirements and supported workloads.
57
+ `check` runs inferred full and selected commands in the checkout and sends nothing by default.
58
+ The commands may write generated files. Use `observe --no-send` for analysis without execution.
59
+ See [`docs/ai-agents.md`](docs/ai-agents.md) for Claude Code, Codex,
60
+ Cursor, GitHub Copilot, and similar tools.
61
+
62
+ **Measured example:** a controlled Cal.com replay showed **44.2% net reduction in a job-equivalent
63
+ install + pretest + test workload**, including analysis overhead. This is one sandbox comparison,
64
+ not Cal.com's production savings or a prediction for your repository.
65
+ [Read the timings and method](docs/research/2026-08-24-calcom-execution-observability/11-frozen-identity-and-complete-job-savings.md).
66
+
67
+ Selection counts alone do not establish runtime savings. `check` reports a measured percentage only
68
+ when both commands pass; `observe` does not execute tests.
69
+
70
+ For an advanced paired runtime check, you can still run `observe` first and then run `verify-savings`
71
+ against the observation report. It compares your normal full command with
72
+ DiffCI's proposed selected command and writes JSON plus Markdown evidence; see
73
+ [`docs/npm-adoption.md`](docs/npm-adoption.md#self-serve-runtime-pilot).
74
+
75
+ ## Observe in GitHub Actions
76
+
77
+ Save this as `.github/workflows/diffci.yml` to add a dedicated, non-blocking observation job:
78
+
79
+ ```yaml
80
+ name: DiffCI observation
81
+ on: [push, pull_request]
82
+ permissions:
83
+ contents: read
84
+ jobs:
85
+ diffci:
86
+ runs-on: ubuntu-latest
87
+ continue-on-error: true
88
+ steps:
89
+ - uses: actions/checkout@v4
90
+ with:
91
+ fetch-depth: 0
92
+ - uses: DiffCI/DiffCI.com@dee4f7b938a7720d077c1124ef2ea050aa2625d6
93
+ ```
94
+
95
+ Then check the workflow locally with `npx @diffci.com/diffci@latest verify-workflow`. Keep the observer
96
+ out of required checks and other jobs' `needs` lists. The Action adds a job summary and a
97
+ `diffci-observation` artifact to the run; it does not alter which tests your other jobs execute.
98
+ The example pins release `v0.1.4` to its full commit SHA for reproducibility.
99
+
100
+ The CLI sends no report with `--no-send`. The Action uploads a GitHub artifact by default; sending to
101
+ DiffCI's hosted service requires an explicitly configured endpoint and token.
102
+ [Installation details](docs/distribution.md) · [Seven-day pilot](docs/shadow-pilot-runbook.md)
103
+
104
+ ## Use DiffCI
105
+
106
+ | Surface | Use it for | Current distribution |
107
+ | --- | --- | --- |
108
+ | [`@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 |
109
+
110
+ The CLI bundles a pinned revision of the [Core engine](https://github.com/DiffCI/core) from GitHub. Users install only
111
+ `@diffci.com/diffci`; the `check` command above uses it directly. Core performs Git analysis,
112
+ dependency graphs, impact, path baseline, and selected-command planning. The report format and
113
+ non-interfering GitHub Action remain in this repository. See
114
+ [`docs/package-relationship.md`](docs/package-relationship.md) for the source relationship.
115
+ For evaluation results and their limits, start with
116
+ [`docs/adoption-evidence.md`](docs/adoption-evidence.md).
117
+
118
+ ## Agent Adoption
119
+
120
+ Add DiffCI instructions to a repository:
121
+
122
+ ```bash
123
+ npx @diffci.com/diffci@latest init
124
+ ```
125
+
126
+ Then ask your coding agent to run:
127
+
128
+ ```bash
129
+ npx @diffci.com/diffci@latest check
130
+ ```
131
+
132
+ Agent-specific docs:
133
+ [`Codex`](docs/codex.md) ·
134
+ [`Claude Code`](docs/claude-code.md) ·
135
+ [`Cursor`](docs/cursor.md) ·
136
+ [`GitHub Copilot`](docs/copilot.md) ·
137
+ [`Grok`](docs/grok.md).
138
+
139
+ Live discovery files:
140
+ [`llms.txt`](https://diffci.com/llms.txt) ·
141
+ [`AI agents`](https://diffci.com/docs/ai-agents.html).
142
+
143
+ For native agent integrations, DiffCI also ships a stdio MCP server:
144
+
145
+ ```bash
146
+ npx -p @diffci.com/diffci@latest diffci-mcp
147
+ ```
148
+
149
+ See [`docs/mcp.md`](docs/mcp.md).
150
+
151
+ ## Project background
152
+
153
+ ## Public Core and private Cloud
154
+
155
+ DiffCI's public-good analysis engine is released separately from its commercial hosted product.
156
+ The project lives in the [DiffCI GitHub organization](https://github.com/DiffCI).
157
+ This repository was transferred to `DiffCI/DiffCI.com` on 2026-09-16.
158
+
159
+ | Component | Scope | Licensing |
160
+ | --- | --- | --- |
161
+ | [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 |
162
+ | DiffCI Cloud | Hosted infrastructure, billing, enterprise dashboard, organization management, proprietary data/services, and managed acceleration | Proprietary |
163
+ | Optional enterprise code | Separately scoped, visible and auditable enterprise capabilities | Source available, with commercial production rights controlled by DiffCI |
164
+
165
+ **This mixed repository remains private.** Only the reviewed Core extraction was published, with
166
+ fresh Git history. This repository retains its existing engine snapshot while package integration is
167
+ migrated separately. No blanket AGPL license applies to this repository. Public Core is advisory-only;
168
+ energy/carbon/cost are modeled estimates, not verified environmental savings. The exact extraction is
169
+ recorded in [the Core release audit](docs/core-release-audit.md).
170
+
171
+ The funded Core should run independently of DiffCI Cloud. AGPL permits commercial use and competing
172
+ hosting; it adds source-sharing obligations for covered modifications, including qualifying remote
173
+ network use. Grant eligibility depends on each grant's agreement and funded deliverables.
174
+
175
+ See the [licensing boundaries](docs/licensing.md), [organization and migration plan](docs/github-organization.md),
176
+ and [prepared organization profile](docs/github-org/profile/README.md).
177
+
178
+
179
+
180
+ **This repository moved out of the [DentalPresence.in](https://github.com/adityankale190895/DentalPresence.in)
181
+ monorepo** (previously `diffci/` there) into its own repo on 2026-08-21, once the project outgrew being a
182
+ subfolder. DentalPresence.in remains DiffCI's original dogfooding target - some code (the `planner`
183
+ DentalPresence-specific PATH baseline/task registry, a few fixture tests) still reflects that origin - but
184
+ the research and shadow-validation pipelines are generic and have been exercised against dozens of
185
+ real third-party repositories.
186
+
187
+ ## Current state
188
+
189
+ Language expansion: initial Vue SFC, Go package-level, and conventional Maven reactor analysis is implemented through repository
190
+ adapters. See [the support matrix and setup requirements](docs/language-support.md) for exact scope,
191
+ fallback behavior, and validation boundaries.
192
+
193
+ Three completed research stages plus an in-progress prospective-validation stage, in order:
194
+
195
+ - **Stage 0** - a 2,000-delta historical benchmark across 20 real repositories, run through a real
196
+ Cloudflare orchestrator. Verdict: **GO WITH CONDITIONS**.
197
+ - **Stage 1A** - forensic root-cause investigation of every repository/delta where Stage 0's confidence
198
+ model degraded to UNSAFE, and of every historical "unsafe miss" candidate. Identified the top 3
199
+ highest-leverage fixes.
200
+ - **Stage 1B** - implemented those 3 fixes (reachability-aware confidence narrowing, an improved
201
+ historical safety-measurement methodology, a tsconfig-scope + package.json-diffing fix), validated them
202
+ live against real repositories (coverage improved, zero contradicted safety cases), and ran a real
203
+ wall-clock FULL/PATH/DiffCI runtime pilot.
204
+ - **Stage 2** (current) - prospective shadow validation on real, currently-arriving CI events, not more
205
+ historical benchmarking. A live pipeline (Cloudflare Sandbox Containers + Worker, D1 + R2) observes real
206
+ repositories, predicts *before* their outcome is known, and later reconciles against the real CI result.
207
+ Current verdict: **EXTEND SHADOW VALIDATION** - the pipeline is real and defect-free, and since
208
+ 2026-08-21 it runs **autonomously**: a Cron Trigger polls enrolled repositories every 10 minutes
209
+ (`src/research/cloudflare/shadow-cron.ts`), and the registered **DiffCI Shadow GitHub App**
210
+ (read-only; see [`docs/github-app-registration.md`](docs/github-app-registration.md)) delivers
211
+ push/workflow events to `/v1/shadow/webhook` for instant predictions and exactly-on-time
212
+ reconciliation - this repository shadow-observes itself through that App. See
213
+ [`docs/research/2026-08-21-stage2-final-report.md`](docs/research/2026-08-21-stage2-final-report.md)
214
+ for the full picture; what's honestly still missing is real observation volume, working GitHub
215
+ Actions on our own repositories (account billing), and real design-partner repositories.
216
+
217
+ Every dated report behind these stages lives in [`docs/research/`](docs/research/) - start with
218
+ `2026-08-21-stage2-architecture.md` for the fullest current picture of what's built vs not, or the
219
+ Stage 0/1A/1B reports for the historical-validation story.
220
+
221
+ For the next product milestone, see [`docs/alpha-readiness.md`](docs/alpha-readiness.md). It tracks the
222
+ private-alpha bar: install DiffCI, keep CI unchanged, collect real shadow observations, and render a
223
+ trustworthy potential-savings report.
224
+
225
+ ## Architecture
226
+
227
+ DiffCI is now framed as an open-core product:
228
+
229
+ ```text
230
+ DiffCI
231
+ |
232
+ ├── Open-source core
233
+ | ├── DiffCI engine
234
+ | ├── CLI / npm package
235
+ | ├── Local analysis
236
+ | └── Basic GitHub Action
237
+ | |
238
+ | └── Tidelift package support
239
+ |
240
+ └── Commercial DiffCI
241
+ ├── Hosted service / DiffCI Cloud
242
+ ├── Organization dashboard
243
+ ├── Historical analytics
244
+ ├── Advanced CI/CD optimization
245
+ ├── Enterprise policies
246
+ ├── Managed runners
247
+ ├── Team features
248
+ └── Support / enterprise services
249
+ ```
250
+
251
+ The open-source core is the trust and adoption surface. It runs locally or in the host repository's own
252
+ CI, writes a report, and changes nothing about CI execution. Commercial DiffCI adds hosted history,
253
+ organization views, policy, managed operations, runners, and support. Tidelift belongs to the supported
254
+ open-source package path, not the hosted product feature boundary. See
255
+ [`docs/open-core-packaging.md`](docs/open-core-packaging.md) and
256
+ [`docs/tidelift-package-support.md`](docs/tidelift-package-support.md).
257
+
258
+ The source tree follows that split:
259
+
260
+ - `src/git/`, `src/repo/`, `src/planner/`, and `src/client/` are the installable OSS observer path.
261
+ - `action.yml` wraps the observer as a basic non-blocking GitHub Action.
262
+ - `src/research/` and `src/shadow/` run validation, GitHub App shadow observation, and reconciliation.
263
+ - `src/product/`, `src/auth/`, `src/billing/`, `src/ingest/`, `src/ledger/`, `src/runner/`, and
264
+ `src/usage/` are the commercial/control-plane layer.
265
+ - `docs/oss-boundary.md` records what is allowed into the npm package.
266
+
267
+ ## Commands
268
+
269
+ ```bash
270
+ # Type-check and run the full test suite
271
+ npm run check
272
+
273
+ # Generate an example delta / impact / plan for the current repo's latest commit
274
+ npm run diffci
275
+ npm run impact
276
+
277
+ # Run a real Stage 0-style historical benchmark locally
278
+ npm run research:stage0
279
+
280
+ # Deploy the Cloudflare research/shadow Worker (D1 + R2 + Sandbox Containers)
281
+ npm run research:sandbox:deploy
282
+ ```
283
+
284
+ ## Install Surfaces
285
+
286
+ DiffCI is intended to be installable as infrastructure, not only as a hosted shadow experiment:
287
+
288
+ ```yaml
289
+ - uses: DiffCI/DiffCI.com@dee4f7b938a7720d077c1124ef2ea050aa2625d6
290
+ ```
291
+
292
+ ```bash
293
+ npx @diffci.com/diffci@latest observe
294
+ npx @diffci.com/diffci@latest check
295
+ npx @diffci.com/diffci@latest init
296
+ npx @diffci.com/diffci@latest verify-workflow
297
+ ```
298
+
299
+ The GitHub Action and npm CLI establish the OSS/package distribution path. The hosted GitHub App and
300
+ DiffCI Cloud build on that trust boundary for teams that want shared reports and history. See
301
+ [`docs/distribution.md`](docs/distribution.md) for the package and Action positioning,
302
+ [`docs/open-core-packaging.md`](docs/open-core-packaging.md) for the commercial split, and
303
+ [`docs/npm-adoption.md`](docs/npm-adoption.md) for copy-paste pilot material.