@diffci.com/diffci 0.3.15 → 0.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist-client/src/client/agent-selection.js +30 -0
  2. package/dist-client/src/client/cli.js +21 -2
  3. package/dist-client/src/client/gate-checks.js +120 -0
  4. package/dist-client/src/client/hook.js +94 -0
  5. package/dist-client/src/client/mcp.js +11 -3
  6. package/dist-client/src/client/observe.js +7 -2
  7. package/dist-client/src/client/verify.js +49 -8
  8. package/node_modules/@diffci.com/core/LICENSE +21 -661
  9. package/node_modules/@diffci.com/core/NOTICE +2 -2
  10. package/node_modules/@diffci.com/core/README.md +21 -3
  11. package/node_modules/@diffci.com/core/dist/analyze.js +1 -1
  12. package/node_modules/@diffci.com/core/dist/analyze.js.map +1 -1
  13. package/node_modules/@diffci.com/core/dist/cache/graph-cache.js +1 -1
  14. package/node_modules/@diffci.com/core/dist/cache/graph-cache.js.map +1 -1
  15. package/node_modules/@diffci.com/core/dist/ci-inference/evidence.js +1 -1
  16. package/node_modules/@diffci.com/core/dist/ci-inference/evidence.js.map +1 -1
  17. package/node_modules/@diffci.com/core/dist/ci-inference/infer.js +1 -1
  18. package/node_modules/@diffci.com/core/dist/ci-inference/infer.js.map +1 -1
  19. package/node_modules/@diffci.com/core/dist/ci-inference/jobs.js +1 -1
  20. package/node_modules/@diffci.com/core/dist/ci-inference/jobs.js.map +1 -1
  21. package/node_modules/@diffci.com/core/dist/ci-inference/purpose.js +1 -1
  22. package/node_modules/@diffci.com/core/dist/ci-inference/purpose.js.map +1 -1
  23. package/node_modules/@diffci.com/core/dist/ci-inference/resolve.js +1 -1
  24. package/node_modules/@diffci.com/core/dist/ci-inference/resolve.js.map +1 -1
  25. package/node_modules/@diffci.com/core/dist/ci-inference/schema.js +1 -1
  26. package/node_modules/@diffci.com/core/dist/ci-inference/schema.js.map +1 -1
  27. package/node_modules/@diffci.com/core/dist/cli.js +1 -1
  28. package/node_modules/@diffci.com/core/dist/cli.js.map +1 -1
  29. package/node_modules/@diffci.com/core/dist/git/git-diff.d.ts +29 -4
  30. package/node_modules/@diffci.com/core/dist/git/git-diff.js +136 -22
  31. package/node_modules/@diffci.com/core/dist/git/git-diff.js.map +1 -1
  32. package/node_modules/@diffci.com/core/dist/git/types.d.ts +7 -0
  33. package/node_modules/@diffci.com/core/dist/index.js +1 -1
  34. package/node_modules/@diffci.com/core/dist/index.js.map +1 -1
  35. package/node_modules/@diffci.com/core/dist/measurement.js +1 -1
  36. package/node_modules/@diffci.com/core/dist/measurement.js.map +1 -1
  37. package/node_modules/@diffci.com/core/dist/planner/check-narrowing.d.ts +45 -0
  38. package/node_modules/@diffci.com/core/dist/planner/check-narrowing.js +252 -0
  39. package/node_modules/@diffci.com/core/dist/planner/check-narrowing.js.map +1 -0
  40. package/node_modules/@diffci.com/core/dist/planner/pipeline-steps.d.ts +60 -0
  41. package/node_modules/@diffci.com/core/dist/planner/pipeline-steps.js +241 -0
  42. package/node_modules/@diffci.com/core/dist/planner/pipeline-steps.js.map +1 -0
  43. package/node_modules/@diffci.com/core/dist/planner/script-reads.d.ts +31 -0
  44. package/node_modules/@diffci.com/core/dist/planner/script-reads.js +197 -0
  45. package/node_modules/@diffci.com/core/dist/planner/script-reads.js.map +1 -0
  46. package/node_modules/@diffci.com/core/dist/planner/type-program.d.ts +33 -0
  47. package/node_modules/@diffci.com/core/dist/planner/type-program.js +106 -0
  48. package/node_modules/@diffci.com/core/dist/planner/type-program.js.map +1 -0
  49. package/node_modules/@diffci.com/core/dist/repo/compiled-projects.js +1 -1
  50. package/node_modules/@diffci.com/core/dist/repo/compiled-projects.js.map +1 -1
  51. package/node_modules/@diffci.com/core/dist/repo/file-references.d.ts +32 -0
  52. package/node_modules/@diffci.com/core/dist/repo/file-references.js +180 -9
  53. package/node_modules/@diffci.com/core/dist/repo/file-references.js.map +1 -1
  54. package/node_modules/@diffci.com/core/dist/repo/impact-types.d.ts +4 -0
  55. package/node_modules/@diffci.com/core/dist/repo/impact.d.ts +19 -0
  56. package/node_modules/@diffci.com/core/dist/repo/impact.js +105 -3
  57. package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
  58. package/node_modules/@diffci.com/core/dist/repo/npm-lockfile.d.ts +27 -0
  59. package/node_modules/@diffci.com/core/dist/repo/npm-lockfile.js +116 -0
  60. package/node_modules/@diffci.com/core/dist/repo/npm-lockfile.js.map +1 -0
  61. package/node_modules/@diffci.com/core/dist/repo/script-universe.js +1 -1
  62. package/node_modules/@diffci.com/core/dist/repo/script-universe.js.map +1 -1
  63. package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.js +1 -1
  64. package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.js.map +1 -1
  65. package/node_modules/@diffci.com/core/dist/repo/workspaces.js +1 -1
  66. package/node_modules/@diffci.com/core/dist/repo/workspaces.js.map +1 -1
  67. package/node_modules/@diffci.com/core/dist/research/baseline/matcher.js +1 -1
  68. package/node_modules/@diffci.com/core/dist/research/baseline/matcher.js.map +1 -1
  69. package/node_modules/@diffci.com/core/dist/research/baseline/test-activity.js +1 -1
  70. package/node_modules/@diffci.com/core/dist/research/baseline/test-activity.js.map +1 -1
  71. package/node_modules/@diffci.com/core/dist/research/baseline/workflow-parser.js +1 -1
  72. package/node_modules/@diffci.com/core/dist/research/baseline/workflow-parser.js.map +1 -1
  73. package/node_modules/@diffci.com/core/package.json +1 -1
  74. package/node_modules/@diffci.com/core/src/analyze.ts +1 -1
  75. package/node_modules/@diffci.com/core/src/cache/graph-cache.ts +1 -1
  76. package/node_modules/@diffci.com/core/src/ci-inference/causal.ts +1 -1
  77. package/node_modules/@diffci.com/core/src/ci-inference/evidence.ts +1 -1
  78. package/node_modules/@diffci.com/core/src/ci-inference/expression.ts +1 -1
  79. package/node_modules/@diffci.com/core/src/ci-inference/infer.ts +1 -1
  80. package/node_modules/@diffci.com/core/src/ci-inference/jobs.ts +1 -1
  81. package/node_modules/@diffci.com/core/src/ci-inference/matrix.ts +1 -1
  82. package/node_modules/@diffci.com/core/src/ci-inference/purpose.ts +1 -1
  83. package/node_modules/@diffci.com/core/src/ci-inference/reference-graph.ts +1 -1
  84. package/node_modules/@diffci.com/core/src/ci-inference/resolve.ts +1 -1
  85. package/node_modules/@diffci.com/core/src/ci-inference/schema.ts +1 -1
  86. package/node_modules/@diffci.com/core/src/cli.ts +1 -1
  87. package/node_modules/@diffci.com/core/src/git/git-diff.ts +127 -21
  88. package/node_modules/@diffci.com/core/src/git/types.ts +7 -0
  89. package/node_modules/@diffci.com/core/src/index.ts +1 -1
  90. package/node_modules/@diffci.com/core/src/measurement.ts +1 -1
  91. package/node_modules/@diffci.com/core/src/planner/check-narrowing.ts +269 -0
  92. package/node_modules/@diffci.com/core/src/planner/pipeline-steps.ts +243 -0
  93. package/node_modules/@diffci.com/core/src/planner/script-reads.ts +174 -0
  94. package/node_modules/@diffci.com/core/src/planner/type-program.ts +103 -0
  95. package/node_modules/@diffci.com/core/src/repo/compiled-projects.ts +1 -1
  96. package/node_modules/@diffci.com/core/src/repo/file-references.ts +170 -9
  97. package/node_modules/@diffci.com/core/src/repo/impact-types.ts +4 -0
  98. package/node_modules/@diffci.com/core/src/repo/impact.ts +115 -2
  99. package/node_modules/@diffci.com/core/src/repo/npm-lockfile.ts +109 -0
  100. package/node_modules/@diffci.com/core/src/repo/script-universe.ts +1 -1
  101. package/node_modules/@diffci.com/core/src/repo/workflow-test-steps.ts +1 -1
  102. package/node_modules/@diffci.com/core/src/repo/workspaces.ts +1 -1
  103. package/node_modules/@diffci.com/core/src/research/baseline/matcher.ts +1 -1
  104. package/node_modules/@diffci.com/core/src/research/baseline/path-baseline.ts +1 -1
  105. package/node_modules/@diffci.com/core/src/research/baseline/registry.ts +1 -1
  106. package/node_modules/@diffci.com/core/src/research/baseline/test-activity.ts +1 -1
  107. package/node_modules/@diffci.com/core/src/research/baseline/workflow-parser.ts +1 -1
  108. package/package.json +2 -2
@@ -0,0 +1,197 @@
1
+ // SPDX-License-Identifier: MIT
2
+ /**
3
+ * Which paths does a repository check script read? (2026-10-29, docs/design/pipeline-impact.md, phase 1
4
+ * slice 3.)
5
+ *
6
+ * This is the inverse of the reference resolver (`src/repo/file-references.ts`): there the question is
7
+ * "which files name the changed path", here it is "which paths does this check name". Dogfood check
8
+ * scripts name what they walk: `sourceFiles(path.join(root, "src"))`, `join(root,
9
+ * "ops/cloudflare/d1-migrations")`, `readFileSync(join(root, "package.json"))`. A script that names `src`
10
+ * reads everything under `src/`; a change elsewhere cannot change its result.
11
+ *
12
+ * THE RULE. The script's closure is the script file plus every relative module it imports, transitively.
13
+ * Its reads are every string literal in the closure, and every argument on its command line, that is a
14
+ * tracked file or directory (relative to the repository root or to the module's directory), plus the
15
+ * static prefix of each template literal. The check runs when a changed path:
16
+ *
17
+ * - is in the closure (the check's own code changed);
18
+ * - is, or is under, a path the closure names; or has a basename the closure names (`"index.ts"`);
19
+ * - is package.json or a lockfile and the closure imports a package or names package.json.
20
+ *
21
+ * FAILING CLOSED. The check runs as written, for any change, when its reads cannot be bounded: it runs
22
+ * another program (child_process), walks the repository root or the working directory, uses a glob that
23
+ * starts at the root, reads a path from the environment, its closure cannot be read or is too large, or the
24
+ * command is not `node`/`tsx`/`bun` running one JavaScript or TypeScript file.
25
+ *
26
+ * RESIDUAL RISK. A path assembled from parts that never appear as literals (`["s", "rc"].join("")`) is not
27
+ * seen, as in the reference resolver. Required CI stays authoritative.
28
+ */
29
+ import { posix } from "node:path";
30
+ import ts from "typescript";
31
+ const MAX_CLOSURE = 400;
32
+ const LOCKFILE = /^(?:package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?)$/;
33
+ const SCRIPT_FILE = /\.(?:[cm]?js|[cm]?ts|tsx|jsx)$/;
34
+ const RESOLVE_EXTENSIONS = ["", ".js", ".mjs", ".cjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", "/index.js", "/index.mjs", "/index.ts", "/index.tsx"];
35
+ const VALUE_FLAGS = new Set(["--import", "-r", "--require", "--loader", "--experimental-loader", "--conditions", "-C", "--env-file", "--tsconfig"]);
36
+ const SPAWNS = /\bchild_process\b|\bexeca\b|\bzx\b|\bBun\.spawn|\bDeno\.Command/;
37
+ const ROOT_NAME = String.raw `(?:root|ROOT|repoRoot|REPO_ROOT|rootDir|ROOT_DIR|projectRoot|PROJECT_ROOT|repositoryRoot|REPOSITORY_ROOT|cwd|process\.cwd\(\)|["'\`]\.{0,2}\/?["'\`])`;
38
+ /** A directory walk, glob or listing that starts at the repository root or the working directory. */
39
+ const WALKS_ROOT = new RegExp(String.raw `\b(?:readdirSync|readdir|opendirSync|opendir|globSync|glob|globby|fg|fastGlob|walk\w*|list\w*|\w*[Ff]iles|scan\w*|collect\w*)\s*\(\s*${ROOT_NAME}\s*[,)]|\bcwd\s*:\s*${ROOT_NAME}|["'\`](?:\.\/)?\*\*`);
40
+ const ENV_PATH = /process\.env\.\w*(?:PATH|DIR|ROOT|FILE)\b|process\.env\[/;
41
+ /**
42
+ * String literals (and each template's static head) and module specifiers, read with the TypeScript
43
+ * parser: regular expressions, comments and templates with substitutions defeat a regex scan (one
44
+ * swallowed `path.join(root, "src")` across lines). Undefined when a `require` or `import()` takes a
45
+ * computed specifier.
46
+ */
47
+ function scanModule(path, text) {
48
+ const kind = /\.tsx$/.test(path) ? ts.ScriptKind.TSX : /\.[cm]?ts$/.test(path) ? ts.ScriptKind.TS : /\.jsx$/.test(path) ? ts.ScriptKind.JSX : ts.ScriptKind.JS;
49
+ const source = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, false, kind);
50
+ const literals = [];
51
+ const imports = [];
52
+ let computed = false;
53
+ const visit = (node) => {
54
+ if ((ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) && node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)) {
55
+ imports.push(node.moduleSpecifier.text);
56
+ }
57
+ else if (ts.isCallExpression(node) && (node.expression.kind === ts.SyntaxKind.ImportKeyword || (ts.isIdentifier(node.expression) && node.expression.text === "require"))) {
58
+ const [argument] = node.arguments;
59
+ if (argument && ts.isStringLiteralLike(argument))
60
+ imports.push(argument.text);
61
+ else
62
+ computed = true;
63
+ }
64
+ if (ts.isStringLiteralLike(node))
65
+ literals.push(node.text);
66
+ else if (ts.isTemplateExpression(node))
67
+ literals.push(node.head.text);
68
+ ts.forEachChild(node, visit);
69
+ };
70
+ visit(source);
71
+ return computed ? undefined : { literals, imports };
72
+ }
73
+ /** The file a `node`/`tsx`/`bun` leaf runs, and its remaining arguments. */
74
+ function scriptOf(command) {
75
+ const words = command.trim().split(/\s+/);
76
+ let index = 0;
77
+ if (words[index] === "npx") {
78
+ index++;
79
+ if (words[index] === "--no-install")
80
+ index++;
81
+ }
82
+ if (!["node", "tsx", "bun", "ts-node"].includes(words[index] ?? ""))
83
+ return undefined;
84
+ if (words[index] === "bun" && words[index + 1] === "run")
85
+ index++;
86
+ for (index++; index < words.length && words[index].startsWith("-"); index++) {
87
+ if (VALUE_FLAGS.has(words[index]))
88
+ index++;
89
+ }
90
+ const file = words[index];
91
+ if (!file || !SCRIPT_FILE.test(file) || /["'$`]/.test(command))
92
+ return undefined;
93
+ return { file: posix.normalize(file), args: words.slice(index + 1) };
94
+ }
95
+ function directories(files) {
96
+ const dirs = new Set();
97
+ for (const file of files)
98
+ for (let dir = posix.dirname(file); dir !== "." && !dirs.has(dir); dir = posix.dirname(dir))
99
+ dirs.add(dir);
100
+ return dirs;
101
+ }
102
+ /** Reads of the script's closure, or a reason they cannot be bounded. */
103
+ function collectReads(entry, args, input, files) {
104
+ const tracked = new Set(files);
105
+ const dirs = directories(files);
106
+ const reads = { closure: new Set(), paths: new Set(), basenames: new Set(), importsPackages: false };
107
+ const addLiteral = (literal, from) => {
108
+ const value = literal.replace(/\\\\/g, "/").trim();
109
+ if (!value || value.length > 300 || /[\s*?{}<>|]/.test(value.replace(/\/$/, "")))
110
+ return;
111
+ for (const base of [".", posix.dirname(from)]) {
112
+ const path = posix.normalize(posix.join(base, value)).replace(/\/$/, "");
113
+ if (path.startsWith("..") || path === ".")
114
+ continue;
115
+ if (tracked.has(path) || dirs.has(path))
116
+ reads.paths.add(path);
117
+ }
118
+ if (/^[\w@+-][\w.@+-]*\.\w+$/.test(value))
119
+ reads.basenames.add(value);
120
+ };
121
+ for (const arg of args)
122
+ addLiteral(arg, ".");
123
+ const queue = [entry];
124
+ while (queue.length) {
125
+ const module = queue.shift();
126
+ if (reads.closure.has(module))
127
+ continue;
128
+ if (reads.closure.size >= MAX_CLOSURE)
129
+ return `its import closure exceeds ${MAX_CLOSURE} files`;
130
+ const text = input.read(module);
131
+ if (text === undefined)
132
+ return `${module} could not be read`;
133
+ reads.closure.add(module);
134
+ if (SPAWNS.test(text))
135
+ return `${module} runs another program`;
136
+ if (WALKS_ROOT.test(text))
137
+ return `${module} walks the repository root`;
138
+ if (ENV_PATH.test(text))
139
+ return `${module} reads a path from the environment`;
140
+ const scanned = scanModule(module, text);
141
+ if (!scanned)
142
+ return `${module} loads a module by a computed name`;
143
+ for (const specifier of scanned.imports) {
144
+ // Path aliases (`@/lib/x`, `~/x`, `#x`) reach repository code this module cannot follow.
145
+ if (/^(?:@\/|~\/|#)/.test(specifier))
146
+ return `${module} imports ${specifier} through a path alias`;
147
+ if (specifier.startsWith(".")) {
148
+ const base = posix.normalize(posix.join(posix.dirname(module), specifier));
149
+ const resolved = RESOLVE_EXTENSIONS.map((ext) => base + ext).find((candidate) => tracked.has(candidate))
150
+ ?? (tracked.has(base.replace(/\.js$/, ".ts")) ? base.replace(/\.js$/, ".ts") : undefined);
151
+ if (resolved)
152
+ queue.push(resolved);
153
+ else
154
+ return `${module} imports ${specifier}, which is not a tracked file`;
155
+ }
156
+ else if (!specifier.startsWith("node:") && !/^(?:fs|path|os|url|util|assert|crypto|child_process|stream|events|zlib|readline|process|module|worker_threads|http|https|net|buffer|timers)(?:\/|$)/.test(specifier)) {
157
+ reads.importsPackages = true;
158
+ }
159
+ }
160
+ for (const literal of scanned.literals)
161
+ addLiteral(literal, module);
162
+ if (/__dirname|import\.meta\.(?:dirname|url)/.test(text) && posix.dirname(module) !== ".")
163
+ reads.paths.add(posix.dirname(module));
164
+ }
165
+ return reads;
166
+ }
167
+ /** RUN or SKIP for a check that runs one repository script; other checks are returned unchanged. */
168
+ export function decideScriptCheck(check, input) {
169
+ if (check.kind !== "script" || !input.files)
170
+ return check;
171
+ if (check.runsScript && input.lifecycleHooks !== false
172
+ && (input.scripts[`pre${check.script}`] !== undefined || input.scripts[`post${check.script}`] !== undefined))
173
+ return check;
174
+ const script = scriptOf(check.command);
175
+ if (!script)
176
+ return check;
177
+ const run = (reason) => ({ ...check, decision: "RUN", reason });
178
+ const reads = collectReads(script.file, script.args, input, input.files);
179
+ if (typeof reads === "string")
180
+ return run(`${reads}: runs for any change`);
181
+ for (const { path } of input.changes) {
182
+ if (reads.closure.has(path))
183
+ return run(`${path} changed, and the check runs it`);
184
+ const named = [...reads.paths].find((read) => path === read || path.startsWith(`${read}/`));
185
+ if (named)
186
+ return run(`reads ${named}, which contains ${path}`);
187
+ if (reads.basenames.has(posix.basename(path)))
188
+ return run(`names ${posix.basename(path)}`);
189
+ const base = posix.basename(path);
190
+ if ((path === "package.json" || LOCKFILE.test(base)) && (reads.importsPackages || reads.paths.has("package.json")))
191
+ return run(`${path} changed and the check imports packages`);
192
+ }
193
+ const shown = [...reads.paths].sort().slice(0, 4);
194
+ const more = reads.paths.size > shown.length ? ` and ${reads.paths.size - shown.length} more` : "";
195
+ return { ...check, decision: "SKIP", reason: `reads ${shown.length ? shown.join(", ") + more : "only its own code"}; no changed file there` };
196
+ }
197
+ //# sourceMappingURL=script-reads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script-reads.js","sourceRoot":"","sources":["../../src/planner/script-reads.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,KAAK,E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,eAAe,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAAE,OAAO,GAAG,CAAC,GAAG,IAAI,yCAAyC,CAAC,CAAC;IACnL,CAAC;IACD,MAAM,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACnG,OAAO,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,mBAAmB,yBAAyB,EAAE,CAAC;AAChJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Is a change inside a TypeScript program? (2026-10-29, docs/design/pipeline-impact.md, phase 1 slice 4.)
3
+ *
4
+ * `tsc --noEmit` and type-aware lint check a whole program, so a change anywhere in it can break a file
5
+ * that did not change, and they are never narrowed to files. But a change outside the program (docs, SQL,
6
+ * site HTML, a script no TypeScript imports) cannot change their result, and they can be skipped.
7
+ *
8
+ * THE RULE. The program is the tsconfig's root files (`files`, `include`, `exclude`, inherited through
9
+ * relative `extends`; `projectRoots` in compiled-projects.ts) plus whatever those roots import. A change is
10
+ * in the program when:
11
+ *
12
+ * - it is a root (added and deleted paths count: they enter or leave the program);
13
+ * - it is a tsconfig/jsconfig, package.json, a lockfile or any `.d.ts` (they change every file's types);
14
+ * - it is a file TypeScript can load (TypeScript, JavaScript, JSON) and some root's text names it in an
15
+ * import-like string (`"./x"`, `"@/lib/x"`, `"../data/x.json"`). TypeScript can only reach a non-root
16
+ * file through an import that names it.
17
+ *
18
+ * FAILING CLOSED. A tsconfig that cannot be read, or one that extends a package (whose `include` and
19
+ * `allowJs` are unknown) when a JavaScript file changed, counts as in the program.
20
+ */
21
+ import type { NarrowingInput } from "./check-narrowing.js";
22
+ export type ProgramMembership = {
23
+ inProgram: true;
24
+ reason: string;
25
+ } | {
26
+ inProgram: false;
27
+ reason: string;
28
+ };
29
+ /** Root file texts, read once per narrowing pass. */
30
+ export type RootTextCache = Map<string, string | undefined>;
31
+ export declare function programMembership(config: string, input: NarrowingInput, cache?: RootTextCache): ProgramMembership;
32
+ /** The tsconfig a `tsc` leaf checks, or undefined when the command is not a plain project check. */
33
+ export declare function tscProject(command: string): string | undefined;
@@ -0,0 +1,106 @@
1
+ // SPDX-License-Identifier: MIT
2
+ /**
3
+ * Is a change inside a TypeScript program? (2026-10-29, docs/design/pipeline-impact.md, phase 1 slice 4.)
4
+ *
5
+ * `tsc --noEmit` and type-aware lint check a whole program, so a change anywhere in it can break a file
6
+ * that did not change, and they are never narrowed to files. But a change outside the program (docs, SQL,
7
+ * site HTML, a script no TypeScript imports) cannot change their result, and they can be skipped.
8
+ *
9
+ * THE RULE. The program is the tsconfig's root files (`files`, `include`, `exclude`, inherited through
10
+ * relative `extends`; `projectRoots` in compiled-projects.ts) plus whatever those roots import. A change is
11
+ * in the program when:
12
+ *
13
+ * - it is a root (added and deleted paths count: they enter or leave the program);
14
+ * - it is a tsconfig/jsconfig, package.json, a lockfile or any `.d.ts` (they change every file's types);
15
+ * - it is a file TypeScript can load (TypeScript, JavaScript, JSON) and some root's text names it in an
16
+ * import-like string (`"./x"`, `"@/lib/x"`, `"../data/x.json"`). TypeScript can only reach a non-root
17
+ * file through an import that names it.
18
+ *
19
+ * FAILING CLOSED. A tsconfig that cannot be read, or one that extends a package (whose `include` and
20
+ * `allowJs` are unknown) when a JavaScript file changed, counts as in the program.
21
+ */
22
+ import { posix } from "node:path";
23
+ import { projectRoots } from "../repo/compiled-projects.js";
24
+ const CONFIG = /(?:^|\/)(?:tsconfig|jsconfig)[^/]*\.json$/;
25
+ const LOCKFILE = /^(?:package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?)$/;
26
+ const LOADABLE = /\.(?:[cm]?tsx?|[cm]?jsx?|json)$/;
27
+ const JAVASCRIPT = /\.[cm]?jsx?$/;
28
+ function escape(text) {
29
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
30
+ }
31
+ /** The name an import of `path` would end with: its stem, or its directory for an index file. */
32
+ function importName(path) {
33
+ const stem = posix.basename(path).replace(/\.(?:d\.)?[^.]+$/, "");
34
+ return stem === "index" && posix.dirname(path) !== "." ? posix.basename(posix.dirname(path)) : stem;
35
+ }
36
+ export function programMembership(config, input, cache = new Map()) {
37
+ const configText = input.read(config);
38
+ if (configText === undefined)
39
+ return { inProgram: true, reason: `${config} could not be read` };
40
+ const global = input.changes.find(({ path }) => CONFIG.test(path) || path === "package.json" || LOCKFILE.test(posix.basename(path)) || path.endsWith(".d.ts"));
41
+ if (global)
42
+ return { inProgram: true, reason: `${global.path} changed, which affects every file's types` };
43
+ // Added and deleted paths are matched too: they enter or leave the program.
44
+ const files = [...new Set([...(input.files ?? []), ...input.changes.map(({ path }) => path)])];
45
+ const roots = projectRoots(config, { files, read: input.read });
46
+ if (!roots)
47
+ return { inProgram: true, reason: `${config} could not be parsed` };
48
+ const rootSet = new Set(roots);
49
+ const root = input.changes.find(({ path }) => rootSet.has(path));
50
+ if (root)
51
+ return { inProgram: true, reason: `${root.path} is in the ${config} program` };
52
+ const packageBase = /"extends"\s*:\s*(?:\[[^\]]*)?"[^.]/.test(configText);
53
+ const loadable = input.changes.filter(({ path }) => LOADABLE.test(path));
54
+ if (packageBase) {
55
+ const script = loadable.find(({ path }) => JAVASCRIPT.test(path));
56
+ if (script)
57
+ return { inProgram: true, reason: `${config} extends a package, so ${script.path} may be compiled` };
58
+ }
59
+ for (const { path } of loadable) {
60
+ const pattern = new RegExp(`["'\`/]${escape(importName(path))}(?:\\.[\\w.]+)?["'\`]`);
61
+ for (const candidate of roots) {
62
+ if (!cache.has(candidate))
63
+ cache.set(candidate, input.read(candidate));
64
+ if (pattern.test(cache.get(candidate) ?? ""))
65
+ return { inProgram: true, reason: `${path} may be imported by ${candidate}` };
66
+ }
67
+ }
68
+ return { inProgram: false, reason: `no changed file is in the ${config} program` };
69
+ }
70
+ const TSC_VALUE_FLAGS = new Set(["-p", "--project", "--tsBuildInfoFile", "--pretty"]);
71
+ const TSC_BOOLEAN_FLAGS = new Set(["--noEmit", "--incremental", "--skipLibCheck", "--extendedDiagnostics", "--diagnostics", "--noErrorTruncation"]);
72
+ /** The tsconfig a `tsc` leaf checks, or undefined when the command is not a plain project check. */
73
+ export function tscProject(command) {
74
+ const words = command.trim().split(/\s+/);
75
+ let index = 0;
76
+ if (words[index] === "npx") {
77
+ index++;
78
+ if (words[index] === "--no-install")
79
+ index++;
80
+ }
81
+ if (words[index] !== "tsc")
82
+ return undefined;
83
+ let project = "tsconfig.json";
84
+ for (index++; index < words.length; index++) {
85
+ const word = words[index];
86
+ if (TSC_BOOLEAN_FLAGS.has(word))
87
+ continue;
88
+ if (!TSC_VALUE_FLAGS.has(word))
89
+ return undefined;
90
+ const value = words[++index];
91
+ if (value === undefined)
92
+ return undefined;
93
+ if (word === "--pretty" && !/^(?:true|false)$/.test(value)) {
94
+ index--;
95
+ continue;
96
+ }
97
+ if (word === "-p" || word === "--project") {
98
+ if (/["'$`]/.test(value))
99
+ return undefined;
100
+ const normalized = posix.normalize(value).replace(/\/$/, "");
101
+ project = normalized.endsWith(".json") ? normalized : posix.join(normalized, "tsconfig.json");
102
+ }
103
+ }
104
+ return project;
105
+ }
106
+ //# sourceMappingURL=type-program.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-program.js","sourceRoot":"","sources":["../../src/planner/type-program.ts"],"names":[],"mappings":"AAAA,+BAA+B;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,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC7D,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QAChG,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: AGPL-3.0-only
1
+ // SPDX-License-Identifier: MIT
2
2
  /**
3
3
  * Tests that observe code by compiling it (2026-10-21).
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"compiled-projects.js","sourceRoot":"","sources":["../../src/repo/compiled-projects.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,mBAAmB,GAAG,8GAA8G,CAAC;AAC3I,MAAM,cAAc,GAAG,8BAA8B,CAAC;AACtD,MAAM,UAAU,GAAG,4BAA4B,CAAC;AAkBhD,SAAS,QAAQ,CAAC,MAAc,EAAE,IAAkC,EAAE,KAAK,GAAG,CAAC;IAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1B,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IACtD,MAAM,MAAM,GAAG,EAAE,CAAC,yBAAyB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1D,IAAI,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,Q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AC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -45,6 +45,13 @@ export interface ReferenceResolutionInput {
45
45
  /** Changed files whose content analyzeGitDelta proved cannot change how tests run
46
46
  * (GitDeltaAnalysis.referenceResolvedPaths); a workflow reading them does not block. */
47
47
  contentCleared?: ReadonlySet<string>;
48
+ /** Treat a reader that tooling loads implicitly (wrangler config, Dockerfile, `*.config.*`) as
49
+ * unresolvable. Used for code: such a reader can run the file without anything naming it. */
50
+ implicitReadersUnresolvable?: boolean;
51
+ /** Resolve a file the root test script runs directly (`node scripts/test-security.js`) to that phase
52
+ * of the script instead of failing closed (ReferenceResolution.phases). Off by default: a caller
53
+ * that does not run the returned phases must keep the fallback. */
54
+ testPhases?: boolean;
48
55
  }
49
56
  export interface ReferenceResolution {
50
57
  /** Tests that name the file, directly or through a chain of non-code readers. */
@@ -59,10 +66,35 @@ export interface ReferenceResolution {
59
66
  kind: ReaderKind;
60
67
  via: string;
61
68
  }>;
69
+ /** Phases of the root test script, verbatim, that run a reader directly; the caller must run them.
70
+ * Only produced with `testPhases`. */
71
+ phases: string[];
62
72
  }
63
73
  /** Script names reachable from `npm test`, including lifecycle hooks and any script one of those bodies
64
74
  * names. Over-inclusive by design: a script name appearing anywhere in a reachable body is followed. */
65
75
  export declare function testScriptClosure(scripts: Readonly<Record<string, string>>): Set<string>;
76
+ /**
77
+ * Whether a script body names `target`, judged word by word (2026-10-28). The reference pattern alone
78
+ * matched a test script that lists `ops/cloudflare/src/a.test.mjs` as naming every file under
79
+ * `ops/cloudflare/`, because the directory is a prefix of the listed file - in one dogfood repository, whose
80
+ * `test` script lists ~60 files, that made every data file under `scripts/` and `ops/` unresolvable.
81
+ * A word that is a different concrete path names that file, not its directories. Anything the check
82
+ * cannot read as a plain path or glob (inline code, variables, quotes inside a word) still counts as
83
+ * naming the target whenever the reference pattern matches it.
84
+ */
85
+ export declare function scriptNamesPath(body: string, target: string, pattern: RegExp, { ancestors, cwd }?: {
86
+ ancestors?: boolean;
87
+ cwd?: string;
88
+ }): boolean;
89
+ /**
90
+ * Whether `content`, read from `readerPath`, names `target` (or, with `ancestors`, one of its
91
+ * directories), once each matching word is read as a whole path (2026-10-28). The reference pattern
92
+ * matches on the basename, so every `wrangler.jsonc` with `"main": "./src/index.js"` named every
93
+ * `src/index.js` in the repository, and `ops/cloudflare/src/a.js` named `ops/cloudflare/src/b.json` by
94
+ * sharing its directory. A word that resolves - from the reader's directory or the repository root - to
95
+ * a different file names that file. Bare names, globs and variables keep the conservative answer.
96
+ */
97
+ export declare function contentNamesPath(content: string, readerPath: string, target: string, pattern: RegExp, ancestors: boolean): boolean;
66
98
  /** Resolves who reads `filePath`. See the module comment for the rule and its limits. */
67
99
  export declare function resolveFileReferences(filePath: string, input: ReferenceResolutionInput): ReferenceResolution;
68
100
  export {};