@antelopejs/tooling-configs 0.2.11 → 0.2.12
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 +8 -0
- package/dist/bin/garden.mjs +13 -71
- package/dist/bin/suppressions.mjs +32 -20
- package/dist/bin/sync.mjs +366 -22
- package/dist/bin/verify.d.mts +1 -0
- package/dist/bin/verify.mjs +3000 -0
- package/dist/checks-BlWDFYio.mjs +94 -0
- package/dist/json-BqvuCkqr.mjs +67 -0
- package/dist/kinds-Bzyyi9yk.mjs +25 -0
- package/dist/verify/index.d.mts +262 -0
- package/dist/verify/index.mjs +2 -0
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@ The AntelopeJS guardrail pack: shared lint, format and dead-code presets, the co
|
|
|
25
25
|
| `./knip` | `import { antelopeKnipConfig } from "@antelopejs/tooling-configs/knip"` | Knip for AntelopeJS modules |
|
|
26
26
|
| `./oxc/anti-slop` | Loaded by the oxlint preset as a JS plugin | The vendored [anti-slop](https://github.com/dmmulroy/anti-slop) rules |
|
|
27
27
|
| `./oxc/guardrails` | Loaded by the oxlint preset as a JS plugin | The `antelopejs` comment and test-quality rules |
|
|
28
|
+
| `./verify` | `import type { VerifyConfig } from "@antelopejs/tooling-configs/verify"` | Types and check helpers for a shared verification skill's `verify.config.ts` |
|
|
28
29
|
| bin | `antelopejs-sync` | Writes the guardrail pack into a repository; `--check` reports drift |
|
|
29
30
|
| bin | `antelopejs-checks` | Runs every check and prints only the failures |
|
|
30
31
|
| bin | `antelopejs-ratchet` | Fails when recorded debt grows; `--update` lowers the record |
|
|
@@ -34,6 +35,7 @@ The AntelopeJS guardrail pack: shared lint, format and dead-code presets, the co
|
|
|
34
35
|
| bin | `antelopejs-comment-proof <base-ref>` | Compares comment-free JavaScript emit against committed HEAD |
|
|
35
36
|
| bin | `antelopejs-check-interface-ranges` | Fails on interface ranges that break module startup |
|
|
36
37
|
| bin | `antelopejs-garden [--json] [--apply-pauses]` | The Gardener's scans of the organization through the GitHub API and npm |
|
|
38
|
+
| bin | `antelopejs-verify <command>` | The harness of the shared `verify-interface`, `verify-module` and `verify-template` skills |
|
|
37
39
|
|
|
38
40
|
## antelopejs-garden
|
|
39
41
|
|
|
@@ -45,6 +47,12 @@ The AntelopeJS guardrail pack: shared lint, format and dead-code presets, the co
|
|
|
45
47
|
|
|
46
48
|
`antelopejs-sync` (full profile) writes the weekly mutation caller `.github/workflows/mutation.yml`, and both profiles keep the shared CI caller on the job id `ci`, so the check is reported as `ci / checks`.
|
|
47
49
|
|
|
50
|
+
## Shared verification skills
|
|
51
|
+
|
|
52
|
+
`antelopejs-sync` writes one shared verification skill into a repository: `verify-interface` for an interface, `verify-module` for an implementation module (inferred from `antelopeJs.implements`) and `verify-template` under `--profile template`. Pass `--verify interface|module|template` to choose, or `--verify custom` for a repository that keeps its own `.agents/skills/verify-<repo>/`. Sync writes `SKILL.md` and `package.json` in `.agents/skills/verify-<kind>/` with a `.claude/skills/verify-<kind>` link, and `--check` reports them as drift. It never touches the repository's own layer beside them: `verify.config.ts`, `features/`, `seeded-breaks/` and `seeded-doors/`.
|
|
53
|
+
|
|
54
|
+
Every deterministic step of a verification is an `antelopejs-verify` command: `map`, `plan`, `new`, `doctor`, `journey`, `formal`, `doors`, `seeded`, `seeded-doors`, `clean`, `verdict` and `publish`. The synced `SKILL.md` documents each one for the agent that verifies.
|
|
55
|
+
|
|
48
56
|
## Install
|
|
49
57
|
|
|
50
58
|
Node.js 24, or at least 22.18: oxlint reads `oxlint.config.ts` and loads JS plugins by executing TypeScript.
|
package/dist/bin/garden.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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-BqvuCkqr.mjs";
|
|
2
3
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
3
4
|
import { c as ciNodeCallers, n as CI_NODE_REF, r as CI_PATH, t as CI_CONTEXT } from "../ci-workflow-BDy6hQJ6.mjs";
|
|
4
5
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -7,72 +8,6 @@ import { execFileSync, spawnSync } from "node:child_process";
|
|
|
7
8
|
import { parseArgs } from "node:util";
|
|
8
9
|
import { homedir, tmpdir } from "node:os";
|
|
9
10
|
import { inflateRawSync } from "node:zlib";
|
|
10
|
-
//#region src/garden/json.ts
|
|
11
|
-
/** Raised when an API payload lacks a field the Gardener relies on. */
|
|
12
|
-
var DecodeError = class extends Error {};
|
|
13
|
-
function isString(value) {
|
|
14
|
-
return String(value) === value;
|
|
15
|
-
}
|
|
16
|
-
function isNumber(value) {
|
|
17
|
-
return Number.isFinite(value);
|
|
18
|
-
}
|
|
19
|
-
function isObject(value) {
|
|
20
|
-
return Object(value) === value && !Array.isArray(value);
|
|
21
|
-
}
|
|
22
|
-
function parseJson(text) {
|
|
23
|
-
return JSON.parse(text);
|
|
24
|
-
}
|
|
25
|
-
function object(value, path) {
|
|
26
|
-
if (!isObject(value)) throw new DecodeError(`${path}: expected an object`);
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
29
|
-
function list(value, path) {
|
|
30
|
-
if (!Array.isArray(value)) throw new DecodeError(`${path}: expected a list`);
|
|
31
|
-
return value;
|
|
32
|
-
}
|
|
33
|
-
function str(source, key) {
|
|
34
|
-
const value = source[key];
|
|
35
|
-
if (value === void 0 || !isString(value)) throw new DecodeError(`${key}: expected a string`);
|
|
36
|
-
return value;
|
|
37
|
-
}
|
|
38
|
-
function optStr(source, key) {
|
|
39
|
-
const value = source[key];
|
|
40
|
-
return value !== void 0 && isString(value) ? value : void 0;
|
|
41
|
-
}
|
|
42
|
-
function num(source, key) {
|
|
43
|
-
const value = source[key];
|
|
44
|
-
if (value === void 0 || !isNumber(value)) throw new DecodeError(`${key}: expected a number`);
|
|
45
|
-
return value;
|
|
46
|
-
}
|
|
47
|
-
function optNum(source, key) {
|
|
48
|
-
const value = source[key];
|
|
49
|
-
return value !== void 0 && isNumber(value) ? value : void 0;
|
|
50
|
-
}
|
|
51
|
-
function flag(source, key) {
|
|
52
|
-
return source[key] === true;
|
|
53
|
-
}
|
|
54
|
-
function child(source, key) {
|
|
55
|
-
const value = source[key];
|
|
56
|
-
return value === void 0 ? {} : object(value, key);
|
|
57
|
-
}
|
|
58
|
-
function children(source, key) {
|
|
59
|
-
const value = source[key];
|
|
60
|
-
return value === void 0 ? [] : list(value, key).map((entry) => object(entry, key));
|
|
61
|
-
}
|
|
62
|
-
function strings(source, key) {
|
|
63
|
-
const value = source[key];
|
|
64
|
-
return value === void 0 ? [] : list(value, key).filter((entry) => isString(entry));
|
|
65
|
-
}
|
|
66
|
-
function time(source, key) {
|
|
67
|
-
const value = Date.parse(str(source, key));
|
|
68
|
-
if (Number.isNaN(value)) throw new DecodeError(`${key}: expected a date`);
|
|
69
|
-
return value;
|
|
70
|
-
}
|
|
71
|
-
function optTime(source, key) {
|
|
72
|
-
const value = optStr(source, key);
|
|
73
|
-
return value === void 0 ? void 0 : Date.parse(value);
|
|
74
|
-
}
|
|
75
|
-
//#endregion
|
|
76
11
|
//#region src/garden/api.ts
|
|
77
12
|
/** A GitHub or npm answer that is not a success. */
|
|
78
13
|
var ApiError = class extends Error {
|
|
@@ -427,7 +362,8 @@ var GardenContext = class {
|
|
|
427
362
|
}
|
|
428
363
|
tree(repo) {
|
|
429
364
|
return this.trees.get(repo.name, async () => {
|
|
430
|
-
|
|
365
|
+
const body = object(await this.api.json(`/repos/${ORG}/${repo.name}/git/trees/${repo.defaultBranch}?recursive=1`), "tree");
|
|
366
|
+
return children(body, "tree").map((entry) => str(entry, "path"));
|
|
431
367
|
});
|
|
432
368
|
}
|
|
433
369
|
file(repo, path, ref = repo.defaultBranch) {
|
|
@@ -457,7 +393,8 @@ var GardenContext = class {
|
|
|
457
393
|
return this.runs.get(`${repo.name}:${workflow}:${branch}:${event}`, async () => {
|
|
458
394
|
try {
|
|
459
395
|
const filter = event === "" ? "" : `&event=${event}`;
|
|
460
|
-
|
|
396
|
+
const body = await this.api.json(`/repos/${ORG}/${repo.name}/actions/workflows/${workflow}/runs?branch=${branch}${filter}&status=completed&per_page=100`);
|
|
397
|
+
return children(object(body, "runs"), "workflow_runs").map((run) => workflowRun(run));
|
|
461
398
|
} catch (error) {
|
|
462
399
|
if (error instanceof Error && isMissing(error)) return void 0;
|
|
463
400
|
throw error;
|
|
@@ -494,7 +431,8 @@ var GardenContext = class {
|
|
|
494
431
|
variable(repo, name) {
|
|
495
432
|
return this.variables.get(`${repo.name}:${name}`, async () => {
|
|
496
433
|
try {
|
|
497
|
-
|
|
434
|
+
const body = await this.api.json(`/repos/${ORG}/${repo.name}/actions/variables/${name}`);
|
|
435
|
+
return str(object(body, "variable"), "value");
|
|
498
436
|
} catch (error) {
|
|
499
437
|
if (error instanceof Error && isMissing(error)) return void 0;
|
|
500
438
|
throw error;
|
|
@@ -505,7 +443,10 @@ var GardenContext = class {
|
|
|
505
443
|
removedInHistory(repo, path) {
|
|
506
444
|
return this.removals.get(`${repo.name}:${path}`, async () => {
|
|
507
445
|
const commits = list(await this.api.json(`/repos/${ORG}/${repo.name}/commits?path=${path}&sha=${repo.defaultBranch}&per_page=30`), "commits");
|
|
508
|
-
for (const commit of commits)
|
|
446
|
+
for (const commit of commits) {
|
|
447
|
+
const detail = object(await this.api.json(`/repos/${ORG}/${repo.name}/commits/${str(object(commit, "commit"), "sha")}`), "commit");
|
|
448
|
+
if (children(detail, "files").some((file) => str(file, "filename") === path && optStr(file, "status") === "removed")) return true;
|
|
449
|
+
}
|
|
509
450
|
return false;
|
|
510
451
|
});
|
|
511
452
|
}
|
|
@@ -650,7 +591,8 @@ const WORKFLOWS_REPO = ".github";
|
|
|
650
591
|
async function latestReport(context, repo, name) {
|
|
651
592
|
const [latest] = await context.artifactsNamed(repo, name);
|
|
652
593
|
if (latest === void 0) return void 0;
|
|
653
|
-
|
|
594
|
+
const archive = await context.api.bytes(`/repos/${ORG}/${repo}/actions/artifacts/${latest.id}/zip`);
|
|
595
|
+
return object(parseJson(firstZipEntry(archive)), name);
|
|
654
596
|
}
|
|
655
597
|
function survivors(report) {
|
|
656
598
|
const files = object(report.files ?? {}, "files");
|
|
@@ -4,7 +4,7 @@ import { o as repositoryRoot, s as resolveRevision } from "../files-2FikHZ9F.mjs
|
|
|
4
4
|
import { a as parseBudget, c as checkPolicy, i as checkSuppressions, n as SUPPRESSIONS_FILE, o as safetyCeiling, s as stagedSuppressions } from "../suppression-budget-Yyf5_J5l.mjs";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { join } from "node:path";
|
|
7
|
-
import {
|
|
7
|
+
import { spawnSync } from "node:child_process";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
9
9
|
//#region src/guardrails/suppression-base.ts
|
|
10
10
|
function verified(root, ref) {
|
|
@@ -20,33 +20,45 @@ function verified(root, ref) {
|
|
|
20
20
|
});
|
|
21
21
|
return result.status === 0 ? result.stdout.trim() : void 0;
|
|
22
22
|
}
|
|
23
|
+
function fetchBase(root, branch, remote) {
|
|
24
|
+
const result = spawnSync("git", [
|
|
25
|
+
"fetch",
|
|
26
|
+
"--quiet",
|
|
27
|
+
"--no-tags",
|
|
28
|
+
"--depth=1",
|
|
29
|
+
"origin",
|
|
30
|
+
`+refs/heads/${branch}:${remote}`
|
|
31
|
+
], {
|
|
32
|
+
cwd: root,
|
|
33
|
+
encoding: "utf8",
|
|
34
|
+
env: {
|
|
35
|
+
...process.env,
|
|
36
|
+
GIT_TERMINAL_PROMPT: "0"
|
|
37
|
+
},
|
|
38
|
+
stdio: [
|
|
39
|
+
"ignore",
|
|
40
|
+
"ignore",
|
|
41
|
+
"pipe"
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
if (result.status === 0) return;
|
|
45
|
+
const detail = result.error?.message ?? result.stderr.trim();
|
|
46
|
+
throw new Error(`Cannot compare with the pull request base: ${remote} is missing and fetching ${branch} from origin failed${detail ? ` (${detail})` : ""}. In CI, fetch the base branch before this check with credentials, or pass --base.`);
|
|
47
|
+
}
|
|
23
48
|
/**
|
|
24
49
|
* The commit a pull request merges into: `base` when given; in CI the
|
|
25
|
-
* `GITHUB_BASE_REF` branch,
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
50
|
+
* `GITHUB_BASE_REF` branch, taken from the local `origin/<branch>` ref when
|
|
51
|
+
* present and otherwise fetched from `origin`, an error naming the missing ref
|
|
52
|
+
* when the fetch fails; otherwise `origin/HEAD`, the remote's default branch.
|
|
53
|
+
* A requested base that cannot be resolved is an error; without one, a
|
|
54
|
+
* repository with no `origin/HEAD` has no base.
|
|
29
55
|
*/
|
|
30
56
|
function suppressionBase(root, base) {
|
|
31
57
|
if (base !== void 0) return resolveRevision(root, base);
|
|
32
58
|
const branch = process.env.GITHUB_BASE_REF;
|
|
33
59
|
if (branch) {
|
|
34
60
|
const remote = `refs/remotes/origin/${branch}`;
|
|
35
|
-
if (verified(root, remote) === void 0)
|
|
36
|
-
"fetch",
|
|
37
|
-
"--quiet",
|
|
38
|
-
"--no-tags",
|
|
39
|
-
"--depth=1",
|
|
40
|
-
"origin",
|
|
41
|
-
`+refs/heads/${branch}:${remote}`
|
|
42
|
-
], {
|
|
43
|
-
cwd: root,
|
|
44
|
-
stdio: [
|
|
45
|
-
"ignore",
|
|
46
|
-
"ignore",
|
|
47
|
-
"pipe"
|
|
48
|
-
]
|
|
49
|
-
});
|
|
61
|
+
if (verified(root, remote) === void 0) fetchBase(root, branch, remote);
|
|
50
62
|
return resolveRevision(root, remote);
|
|
51
63
|
}
|
|
52
64
|
return verified(root, "refs/remotes/origin/HEAD");
|