@diffci.com/diffci 0.2.11 → 0.3.0-rc.1

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.
@@ -0,0 +1,265 @@
1
+ import { mkdtempSync, rmSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
3
+ import { join, resolve } from "node:path";
4
+ import { inferFullCommand, inferSelectedCommand } from "./full-command.js";
5
+ import { observe } from "./observe.js";
6
+ import { measureCommand } from "./verify-savings.js";
7
+ import { captureWorkingTreeSnapshot } from "./working-tree.js";
8
+ export const VERIFICATION_SCHEMA = "diffci.verification.v1";
9
+ function receiptRange(range) {
10
+ if (!range)
11
+ return undefined;
12
+ return {
13
+ base_sha: range.baseSha,
14
+ head_sha: range.headSha,
15
+ source: range.source,
16
+ merge_base_sha: range.mergeBaseSha,
17
+ };
18
+ }
19
+ function baseReport(snapshot, scope, range) {
20
+ return {
21
+ schema: VERIFICATION_SCHEMA,
22
+ schema_version: "1",
23
+ produced_at: new Date().toISOString(),
24
+ scope,
25
+ commit_range: receiptRange(range),
26
+ snapshot: {
27
+ base_sha: snapshot.baseSha,
28
+ before_tree_sha: snapshot.treeSha,
29
+ unchanged: false,
30
+ },
31
+ };
32
+ }
33
+ function blocked(snapshot, scope, reason, analysis, counts = {}, range) {
34
+ return {
35
+ ...baseReport(snapshot, scope, range),
36
+ verification: "blocked",
37
+ safe_to_continue: false,
38
+ reason,
39
+ changed_files: counts.changedFiles ?? 0,
40
+ tests_available: counts.testsAvailable ?? 0,
41
+ tests_selected: counts.testsSelected ?? 0,
42
+ selection: "none",
43
+ analysis,
44
+ required_actions: [reason],
45
+ };
46
+ }
47
+ function unknownSnapshot() {
48
+ return { baseSha: "unknown", treeSha: "unknown", commitSha: "unknown", changed: true };
49
+ }
50
+ async function executeObservation(options, scope, before, observation) {
51
+ const result = observation.result;
52
+ const range = observation.commitRange;
53
+ const boundRange = scope === "commit-range" ? range : undefined;
54
+ const counts = {
55
+ changedFiles: result?.changedFileCount ?? 0,
56
+ testsAvailable: result?.totalTestCount ?? 0,
57
+ testsSelected: result?.selectedTests.length ?? 0,
58
+ };
59
+ const analysis = {
60
+ status: observation.status,
61
+ stage: observation.stage,
62
+ mode: result?.mode,
63
+ fallback_reasons: result?.fallbackReasons ?? [],
64
+ error: observation.reason,
65
+ };
66
+ if (observation.status !== "OBSERVED" || !result) {
67
+ return blocked(before, scope, observation.reason ?? "DiffCI analysis did not produce a verification plan", analysis, counts, boundRange);
68
+ }
69
+ if (scope === "commit-range") {
70
+ if (!range)
71
+ return blocked(before, scope, "DiffCI did not resolve a commit range", analysis, counts);
72
+ if (range.headSha !== before.baseSha) {
73
+ return blocked(before, scope, `the analyzed head ${range.headSha} is not the checked-out HEAD ${before.baseSha}`, analysis, counts, range);
74
+ }
75
+ }
76
+ let afterAnalysis;
77
+ try {
78
+ afterAnalysis = captureWorkingTreeSnapshot(options.repoPath);
79
+ }
80
+ catch (error) {
81
+ const message = error instanceof Error ? error.message : String(error);
82
+ return blocked(before, scope, `could not confirm the post-analysis snapshot: ${message}`, analysis, counts, boundRange);
83
+ }
84
+ if (!observation.nonInterference.worktreeUnchanged || before.baseSha !== afterAnalysis.baseSha || before.treeSha !== afterAnalysis.treeSha) {
85
+ const report = blocked(before, scope, "the working tree changed during DiffCI analysis", analysis, counts, boundRange);
86
+ report.snapshot.after_base_sha = afterAnalysis.baseSha;
87
+ report.snapshot.after_tree_sha = afterAnalysis.treeSha;
88
+ return report;
89
+ }
90
+ let selection;
91
+ let command;
92
+ let reason;
93
+ if (result.mode === "SELECTIVE" && !result.commandRefusalReason && result.proposedCommands.length === 1) {
94
+ const selected = inferSelectedCommand(options.repoPath, result.proposedCommands[0], result.selectedTests);
95
+ if (selected.command) {
96
+ selection = "selected";
97
+ command = selected.command;
98
+ reason = "dependency impact";
99
+ }
100
+ else {
101
+ selection = "full";
102
+ const full = inferFullCommand(options.repoPath);
103
+ command = full.command;
104
+ reason = `selected verification was not executable (${selected.reason}); broadened to full verification`;
105
+ }
106
+ }
107
+ else {
108
+ selection = "full";
109
+ const full = inferFullCommand(options.repoPath);
110
+ command = full.command;
111
+ const fallback = result.fallbackReasons[0] ?? result.commandRefusalReason;
112
+ reason = fallback ? `full verification required: ${fallback}` : "full verification required";
113
+ }
114
+ if (!command) {
115
+ const inferred = inferFullCommand(options.repoPath);
116
+ return blocked(before, scope, `no executable verification command is available: ${inferred.reason}`, analysis, counts, boundRange);
117
+ }
118
+ const execution = measureCommand(command, { cwd: options.repoPath, timeoutMs: options.timeoutMs, tailBytes: options.tailBytes });
119
+ let after;
120
+ try {
121
+ after = captureWorkingTreeSnapshot(options.repoPath);
122
+ }
123
+ catch (error) {
124
+ const message = error instanceof Error ? error.message : String(error);
125
+ return {
126
+ ...blocked(before, scope, `could not confirm the post-verification snapshot: ${message}`, analysis, counts, boundRange),
127
+ selection,
128
+ command,
129
+ execution,
130
+ };
131
+ }
132
+ const unchanged = before.baseSha === after.baseSha && before.treeSha === after.treeSha;
133
+ const succeeded = execution.exitCode === 0 && !execution.timedOut;
134
+ const verification = !unchanged ? "blocked" : succeeded ? "passed" : "failed";
135
+ const finalReason = !unchanged
136
+ ? "the working tree changed while verification was running; rerun DiffCI for the new snapshot"
137
+ : succeeded
138
+ ? reason
139
+ : execution.timedOut
140
+ ? `verification timed out after ${options.timeoutMs}ms`
141
+ : `verification command failed with exit code ${String(execution.exitCode)}`;
142
+ return {
143
+ ...baseReport(before, scope, boundRange),
144
+ verification,
145
+ safe_to_continue: verification === "passed",
146
+ reason: finalReason,
147
+ changed_files: counts.changedFiles,
148
+ tests_available: counts.testsAvailable,
149
+ tests_selected: selection === "full" ? counts.testsAvailable : counts.testsSelected,
150
+ selection,
151
+ command,
152
+ execution,
153
+ snapshot: {
154
+ ...baseReport(before, scope, boundRange).snapshot,
155
+ after_base_sha: after.baseSha,
156
+ after_tree_sha: after.treeSha,
157
+ unchanged,
158
+ },
159
+ analysis,
160
+ required_actions: verification === "passed" ? [] : [finalReason],
161
+ };
162
+ }
163
+ /** Verify exactly the staged, unstaged, and non-ignored untracked content currently on disk. */
164
+ export async function verifyChanged(options) {
165
+ const repoPath = resolve(options.repoPath);
166
+ let before;
167
+ try {
168
+ before = captureWorkingTreeSnapshot(repoPath);
169
+ }
170
+ catch (error) {
171
+ const message = error instanceof Error ? error.message : String(error);
172
+ return blocked(unknownSnapshot(), "working-tree", message, { status: "ERROR", stage: "context", fallback_reasons: [], error: message });
173
+ }
174
+ if (!before.changed) {
175
+ return {
176
+ ...baseReport(before, "working-tree"),
177
+ verification: "passed",
178
+ safe_to_continue: true,
179
+ reason: "no staged, unstaged, or non-ignored untracked changes",
180
+ changed_files: 0,
181
+ tests_available: 0,
182
+ tests_selected: 0,
183
+ selection: "none",
184
+ snapshot: {
185
+ ...baseReport(before, "working-tree").snapshot,
186
+ after_base_sha: before.baseSha,
187
+ after_tree_sha: before.treeSha,
188
+ unchanged: true,
189
+ },
190
+ analysis: { status: "not_needed", fallback_reasons: [] },
191
+ required_actions: [],
192
+ };
193
+ }
194
+ const temporaryDirectory = mkdtempSync(join(tmpdir(), "diffci-verify-"));
195
+ try {
196
+ const observation = await observe({
197
+ repoPath,
198
+ env: options.env,
199
+ version: options.version,
200
+ engineSha: options.engineSha,
201
+ baseOverride: before.baseSha,
202
+ headOverride: before.commitSha,
203
+ redactPaths: options.redactPaths,
204
+ reportPath: join(temporaryDirectory, "observation.json"),
205
+ });
206
+ return await executeObservation({ ...options, repoPath }, "working-tree", before, observation);
207
+ }
208
+ finally {
209
+ rmSync(temporaryDirectory, { recursive: true, force: true });
210
+ }
211
+ }
212
+ /** Verify a real commit range and bind the receipt to the clean commit that was actually executed. */
213
+ export async function verifyRange(options) {
214
+ const repoPath = resolve(options.repoPath);
215
+ let before;
216
+ try {
217
+ before = captureWorkingTreeSnapshot(repoPath);
218
+ }
219
+ catch (error) {
220
+ const message = error instanceof Error ? error.message : String(error);
221
+ return blocked(unknownSnapshot(), "commit-range", message, { status: "ERROR", stage: "context", fallback_reasons: [], error: message });
222
+ }
223
+ if (before.changed) {
224
+ return blocked(before, "commit-range", "commit-range verification requires a clean checkout; use verify --changed for uncommitted changes", { status: "not_needed", fallback_reasons: [] });
225
+ }
226
+ const temporaryDirectory = mkdtempSync(join(tmpdir(), "diffci-verify-"));
227
+ try {
228
+ const observation = await observe({
229
+ repoPath,
230
+ env: options.env,
231
+ version: options.version,
232
+ engineSha: options.engineSha,
233
+ baseOverride: options.baseOverride,
234
+ headOverride: options.headOverride,
235
+ redactPaths: options.redactPaths,
236
+ reportPath: join(temporaryDirectory, "observation.json"),
237
+ });
238
+ return await executeObservation({ ...options, repoPath }, "commit-range", before, observation);
239
+ }
240
+ finally {
241
+ rmSync(temporaryDirectory, { recursive: true, force: true });
242
+ }
243
+ }
244
+ export function verificationExitCode(report) {
245
+ if (report.verification === "passed")
246
+ return 0;
247
+ if (report.verification === "failed")
248
+ return 1;
249
+ return 2;
250
+ }
251
+ export function formatVerificationSummary(report) {
252
+ const lines = [
253
+ `DiffCI verification: ${report.verification.toUpperCase()}`,
254
+ ` scope: ${report.scope}`,
255
+ ` changed files: ${report.changed_files}`,
256
+ ` verification: ${report.selection} (${report.tests_selected}/${report.tests_available} test files)`,
257
+ ` reason: ${report.reason}`,
258
+ ` snapshot: ${report.snapshot.before_tree_sha.slice(0, 12)} (${report.snapshot.unchanged ? "unchanged" : "not confirmed"})`,
259
+ ];
260
+ if (report.commit_range)
261
+ lines.splice(2, 0, ` range: ${report.commit_range.base_sha.slice(0, 12)}..${report.commit_range.head_sha.slice(0, 12)}`);
262
+ if (report.command)
263
+ lines.push(` command: ${report.command}`);
264
+ return lines.join("\n");
265
+ }
@@ -88,6 +88,12 @@ function listWorkflowFiles(repoPath) {
88
88
  function runReferencesDiffCi(run, actionPattern) {
89
89
  return actionPattern.test(commandText(run));
90
90
  }
91
+ /** A fail-closed `verify` job is intentionally allowed to affect its own check conclusion. */
92
+ function runInvokesDiffCiVerification(run) {
93
+ const command = commandText(run);
94
+ return /\bdiffci:verify\b/i.test(command) ||
95
+ /\b(?:diffci(?:\.com\/diffci)?(?:@[^\s"']+)?|cli\.(?:js|ts))["']?\s+verify(?=\s|$)/i.test(command);
96
+ }
91
97
  /**
92
98
  * The part of a `run:` script that can invoke something: shell comments and URLs are removed line by
93
99
  * line before matching. A URL is data handed to a command, not a command - DiffCI's own deploy
@@ -180,7 +186,10 @@ export function auditWorkflows(repoPath, options = {}) {
180
186
  const steps = asArray(rawJob.steps).filter(isRecord);
181
187
  const isDiffCiStep = (step) => (typeof step.uses === "string" && referencesDiffCi(step.uses, repoPath, actionPattern)) ||
182
188
  (typeof step.run === "string" && runReferencesDiffCi(step.run, actionPattern));
183
- const diffciSteps = steps.filter(isDiffCiStep);
189
+ const isVerificationStep = (step) => typeof step.run === "string" && runInvokesDiffCiVerification(step.run);
190
+ // This guard proves that observation jobs are inert. A dedicated fail-closed verification job
191
+ // is a different product surface: making its own status check fail is its intended contract.
192
+ const diffciSteps = steps.filter((step) => isDiffCiStep(step) && !isVerificationStep(step));
184
193
  if (diffciSteps.length === 0)
185
194
  continue;
186
195
  observerJobs.push(`${relativePath}#${jobId}`);
@@ -213,7 +222,7 @@ export function auditWorkflows(repoPath, options = {}) {
213
222
  // DiffCI became a package rather than an Action it invokes itself with `run:`, and the rule
214
223
  // below - "any run: step is real work" - was written when that could not happen. Leaving the
215
224
  // order the other way round made the product's own generated workflow fail its own guard.
216
- if (isDiffCiStep(step))
225
+ if (isDiffCiStep(step) && !isVerificationStep(step))
217
226
  return false;
218
227
  // Any other shell step in this job IS real work, and DiffCI must not share a job with it.
219
228
  if (typeof step.run === "string")
@@ -0,0 +1,65 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { mkdtempSync, rmSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join, resolve } from "node:path";
5
+ function runGit(repoPath, args, env, input) {
6
+ const result = spawnSync("git", args, {
7
+ cwd: repoPath,
8
+ env: env ? { ...process.env, ...env } : process.env,
9
+ input,
10
+ encoding: "utf8",
11
+ maxBuffer: 64 * 1024 * 1024,
12
+ windowsHide: true,
13
+ });
14
+ return {
15
+ status: result.status,
16
+ stdout: result.stdout ?? "",
17
+ stderr: result.stderr ?? "",
18
+ };
19
+ }
20
+ function requireGit(repoPath, args, context, env, input) {
21
+ const result = runGit(repoPath, args, env, input);
22
+ if (result.status !== 0) {
23
+ const detail = result.stderr.trim() || result.stdout.trim() || `git exited with status ${String(result.status)}`;
24
+ throw new Error(`${context}: ${detail.split("\n")[0]}`);
25
+ }
26
+ return result.stdout.trim();
27
+ }
28
+ /**
29
+ * Materialize the current worktree as a Git tree without changing the user's index or checkout.
30
+ *
31
+ * A temporary index begins at HEAD and stages the working tree into that isolated index. Git therefore
32
+ * applies the repository's normal ignore rules, executable-bit handling, symlink handling, and clean
33
+ * filters, while the real index and every source file stay untouched. The resulting tree SHA is a
34
+ * content-addressed verification identity. The synthetic commit is intentionally unreachable and is
35
+ * used only by DiffCI's existing commit-to-commit analyzer.
36
+ */
37
+ export function captureWorkingTreeSnapshot(repoPathInput) {
38
+ const repoPath = resolve(repoPathInput);
39
+ const baseSha = requireGit(repoPath, ["rev-parse", "--verify", "HEAD^{commit}"], "could not resolve repository HEAD");
40
+ const baseTreeSha = requireGit(repoPath, ["rev-parse", "--verify", "HEAD^{tree}"], "could not resolve repository HEAD tree");
41
+ const unmerged = requireGit(repoPath, ["ls-files", "--unmerged"], "could not inspect the repository index");
42
+ if (unmerged !== "")
43
+ throw new Error("the repository index contains unresolved merge entries");
44
+ const temporaryDirectory = mkdtempSync(join(tmpdir(), "diffci-working-tree-"));
45
+ const temporaryIndex = join(temporaryDirectory, "index");
46
+ const indexEnvironment = { GIT_INDEX_FILE: temporaryIndex };
47
+ try {
48
+ requireGit(repoPath, ["read-tree", baseSha], "could not initialize the verification snapshot", indexEnvironment);
49
+ requireGit(repoPath, ["add", "-A", "--", "."], "could not capture the working tree", indexEnvironment);
50
+ const treeSha = requireGit(repoPath, ["write-tree"], "could not write the verification tree", indexEnvironment);
51
+ const identityEnvironment = {
52
+ GIT_AUTHOR_NAME: "DiffCI",
53
+ GIT_AUTHOR_EMAIL: "snapshot@diffci.local",
54
+ GIT_COMMITTER_NAME: "DiffCI",
55
+ GIT_COMMITTER_EMAIL: "snapshot@diffci.local",
56
+ GIT_AUTHOR_DATE: "2000-01-01T00:00:00Z",
57
+ GIT_COMMITTER_DATE: "2000-01-01T00:00:00Z",
58
+ };
59
+ const commitSha = requireGit(repoPath, ["commit-tree", treeSha, "-p", baseSha], "could not create the verification snapshot", identityEnvironment, "DiffCI working tree snapshot\n");
60
+ return { baseSha, treeSha, commitSha, changed: treeSha !== baseTreeSha };
61
+ }
62
+ finally {
63
+ rmSync(temporaryDirectory, { recursive: true, force: true });
64
+ }
65
+ }
@@ -97,7 +97,7 @@ They are supporting signals only.
97
97
 
98
98
  | Signal | Value | Interpretation |
99
99
  | --- | ---: | --- |
100
- | npm latest version | `0.2.11` | Current CLI and MCP binaries are publicly available. |
100
+ | npm latest version | `0.3.0-rc.1` | Current CLI and MCP binaries are publicly available. |
101
101
  | npm downloads, last complete registry week (`2026-09-15`–`2026-09-21`) | 1,929 | Distribution activity; not unique users or repositories. |
102
102
  | GitHub stars / forks / watchers | 0 / 0 / 0 | No repository-level community conversion yet. |
103
103
  | GitHub views, available 14-day window | 18 views / 4 unique visitors | Early discovery signal. |
@@ -120,7 +120,7 @@ Existing outreach log:
120
120
  | 2026-09-22 | ciembor/agent-rules-books | Issue | https://github.com/ciembor/agent-rules-books/issues/8 | Open; no reply as of 2026-09-25 | Follow up once on 2026-09-30; offer a PR only if invited. |
121
121
  | 2026-09-22 | jbarbier/CLAUDE.md | Issue | https://github.com/jbarbier/CLAUDE.md/issues/12 | Open; no reply as of 2026-09-25 | Follow up once on 2026-09-30; offer a PR only if invited. |
122
122
  | 2026-09-22 | Official MCP Registry | Directory | `io.github.adityankale190895/diffci` | Published | Consider moving to `io.github.DiffCI/diffci` after GitHub org namespace authorization is available. |
123
- | 2026-09-25 | Official MCP Registry | Directory | `io.github.DiffCI/diffci` | Migration in progress | Organization namespace authorized through GitHub OIDC. |
123
+ | 2026-09-25 | Official MCP Registry | Directory | `io.github.DiffCI/diffci` | Published | Organization namespace authorized through GitHub OIDC; the listing uses the versioned `https://diffci.com/mcp/v1` remote. |
124
124
  | 2026-09-22 | Glama | Directory | TBD | Planned | Submit repository URL. |
125
125
  | 2026-09-22 | Smithery | Directory | TBD | Blocked | Needs Smithery account/API key. |
126
126
 
@@ -6,12 +6,26 @@ Copy only the integration your repository needs. DiffCI does not replace require
6
6
 
7
7
  Add this to `AGENTS.md` or the equivalent agent instruction file:
8
8
 
9
- > Before calling a change PR-ready, run `npx "@diffci.com/diffci@latest" check` from the repository
10
- > root. Use its output to understand affected tests and fallback reasons. Keep the repository's
11
- > required CI authoritative. If DiffCI reports `REFUSED` or `ERROR`, run the normal tests.
9
+ > Before calling a change PR-ready, run `npx "@diffci.com/diffci@latest" verify --changed --json`
10
+ > from the repository root. Continue only when the receipt says `safe_to_continue: true`. Keep the
11
+ > repository's required CI authoritative. If DiffCI refuses, errors, fails, or cannot prove a safe
12
+ > selection, run the normal tests and do not treat the change as verified.
12
13
 
13
- `check` may execute the repository's full and selected test commands, which may write generated
14
- files. For analysis without executing tests, run `npx "@diffci.com/diffci@latest" observe --no-send`.
14
+ `verify --changed` may execute the repository's selected or full test command, which may write
15
+ generated files. DiffCI fails if the content-addressed snapshot changes while verification runs. For
16
+ paired runtime measurement use `check`; for analysis without tests use `observe --no-send`.
17
+
18
+ ## Blocking GitHub verification
19
+
20
+ Generate the workflow instead of copying a version-sensitive package command:
21
+
22
+ ```bash
23
+ npx "@diffci.com/diffci@latest" init --verification-workflow
24
+ ```
25
+
26
+ The generated **DiffCI verification** job verifies the pull-request or push range, has no
27
+ `continue-on-error`, and uploads its receipt. After a successful pilot, make that job a required
28
+ branch-protection check.
15
29
 
16
30
  ## GitHub Action
17
31
 
@@ -30,7 +44,7 @@ jobs:
30
44
  - uses: actions/checkout@v4
31
45
  with:
32
46
  fetch-depth: 0
33
- - uses: DiffCI/DiffCI.com@e1d7bab271c5d83899bda0034d70d3e34c10c1f7 # v0.2.11
47
+ - uses: DiffCI/DiffCI.com@2f72b7fc017cc987fb0fd80c7e2351f33240e7d4 # v0.3.0-rc.1
34
48
  ```
35
49
 
36
50
  Run `npx "@diffci.com/diffci@latest" verify-workflow` before starting a pilot. The Action uploads a
@@ -60,9 +74,9 @@ Suggested title: **Add optional DiffCI validation for coding agents**
60
74
 
61
75
  Suggested description:
62
76
 
63
- > This adds an optional DiffCI instruction or observation job. DiffCI analyzes the change and
64
- > reports affected tests. Its `check` command compares full and selected test commands when it can
65
- > infer them; the GitHub Action only observes. Required CI continues to run as before.
77
+ > This adds a persistent DiffCI agent instruction and optionally a blocking verification job. DiffCI
78
+ > runs the minimum test command it can justify, falls back to full verification on uncertainty, and
79
+ > emits a machine-readable receipt. Required CI continues to run as before.
66
80
 
67
81
  ## Where to point maintainers
68
82
 
@@ -76,7 +90,7 @@ If a maintainer is evaluating DiffCI for the first time, ask for one local run b
76
90
  workflow change:
77
91
 
78
92
  ```bash
79
- npx "@diffci.com/diffci@latest" check
93
+ npx "@diffci.com/diffci@latest" verify --changed --json
80
94
  ```
81
95
 
82
96
  Then use the first-report issue template to capture the result, fallback/refusal reasons, CI shape,
@@ -31,7 +31,7 @@ small optional-instruction PR from [`agent-adoption-kit.md`](agent-adoption-kit.
31
31
 
32
32
  | Directory | Submission path | Status |
33
33
  | --- | --- | --- |
34
- | [Official MCP Registry](https://github.com/modelcontextprotocol/registry) | Publish with GitHub OIDC as `io.github.DiffCI/diffci`. | Publishing under the authorized organization namespace. |
34
+ | [Official MCP Registry](https://github.com/modelcontextprotocol/registry) | Publish with GitHub OIDC as `io.github.DiffCI/diffci`. | Published under the authorized organization namespace with the `https://diffci.com/mcp/v1` remote. |
35
35
  | [Glama](https://glama.ai/) | Submit the GitHub repository URL and short description; optional `glama.json` metadata can improve indexing. | Ready to submit. |
36
36
  | [Smithery](https://smithery.ai/) | Publish through Smithery's server release flow/API. | Needs Smithery account/API key. |
37
37
  | [PulseMCP](https://www.pulsemcp.com/) | Submit/list the MCP server if their current listing flow accepts third-party servers. | Review current submission rules first. |
package/docs/ai-agents.md CHANGED
@@ -1,17 +1,19 @@
1
1
  # DiffCI for AI Coding Agents
2
2
 
3
- DiffCI is the default CI/CD validation lens agents can run before proposing, committing, or opening a
4
- pull request.
3
+ DiffCI is a fail-closed verification layer agents run before proposing, committing, or opening a pull
4
+ request. It chooses the narrowest verification it can justify and broadens to the full inferred test
5
+ command when the evidence is incomplete.
5
6
 
6
7
  The default command is:
7
8
 
8
9
  ```bash
9
- npx "@diffci.com/diffci@latest" check
10
+ npx "@diffci.com/diffci@latest" verify --changed --json
10
11
  ```
11
12
 
12
- `check` analyzes the change and runs inferred full and selected test commands when possible. It
13
- prints paired runtime when both pass and sends nothing to DiffCI Cloud. Test commands may change
14
- the checkout. Use `observe --no-send` when you need analysis without running tests.
13
+ `verify --changed` snapshots staged, unstaged, and non-ignored untracked content, runs the selected
14
+ command or a conservative full fallback, and fails unless that exact snapshot passes and remains
15
+ unchanged. Its JSON receipt is designed for agents. Use `check` for paired full-versus-selected
16
+ measurement and `observe --no-send` for analysis without test execution.
15
17
 
16
18
  ## Install Agent Instructions
17
19
 
@@ -29,7 +31,8 @@ This writes:
29
31
  - `.github/copilot-instructions.md`
30
32
  - `diffci.config.json`
31
33
 
32
- Existing files are kept. Pass `--force` only when you intentionally want to replace them.
34
+ Existing instruction files are extended with a managed DiffCI rule when possible; unrelated content
35
+ is preserved. Pass `--force` only when you intentionally want to replace DiffCI-managed output.
33
36
 
34
37
  To also add a non-blocking GitHub Actions observer job:
35
38
 
@@ -43,6 +46,15 @@ Then verify the workflow:
43
46
  npx "@diffci.com/diffci@latest" verify-workflow
44
47
  ```
45
48
 
49
+ To add a blocking, commit-range verification check instead:
50
+
51
+ ```bash
52
+ npx "@diffci.com/diffci@latest" init --verification-workflow
53
+ ```
54
+
55
+ The generated check uploads a receipt and intentionally does not use `continue-on-error`. Make its
56
+ **DiffCI verification** job required only after it has passed in the repository's normal CI context.
57
+
46
58
  ## Copy-Paste Adoption
47
59
 
48
60
  For a maintainer-facing snippet, PR template, and GitHub search queries for repositories that already
@@ -89,9 +101,11 @@ Minimal MCP config:
89
101
 
90
102
  Agents should:
91
103
 
92
- - run `diffci check` before PR-ready answers when Git and Node.js are available;
93
- - call `diffci_check` when connected through MCP;
94
- - read the printed verdict, selected tests, fallback reasons, and report path;
104
+ - run `diffci verify --changed --json` before PR-ready answers for local edits;
105
+ - run `diffci verify --json` for a clean CI commit range;
106
+ - call `diffci_verify_changed` locally or `diffci_verify` in CI when connected through MCP;
107
+ - require `safe_to_continue: true` and read the receipt's verification, selected tests, fallback
108
+ reasons, command result, and snapshot identities;
95
109
  - use DiffCI output to choose focused follow-up validation;
96
110
  - keep the repository's required CI commands authoritative.
97
111
 
@@ -99,6 +113,7 @@ Agents should not:
99
113
 
100
114
  - skip required CI because DiffCI selected fewer tests;
101
115
  - treat `REFUSED` or `ERROR` as a passing validation;
116
+ - continue after a receipt says `safe_to_continue: false`;
102
117
  - configure hosted report sending unless the user explicitly supplies an endpoint and token.
103
118
 
104
119
  ## Open Core Boundary
@@ -1,7 +1,7 @@
1
1
  # DiffCI Distribution
2
2
 
3
- DiffCI has three install surfaces with the same initial contract: observe CI, write a report, and do
4
- not change what the host repository runs.
3
+ DiffCI has complementary install surfaces: a fail-closed agent verifier, a blocking CI verification
4
+ workflow, and an observation-only Action for measuring opportunities without changing required CI.
5
5
 
6
6
  The product model is open core. The npm CLI and basic GitHub Action are the open-source adoption path;
7
7
  DiffCI Cloud adds hosted history, organization dashboards, policies, managed operations, and support.
@@ -13,8 +13,9 @@ Reviewed 2026-09-22. These channels have different jobs in the same adoption pat
13
13
 
14
14
  | Channel | Role for DiffCI | Next step |
15
15
  | --- | --- | --- |
16
- | npm | Developer discovery and local evaluation of `@diffci.com/diffci` | Lead with `observe`, a sample report, and the observation-only contract. |
17
- | GitHub Action | Repeatable CI adoption | Use the dedicated, non-blocking job below and verify the workflow before a pilot. |
16
+ | npm | Agent-native local and CI verification through `@diffci.com/diffci` | Lead with `verify --changed --json` and its content-bound receipt. |
17
+ | GitHub workflow | Repeatable blocking verification | Generate it with `init --verification-workflow`, pilot it, then make the job required. |
18
+ | GitHub Action | Observation-only adoption | Use the dedicated, non-blocking job below and verify the workflow before a pilot. |
18
19
  | GitHub Marketplace | CI-specific discovery of the same Action | [DiffCI observer is live](https://github.com/marketplace/actions/diffci-observer); keep the installation example and release pin current. |
19
20
  | MCP directories | Discovery for agents that install stdio tools | Publish matching npm and registry metadata, then submit to the official MCP Registry and Glama. |
20
21
  | Tidelift | Potential package maintenance assurance and maintainer income | Pursue package acceptance using the existing submission packet; do not present support as active. |
@@ -68,10 +69,10 @@ jobs:
68
69
  - uses: actions/checkout@v4
69
70
  with:
70
71
  fetch-depth: 0
71
- - uses: DiffCI/DiffCI.com@e1d7bab271c5d83899bda0034d70d3e34c10c1f7
72
+ - uses: DiffCI/DiffCI.com@2f72b7fc017cc987fb0fd80c7e2351f33240e7d4
72
73
  ```
73
74
 
74
- The example pins release `v0.2.11` to its qualified feature commit SHA. `npx "@diffci.com/diffci@latest" verify-workflow`
75
+ The example pins release `v0.3.0-rc.1` to its qualified feature commit SHA. `npx "@diffci.com/diffci@latest" verify-workflow`
75
76
  checks that the job is dedicated, read-only, not required by other jobs, and unable to alter the rest
76
77
  of CI.
77
78
 
@@ -80,10 +81,16 @@ of CI.
80
81
  The CLI is the standalone npm package surface. The package name is `@diffci.com/diffci`:
81
82
 
82
83
  ```bash
84
+ npx "@diffci.com/diffci@latest" verify --changed --json
85
+ npx "@diffci.com/diffci@latest" verify --json
83
86
  npx "@diffci.com/diffci@latest" observe
84
87
  npx "@diffci.com/diffci@latest" verify-workflow
85
88
  ```
86
89
 
90
+ `verify --changed` covers staged, unstaged, and non-ignored untracked changes. `verify --json` covers
91
+ a clean CI commit range. Both execute the narrowest safe command, broaden to the full inferred test
92
+ command on uncertainty, fail closed, and emit a `diffci.verification.v1` receipt.
93
+
87
94
  `observe` writes a JSON report outside the checkout by default. It never runs, skips, cancels, or
88
95
  reorders tests. A hosted endpoint is opt-in: reports are sent only when both `DIFFCI_API_URL` and
89
96
  `DIFFCI_TOKEN` are set, or when equivalent CLI flags are passed.
package/docs/mcp.md CHANGED
@@ -61,16 +61,24 @@ On Windows, keep the same command shape and use a Windows path:
61
61
  ```
62
62
 
63
63
  For Claude Desktop, Claude Code, Cursor, Codex-style MCP clients, and other stdio-compatible agents,
64
- name the server `diffci` and call `diffci_check` before PR-ready answers.
64
+ name the server `diffci` and call the verification tool that matches the change scope before PR-ready
65
+ answers.
65
66
 
66
67
  Available tools:
67
68
 
69
+ - `diffci_verify_changed` - verifies staged, unstaged, and non-ignored untracked changes and returns a
70
+ machine-readable, content-bound receipt.
71
+ - `diffci_verify` - verifies a clean commit range, resolving the CI range automatically or accepting
72
+ explicit base and head revisions.
68
73
  - `diffci_check` - runs `diffci check`, including inferred full and selected test commands.
69
74
  - `diffci_init` - runs `diffci init` to seed agent instruction files.
70
75
  - `diffci_verify_workflow` - runs `diffci verify-workflow` to check non-interference.
71
76
 
72
- The stdio MCP server delegates to the same open-source CLI. `diffci_check` sends nothing to DiffCI Cloud,
73
- but it runs test commands when it can infer them. Use the CLI's `observe --no-send` for analysis only.
77
+ The verification tools return the same `diffci.verification.v1` receipt as the CLI, including
78
+ `verification`, `safe_to_continue`, change and selection counts, fallback reasoning, the executed
79
+ command result, and checkout identities. The stdio MCP server delegates to the same open-source CLI
80
+ and sends nothing to DiffCI Cloud. Verification runs repository test commands; use the CLI's
81
+ `observe --no-send` for analysis only.
74
82
 
75
83
  Keep required project CI authoritative. DiffCI output is a validation lens, not permission to skip
76
84
  required checks.
@@ -88,5 +96,5 @@ Discovery links:
88
96
 
89
97
  Short description:
90
98
 
91
- > Change-aware CI/CD validation for AI coding agents. DiffCI analyzes the checkout, can run paired
92
- > full and selected test commands, and keeps required CI authoritative.
99
+ > Fail-closed, change-aware verification for AI coding agents. DiffCI selects the minimum justified
100
+ > test command, broadens to full verification on uncertainty, and returns a machine-readable receipt.
@@ -38,7 +38,7 @@ jobs:
38
38
  - uses: actions/checkout@v4
39
39
  with:
40
40
  fetch-depth: 0
41
- - uses: DiffCI/DiffCI.com@e1d7bab271c5d83899bda0034d70d3e34c10c1f7
41
+ - uses: DiffCI/DiffCI.com@2f72b7fc017cc987fb0fd80c7e2351f33240e7d4
42
42
  ```
43
43
 
44
44
  ## Outreach Copy
package/glama.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "DiffCI",
3
- "description": "Change-aware CI validation, affected-test selection, and workflow safety for coding agents.",
3
+ "description": "Fail-closed verification, affected-test selection, and workflow safety for AI coding agents.",
4
4
  "category": "developer-tools",
5
5
  "homepage": "https://diffci.com/mcp-server",
6
6
  "repository": "https://github.com/DiffCI/DiffCI.com",