@diffci.com/diffci 0.3.13 → 0.3.14

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 (65) hide show
  1. package/dist-client/src/client/agent-selection.js +4 -1
  2. package/dist-client/src/client/cli.js +4 -49
  3. package/dist-client/src/client/command-batches.js +80 -0
  4. package/dist-client/src/client/failure-baseline.js +99 -0
  5. package/dist-client/src/client/observe.js +11 -3
  6. package/dist-client/src/client/pilot-packet.js +0 -31
  7. package/dist-client/src/client/verify-savings.js +12 -1
  8. package/dist-client/src/client/verify.js +53 -5
  9. package/dist-client/src/client/workflow-templates.js +80 -0
  10. package/node_modules/@diffci.com/core/README.md +13 -7
  11. package/node_modules/@diffci.com/core/dist/analyze.js +2 -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.d.ts +1 -1
  14. package/node_modules/@diffci.com/core/dist/cache/graph-cache.js +1 -1
  15. package/node_modules/@diffci.com/core/dist/git/git-diff.d.ts +9 -0
  16. package/node_modules/@diffci.com/core/dist/git/git-diff.js +122 -19
  17. package/node_modules/@diffci.com/core/dist/git/git-diff.js.map +1 -1
  18. package/node_modules/@diffci.com/core/dist/git/types.d.ts +9 -0
  19. package/node_modules/@diffci.com/core/dist/planner/test-command.js +16 -3
  20. package/node_modules/@diffci.com/core/dist/planner/test-command.js.map +1 -1
  21. package/node_modules/@diffci.com/core/dist/repo/adapters/maven.js +99 -42
  22. package/node_modules/@diffci.com/core/dist/repo/adapters/maven.js.map +1 -1
  23. package/node_modules/@diffci.com/core/dist/repo/compiled-projects.d.ts +16 -0
  24. package/node_modules/@diffci.com/core/dist/repo/compiled-projects.js +101 -0
  25. package/node_modules/@diffci.com/core/dist/repo/compiled-projects.js.map +1 -0
  26. package/node_modules/@diffci.com/core/dist/repo/file-references.d.ts +68 -0
  27. package/node_modules/@diffci.com/core/dist/repo/file-references.js +278 -0
  28. package/node_modules/@diffci.com/core/dist/repo/file-references.js.map +1 -0
  29. package/node_modules/@diffci.com/core/dist/repo/graph.d.ts +4 -2
  30. package/node_modules/@diffci.com/core/dist/repo/graph.js +107 -31
  31. package/node_modules/@diffci.com/core/dist/repo/graph.js.map +1 -1
  32. package/node_modules/@diffci.com/core/dist/repo/impact-types.d.ts +7 -1
  33. package/node_modules/@diffci.com/core/dist/repo/impact.d.ts +32 -0
  34. package/node_modules/@diffci.com/core/dist/repo/impact.js +241 -20
  35. package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
  36. package/node_modules/@diffci.com/core/dist/repo/runner-universe.js +9 -3
  37. package/node_modules/@diffci.com/core/dist/repo/runner-universe.js.map +1 -1
  38. package/node_modules/@diffci.com/core/dist/repo/script-universe.d.ts +16 -0
  39. package/node_modules/@diffci.com/core/dist/repo/script-universe.js +173 -0
  40. package/node_modules/@diffci.com/core/dist/repo/script-universe.js.map +1 -0
  41. package/node_modules/@diffci.com/core/dist/repo/test-discovery.d.ts +12 -0
  42. package/node_modules/@diffci.com/core/dist/repo/test-discovery.js +54 -7
  43. package/node_modules/@diffci.com/core/dist/repo/test-discovery.js.map +1 -1
  44. package/node_modules/@diffci.com/core/dist/repo/types.d.ts +8 -0
  45. package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.d.ts +15 -0
  46. package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.js +157 -0
  47. package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.js.map +1 -0
  48. package/node_modules/@diffci.com/core/package.json +5 -0
  49. package/node_modules/@diffci.com/core/src/analyze.ts +2 -1
  50. package/node_modules/@diffci.com/core/src/cache/graph-cache.ts +1 -1
  51. package/node_modules/@diffci.com/core/src/git/git-diff.ts +106 -20
  52. package/node_modules/@diffci.com/core/src/git/types.ts +9 -0
  53. package/node_modules/@diffci.com/core/src/planner/test-command.ts +17 -3
  54. package/node_modules/@diffci.com/core/src/repo/adapters/maven.ts +120 -30
  55. package/node_modules/@diffci.com/core/src/repo/compiled-projects.ts +108 -0
  56. package/node_modules/@diffci.com/core/src/repo/file-references.ts +275 -0
  57. package/node_modules/@diffci.com/core/src/repo/graph.ts +104 -31
  58. package/node_modules/@diffci.com/core/src/repo/impact-types.ts +10 -0
  59. package/node_modules/@diffci.com/core/src/repo/impact.ts +243 -18
  60. package/node_modules/@diffci.com/core/src/repo/runner-universe.ts +6 -3
  61. package/node_modules/@diffci.com/core/src/repo/script-universe.ts +158 -0
  62. package/node_modules/@diffci.com/core/src/repo/test-discovery.ts +62 -7
  63. package/node_modules/@diffci.com/core/src/repo/types.ts +5 -0
  64. package/node_modules/@diffci.com/core/src/repo/workflow-test-steps.ts +117 -0
  65. package/package.json +2 -2
@@ -4,62 +4,119 @@ import { contribution } from "./types.js";
4
4
  function tags(xml, name) {
5
5
  const re = new RegExp(`<${name}\\b[^>]*>([\\s\\S]*?)<\\/${name}>`, "g");
6
6
  const out = [];
7
- let m;
8
- while ((m = re.exec(xml)))
9
- out.push((m[1] ?? "").trim());
7
+ let match;
8
+ while ((match = re.exec(xml)))
9
+ out.push((match[1] ?? "").trim());
10
10
  return out;
11
11
  }
12
12
  function first(xml, name) { return tags(xml, name)[0]; }
13
13
  function parsePom(path, xml) {
14
14
  const dir = posix.dirname(path) === "." ? "" : posix.dirname(path);
15
- const parent = first(xml, "parent") ?? "";
15
+ const parent = first(xml, "parent");
16
16
  const own = xml.replace(/<parent\b[^>]*>[\s\S]*?<\/parent>/, "");
17
- const deps = tags(xml, "dependency").map(x => ({ groupId: first(x, "groupId") ?? "", artifactId: first(x, "artifactId") ?? "" })).filter(x => x.artifactId);
18
- return { path, dir, groupId: first(own, "groupId") ?? first(parent, "groupId"), artifactId: first(own, "artifactId"), modules: tags(first(xml, "modules") ?? "", "module"), dependencies: deps };
17
+ // Nested plugin/dependency coordinates are not the project's own identity. In
18
+ // particular, a dependency's ${project.groupId} must not shadow an inherited ID.
19
+ const identity = own.replace(/<(dependencies|dependencyManagement|build|profiles|reporting|properties)\b[^>]*>[\s\S]*?<\/\1>/g, "");
20
+ const dependencies = tags(xml, "dependency")
21
+ .map(value => ({ groupId: first(value, "groupId") ?? "", artifactId: first(value, "artifactId") ?? "" }))
22
+ .filter(value => value.artifactId);
23
+ return {
24
+ path, dir,
25
+ groupId: first(identity, "groupId") ?? first(parent ?? "", "groupId"),
26
+ artifactId: first(identity, "artifactId"),
27
+ parent: parent === undefined ? undefined : { groupId: first(parent, "groupId") ?? "", artifactId: first(parent, "artifactId") ?? "" },
28
+ dependencies,
29
+ customSourceRoots: tags(xml, "sourceDirectory").some(root => root !== "src/main/java") ||
30
+ tags(xml, "testSourceDirectory").some(root => root !== "src/test/java"),
31
+ };
19
32
  }
20
33
  function under(dir, path) { return !dir || path === dir || path.startsWith(dir + "/"); }
21
- function owningPom(poms, file) { return poms.filter(p => under(p.dir, file)).sort((a, b) => b.dir.length - a.dir.length)[0]; }
22
- function javaFiles(context, poms, pom) { return context.files.filter(f => owningPom(poms, f) === pom && /\/src\/(?:main|test)\/(?:java|kotlin)\/.*\.(?:java|kt)$/.test("/" + f)); }
23
- function isTest(path) { return /\/src\/test\/(?:java|kotlin)\//.test("/" + path) && /(?:Test|Tests|TestCase|IT)\.(?:java|kt)$/.test(path); }
34
+ function owningPom(poms, file) {
35
+ return poms.filter(pom => under(pom.dir, file)).sort((a, b) => b.dir.length - a.dir.length)[0];
36
+ }
37
+ function isTest(path) {
38
+ return /\/src\/test\/(?:java|kotlin)\//.test("/" + path) &&
39
+ /^(?:Test.*|.*(?:Test|Tests|TestCase|IT))\.(?:java|kt)$/.test(posix.basename(path));
40
+ }
24
41
  export function analyzeMaven(context) {
25
- const r = contribution(mavenAdapter);
26
- const poms = context.files.filter(f => f === "pom.xml" || f.endsWith("/pom.xml")).map(path => parsePom(path, readFileSync(context.repoPath + "/" + path, "utf8")));
42
+ const result = contribution(mavenAdapter);
43
+ const poms = context.files.filter(file => file === "pom.xml" || file.endsWith("/pom.xml"))
44
+ .map(path => parsePom(path, readFileSync(context.repoPath + "/" + path, "utf8")));
27
45
  if (!poms.length) {
28
- r.blockers.push("Maven analysis found no pom.xml");
29
- return r;
46
+ result.blockers.push("Maven analysis found no pom.xml");
47
+ return result;
30
48
  }
31
- const byGA = new Map(poms.filter(p => p.artifactId).map(p => [`${p.groupId ?? ""}:${p.artifactId}`, p]));
32
- const byArtifact = new Map(poms.filter(p => p.artifactId).map(p => [p.artifactId, p]));
33
- const members = new Map(), anchors = new Map();
34
- for (const p of poms) {
35
- const files = javaFiles(context, poms, p);
36
- if (!files.length)
37
- continue;
38
- members.set(p, files);
39
- anchors.set(p, files[0]);
40
- r.sourcePaths.push(...files);
41
- for (const f of files)
42
- if (isTest(f)) {
43
- r.testFiles.push(f);
44
- r.testPackages[f] = p.dir || ".";
49
+ const byGA = new Map(poms.filter(pom => pom.artifactId).map(pom => [`${pom.groupId ?? ""}:${pom.artifactId}`, pom]));
50
+ const byArtifact = new Map(poms.filter(pom => pom.artifactId).map(pom => [pom.artifactId, pom]));
51
+ const findPom = (coordinates) => byGA.get(`${coordinates.groupId}:${coordinates.artifactId}`) ?? byArtifact.get(coordinates.artifactId);
52
+ const members = new Map();
53
+ const resources = new Map();
54
+ const anchors = new Map();
55
+ for (const pom of poms) {
56
+ if (pom.customSourceRoots)
57
+ result.blockers.push(`Maven ${pom.path}: custom source roots require full validation`);
58
+ // This static adapter does not construct Maven's effective model. A local parent's
59
+ // dependency declarations cannot safely be treated as belonging only to that POM.
60
+ const visited = new Set([pom]);
61
+ let parent = pom.parent && findPom(pom.parent);
62
+ while (parent && !visited.has(parent)) {
63
+ if (parent.dependencies.length) {
64
+ result.blockers.push(`Maven ${pom.path}: parent dependency inheritance requires full validation`);
65
+ break;
45
66
  }
67
+ visited.add(parent);
68
+ parent = parent.parent && findPom(parent.parent);
69
+ }
70
+ const owned = context.files.filter(file => owningPom(poms, file) === pom);
71
+ const sources = owned.filter(file => /\/src\/(?:main|test)\/(?:java|kotlin)\/.*\.(?:java|kt)$/.test("/" + file));
72
+ const assets = owned.filter(file => /\/src\/(?:main|test)\/resources\//.test("/" + file));
73
+ members.set(pom, sources);
74
+ resources.set(pom, assets);
75
+ const anchor = sources[0] ?? assets[0];
76
+ if (anchor)
77
+ anchors.set(pom, anchor);
78
+ result.sourcePaths.push(...sources);
79
+ result.assetPaths.push(...assets);
80
+ for (const file of sources) {
81
+ if (isTest(file)) {
82
+ result.testFiles.push(file);
83
+ result.testPackages[file] = pom.dir || ".";
84
+ }
85
+ }
46
86
  }
47
- for (const [p, files] of members) {
48
- const a = anchors.get(p);
49
- for (const f of files)
50
- if (f !== a)
51
- r.edges.push({ from: a, to: f, kind: "import" }, { from: f, to: a, kind: "import" });
52
- for (const d of p.dependencies) {
53
- const normalizedGroup = d.groupId.replace(/\$\{project\.groupId\}/g, p.groupId ?? "").replace(/\$\{pom\.groupId\}/g, p.groupId ?? "");
54
- const target = byGA.get(`${normalizedGroup}:${d.artifactId}`) ?? byArtifact.get(d.artifactId);
55
- const ta = target && anchors.get(target);
56
- if (ta && ta !== a)
57
- r.edges.push({ from: a, to: ta, kind: "import" });
87
+ for (const pom of poms) {
88
+ const anchor = anchors.get(pom);
89
+ if (anchor) {
90
+ for (const file of members.get(pom) ?? []) {
91
+ if (file !== anchor)
92
+ result.edges.push({ from: anchor, to: file, kind: "import" }, { from: file, to: anchor, kind: "import" });
93
+ }
94
+ // Resources are inputs to the entire module. Resource-only JARs also need an
95
+ // anchor so changes can reach tests in modules that depend on them.
96
+ for (const file of resources.get(pom) ?? []) {
97
+ if (file !== anchor)
98
+ result.edges.push({ from: anchor, to: file, kind: "asset" });
99
+ }
100
+ }
101
+ for (const dependency of pom.dependencies) {
102
+ const groupId = dependency.groupId.replace(/\$\{project\.groupId\}/g, pom.groupId ?? "").replace(/\$\{pom\.groupId\}/g, pom.groupId ?? "");
103
+ if (/\$\{/.test(groupId) || /\$\{/.test(dependency.artifactId)) {
104
+ result.blockers.push(`Maven ${pom.path}: unresolved dependency coordinates require full validation`);
105
+ continue;
106
+ }
107
+ const target = findPom({ groupId, artifactId: dependency.artifactId });
108
+ const targetAnchor = target && anchors.get(target);
109
+ if (anchor && targetAnchor && targetAnchor !== anchor)
110
+ result.edges.push({ from: anchor, to: targetAnchor, kind: "import" });
58
111
  }
59
112
  }
60
- if (!r.sourcePaths.length)
61
- r.blockers.push("Maven reactor contains no Java sources");
62
- return r;
113
+ if (!result.sourcePaths.length)
114
+ result.blockers.push("Maven reactor contains no Java sources");
115
+ return result;
63
116
  }
64
- export const mavenAdapter = { id: "maven", version: "1", kind: "language", detect: ({ files }) => files.includes("pom.xml") && files.some(f => f.endsWith(".java") || f.endsWith(".kt")), analyze: analyzeMaven };
117
+ export const mavenAdapter = {
118
+ id: "maven", version: "2", kind: "language",
119
+ detect: ({ files }) => files.includes("pom.xml") && files.some(file => file.endsWith(".java") || file.endsWith(".kt")),
120
+ analyze: analyzeMaven,
121
+ };
65
122
  //# sourceMappingURL=maven.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"maven.js","sourceRoot":"","sources":["../../../src/repo/adapters/maven.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAW,KAAK,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAyE,MAAM,YAAY,CAAC;AAIjH,SAAS,IAAI,CAAC,GAAU,EAAE,IAAW;IACnC,MAAM,EAAE,GAAC,IAAI,MAAM,CAAC,IAAI,IAAI,4BAA4B,IAAI,GAAG,EAAC,GAAG,CAAC,CAAC;IAAC,MAAM,GAAG,GAAU,EAAE,CAAC;IAAC,IAAI,CAAsB,CAAC;IACxH,OAAM,CAAC,CAAC,GAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAAC,OAAO,GAAG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E,UAAU;IAC3C,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtH,OAAO,EAAE,YAAY;CACtB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export interface CompiledProjectInput {
2
+ files: readonly string[];
3
+ read: (path: string) => string | undefined;
4
+ isTestFile: (path: string) => boolean;
5
+ /** Every file a root transitively imports, from the dependency graph. */
6
+ dependenciesOf: (path: string) => readonly string[];
7
+ }
8
+ export interface CompiledProject {
9
+ config: string;
10
+ tests: string[];
11
+ files: ReadonlySet<string>;
12
+ }
13
+ /** Root files of a project, as tsc would list them before following imports. */
14
+ export declare function projectRoots(config: string, input: Pick<CompiledProjectInput, "files" | "read">): string[] | undefined;
15
+ /** Projects that some test compiles, with the tests and every file each compiles. */
16
+ export declare function compiledProjects(input: CompiledProjectInput): CompiledProject[];
@@ -0,0 +1,101 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * Tests that observe code by compiling it (2026-10-21).
4
+ *
5
+ * WHY. A test can check a TypeScript project without importing any of it, by running the compiler on
6
+ * a named project and then executing the output: `execFileSync(node, [".../typescript/bin/tsc", "-p",
7
+ * "tsconfig.client.json"])`, then spawning the built CLI. The dependency graph has no edge from such a
8
+ * test to the files it compiles, so a change that breaks the build selected nothing that would notice.
9
+ * Replaying a dogfood repository's history found exactly this: a change to `src/client/cli.ts`
10
+ * selected 117 tests and left out the one that builds and runs the CLI.
11
+ *
12
+ * THE RULE. A test that both invokes the compiler (tsc, typescript/bin/tsc, createProgram, --project)
13
+ * and names a `tsconfig*.json` that exists at HEAD compiles that project. The project is its root files
14
+ * (`files`, `include` and `exclude`, inherited through `extends` when absent) and everything those
15
+ * roots import, which is what tsc compiles too. A change to any of those files selects the test.
16
+ *
17
+ * Over-inclusion is the safe direction: a test that merely writes a tsconfig.json fixture and calls
18
+ * createProgram on a temporary repository is also treated as compiling the real project.
19
+ */
20
+ import { posix } from "node:path";
21
+ import ts from "typescript";
22
+ import { referencePattern, referenceTokens } from "./file-references.js";
23
+ import { matchesGlob } from "./test-discovery.js";
24
+ const COMPILER_INVOCATION = /["'`/\s]tsc(?:\.cmd)?["'`\s]|typescript["'`/,\s]+bin["'`/,\s]+tsc|\bcreateProgram\b|--project\b|["'`]-p["'`]/;
25
+ const PROJECT_CONFIG = /(?:^|\/)tsconfig[^/]*\.json$/;
26
+ const COMPILABLE = /\.(?:[cm]?tsx?|[cm]?jsx?)$/;
27
+ function readSpec(config, read, depth = 0) {
28
+ const text = read(config);
29
+ if (text === undefined || depth > 5)
30
+ return undefined;
31
+ const parsed = ts.parseConfigFileTextToJson(config, text);
32
+ if (parsed.error || !parsed.config || typeof parsed.config !== "object")
33
+ return undefined;
34
+ const json = parsed.config;
35
+ const dir = posix.dirname(config);
36
+ const local = (values) => Array.isArray(values) ? values.filter((v) => typeof v === "string").map((v) => posix.normalize(posix.join(dir, v))) : undefined;
37
+ let spec = { files: local(json.files), include: local(json.include), exclude: local(json.exclude), allowJs: json.compilerOptions?.allowJs === true ? true : undefined };
38
+ const parents = typeof json.extends === "string" ? [json.extends] : Array.isArray(json.extends) ? json.extends.filter((e) => typeof e === "string") : [];
39
+ for (const parent of parents) {
40
+ if (!parent.startsWith("."))
41
+ continue;
42
+ const parentPath = posix.normalize(posix.join(dir, parent.endsWith(".json") ? parent : `${parent}.json`));
43
+ const inherited = readSpec(parentPath, read, depth + 1);
44
+ if (!inherited)
45
+ continue;
46
+ spec = { files: spec.files ?? inherited.files, include: spec.include ?? inherited.include, exclude: spec.exclude ?? inherited.exclude, allowJs: spec.allowJs ?? inherited.allowJs };
47
+ }
48
+ return spec;
49
+ }
50
+ function asGlob(pattern) {
51
+ if (/[*?]/.test(pattern) || posix.extname(pattern))
52
+ return pattern;
53
+ return `${pattern.replace(/\/$/, "")}/**/*`;
54
+ }
55
+ /** Root files of a project, as tsc would list them before following imports. */
56
+ export function projectRoots(config, input) {
57
+ const spec = readSpec(config, input.read);
58
+ if (!spec)
59
+ return undefined;
60
+ const dir = posix.dirname(config);
61
+ const roots = new Set(spec.files ?? []);
62
+ const include = spec.include ?? (spec.files ? [] : [posix.join(dir, "**/*")]);
63
+ const exclude = (spec.exclude ?? []).map(asGlob);
64
+ const extensions = spec.allowJs ? COMPILABLE : /\.(?:[cm]?tsx?)$/;
65
+ for (const pattern of include.map(asGlob)) {
66
+ for (const file of input.files) {
67
+ if (!extensions.test(file) || file.endsWith(".d.ts") || file.split("/").includes("node_modules"))
68
+ continue;
69
+ if (matchesGlob(file, pattern) && !exclude.some((glob) => matchesGlob(file, glob)))
70
+ roots.add(file);
71
+ }
72
+ }
73
+ return [...roots].sort();
74
+ }
75
+ /** Projects that some test compiles, with the tests and every file each compiles. */
76
+ export function compiledProjects(input) {
77
+ const configs = input.files.filter((file) => PROJECT_CONFIG.test(file));
78
+ if (configs.length === 0)
79
+ return [];
80
+ const compilingTests = input.files.filter((file) => input.isTestFile(file) && COMPILABLE.test(file))
81
+ .map((file) => ({ file, text: input.read(file) ?? "" }))
82
+ .filter(({ text }) => COMPILER_INVOCATION.test(text));
83
+ const projects = [];
84
+ for (const config of configs) {
85
+ const names = referencePattern(referenceTokens(config, { ancestors: false }));
86
+ const tests = compilingTests.filter(({ text }) => names.test(text)).map(({ file }) => file);
87
+ if (tests.length === 0)
88
+ continue;
89
+ const roots = projectRoots(config, input);
90
+ if (!roots)
91
+ continue;
92
+ const files = new Set(roots);
93
+ for (const root of roots)
94
+ for (const dependency of input.dependenciesOf(root))
95
+ files.add(dependency);
96
+ files.add(config);
97
+ projects.push({ config, tests: tests.sort(), files });
98
+ }
99
+ return projects;
100
+ }
101
+ //# sourceMappingURL=compiled-projects.js.map
@@ -0,0 +1 @@
1
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IAAI,EAAE,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAsB,EAAE,CAAC;IACvC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,gBAAgB,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9E,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;QAC5F,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACjC,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,KAAK,CAAC,CAAC;QACrC,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC;gBAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAClB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,68 @@
1
+ /** Reads repo-relative text files from a checkout at HEAD, the same tree the dependency graph reads.
2
+ * Binary content (a NUL byte in the first 8 KiB) and files over 1 MiB are unreadable. */
3
+ export declare function repositoryFileReader(repoPath: string): (path: string) => string | undefined;
4
+ /** True when tooling may load `filePath` implicitly, so no reference to it would ever be written. */
5
+ export declare function isImplicitlyLoadedFile(filePath: string): boolean;
6
+ /**
7
+ * What a file under an infrastructure directory is (2026-10-21). Everything under `ops/` used to force
8
+ * full validation - 55 of one dogfood repository's 124 receipts - yet that tree holds tested Worker code, runbooks
9
+ * and JSON evidence manifests as well as deployment definitions. Only a definition that tooling loads by
10
+ * convention is global; code goes through the dependency graph, Markdown is documentation, and other
11
+ * files are data whose readers are resolved by reference. `undefined` outside infrastructure trees.
12
+ */
13
+ export declare function infrastructureRole(filePath: string): "definition" | "code" | "documentation" | "data" | undefined;
14
+ interface ReferenceToken {
15
+ value: string;
16
+ bare: boolean;
17
+ }
18
+ /** The strings whose appearance means a file names `filePath`: the path itself, its basename, and every
19
+ * ancestor directory (as a path and as a name). A bare name (no dot, no slash) must be delimited by
20
+ * quotes or slashes on both sides, so prose and identifiers do not match; anything else may also be
21
+ * delimited by whitespace, as in a shell command line.
22
+ *
23
+ * `ancestors: false` drops the directories. A script is run by naming it, so following who runs a code
24
+ * reader needs only its path and basename; in one dogfood repository the bare `"scripts"` matched nearly every
25
+ * file and no change under `site/` could ever resolve (2026-10-21 replay). */
26
+ export declare function referenceTokens(filePath: string, { ancestors }?: {
27
+ ancestors?: boolean;
28
+ }): ReferenceToken[];
29
+ /** One regular expression matching any of `tokens` at a reference boundary. */
30
+ export declare function referencePattern(tokens: readonly ReferenceToken[]): RegExp;
31
+ export type ReaderKind = "test" | "graph-code" | "package-script" | "documentation" | "transitive" | "unresolvable";
32
+ export interface ReferenceResolutionInput {
33
+ /** Repo-relative paths present at HEAD. */
34
+ files: readonly string[];
35
+ /** Reads a repo-relative file at HEAD; undefined for unreadable, binary or oversized content. */
36
+ read: (path: string) => string | undefined;
37
+ isTestFile: (path: string) => boolean;
38
+ isDocumentation: (path: string) => boolean;
39
+ /** Whether a code file is part of the dependency graph. */
40
+ inGraph: (path: string) => boolean;
41
+ isCodeFile: (path: string) => boolean;
42
+ /** Whether something a workflow names can reach the test suite through it, given a pattern matching
43
+ * the name (src/repo/workflow-test-steps.ts, workflowFeedsTests). */
44
+ workflowFeedsTests: (content: string, names: RegExp) => boolean;
45
+ /** Changed files whose content analyzeGitDelta proved cannot change how tests run
46
+ * (GitDeltaAnalysis.referenceResolvedPaths); a workflow reading them does not block. */
47
+ contentCleared?: ReadonlySet<string>;
48
+ }
49
+ export interface ReferenceResolution {
50
+ /** Tests that name the file, directly or through a chain of non-code readers. */
51
+ tests: string[];
52
+ /** Graph code that names the file; its dependent tests are selected by the caller. */
53
+ code: string[];
54
+ /** Why the file cannot be narrowed; empty when it can. */
55
+ unresolvable: string[];
56
+ /** Every reader found, for evidence. */
57
+ readers: Array<{
58
+ path: string;
59
+ kind: ReaderKind;
60
+ via: string;
61
+ }>;
62
+ }
63
+ /** Script names reachable from `npm test`, including lifecycle hooks and any script one of those bodies
64
+ * names. Over-inclusive by design: a script name appearing anywhere in a reachable body is followed. */
65
+ export declare function testScriptClosure(scripts: Readonly<Record<string, string>>): Set<string>;
66
+ /** Resolves who reads `filePath`. See the module comment for the rule and its limits. */
67
+ export declare function resolveFileReferences(filePath: string, input: ReferenceResolutionInput): ReferenceResolution;
68
+ export {};