@antelopejs/tooling-configs 0.5.8 → 0.7.0
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 +39 -49
- package/dist/{api-CCOiLN3w.mjs → api-BQLrI_S1.mjs} +19 -2
- package/dist/bin/api-diff.mjs +155 -37
- package/dist/bin/body-check.mjs +6 -3
- package/dist/bin/check-size.mjs +1 -1
- package/dist/bin/checks.mjs +1 -1
- package/dist/bin/comment-proof.mjs +3 -5
- package/dist/bin/garden.mjs +86 -34
- package/dist/bin/lease.mjs +314 -26
- package/dist/bin/ratchet.mjs +4 -4
- package/dist/bin/readme-strip.mjs +1 -1
- package/dist/bin/suppressions.mjs +10 -6
- package/dist/bin/sync.mjs +23 -98
- package/dist/bin/triage.mjs +1 -1
- package/dist/bin/verify.mjs +1 -1
- package/dist/{checks-BC-F8bsv.mjs → checks-BefrkjiT.mjs} +729 -25
- package/dist/{docs-compat-Ft1r2sf0.mjs → docs-compat-CSljVi3O.mjs} +13 -8
- package/dist/eslint.d.mts +13 -4
- package/dist/eslint.mjs +48 -6
- package/dist/guardrails-BfGwehVj.mjs +2414 -0
- package/dist/installed-typescript-6MtIWlE4.mjs +84 -0
- package/dist/oxc/anti-slop/index.mjs +541 -34
- package/dist/oxc/guardrails/index.d.mts +1 -1
- package/dist/oxc/guardrails/index.mjs +2 -1854
- package/dist/oxc/lint.d.mts +10 -1
- package/dist/oxc/lint.mjs +13 -5
- package/dist/{oxlint-CCOJqj3d.mjs → oxlint-CkHhK5K_.mjs} +33 -11
- package/dist/{package-DnxZ2CXZ.mjs → package-DDG3YH7W.mjs} +10 -5
- package/dist/{ports-DGP6bPJy.mjs → ports-DAeEJsYh.mjs} +22 -0
- package/dist/{proof-stamp-lyD84zmj.mjs → proof-stamp-BFV7JTZT.mjs} +5 -4
- package/dist/{ratchet-SQ7vTR0i.mjs → ratchet-2FeMs1kh.mjs} +4 -3
- package/dist/{suppression-base-whhvw-IJ.mjs → suppression-base-CYaLZAq7.mjs} +2 -2
- package/dist/{suppression-budget-CtIYSoDO.mjs → suppression-budget-CPDSFg4X.mjs} +1 -1
- package/dist/{suppressions-C79kRvYI.mjs → suppressions-CxPnh4sC.mjs} +2 -2
- package/dist/{templates-Dg188oRC.mjs → templates-HG0fel2S.mjs} +1 -1
- package/dist/{type-aware-rules-DMuN6sHb.mjs → type-aware-rules-Da3769fI.mjs} +9 -1
- package/dist/{typescript--_8og8AM.mjs → typescript-CxfNxyr2.mjs} +59 -98
- package/dist/{workflow-CPcNc8KL.mjs → workflow-C-oBwL2H.mjs} +25 -1
- package/package.json +9 -5
- package/dist/bin/check-interface-ranges.d.mts +0 -1
- package/dist/bin/check-interface-ranges.mjs +0 -44
- package/dist/interface-ranges-CcVSr59f.mjs +0 -116
package/dist/bin/garden.mjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { t as admits } from "../semver-BDxeEcP_.mjs";
|
|
3
3
|
import { a as isString, 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";
|
|
4
4
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
5
|
-
import { a as RENOVATE_CONFIGS, c as
|
|
6
|
-
import { i as ghToken, n as createApi, t as ApiError } from "../api-
|
|
5
|
+
import { a as RENOVATE_CONFIGS, c as GITATTRIBUTES, d as enforcesLf, f as CI_CONTEXT, h as CI_RENOVATE_SYNC_REF, m as CI_PATH, n as ciNodeCallers, o as RENOVATE_PRESET, p as CI_NODE_REF, r as ciRenovateSyncCallers, u as LF_ATTRIBUTES } from "../workflow-C-oBwL2H.mjs";
|
|
6
|
+
import { i as ghToken, n as createApi, t as ApiError } from "../api-BQLrI_S1.mjs";
|
|
7
7
|
import { parseDocument } from "yaml";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
9
9
|
import { inflateRawSync } from "node:zlib";
|
|
@@ -481,7 +481,7 @@ function firstZipEntry(archive) {
|
|
|
481
481
|
}
|
|
482
482
|
//#endregion
|
|
483
483
|
//#region src/garden/checks/artifacts.ts
|
|
484
|
-
const WORKFLOWS_REPO = ".github";
|
|
484
|
+
const WORKFLOWS_REPO$1 = ".github";
|
|
485
485
|
async function latestReport(context, repo, name) {
|
|
486
486
|
const [latest] = await context.artifactsNamed(repo, name);
|
|
487
487
|
if (latest === void 0) return void 0;
|
|
@@ -491,8 +491,8 @@ async function latestReport(context, repo, name) {
|
|
|
491
491
|
const linkRot = {
|
|
492
492
|
id: "link-rot",
|
|
493
493
|
async run(context) {
|
|
494
|
-
if (!await context.exists(WORKFLOWS_REPO, ".github/workflows/link-rot.yml")) return skip("AntelopeJS/.github has no link-rot.yml yet");
|
|
495
|
-
const report = await latestReport(context, WORKFLOWS_REPO, "link-rot");
|
|
494
|
+
if (!await context.exists(WORKFLOWS_REPO$1, ".github/workflows/link-rot.yml")) return skip("AntelopeJS/.github has no link-rot.yml yet");
|
|
495
|
+
const report = await latestReport(context, WORKFLOWS_REPO$1, "link-rot");
|
|
496
496
|
if (report === void 0) return skip("no link-rot artifact exists yet");
|
|
497
497
|
const repos = object(report.repos ?? {}, "repos");
|
|
498
498
|
const findings = [];
|
|
@@ -931,25 +931,28 @@ function mayBypass(actor) {
|
|
|
931
931
|
function describeActor(actor) {
|
|
932
932
|
return `${optStr(actor, "actor_type") ?? "unknown"} ${optNum(actor, "actor_id") ?? "none"} (${optStr(actor, "bypass_mode") ?? "unknown"})`;
|
|
933
933
|
}
|
|
934
|
-
function
|
|
934
|
+
function rulesetRef(repo, rule) {
|
|
935
935
|
const id = num(rule, "ruleset_id");
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
936
|
+
const organization = optStr(rule, "ruleset_source_type") === "Organization";
|
|
937
|
+
return {
|
|
938
|
+
key: organization ? `${ORG}:${id}` : `${ORG}/${repo.name}:${id}`,
|
|
939
|
+
path: `/repos/${ORG}/${repo.name}/rulesets/${id}`,
|
|
940
|
+
label: `${organization ? "organization" : "repository"} ruleset ${id}`
|
|
941
|
+
};
|
|
940
942
|
}
|
|
941
943
|
function rulesetReader(context) {
|
|
942
944
|
const cache = new Memo();
|
|
943
|
-
return (
|
|
945
|
+
return (ref) => cache.get(ref.key, async () => object(await context.api.json(ref.path), "ruleset"));
|
|
944
946
|
}
|
|
945
|
-
async function bypassOffenders(read,
|
|
947
|
+
async function bypassOffenders(read, refs) {
|
|
946
948
|
const offenders = [];
|
|
947
|
-
for (const
|
|
948
|
-
const set = await read(
|
|
949
|
+
for (const ref of refs) {
|
|
950
|
+
const set = await read(ref);
|
|
951
|
+
const name = `${str(set, "name")} (${ref.label})`;
|
|
949
952
|
const listed = set["bypass_actors"];
|
|
950
|
-
if (listed === void 0) throw new Error(`${
|
|
953
|
+
if (listed === void 0) throw new Error(`${name} returned no bypass list; the Gardener token must belong to an administrator.`);
|
|
951
954
|
const actors = list(listed, "bypass_actors").map((actor) => object(actor, "bypass_actors")).filter((actor) => !mayBypass(actor));
|
|
952
|
-
if (actors.length) offenders.push(`${
|
|
955
|
+
if (actors.length) offenders.push(`${name}: ${actors.map(describeActor).join(", ")}`);
|
|
953
956
|
}
|
|
954
957
|
return offenders;
|
|
955
958
|
}
|
|
@@ -962,7 +965,7 @@ async function scanBranch(context, read, repo) {
|
|
|
962
965
|
subject: `${branch}:${subject}`
|
|
963
966
|
}, evidence, doneMeans, severity);
|
|
964
967
|
const unmet = REQUIREMENTS.filter((entry) => entry.applies(repo) && !entry.met(rules)).map((entry) => report(entry.subject, `The rules in force on ${branch} hold no ${entry.need}.`, `The rules in force on ${branch} hold ${entry.need}.`, entry.severity));
|
|
965
|
-
const offenders = await bypassOffenders(read, [...new
|
|
968
|
+
const offenders = await bypassOffenders(read, [...new Map(rules.map((rule) => rulesetRef(repo, rule)).map((ref) => [ref.key, ref])).values()]);
|
|
966
969
|
return offenders.length ? [...unmet, report("bypass", `Rulesets on ${branch} let actors other than administrators bypass them: ${offenders.join("; ")}.`, `Only the admin role and organization administrators can bypass the rulesets on ${branch}.`, "urgent")] : unmet;
|
|
967
970
|
}
|
|
968
971
|
const branchGovernance = {
|
|
@@ -1063,7 +1066,14 @@ async function orgDrift(context, summaries, policy) {
|
|
|
1063
1066
|
const orgChecksRuleset = {
|
|
1064
1067
|
id: "org-checks-ruleset",
|
|
1065
1068
|
async run(context) {
|
|
1066
|
-
|
|
1069
|
+
let listed;
|
|
1070
|
+
try {
|
|
1071
|
+
listed = await context.api.pages(`/orgs/${ORG}/rulesets`);
|
|
1072
|
+
} catch (error) {
|
|
1073
|
+
if (error instanceof ApiError && error.missingScopes.length) return skip(`listing organization rulesets needs the ${error.missingScopes.join(" or ")} scope, which the token lacks`);
|
|
1074
|
+
throw error;
|
|
1075
|
+
}
|
|
1076
|
+
const summaries = listed.map((entry) => object(entry, "ruleset"));
|
|
1067
1077
|
const findings = [];
|
|
1068
1078
|
for (const policy of ORG_RULESETS) findings.push(...await orgDrift(context, summaries, policy));
|
|
1069
1079
|
return found(findings);
|
|
@@ -1217,7 +1227,7 @@ const packageSize = {
|
|
|
1217
1227
|
};
|
|
1218
1228
|
//#endregion
|
|
1219
1229
|
//#region src/garden/workflow-windows.ts
|
|
1220
|
-
const CI_NODE = /^AntelopeJS\/\.github\/\.github\/workflows\/ci-node\.yml
|
|
1230
|
+
const CI_NODE$1 = /^AntelopeJS\/\.github\/\.github\/workflows\/ci-node\.yml@(\S+)$/;
|
|
1221
1231
|
const CI_EVENTS = /* @__PURE__ */ new Set([
|
|
1222
1232
|
"pull_request",
|
|
1223
1233
|
"pull_request_target",
|
|
@@ -1247,6 +1257,9 @@ function texts(value) {
|
|
|
1247
1257
|
function own(source, key) {
|
|
1248
1258
|
return Object.hasOwn(source, key) ? source[key] : null;
|
|
1249
1259
|
}
|
|
1260
|
+
function at(value, keys) {
|
|
1261
|
+
return keys.reduce((node, key) => node !== null && isObject(node) ? own(node, key) : null, value);
|
|
1262
|
+
}
|
|
1250
1263
|
function triggers(on) {
|
|
1251
1264
|
if (on !== null && isObject(on)) return Object.keys(on);
|
|
1252
1265
|
return texts(on);
|
|
@@ -1268,30 +1281,42 @@ function runnerIsWindows(job) {
|
|
|
1268
1281
|
if (!isObject(matrix)) return texts(matrix).some((value) => WINDOWS.test(value));
|
|
1269
1282
|
return labels.filter((label) => EXPRESSION.test(label)).flatMap((label) => [...label.matchAll(MATRIX_KEY)].map((match) => match[1])).some((key) => legs(matrix, key).some((value) => WINDOWS.test(value)));
|
|
1270
1283
|
}
|
|
1271
|
-
function jobRunsOnWindows(job) {
|
|
1284
|
+
async function jobRunsOnWindows(job, windowsDefault) {
|
|
1272
1285
|
const condition = own(job, "if");
|
|
1273
1286
|
if (condition === false || isString(condition) && NEVER.test(condition)) return false;
|
|
1274
1287
|
const uses = own(job, "uses");
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1288
|
+
const ref = isString(uses) ? CI_NODE$1.exec(uses)?.[1] : void 0;
|
|
1289
|
+
if (ref === void 0) return runnerIsWindows(job);
|
|
1290
|
+
const windows = at(job, ["with", "windows"]);
|
|
1291
|
+
if (windows === null) return windowsDefault(ref);
|
|
1292
|
+
return windows === true || isString(windows) && ALWAYS.test(windows);
|
|
1293
|
+
}
|
|
1294
|
+
/** Whether a ci-node.yml, given as its text, defaults its `windows` input to true. False when the YAML does not parse. */
|
|
1295
|
+
function windowsByDefault(ciNode) {
|
|
1296
|
+
const parsed = workflow(ciNode);
|
|
1297
|
+
return parsed !== void 0 && at(parsed, [
|
|
1298
|
+
"on",
|
|
1299
|
+
"workflow_call",
|
|
1300
|
+
"inputs",
|
|
1301
|
+
"windows",
|
|
1302
|
+
"default"
|
|
1303
|
+
]) === true;
|
|
1281
1304
|
}
|
|
1282
1305
|
/**
|
|
1283
1306
|
* Whether a workflow file runs a job on Windows for pull requests or pushes: a ci-node.yml caller with
|
|
1284
|
-
* `windows: true`, or
|
|
1285
|
-
*
|
|
1286
|
-
*
|
|
1307
|
+
* `windows: true`, or with no `windows` input when `windowsDefault` says the ci-node.yml at the caller's ref
|
|
1308
|
+
* defaults it to true, or a job whose `runs-on`, or the matrix value it reads, names a Windows runner. A
|
|
1309
|
+
* workflow on other events only, a job whose `if` is false, and matrix values `exclude` drops do not count.
|
|
1310
|
+
* False when the YAML does not parse.
|
|
1287
1311
|
*/
|
|
1288
|
-
function runsOnWindows(text) {
|
|
1312
|
+
async function runsOnWindows(text, windowsDefault) {
|
|
1289
1313
|
const parsed = workflow(text);
|
|
1290
1314
|
if (parsed === void 0) return false;
|
|
1291
1315
|
if (!triggers(own(parsed, "on")).some((event) => CI_EVENTS.has(event))) return false;
|
|
1292
1316
|
const jobs = own(parsed, "jobs");
|
|
1293
1317
|
if (jobs === null || !isObject(jobs)) return false;
|
|
1294
|
-
|
|
1318
|
+
for (const job of Object.values(jobs)) if (job !== null && isObject(job) && await jobRunsOnWindows(job, windowsDefault)) return true;
|
|
1319
|
+
return false;
|
|
1295
1320
|
}
|
|
1296
1321
|
//#endregion
|
|
1297
1322
|
//#region src/garden/stack.ts
|
|
@@ -1311,6 +1336,7 @@ const MODULES = /* @__PURE__ */ new Set([
|
|
|
1311
1336
|
"mollie",
|
|
1312
1337
|
"mongodb",
|
|
1313
1338
|
"mqtt",
|
|
1339
|
+
"mysql",
|
|
1314
1340
|
"nodemailer",
|
|
1315
1341
|
"payment-subscriptions",
|
|
1316
1342
|
"postgres",
|
|
@@ -1333,19 +1359,44 @@ function isStackRepo(name) {
|
|
|
1333
1359
|
//#endregion
|
|
1334
1360
|
//#region src/garden/checks/windows.ts
|
|
1335
1361
|
const CHECK = "windows-ci";
|
|
1362
|
+
const LINE_ENDINGS = "line-endings";
|
|
1336
1363
|
const WORKFLOW = /^\.github\/workflows\/[^/]+\.ya?ml$/;
|
|
1364
|
+
const WORKFLOWS_REPO = ".github";
|
|
1365
|
+
const CI_NODE = ".github/workflows/ci-node.yml";
|
|
1337
1366
|
/** Reports every framework and DMS stack repository whose workflows run no job on Windows. */
|
|
1338
1367
|
const windowsCi = {
|
|
1339
1368
|
id: CHECK,
|
|
1340
1369
|
async run(context) {
|
|
1341
|
-
|
|
1370
|
+
const repos = await context.repos();
|
|
1371
|
+
const workflowsRepo = repos.find(({ name }) => name === WORKFLOWS_REPO);
|
|
1372
|
+
const windowsDefault = async (ref) => {
|
|
1373
|
+
if (workflowsRepo === void 0) return false;
|
|
1374
|
+
const ciNode = await context.file(workflowsRepo, CI_NODE, ref);
|
|
1375
|
+
return ciNode !== void 0 && windowsByDefault(ciNode);
|
|
1376
|
+
};
|
|
1377
|
+
return perRepo(repos.filter(({ name }) => isStackRepo(name)), async (repo) => {
|
|
1342
1378
|
const workflows = (await context.tree(repo)).filter((path) => WORKFLOW.test(path));
|
|
1343
|
-
for (const path of workflows) if (runsOnWindows(await context.file(repo, path) ?? "")) return [];
|
|
1379
|
+
for (const path of workflows) if (await runsOnWindows(await context.file(repo, path) ?? "", windowsDefault)) return [];
|
|
1344
1380
|
return [finding({
|
|
1345
1381
|
repo: repo.name,
|
|
1346
1382
|
check: CHECK,
|
|
1347
1383
|
subject: "windows"
|
|
1348
|
-
}, workflows.length ? `No job in ${workflows.join(", ")} runs on Windows.` : "The repository has no workflow.", "The ci-node.yml caller passes windows: true, or a workflow job runs on windows-latest.")];
|
|
1384
|
+
}, workflows.length ? `No job in ${workflows.join(", ")} runs on Windows.` : "The repository has no workflow.", "The ci-node.yml caller passes windows: true or leaves it at a true default, or a workflow job runs on windows-latest.")];
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
/** Reports every framework and DMS stack repository whose `.gitattributes` does not check text files out with LF, so a Windows clone keeps its shell scripts runnable. */
|
|
1389
|
+
const lineEndings = {
|
|
1390
|
+
id: LINE_ENDINGS,
|
|
1391
|
+
async run(context) {
|
|
1392
|
+
return perRepo((await context.repos()).filter(({ name }) => isStackRepo(name)), async (repo) => {
|
|
1393
|
+
const text = await context.file(repo, GITATTRIBUTES);
|
|
1394
|
+
if (text !== void 0 && enforcesLf(text)) return [];
|
|
1395
|
+
return [finding({
|
|
1396
|
+
repo: repo.name,
|
|
1397
|
+
check: LINE_ENDINGS,
|
|
1398
|
+
subject: "gitattributes"
|
|
1399
|
+
}, text === void 0 ? `${GITATTRIBUTES} does not exist.` : `${GITATTRIBUTES} has no \`${LF_ATTRIBUTES}\` line.`, `${GITATTRIBUTES} holds \`${LF_ATTRIBUTES}\`, as antelopejs-sync writes it.`)];
|
|
1349
1400
|
});
|
|
1350
1401
|
}
|
|
1351
1402
|
};
|
|
@@ -1499,6 +1550,7 @@ const CHECKS = [
|
|
|
1499
1550
|
linkRot,
|
|
1500
1551
|
captureScenes,
|
|
1501
1552
|
windowsCi,
|
|
1553
|
+
lineEndings,
|
|
1502
1554
|
staleBranches
|
|
1503
1555
|
];
|
|
1504
1556
|
function compare(a, b) {
|