@antelopejs/tooling-configs 0.3.0 → 0.3.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.
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ The AntelopeJS guardrail pack: shared lint, format and dead-code presets, the co
|
|
|
49
49
|
- `--apply` turns `delete_branch_on_merge` on for each repository the `conformance` check reports it off on, and writes nothing else.
|
|
50
50
|
- The `stale-branches` check lists, in one finding per repository, the branches other than the default, `next` and protected ones that head a merged or closed pull request at their current commit, or have no open pull request and no commit for 30 days. A branch that heads or receives an open pull request is never listed. `prunes` holds one `{ repo, branch, reason }` per listed branch, and `--apply-prunes` deletes exactly those refs.
|
|
51
51
|
|
|
52
|
-
`antelopejs-sync`
|
|
52
|
+
Both profiles of `antelopejs-sync` keep the shared CI caller on the job id `ci`, so the check is reported as `ci / checks`. The `ci` job is read-only (`contents: read`) and passes `renovate-sync: false` and `test-job: true`, which runs the tests in their own job (sync adds `test-job: true` to a caller that does not set it and keeps a value the caller set); the `contents: write` and `actions: write` grants that let the Renovate sync push its commit and dispatch the caller live on a separate `renovate-sync` job calling `ci-renovate-sync.yml`, which sync adds when it is missing and never re-pins. Under the full profile it also sets the `docs-files` input of every ci-node caller to the existing `README.md` and `docs` of the root and of each workspace package that is not private, then keeps the caller's other listed paths that still exist. Renaming a caller to `ci` also rewrites `needs:` lists and `needs.<old-id>` reads in expressions, and sync (and `--check`) fails a caller in which a job needs a job that does not exist or reads `needs.<id>` of a job missing from its own `needs:`, since GitHub evaluates that read to null and a gate like `needs.checks.result == 'skipped'` then never fails.
|
|
53
53
|
|
|
54
54
|
## Shared verification skills
|
|
55
55
|
|
package/dist/bin/garden.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
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";
|
|
3
3
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { c as ciRenovateSyncCallers, i as CI_RENOVATE_SYNC_REF, n as CI_NODE_REF, r as CI_PATH, s as ciNodeCallers, t as CI_CONTEXT } from "../ci-workflow-mc0vywUV.mjs";
|
|
5
5
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
7
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
@@ -635,37 +635,6 @@ async function latestReport(context, repo, name) {
|
|
|
635
635
|
const archive = await context.api.bytes(`/repos/${ORG}/${repo}/actions/artifacts/${latest.id}/zip`);
|
|
636
636
|
return object(parseJson(firstZipEntry(archive)), name);
|
|
637
637
|
}
|
|
638
|
-
function survivors(report) {
|
|
639
|
-
const files = object(report.files ?? {}, "files");
|
|
640
|
-
return Object.keys(files).map((file) => {
|
|
641
|
-
const mutants = children(object(files[file], file), "mutants");
|
|
642
|
-
return {
|
|
643
|
-
file,
|
|
644
|
-
survived: mutants.filter((mutant) => optStr(mutant, "status") === "Survived").length,
|
|
645
|
-
total: mutants.length
|
|
646
|
-
};
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
const mutation = {
|
|
650
|
-
id: "mutation",
|
|
651
|
-
async run(context) {
|
|
652
|
-
if (!await context.exists(WORKFLOWS_REPO, ".github/workflows/mutation.yml")) return skip("AntelopeJS/.github has no mutation.yml yet");
|
|
653
|
-
const repos = (await context.scope()).filter((repo) => repo.tier === "N1" || repo.tier === "N2");
|
|
654
|
-
const findings = [];
|
|
655
|
-
let reports = 0;
|
|
656
|
-
for (const repo of repos) {
|
|
657
|
-
const report = await latestReport(context, repo.name, "mutation-report");
|
|
658
|
-
if (report === void 0) continue;
|
|
659
|
-
reports++;
|
|
660
|
-
for (const { file, survived, total } of survivors(report)) if (survived > 0) findings.push(finding({
|
|
661
|
-
repo: repo.name,
|
|
662
|
-
check: "mutation",
|
|
663
|
-
subject: file
|
|
664
|
-
}, `${survived} of ${total} mutants survive in ${file}.`, `Tests kill the surviving mutants of ${file}, or Stryker ignores them with a reason.`));
|
|
665
|
-
}
|
|
666
|
-
return reports ? found(findings) : skip("no mutation-report artifact exists in any N1 or N2 repository yet");
|
|
667
|
-
}
|
|
668
|
-
};
|
|
669
638
|
const linkRot = {
|
|
670
639
|
id: "link-rot",
|
|
671
640
|
async run(context) {
|
|
@@ -1523,7 +1492,6 @@ const CHECKS = [
|
|
|
1523
1492
|
aiApps,
|
|
1524
1493
|
orbSecrets,
|
|
1525
1494
|
packageSize,
|
|
1526
|
-
mutation,
|
|
1527
1495
|
templateBehindLatest,
|
|
1528
1496
|
templateMembership,
|
|
1529
1497
|
staleRegistry,
|
package/dist/bin/sync.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
|
7
7
|
import { c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
|
|
8
8
|
import { i as recordedRelease, t as measureBaseline } from "../ratchet-BAcLRYuM.mjs";
|
|
9
9
|
import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-C0SkPO5R.mjs";
|
|
10
|
-
import { a as
|
|
10
|
+
import { a as ciWorkflow, c as ciRenovateSyncCallers, l as hasChecksWorkflow, o as MISSING_CHECKS_WORKFLOW, r as CI_PATH, s as ciNodeCallers } from "../ci-workflow-mc0vywUV.mjs";
|
|
11
11
|
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, rmdirSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
12
12
|
import { dirname, join, resolve } from "node:path";
|
|
13
13
|
import { execFileSync } from "node:child_process";
|
|
@@ -1128,14 +1128,6 @@ const MANAGED_ARTIFACTS = [
|
|
|
1128
1128
|
notes: []
|
|
1129
1129
|
})
|
|
1130
1130
|
},
|
|
1131
|
-
{
|
|
1132
|
-
path: MUTATION_PATH,
|
|
1133
|
-
profiles: ["full"],
|
|
1134
|
-
desired: (_current, context) => ({
|
|
1135
|
-
content: mutationCaller(context.packageName),
|
|
1136
|
-
notes: []
|
|
1137
|
-
})
|
|
1138
|
-
},
|
|
1139
1131
|
{
|
|
1140
1132
|
path: "package.json",
|
|
1141
1133
|
profiles: ["full", "template"],
|
|
@@ -1290,7 +1282,6 @@ function repositoryContext(root, current, profile, verificationSkill) {
|
|
|
1290
1282
|
claude: profile === "full" ? claudeProse(root, current) : "",
|
|
1291
1283
|
baseline: "",
|
|
1292
1284
|
suppressionBudget: profile === "full" ? adoptedBudget(root, current.get(SUPPRESSIONS_FILE)) : "",
|
|
1293
|
-
packageName: manifest.name ?? "",
|
|
1294
1285
|
managesCi: current.has(".github/workflows/ci.yml") || !hasChecksWorkflow(root),
|
|
1295
1286
|
verificationSkill: profile === "template" && inScaffoldExcludedPath(verificationSkill) ? void 0 : verificationSkill,
|
|
1296
1287
|
glossary: ["GLOSSARY.md", "docs/GLOSSARY.md"].find((file) => existsSync(join(root, file))),
|
|
@@ -100,13 +100,11 @@ function staleNeeds(document, path) {
|
|
|
100
100
|
//#endregion
|
|
101
101
|
//#region src/guardrails/ci-workflow.ts
|
|
102
102
|
const CI_PATH = ".github/workflows/ci.yml";
|
|
103
|
-
const MUTATION_PATH = ".github/workflows/mutation.yml";
|
|
104
103
|
/** The status context GitHub derives from the caller job id and the shared workflow's `checks` job. */
|
|
105
104
|
const CI_CONTEXT = `ci / checks`;
|
|
106
105
|
const RENOVATE_SYNC_JOB_ID = "renovate-sync";
|
|
107
106
|
const CI_NODE_REF = "AntelopeJS/.github/.github/workflows/ci-node.yml@v1";
|
|
108
107
|
const CI_RENOVATE_SYNC_REF = "AntelopeJS/.github/.github/workflows/ci-renovate-sync.yml@v1";
|
|
109
|
-
const MUTATION_REF = "AntelopeJS/.github/.github/workflows/mutation.yml@v1";
|
|
110
108
|
const CI_CALLER = `name: ci
|
|
111
109
|
|
|
112
110
|
on:
|
|
@@ -139,27 +137,6 @@ jobs:
|
|
|
139
137
|
uses: ${CI_RENOVATE_SYNC_REF}
|
|
140
138
|
`;
|
|
141
139
|
const PRINT_WIDTH = 80;
|
|
142
|
-
const WEEK_MINUTES = 10080;
|
|
143
|
-
/** Spreads the weekly runs of different repositories over the week so they do not queue together. */
|
|
144
|
-
function mutationCaller(packageName) {
|
|
145
|
-
let slot = 0;
|
|
146
|
-
for (const character of packageName) slot = (slot * 31 + character.charCodeAt(0)) % WEEK_MINUTES;
|
|
147
|
-
const day = Math.floor(slot / 1440) % 7;
|
|
148
|
-
return `name: mutation
|
|
149
|
-
|
|
150
|
-
on:
|
|
151
|
-
schedule:
|
|
152
|
-
- cron: "${slot % 60} ${Math.floor(slot % 1440 / 60)} * * ${day}"
|
|
153
|
-
workflow_dispatch:
|
|
154
|
-
|
|
155
|
-
permissions:
|
|
156
|
-
contents: read
|
|
157
|
-
|
|
158
|
-
jobs:
|
|
159
|
-
mutation:
|
|
160
|
-
uses: ${MUTATION_REF}
|
|
161
|
-
`;
|
|
162
|
-
}
|
|
163
140
|
function flatSequence(seq) {
|
|
164
141
|
const items = [];
|
|
165
142
|
for (const item of seq.items) {
|
|
@@ -367,4 +344,4 @@ function ciWorkflow(current, callers, syncCallers, docsFiles) {
|
|
|
367
344
|
});
|
|
368
345
|
}
|
|
369
346
|
//#endregion
|
|
370
|
-
export {
|
|
347
|
+
export { ciWorkflow as a, ciRenovateSyncCallers as c, CI_RENOVATE_SYNC_REF as i, hasChecksWorkflow as l, CI_NODE_REF as n, MISSING_CHECKS_WORKFLOW as o, CI_PATH as r, ciNodeCallers as s, CI_CONTEXT as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/tooling-configs",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Shared tooling presets for AntelopeJS repositories: oxlint (with the vendored anti-slop rules), oxfmt, ESLint for Nuxt layers, Knip, and an interface range check",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|