@antelopejs/tooling-configs 0.4.1 → 0.5.1

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 (41) hide show
  1. package/README.md +68 -29
  2. package/dist/bin/api-diff.mjs +235 -37
  3. package/dist/bin/body-check.mjs +14 -11
  4. package/dist/bin/capture.mjs +173 -54
  5. package/dist/bin/check-size.mjs +1 -1
  6. package/dist/bin/checks.mjs +166 -11
  7. package/dist/bin/comment-proof.mjs +29 -7
  8. package/dist/bin/garden.mjs +8 -58
  9. package/dist/bin/lease.mjs +48 -11
  10. package/dist/bin/ratchet.mjs +48 -14
  11. package/dist/bin/suppressions.mjs +3 -3
  12. package/dist/bin/sync.mjs +199 -80
  13. package/dist/bin/verify.mjs +1163 -474
  14. package/dist/capture/index.d.mts +6 -1
  15. package/dist/capture/index.mjs +1 -1
  16. package/dist/{ci-workflow-37qJa9LX.mjs → ci-workflow-COJUT12b.mjs} +121 -1
  17. package/dist/eslint.d.mts +16 -3
  18. package/dist/eslint.mjs +21 -6
  19. package/dist/formal/index.d.mts +20 -4
  20. package/dist/formal/index.mjs +71 -19
  21. package/dist/{map-B23_WMGE.mjs → map-DRyYz_Fw.mjs} +20 -1
  22. package/dist/oxc/anti-slop/index.mjs +156 -421
  23. package/dist/oxc/guardrails/index.d.mts +1 -1
  24. package/dist/oxc/guardrails/index.mjs +789 -103
  25. package/dist/oxc/lint.d.mts +13 -15
  26. package/dist/oxc/lint.mjs +19 -29
  27. package/dist/{package-CqqBgE8Y.mjs → package-Dn7VTFUW.mjs} +71 -17
  28. package/dist/{proof-stamp-DDDC0J6l.mjs → proof-stamp-DLWpPwQE.mjs} +72 -10
  29. package/dist/{ratchet-Q-JXuZIX.mjs → ratchet-ClfblHNJ.mjs} +18 -15
  30. package/dist/require-safety-comment-for-type-assertion-mnb0CIxa.mjs +181 -0
  31. package/dist/{scenes-DZVXkcxS.mjs → scenes-d-VQ0LOm.mjs} +4 -1
  32. package/dist/semver-BDxeEcP_.mjs +57 -0
  33. package/dist/{suppression-base-9L8dlMQK.mjs → suppression-base-Drnl6Y7F.mjs} +2 -2
  34. package/dist/{suppression-budget-C0SkPO5R.mjs → suppression-budget-Dvb_IqBo.mjs} +1 -1
  35. package/dist/{suppressions-DM60NkvL.mjs → suppressions-BroaaGJ_.mjs} +1 -1
  36. package/dist/{templates-BKZv-BRw.mjs → templates-lJBZFskp.mjs} +8 -3
  37. package/dist/type-aware-rules-DMuN6sHb.mjs +30 -0
  38. package/dist/{typescript-DAgQIAAR.mjs → typescript-BBbry7uU.mjs} +123 -27
  39. package/dist/verify/index.d.mts +60 -15
  40. package/package.json +3 -1
  41. package/dist/require-safety-comment-for-type-assertion-BBQ669kj.mjs +0 -83
@@ -1,20 +1,41 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as runCli } from "../cli-4Tv71vYk.mjs";
3
3
  import { c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
4
- import { c as revisionCounts, i as stampProof, o as compareRevisions } from "../proof-stamp-DDDC0J6l.mjs";
5
- import { o as packagesAt, t as emitPackage } from "../typescript-DAgQIAAR.mjs";
6
- import { copyFileSync, mkdirSync } from "node:fs";
7
- import { dirname, join, relative } from "node:path";
4
+ import { c as revisionCounts, i as stampProof, o as compareRevisions } from "../proof-stamp-DLWpPwQE.mjs";
5
+ import { a as listsNoFiles, c as packagesAt, n as extendedConfigs, t as emitPackage } from "../typescript-BBbry7uU.mjs";
6
+ import { copyFileSync, existsSync, mkdirSync } from "node:fs";
7
+ import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
8
8
  //#region src/guardrails/comment-proof.ts
9
- /** Proves comment-free JavaScript emit matches, including private packages and excluding tests. */
9
+ /** A private repository root whose `tsconfig.json` parses to no inputs and is extended by another tracked package: the base its packages extend, which compiles nothing on its own. */
10
+ function isWorkspaceBase(worktree, { directory, manifest }, tracked) {
11
+ if (directory !== "." || manifest.private !== true) return false;
12
+ const base = resolve(worktree, "tsconfig.json");
13
+ return listsNoFiles(worktree) && tracked.some((other) => other.directory !== "." && extendedConfigs(join(worktree, other.directory)).includes(base));
14
+ }
15
+ /** The first base a package's tsconfig extends that lies inside the repository but is absent from the commit, such as a generated file, as a repository path. */
16
+ function uncommittedBase(worktree, directory) {
17
+ const missing = extendedConfigs(join(worktree, directory)).find((file) => !existsSync(file));
18
+ if (missing === void 0) return void 0;
19
+ const path = relative(worktree, missing);
20
+ return path.startsWith(`..${sep}`) || isAbsolute(path) ? void 0 : path.split(sep).join("/");
21
+ }
22
+ /** Proves comment-free JavaScript emit matches, including private packages and excluding tests. A workspace base tsconfig is left out. A package whose tsconfig extends a repository file the commit lacks cannot compile from it, so it is skipped and reported; a missing base outside the repository still fails. */
10
23
  function commentProof(root, baseRef) {
24
+ const notices = /* @__PURE__ */ new Set();
25
+ const skipped = /* @__PURE__ */ new Map();
11
26
  const result = compareRevisions(root, baseRef, "Comment proof", (worktree, output, scratch) => {
12
- const packages = packagesAt(worktree, false);
27
+ const tracked = packagesAt(worktree, false);
28
+ const packages = tracked.filter((candidate) => {
29
+ const base = uncommittedBase(worktree, candidate.directory);
30
+ if (base !== void 0) skipped.set(candidate.directory, base);
31
+ return base === void 0 && !isWorkspaceBase(worktree, candidate, tracked);
32
+ });
13
33
  let entries = 0;
14
34
  for (const { directory } of packages) {
15
35
  const key = directory === "." ? "_root" : directory;
16
36
  const emittedRoot = join(scratch, key);
17
37
  const emitted = emitPackage(join(worktree, directory), emittedRoot, false);
38
+ if (emitted.notice !== void 0) notices.add(emitted.notice);
18
39
  for (const file of emitted.files) {
19
40
  const path = join(output, key, relative(emittedRoot, file));
20
41
  mkdirSync(dirname(path), { recursive: true });
@@ -27,9 +48,10 @@ function commentProof(root, baseRef) {
27
48
  entries
28
49
  };
29
50
  });
51
+ const skips = [...skipped].sort(([a], [b]) => a.localeCompare(b)).map(([directory, file]) => `Comment proof: skipped ${directory}, its tsconfig extends ${file}, which the commit does not hold.\n`).join("");
30
52
  return {
31
53
  ...result,
32
- output: stampProof(root, `antelopejs-comment-proof ${baseRef}`, baseRef, result.output + revisionCounts(root, baseRef))
54
+ output: stampProof(root, `antelopejs-comment-proof ${baseRef}`, baseRef, result.output + skips + [...notices].sort().join("") + revisionCounts(root, baseRef))
33
55
  };
34
56
  }
35
57
  //#endregion
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
+ import { t as admits } from "../semver-BDxeEcP_.mjs";
2
3
  import { c as object, d as optTime, f as parseJson, h as time, i as isObject, l as optNum, m as strings, n as children, o as list, p as str, r as flag, s as num, t as child, u as optStr } from "../json-CG2L7YFl.mjs";
3
4
  import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
4
- import { c as ciNodeCallers, d as RENOVATE_CONFIGS, f as RENOVATE_PRESET, i as CI_RENOVATE_SYNC_REF, l as ciRenovateSyncCallers, n as CI_NODE_REF, r as CI_PATH, t as CI_CONTEXT } from "../ci-workflow-37qJa9LX.mjs";
5
+ import { c as ciNodeCallers, d as RENOVATE_CONFIGS, f as RENOVATE_PRESET, i as CI_RENOVATE_SYNC_REF, l as ciRenovateSyncCallers, n as CI_NODE_REF, r as CI_PATH, t as CI_CONTEXT } from "../ci-workflow-COJUT12b.mjs";
5
6
  import { i as ghToken, n as createApi, t as ApiError } from "../api-CCOiLN3w.mjs";
6
7
  import { parseArgs } from "node:util";
7
8
  import { inflateRawSync } from "node:zlib";
@@ -769,6 +770,8 @@ async function tooling(context) {
769
770
  const CHECK$1 = "conformance";
770
771
  const DAY$2 = 864e5;
771
772
  const MEND_EXEMPT = /* @__PURE__ */ new Set(["k8s-gitops-infra"]);
773
+ /** Repositories whose ci.yml runs its own jobs: tooling-configs shards its tests and checks its docs action at HEAD, which ci-node.yml cannot do. */
774
+ const CI_CALLER_EXEMPT = /* @__PURE__ */ new Set(["tooling-configs"]);
772
775
  function problem(repo, subject, evidence, doneMeans) {
773
776
  return finding({
774
777
  repo: repo.name,
@@ -777,6 +780,7 @@ function problem(repo, subject, evidence, doneMeans) {
777
780
  }, evidence, doneMeans);
778
781
  }
779
782
  async function ciCaller(context, repo) {
783
+ if (CI_CALLER_EXEMPT.has(repo.name)) return [];
780
784
  const text = await context.file(repo, CI_PATH);
781
785
  if (text === void 0) return [problem(repo, "ci-caller", `${CI_PATH} does not exist.`, `${CI_PATH} has a job calling ${CI_NODE_REF}.`)];
782
786
  const callers = ciNodeCallers(text);
@@ -802,7 +806,9 @@ async function installed(context, repo, range) {
802
806
  return (await context.file(repo, "pnpm-lock.yaml"))?.match(LOCK_ENTRY)?.[1] ?? range.replace(/^[^\d]*/, "");
803
807
  }
804
808
  async function toolingVersion(context, repo) {
805
- const range = (await context.packages(repo)).map(({ tooling: declared }) => declared).find((declared) => declared !== void 0);
809
+ const manifests = await context.packages(repo);
810
+ if (manifests.some(({ name }) => name === "@antelopejs/tooling-configs")) return [];
811
+ const range = manifests.map(({ tooling: declared }) => declared).find((declared) => declared !== void 0);
806
812
  const latest = await tooling(context);
807
813
  const done = `@antelopejs/tooling-configs is ${latest} or a Renovate PR bumping it is under 7 days old.`;
808
814
  if (range === void 0) return [problem(repo, "tooling-configs", "@antelopejs/tooling-configs is not a dependency.", done)];
@@ -1145,62 +1151,6 @@ const packageSize = {
1145
1151
  }
1146
1152
  };
1147
1153
  //#endregion
1148
- //#region src/garden/semver.ts
1149
- const VERSION = /^v?(\d+)\.(\d+)\.(\d+)/;
1150
- function parse(text) {
1151
- const match = VERSION.exec(text.trim());
1152
- return match ? [
1153
- Number(match[1]),
1154
- Number(match[2]),
1155
- Number(match[3])
1156
- ] : void 0;
1157
- }
1158
- function compare$1(a, b) {
1159
- return a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
1160
- }
1161
- function caret(floor) {
1162
- if (floor[0] > 0) return [
1163
- floor[0] + 1,
1164
- 0,
1165
- 0
1166
- ];
1167
- return floor[1] > 0 ? [
1168
- 0,
1169
- floor[1] + 1,
1170
- 0
1171
- ] : [
1172
- 0,
1173
- 0,
1174
- floor[2] + 1
1175
- ];
1176
- }
1177
- function comparator(term, version) {
1178
- const operator = /^(>=|<=|>|<|=|\^|~)?\s*(.*)$/.exec(term.trim());
1179
- const bound = parse(operator?.[2] ?? "");
1180
- if (!operator || !bound) return true;
1181
- switch (operator[1]) {
1182
- case ">=": return compare$1(version, bound) >= 0;
1183
- case ">": return compare$1(version, bound) > 0;
1184
- case "<=": return compare$1(version, bound) <= 0;
1185
- case "<": return compare$1(version, bound) < 0;
1186
- case "^": return compare$1(version, bound) >= 0 && compare$1(version, caret(bound)) < 0;
1187
- case "~": return compare$1(version, bound) >= 0 && compare$1(version, [
1188
- bound[0],
1189
- bound[1] + 1,
1190
- 0
1191
- ]) < 0;
1192
- default: return compare$1(version, bound) === 0;
1193
- }
1194
- }
1195
- /** Whether a plain npm range (`^`, `~`, comparators, `||`, `*`) admits a release; wildcards and tags admit everything. */
1196
- function admits(range, release) {
1197
- const version = parse(release);
1198
- if (!version) return true;
1199
- return range.split("||").some((alternative) => {
1200
- return alternative.replace(/(>=|<=|>|<|=|\^|~)\s+/g, "$1").trim().split(/\s+/).every((term) => comparator(term, version));
1201
- });
1202
- }
1203
- //#endregion
1204
1154
  //#region src/garden/checks/templates.ts
1205
1155
  const DAY = 864e5;
1206
1156
  const INTERFACES = "interfaces";
@@ -122,15 +122,15 @@ function launch(command, env) {
122
122
  const STAT_AFTER_COMM = 2;
123
123
  const STAT_PPID = 1;
124
124
  const STAT_PGID = 2;
125
- const STAT_START = 19;
126
- const DEAD_STATES = /* @__PURE__ */ new Set(["Z", "X"]);
125
+ const STAT_START$1 = 19;
126
+ const DEAD_STATES$1 = /* @__PURE__ */ new Set(["Z", "X"]);
127
127
  function fromProc(pid) {
128
128
  const stat = readFileSync(`/proc/${pid}/stat`, "utf8");
129
129
  const fields = stat.slice(stat.lastIndexOf(")") + STAT_AFTER_COMM).split(" ");
130
- if (DEAD_STATES.has(fields[0] ?? "")) return void 0;
130
+ if (DEAD_STATES$1.has(fields[0] ?? "")) return void 0;
131
131
  return {
132
132
  pid,
133
- start: `${readFileSync("/proc/sys/kernel/random/boot_id", "utf8").trim()}:${fields[STAT_START]}`,
133
+ start: `${readFileSync("/proc/sys/kernel/random/boot_id", "utf8").trim()}:${fields[STAT_START$1]}`,
134
134
  uid: statSync(`/proc/${pid}`).uid,
135
135
  pgid: Number(fields[STAT_PGID]),
136
136
  ppid: Number(fields[STAT_PPID])
@@ -150,7 +150,7 @@ function fromPs(pid) {
150
150
  "ignore"
151
151
  ]
152
152
  }).trim().split(/\s+/u);
153
- if (state === void 0 || DEAD_STATES.has(state.slice(0, 1))) return void 0;
153
+ if (state === void 0 || DEAD_STATES$1.has(state.slice(0, 1))) return void 0;
154
154
  return {
155
155
  pid,
156
156
  start: started.join(" "),
@@ -184,6 +184,8 @@ function assertSignallable(pid) {
184
184
  const READY_TIMEOUT_MS = 3e4;
185
185
  const KILL_WAIT_MS$1 = 2e3;
186
186
  const POLL_MS$1 = 50;
187
+ const STAT_START = 19;
188
+ const DEAD_STATES = /* @__PURE__ */ new Set(["Z", "X"]);
187
189
  const CACHED_BINARY = /^mongod-.+-(\d+)\.(\d+)\.(\d+)$/u;
188
190
  function executable(path) {
189
191
  try {
@@ -259,11 +261,44 @@ function mongodPid(dbpath) {
259
261
  function serves(pid, dbpath) {
260
262
  return commandLine(pid).includes(dbpath);
261
263
  }
262
- /** Waits for the process itself: mongod empties `mongod.lock` before it exits. */
263
- async function untilGone$1(pid, dbpath, ms) {
264
+ /** The fields of `/proc/<path>/stat` after the command name, the state first; `undefined` when it cannot be read. */
265
+ function statFields(path) {
266
+ try {
267
+ const stat = readFileSync(`/proc/${path}/stat`, "utf8");
268
+ return stat.slice(stat.lastIndexOf(")") + 2).split(" ");
269
+ } catch {
270
+ return;
271
+ }
272
+ }
273
+ /** True while some thread of `pid` has not exited, a main thread that exited before the others included. */
274
+ function anyThreadRuns(pid) {
275
+ let tids;
276
+ try {
277
+ tids = readdirSync(`/proc/${pid}/task`);
278
+ } catch {
279
+ return false;
280
+ }
281
+ return tids.some((tid) => {
282
+ const state = statFields(`${pid}/task/${tid}`)?.[0];
283
+ return state !== void 0 && !DEAD_STATES.has(state);
284
+ });
285
+ }
286
+ /**
287
+ * A check that answers whether the mongod `pid` serving `dbpath` still runs. On Linux it holds
288
+ * until no thread of the process started at the same time as `pid` now runs: the command line
289
+ * reads empty from the moment mongod drops its memory, while its threads still hold its port. A
290
+ * reused pid has another start time. Elsewhere it holds while the command line names `dbpath`.
291
+ */
292
+ function runningCheck(pid, dbpath) {
293
+ if (process.platform !== "linux") return () => serves(pid, dbpath);
294
+ const start = statFields(String(pid))?.[STAT_START];
295
+ return () => start !== void 0 && statFields(String(pid))?.[STAT_START] === start && anyThreadRuns(pid);
296
+ }
297
+ /** Waits up to `ms` for `runs` to answer false; answers whether it did. */
298
+ async function untilGone$1(runs, ms) {
264
299
  const deadline = Date.now() + ms;
265
- while (serves(pid, dbpath) && Date.now() < deadline) await setTimeout(POLL_MS$1);
266
- return !serves(pid, dbpath);
300
+ while (runs() && Date.now() < deadline) await setTimeout(POLL_MS$1);
301
+ return !runs();
267
302
  }
268
303
  function signal$1(pid, name) {
269
304
  assertSignallable(pid);
@@ -280,12 +315,14 @@ function signal$1(pid, name) {
280
315
  async function stopMongod(dbpath, graceMs) {
281
316
  const pid = mongodPid(dbpath);
282
317
  if (pid === void 0) return;
318
+ const runs = runningCheck(pid, dbpath);
319
+ if (!runs()) return;
283
320
  if (graceMs > 0) {
284
321
  signal$1(pid, "SIGTERM");
285
- if (await untilGone$1(pid, dbpath, graceMs)) return;
322
+ if (await untilGone$1(runs, graceMs)) return;
286
323
  }
287
324
  signal$1(pid, "SIGKILL");
288
- if (await untilGone$1(pid, dbpath, KILL_WAIT_MS$1)) return;
325
+ if (await untilGone$1(runs, KILL_WAIT_MS$1)) return;
289
326
  throw new Error(`antelopejs-lease: mongod ${pid} was still running ${KILL_WAIT_MS$1 / 1e3} s after SIGKILL`);
290
327
  }
291
328
  async function holder(port) {
@@ -2,13 +2,13 @@
2
2
  import { c as parseCeilings, l as readCeilings, t as CEILINGS_FILE } from "../ceilings-B7KayYIG.mjs";
3
3
  import { n as renamedPaths } from "../renames-L2owF5GD.mjs";
4
4
  import { t as runCli } from "../cli-4Tv71vYk.mjs";
5
- import { c as repositoryRoot, l as resolveRevision, s as repositoryPath, t as LINT_CONFIG } from "../files-DJ0TeaTU.mjs";
6
- import { n as ratchet, r as withPreviousTree } from "../ratchet-Q-JXuZIX.mjs";
5
+ import { c as repositoryRoot, l as resolveRevision, t as LINT_CONFIG } from "../files-DJ0TeaTU.mjs";
6
+ import { n as ratchet, r as withPreviousTree } from "../ratchet-ClfblHNJ.mjs";
7
7
  import { t as lintDiagnostics } from "../oxlint-DIV-lLSS.mjs";
8
- import { d as stagedAdditions, f as stagedChanges, u as previousLine } from "../suppression-budget-C0SkPO5R.mjs";
9
- import { n as suppressionBase } from "../suppression-base-9L8dlMQK.mjs";
8
+ import { d as stagedAdditions, f as stagedChanges, u as previousLine } from "../suppression-budget-Dvb_IqBo.mjs";
9
+ import { n as suppressionBase } from "../suppression-base-Drnl6Y7F.mjs";
10
10
  import { existsSync } from "node:fs";
11
- import { join, resolve } from "node:path";
11
+ import { join } from "node:path";
12
12
  import { execFileSync, spawnSync } from "node:child_process";
13
13
  import { parseArgs } from "node:util";
14
14
  //#region src/guardrails/approved-raises.ts
@@ -44,6 +44,7 @@ function stagedNames(root, filter) {
44
44
  "diff",
45
45
  "--cached",
46
46
  "--name-only",
47
+ "--ignore-submodules=all",
47
48
  `--diff-filter=${filter}`,
48
49
  "-z"
49
50
  ], {
@@ -169,15 +170,47 @@ function hiddenTracked(root) {
169
170
  encoding: "utf8"
170
171
  }).split("\0").filter((line) => /^(S|[a-z]) /u.test(line)).map((line) => line.slice(2));
171
172
  }
172
- function approvalRefusal(root, rule, max, holds) {
173
- const unstaged = execFileSync("git", [
173
+ /** Tracked files whose working copy differs from the index, deleted ones included. */
174
+ function unstagedNames(root) {
175
+ return execFileSync("git", [
174
176
  "diff",
175
177
  "--name-only",
178
+ "--no-renames",
176
179
  "-z"
177
180
  ], {
178
181
  cwd: root,
179
182
  encoding: "utf8"
180
183
  }).split("\0").filter(Boolean);
184
+ }
185
+ /** Per file and rule, the findings of whichever run reports more of them. */
186
+ function higherPerFile(first, second) {
187
+ const key = ({ file, rule }) => `${file}\0${rule}`;
188
+ const left = Map.groupBy(first, key);
189
+ const right = Map.groupBy(second, key);
190
+ return [.../* @__PURE__ */ new Set([...left.keys(), ...right.keys()])].flatMap((group) => {
191
+ const a = left.get(group) ?? [];
192
+ const b = right.get(group) ?? [];
193
+ return a.length >= b.length ? a : b;
194
+ });
195
+ }
196
+ /**
197
+ * The findings in `targets` as the index holds them. Each file the working
198
+ * tree has is linted there, where untracked generated types resolve; a file
199
+ * whose working copy differs, is deleted, or is hidden from git (skip-worktree,
200
+ * assume-unchanged), or every file when a lint configuration does, is also
201
+ * linted in a checkout of the index, and keeps, per rule, the run that reports
202
+ * more.
203
+ */
204
+ function stagedDiagnostics(root, targets) {
205
+ const unstaged = /* @__PURE__ */ new Set([...unstagedNames(root), ...hiddenTracked(root)]);
206
+ const present = targets.filter((file) => existsSync(join(root, file)));
207
+ const inTree = present.length ? lintDiagnostics(root, void 0, present, STAGED_LINT) : [];
208
+ const inIndex = [...unstaged].some((file) => LINT_CONFIG.test(file)) ? targets : targets.filter((file) => unstaged.has(file));
209
+ if (!inIndex.length) return inTree;
210
+ return higherPerFile(inTree, withPreviousTree(root, "HEAD", [], (tree) => lintDiagnostics(tree, void 0, inIndex, STAGED_LINT), { wholeIndex: true }));
211
+ }
212
+ function approvalRefusal(root, rule, max, holds) {
213
+ const unstaged = unstagedNames(root);
181
214
  if (unstaged.length) return `${rule}: an approved raise is refused while ${unstaged.length} tracked file(s) have unstaged changes (${unstaged[0]}); stage or stash them first.`;
182
215
  const hidden = hiddenTracked(root);
183
216
  if (hidden.length) return `${rule}: an approved raise is refused while ${hidden.length} tracked file(s) are skip-worktree or assume-unchanged (${hidden[0]}); disable the sparse checkout or clear the bit first.`;
@@ -212,7 +245,8 @@ function inRanges(ranges, file, line) {
212
245
  return ranges.get(file)?.some(({ start, end }) => line >= start && line <= end) ?? false;
213
246
  }
214
247
  /**
215
- * Fails each ceilinged rule whose findings in the staged files outnumber both
248
+ * Fails each ceilinged rule whose findings in the staged files, as the index
249
+ * holds them, outnumber both
216
250
  * what the same files, rename sources and deleted files had at HEAD and the
217
251
  * staged findings that sit, on a line unchanged since the merge-base of HEAD
218
252
  * with the pull request base (`GITHUB_BASE_REF`, else `origin/HEAD`), where
@@ -225,17 +259,17 @@ function inRanges(ranges, file, line) {
225
259
  * rise above both fails, and lists the findings on the lines that differ from
226
260
  * HEAD and from the base.
227
261
  */
228
- function stagedRatchet(root, files) {
262
+ function stagedRatchet(root) {
229
263
  const approved = parseApprovedRaises();
230
264
  const raised = unlistedRaises(root, approved);
231
265
  const accepted = [];
232
- const targets = files ?? stagedNames(root, "ACMR");
266
+ const targets = stagedNames(root, "ACMR");
233
267
  if (!targets.length) return {
234
268
  failures: raised,
235
269
  accepted
236
270
  };
237
271
  const ceilings = readCeilings(root);
238
- const after = lintDiagnostics(root, void 0, targets, STAGED_LINT).filter(({ rule }) => Object.hasOwn(ceilings.rules, rule) || approved.has(rule));
272
+ const after = stagedDiagnostics(root, targets).filter(({ rule }) => Object.hasOwn(ceilings.rules, rule) || approved.has(rule));
239
273
  if (!after.length) return {
240
274
  failures: raised,
241
275
  accepted
@@ -300,8 +334,8 @@ function stagedRatchet(root, files) {
300
334
  }
301
335
  //#endregion
302
336
  //#region src/bin/ratchet.ts
303
- function stagedResult(root, files) {
304
- const staged = stagedRatchet(root, files.length ? files.map((file) => repositoryPath(root, resolve(file))) : void 0);
337
+ function stagedResult(root) {
338
+ const staged = stagedRatchet(root);
305
339
  return {
306
340
  failures: staged.failures,
307
341
  accepted: staged.accepted,
@@ -324,7 +358,7 @@ runCli(() => {
324
358
  if (values.base !== void 0 && values.staged) throw new Error("--base cannot be combined with --staged.");
325
359
  if (values.update && values.staged) throw new Error("--staged cannot be combined with --update.");
326
360
  if (positionals.length && !values.staged) throw new Error("File arguments require --staged.");
327
- const result = values.staged ? stagedResult(root, positionals) : {
361
+ const result = values.staged ? stagedResult(root) : {
328
362
  ...ratchet(root, values.update, values.base === void 0 ? void 0 : resolveRevision(root, values.base), suppressionBase(root, values.base)),
329
363
  accepted: []
330
364
  };
@@ -2,9 +2,9 @@
2
2
  import { t as runCli } from "../cli-4Tv71vYk.mjs";
3
3
  import { c as repositoryRoot, r as changedFiles } from "../files-DJ0TeaTU.mjs";
4
4
  import { n as unusedDirectives } from "../oxlint-DIV-lLSS.mjs";
5
- import { c as stagedSuppressions, i as checkSuppressions, l as checkPolicy, s as stagedNames } from "../suppression-budget-C0SkPO5R.mjs";
6
- import { c as suppressionsIn, i as inWorktree } from "../suppressions-DM60NkvL.mjs";
7
- import { n as suppressionBase, t as raisedCeilings } from "../suppression-base-9L8dlMQK.mjs";
5
+ import { c as stagedSuppressions, i as checkSuppressions, l as checkPolicy, s as stagedNames } from "../suppression-budget-Dvb_IqBo.mjs";
6
+ import { c as suppressionsIn, i as inWorktree } from "../suppressions-BroaaGJ_.mjs";
7
+ import { n as suppressionBase, t as raisedCeilings } from "../suppression-base-Drnl6Y7F.mjs";
8
8
  import { readdirSync } from "node:fs";
9
9
  import { dirname, join } from "node:path";
10
10
  import { execFileSync, spawnSync } from "node:child_process";