@outerlayer/cli 0.34.0-next.20261028164329 → 0.34.0-next.20261028183303

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.
@@ -1 +1 @@
1
- {"id":"2026-10-28T16:46:07.632Z+d4ef10e","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
1
+ {"id":"2026-10-28T18:35:15.867Z+17d8740","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { probeCredentials } from './chunk-QI7JB2GU.js';
3
+ import { probeCredentials } from './chunk-LJEZGHCH.js';
4
4
  import './chunk-3JVYMD4G.js';
5
- import './chunk-FUOKDHRB.js';
5
+ import './chunk-64O2NUVA.js';
6
6
  import './chunk-E7R2GIAW.js';
7
7
  import './chunk-MH6QLXUO.js';
8
8
  import './chunk-ZCZY3Q55.js';
9
- import './chunk-WA3HIJVK.js';
9
+ import './chunk-NXUZFHMX.js';
10
10
  import './chunk-MEIDQLXQ.js';
11
- import './chunk-IPWKT5J7.js';
12
- import './chunk-UE2C4STC.js';
11
+ import './chunk-VX7WZK7J.js';
12
+ import './chunk-3UIXIGYT.js';
13
13
  import './chunk-ZVB57WI6.js';
14
14
  import './chunk-POND2SMT.js';
15
15
  import './chunk-I3LTIAOR.js';
@@ -13,6 +13,20 @@ var ARTIFACT_PROOF_REASON = "Its declared artifact proves it; the judge does not
13
13
  var NO_CITING_TEST_REASON = "No test cites this criterion, and it declares no artifact proof.";
14
14
  var NO_TEST_FILES_REASON = "No file at this commit is recognized as a test. Name the repository's test files with a runner glob in `.outerlayer-proofs.yaml`.";
15
15
  var NO_VERDICT_REASON = "The judge gave no result for this criterion.";
16
+ function foundInReason(id, paths) {
17
+ const named = paths.slice(0, 3).map((path2) => `\`${path2}\``);
18
+ const list = paths.length > 3 ? `${named.join(", ")} and other files` : named.length === 1 ? named[0] : `${named.slice(0, -1).join(", ")} and ${named.at(-1)}`;
19
+ const many = paths.length > 1;
20
+ return `${foundInOpening(id)}${list}, which ${many ? "are" : "is"} not read as ${many ? "tests" : "a test"}. If ${many ? "one" : "that file"} holds the test, name it with a runner glob in \`.outerlayer-proofs.yaml\`.`;
21
+ }
22
+ var foundInOpening = (id) => `\`${id}\` appears in `;
23
+ var FOUND_IN_ENDING = " holds the test, name it with a runner glob in `.outerlayer-proofs.yaml`.";
24
+ function isFoundInReason(reason, id) {
25
+ return reason !== void 0 && reason.startsWith(foundInOpening(id)) && reason.endsWith(FOUND_IN_ENDING);
26
+ }
27
+ function uncitedIds(criteria, citations) {
28
+ return criteria.filter((criterion) => criterion.proof === null && refsFor(criterion.id, citations) === void 0).map((criterion) => criterion.id);
29
+ }
16
30
  function criterionInputs(input) {
17
31
  const paths = [...new Set((input.citations[input.criterion.id] ?? []).map((citation) => citation.path))].sort();
18
32
  const hash = createHash("sha256");
@@ -54,7 +68,9 @@ function planCriteria(input) {
54
68
  continue;
55
69
  }
56
70
  if (refs === void 0) {
57
- settled.push({ ...base, result: "fail", reason: input.noTestFiles === true ? NO_TEST_FILES_REASON : NO_CITING_TEST_REASON });
71
+ const where = input.foundIn?.get(criterion.id) ?? [];
72
+ const reason = where.length > 0 ? foundInReason(criterion.id, where) : input.noTestFiles === true ? NO_TEST_FILES_REASON : NO_CITING_TEST_REASON;
73
+ settled.push({ ...base, result: "fail", reason });
58
74
  continue;
59
75
  }
60
76
  const kept = previousById.get(criterion.id);
@@ -2059,4 +2075,70 @@ function hostItemsOf(workItem, name) {
2059
2075
  return parsed.success ? parsed.data : [];
2060
2076
  }
2061
2077
 
2062
- export { MAX_TEST_FILES, MAX_TEST_FILE_BYTES, NO_CITING_TEST_REASON, NO_TEST_FILES_REASON, NO_VERDICT_REASON, criteriaOf, criterionInputs, hostItemsOf, inCriteriaOrder, itemsSentence, judgedItems, loadCitationFinder, oneLineReason, parseJudgeAnswer, planCriteria, runnerMatcher, testFileMatcher };
2078
+ // src/runner/judge-found.ts
2079
+ var MAX_FOUND_FILES = 4;
2080
+ var MAX_NAMED_PATH_LENGTH = 200;
2081
+ var JUDGE_LIMITS = { files: MAX_TEST_FILES, bytes: MAX_TEST_FILE_BYTES };
2082
+ function isSearchCandidate(file, rules, maxBytes = MAX_TEST_FILE_BYTES) {
2083
+ return file.size <= maxBytes && !rules.isTest(file.path) && rules.isSearchable(file.path);
2084
+ }
2085
+ function firstInPathOrder(files, limit) {
2086
+ return [...files].sort((a, b) => a.path < b.path ? -1 : 1).slice(0, limit);
2087
+ }
2088
+ function pickSearchable(candidates, rules, limits = JUDGE_LIMITS) {
2089
+ return firstInPathOrder(
2090
+ candidates.filter((file) => isSearchCandidate(file, rules, limits.bytes)),
2091
+ limits.files
2092
+ );
2093
+ }
2094
+ var READ_GROUP = { files: 500, bytes: 33554432 };
2095
+ function groupBySize(sizes, limit = READ_GROUP) {
2096
+ const groups = [];
2097
+ let start = 0;
2098
+ let bytes = 0;
2099
+ for (let at = 0; at < sizes.length; at += 1) {
2100
+ if (at > start && (at - start >= limit.files || bytes + sizes[at] > limit.bytes)) {
2101
+ groups.push([start, at]);
2102
+ start = at;
2103
+ bytes = 0;
2104
+ }
2105
+ bytes += sizes[at];
2106
+ }
2107
+ if (start < sizes.length) groups.push([start, sizes.length]);
2108
+ return groups;
2109
+ }
2110
+ function isNameable(path2) {
2111
+ if (path2.length > MAX_NAMED_PATH_LENGTH) return false;
2112
+ for (const character of path2) {
2113
+ const code = character.codePointAt(0);
2114
+ if (code < 32 || code >= 127 && code <= 159 || character === "`") return false;
2115
+ if (code === 8232 || code === 8233 || code >= 8234 && code <= 8238 || code >= 8294 && code <= 8297) return false;
2116
+ }
2117
+ return true;
2118
+ }
2119
+ var IdScan = class {
2120
+ constructor(finder, ids) {
2121
+ this.found = /* @__PURE__ */ new Map();
2122
+ this.pending = [...new Set(ids)].filter((id) => id !== "");
2123
+ this.patterns = new Map(this.pending.map((id) => [id, finder.idPattern(id)]));
2124
+ }
2125
+ /** True when every id has all its paths, so no later file can change the result. */
2126
+ get complete() {
2127
+ return this.pending.length === 0;
2128
+ }
2129
+ offer(path2, contents) {
2130
+ if (this.complete || !isNameable(path2) || contents.includes("\0")) return;
2131
+ for (const id of [...this.pending]) {
2132
+ if (!contents.includes(id) || !this.patterns.get(id).test(contents)) continue;
2133
+ const paths = this.found.get(id) ?? [];
2134
+ paths.push(path2);
2135
+ this.found.set(id, paths);
2136
+ if (paths.length >= MAX_FOUND_FILES) this.pending.splice(this.pending.indexOf(id), 1);
2137
+ }
2138
+ }
2139
+ result() {
2140
+ return this.found;
2141
+ }
2142
+ };
2143
+
2144
+ export { IdScan, MAX_TEST_FILES, MAX_TEST_FILE_BYTES, NO_CITING_TEST_REASON, NO_TEST_FILES_REASON, NO_VERDICT_REASON, criteriaOf, criterionInputs, firstInPathOrder, foundInReason, groupBySize, hostItemsOf, inCriteriaOrder, isFoundInReason, isSearchCandidate, itemsSentence, judgedItems, loadCitationFinder, oneLineReason, parseJudgeAnswer, pickSearchable, planCriteria, runnerMatcher, testFileMatcher, uncitedIds };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { scrubReason, stripTerminalControls } from './chunk-IPWKT5J7.js';
3
+ import { scrubReason, stripTerminalControls } from './chunk-VX7WZK7J.js';
4
4
  import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-4YD7N6V3.js';
5
5
  import { RunnerAlreadyRunningError, readPidFile } from './chunk-SAAVZ2BX.js';
6
6
  import { isSameProcess } from './chunk-JBJTC3UU.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { criteriaOf, loadCitationFinder, hostItemsOf, testFileMatcher, criterionInputs, NO_CITING_TEST_REASON, NO_VERDICT_REASON, planCriteria, NO_TEST_FILES_REASON, MAX_TEST_FILE_BYTES, MAX_TEST_FILES } from './chunk-UE2C4STC.js';
3
+ import { criteriaOf, loadCitationFinder, hostItemsOf, criterionInputs, NO_CITING_TEST_REASON, NO_TEST_FILES_REASON, NO_VERDICT_REASON, isFoundInReason, uncitedIds, planCriteria, pickSearchable, IdScan, testFileMatcher, foundInReason, MAX_TEST_FILE_BYTES, MAX_TEST_FILES, groupBySize } from './chunk-3UIXIGYT.js';
4
4
  import { WorkCommandError, resolveCredentials, getJson } from './chunk-XDAMLX2L.js';
5
5
  import { C } from './chunk-ANPNT6PM.js';
6
6
  import { sanitizeTerminal } from './chunk-VEVNGDTP.js';
@@ -70,7 +70,8 @@ function unprovenCriteria(input) {
70
70
  for (const item of input.items) {
71
71
  const criterion = criteria.find((c) => c.id === item.id);
72
72
  if (criterion === void 0 || item.result !== "fail" || item.inputs === void 0) continue;
73
- if (item.reason === NO_CITING_TEST_REASON || item.reason === NO_VERDICT_REASON) continue;
73
+ if (item.reason === NO_CITING_TEST_REASON || item.reason === NO_TEST_FILES_REASON || item.reason === NO_VERDICT_REASON) continue;
74
+ if (item.refs === void 0 && isFoundInReason(item.reason, item.id)) continue;
74
75
  const commit = item.refs === void 0 ? void 0 : commitOf(item.refs);
75
76
  if (commit === void 0) {
76
77
  notes.push(`the links of ${item.id} name no commit`);
@@ -87,14 +88,21 @@ function unprovenCriteria(input) {
87
88
  commits.set(item.id, commit);
88
89
  previous.set(item.id, { ...item, inputs: criterionInputs({ brief: NO_BRIEF, criterion, citations: judgedCitations, testFiles: judged }) });
89
90
  }
91
+ const uncited = uncitedIds(criteria, citations);
92
+ const foundIn = uncited.length === 0 ? void 0 : input.foundOutsideTestsAt?.(uncited);
93
+ if (uncited.length > 0 && input.foundOutsideTestsAt !== void 0 && foundIn === void 0) {
94
+ notes.push("the files that could hold the id of a criterion no test cites cannot be read, so its row names none");
95
+ }
90
96
  const plan = planCriteria({ criteria, citations, inputs, previous: [...previous.values()], noTestFiles: input.headFiles.length === 0 });
91
97
  const settled = new Map(plan.settled.map((item) => [item.id, item]));
92
98
  const entries = [];
93
99
  for (const criterion of criteria) {
94
100
  const item = settled.get(criterion.id);
95
101
  if (item === void 0 || item.result !== "fail") continue;
96
- if (item.refs === void 0) entries.push({ id: criterion.id, proof: null, state: "uncited", ...item.reason === NO_TEST_FILES_REASON ? { noTestFiles: true } : {} });
97
- else entries.push({ id: criterion.id, proof: null, state: "failed", commit: commits.get(criterion.id) ?? "", reason: item.reason ?? "no reason recorded" });
102
+ if (item.refs === void 0) {
103
+ const where = foundIn?.get(criterion.id);
104
+ entries.push({ id: criterion.id, proof: null, state: "uncited", ...where !== void 0 ? { foundIn: where } : item.reason === NO_TEST_FILES_REASON ? { noTestFiles: true } : {} });
105
+ } else entries.push({ id: criterion.id, proof: null, state: "failed", commit: commits.get(criterion.id) ?? "", reason: item.reason ?? "no reason recorded" });
98
106
  }
99
107
  return { entries, notes };
100
108
  }
@@ -103,6 +111,15 @@ function git(cwd, args, input) {
103
111
  if (run.status !== 0) throw new Error(`git ${args[0]} failed`);
104
112
  return run.stdout;
105
113
  }
114
+ function treeAt(cwd, head) {
115
+ const listing = git(cwd, ["ls-tree", "-r", "-l", "-z", "--full-tree", head]);
116
+ const entries = [];
117
+ for (const entry of listing.toString("utf8").split("\0")) {
118
+ const match = /^(\d+) blob ([0-9a-f]+)\s+(\d+)\t(.*)$/s.exec(entry);
119
+ if (match !== null && match[1].startsWith("100")) entries.push({ path: match[4], oid: match[2], size: Number(match[3]) });
120
+ }
121
+ return entries;
122
+ }
106
123
  function readObjects(cwd, specs) {
107
124
  const out = git(cwd, ["cat-file", "--batch"], `${specs.join("\n")}
108
125
  `);
@@ -123,19 +140,39 @@ function readObjects(cwd, specs) {
123
140
  }
124
141
  return texts;
125
142
  }
143
+ function readTexts(cwd, entries, visit) {
144
+ for (const [start, end] of groupBySize(entries.map((entry) => entry.size))) {
145
+ for (const [n, text] of readObjects(cwd, entries.slice(start, end).map((entry) => entry.oid)).entries()) {
146
+ if (text !== void 0 && visit(start + n, text) === false) return;
147
+ }
148
+ }
149
+ }
126
150
  function testFilesAt(cwd, head, isTest) {
127
151
  try {
128
- const listing = git(cwd, ["ls-tree", "-r", "-l", "-z", head]);
129
- const picked = /* @__PURE__ */ new Map();
130
- for (const entry of listing.toString("utf8").split("\0")) {
131
- const match = /^(\d+) blob ([0-9a-f]+)\s+(\d+)\t(.*)$/s.exec(entry);
132
- if (match === null || !match[1].startsWith("100") || Number(match[3]) > MAX_TEST_FILE_BYTES || !isTest(match[4])) continue;
133
- if (picked.size >= MAX_TEST_FILES) break;
134
- picked.set(match[4], match[2]);
152
+ const picked = [];
153
+ for (const entry of treeAt(cwd, head)) {
154
+ if (entry.size > MAX_TEST_FILE_BYTES || !isTest(entry.path)) continue;
155
+ if (picked.length >= MAX_TEST_FILES) break;
156
+ picked.push(entry);
135
157
  }
136
- const paths = [...picked.keys()];
137
- const texts = readObjects(cwd, [...picked.values()]);
138
- return paths.flatMap((path, n) => texts[n] === void 0 ? [] : [{ path, contents: texts[n] }]);
158
+ const files = [];
159
+ readTexts(cwd, picked, (n, text) => {
160
+ files.push({ path: picked[n].path, contents: text });
161
+ });
162
+ return files;
163
+ } catch {
164
+ return void 0;
165
+ }
166
+ }
167
+ function findIdsOutsideTestsAt(cwd, head, input, limits) {
168
+ try {
169
+ const picked = pickSearchable(treeAt(cwd, head), input, limits);
170
+ const scan = new IdScan(input.finder, input.ids);
171
+ readTexts(cwd, picked, (n, text) => {
172
+ scan.offer(picked[n].path, text);
173
+ return !scan.complete;
174
+ });
175
+ return scan.result();
139
176
  } catch {
140
177
  return void 0;
141
178
  }
@@ -147,8 +184,11 @@ function proofsFileAt(cwd, commit) {
147
184
  return void 0;
148
185
  }
149
186
  }
187
+ function matcherAt(cwd, commit, finder) {
188
+ return testFileMatcher(finder, proofsFileAt(cwd, commit));
189
+ }
150
190
  function testFilesOf(cwd, commit, finder) {
151
- return testFilesAt(cwd, commit, testFileMatcher(finder, proofsFileAt(cwd, commit)));
191
+ return testFilesAt(cwd, commit, matcherAt(cwd, commit, finder));
152
192
  }
153
193
  function checkoutPlaces(cwd) {
154
194
  for (let dir = resolve(cwd); ; dir = dirname(dir)) {
@@ -177,14 +217,14 @@ function governingDir(cwd) {
177
217
  async function testProofMode(cwd) {
178
218
  const dir = governingDir(cwd);
179
219
  if (dir === void 0) return "any";
180
- const { testProofIn } = await import('./host-checks-LEVAIIN4.js');
220
+ const { testProofIn } = await import('./host-checks-HC4XXGAD.js');
181
221
  return testProofIn(dir);
182
222
  }
183
223
  async function judgeCheckName(cwd) {
184
224
  const dir = governingDir(cwd);
185
225
  if (dir === void 0) return {};
186
226
  if (!existsSync(dir)) return { note: `the governed context at ${dir} is not readable` };
187
- const { checksIn, isJudgeCheck } = await import('./host-checks-LEVAIIN4.js');
227
+ const { checksIn, isJudgeCheck } = await import('./host-checks-HC4XXGAD.js');
188
228
  const quiet = { line: () => void 0, error: () => void 0 };
189
229
  const check = checksIn(dir, quiet, "").checks.find((c) => isJudgeCheck(c) && c.judge.subjects === "criteria");
190
230
  return check === void 0 ? {} : { name: check.name };
@@ -204,7 +244,8 @@ async function findUnproven(input) {
204
244
  finder,
205
245
  headFiles,
206
246
  items,
207
- testFilesAt: (commit) => testFilesOf(input.cwd, commit, finder)
247
+ testFilesAt: (commit) => testFilesOf(input.cwd, commit, finder),
248
+ foundOutsideTestsAt: (ids) => findIdsOutsideTestsAt(input.cwd, input.head, { isTest: matcherAt(input.cwd, input.head, finder), isSearchable: finder.isSearchableFile, finder, ids })
208
249
  });
209
250
  const check = Object(input.item).checks?.find((c) => Object(c).name === found.name);
210
251
  if (check?.source === "host" && check.result === "fail" && items.length === 0) result.notes.unshift("the gateway returned no check items for the judge's result");
@@ -258,8 +299,9 @@ var STATE_LABEL = { current: "current", "out-of-date": "out of date", missing: "
258
299
  function renderEntry(e) {
259
300
  const id = sanitizeTerminal(e.id);
260
301
  if (e.state === "uncited") {
302
+ if (e.foundIn !== void 0) return `${id} none uncited ${sanitizeTerminal(foundInReason(e.id, e.foundIn))}`;
261
303
  if (e.noTestFiles === true) {
262
- return `${id} none uncited No file at this commit is recognized as a test. Name the repository's test files with a runner glob in \`.outerlayer-proofs.yaml\`.`;
304
+ return `${id} none uncited ${NO_TEST_FILES_REASON}`;
263
305
  }
264
306
  return `${id} none uncited No test at HEAD cites it. Put ${id} in a test's title or in a comment above the test, as in // proves ${id}`;
265
307
  }
@@ -327,7 +369,7 @@ async function runWorkProofs(opts) {
327
369
  async function runWorkProofsCommand(opts) {
328
370
  try {
329
371
  if (opts.record) {
330
- const { runWorkProofsRecord } = await import('./work-proofs-record-CJAFFWXG.js');
372
+ const { runWorkProofsRecord } = await import('./work-proofs-record-JD4DNZUW.js');
331
373
  const result2 = await runWorkProofsRecord(opts);
332
374
  process.exitCode = result2.exitCode;
333
375
  return;
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { decideInstalledSwitch } from './chunk-3JVYMD4G.js';
4
- import { reportFailedStart, fitImageBuildMemory } from './chunk-FUOKDHRB.js';
4
+ import { reportFailedStart, fitImageBuildMemory } from './chunk-64O2NUVA.js';
5
5
  import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-E7R2GIAW.js';
6
6
  import { RUNNER_PROTOCOL } from './chunk-MH6QLXUO.js';
7
7
  import { writePendingUpdate } from './chunk-ZCZY3Q55.js';
8
- import { renderUpdateSteps } from './chunk-WA3HIJVK.js';
8
+ import { renderUpdateSteps } from './chunk-NXUZFHMX.js';
9
9
  import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-MEIDQLXQ.js';
10
- import { releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, readProvisionOut, workdirProblem, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, startSender, finishJob, sampleGuest, foldSample, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, listTrackedJobs, restartSender, serveLease, vmAlive, writeGuestGhConfig, ALREADY_RELEASED, inTeardown } from './chunk-IPWKT5J7.js';
10
+ import { releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, readProvisionOut, workdirProblem, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, startSender, finishJob, sampleGuest, foldSample, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, listTrackedJobs, restartSender, serveLease, vmAlive, writeGuestGhConfig, ALREADY_RELEASED, inTeardown } from './chunk-VX7WZK7J.js';
11
11
  import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-ZVB57WI6.js';
12
12
  import { realBlockedProbes, checkBlockedWithSlots, largeBuildMemoryBytes, LARGE_BUILD_DISK_BYTES, checkManagedRoom, sliceMemoryOf, createHousekeepingDocker, housekeepingDockerIfReachable, KIND_LABEL, RECIPE_KEY_LABEL } from './chunk-QGEGLZSY.js';
13
13
  import { writeMarker, readMarker, currentVersion, removeMarker, isInLayout, startedThroughCurrent, entryIn, versionDir, switchCurrent, cleanVersions, stagingDir } from './chunk-KH4774QT.js';
@@ -3255,7 +3255,7 @@ async function startRunner(configPath, deps, startup) {
3255
3255
  check: update.check ? () => update.check(configPath) : async () => {
3256
3256
  const held = heldClaudeCredential();
3257
3257
  const env = held === void 0 ? process.env : { ...process.env, [held.variable]: held.value };
3258
- return (await import('./check-SPMUN5C4.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3258
+ return (await import('./check-VKSOYRNI.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3259
3259
  },
3260
3260
  now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
3261
3261
  log
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { stripTerminalControls } from './chunk-IPWKT5J7.js';
3
+ import { stripTerminalControls } from './chunk-VX7WZK7J.js';
4
4
  import { tagToPull, imageTag, pullInstruction, readUpdateStatus, runnerImageVersion } from './chunk-UXC3RQLF.js';
5
5
  import { readFileSync } from 'fs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, MAX_TEST_FILE_BYTES, MAX_TEST_FILES, testFileMatcher, criterionInputs, planCriteria, parseJudgeAnswer, inCriteriaOrder, oneLineReason, judgedItems } from './chunk-UE2C4STC.js';
3
+ import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, MAX_TEST_FILE_BYTES, MAX_TEST_FILES, criterionInputs, uncitedIds, planCriteria, parseJudgeAnswer, inCriteriaOrder, oneLineReason, judgedItems, IdScan, firstInPathOrder, isSearchCandidate } from './chunk-3UIXIGYT.js';
4
4
  import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk-ZVB57WI6.js';
5
5
  import { HELPER_PATH, DOCKERD_LOG, HELPER_RECORD } from './chunk-POND2SMT.js';
6
6
  import { zodProblem } from './chunk-I3LTIAOR.js';
@@ -1912,6 +1912,32 @@ function testFilesIn(root, isTest, limits = { files: MAX_TEST_FILES, bytes: MAX_
1912
1912
  walk(root, "");
1913
1913
  return files;
1914
1914
  }
1915
+ function findIdsOutsideTestsIn(root, input, limits = { files: MAX_TEST_FILES, bytes: MAX_TEST_FILE_BYTES }) {
1916
+ const candidates = [];
1917
+ const walk = (dir, prefix) => {
1918
+ for (const name of readdirSync(dir)) {
1919
+ if (prefix === "" && name === ".git") continue;
1920
+ const path = join(dir, name);
1921
+ const rel = prefix === "" ? name : `${prefix}/${name}`;
1922
+ const stat = lstatSync(path);
1923
+ if (stat.isDirectory()) walk(path, rel);
1924
+ else if (stat.isFile() && isSearchCandidate({ path: rel, size: stat.size }, input, limits.bytes)) candidates.push({ path: rel, size: stat.size });
1925
+ }
1926
+ };
1927
+ walk(root, "");
1928
+ const scan = new IdScan(input.finder, input.ids);
1929
+ for (const { path } of firstInPathOrder(candidates, limits.files)) {
1930
+ if (scan.complete) break;
1931
+ let contents;
1932
+ try {
1933
+ contents = readFileSync(join(root, path), "utf8");
1934
+ } catch {
1935
+ continue;
1936
+ }
1937
+ scan.offer(path, contents);
1938
+ }
1939
+ return scan.result();
1940
+ }
1915
1941
  function proofsFileIn(root) {
1916
1942
  const path = join(root, ".outerlayer-proofs.yaml");
1917
1943
  try {
@@ -2055,11 +2081,21 @@ async function runJudge(input) {
2055
2081
  if (!fetched.ok) return await fail(check, `the build's tests could not be fetched: ${fetched.reason}`);
2056
2082
  const finder = await loadCitationFinder();
2057
2083
  const list = criteria ?? [];
2058
- const testFiles = testFilesIn(branchDir, testFileMatcher(finder, proofsFileIn(branchDir)));
2084
+ const isTest = testFileMatcher(finder, proofsFileIn(branchDir));
2085
+ const testFiles = testFilesIn(branchDir, isTest);
2059
2086
  const citations = finder.buildCitations({ ids: list.map((criterion) => criterion.id), files: testFiles, repository: repo, sha: head });
2060
2087
  const testFileText = new Map(testFiles.map((file) => [file.path, file.contents]));
2061
2088
  const inputs = new Map(list.map((criterion) => [criterion.id, criterionInputs({ brief, criterion, citations, testFiles: testFileText })]));
2062
- const plan = planCriteria({ criteria: list, citations, inputs, previous, noTestFiles: testFiles.length === 0 });
2089
+ const uncited = uncitedIds(list, citations);
2090
+ let foundIn;
2091
+ if (uncited.length > 0) {
2092
+ try {
2093
+ foundIn = (deps.findIdsOutside ?? findIdsOutsideTestsIn)(branchDir, { isTest, isSearchable: finder.isSearchableFile, finder, ids: uncited });
2094
+ } catch (err) {
2095
+ log.error(`${tag} the search for the ids of the criteria that no test cites failed: ${describeCallFailure(err)}`);
2096
+ }
2097
+ }
2098
+ const plan = planCriteria({ criteria: list, citations, inputs, previous, noTestFiles: testFiles.length === 0, foundIn });
2063
2099
  if (plan.toJudge.length < list.length) {
2064
2100
  log.line(`${tag} judge: ${plan.toJudge.length} of ${list.length} criteria to judge, ${list.length - plan.toJudge.length} settled without the judge`);
2065
2101
  }
@@ -4999,7 +4999,7 @@ differs from HEAD.
4999
4999
  fail(trackerNumberError("--pr", opts.pr));
5000
5000
  return;
5001
5001
  }
5002
- const { runWorkProofsCommand } = await import('./work-proofs-cmd-H2GGE5HK.js');
5002
+ const { runWorkProofsCommand } = await import('./work-proofs-cmd-GFGENBGN.js');
5003
5003
  await runWorkProofsCommand({ ...opts, ...pr === void 0 ? {} : { pr } });
5004
5004
  });
5005
5005
  workCmd.command("list").description("List live work items for this factory").option("--stage <spec|build|review>", "filter by stage").option("--section <attention|waiting|flowing>", "filter by Queue section").option("--repo <owner/name>", "repository (default: the current checkout's remote)").option("--unclaimed", "only items with no live lease").option("--claimed", "only items with a live lease, held by a host or a local session").option("--startable", "only items a host can start: a build request, no open PR, no live lease").option("--needs <amend>", "only items with a thread waiting on an agent").option("--json", "machine-readable JSON output").option("--url <url>", "cloud base URL (or OUTERLAYER_URL / config)").addOption(apiKeyOption()).option("--app-id <id>", "factory id the key is bound to (or OUTERLAYER_APP_ID / config)").action(async (opts) => {
@@ -5146,7 +5146,7 @@ function registerRunnerCommands(program2) {
5146
5146
  const configOption = "the cloud config file to run against (default: ~/.outerlayer/config.json)";
5147
5147
  runnerCmd.command("start").description("Run the loop: claim work, run it, report, clean up, repeat").option("--config <path>", configOption).action(async (opts) => {
5148
5148
  const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-RSOCVUKC.js');
5149
- const { start, RunnerStartError } = await import('./loop-NNJN2XOW.js');
5149
+ const { start, RunnerStartError } = await import('./loop-GBTANKUW.js');
5150
5150
  const { RunnerAlreadyRunningError } = await import('./pidfile-DSQOOAZV.js');
5151
5151
  const configPath = opts.config ?? defaultRunnerConfigPath();
5152
5152
  try {
@@ -5165,8 +5165,8 @@ function registerRunnerCommands(program2) {
5165
5165
  "\nReads OUTERLAYER_URL, OUTERLAYER_APP_ID, OUTERLAYER_API_KEY, OUTERLAYER_RUNNER_NAME and one Claude credential\n(CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY) from the environment. OUTERLAYER_AGENT\nis optional and defaults to claude. On a later start it refuses variables that disagree with the config in the volume.\nThe image sets OUTERLAYER_RUNNER_IMAGE; outside the image, use `runner start`.\n"
5166
5166
  ).action(async () => {
5167
5167
  const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-RSOCVUKC.js');
5168
- const { containerStart } = await import('./container-start-ZDSVXSAL.js');
5169
- const { start, RunnerStartError } = await import('./loop-NNJN2XOW.js');
5168
+ const { containerStart } = await import('./container-start-PYW7W2N2.js');
5169
+ const { start, RunnerStartError } = await import('./loop-GBTANKUW.js');
5170
5170
  const { RunnerAlreadyRunningError } = await import('./pidfile-DSQOOAZV.js');
5171
5171
  try {
5172
5172
  const result = await containerStart({
@@ -5190,14 +5190,14 @@ function registerRunnerCommands(program2) {
5190
5190
  ).action(async (opts) => {
5191
5191
  const { defaultRunnerConfigPath } = await import('./config-RSOCVUKC.js');
5192
5192
  const { runnerDir } = await import('./paths-M66LPPUF.js');
5193
- const { runUpdateSteps } = await import('./update-steps-E2PP5DPR.js');
5193
+ const { runUpdateSteps } = await import('./update-steps-HMSVBDKH.js');
5194
5194
  const text = await runUpdateSteps({ runnerDirPath: runnerDir(opts.config ?? defaultRunnerConfigPath()) });
5195
5195
  process.stdout.write(`${text}
5196
5196
  `);
5197
5197
  });
5198
5198
  runnerCmd.command("check").description("Validate the config, the hooks and the key, and print the effective settings").option("--config <path>", configOption).action(async (opts) => {
5199
5199
  const { defaultRunnerConfigPath } = await import('./config-RSOCVUKC.js');
5200
- const { runRunnerCheck } = await import('./check-SPMUN5C4.js');
5200
+ const { runRunnerCheck } = await import('./check-VKSOYRNI.js');
5201
5201
  const configPath = opts.config ?? defaultRunnerConfigPath();
5202
5202
  const result = await runRunnerCheck(configPath);
5203
5203
  if (!result.ok) {
@@ -5606,7 +5606,7 @@ Next:
5606
5606
  });
5607
5607
  runnerCmd.command("stop").description("Take no more work; finish running jobs, then exit").option("--config <path>", "the cloud config file naming the runner to stop").option("--now", "end running jobs immediately, with outcome stopped").action(async (opts) => {
5608
5608
  const { defaultRunnerConfigPath } = await import('./config-RSOCVUKC.js');
5609
- const { requestStop } = await import('./loop-NNJN2XOW.js');
5609
+ const { requestStop } = await import('./loop-GBTANKUW.js');
5610
5610
  const configPath = opts.config ?? defaultRunnerConfigPath();
5611
5611
  const { runnerImageVersion } = await import('./image-tag-YJJONB64.js');
5612
5612
  await requestStop(configPath, Boolean(opts.now), void 0, { image: runnerImageVersion() !== void 0 });
@@ -5614,8 +5614,8 @@ Next:
5614
5614
  runnerCmd.command("status").description("List running jobs; with --recent, finished ones too").option("--config <path>", "the cloud config file naming the runner to inspect").option("--recent", "also list finished jobs, newest first, capped at 20").option("--json", "machine-readable JSON output").action(async (opts) => {
5615
5615
  const { defaultRunnerConfigPath, loadRunnerConfig } = await import('./config-RSOCVUKC.js');
5616
5616
  const { jobsDir, runnerDir } = await import('./paths-M66LPPUF.js');
5617
- const { listJobFiles, runnerProcessState } = await import('./loop-NNJN2XOW.js');
5618
- const { renderStatus } = await import('./status-IPIMYTG5.js');
5617
+ const { listJobFiles, runnerProcessState } = await import('./loop-GBTANKUW.js');
5618
+ const { renderStatus } = await import('./status-VMFS7N6A.js');
5619
5619
  const { readHousekeepingRecord } = await import('./record-3KKIJ3XL.js');
5620
5620
  const path2 = await import('path');
5621
5621
  const configPath = opts.config ?? defaultRunnerConfigPath();
@@ -5674,7 +5674,7 @@ Next:
5674
5674
  });
5675
5675
  runnerCmd.command("logs").argument("<item>", "the work item's number in the factory").description("Print the newest attempt's log for one item").option("--config <path>", "the cloud config file naming the runner to inspect").option("-f, --follow", "keep printing as the log grows").action(async (itemArg, opts) => {
5676
5676
  const { defaultRunnerConfigPath } = await import('./config-RSOCVUKC.js');
5677
- const { listJobFiles } = await import('./loop-NNJN2XOW.js');
5677
+ const { listJobFiles } = await import('./loop-GBTANKUW.js');
5678
5678
  const { newestAttempt, logPathFor, tail, RunnerLogsError } = await import('./logs-YVXVAYTD.js');
5679
5679
  const configPath = opts.config ?? defaultRunnerConfigPath();
5680
5680
  const item = parseTrackerNumber(itemArg);
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { reportFailedStart, BUILD_MEMORY_VARIABLE } from './chunk-FUOKDHRB.js';
4
- import { readOwnContainer } from './chunk-WA3HIJVK.js';
5
- import './chunk-IPWKT5J7.js';
6
- import './chunk-UE2C4STC.js';
3
+ import { reportFailedStart, BUILD_MEMORY_VARIABLE } from './chunk-64O2NUVA.js';
4
+ import { readOwnContainer } from './chunk-NXUZFHMX.js';
5
+ import './chunk-VX7WZK7J.js';
6
+ import './chunk-3UIXIGYT.js';
7
7
  import './chunk-ZVB57WI6.js';
8
8
  import './chunk-POND2SMT.js';
9
9
  import './chunk-I3LTIAOR.js';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { MAX_CHECK_ITEMS_BYTES, checksIn, commandItems, isJudgeCheck, makeRecorder, readDefinitions, runHostChecks, testProofIn, timeoutAfter } from './chunk-IPWKT5J7.js';
4
- import './chunk-UE2C4STC.js';
3
+ export { MAX_CHECK_ITEMS_BYTES, checksIn, commandItems, isJudgeCheck, makeRecorder, readDefinitions, runHostChecks, testProofIn, timeoutAfter } from './chunk-VX7WZK7J.js';
4
+ import './chunk-3UIXIGYT.js';
5
5
  import './chunk-ZVB57WI6.js';
6
6
  import './chunk-POND2SMT.js';
7
7
  import './chunk-I3LTIAOR.js';
package/dist/index.js CHANGED
@@ -26,5 +26,5 @@ if (argv[0] === "claude") {
26
26
  process.exit(await runClaudeLauncher(argv.slice(1)));
27
27
  }
28
28
  (await import('./hook-fast-GOH4T6SN.js')).recordLinkExitFailure(argv);
29
- var { runCli } = await import('./cli-GKROH23V.js');
29
+ var { runCli } = await import('./cli-HBS2PXSS.js');
30
30
  await runCli(process.argv);
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { RunnerStartError, leaseTimeLeftFor, listJobFiles, logUnusableHelper, probeBuild, probeCredentials, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick } from './chunk-QI7JB2GU.js';
3
+ export { RunnerStartError, leaseTimeLeftFor, listJobFiles, logUnusableHelper, probeBuild, probeCredentials, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick } from './chunk-LJEZGHCH.js';
4
4
  import './chunk-3JVYMD4G.js';
5
- import './chunk-FUOKDHRB.js';
5
+ import './chunk-64O2NUVA.js';
6
6
  import './chunk-E7R2GIAW.js';
7
7
  import './chunk-MH6QLXUO.js';
8
8
  import './chunk-ZCZY3Q55.js';
9
- import './chunk-WA3HIJVK.js';
9
+ import './chunk-NXUZFHMX.js';
10
10
  import './chunk-MEIDQLXQ.js';
11
- import './chunk-IPWKT5J7.js';
12
- import './chunk-UE2C4STC.js';
11
+ import './chunk-VX7WZK7J.js';
12
+ import './chunk-3UIXIGYT.js';
13
13
  import './chunk-ZVB57WI6.js';
14
14
  import './chunk-POND2SMT.js';
15
15
  import './chunk-I3LTIAOR.js';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { isReadable, ALREADY_RELEASED, RENEW_INTERVAL_SECONDS } from './chunk-IPWKT5J7.js';
4
- import './chunk-UE2C4STC.js';
3
+ import { isReadable, ALREADY_RELEASED, RENEW_INTERVAL_SECONDS } from './chunk-VX7WZK7J.js';
4
+ import './chunk-3UIXIGYT.js';
5
5
  import { jobStateFormatOf } from './chunk-ZVB57WI6.js';
6
6
  import './chunk-POND2SMT.js';
7
7
  import './chunk-I3LTIAOR.js';
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { readOwnContainer, renderUpdateSteps, runUpdateSteps } from './chunk-WA3HIJVK.js';
4
- import './chunk-IPWKT5J7.js';
5
- import './chunk-UE2C4STC.js';
3
+ export { readOwnContainer, renderUpdateSteps, runUpdateSteps } from './chunk-NXUZFHMX.js';
4
+ import './chunk-VX7WZK7J.js';
5
+ import './chunk-3UIXIGYT.js';
6
6
  import './chunk-ZVB57WI6.js';
7
7
  import './chunk-POND2SMT.js';
8
8
  import './chunk-I3LTIAOR.js';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { classifyProofs, classifyProofsAt, otherPullRequestHeads, resolveProofsItem, runWorkProofs, runWorkProofsCommand } from './chunk-YIK5SGEN.js';
4
- import './chunk-UE2C4STC.js';
3
+ export { classifyProofs, classifyProofsAt, otherPullRequestHeads, resolveProofsItem, runWorkProofs, runWorkProofsCommand } from './chunk-AF4E4I4T.js';
4
+ import './chunk-3UIXIGYT.js';
5
5
  import './chunk-XDAMLX2L.js';
6
6
  import './chunk-IP7BIBXJ.js';
7
7
  import './chunk-MRLJK4GZ.js';
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { resolveProofsItem, ownPullRequest, otherPullRequestHeads, classifyProofsAt, runWorkProofs, proofsCommentId, kindProblem, proofsCommentBody } from './chunk-YIK5SGEN.js';
3
+ import { resolveProofsItem, ownPullRequest, otherPullRequestHeads, classifyProofsAt, runWorkProofs, proofsCommentId, kindProblem, proofsCommentBody } from './chunk-AF4E4I4T.js';
4
4
  import { runWorkComment } from './chunk-H7MGR2GN.js';
5
- import { runnerMatcher } from './chunk-UE2C4STC.js';
5
+ import { runnerMatcher } from './chunk-3UIXIGYT.js';
6
6
  import { runEmitDemo } from './chunk-ZCA34T7R.js';
7
7
  import { readNewestDemo } from './chunk-ER6KQCVJ.js';
8
8
  import { runEmitArtifact } from './chunk-W7E6IMEW.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outerlayer/cli",
3
- "version": "0.34.0-next.20261028164329",
3
+ "version": "0.34.0-next.20261028183303",
4
4
  "description": "OuterLayer CLI — commands: init, claude, connect, doctor, login, logout, sync, daemon (alias: watch), emit, demo, findings, work, spec, runner, hooks, mcp, context. Capture and sync coding-agent sessions, and record proof of factory work.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Magu Studios, Inc.",
@@ -409,7 +409,8 @@ and the reason. In a runner build, the host records the proofs again at the
409
409
  final commit, so a proof out of date only because of a later commit needs no
410
410
  reason. A row marked `uncited` or `failed` has no such excuse: make a
411
411
  test cite the criterion, or change a test that cites it, and run the command
412
- again. Exit 2 means it could not decide: fix the reason it prints and
412
+ again. When an `uncited` row names a file, name that file with a runner glob in
413
+ `.outerlayer-proofs.yaml` instead. Exit 2 means it could not decide: fix the reason it prints and
413
414
  run it again:
414
415
 
415
416
  outerlayer work release --item "$OUTERLAYER_WORK"
@@ -34,7 +34,8 @@ proof too, unless the policy file sets `criteria.test_proof: ci`. It also lists
34
34
  each criterion that the host's criteria judge fails without reading a test. A
35
35
  row marked `uncited` has no proof and no test at HEAD that cites it: put the id
36
36
  in a test's title or in a comment above it, as in `// proves AC-7-02`, and
37
- commit. A row marked `failed` names a criterion that the judge failed, whose
37
+ commit. When the row names a file that holds the id, that file is not read as a
38
+ test: name it with a runner glob in `.outerlayer-proofs.yaml`, and commit. A row marked `failed` names a criterion that the judge failed, whose
38
39
  citing tests have not changed: change a test that cites it, and commit.
39
40
 
40
41
  A commit makes every proof out of date, and each `--record` run starts the app
@@ -30,7 +30,7 @@ import { pathToFileURL } from "node:url";
30
30
  * - Ruby `*_spec.rb`, `*_test.rb` and `test_*.rb`
31
31
  * - Java, Kotlin: `*Test`, `*Tests`, `*IT`; Groovy `*Spec`; Scala `*Spec` and `*Test`
32
32
  * - C# `*Test.cs` and `*Tests.cs`, PHP `*Test.php`, Swift `*Tests.swift`
33
- * - Elixir `*_test.exs`, Dart `*_test.dart`, Rust files under `tests/`, `.bats` files
33
+ * - Elixir `*_test.exs`, Dart `*_test.dart`, Rust files under `tests/`, `.bats` and Gherkin `.feature` files
34
34
  */
35
35
  export const TEST_FILE = new RegExp(
36
36
  `(?:${[
@@ -46,21 +46,78 @@ export const TEST_FILE = new RegExp(
46
46
  String.raw`Tests?\.(?:cs|php)`,
47
47
  String.raw`Tests\.swift`,
48
48
  String.raw`(?:^|/)tests/.+\.rs`,
49
- String.raw`\.bats`,
49
+ String.raw`\.(?:bats|feature)`,
50
50
  ]
51
51
  .map((alternative) => `(?:${alternative})`)
52
52
  .join("|")})$`,
53
53
  );
54
54
 
55
+ /** Folders whose source files are tests. These are exact names. */
56
+ const TEST_FOLDERS = new Set(["test", "tests", "spec", "__tests__", "Test", "Tests"]);
57
+ /** A project or source-set folder named for its tests: `Wallet.Tests`, `UITests`, `jvmTest`. The capital T is what marks the name: `Contest` is not one. */
58
+ const TEST_FOLDER_SUFFIX = /Tests?$/;
59
+ /** Folders that hold the data of tests, not tests. Compared in lower case. */
60
+ const DATA_FOLDERS = new Set(["fixtures", "fixture", "__fixtures__", "testdata", "test-data", "snapshots", "__snapshots__", "resources"]);
61
+ /** Folders that hold other people's code or build output. Compared in lower case. */
62
+ const VENDORED_FOLDERS = new Set(["node_modules", "vendor", "third_party", "target", "build", "dist", "out", "obj", ".git"]);
63
+ /** The extensions of the source languages whose files a test folder can hold. */
64
+ const SOURCE_EXTENSIONS = new Set(
65
+ `rb py js jsx ts tsx mjs cjs mts cts java kt kts scala sc groovy gvy cs fs fsx vb php ex exs swift dart rs go c cc cpp cxx h hh hpp hxx m mm
66
+ clj cljs cljc hs lhs ml mli lua pl pm t sh bash zsh zig jl r erl hrl nim cr d elm purs vue svelte robot`.split(/\s+/),
67
+ );
68
+ /** The extensions of documentation files, which a search for an id skips. */
69
+ const DOCUMENTATION_EXTENSIONS = new Set(["md", "mdx", "markdown", "rst", "txt", "adoc"]);
70
+
71
+ /** The lower-case extension of a file name; none for `Makefile`, `.rb` or `wallet.`. */
72
+ function extensionOf(file) {
73
+ const dot = file.lastIndexOf(".");
74
+ return dot <= 0 ? "" : file.slice(dot + 1).toLowerCase();
75
+ }
76
+
55
77
  /**
56
- * Whether the repository-relative `path` holds tests. `inRunnerGlob` is the
57
- * caller's test for the files that a runner glob in `.outerlayer-proofs.yaml`
58
- * matches. It only adds files: a file the built-in names read stays read. The
59
- * criteria judge and `outerlayer work proofs` pass it. This script reads the
60
- * built-in names alone, and the CLI's two readers add the runner globs.
78
+ * Whether `path` is a source file in a test folder: a folder in its path is
79
+ * named for tests, and none holds test data or other people's code. The
80
+ * folder rule reads helpers and library code that sit in such a folder too.
81
+ * A file cites a criterion only when it holds the criterion's id, so reading such a file as a test does no harm.
82
+ */
83
+ function inTestFolder(path) {
84
+ const folders = path.split("/");
85
+ const file = folders.pop();
86
+ if (!SOURCE_EXTENSIONS.has(extensionOf(file))) return false;
87
+ let named = false;
88
+ for (const folder of folders) {
89
+ const lower = folder.toLowerCase();
90
+ if (DATA_FOLDERS.has(lower) || VENDORED_FOLDERS.has(lower)) return false;
91
+ if (TEST_FOLDERS.has(folder) || TEST_FOLDER_SUFFIX.test(folder)) named = true;
92
+ }
93
+ return named;
94
+ }
95
+
96
+ /**
97
+ * Whether the repository-relative `path` holds tests: a built-in name, a
98
+ * source file in a test folder, or a file the caller's `inRunnerGlob` accepts.
99
+ * `inRunnerGlob` is the caller's test for the files that a runner glob in
100
+ * `.outerlayer-proofs.yaml` matches. A name or a test folder reads a file even
101
+ * when the caller's glob refuses it, and a runner glob only adds files. The criteria judge and
102
+ * `outerlayer work proofs` pass it. This script reads names and folders alone,
103
+ * and the CLI's two readers add the runner globs.
61
104
  */
62
105
  export function isTestFile(path, inRunnerGlob) {
63
- return TEST_FILE.test(path) || (inRunnerGlob?.(path) ?? false);
106
+ return TEST_FILE.test(path) || inTestFolder(path) || (inRunnerGlob?.(path) ?? false);
107
+ }
108
+
109
+ /**
110
+ * Whether a search for a criterion's id outside the tests may read `path`.
111
+ * It skips documentation, the acceptance folder at the root, the proofs file,
112
+ * and vendored or generated folders. The caller also leaves out the files it
113
+ * reads as tests.
114
+ */
115
+ export function isSearchableFile(path) {
116
+ const folders = path.split("/");
117
+ const file = folders.pop();
118
+ if (DOCUMENTATION_EXTENSIONS.has(extensionOf(file))) return false;
119
+ if (path === ".outerlayer-proofs.yaml" || folders[0] === "acceptance") return false;
120
+ return !folders.some((folder) => VENDORED_FOLDERS.has(folder.toLowerCase()));
64
121
  }
65
122
  /** A line that is only a comment: `//`, `#`, `*`, `/*`, `--` or `<!--` first. */
66
123
  const COMMENT_LINE = /^\s*(?:\/\/|#|\*|\/\*|--|<!--)/;