@diffci.com/diffci 0.3.13 → 0.3.15
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.
- package/LICENSE +20 -661
- package/README.md +1 -1
- package/dist-client/src/client/agent-selection.js +4 -1
- package/dist-client/src/client/cli.js +143 -59
- package/dist-client/src/client/command-batches.js +80 -0
- package/dist-client/src/client/context.js +1 -1
- package/dist-client/src/client/enforce-misses-collect.js +157 -0
- package/dist-client/src/client/enforce-misses.js +229 -0
- package/dist-client/src/client/enforce-policy.js +169 -0
- package/dist-client/src/client/failure-baseline.js +99 -0
- package/dist-client/src/client/feedback-prompt.js +42 -0
- package/dist-client/src/client/mcp.js +1 -1
- package/dist-client/src/client/observe.js +12 -4
- package/dist-client/src/client/pilot-packet.js +0 -31
- package/dist-client/src/client/telemetry.js +46 -0
- package/dist-client/src/client/usage-signal.js +17 -10
- package/dist-client/src/client/verify-savings.js +12 -1
- package/dist-client/src/client/verify.js +81 -9
- package/dist-client/src/client/workflow-templates.js +80 -0
- package/node_modules/@diffci.com/core/README.md +13 -7
- package/node_modules/@diffci.com/core/dist/analyze.js +2 -1
- package/node_modules/@diffci.com/core/dist/analyze.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/cache/graph-cache.d.ts +1 -1
- package/node_modules/@diffci.com/core/dist/cache/graph-cache.js +1 -1
- package/node_modules/@diffci.com/core/dist/git/git-diff.d.ts +9 -0
- package/node_modules/@diffci.com/core/dist/git/git-diff.js +122 -19
- package/node_modules/@diffci.com/core/dist/git/git-diff.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/git/types.d.ts +9 -0
- package/node_modules/@diffci.com/core/dist/planner/test-command.js +16 -3
- package/node_modules/@diffci.com/core/dist/planner/test-command.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/adapters/maven.js +99 -42
- package/node_modules/@diffci.com/core/dist/repo/adapters/maven.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/compiled-projects.d.ts +16 -0
- package/node_modules/@diffci.com/core/dist/repo/compiled-projects.js +101 -0
- package/node_modules/@diffci.com/core/dist/repo/compiled-projects.js.map +1 -0
- package/node_modules/@diffci.com/core/dist/repo/file-references.d.ts +68 -0
- package/node_modules/@diffci.com/core/dist/repo/file-references.js +278 -0
- package/node_modules/@diffci.com/core/dist/repo/file-references.js.map +1 -0
- package/node_modules/@diffci.com/core/dist/repo/graph.d.ts +4 -2
- package/node_modules/@diffci.com/core/dist/repo/graph.js +107 -31
- package/node_modules/@diffci.com/core/dist/repo/graph.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/impact-types.d.ts +7 -1
- package/node_modules/@diffci.com/core/dist/repo/impact.d.ts +32 -0
- package/node_modules/@diffci.com/core/dist/repo/impact.js +241 -20
- package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/runner-universe.js +9 -3
- package/node_modules/@diffci.com/core/dist/repo/runner-universe.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/script-universe.d.ts +16 -0
- package/node_modules/@diffci.com/core/dist/repo/script-universe.js +173 -0
- package/node_modules/@diffci.com/core/dist/repo/script-universe.js.map +1 -0
- package/node_modules/@diffci.com/core/dist/repo/test-discovery.d.ts +12 -0
- package/node_modules/@diffci.com/core/dist/repo/test-discovery.js +54 -7
- package/node_modules/@diffci.com/core/dist/repo/test-discovery.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/types.d.ts +8 -0
- package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.d.ts +15 -0
- package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.js +157 -0
- package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.js.map +1 -0
- package/node_modules/@diffci.com/core/package.json +5 -0
- package/node_modules/@diffci.com/core/src/analyze.ts +2 -1
- package/node_modules/@diffci.com/core/src/cache/graph-cache.ts +1 -1
- package/node_modules/@diffci.com/core/src/git/git-diff.ts +106 -20
- package/node_modules/@diffci.com/core/src/git/types.ts +9 -0
- package/node_modules/@diffci.com/core/src/planner/test-command.ts +17 -3
- package/node_modules/@diffci.com/core/src/repo/adapters/maven.ts +120 -30
- package/node_modules/@diffci.com/core/src/repo/compiled-projects.ts +108 -0
- package/node_modules/@diffci.com/core/src/repo/file-references.ts +275 -0
- package/node_modules/@diffci.com/core/src/repo/graph.ts +104 -31
- package/node_modules/@diffci.com/core/src/repo/impact-types.ts +10 -0
- package/node_modules/@diffci.com/core/src/repo/impact.ts +243 -18
- package/node_modules/@diffci.com/core/src/repo/runner-universe.ts +6 -3
- package/node_modules/@diffci.com/core/src/repo/script-universe.ts +158 -0
- package/node_modules/@diffci.com/core/src/repo/test-discovery.ts +62 -7
- package/node_modules/@diffci.com/core/src/repo/types.ts +5 -0
- package/node_modules/@diffci.com/core/src/repo/workflow-test-steps.ts +117 -0
- package/package.json +6 -4
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { deliverUsageSignal } from "./usage-signal.js";
|
|
6
|
+
export function preferencePath(env) {
|
|
7
|
+
return join(env.DIFFCI_TELEMETRY_HOME ?? join(homedir(), ".diffci"), "telemetry.json");
|
|
8
|
+
}
|
|
9
|
+
export function readTelemetryPreference(env) {
|
|
10
|
+
try {
|
|
11
|
+
const value = JSON.parse(readFileSync(preferencePath(env), "utf8"));
|
|
12
|
+
if (!["off", "anonymous", "installations"].includes(value.mode))
|
|
13
|
+
throw new Error("invalid preference");
|
|
14
|
+
if (value.mode === "installations" && !/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value.installationId ?? ""))
|
|
15
|
+
throw new Error("invalid identifier");
|
|
16
|
+
return { mode: value.mode, internal: value.internal === true, ...(value.mode === "installations" ? { installationId: value.installationId } : {}) };
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return { mode: "off", internal: false };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function configureTelemetry(mode, internal, env) {
|
|
23
|
+
if (!["off", "anonymous", "installations"].includes(mode))
|
|
24
|
+
throw new Error("Choose off, anonymous, or installations.");
|
|
25
|
+
const previous = readTelemetryPreference(env);
|
|
26
|
+
const value = { mode: mode, internal,
|
|
27
|
+
...(mode === "installations" ? { installationId: previous.installationId ?? randomUUID() } : {}) };
|
|
28
|
+
const path = preferencePath(env);
|
|
29
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
30
|
+
writeFileSync(path, `${JSON.stringify(value)}\n`, { encoding: "utf8", mode: 0o600 });
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
export async function recordUsage(command, outcome, version, flags, env) {
|
|
34
|
+
// Explicit denial overrides saved consent and every opt-in route.
|
|
35
|
+
if (flags["no-send"] === true || env.DIFFCI_SHARE_USAGE === "0" || env.DIFFCI_NO_SEND === "1")
|
|
36
|
+
return;
|
|
37
|
+
const preference = readTelemetryPreference(env);
|
|
38
|
+
if (flags["share-usage"] !== true && env.DIFFCI_SHARE_USAGE !== "1" && preference.mode === "off")
|
|
39
|
+
return;
|
|
40
|
+
const result = await deliverUsageSignal({ command, outcome, version,
|
|
41
|
+
surface: env.DIFFCI_MCP === "1" ? "local-mcp" : "cli",
|
|
42
|
+
activity: flags["internal-usage"] === true || env.DIFFCI_USAGE_INTERNAL === "1" || preference.internal ? "internal" : "external",
|
|
43
|
+
...(preference.mode === "installations" ? { installationId: preference.installationId } : {}),
|
|
44
|
+
});
|
|
45
|
+
console.error(`DiffCI telemetry: ${result.status}${result.httpStatus ? ` (HTTP ${result.httpStatus})` : ""}. No repository content sent.`);
|
|
46
|
+
}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
export async function sendUsageSignal(input) {
|
|
3
|
-
const url = new URL(input.endpoint ?? "https://app.diffci.com/v1/usage-events");
|
|
4
|
-
if (url.protocol !== "https:")
|
|
5
|
-
return false;
|
|
1
|
+
export async function deliverUsageSignal(input) {
|
|
6
2
|
try {
|
|
3
|
+
const url = new URL(input.endpoint ?? "https://app.diffci.com/v1/usage-events");
|
|
4
|
+
if (url.protocol !== "https:")
|
|
5
|
+
return { status: "failed" };
|
|
7
6
|
const response = await (input.fetchImpl ?? fetch)(url, {
|
|
8
7
|
method: "POST",
|
|
9
8
|
headers: { "Content-Type": "application/json" },
|
|
10
|
-
body: JSON.stringify({ schema: "diffci.usage.v1", command: input.command, outcome: input.outcome, version: input.version
|
|
11
|
-
|
|
9
|
+
body: JSON.stringify({ schema: "diffci.usage.v1", command: input.command, outcome: input.outcome, version: input.version,
|
|
10
|
+
...(input.surface ? { surface: input.surface } : {}),
|
|
11
|
+
...(input.activity ? { activity: input.activity } : {}),
|
|
12
|
+
...(input.installationId ? { installation_id: input.installationId } : {}),
|
|
13
|
+
}),
|
|
14
|
+
signal: AbortSignal.timeout(5000),
|
|
12
15
|
});
|
|
13
|
-
return response.ok;
|
|
16
|
+
return { status: !response.ok ? "failed" : response.status === 202 ? "accepted" : "delivered", httpStatus: response.status };
|
|
14
17
|
}
|
|
15
|
-
catch {
|
|
16
|
-
return
|
|
18
|
+
catch (error) {
|
|
19
|
+
return { status: error instanceof Error && error.name === "TimeoutError" ? "timed-out" : "failed" };
|
|
17
20
|
}
|
|
18
21
|
}
|
|
22
|
+
export async function sendUsageSignal(input) {
|
|
23
|
+
const result = await deliverUsageSignal(input);
|
|
24
|
+
return result.status === "delivered" || result.status === "accepted";
|
|
25
|
+
}
|
|
@@ -3,6 +3,7 @@ import { createHash } from "node:crypto";
|
|
|
3
3
|
import { existsSync, lstatSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { arch, cpus, platform, release, totalmem } from "node:os";
|
|
5
5
|
import { basename, dirname, resolve } from "node:path";
|
|
6
|
+
import { failingTestNames } from "./failure-baseline.js";
|
|
6
7
|
import { classifyFailureFromEvidence, computeFailureFingerprint } from "../preflight/fingerprint.js";
|
|
7
8
|
function tail(value, bytes) {
|
|
8
9
|
if (Buffer.byteLength(value, "utf8") <= bytes)
|
|
@@ -237,6 +238,13 @@ function assessFailures(trials) {
|
|
|
237
238
|
}
|
|
238
239
|
return { kind: "inconclusive", confidence: "low", explanation: "The failures were not stable enough to classify conservatively.", evidence };
|
|
239
240
|
}
|
|
241
|
+
/** A `node --test` started while NODE_TEST_CONTEXT is set reports to that parent runner instead of
|
|
242
|
+
* running as its own suite, and exits 0 without executing anything. DiffCI launched from inside a test
|
|
243
|
+
* process (an agent's harness, DiffCI's own tests) must still measure the real suite (2026-10-21). */
|
|
244
|
+
function withoutTestRunnerContext(env) {
|
|
245
|
+
const { NODE_TEST_CONTEXT: _context, ...rest } = env;
|
|
246
|
+
return rest;
|
|
247
|
+
}
|
|
240
248
|
export function measureCommand(command, options) {
|
|
241
249
|
const startedAt = new Date().toISOString();
|
|
242
250
|
const started = Date.now();
|
|
@@ -252,7 +260,7 @@ export function measureCommand(command, options) {
|
|
|
252
260
|
shell: false,
|
|
253
261
|
windowsVerbatimArguments: process.platform === "win32",
|
|
254
262
|
env: {
|
|
255
|
-
...process.env,
|
|
263
|
+
...withoutTestRunnerContext(process.env),
|
|
256
264
|
CI: "1",
|
|
257
265
|
FORCE_COLOR: "0",
|
|
258
266
|
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0",
|
|
@@ -260,6 +268,8 @@ export function measureCommand(command, options) {
|
|
|
260
268
|
},
|
|
261
269
|
});
|
|
262
270
|
const finishedAt = new Date().toISOString();
|
|
271
|
+
const failingTests = result.status === 0 ? [] : failingTestNames(`${result.stdout ?? ""}
|
|
272
|
+
${result.stderr ?? ""}`);
|
|
263
273
|
return {
|
|
264
274
|
command,
|
|
265
275
|
exitCode: result.status,
|
|
@@ -270,6 +280,7 @@ export function measureCommand(command, options) {
|
|
|
270
280
|
wallMs: Date.now() - started,
|
|
271
281
|
stdoutTail: tail(result.stdout ?? "", options.tailBytes),
|
|
272
282
|
stderrTail: tail(result.stderr ?? "", options.tailBytes),
|
|
283
|
+
...(failingTests.length ? { failingTests } : {}),
|
|
273
284
|
};
|
|
274
285
|
}
|
|
275
286
|
export function buildVerifySavingsReport(input) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { mkdtempSync, rmSync } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
|
+
import { batchCommand, measureCommands } from "./command-batches.js";
|
|
5
|
+
import { compareWithBaseline } from "./failure-baseline.js";
|
|
6
|
+
import { collectEnforcementContext, evaluateEnforcement } from "./enforce-policy.js";
|
|
4
7
|
import { inferFullCommand, inferSelectedCommand } from "./full-command.js";
|
|
5
|
-
import { observe } from "./observe.js";
|
|
6
|
-
import { measureCommand } from "./verify-savings.js";
|
|
8
|
+
import { makeGitRunner, observe } from "./observe.js";
|
|
7
9
|
import { captureWorkingTreeSnapshot } from "./working-tree.js";
|
|
8
10
|
export const VERIFICATION_SCHEMA = "diffci.verification.v1";
|
|
9
11
|
function receiptRange(range) {
|
|
@@ -48,6 +50,18 @@ function unknownSnapshot() {
|
|
|
48
50
|
return { baseSha: "unknown", treeSha: "unknown", commitSha: "unknown", changed: true };
|
|
49
51
|
}
|
|
50
52
|
async function executeObservation(options, scope, before, observation) {
|
|
53
|
+
const enforcement = options.policy === "enforce"
|
|
54
|
+
? evaluateEnforcement(collectEnforcementContext(makeGitRunner(options.repoPath), options.env, observation), observation)
|
|
55
|
+
: undefined;
|
|
56
|
+
const report = await executeWithPolicy(options, scope, before, observation, enforcement);
|
|
57
|
+
if (!enforcement)
|
|
58
|
+
return report;
|
|
59
|
+
return { ...report, enforcement: { ...enforcement, applied: enforcement.fired_fallback === null && report.selection === "selected" } };
|
|
60
|
+
}
|
|
61
|
+
async function executeWithPolicy(options, scope, before, observation, enforcement) {
|
|
62
|
+
// Under enforce, a fired fallback runs the full suite even where plain verify would block: an
|
|
63
|
+
// unusable analysis is a reason to run everything, never a reason to pass with nothing run.
|
|
64
|
+
const enforcedFull = enforcement !== undefined && enforcement.fired_fallback !== null;
|
|
51
65
|
const result = observation.result;
|
|
52
66
|
const range = observation.commitRange;
|
|
53
67
|
const boundRange = scope === "commit-range" ? range : undefined;
|
|
@@ -62,14 +76,16 @@ async function executeObservation(options, scope, before, observation) {
|
|
|
62
76
|
mode: result?.mode,
|
|
63
77
|
fallback_reasons: result?.fallbackReasons ?? [],
|
|
64
78
|
error: observation.reason,
|
|
79
|
+
...(observation.timings?.totalMs !== undefined ? { duration_ms: observation.timings.totalMs } : {}),
|
|
80
|
+
...(result?.graph ? { graph_confidence: result.graph.confidence, effective_graph_confidence: result.graph.effectiveConfidence } : {}),
|
|
65
81
|
};
|
|
66
|
-
if (observation.status !== "OBSERVED" || !result) {
|
|
82
|
+
if ((observation.status !== "OBSERVED" || !result) && !enforcedFull) {
|
|
67
83
|
return blocked(before, scope, observation.reason ?? "DiffCI analysis did not produce a verification plan", analysis, counts, boundRange);
|
|
68
84
|
}
|
|
69
85
|
if (scope === "commit-range") {
|
|
70
|
-
if (!range)
|
|
86
|
+
if (!range && !enforcedFull)
|
|
71
87
|
return blocked(before, scope, "DiffCI did not resolve a commit range", analysis, counts);
|
|
72
|
-
if (range.headSha !== before.baseSha) {
|
|
88
|
+
if (range && range.headSha !== before.baseSha) {
|
|
73
89
|
return blocked(before, scope, `the analyzed head ${range.headSha} is not the checked-out HEAD ${before.baseSha}`, analysis, counts, range);
|
|
74
90
|
}
|
|
75
91
|
}
|
|
@@ -87,12 +103,14 @@ async function executeObservation(options, scope, before, observation) {
|
|
|
87
103
|
report.snapshot.after_tree_sha = afterAnalysis.treeSha;
|
|
88
104
|
return report;
|
|
89
105
|
}
|
|
90
|
-
const { selection, command, reason } =
|
|
106
|
+
const { selection, command, commands, reason, outsideSuite } = enforcedFull || !result
|
|
107
|
+
? fullSelection(options.repoPath, `enforce fallback (${enforcement?.fired_fallback}): ${enforcement?.detail}`)
|
|
108
|
+
: executableSelection(options.repoPath, result);
|
|
91
109
|
if (!command) {
|
|
92
110
|
const inferred = inferFullCommand(options.repoPath);
|
|
93
111
|
return blocked(before, scope, `no executable verification command is available: ${inferred.reason}`, analysis, counts, boundRange);
|
|
94
112
|
}
|
|
95
|
-
const execution =
|
|
113
|
+
const execution = measureCommands(commands, { cwd: options.repoPath, timeoutMs: options.timeoutMs, tailBytes: options.tailBytes });
|
|
96
114
|
let after;
|
|
97
115
|
try {
|
|
98
116
|
after = captureWorkingTreeSnapshot(options.repoPath);
|
|
@@ -103,6 +121,7 @@ async function executeObservation(options, scope, before, observation) {
|
|
|
103
121
|
...blocked(before, scope, `could not confirm the post-verification snapshot: ${message}`, analysis, counts, boundRange),
|
|
104
122
|
selection,
|
|
105
123
|
command,
|
|
124
|
+
...(commands.length > 1 ? { commands } : {}),
|
|
106
125
|
execution,
|
|
107
126
|
};
|
|
108
127
|
}
|
|
@@ -116,6 +135,13 @@ async function executeObservation(options, scope, before, observation) {
|
|
|
116
135
|
: execution.timedOut
|
|
117
136
|
? `verification timed out after ${options.timeoutMs}ms`
|
|
118
137
|
: `verification command failed with exit code ${String(execution.exitCode)}`;
|
|
138
|
+
const baselineSha = scope === "commit-range" ? range?.baseSha : before.baseSha;
|
|
139
|
+
const failureBaseline = verification === "failed" && !execution.timedOut && options.baselineOnFailure && baselineSha
|
|
140
|
+
? compareWithBaseline({ repoPath: options.repoPath, baseSha: baselineSha, headSha: scope === "commit-range" ? before.baseSha : before.commitSha, commands, headFailures: execution.failingTests ?? [], timeoutMs: options.timeoutMs })
|
|
141
|
+
: undefined;
|
|
142
|
+
const baselineNote = failureBaseline && failureBaseline.status !== "unknown"
|
|
143
|
+
? `; ${failureBaseline.reason} (${failureBaseline.base_sha.slice(0, 12)})`
|
|
144
|
+
: "";
|
|
119
145
|
return {
|
|
120
146
|
...baseReport(before, scope, boundRange),
|
|
121
147
|
verification,
|
|
@@ -124,8 +150,11 @@ async function executeObservation(options, scope, before, observation) {
|
|
|
124
150
|
changed_files: counts.changedFiles,
|
|
125
151
|
tests_available: counts.testsAvailable,
|
|
126
152
|
tests_selected: selection === "full" ? counts.testsAvailable : counts.testsSelected,
|
|
153
|
+
...(outsideSuite ? { tests_outside_full_suite: outsideSuite } : {}),
|
|
127
154
|
selection,
|
|
155
|
+
...(selection === "selected" && result ? { selected_tests: result.selectedTests } : {}),
|
|
128
156
|
command,
|
|
157
|
+
...(commands.length > 1 ? { commands } : {}),
|
|
129
158
|
execution,
|
|
130
159
|
snapshot: {
|
|
131
160
|
...baseReport(before, scope, boundRange).snapshot,
|
|
@@ -134,11 +163,19 @@ async function executeObservation(options, scope, before, observation) {
|
|
|
134
163
|
unchanged,
|
|
135
164
|
},
|
|
136
165
|
analysis,
|
|
137
|
-
required_actions: verification === "passed" ? [] : [finalReason],
|
|
166
|
+
required_actions: verification === "passed" ? [] : [finalReason + baselineNote],
|
|
167
|
+
...(failureBaseline ? { failure_baseline: failureBaseline } : {}),
|
|
138
168
|
};
|
|
139
169
|
}
|
|
170
|
+
function stamped(report, version) {
|
|
171
|
+
const { schema, schema_version, produced_at, ...rest } = report;
|
|
172
|
+
return { schema, schema_version, produced_at, diffci_version: version, ...rest };
|
|
173
|
+
}
|
|
140
174
|
/** Verify exactly the staged, unstaged, and non-ignored untracked content currently on disk. */
|
|
141
175
|
export async function verifyChanged(options) {
|
|
176
|
+
return stamped(await verifyChangedSnapshot(options), options.version);
|
|
177
|
+
}
|
|
178
|
+
async function verifyChangedSnapshot(options) {
|
|
142
179
|
const repoPath = resolve(options.repoPath);
|
|
143
180
|
let before;
|
|
144
181
|
try {
|
|
@@ -188,6 +225,9 @@ export async function verifyChanged(options) {
|
|
|
188
225
|
}
|
|
189
226
|
/** Verify a real commit range and bind the receipt to the clean commit that was actually executed. */
|
|
190
227
|
export async function verifyRange(options) {
|
|
228
|
+
return stamped(await verifyCommitRange(options), options.version);
|
|
229
|
+
}
|
|
230
|
+
async function verifyCommitRange(options) {
|
|
191
231
|
const repoPath = resolve(options.repoPath);
|
|
192
232
|
let before;
|
|
193
233
|
try {
|
|
@@ -238,8 +278,16 @@ export function formatVerificationSummary(report) {
|
|
|
238
278
|
lines.splice(2, 0, ` range: ${report.commit_range.base_sha.slice(0, 12)}..${report.commit_range.head_sha.slice(0, 12)}`);
|
|
239
279
|
if (report.command)
|
|
240
280
|
lines.push(` command: ${report.command}`);
|
|
281
|
+
if (report.enforcement) {
|
|
282
|
+
const fired = report.enforcement.fired_fallback;
|
|
283
|
+
lines.push(` enforce: ${report.enforcement.applied ? "applied" : fired ? `fell back to full (${fired}: ${report.enforcement.detail})` : "not applied"}`);
|
|
284
|
+
}
|
|
241
285
|
return lines.join("\n");
|
|
242
286
|
}
|
|
287
|
+
function fullSelection(repoPath, reason) {
|
|
288
|
+
const command = inferFullCommand(repoPath).command;
|
|
289
|
+
return { selection: "full", command, commands: command ? [command] : [], reason, outsideSuite: 0 };
|
|
290
|
+
}
|
|
243
291
|
/** Shared executable plan for read-only agent selection and verification. */
|
|
244
292
|
export function executableSelection(repoPath, result) {
|
|
245
293
|
let selection;
|
|
@@ -266,5 +314,29 @@ export function executableSelection(repoPath, result) {
|
|
|
266
314
|
const fallback = result.fallbackReasons[0] ?? result.commandRefusalReason;
|
|
267
315
|
reason = fallback ? `full verification required: ${fallback}` : "full verification required";
|
|
268
316
|
}
|
|
269
|
-
|
|
317
|
+
// Affected tests the full command never runs are still affected: run them after the selection
|
|
318
|
+
// rather than counting them in it (2026-10-21).
|
|
319
|
+
const outside = result.testsOutsideFullSuite ?? [];
|
|
320
|
+
let outsideSuite = 0;
|
|
321
|
+
let primary;
|
|
322
|
+
let auxiliaryCommand;
|
|
323
|
+
if (command && outside.length) {
|
|
324
|
+
const auxiliary = result.outsideSuiteCommands?.length === 1 ? inferSelectedCommand(repoPath, result.outsideSuiteCommands[0], outside) : undefined;
|
|
325
|
+
if (auxiliary?.command) {
|
|
326
|
+
primary = command;
|
|
327
|
+
auxiliaryCommand = auxiliary.command;
|
|
328
|
+
command = `${command} && ${auxiliary.command}`;
|
|
329
|
+
outsideSuite = outside.length;
|
|
330
|
+
reason = `${reason}; also ran ${outside.length} affected test file(s) the full test command does not run`;
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
reason = `${reason}; ${outside.length} affected test file(s) outside the full test command were not run (${auxiliary?.reason ?? "no single command covers them"})`;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
// Each part stays within the shell's command-line limit (cmd.exe stops at 8,191 characters).
|
|
337
|
+
const commands = command ? [
|
|
338
|
+
...batchCommand(primary ?? command, selection === "selected" ? result.selectedTests : []),
|
|
339
|
+
...(auxiliaryCommand ? batchCommand(auxiliaryCommand, outside) : []),
|
|
340
|
+
] : [];
|
|
341
|
+
return { selection, command: commands.length ? commands.join(" && ") : command, commands, reason, outsideSuite };
|
|
270
342
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** GitHub-hosted runner and Node 24 action pins shared by every workflow the CLI generates. */
|
|
2
|
+
export const RUNNER = "ubuntu-26.04";
|
|
3
|
+
export const CHECKOUT_SHA = "3d3c42e5aac5ba805825da76410c181273ba90b1"; // actions/checkout v7.0.1
|
|
4
|
+
export const SETUP_NODE_SHA = "820762786026740c76f36085b0efc47a31fe5020"; // actions/setup-node v7.0.0
|
|
5
|
+
export const UPLOAD_ARTIFACT_SHA = "043fb46d1a93c77aae656e7c1c64a875d1fc6a0a"; // actions/upload-artifact v7.0.1
|
|
6
|
+
export function diffciWorkflow(version) {
|
|
7
|
+
return `name: DiffCI observation
|
|
8
|
+
on: [push, pull_request]
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
jobs:
|
|
12
|
+
diffci:
|
|
13
|
+
runs-on: ${RUNNER}
|
|
14
|
+
continue-on-error: true
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@${CHECKOUT_SHA} # immutable checkout pin
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
- uses: actions/setup-node@${SETUP_NODE_SHA} # immutable setup-node pin
|
|
20
|
+
with:
|
|
21
|
+
node-version: 22
|
|
22
|
+
- run: npx "@diffci.com/diffci@${version}" observe --no-send
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
export function diffciVerificationWorkflow(version) {
|
|
26
|
+
return `name: DiffCI verification
|
|
27
|
+
on: [push, pull_request]
|
|
28
|
+
permissions:
|
|
29
|
+
contents: read
|
|
30
|
+
jobs:
|
|
31
|
+
diffci-verify:
|
|
32
|
+
name: DiffCI verification
|
|
33
|
+
runs-on: ${RUNNER}
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@${CHECKOUT_SHA} # immutable checkout pin
|
|
36
|
+
with:
|
|
37
|
+
fetch-depth: 0
|
|
38
|
+
ref: \${{ github.event.pull_request.head.sha || github.sha }}
|
|
39
|
+
- uses: actions/setup-node@${SETUP_NODE_SHA} # immutable setup-node pin
|
|
40
|
+
with:
|
|
41
|
+
node-version: 22
|
|
42
|
+
- name: Verify changed code
|
|
43
|
+
run: npx "@diffci.com/diffci@${version}" verify --json --out "$RUNNER_TEMP/diffci-verification.json"
|
|
44
|
+
- name: Upload verification receipt
|
|
45
|
+
if: always()
|
|
46
|
+
uses: actions/upload-artifact@${UPLOAD_ARTIFACT_SHA} # immutable upload-artifact v7 pin
|
|
47
|
+
with:
|
|
48
|
+
name: diffci-verification-\${{ github.run_id }}-\${{ github.run_attempt }}
|
|
49
|
+
path: \${{ runner.temp }}/diffci-verification.json
|
|
50
|
+
if-no-files-found: warn
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
export function buildPilotWorkflow(version) {
|
|
54
|
+
return `name: DiffCI pilot observation
|
|
55
|
+
on: [pull_request]
|
|
56
|
+
permissions:
|
|
57
|
+
contents: read
|
|
58
|
+
jobs:
|
|
59
|
+
diffci-pilot:
|
|
60
|
+
name: DiffCI pilot (non-blocking)
|
|
61
|
+
runs-on: ${RUNNER}
|
|
62
|
+
continue-on-error: true
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@${CHECKOUT_SHA} # immutable checkout pin
|
|
65
|
+
with:
|
|
66
|
+
fetch-depth: 0
|
|
67
|
+
- uses: actions/setup-node@${SETUP_NODE_SHA} # immutable setup-node pin
|
|
68
|
+
with:
|
|
69
|
+
node-version: 22
|
|
70
|
+
- name: Observe only
|
|
71
|
+
run: npx "@diffci.com/diffci@${version}" observe --no-send --out "$RUNNER_TEMP/diffci-observe.json"
|
|
72
|
+
- name: Upload local observation
|
|
73
|
+
if: always()
|
|
74
|
+
uses: actions/upload-artifact@${UPLOAD_ARTIFACT_SHA} # immutable upload-artifact v7 pin
|
|
75
|
+
with:
|
|
76
|
+
name: diffci-observation-\${{ github.run_id }}-\${{ github.run_attempt }}
|
|
77
|
+
path: \${{ runner.temp }}/diffci-observe.json
|
|
78
|
+
if-no-files-found: warn
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# DiffCI Core
|
|
2
2
|
|
|
3
|
+
[](https://mcprush.com/to/diffci-mcp?ref=badge)
|
|
4
|
+
|
|
3
5
|
**Open-source test-impact analysis for faster CI.** For developers and maintainers evaluating which tests a change affects, with conservative full-run fallbacks. Licensed under AGPL-3.0-only.
|
|
4
6
|
|
|
5
7
|
## Coding-agent plugins
|
|
@@ -7,7 +9,9 @@
|
|
|
7
9
|
The public [`integrations/agent-plugin`](integrations/agent-plugin) package
|
|
8
10
|
makes the published DiffCI CLI available as a checkout-aware local MCP plugin.
|
|
9
11
|
It contains only public marketplace metadata, skills, and a pinned npm
|
|
10
|
-
launcher; it does not include product services or private source.
|
|
12
|
+
launcher; it does not include product services or private source. The
|
|
13
|
+
[cross-agent installation guide](docs/agent-installation.md) covers Codex,
|
|
14
|
+
Claude Code, Cursor, Grok, Meta Muse Code, and generic MCP hosts.
|
|
11
15
|
|
|
12
16
|
```sh
|
|
13
17
|
# Codex
|
|
@@ -20,8 +24,10 @@ claude plugin install diffci@diffci-marketplace
|
|
|
20
24
|
```
|
|
21
25
|
|
|
22
26
|
Cursor Marketplace reads [`.cursor-plugin/marketplace.json`](.cursor-plugin/marketplace.json)
|
|
23
|
-
from this repository.
|
|
24
|
-
|
|
27
|
+
from this repository. Meta Muse Code reads the native root
|
|
28
|
+
[`marketplace.json`](marketplace.json). Before a public listing is approved,
|
|
29
|
+
use the local MCP configuration in the agent-plugin package or visit
|
|
30
|
+
https://diffci.com/mcp-server.
|
|
25
31
|
|
|
26
32
|
## GitHub Action
|
|
27
33
|
|
|
@@ -31,9 +37,9 @@ retains existing CI jobs, and uploads an advisory report. See the
|
|
|
31
37
|
[observer Action guide](docs/github-action-observer.md) and
|
|
32
38
|
[workflow example](examples/github-actions-observer.yml).
|
|
33
39
|
|
|
34
|
-
The [v0.3.10
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
The [v0.3.10 corresponding source](https://github.com/DiffCI/core/tree/4c76be14cec37d94eb7df93922f3c29d202f4e65/packages/diffci-cli)
|
|
41
|
+
remains publicly available at tagged Core commit `4c76be14` (`cli-v0.3.10-source`)
|
|
42
|
+
while distribution migrates to the Core-native CLI package.
|
|
37
43
|
|
|
38
44
|
Try the published CLI in an existing Git checkout with Git and Node.js 22.5+:
|
|
39
45
|
|
|
@@ -93,7 +99,7 @@ Declared pnpm workspaces with a single Vitest test phase can receive package-loc
|
|
|
93
99
|
| Reproducible evaluation | Synthetic benchmark and portable regression tests |
|
|
94
100
|
| Measurement | Current-process wall time, CPU time and ending RSS; explicit-input cost/energy/carbon estimates |
|
|
95
101
|
|
|
96
|
-
The library entry point exports `analyzeCheckout`, `buildDependencyGraph`, `ImpactAnalyzer`, `DefaultCIPlanner`, `collectEvidence`, `inferPipeline`, `measure` and `estimateImpact`. Lower-level modules are available as package subpaths. This repository is the engine source
|
|
102
|
+
The library entry point exports `analyzeCheckout`, `buildDependencyGraph`, `ImpactAnalyzer`, `DefaultCIPlanner`, `collectEvidence`, `inferPipeline`, `measure` and `estimateImpact`. Lower-level modules are available as package subpaths. This repository is the engine source, and the published [`@diffci.com/diffci` CLI](https://www.npmjs.com/package/@diffci.com/diffci) is released from it. The corresponding source for the previously published v0.3.10 package is retained in the [source archive at tagged commit `4c76be14`](https://github.com/DiffCI/core/tree/4c76be14cec37d94eb7df93922f3c29d202f4e65/packages/diffci-cli).
|
|
97
103
|
|
|
98
104
|
```sh
|
|
99
105
|
npm run typecheck
|
|
@@ -5,6 +5,7 @@ import { realpathSync } from "node:fs";
|
|
|
5
5
|
import { analyzeGitDelta } from "./git/git-diff.js";
|
|
6
6
|
import { buildDependencyGraph } from "./repo/graph.js";
|
|
7
7
|
import { ImpactAnalyzer } from "./repo/impact.js";
|
|
8
|
+
import { repositoryFileReader } from "./repo/file-references.js";
|
|
8
9
|
import { DefaultCIPlanner } from "./planner/planner.js";
|
|
9
10
|
import { buildGenericTaskRegistry } from "./research/baseline/registry.js";
|
|
10
11
|
import { parseRepositoryWorkflows } from "./research/baseline/workflow-parser.js";
|
|
@@ -28,7 +29,7 @@ export async function analyzeCheckout(options) {
|
|
|
28
29
|
if (!delta.success)
|
|
29
30
|
throw new Error(JSON.stringify(delta.error));
|
|
30
31
|
const graph = await buildDependencyGraph({ repoPath, excludeDirs: ["node_modules", ".git", "dist", "build", ".next", "coverage"] });
|
|
31
|
-
const impact = new ImpactAnalyzer().analyze(delta.delta, graph, graph.profile, { repositoryFiles: delta.inventory?.files });
|
|
32
|
+
const impact = new ImpactAnalyzer().analyze(delta.delta, graph, graph.profile, { repositoryFiles: delta.inventory?.files, readRepositoryFile: repositoryFileReader(repoPath) });
|
|
32
33
|
const registry = buildGenericTaskRegistry(graph.profile, "typescript", parseRepositoryWorkflows(graph.profile, repoPath));
|
|
33
34
|
const plan = new DefaultCIPlanner(registry).plan({ delta: delta.delta, impact, profile: graph.profile });
|
|
34
35
|
return { adv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,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAChL,MAAM,QAAQ,GAAG,wBAAwB,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,wBAAwB,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC1H,MAAM,IAAI,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACzG,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
|
-
export const GRAPH_CACHE_SCHEMA_VERSION = "
|
|
5
|
+
export const GRAPH_CACHE_SCHEMA_VERSION = "3";
|
|
6
6
|
export function buildGraphCacheKey(inputs) {
|
|
7
7
|
const payload = JSON.stringify({
|
|
8
8
|
schema: GRAPH_CACHE_SCHEMA_VERSION,
|
|
@@ -24,6 +24,15 @@ export declare function normalizeDirectories(paths: Iterable<string>): string[];
|
|
|
24
24
|
* nothing safe to compare. This function only ever narrows true -> false, never invents a change that
|
|
25
25
|
* a path-based check didn't already flag. */
|
|
26
26
|
export declare function hasRelevantPackageJsonChange(oldContent: string | undefined, newContent: string | undefined): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* How a modified package.json changed:
|
|
29
|
+
* - `metadata`: only descriptive fields (hasRelevantPackageJsonChange is false);
|
|
30
|
+
* - `data`: only PACKAGE_JSON_DATA_FIELDS and scripts outside the test closure (`test`, its
|
|
31
|
+
* lifecycle hooks, install hooks, and every script they name) on either side - tests may read the
|
|
32
|
+
* file, so it is resolved by reference rather than ignored;
|
|
33
|
+
* - `behavioral`: anything else, including dependencies, engines, type, exports and unparseable JSON.
|
|
34
|
+
*/
|
|
35
|
+
export declare function packageJsonChangeKind(oldContent: string | undefined, newContent: string | undefined): "metadata" | "data" | "behavioral";
|
|
27
36
|
export declare function computeAnalysis(files: ChangedFile[]): GitDeltaAnalysis;
|
|
28
37
|
export declare function summarize(files: ChangedFile[]): GitDeltaSummary;
|
|
29
38
|
export declare function resolveCommitParents(sha: string, repoPath: string | undefined): string[];
|