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