@diffci.com/diffci 0.3.23 → 0.3.25
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/dist-client/src/client/agent-setup.d.ts +23 -0
- package/dist-client/src/client/agent-setup.js +111 -0
- package/dist-client/src/client/cli.js +26 -8
- package/dist-client/src/client/failure-baseline.js +0 -0
- package/dist-client/src/client/full-command.d.ts +10 -0
- package/dist-client/src/client/full-command.js +22 -0
- package/dist-client/src/client/hook.d.ts +1 -0
- package/dist-client/src/client/hook.js +9 -0
- package/dist-client/src/client/mcp.js +10 -4
- package/dist-client/src/client/observe.js +10 -5
- package/dist-client/src/client/verify.js +18 -3
- package/dist-client/src/client/workflow-templates.d.ts +2 -2
- package/dist-client/src/client/workflow-templates.js +2 -2
- package/node_modules/@diffci.com/core/README.md +7 -0
- 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 +3 -1
- package/node_modules/@diffci.com/core/dist/cache/graph-cache.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/git/git-diff.js +16 -0
- package/node_modules/@diffci.com/core/dist/git/git-diff.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/planner/test-command.d.ts +4 -0
- package/node_modules/@diffci.com/core/dist/planner/test-command.js +127 -20
- package/node_modules/@diffci.com/core/dist/planner/test-command.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/analyzer.js +9 -2
- package/node_modules/@diffci.com/core/dist/repo/analyzer.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/file-references.d.ts +22 -2
- package/node_modules/@diffci.com/core/dist/repo/file-references.js +70 -10
- package/node_modules/@diffci.com/core/dist/repo/file-references.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/graph.js +231 -28
- package/node_modules/@diffci.com/core/dist/repo/graph.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/impact.d.ts +28 -0
- package/node_modules/@diffci.com/core/dist/repo/impact.js +167 -11
- package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/test-discovery.d.ts +5 -1
- package/node_modules/@diffci.com/core/dist/repo/test-discovery.js +55 -6
- 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 +7 -0
- package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.d.ts +2 -2
- package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.js +7 -5
- package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.js.map +1 -1
- package/node_modules/@diffci.com/core/src/cache/graph-cache.ts +3 -1
- package/node_modules/@diffci.com/core/src/git/git-diff.ts +13 -0
- package/node_modules/@diffci.com/core/src/planner/test-command.ts +125 -16
- package/node_modules/@diffci.com/core/src/repo/analyzer.ts +9 -2
- package/node_modules/@diffci.com/core/src/repo/file-references.ts +74 -11
- package/node_modules/@diffci.com/core/src/repo/graph.ts +206 -30
- package/node_modules/@diffci.com/core/src/repo/impact.ts +169 -12
- package/node_modules/@diffci.com/core/src/repo/test-discovery.ts +52 -8
- package/node_modules/@diffci.com/core/src/repo/types.ts +7 -0
- package/node_modules/@diffci.com/core/src/repo/workflow-test-steps.ts +8 -6
- package/node_modules/source-map-js/lib/quick-sort.js +10 -1
- package/node_modules/source-map-js/lib/source-map-consumer.js +51 -3
- package/node_modules/source-map-js/lib/source-map-generator.js +6 -4
- package/node_modules/source-map-js/lib/source-node.js +7 -0
- package/node_modules/source-map-js/package.json +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent integrations `diffci init` sets up by default (2026-11-04): the MCP server in the project
|
|
3
|
+
* configs Claude Code (`.mcp.json`) and Cursor (`.cursor/mcp.json`) read, and the diffci-verify skill
|
|
4
|
+
* in `.claude/skills`.
|
|
5
|
+
*
|
|
6
|
+
* WHY. Agents called DiffCI in 24 of over 1,500 test commands on DentalPresence, where it was only an
|
|
7
|
+
* instruction. Growth depends on the agent finding DiffCI's tools in the repository without anyone
|
|
8
|
+
* installing a plugin, so one `diffci init` now registers them. Each write keeps files and servers
|
|
9
|
+
* DiffCI did not write.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MCP_CONFIG_PATHS: readonly [".mcp.json", ".cursor/mcp.json"];
|
|
12
|
+
export declare const SKILL_PATH = ".claude/skills/diffci-verify/SKILL.md";
|
|
13
|
+
/** Same launcher as the portable agent plugin: `npx` through cmd.exe on Windows, where agents cannot spawn `npx.cmd` directly. */
|
|
14
|
+
export declare function mcpServerEntry(version: string): {
|
|
15
|
+
command: string;
|
|
16
|
+
args: string[];
|
|
17
|
+
};
|
|
18
|
+
/** Adds or updates the `diffci` server and leaves every other server untouched. */
|
|
19
|
+
export declare function writeMcpConfig(repoPath: string, relativePath: string, version: string, force: boolean): string;
|
|
20
|
+
/** Kept identical to integrations/agent-plugin/skills/diffci-verify/SKILL.md (tested). */
|
|
21
|
+
export declare const DIFFCI_VERIFY_SKILL = "---\nname: diffci-verify\ndescription: Select and verify affected tests after editing code in a local Git repository, using DiffCI MCP tools or the DiffCI CLI before reporting the change ready.\n---\n\nPass the absolute path of the edited repository as `repo` on every tool call.\n\nUse `diffci_changed_files` to inspect staged, unstaged, and non-ignored untracked\nchanges. Use `diffci_select_tests` or `diffci_explain_selection` when you need the\naffected-test plan, command, or reasons for full fallback. These tools run no tests;\ntheir counts describe test files, not passing test cases. A plan is not verification.\n\nBefore reporting an edited change ready, call `diffci_run_affected_tests`. It\nrecomputes the selection and verifies the current snapshot. Accept a passing result\nonly when `safe_to_continue` is true and `snapshot.unchanged` is true. After further\nedits, rerun verification. For a clean committed change, use `diffci_verify` with the\nintended base/head range instead; no uncommitted changes does not mean the commit\nhas been tested.\n\nIf MCP is unavailable, use the installed CLI:\n\n```bash\ndiffci verify --changed --repo /absolute/path/to/repository --json\n```\n\nIf DiffCI is not installed, use `npx \"@diffci.com/diffci@latest\" verify --changed`\nwith the same repo and JSON flags. On blocked analysis or installation failure,\nrun the repository's normal verification and report the limitation. On a test\nfailure, fix the cause and rerun. On snapshot changes from generated files, inspect\nthe files and rerun for that snapshot.\n\nReport executed command, selection scope (affected or full fallback), test-file\ncounts, outcome, and any outstanding required checks. Never infer passed suites,\ntest cases, skipped CI jobs, or measured savings from selection counts. Required\nproject CI stays authoritative.\n";
|
|
22
|
+
/** A skill file DiffCI wrote is recognised by its frontmatter name and updated; any other file is kept. */
|
|
23
|
+
export declare function writeSkill(repoPath: string, force: boolean): string;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Agent integrations `diffci init` sets up by default (2026-11-04): the MCP server in the project
|
|
5
|
+
* configs Claude Code (`.mcp.json`) and Cursor (`.cursor/mcp.json`) read, and the diffci-verify skill
|
|
6
|
+
* in `.claude/skills`.
|
|
7
|
+
*
|
|
8
|
+
* WHY. Agents called DiffCI in 24 of over 1,500 test commands on DentalPresence, where it was only an
|
|
9
|
+
* instruction. Growth depends on the agent finding DiffCI's tools in the repository without anyone
|
|
10
|
+
* installing a plugin, so one `diffci init` now registers them. Each write keeps files and servers
|
|
11
|
+
* DiffCI did not write.
|
|
12
|
+
*/
|
|
13
|
+
export const MCP_CONFIG_PATHS = [".mcp.json", ".cursor/mcp.json"];
|
|
14
|
+
export const SKILL_PATH = ".claude/skills/diffci-verify/SKILL.md";
|
|
15
|
+
/** Same launcher as the portable agent plugin: `npx` through cmd.exe on Windows, where agents cannot spawn `npx.cmd` directly. */
|
|
16
|
+
export function mcpServerEntry(version) {
|
|
17
|
+
return {
|
|
18
|
+
command: "node",
|
|
19
|
+
args: [
|
|
20
|
+
"-e",
|
|
21
|
+
`const { spawn } = require('node:child_process'); const npxArgs = ['--yes', '--package', '@diffci.com/diffci@${version}', 'diffci-mcp']; const child = process.platform === 'win32' ? spawn(process.env.ComSpec || 'cmd.exe', ['/d', '/s', '/c', 'npx', ...npxArgs], { stdio: 'inherit' }); child.once('error', (error) => { console.error('Failed to launch DiffCI MCP:', error.message); process.exit(1); }); child.once('exit', (code, signal) => process.exit(code ?? (signal ? 1 : 0)));`,
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function isDiffciEntry(entry) {
|
|
26
|
+
return JSON.stringify(entry ?? null).includes("@diffci.com/diffci");
|
|
27
|
+
}
|
|
28
|
+
/** Adds or updates the `diffci` server and leaves every other server untouched. */
|
|
29
|
+
export function writeMcpConfig(repoPath, relativePath, version, force) {
|
|
30
|
+
const absolutePath = join(repoPath, relativePath);
|
|
31
|
+
const entry = mcpServerEntry(version);
|
|
32
|
+
let config = {};
|
|
33
|
+
let existing;
|
|
34
|
+
if (existsSync(absolutePath)) {
|
|
35
|
+
existing = readFileSync(absolutePath, "utf8");
|
|
36
|
+
try {
|
|
37
|
+
const parsed = JSON.parse(existing);
|
|
38
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
39
|
+
throw new Error("not an object");
|
|
40
|
+
config = parsed;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return `kept ${relativePath} (not a JSON object; add the diffci MCP server by hand)`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const servers = config.mcpServers && typeof config.mcpServers === "object" ? config.mcpServers : {};
|
|
47
|
+
if (servers.diffci !== undefined && !isDiffciEntry(servers.diffci) && !force) {
|
|
48
|
+
return `kept ${relativePath} (its diffci server was not written by DiffCI; pass --force to replace it)`;
|
|
49
|
+
}
|
|
50
|
+
config.mcpServers = { ...servers, diffci: entry };
|
|
51
|
+
const next = `${JSON.stringify(config, null, 2)}\n`;
|
|
52
|
+
if (next === existing)
|
|
53
|
+
return `kept ${relativePath} (diffci MCP server current)`;
|
|
54
|
+
mkdirSync(dirname(absolutePath), { recursive: true });
|
|
55
|
+
writeFileSync(absolutePath, next, "utf8");
|
|
56
|
+
return `${existing === undefined ? "wrote" : "updated"} ${relativePath} (diffci MCP server)`;
|
|
57
|
+
}
|
|
58
|
+
/** Kept identical to integrations/agent-plugin/skills/diffci-verify/SKILL.md (tested). */
|
|
59
|
+
export const DIFFCI_VERIFY_SKILL = `---
|
|
60
|
+
name: diffci-verify
|
|
61
|
+
description: Select and verify affected tests after editing code in a local Git repository, using DiffCI MCP tools or the DiffCI CLI before reporting the change ready.
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
Pass the absolute path of the edited repository as \`repo\` on every tool call.
|
|
65
|
+
|
|
66
|
+
Use \`diffci_changed_files\` to inspect staged, unstaged, and non-ignored untracked
|
|
67
|
+
changes. Use \`diffci_select_tests\` or \`diffci_explain_selection\` when you need the
|
|
68
|
+
affected-test plan, command, or reasons for full fallback. These tools run no tests;
|
|
69
|
+
their counts describe test files, not passing test cases. A plan is not verification.
|
|
70
|
+
|
|
71
|
+
Before reporting an edited change ready, call \`diffci_run_affected_tests\`. It
|
|
72
|
+
recomputes the selection and verifies the current snapshot. Accept a passing result
|
|
73
|
+
only when \`safe_to_continue\` is true and \`snapshot.unchanged\` is true. After further
|
|
74
|
+
edits, rerun verification. For a clean committed change, use \`diffci_verify\` with the
|
|
75
|
+
intended base/head range instead; no uncommitted changes does not mean the commit
|
|
76
|
+
has been tested.
|
|
77
|
+
|
|
78
|
+
If MCP is unavailable, use the installed CLI:
|
|
79
|
+
|
|
80
|
+
\`\`\`bash
|
|
81
|
+
diffci verify --changed --repo /absolute/path/to/repository --json
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
If DiffCI is not installed, use \`npx "@diffci.com/diffci@latest" verify --changed\`
|
|
85
|
+
with the same repo and JSON flags. On blocked analysis or installation failure,
|
|
86
|
+
run the repository's normal verification and report the limitation. On a test
|
|
87
|
+
failure, fix the cause and rerun. On snapshot changes from generated files, inspect
|
|
88
|
+
the files and rerun for that snapshot.
|
|
89
|
+
|
|
90
|
+
Report executed command, selection scope (affected or full fallback), test-file
|
|
91
|
+
counts, outcome, and any outstanding required checks. Never infer passed suites,
|
|
92
|
+
test cases, skipped CI jobs, or measured savings from selection counts. Required
|
|
93
|
+
project CI stays authoritative.
|
|
94
|
+
`;
|
|
95
|
+
/** A skill file DiffCI wrote is recognised by its frontmatter name and updated; any other file is kept. */
|
|
96
|
+
export function writeSkill(repoPath, force) {
|
|
97
|
+
const absolutePath = join(repoPath, SKILL_PATH);
|
|
98
|
+
if (existsSync(absolutePath)) {
|
|
99
|
+
const existing = readFileSync(absolutePath, "utf8");
|
|
100
|
+
if (existing.replace(/\r\n/g, "\n") === DIFFCI_VERIFY_SKILL)
|
|
101
|
+
return `kept ${SKILL_PATH} (current)`;
|
|
102
|
+
if (!/^---\r?\nname: diffci-verify\r?\n/.test(existing) && !force) {
|
|
103
|
+
return `kept ${SKILL_PATH} (existing file not written by DiffCI; pass --force to replace it)`;
|
|
104
|
+
}
|
|
105
|
+
writeFileSync(absolutePath, DIFFCI_VERIFY_SKILL, "utf8");
|
|
106
|
+
return `updated ${SKILL_PATH}`;
|
|
107
|
+
}
|
|
108
|
+
mkdirSync(dirname(absolutePath), { recursive: true });
|
|
109
|
+
writeFileSync(absolutePath, DIFFCI_VERIFY_SKILL, "utf8");
|
|
110
|
+
return `wrote ${SKILL_PATH} (Claude Code skill)`;
|
|
111
|
+
}
|
|
@@ -36,7 +36,8 @@ import { observe, isInsideRepository } from "./observe.js";
|
|
|
36
36
|
import { resolveObservationAgent } from "./agent-identity.js";
|
|
37
37
|
import { inferFullCommand, inferComparableSelectedCommand, inferWorkspaceComparison } from "./full-command.js";
|
|
38
38
|
import { addDiffciPackageScripts, detectPackageManager, installDiffci } from "./install.js";
|
|
39
|
-
import { hookCommand, installPrePushHook } from "./hook.js";
|
|
39
|
+
import { hookCommand, installPrePushHook, isGitRepository } from "./hook.js";
|
|
40
|
+
import { MCP_CONFIG_PATHS, SKILL_PATH, writeMcpConfig, writeSkill } from "./agent-setup.js";
|
|
40
41
|
import { submitObservation } from "./submit.js";
|
|
41
42
|
import { configureGraphCache } from "./shared-graph-cache.js";
|
|
42
43
|
import { GraphCache } from "@diffci.com/core/cache/graph-cache";
|
|
@@ -283,7 +284,22 @@ function runInit(flags, env) {
|
|
|
283
284
|
if (includeVerificationWorkflow) {
|
|
284
285
|
writes.push(writeInitFile(repoPath, ".github/workflows/diffci-verify.yml", diffciVerificationWorkflow(identity.version), force));
|
|
285
286
|
}
|
|
286
|
-
|
|
287
|
+
// The hook, MCP server and skill are on by default so an agent meets DiffCI without being told to.
|
|
288
|
+
const skipped = [];
|
|
289
|
+
if (flags["no-mcp"] === true)
|
|
290
|
+
skipped.push("skipped the MCP server configs (--no-mcp)");
|
|
291
|
+
else
|
|
292
|
+
for (const path of MCP_CONFIG_PATHS)
|
|
293
|
+
writes.push(writeMcpConfig(repoPath, path, identity.version, force));
|
|
294
|
+
if (flags["no-skill"] === true)
|
|
295
|
+
skipped.push(`skipped ${SKILL_PATH} (--no-skill)`);
|
|
296
|
+
else
|
|
297
|
+
writes.push(writeSkill(repoPath, force));
|
|
298
|
+
if (flags["no-hook"] === true)
|
|
299
|
+
skipped.push("skipped the pre-push hook (--no-hook)");
|
|
300
|
+
else if (!isGitRepository(repoPath))
|
|
301
|
+
skipped.push("skipped the pre-push hook (not a Git repository; rerun init after git init)");
|
|
302
|
+
else
|
|
287
303
|
writes.push(installPrePushHook(repoPath, hookCommand(manager, identity.version), force));
|
|
288
304
|
console.log(`DiffCI initialized for AI coding agents in ${repoPath}`);
|
|
289
305
|
for (const write of writes)
|
|
@@ -292,8 +308,8 @@ function runInit(flags, env) {
|
|
|
292
308
|
console.log(` ${installed}`);
|
|
293
309
|
else
|
|
294
310
|
console.log(" skipped package installation (pass --install to add an exact dev dependency)");
|
|
295
|
-
|
|
296
|
-
console.log(
|
|
311
|
+
for (const line of skipped)
|
|
312
|
+
console.log(` ${line}`);
|
|
297
313
|
if (!includeWorkflow)
|
|
298
314
|
console.log(" skipped .github/workflows/diffci.yml (pass --workflow to add it)");
|
|
299
315
|
if (!includeVerificationWorkflow)
|
|
@@ -1067,7 +1083,7 @@ Open-source engine: https://github.com/DiffCI/core
|
|
|
1067
1083
|
Pilot a repository: https://diffci.com/#pilot
|
|
1068
1084
|
|
|
1069
1085
|
Usage:
|
|
1070
|
-
diffci init [--repo <path>] [--workflow] [--verification-workflow] [--install] [--hook] [--force]
|
|
1086
|
+
diffci init [--repo <path>] [--workflow] [--verification-workflow] [--install] [--no-hook] [--no-mcp] [--no-skill] [--force]
|
|
1071
1087
|
diffci mcp
|
|
1072
1088
|
diffci verify [--changed | --base <sha> --head <sha>] [--policy enforce] [--repo <path>] [--out <file>] [--json]
|
|
1073
1089
|
[--redact-paths] [--timeout-ms <ms>] [--baseline-on-failure] [--no-checks | --checks]
|
|
@@ -1098,12 +1114,14 @@ Usage:
|
|
|
1098
1114
|
[--head <sha>] [--rerun-junit <file>] [--open-issue]
|
|
1099
1115
|
diffci version
|
|
1100
1116
|
|
|
1101
|
-
init writes AGENTS.md, CLAUDE.md, Cursor rules, Copilot instructions, and diffci.config.json.
|
|
1102
|
-
|
|
1117
|
+
init writes AGENTS.md, CLAUDE.md, Cursor rules, Copilot instructions, and diffci.config.json. It also
|
|
1118
|
+
registers the DiffCI MCP server in .mcp.json (Claude Code) and .cursor/mcp.json (Cursor), keeping other
|
|
1119
|
+
servers, adds the diffci-verify skill to .claude/skills, and installs the pre-push hook; --no-mcp,
|
|
1120
|
+
--no-skill and --no-hook leave each out. --workflow adds a separate non-blocking observation workflow. --install detects npm, pnpm, Yarn,
|
|
1103
1121
|
or Bun, installs this DiffCI version as an exact dev dependency, updates the manager's lockfile,
|
|
1104
1122
|
and adds diffci:verify, diffci:check, and diffci:observe package scripts without replacing existing scripts.
|
|
1105
1123
|
--verification-workflow adds a blocking GitHub check that uploads a commit-bound verification receipt.
|
|
1106
|
-
|
|
1124
|
+
The pre-push hook runs diffci verify on the commits being pushed and blocks the push
|
|
1107
1125
|
when verification fails (git push --no-verify skips it; DIFFCI_HOOK_STRICT=1 also blocks when it cannot verify).
|
|
1108
1126
|
mcp runs the stdio MCP server for native agent integrations.
|
|
1109
1127
|
verify --changed snapshots staged, unstaged, and non-ignored untracked changes, runs the minimum
|
|
Binary file
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A selection the planner splits across several commands - a workspace package and the root suite, or
|
|
3
|
+
* several Vitest projects - rebuilt from the repository so only the planner's own commands run, each
|
|
4
|
+
* split to fit the shell. Before 2026-11-04 verify ran the full suite for any plan of more than one
|
|
5
|
+
* command (LobeHub: every narrowed commit, 27 minutes then a timeout).
|
|
6
|
+
*/
|
|
7
|
+
export declare function inferSelectedCommands(repoPath: string, proposed: readonly string[], selectedTests: readonly string[]): {
|
|
8
|
+
commands?: string[];
|
|
9
|
+
reason: string;
|
|
10
|
+
};
|
|
1
11
|
/** Rebuild the complete plan locally; never join arbitrary report commands. */
|
|
2
12
|
export declare function inferWorkspaceComparison(repoPath: string, proposed: readonly string[], selectedTests: readonly string[]): {
|
|
3
13
|
full?: string;
|
|
@@ -3,6 +3,28 @@ import { join } from "node:path";
|
|
|
3
3
|
import { readRepositoryConfig } from "@diffci.com/core/repo/repo-config";
|
|
4
4
|
import { analyzeRepository } from "@diffci.com/core/repo/analyzer";
|
|
5
5
|
import { commandSpecToString, planSelectiveTestCommands } from "@diffci.com/core/planner/test-command";
|
|
6
|
+
import { batchCommand } from "./command-batches.js";
|
|
7
|
+
/**
|
|
8
|
+
* A selection the planner splits across several commands - a workspace package and the root suite, or
|
|
9
|
+
* several Vitest projects - rebuilt from the repository so only the planner's own commands run, each
|
|
10
|
+
* split to fit the shell. Before 2026-11-04 verify ran the full suite for any plan of more than one
|
|
11
|
+
* command (LobeHub: every narrowed commit, 27 minutes then a timeout).
|
|
12
|
+
*/
|
|
13
|
+
export function inferSelectedCommands(repoPath, proposed, selectedTests) {
|
|
14
|
+
const plan = planSelectiveTestCommands(analyzeRepository({ repoPath }), selectedTests);
|
|
15
|
+
if (plan.refusalReason || !plan.commands.length)
|
|
16
|
+
return { reason: plan.refusalReason ?? "the plan has no commands" };
|
|
17
|
+
if (JSON.stringify(plan.commands.map(commandSpecToString)) !== JSON.stringify(proposed))
|
|
18
|
+
return { reason: "report commands differ from the verified plan" };
|
|
19
|
+
const commands = plan.groups.flatMap((group) => {
|
|
20
|
+
// The trailing arguments that name selected files, as the shell string spells them.
|
|
21
|
+
const paths = group.commandSpec.args
|
|
22
|
+
.filter((arg) => group.paths.some((path) => path === arg || path.endsWith(`/${arg}`)))
|
|
23
|
+
.map((arg) => commandSpecToString({ executable: "", args: [arg] }).slice(1));
|
|
24
|
+
return batchCommand(commandSpecToString(group.commandSpec), paths);
|
|
25
|
+
});
|
|
26
|
+
return { commands, reason: `${plan.commands.length} commands from the verified plan` };
|
|
27
|
+
}
|
|
6
28
|
/** Rebuild the complete plan locally; never join arbitrary report commands. */
|
|
7
29
|
export function inferWorkspaceComparison(repoPath, proposed, selectedTests) {
|
|
8
30
|
const profile = analyzeRepository({ repoPath });
|
|
@@ -22,6 +22,7 @@ export declare function prePushHook(command: string): string;
|
|
|
22
22
|
/** The command the hook runs: the installed binary when the repository has DiffCI as a dependency,
|
|
23
23
|
* otherwise a pinned npx invocation, so the hook never floats to a newer release. */
|
|
24
24
|
export declare function hookCommand(manager: "npm" | "pnpm" | "yarn" | "bun" | undefined, version: string): string;
|
|
25
|
+
export declare function isGitRepository(repoPath: string): boolean;
|
|
25
26
|
/** Writes the hook into the directory Git actually runs hooks from (`core.hooksPath` included, such as
|
|
26
27
|
* `.husky`). An existing hook DiffCI did not write is kept unless `force` is set. */
|
|
27
28
|
export declare function installPrePushHook(repoPath: string, command: string, force: boolean): string;
|
|
@@ -77,6 +77,15 @@ export function hookCommand(manager, version) {
|
|
|
77
77
|
default: return `npx --yes "@diffci.com/diffci@${version}"`;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
export function isGitRepository(repoPath) {
|
|
81
|
+
try {
|
|
82
|
+
execFileSync("git", ["rev-parse", "--git-dir"], { cwd: repoPath, stdio: "ignore", windowsHide: true });
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
80
89
|
/** Writes the hook into the directory Git actually runs hooks from (`core.hooksPath` included, such as
|
|
81
90
|
* `.husky`). An existing hook DiffCI did not write is kept unless `force` is set. */
|
|
82
91
|
export function installPrePushHook(repoPath, command, force) {
|
|
@@ -69,14 +69,16 @@ const tools = [
|
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
name: "diffci_init",
|
|
72
|
-
description: "Seed a repository with
|
|
72
|
+
description: "Seed a repository with DiffCI agent instruction files, MCP server configs, the diffci-verify skill and the pre-push hook.",
|
|
73
73
|
inputSchema: {
|
|
74
74
|
type: "object",
|
|
75
75
|
properties: {
|
|
76
76
|
repo: { type: "string", description: "Repository path. Defaults to the MCP server working directory." },
|
|
77
77
|
workflow: { type: "boolean", description: "Also add the non-blocking GitHub Actions observer workflow." },
|
|
78
78
|
verificationWorkflow: { type: "boolean", description: "Also add the blocking GitHub Actions verification workflow." },
|
|
79
|
-
hook: { type: "boolean", description: "
|
|
79
|
+
hook: { type: "boolean", description: "Install the Git pre-push hook that verifies the commits being pushed (default true)." },
|
|
80
|
+
mcp: { type: "boolean", description: "Register the DiffCI MCP server in .mcp.json and .cursor/mcp.json (default true)." },
|
|
81
|
+
skill: { type: "boolean", description: "Add the diffci-verify skill to .claude/skills (default true)." },
|
|
80
82
|
force: { type: "boolean", description: "Overwrite existing instruction files." },
|
|
81
83
|
},
|
|
82
84
|
additionalProperties: false,
|
|
@@ -160,8 +162,12 @@ function commandForTool(name, args) {
|
|
|
160
162
|
command.push("--workflow");
|
|
161
163
|
if (booleanArg(args, "verificationWorkflow"))
|
|
162
164
|
command.push("--verification-workflow");
|
|
163
|
-
if (
|
|
164
|
-
command.push("--hook");
|
|
165
|
+
if (args.hook === false)
|
|
166
|
+
command.push("--no-hook");
|
|
167
|
+
if (args.mcp === false)
|
|
168
|
+
command.push("--no-mcp");
|
|
169
|
+
if (args.skill === false)
|
|
170
|
+
command.push("--no-skill");
|
|
165
171
|
if (booleanArg(args, "force"))
|
|
166
172
|
command.push("--force");
|
|
167
173
|
return command;
|
|
@@ -222,14 +222,19 @@ export async function observe(options) {
|
|
|
222
222
|
};
|
|
223
223
|
const impact = new ImpactAnalyzer().analyze(delta, graphResult, profile, analyzeOptions);
|
|
224
224
|
const baseline = runPathBaseline(profile.testFilePaths, delta.files, profile);
|
|
225
|
-
const
|
|
225
|
+
const affected = impact.affectedTests.map((test) => test.path).sort();
|
|
226
|
+
// `outsideSuitePaths` is newer than some bundled engines, which never return it.
|
|
227
|
+
const firstPlan = impact.fallbackRequired ? undefined : planSelectiveTestCommands(profile, affected);
|
|
228
|
+
// Affected tests the plan finds the full test command never runs (every Vitest project that would
|
|
229
|
+
// include them excludes them) move beside the selection, as impact.ts moves tests a node:test script
|
|
230
|
+
// never runs (2026-11-04, LobeHub: `apps/desktop` tests refused every plan).
|
|
231
|
+
const planOutside = new Set(firstPlan?.outsideSuitePaths ?? []);
|
|
232
|
+
const selectedTests = affected.filter((path) => !planOutside.has(path));
|
|
233
|
+
const commandPlan = planOutside.size ? planSelectiveTestCommands(profile, selectedTests) : firstPlan;
|
|
226
234
|
// The comparator's own identities, sorted and redacted identically so the two arms of an economics
|
|
227
235
|
// experiment are executed the same way rather than merely counted the same way.
|
|
228
236
|
const comparatorSelectedTests = [...baseline.selectedTests].sort().map(hashPath);
|
|
229
|
-
const
|
|
230
|
-
? undefined
|
|
231
|
-
: planSelectiveTestCommands(profile, selectedTests);
|
|
232
|
-
const outsideSuite = (impact.testsOutsideFullSuite ?? []).map((test) => test.path).sort();
|
|
237
|
+
const outsideSuite = [...(impact.testsOutsideFullSuite ?? []).map((test) => test.path), ...planOutside].sort();
|
|
233
238
|
const outsidePlan = outsideSuite.length ? planSelectiveTestCommands(profile, outsideSuite) : undefined;
|
|
234
239
|
markPhase("impactAndCommands");
|
|
235
240
|
return finish("OBSERVED", "complete", {
|
|
@@ -4,7 +4,7 @@ import { join, resolve } from "node:path";
|
|
|
4
4
|
import { batchCommand, measureCommands } from "./command-batches.js";
|
|
5
5
|
import { checkAtBaseline, compareWithBaseline } from "./failure-baseline.js";
|
|
6
6
|
import { collectEnforcementContext, evaluateEnforcement } from "./enforce-policy.js";
|
|
7
|
-
import { inferFullCommand, inferSelectedCommand } from "./full-command.js";
|
|
7
|
+
import { inferFullCommand, inferSelectedCommand, inferSelectedCommands } from "./full-command.js";
|
|
8
8
|
import { plannedChecks, runChecks } from "./gate-checks.js";
|
|
9
9
|
import { makeGitRunner, observe } from "./observe.js";
|
|
10
10
|
import { selectedNodeTests, traceNodeTestFiles, unmatchedNodeTests, unstartedNodeTests } from "./selected-coverage.js";
|
|
@@ -388,7 +388,22 @@ export function executableSelection(repoPath, result) {
|
|
|
388
388
|
let command;
|
|
389
389
|
let reason;
|
|
390
390
|
let primaryPhases = [];
|
|
391
|
-
|
|
391
|
+
let selectedParts;
|
|
392
|
+
const multiple = result.mode === "SELECTIVE" && !result.commandRefusalReason && result.proposedCommands.length > 1
|
|
393
|
+
? inferSelectedCommands(repoPath, result.proposedCommands, result.selectedTests) : undefined;
|
|
394
|
+
if (multiple?.commands) {
|
|
395
|
+
selection = "selected";
|
|
396
|
+
selectedParts = multiple.commands;
|
|
397
|
+
command = multiple.commands.join(" && ");
|
|
398
|
+
primaryPhases = (result.testPhases ?? []).map(phaseCommand);
|
|
399
|
+
reason = `dependency impact (${multiple.reason})${primaryPhases.length ? `; also ran ${primaryPhases.length} test-script phase(s) that read changed files: ${result.testPhases.join("; ")}` : ""}`;
|
|
400
|
+
}
|
|
401
|
+
else if (multiple) {
|
|
402
|
+
selection = "full";
|
|
403
|
+
command = inferFullCommand(repoPath).command;
|
|
404
|
+
reason = `selected verification was not executable (${multiple.reason}); broadened to full verification`;
|
|
405
|
+
}
|
|
406
|
+
else if (result.mode === "SELECTIVE" && !result.commandRefusalReason && result.proposedCommands.length === 1) {
|
|
392
407
|
const inferred = inferSelectedCommand(repoPath, result.proposedCommands[0], result.selectedTests);
|
|
393
408
|
// A selected file the runner's glob would not match never runs, and the rest still pass (2026-11-01).
|
|
394
409
|
const unmatched = inferred.command ? unmatchedNodeTests(inferred.command, result.selectedTests) : [];
|
|
@@ -444,7 +459,7 @@ export function executableSelection(repoPath, result) {
|
|
|
444
459
|
}
|
|
445
460
|
// Each part stays within the shell's command-line limit (cmd.exe stops at 8,191 characters).
|
|
446
461
|
const commands = command ? [
|
|
447
|
-
...batchCommand(primary ?? command, selection === "selected" ? result.selectedTests : []),
|
|
462
|
+
...(selectedParts ?? batchCommand(primary ?? command, selection === "selected" ? result.selectedTests : [])),
|
|
448
463
|
...primaryPhases,
|
|
449
464
|
...(auxiliaryCommand ? batchCommand(auxiliaryCommand, outside) : []),
|
|
450
465
|
] : [];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** GitHub-hosted runner and Node 24 action pins shared by every workflow the CLI generates. */
|
|
2
2
|
export declare const RUNNER = "ubuntu-26.04";
|
|
3
3
|
export declare const CHECKOUT_SHA = "3d3c42e5aac5ba805825da76410c181273ba90b1";
|
|
4
|
-
export declare const SETUP_NODE_SHA = "
|
|
5
|
-
export declare const UPLOAD_ARTIFACT_SHA = "
|
|
4
|
+
export declare const SETUP_NODE_SHA = "949feb2413d6458794dcd2491c4babbbce0c15c1";
|
|
5
|
+
export declare const UPLOAD_ARTIFACT_SHA = "cf430e030ddbb5b0abf93d22962f4752f3646cd9";
|
|
6
6
|
export declare function diffciWorkflow(version: string): string;
|
|
7
7
|
export declare function diffciVerificationWorkflow(version: string): string;
|
|
8
8
|
export declare function buildPilotWorkflow(version: string): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** GitHub-hosted runner and Node 24 action pins shared by every workflow the CLI generates. */
|
|
2
2
|
export const RUNNER = "ubuntu-26.04";
|
|
3
3
|
export const CHECKOUT_SHA = "3d3c42e5aac5ba805825da76410c181273ba90b1"; // actions/checkout v7.0.1
|
|
4
|
-
export const SETUP_NODE_SHA = "
|
|
5
|
-
export const UPLOAD_ARTIFACT_SHA = "
|
|
4
|
+
export const SETUP_NODE_SHA = "949feb2413d6458794dcd2491c4babbbce0c15c1"; // actions/setup-node v7.1.0
|
|
5
|
+
export const UPLOAD_ARTIFACT_SHA = "cf430e030ddbb5b0abf93d22962f4752f3646cd9"; // actions/upload-artifact v7.0.2
|
|
6
6
|
export function diffciWorkflow(version) {
|
|
7
7
|
return `name: DiffCI observation
|
|
8
8
|
on: [push, pull_request]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# DiffCI Core
|
|
2
2
|
|
|
3
3
|
[](https://mcprush.com/to/diffci-mcp?ref=badge)
|
|
4
|
+
[](https://scorecard.dev/viewer/?uri=github.com/DiffCI/core)
|
|
4
5
|
|
|
5
6
|
**Affected checks before push, for AI coding agents.** DiffCI tells Claude Code, Codex, Cursor (or you) which tests and checks a change affects, so they run before the push instead of failing at the full CI gate afterwards. MIT licensed, runs locally, sends nothing by default, and falls back to the full suite whenever the evidence is incomplete.
|
|
6
7
|
|
|
@@ -10,6 +11,10 @@ npx "@diffci.com/diffci@latest" check
|
|
|
10
11
|
|
|
11
12
|
Run it in any Git checkout with Node.js 22.5+. [What the output means](docs/using-diffci.md).
|
|
12
13
|
|
|
14
|
+
[](https://www.youtube.com/watch?v=ychCnVVRQq0)
|
|
15
|
+
|
|
16
|
+
▶ [Watch the demo on YouTube](https://www.youtube.com/watch?v=ychCnVVRQq0)
|
|
17
|
+
|
|
13
18
|
## Why
|
|
14
19
|
|
|
15
20
|
Coding agents pass the narrow check they picked and miss wider breakage, then rerun the whole suite when they are unsure. We measured this on our own agent-built production app (about 1,100 commits in two months, most of them co-authored by Claude):
|
|
@@ -166,6 +171,8 @@ Sponsors' bug reports are labelled [`sponsor`](https://github.com/DiffCI/core/la
|
|
|
166
171
|
|
|
167
172
|
Only the explicitly extracted Core files and standalone tooling are in this repository. There is no private monorepo history, customer data, deployment configuration or Cloud implementation here. Core is usable independently; it is not a promise that the private product has already migrated to consume this package.
|
|
168
173
|
|
|
174
|
+
What stays in Core, and never moves to Cloud, is set out in [STEWARDSHIP.md](STEWARDSHIP.md). The plan DiffCI writes for each change is an open format other tools can produce or consume: [the change plan](docs/change-plan.md). Report vulnerabilities privately as described in [SECURITY.md](SECURITY.md).
|
|
175
|
+
|
|
169
176
|
## Contributing
|
|
170
177
|
|
|
171
178
|
Most open work is teaching DiffCI to narrow changes it currently treats as "run everything": config files, `package.json` edits and lockfiles. Each case is small and comes with a synthetic fixture, so you don't need to learn the whole engine. Python and Rust support are next and split into one-PR steps: see the [Python](https://github.com/DiffCI/core/issues/61) and [Rust](https://github.com/DiffCI/core/issues/62) tracking issues. Pick a [good first issue](https://github.com/DiffCI/core/issues?q=is%3Aopen+label%3A%22good+first+issue%22) and see [CONTRIBUTING.md](CONTRIBUTING.md); a dev container is included.
|
|
@@ -2,7 +2,9 @@
|
|
|
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
|
-
|
|
5
|
+
// 4: bounded computed loads have edges, and results carry runtimeTestSelection (2026-11-03).
|
|
6
|
+
// 5: inline type-only imports are type edges and vi.mock/jest.mock targets are edges (2026-11-04).
|
|
7
|
+
export const GRAPH_CACHE_SCHEMA_VERSION = "5";
|
|
6
8
|
export function buildGraphCacheKey(inputs) {
|
|
7
9
|
const payload = JSON.stringify({
|
|
8
10
|
schema: GRAPH_CACHE_SCHEMA_VERSION,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-cache.js","sourceRoot":"","sources":["../../src/cache/graph-cache.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,O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AC,GAAG,CAAC,CAAC;QACjC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,kFAAkF;YAClF,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -703,6 +703,22 @@ export async function analyzeGitDelta(options = {}) {
|
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
+
// 2026-11-03: a workspace package's package.json used to be an unknown file and a full run. One whose
|
|
707
|
+
// edit is limited to metadata and data fields (a release bumping `version`) cannot change how tests
|
|
708
|
+
// run, so its readers are resolved like the root's. A script edit stays unknown: the root's test
|
|
709
|
+
// command can run a workspace script by any name, so the package's own test closure does not bound it.
|
|
710
|
+
for (const file of filesWithBinary) {
|
|
711
|
+
if (file.changeType !== "modified" || !file.path.endsWith("/package.json") || file.path.split("/").includes("node_modules"))
|
|
712
|
+
continue;
|
|
713
|
+
const before = readFileAtSha(baseSha, file.path, repoPath);
|
|
714
|
+
const after = readFileAtSha(headSha, file.path, repoPath);
|
|
715
|
+
const change = packageJsonChange(before, after);
|
|
716
|
+
if (change.kind !== "metadata" && change.kind !== "data")
|
|
717
|
+
continue;
|
|
718
|
+
if (JSON.stringify(parsePackageScripts(before)) !== JSON.stringify(parsePackageScripts(after)))
|
|
719
|
+
continue;
|
|
720
|
+
referenceResolvedPaths.push(file.path);
|
|
721
|
+
}
|
|
706
722
|
// 2026-10-21: a workflow that cannot run tests (deploy, publish, scan) cannot change a test
|
|
707
723
|
// outcome. Both sides of the change are inspected, since removing a test step changes CI too.
|
|
708
724
|
if (analysis.workflowChanged) {
|