@antelopejs/tooling-configs 0.2.17 → 0.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -21
- package/dist/bin/api-diff.mjs +25 -14
- package/dist/bin/body-check.mjs +3 -3
- package/dist/bin/capture.d.mts +1 -0
- package/dist/bin/capture.mjs +559 -0
- package/dist/bin/check-size.mjs +3 -3
- package/dist/bin/checks.mjs +24 -6
- package/dist/bin/comment-proof.mjs +3 -3
- package/dist/bin/garden.mjs +229 -28
- package/dist/bin/lease.d.mts +1 -0
- package/dist/bin/lease.mjs +1053 -0
- package/dist/bin/ratchet.mjs +146 -100
- package/dist/bin/suppressions.mjs +5 -5
- package/dist/bin/sync.mjs +150 -176
- package/dist/bin/verify.mjs +238 -125
- package/dist/capture/index.d.mts +50 -0
- package/dist/capture/index.mjs +2 -0
- package/dist/{ci-workflow-ChW4He0r.mjs → ci-workflow-DVkpwauQ.mjs} +12 -0
- package/dist/{files-Bc036sJW.mjs → files-DJ0TeaTU.mjs} +10 -4
- package/dist/formal/index.d.mts +40 -0
- package/dist/formal/index.mjs +205 -0
- package/dist/oxc/anti-slop/index.mjs +717 -16
- package/dist/oxc/fmt.mjs +1 -1
- package/dist/oxc/guardrails/index.d.mts +1 -1
- package/dist/oxc/guardrails/index.mjs +93 -5
- package/dist/oxc/lint.d.mts +9 -0
- package/dist/oxc/lint.mjs +14 -3
- package/dist/{oxlint-Bltmk8-6.mjs → oxlint-DIV-lLSS.mjs} +7 -3
- package/dist/{package-DTxLPNDu.mjs → package-BRTjkzt5.mjs} +26 -1
- package/dist/{proof-stamp-w-3j47A-.mjs → proof-stamp-DDDC0J6l.mjs} +3 -3
- package/dist/{ratchet-DwRj9h4L.mjs → ratchet-BAcLRYuM.mjs} +194 -21
- package/dist/scenes-DZVXkcxS.mjs +104 -0
- package/dist/shared-igPpEDpS.mjs +622 -0
- package/dist/{size-DNtWruCO.mjs → size-DBatLT-F.mjs} +2 -2
- package/dist/{suppression-base-DAfCXwjL.mjs → suppression-base-9L8dlMQK.mjs} +36 -11
- package/dist/{suppression-budget-Bd2GqMYb.mjs → suppression-budget-C0SkPO5R.mjs} +56 -19
- package/dist/{suppressions-BD_f8f7L.mjs → suppressions-DM60NkvL.mjs} +1 -1
- package/dist/templates-CypDm-j9.mjs +121 -0
- package/dist/{typescript-BmS5BmrS.mjs → typescript-CM0LrVP7.mjs} +2 -2
- package/dist/verify/index.d.mts +6 -1
- package/package.json +29 -4
- package/dist/shared-CoUt4GUm.mjs +0 -73
package/dist/bin/ratchet.mjs
CHANGED
|
@@ -1,100 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { l as readCeilings, t as CEILINGS_FILE } from "../ceilings-B7KayYIG.mjs";
|
|
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 {
|
|
6
|
-
import { n as ratchet } from "../ratchet-
|
|
7
|
-
import { t as lintDiagnostics } from "../oxlint-
|
|
8
|
-
import { d as stagedAdditions, f as stagedChanges, u as previousLine } from "../suppression-budget-
|
|
9
|
-
import { n as suppressionBase } from "../suppression-base-
|
|
10
|
-
import {
|
|
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-BAcLRYuM.mjs";
|
|
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";
|
|
10
|
+
import { existsSync } from "node:fs";
|
|
11
11
|
import { join, resolve } from "node:path";
|
|
12
12
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
13
13
|
import { parseArgs } from "node:util";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
cwd: root,
|
|
19
|
-
encoding: "utf8",
|
|
20
|
-
env: {
|
|
21
|
-
...process.env,
|
|
22
|
-
...env
|
|
23
|
-
},
|
|
24
|
-
input,
|
|
25
|
-
maxBuffer: 268435456
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function revisionEntries(root, revision) {
|
|
29
|
-
const entries = /* @__PURE__ */ new Map();
|
|
30
|
-
for (const entry of git(root, [
|
|
31
|
-
"ls-tree",
|
|
32
|
-
"-r",
|
|
33
|
-
"-z",
|
|
34
|
-
revision
|
|
35
|
-
], {}).split("\0")) {
|
|
36
|
-
const tab = entry.indexOf(" ");
|
|
37
|
-
if (tab > 0) entries.set(entry.slice(tab + 1), entry.slice(0, tab));
|
|
38
|
-
}
|
|
39
|
-
return entries;
|
|
40
|
-
}
|
|
14
|
+
//#region src/guardrails/approved-raises.ts
|
|
15
|
+
/** The environment variable that carries the raises the operator approved. */
|
|
16
|
+
const APPROVED_RAISES_ENV = "APPROVED_RAISES";
|
|
17
|
+
const ENTRY = /^([^=]+)=([0-9]{1,15})$/u;
|
|
41
18
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
19
|
+
* Parses `APPROVED_RAISES`, a space-separated list of `<rule>=<max>` entries
|
|
20
|
+
* where `<max>` is the ceiling the same commit writes for `<rule>`.
|
|
21
|
+
* Entries are split on space and tab only. The bash reader stops at the first
|
|
22
|
+
* line, so a newline anywhere makes the list malformed, as does a non-breaking
|
|
23
|
+
* space inside an entry.
|
|
24
|
+
* An unset or blank variable approves nothing. A bare rule, a non-numeric or
|
|
25
|
+
* oversized max, or a rule listed twice makes the whole list malformed, and
|
|
26
|
+
* a malformed list throws instead of approving any of its entries.
|
|
46
27
|
*/
|
|
47
|
-
function
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
], {
|
|
55
|
-
cwd: root,
|
|
56
|
-
stdio: "ignore"
|
|
57
|
-
}).status === 0;
|
|
58
|
-
const index = join(scratch, "index");
|
|
59
|
-
copyFileSync(git(root, [
|
|
60
|
-
"rev-parse",
|
|
61
|
-
"--path-format=absolute",
|
|
62
|
-
"--git-path",
|
|
63
|
-
"index"
|
|
64
|
-
], {}).trim(), index);
|
|
65
|
-
const env = { GIT_INDEX_FILE: index };
|
|
66
|
-
const head = exists ? revisionEntries(root, revision) : /* @__PURE__ */ new Map();
|
|
67
|
-
const restored = paths.filter((path) => head.has(path));
|
|
68
|
-
const removed = paths.filter((path) => !head.has(path));
|
|
69
|
-
if (restored.length) git(root, [
|
|
70
|
-
"update-index",
|
|
71
|
-
"-z",
|
|
72
|
-
"--index-info"
|
|
73
|
-
], env, restored.map((path) => `${head.get(path)}\t${path}\0`).join(""));
|
|
74
|
-
if (removed.length) git(root, [
|
|
75
|
-
"update-index",
|
|
76
|
-
"-z",
|
|
77
|
-
"--force-remove",
|
|
78
|
-
"--stdin"
|
|
79
|
-
], env, removed.map((path) => `${path}\0`).join(""));
|
|
80
|
-
const tree = join(scratch, "tree");
|
|
81
|
-
git(root, [
|
|
82
|
-
"checkout-index",
|
|
83
|
-
"-a",
|
|
84
|
-
"-f",
|
|
85
|
-
`--prefix=${tree}/`
|
|
86
|
-
], env);
|
|
87
|
-
if (existsSync(join(root, "node_modules"))) symlinkSync(join(root, "node_modules"), join(tree, "node_modules"), "dir");
|
|
88
|
-
return use(tree);
|
|
89
|
-
} finally {
|
|
90
|
-
rmSync(scratch, {
|
|
91
|
-
recursive: true,
|
|
92
|
-
force: true
|
|
93
|
-
});
|
|
28
|
+
function parseApprovedRaises(value = process.env[APPROVED_RAISES_ENV]) {
|
|
29
|
+
const approved = /* @__PURE__ */ new Map();
|
|
30
|
+
if (value?.includes("\n")) throw new Error(`${APPROVED_RAISES_ENV} is malformed: it holds a newline, which the shell reader would stop at, so nothing is approved.`);
|
|
31
|
+
for (const entry of (value ?? "").split(/[ \t]+/u).filter(Boolean)) {
|
|
32
|
+
const match = ENTRY.exec(entry);
|
|
33
|
+
if (match === null || approved.has(match[1])) throw new Error(`${APPROVED_RAISES_ENV} is malformed at ${JSON.stringify(entry)}: expected space-separated <rule>=<max> entries with a whole-number max and each rule once, so nothing is approved.`);
|
|
34
|
+
approved.set(match[1], Number(match[2]));
|
|
94
35
|
}
|
|
36
|
+
return approved;
|
|
95
37
|
}
|
|
96
38
|
//#endregion
|
|
97
39
|
//#region src/guardrails/staged-ratchet.ts
|
|
40
|
+
/** The staged hook measures the real tree and a scratch checkout, so a project that fails to load in either must stop it. */
|
|
41
|
+
const STAGED_LINT = { rejectBrokenProject: true };
|
|
98
42
|
function stagedNames(root, filter) {
|
|
99
43
|
return execFileSync("git", [
|
|
100
44
|
"diff",
|
|
@@ -112,7 +56,6 @@ function countByRule(diagnostics) {
|
|
|
112
56
|
for (const { rule } of diagnostics) counts.set(rule, (counts.get(rule) ?? 0) + 1);
|
|
113
57
|
return counts;
|
|
114
58
|
}
|
|
115
|
-
const LINT_CONFIG = /(?:^|\/)(?:oxlint\.config\.[cm]?[jt]s|\.oxlintrc\.jsonc?)$/u;
|
|
116
59
|
function comparisonBase(root) {
|
|
117
60
|
const base = suppressionBase(root);
|
|
118
61
|
const name = process.env.GITHUB_BASE_REF ? `origin/${process.env.GITHUB_BASE_REF}` : "origin/HEAD";
|
|
@@ -144,7 +87,7 @@ function previousDiagnostics(root, targets, revision) {
|
|
|
144
87
|
const previous = [.../* @__PURE__ */ new Set([...targets.map((file) => renames.get(file) ?? file), ...stagedNames(root, "D").map((file) => deletedFrom.get(file) ?? file)])];
|
|
145
88
|
return withPreviousTree(root, revision ?? "HEAD", previous.filter((file) => !LINT_CONFIG.test(file)), (tree) => {
|
|
146
89
|
const existing = previous.filter((file) => existsSync(join(tree, file)));
|
|
147
|
-
return existing.length ? lintDiagnostics(tree, void 0, existing) : [];
|
|
90
|
+
return existing.length ? lintDiagnostics(tree, void 0, existing, STAGED_LINT) : [];
|
|
148
91
|
});
|
|
149
92
|
}
|
|
150
93
|
/**
|
|
@@ -190,13 +133,81 @@ function branchCounts(root, revision) {
|
|
|
190
133
|
}).split("\0").filter((file) => file && !LINT_CONFIG.test(file));
|
|
191
134
|
const lint = (tree) => {
|
|
192
135
|
const existing = paths.filter((file) => existsSync(join(tree, file)));
|
|
193
|
-
return countByRule(existing.length ? lintDiagnostics(tree, void 0, existing) : []);
|
|
136
|
+
return countByRule(existing.length ? lintDiagnostics(tree, void 0, existing, STAGED_LINT) : []);
|
|
194
137
|
};
|
|
195
138
|
return {
|
|
196
139
|
before: withPreviousTree(root, revision, paths, lint),
|
|
197
140
|
after: withPreviousTree(root, revision, [], lint)
|
|
198
141
|
};
|
|
199
142
|
}
|
|
143
|
+
/** The ceilings `revision` (`:` for the index, which is what the commit will write; `HEAD:`) records; none when it has no ceilings file. */
|
|
144
|
+
function ceilingsAt(root, revision) {
|
|
145
|
+
const result = spawnSync("git", ["show", `${revision}${CEILINGS_FILE}`], {
|
|
146
|
+
cwd: root,
|
|
147
|
+
encoding: "utf8"
|
|
148
|
+
});
|
|
149
|
+
if (result.status !== 0) return {};
|
|
150
|
+
return parseCeilings(result.stdout, `${revision}${CEILINGS_FILE}`).rules;
|
|
151
|
+
}
|
|
152
|
+
/** Failures for each ceiling this commit raises that the variable does not list, so an approval for one rule cannot carry another. */
|
|
153
|
+
function unlistedRaises(root, approved) {
|
|
154
|
+
if (!approved.size) return [];
|
|
155
|
+
const head = ceilingsAt(root, "HEAD:");
|
|
156
|
+
return Object.entries(ceilingsAt(root, ":")).flatMap(([rule, count]) => approved.has(rule) || count <= (head[rule] ?? 0) ? [] : [`${rule}: this commit raises its ceiling from ${head[rule] ?? 0} to ${count}; APPROVED_RAISES does not list ${rule}.`]);
|
|
157
|
+
}
|
|
158
|
+
function unlisted(rule, approved) {
|
|
159
|
+
return approved.size ? [` APPROVED_RAISES does not list ${rule}.`] : [];
|
|
160
|
+
}
|
|
161
|
+
/** Tracked files git is told not to look at (`S` skip-worktree, lowercase assume-unchanged), whose working copy can differ from the index unseen. */
|
|
162
|
+
function hiddenTracked(root) {
|
|
163
|
+
return execFileSync("git", [
|
|
164
|
+
"ls-files",
|
|
165
|
+
"-v",
|
|
166
|
+
"-z"
|
|
167
|
+
], {
|
|
168
|
+
cwd: root,
|
|
169
|
+
encoding: "utf8"
|
|
170
|
+
}).split("\0").filter((line) => /^(S|[a-z]) /u.test(line)).map((line) => line.slice(2));
|
|
171
|
+
}
|
|
172
|
+
function approvalRefusal(root, rule, max, holds) {
|
|
173
|
+
const unstaged = execFileSync("git", [
|
|
174
|
+
"diff",
|
|
175
|
+
"--name-only",
|
|
176
|
+
"-z"
|
|
177
|
+
], {
|
|
178
|
+
cwd: root,
|
|
179
|
+
encoding: "utf8"
|
|
180
|
+
}).split("\0").filter(Boolean);
|
|
181
|
+
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
|
+
const hidden = hiddenTracked(root);
|
|
183
|
+
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.`;
|
|
184
|
+
const staged = ceilingsAt(root, ":")[rule];
|
|
185
|
+
const head = ceilingsAt(root, "HEAD:")[rule] ?? 0;
|
|
186
|
+
if (staged !== max) return `${rule}: APPROVED_RAISES approves ${max}, but the staged ${CEILINGS_FILE} records ${staged ?? "no ceiling"}; the commit must write exactly ${max}.`;
|
|
187
|
+
if (max <= head) return `${rule}: APPROVED_RAISES approves ${max}, but this commit does not raise the ceiling above ${head} at HEAD.`;
|
|
188
|
+
return holds > max ? `${rule}: the repository holds ${holds} findings, but APPROVED_RAISES approves at most ${max}.` : void 0;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Settles `rule` against its approved `max`: it passes while this commit
|
|
192
|
+
* raises the ceiling from HEAD's to exactly `max` and the repository holds no
|
|
193
|
+
* more than `max`, so an approval left set accepts nothing in a later commit.
|
|
194
|
+
*/
|
|
195
|
+
function settleApproved(root, rule, max, { holds, rise, shown }) {
|
|
196
|
+
const refusal = approvalRefusal(root, rule, max, holds);
|
|
197
|
+
if (refusal === void 0) return {
|
|
198
|
+
accepted: [`${rule} raised to ${max} (this commit adds ${rise}, ${holds} in the repository, ceiling ${max}), approved through APPROVED_RAISES`],
|
|
199
|
+
failures: []
|
|
200
|
+
};
|
|
201
|
+
return {
|
|
202
|
+
accepted: [],
|
|
203
|
+
failures: [refusal, ...shown.map((diagnostic) => ` ${diagnostic.location}: ${diagnostic.message}`)]
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function higherCounts(first, second) {
|
|
207
|
+
const higher = new Map(first);
|
|
208
|
+
for (const [rule, count] of second) higher.set(rule, Math.max(count, higher.get(rule) ?? 0));
|
|
209
|
+
return higher;
|
|
210
|
+
}
|
|
200
211
|
function inRanges(ranges, file, line) {
|
|
201
212
|
return ranges.get(file)?.some(({ start, end }) => line >= start && line <= end) ?? false;
|
|
202
213
|
}
|
|
@@ -215,11 +226,20 @@ function inRanges(ranges, file, line) {
|
|
|
215
226
|
* HEAD and from the base.
|
|
216
227
|
*/
|
|
217
228
|
function stagedRatchet(root, files) {
|
|
229
|
+
const approved = parseApprovedRaises();
|
|
230
|
+
const raised = unlistedRaises(root, approved);
|
|
231
|
+
const accepted = [];
|
|
218
232
|
const targets = files ?? stagedNames(root, "ACMR");
|
|
219
|
-
if (!targets.length) return
|
|
233
|
+
if (!targets.length) return {
|
|
234
|
+
failures: raised,
|
|
235
|
+
accepted
|
|
236
|
+
};
|
|
220
237
|
const ceilings = readCeilings(root);
|
|
221
|
-
const after = lintDiagnostics(root, void 0, targets).filter(({ rule }) => Object.hasOwn(ceilings.rules, rule));
|
|
222
|
-
if (!after.length) return
|
|
238
|
+
const after = lintDiagnostics(root, void 0, targets, STAGED_LINT).filter(({ rule }) => Object.hasOwn(ceilings.rules, rule) || approved.has(rule));
|
|
239
|
+
if (!after.length) return {
|
|
240
|
+
failures: raised,
|
|
241
|
+
accepted
|
|
242
|
+
};
|
|
223
243
|
const base = comparisonBase(root);
|
|
224
244
|
const atHead = countByRule(previousDiagnostics(root, targets, void 0));
|
|
225
245
|
const headAdditions = stagedAdditions(root, targets);
|
|
@@ -249,6 +269,7 @@ function stagedRatchet(root, files) {
|
|
|
249
269
|
};
|
|
250
270
|
};
|
|
251
271
|
const failures = [];
|
|
272
|
+
let repository;
|
|
252
273
|
for (const [rule, total] of countByRule(after)) {
|
|
253
274
|
const head = atHead.get(rule) ?? 0;
|
|
254
275
|
if (total <= head) continue;
|
|
@@ -256,13 +277,40 @@ function stagedRatchet(root, files) {
|
|
|
256
277
|
const { kept, rise, raised } = measure(rule, matches, head, total);
|
|
257
278
|
if (rise <= 0) continue;
|
|
258
279
|
const added = matches.filter(({ file, line }) => line !== void 0 && inRanges(headAdditions, file, line) && (baseChanges === void 0 || previousLine(baseChanges.get(file)?.hunks ?? [], line) === void 0));
|
|
280
|
+
const max = approved.get(rule);
|
|
281
|
+
if (max !== void 0) {
|
|
282
|
+
repository ??= higherCounts(withPreviousTree(root, "HEAD", [], (tree) => countByRule(lintDiagnostics(tree, void 0, void 0, STAGED_LINT)), { wholeIndex: true }), countByRule(lintDiagnostics(root, void 0, void 0, STAGED_LINT)));
|
|
283
|
+
const settled = settleApproved(root, rule, max, {
|
|
284
|
+
holds: repository.get(rule) ?? 0,
|
|
285
|
+
rise,
|
|
286
|
+
shown: added.length ? added : matches
|
|
287
|
+
});
|
|
288
|
+
accepted.push(...settled.accepted);
|
|
289
|
+
failures.push(...settled.failures);
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
259
292
|
const counts = kept === void 0 || base.revision === void 0 ? `${head} at HEAD` : `${head} at HEAD, ${kept} unchanged since ${base.label}`;
|
|
260
|
-
failures.push(`${rule}: this commit adds ${rise} to the staged files (${counts}, ${total} staged)${raised === void 0 ? "" : `; ${raised}`}; the ceiling covers only legacy findings.`, ...(added.length ? added : matches).map((diagnostic) => ` ${diagnostic.location}: ${diagnostic.message}\n Fix: ${diagnostic.help ?? "Resolve this finding; moving, reformatting or restoring a legacy finding to its base form is allowed, adding one is not."}`));
|
|
293
|
+
failures.push(`${rule}: this commit adds ${rise} to the staged files (${counts}, ${total} staged)${raised === void 0 ? "" : `; ${raised}`}; the ceiling covers only legacy findings.`, ...unlisted(rule, approved), ...(added.length ? added : matches).map((diagnostic) => ` ${diagnostic.location}: ${diagnostic.message}\n Fix: ${diagnostic.help ?? "Resolve this finding; moving, reformatting or restoring a legacy finding to its base form is allowed, adding one is not."}`));
|
|
261
294
|
}
|
|
262
|
-
|
|
295
|
+
failures.unshift(...raised);
|
|
296
|
+
return {
|
|
297
|
+
failures: failures.length && base.revision === void 0 ? [...failures, base.note] : failures,
|
|
298
|
+
accepted
|
|
299
|
+
};
|
|
263
300
|
}
|
|
264
301
|
//#endregion
|
|
265
302
|
//#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);
|
|
305
|
+
return {
|
|
306
|
+
failures: staged.failures,
|
|
307
|
+
accepted: staged.accepted,
|
|
308
|
+
lowered: [],
|
|
309
|
+
adoptions: [],
|
|
310
|
+
retired: false,
|
|
311
|
+
created: false
|
|
312
|
+
};
|
|
313
|
+
}
|
|
266
314
|
runCli(() => {
|
|
267
315
|
const { values, positionals } = parseArgs({
|
|
268
316
|
options: {
|
|
@@ -276,17 +324,15 @@ runCli(() => {
|
|
|
276
324
|
if (values.base !== void 0 && values.staged) throw new Error("--base cannot be combined with --staged.");
|
|
277
325
|
if (values.update && values.staged) throw new Error("--staged cannot be combined with --update.");
|
|
278
326
|
if (positionals.length && !values.staged) throw new Error("File arguments require --staged.");
|
|
279
|
-
const result = values.staged ? {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
retired: false,
|
|
284
|
-
created: false
|
|
285
|
-
} : ratchet(root, values.update, values.base === void 0 ? void 0 : resolveRevision(root, values.base), suppressionBase(root, values.base));
|
|
327
|
+
const result = values.staged ? stagedResult(root, positionals) : {
|
|
328
|
+
...ratchet(root, values.update, values.base === void 0 ? void 0 : resolveRevision(root, values.base), suppressionBase(root, values.base)),
|
|
329
|
+
accepted: []
|
|
330
|
+
};
|
|
286
331
|
if (result.created) process.stdout.write(`Created ${CEILINGS_FILE} for the rules the pack newly enabled. Run antelopejs-sync.\n`);
|
|
287
332
|
for (const message of result.adoptions) process.stdout.write(`Adopted ${message}\n`);
|
|
288
333
|
if (result.retired) process.stdout.write(`Deleted ${CEILINGS_FILE}: no debt left. Run antelopejs-sync.\n`);
|
|
289
334
|
for (const message of result.lowered) process.stdout.write(`Lowered ${message}\n`);
|
|
335
|
+
for (const message of result.accepted) process.stderr.write(`APPROVED RAISE ACCEPTED: ${message}. APPROVED_RAISES is set in this environment, and only that lets this commit pass.\n`);
|
|
290
336
|
for (const message of result.failures) process.stderr.write(`${message}\n`);
|
|
291
337
|
if (!result.failures.length) process.stdout.write("Ratchet: within ceilings.\n");
|
|
292
338
|
return result.failures.length ? 1 : 0;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { n as unusedDirectives } from "../oxlint-
|
|
5
|
-
import { c as stagedSuppressions, i as checkSuppressions, l as checkPolicy, s as stagedNames } from "../suppression-budget-
|
|
6
|
-
import { c as suppressionsIn, i as inWorktree } from "../suppressions-
|
|
7
|
-
import { n as suppressionBase, t as raisedCeilings } from "../suppression-base-
|
|
3
|
+
import { c as repositoryRoot, r as changedFiles } from "../files-DJ0TeaTU.mjs";
|
|
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";
|
|
8
8
|
import { readdirSync } from "node:fs";
|
|
9
9
|
import { dirname, join } from "node:path";
|
|
10
10
|
import { execFileSync, spawnSync } from "node:child_process";
|