@antelopejs/tooling-configs 0.7.4 → 0.7.5-next.356.g0d472b3

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 (44) hide show
  1. package/README.md +32 -77
  2. package/dist/bin/api-diff.mjs +16 -36
  3. package/dist/bin/capture.mjs +4 -4
  4. package/dist/bin/check-size.mjs +12 -3
  5. package/dist/bin/checks.mjs +2 -2
  6. package/dist/bin/comment-proof.mjs +3 -4
  7. package/dist/bin/garden.mjs +45 -170
  8. package/dist/bin/readme-strip.mjs +2 -2
  9. package/dist/bin/suppressions.mjs +212 -9
  10. package/dist/bin/sync.mjs +284 -189
  11. package/dist/bin/tsc.mjs +1 -1
  12. package/dist/bin/verify.mjs +33 -613
  13. package/dist/{checks-BTFf0Evy.mjs → checks-C60vMFin.mjs} +130 -283
  14. package/dist/{docs-compat-BmczGA1d.mjs → docs-compat-CdgBviGf.mjs} +2 -2
  15. package/dist/eslint.mjs +1 -1
  16. package/dist/{files-C-JJhExM.mjs → files-BbzJEk-L.mjs} +5 -4
  17. package/dist/formal/index.mjs +1 -1
  18. package/dist/{guardrails-CNmSFSxO.mjs → guardrails-Dron1AbR.mjs} +5 -611
  19. package/dist/{map-BYkmnvNw.mjs → map-CbNbypUa.mjs} +2 -2
  20. package/dist/oxc/anti-slop/index.mjs +22 -964
  21. package/dist/oxc/guardrails/index.d.mts +1 -1
  22. package/dist/oxc/guardrails/index.mjs +1 -1
  23. package/dist/oxc/lint.d.mts +2 -14
  24. package/dist/oxc/lint.mjs +3 -20
  25. package/dist/{package-1pH5I0TF.mjs → package-7oylgBeT.mjs} +3 -12
  26. package/dist/{workflow-C-oBwL2H.mjs → renovate-D0su_v9p.mjs} +191 -91
  27. package/dist/{suppression-budget-BeJIgSTO.mjs → suppression-budget-De9nUzlD.mjs} +33 -13
  28. package/dist/{suppressions-BvWGA463.mjs → suppressions-CfJwL0fN.mjs} +1 -1
  29. package/dist/{templates-Df6SlGLA.mjs → templates-DLW0Ubfk.mjs} +26 -29
  30. package/dist/typescript-C7eU-cig.mjs +581 -0
  31. package/dist/verify/index.d.mts +5 -24
  32. package/package.json +1 -3
  33. package/dist/bin/body-check.d.mts +0 -1
  34. package/dist/bin/body-check.mjs +0 -350
  35. package/dist/bin/ratchet.d.mts +0 -1
  36. package/dist/bin/ratchet.mjs +0 -375
  37. package/dist/ceilings-B7KayYIG.mjs +0 -76
  38. package/dist/oxlint-CIeonWMB.mjs +0 -133
  39. package/dist/proof-stamp-Bg4ULLvr.mjs +0 -342
  40. package/dist/ratchet-CPpvIU6Y.mjs +0 -453
  41. package/dist/renames-L2owF5GD.mjs +0 -59
  42. package/dist/size-CCGLY4Ke.mjs +0 -18
  43. package/dist/suppression-base-CDiFJse2.mjs +0 -120
  44. package/dist/typescript-B0df00nl.mjs +0 -292
@@ -1,17 +1,16 @@
1
- import { t as CEILINGS_FILE } from "./ceilings-B7KayYIG.mjs";
2
- import { l as serializeManifest, o as packageManager, s as parseManifest } from "./package-1pH5I0TF.mjs";
1
+ import { l as serializeManifest, o as packageManager, s as parseManifest } from "./package-7oylgBeT.mjs";
3
2
  import { t as typescript6_default } from "./typescript6-HdyOMBv3.mjs";
4
3
  import { a as isString, f as parseJson, i as isObject, u as optStr } from "./json-CG2L7YFl.mjs";
5
- import { a as gitFiles, u as trackedManifests } from "./files-C-JJhExM.mjs";
6
- import { i as DMS_PACKAGES, n as workspaceDirectories } from "./docs-compat-BmczGA1d.mjs";
4
+ import { i as gitFiles, l as trackedManifests } from "./files-BbzJEk-L.mjs";
5
+ import { i as DMS_PACKAGES, n as workspaceDirectories } from "./docs-compat-CdgBviGf.mjs";
7
6
  import { n as shimInvocation, t as runCommand } from "./run-command-BlFRPORx.mjs";
8
7
  import { n as tagVersion } from "./npm-CIIqL5SG.mjs";
9
8
  import { n as packTarball } from "./pack-tarball-Cn4zGKn7.mjs";
10
9
  import { t as accepting } from "./ports-DAeEJsYh.mjs";
10
+ import { isMap, isScalar, isSeq, parseAllDocuments, parseDocument, stringify } from "yaml";
11
11
  import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
12
12
  import { basename, dirname, join, posix, relative, resolve, sep } from "node:path";
13
13
  import { spawnSync } from "node:child_process";
14
- import { isMap, isScalar, isSeq, parseAllDocuments, parseDocument, stringify } from "yaml";
15
14
  import { createHash } from "node:crypto";
16
15
  import { tmpdir } from "node:os";
17
16
  import { Range, gtr, minVersion, prerelease, satisfies, valid, validRange } from "semver";
@@ -1184,135 +1183,12 @@ async function stopServices(root) {
1184
1183
  return (await compose(root, ["down", "-v"])).failure;
1185
1184
  }
1186
1185
  //#endregion
1187
- //#region src/guardrails/verify-layers.ts
1188
- const SKILLS_FOLDER = ".agents/skills";
1189
- const LAYER_PREFIX = "verify-";
1190
- const TSCONFIG = "tsconfig.json";
1191
- /** Folders of a layer that are not the layer's own code: verify builds its playground with the playground's own tsconfig. */
1192
- const NOT_LAYER_CODE = /* @__PURE__ */ new Set(["node_modules", "dist"]);
1193
- const LAYER_PLAYGROUND = "playground";
1194
- const VERIFY_CONFIG = "verify.config.ts";
1195
- /**
1196
- * Options the generated config sets over the layer's: nothing is emitted, and each declaration or build-cache option the
1197
- * layer may inherit is unset with `null`, so no `.tsbuildinfo` is written, no option is left needing `declaration` or
1198
- * `composite`, and the declaration checks of files that are never emitted are not run.
1199
- */
1200
- const NO_OUTPUT = {
1201
- noEmit: true,
1202
- declaration: null,
1203
- composite: null,
1204
- incremental: null,
1205
- tsBuildInfoFile: null,
1206
- declarationDir: null,
1207
- declarationMap: null,
1208
- emitDeclarationOnly: null,
1209
- isolatedDeclarations: null
1210
- };
1211
- /** The verify layers of a repository, relative to its root: each `.agents/skills/verify-*` folder that holds a `tsconfig.json` or a `verify.config.ts`. */
1212
- function verifyLayers(root) {
1213
- const skills = join(root, SKILLS_FOLDER);
1214
- if (!existsSync(skills)) return [];
1215
- return readdirSync(skills, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.startsWith(LAYER_PREFIX) && [TSCONFIG, VERIFY_CONFIG].some((file) => existsSync(join(skills, entry.name, file)))).map((entry) => `${SKILLS_FOLDER}/${entry.name}`).sort();
1216
- }
1217
- /** Whether a file the layer's tsconfig includes is the layer's own code, not its playground, a dependency or a build output. */
1218
- function isLayerCode(layer, file) {
1219
- const segments = relative(layer, file).split(sep);
1220
- return segments[0] !== LAYER_PLAYGROUND && !segments.some((segment) => NOT_LAYER_CODE.has(segment));
1221
- }
1222
- /**
1223
- * The `package.json` of the package `name` in the nearest `node_modules` from `root` up, where a workspace may hoist it.
1224
- * Node's resolution is not used: it falls back to `NODE_PATH`, where a package manager's bin shim lists the pack's own
1225
- * dependencies, so a repository without TypeScript would be checked with the pack's.
1226
- */
1227
- function manifestOf(root, name) {
1228
- for (let folder = resolve(root);; folder = dirname(folder)) {
1229
- const manifestPath = join(folder, "node_modules", name, "package.json");
1230
- if (existsSync(manifestPath)) return manifestPath;
1231
- if (dirname(folder) === folder) return void 0;
1232
- }
1233
- }
1234
- /** The repository's own `tsc`, the `bin.tsc` entry of the `typescript` it installs, run with Node so no shell parses its path. It is read from `package.json`, a file every TypeScript version ships, because TypeScript 7 declares an `exports` map that leaves `typescript/bin/tsc` out. */
1235
- function compilerOf(root) {
1236
- const manifestPath = manifestOf(root, "typescript");
1237
- if (manifestPath === void 0) return void 0;
1238
- try {
1239
- const tsc = parseManifest(readFileSync(manifestPath, "utf8")).bin?.tsc;
1240
- return tsc === void 0 ? void 0 : join(dirname(manifestPath), tsc);
1241
- } catch {
1242
- return;
1243
- }
1244
- }
1245
- async function typecheckLayer(root, compiler, layer, signal) {
1246
- const configPath = join(root, layer, TSCONFIG);
1247
- if (!existsSync(configPath)) return `${layer}: has a verify.config.ts and no tsconfig.json. Add a tsconfig.json that includes its TypeScript files; antelopejs-sync writes one for the shared kinds.\n`;
1248
- const ts = (await import("./typescript6-BWqCcXGY.mjs")).default;
1249
- const parsed = ts.getParsedCommandLineOfConfigFile(configPath, void 0, {
1250
- ...ts.sys,
1251
- onUnRecoverableConfigFileDiagnostic: () => void 0
1252
- });
1253
- if (parsed === void 0) return `${layer}/${TSCONFIG}: could not read it.\n`;
1254
- const verifyConfig = join(root, layer, VERIFY_CONFIG);
1255
- if (existsSync(verifyConfig) && !parsed.fileNames.some((file) => resolve(file) === verifyConfig)) return `${layer}/${TSCONFIG}: does not include ${VERIFY_CONFIG}, so it is never type-checked. Add it to the tsconfig's "include" or "files".\n`;
1256
- const files = parsed.fileNames.filter((file) => isLayerCode(join(root, layer), resolve(file)));
1257
- if (files.length === 0) return "";
1258
- const folder = mkdtempSync(join(tmpdir(), "antelopejs-verify-types-"));
1259
- try {
1260
- const generated = join(folder, TSCONFIG);
1261
- writeFileSync(generated, JSON.stringify({
1262
- extends: configPath,
1263
- compilerOptions: {
1264
- ...NO_OUTPUT,
1265
- typeRoots: ts.getEffectiveTypeRoots(parsed.options, ts.sys)
1266
- },
1267
- files,
1268
- include: []
1269
- }));
1270
- const result = await runCommand(process.execPath, [
1271
- compiler,
1272
- "-p",
1273
- generated,
1274
- "--pretty",
1275
- "false"
1276
- ], {
1277
- cwd: root,
1278
- env: {
1279
- ...process.env,
1280
- CI: "1"
1281
- },
1282
- signal,
1283
- shell: false
1284
- });
1285
- return result.status === 0 ? "" : result.output;
1286
- } finally {
1287
- rmSync(folder, {
1288
- recursive: true,
1289
- force: true
1290
- });
1291
- }
1292
- }
1293
- /**
1294
- * Type-checks the own code of each verify layer with the repository's own TypeScript. The files are those the layer's
1295
- * `tsconfig.json` includes, minus its `playground` folder, which verify compiles with the playground's own config after
1296
- * installing it, and any `node_modules` or `dist` folder. A config generated in the system temp folder extends the layer's,
1297
- * lists those files, turns off emit and unsets the emit and build-cache options in `NO_OUTPUT`, so nothing is written in the
1298
- * repository and no package is fetched. A layer whose `tsconfig.json` does not include its `verify.config.ts` fails. Returns the compiler output of the layers that fail, empty when all pass.
1299
- */
1300
- async function typecheckLayers(root, signal) {
1301
- const layers = verifyLayers(root);
1302
- if (layers.length === 0) return "";
1303
- const compiler = compilerOf(root);
1304
- if (compiler === void 0) return "TypeScript is not installed in the repository root: add typescript to its devDependencies and run the package manager's install.\n";
1305
- return (await Promise.all(layers.map((layer) => typecheckLayer(root, compiler, layer, signal)))).join("");
1306
- }
1307
- //#endregion
1308
- //#region src/guardrails/verify-lockfiles.ts
1309
- /** The folder a repository's playground lives in; verify installs a fixture project from it. */
1310
- const PLAYGROUND = "playground";
1186
+ //#region src/guardrails/lockfile-reading.ts
1311
1187
  const PNPM_LOCK$1 = "pnpm-lock.yaml";
1312
1188
  const NPM_LOCK = "package-lock.json";
1313
1189
  const MANIFEST = "package.json";
1314
1190
  const PNPM_WORKSPACE = "pnpm-workspace.yaml";
1315
- /** Lockfiles this check does not compare, which still mean a folder is locked. */
1191
+ /** Lockfiles other than pnpm's and npm's, which still mean a folder is locked. */
1316
1192
  const OTHER_LOCKS = [
1317
1193
  "npm-shrinkwrap.json",
1318
1194
  "yarn.lock",
@@ -1325,7 +1201,7 @@ const DIRECT_FIELDS = [
1325
1201
  "devDependencies",
1326
1202
  "optionalDependencies"
1327
1203
  ];
1328
- /** A lockfile or manifest this check cannot read as a version it knows. */
1204
+ /** A lockfile or manifest that cannot be read as a version this module knows. */
1329
1205
  var Unreadable = class extends Error {};
1330
1206
  /** Parses a JSON or YAML file whose top level is a mapping; throws `Unreadable` otherwise. */
1331
1207
  function readMapping(path) {
@@ -1351,118 +1227,11 @@ function scalar(map, key) {
1351
1227
  function keys(map) {
1352
1228
  return (map?.items ?? []).flatMap((pair) => isScalar(pair.key) ? [String(pair.key.value)] : []);
1353
1229
  }
1354
- /** Reads a project's direct dependencies, with `specifierOf` reading the specifier of one name from its field. */
1355
- function directOf(node, specifierOf) {
1356
- const direct = /* @__PURE__ */ new Map();
1357
- for (const field of DIRECT_FIELDS) {
1358
- const entries = mapping(node, field);
1359
- for (const name of keys(entries)) {
1360
- const specifier = specifierOf(entries, name);
1361
- if (specifier === void 0) throw new Unreadable(name);
1362
- direct.set(name, /* @__PURE__ */ new Set([...direct.get(name) ?? [], specifier]));
1363
- }
1364
- }
1365
- return direct;
1366
- }
1367
- /** A `package.json` or a `package-lock.json` root entry, where each name maps to its specifier. */
1368
- function declared(node) {
1369
- return directOf(node, scalar);
1370
- }
1371
- /** A `pnpm-lock.yaml` importer, where each name maps to its `specifier` and resolved `version`. */
1372
- function pnpmLocked(node) {
1373
- return directOf(node, (field, name) => scalar(mapping(field, name), "specifier"));
1374
- }
1375
- function listed(specifiers) {
1376
- return specifiers === void 0 ? "none" : [...specifiers].map((specifier) => `"${specifier}"`).join(" or ");
1377
- }
1378
- /**
1379
- * The names whose specifiers differ between a manifest and what its lockfile records, in either direction. A name counts as
1380
- * present whichever of the three fields records it, and matches when the two sides share a specifier. A name the lockfile
1381
- * records and the manifest declares only as a peer passes, since the package manager may or may not install peers. `skip`
1382
- * names the manifest entries the lockfile may leave out or record with another specifier.
1383
- */
1384
- function differences(manifest, locked, skip) {
1385
- const wanted = declared(manifest);
1386
- const peers = new Set(keys(mapping(manifest, "peerDependencies")));
1387
- const line = (name) => `"${name}": package.json asks for ${listed(wanted.get(name))}, the lockfile has ${listed(locked.get(name))}.`;
1388
- const stale = [...wanted].filter(([name, specifiers]) => ![...locked.get(name) ?? []].some((specifier) => specifiers.has(specifier)) && !skip(name, specifiers)).map(([name]) => line(name));
1389
- const extra = [...locked.keys()].filter((name) => !wanted.has(name) && !peers.has(name)).map(line);
1390
- return [...stale, ...extra].sort();
1391
- }
1392
- /** Every package name an override selector such as `foo`, `@scope/foo@^1` or `bar@1>foo@2` mentions, its target among them. */
1393
- function overrideNames(selector) {
1394
- return selector.split(">").flatMap((segment) => /^(?:@[^/@]+\/)?[^@]+/u.exec(segment) ?? []);
1395
- }
1396
- function pnpmDifferences(path) {
1397
- const lockfile = readMapping(join(path, PNPM_LOCK$1));
1398
- if (Number(scalar(lockfile, "lockfileVersion") ?? "0") < 6) throw new Unreadable(path);
1399
- const overridden = new Set(keys(mapping(lockfile, "overrides")).flatMap(overrideNames));
1400
- const linksLeftOut = scalar(mapping(lockfile, "settings"), "excludeLinksFromLockfile") === "true";
1401
- const skip = (name, specifiers) => overridden.has(name) || linksLeftOut && [...specifiers].every((specifier) => specifier.startsWith("link:"));
1402
- const importers = mapping(lockfile, "importers");
1403
- return (importers ? keys(importers) : ["."]).flatMap((importer) => {
1404
- const manifest = join(path, importer, MANIFEST);
1405
- if (!existsSync(manifest)) return [];
1406
- const node = importers ? mapping(importers, importer) : lockfile;
1407
- return differences(readMapping(manifest), pnpmLocked(node), skip).map((line) => `importer "${importer}" ${line}`);
1408
- });
1409
- }
1410
- function npmDifferences(path) {
1411
- const lockfile = readMapping(join(path, NPM_LOCK));
1412
- const rootEntry = mapping(mapping(lockfile, "packages"), "");
1413
- if (Number(scalar(lockfile, "lockfileVersion") ?? "0") < 2 || rootEntry === void 0) throw new Unreadable(path);
1414
- const manifest = join(path, MANIFEST);
1415
- if (!existsSync(manifest)) return [];
1416
- return differences(readMapping(manifest), declared(rootEntry), () => false);
1417
- }
1418
1230
  function lockfileIn(path) {
1419
1231
  if (existsSync(join(path, PNPM_LOCK$1))) return PNPM_LOCK$1;
1420
1232
  if (existsSync(join(path, NPM_LOCK))) return NPM_LOCK;
1421
1233
  return OTHER_LOCKS.some((name) => existsSync(join(path, name))) ? "other" : void 0;
1422
1234
  }
1423
- /** Each folder at or under `folder`, `node_modules` and `dist` aside, that holds a lockfile. */
1424
- function lockedFolders(root, folder) {
1425
- const path = join(root, folder);
1426
- if (!existsSync(path)) return [];
1427
- const lockfile = lockfileIn(path);
1428
- return [...lockfile === void 0 ? [] : [{
1429
- folder,
1430
- lockfile
1431
- }], ...readdirSync(path, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name !== "node_modules" && entry.name !== "dist").flatMap((entry) => lockedFolders(root, `${folder}/${entry.name}`))];
1432
- }
1433
- /** Whether a `package.json` declares a direct dependency; `false` when it is missing or cannot be read, so this check cannot tell. */
1434
- function hasDependencies(path) {
1435
- try {
1436
- if (!existsSync(path)) return false;
1437
- const manifest = readMapping(path);
1438
- return DIRECT_FIELDS.some((field) => keys(mapping(manifest, field)).length > 0);
1439
- } catch (error) {
1440
- if (error instanceof Unreadable) return false;
1441
- throw error;
1442
- }
1443
- }
1444
- /**
1445
- * The folders this check reads, when a layer exists: each folder under a layer, `node_modules` and `dist` aside, and the
1446
- * root `playground`, that holds a lockfile; and each layer's `playground` and the root `playground`, the folders verify
1447
- * installs from, when its `package.json` has dependencies and it holds no lockfile.
1448
- */
1449
- function verifyInstallFolders(root) {
1450
- const layers = verifyLayers(root);
1451
- if (layers.length === 0) return [];
1452
- const playgrounds = [...layers.map((layer) => `${layer}/${PLAYGROUND}`), PLAYGROUND];
1453
- const rootPlayground = lockfileIn(join(root, PLAYGROUND));
1454
- return [
1455
- ...layers.flatMap((layer) => lockedFolders(root, layer)),
1456
- ...rootPlayground === void 0 ? [] : [{
1457
- folder: PLAYGROUND,
1458
- lockfile: rootPlayground
1459
- }],
1460
- ...playgrounds.filter((folder) => lockfileIn(join(root, folder)) === void 0 && hasDependencies(join(root, folder, MANIFEST))).map((folder) => ({
1461
- folder,
1462
- lockfile: void 0
1463
- }))
1464
- ];
1465
- }
1466
1235
  /** The folders above `folder`, nearest first, up to the repository root. */
1467
1236
  function ancestors(folder) {
1468
1237
  const parent = posix.dirname(folder);
@@ -1488,16 +1257,12 @@ function declaresPackages(path) {
1488
1257
  }
1489
1258
  /**
1490
1259
  * Whether a folder above `folder` holds a workspace that may list it, a `pnpm-workspace.yaml` with `packages` or a
1491
- * `package.json` with `workspaces`: its membership then follows patterns this check does not evaluate, and that workspace's
1260
+ * `package.json` with `workspaces`: its membership then follows patterns this module does not evaluate, and that workspace's
1492
1261
  * lockfile may hold it.
1493
1262
  */
1494
1263
  function inWorkspace(root, folder) {
1495
1264
  return ancestors(folder).some((above) => declaresPackages(join(root, above, PNPM_WORKSPACE)) || declaresWorkspaces(join(root, above, MANIFEST)));
1496
1265
  }
1497
- function fixCommand(root, folder, lockfile) {
1498
- if (lockfile === NPM_LOCK) return `npm install --package-lock-only --prefix ${folder}`;
1499
- return existsSync(join(root, folder, PNPM_WORKSPACE)) ? `pnpm install --dir ${folder} --lockfile-only` : `pnpm install --dir ${folder} --ignore-workspace --lockfile-only`;
1500
- }
1501
1266
  /** The lockfile an install writes in a folder that holds none: `package-lock.json` when a folder above holds one, `pnpm-lock.yaml` otherwise. */
1502
1267
  function unlockedLockfile(root, folder) {
1503
1268
  return ancestors(folder).some((above) => existsSync(join(root, above, NPM_LOCK))) ? NPM_LOCK : PNPM_LOCK$1;
@@ -1506,40 +1271,6 @@ function unlockedLockfile(root, folder) {
1506
1271
  function installsWithPnpm(root, folder) {
1507
1272
  return (lockfileIn(join(root, folder)) ?? unlockedLockfile(root, folder)) === PNPM_LOCK$1;
1508
1273
  }
1509
- function unlocked(root, folder) {
1510
- if (inWorkspace(root, folder)) return "";
1511
- return `${folder}/${MANIFEST} has dependencies and no lockfile: run \`${fixCommand(root, folder, unlockedLockfile(root, folder))}\`.\n`;
1512
- }
1513
- function checkFolder(root, { folder, lockfile }) {
1514
- if (lockfile === "other") return "";
1515
- try {
1516
- if (lockfile === void 0) return unlocked(root, folder);
1517
- const path = join(root, folder);
1518
- const found = lockfile === PNPM_LOCK$1 ? pnpmDifferences(path) : npmDifferences(path);
1519
- return found.length === 0 ? "" : `${folder}/${lockfile} does not match ${folder}/${MANIFEST}: run \`${fixCommand(root, folder, lockfile)}\`.\n${found.map((line) => ` ${line}\n`).join("")}`;
1520
- } catch (error) {
1521
- if (error instanceof Unreadable) return `${folder}/${lockfile ?? MANIFEST}: could not read it, or a ${MANIFEST} it locks, as a version this check knows.\n`;
1522
- throw error;
1523
- }
1524
- }
1525
- /**
1526
- * Compares, in code, the direct dependencies each lockfile records with the `package.json` files it locks, and fails on a
1527
- * difference in either direction. A `pnpm-lock.yaml` is compared importer by importer, for each importer it lists that has a
1528
- * `package.json` on disk; a `package-lock.json` by its root entry. Only `dependencies`, `devDependencies` and
1529
- * `optionalDependencies` are compared, by name and specifier: a name counts as present whichever of the three fields records
1530
- * it, and specifiers such as `catalog:` or `workspace:^` compare as written. A name the lockfile records that `package.json`
1531
- * declares only in `peerDependencies` passes. A `package.json` name that an override selector in the `pnpm-lock.yaml`
1532
- * mentions, or a `link:` one the lockfile leaves out under `excludeLinksFromLockfile`, is not compared. A missing lockfile fails only in a layer's
1533
- * `playground` or the root `playground` whose `package.json` has dependencies, unless a folder above it holds a workspace.
1534
- *
1535
- * It spawns no package manager, writes no file and fetches nothing. It does not check workspace membership, overrides,
1536
- * settings, catalogs, `.npmrc` or user configuration, resolved versions, integrity hashes, transitive entries, npm workspace
1537
- * members, or `yarn.lock` and `bun.lock`: verify's own frozen install still rejects a lockfile stale there. Returns what
1538
- * failed, empty when every lockfile matches.
1539
- */
1540
- function checkLockfiles(root) {
1541
- return verifyInstallFolders(root).map((install) => checkFolder(root, install)).join("");
1542
- }
1543
1274
  //#endregion
1544
1275
  //#region src/guardrails/singleton-packages.ts
1545
1276
  const PNPM_LOCK = "pnpm-lock.yaml";
@@ -1965,6 +1696,127 @@ function typecheckWrites(root) {
1965
1696
  }
1966
1697
  }
1967
1698
  //#endregion
1699
+ //#region src/guardrails/verify-layers.ts
1700
+ const SKILLS_FOLDER = ".agents/skills";
1701
+ const LAYER_PREFIX = "verify-";
1702
+ const TSCONFIG = "tsconfig.json";
1703
+ /** Folders of a layer that are not the layer's own code: verify builds its playground with the playground's own tsconfig. */
1704
+ const NOT_LAYER_CODE = /* @__PURE__ */ new Set(["node_modules", "dist"]);
1705
+ const LAYER_PLAYGROUND = "playground";
1706
+ const VERIFY_CONFIG = "verify.config.ts";
1707
+ /**
1708
+ * Options the generated config sets over the layer's: nothing is emitted, and each declaration or build-cache option the
1709
+ * layer may inherit is unset with `null`, so no `.tsbuildinfo` is written, no option is left needing `declaration` or
1710
+ * `composite`, and the declaration checks of files that are never emitted are not run.
1711
+ */
1712
+ const NO_OUTPUT = {
1713
+ noEmit: true,
1714
+ declaration: null,
1715
+ composite: null,
1716
+ incremental: null,
1717
+ tsBuildInfoFile: null,
1718
+ declarationDir: null,
1719
+ declarationMap: null,
1720
+ emitDeclarationOnly: null,
1721
+ isolatedDeclarations: null
1722
+ };
1723
+ /** The verify layers of a repository, relative to its root: each `.agents/skills/verify-*` folder that holds a `tsconfig.json` or a `verify.config.ts`. */
1724
+ function verifyLayers(root) {
1725
+ const skills = join(root, SKILLS_FOLDER);
1726
+ if (!existsSync(skills)) return [];
1727
+ return readdirSync(skills, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.startsWith(LAYER_PREFIX) && [TSCONFIG, VERIFY_CONFIG].some((file) => existsSync(join(skills, entry.name, file)))).map((entry) => `${SKILLS_FOLDER}/${entry.name}`).sort();
1728
+ }
1729
+ /** Whether a file the layer's tsconfig includes is the layer's own code, not its playground, a dependency or a build output. */
1730
+ function isLayerCode(layer, file) {
1731
+ const segments = relative(layer, file).split(sep);
1732
+ return segments[0] !== LAYER_PLAYGROUND && !segments.some((segment) => NOT_LAYER_CODE.has(segment));
1733
+ }
1734
+ /**
1735
+ * The `package.json` of the package `name` in the nearest `node_modules` from `root` up, where a workspace may hoist it.
1736
+ * Node's resolution is not used: it falls back to `NODE_PATH`, where a package manager's bin shim lists the pack's own
1737
+ * dependencies, so a repository without TypeScript would be checked with the pack's.
1738
+ */
1739
+ function manifestOf(root, name) {
1740
+ for (let folder = resolve(root);; folder = dirname(folder)) {
1741
+ const manifestPath = join(folder, "node_modules", name, "package.json");
1742
+ if (existsSync(manifestPath)) return manifestPath;
1743
+ if (dirname(folder) === folder) return void 0;
1744
+ }
1745
+ }
1746
+ /** The repository's own `tsc`, the `bin.tsc` entry of the `typescript` it installs, run with Node so no shell parses its path. It is read from `package.json`, a file every TypeScript version ships, because TypeScript 7 declares an `exports` map that leaves `typescript/bin/tsc` out. */
1747
+ function compilerOf(root) {
1748
+ const manifestPath = manifestOf(root, "typescript");
1749
+ if (manifestPath === void 0) return void 0;
1750
+ try {
1751
+ const tsc = parseManifest(readFileSync(manifestPath, "utf8")).bin?.tsc;
1752
+ return tsc === void 0 ? void 0 : join(dirname(manifestPath), tsc);
1753
+ } catch {
1754
+ return;
1755
+ }
1756
+ }
1757
+ async function typecheckLayer(root, compiler, layer, signal) {
1758
+ const configPath = join(root, layer, TSCONFIG);
1759
+ if (!existsSync(configPath)) return `${layer}: has a verify.config.ts and no tsconfig.json. Add a tsconfig.json that includes its TypeScript files; antelopejs-sync writes one for the shared kinds.\n`;
1760
+ const ts = (await import("./typescript6-BWqCcXGY.mjs")).default;
1761
+ const parsed = ts.getParsedCommandLineOfConfigFile(configPath, void 0, {
1762
+ ...ts.sys,
1763
+ onUnRecoverableConfigFileDiagnostic: () => void 0
1764
+ });
1765
+ if (parsed === void 0) return `${layer}/${TSCONFIG}: could not read it.\n`;
1766
+ const verifyConfig = join(root, layer, VERIFY_CONFIG);
1767
+ if (existsSync(verifyConfig) && !parsed.fileNames.some((file) => resolve(file) === verifyConfig)) return `${layer}/${TSCONFIG}: does not include ${VERIFY_CONFIG}, so it is never type-checked. Add it to the tsconfig's "include" or "files".\n`;
1768
+ const files = parsed.fileNames.filter((file) => isLayerCode(join(root, layer), resolve(file)));
1769
+ if (files.length === 0) return "";
1770
+ const folder = mkdtempSync(join(tmpdir(), "antelopejs-verify-types-"));
1771
+ try {
1772
+ const generated = join(folder, TSCONFIG);
1773
+ writeFileSync(generated, JSON.stringify({
1774
+ extends: configPath,
1775
+ compilerOptions: {
1776
+ ...NO_OUTPUT,
1777
+ typeRoots: ts.getEffectiveTypeRoots(parsed.options, ts.sys)
1778
+ },
1779
+ files,
1780
+ include: []
1781
+ }));
1782
+ const result = await runCommand(process.execPath, [
1783
+ compiler,
1784
+ "-p",
1785
+ generated,
1786
+ "--pretty",
1787
+ "false"
1788
+ ], {
1789
+ cwd: root,
1790
+ env: {
1791
+ ...process.env,
1792
+ CI: "1"
1793
+ },
1794
+ signal,
1795
+ shell: false
1796
+ });
1797
+ return result.status === 0 ? "" : result.output;
1798
+ } finally {
1799
+ rmSync(folder, {
1800
+ recursive: true,
1801
+ force: true
1802
+ });
1803
+ }
1804
+ }
1805
+ /**
1806
+ * Type-checks the own code of each verify layer with the repository's own TypeScript. The files are those the layer's
1807
+ * `tsconfig.json` includes, minus its `playground` folder, which verify compiles with the playground's own config after
1808
+ * installing it, and any `node_modules` or `dist` folder. A config generated in the system temp folder extends the layer's,
1809
+ * lists those files, turns off emit and unsets the emit and build-cache options in `NO_OUTPUT`, so nothing is written in the
1810
+ * repository and no package is fetched. A layer whose `tsconfig.json` does not include its `verify.config.ts` fails. Returns the compiler output of the layers that fail, empty when all pass.
1811
+ */
1812
+ async function typecheckLayers(root, signal) {
1813
+ const layers = verifyLayers(root);
1814
+ if (layers.length === 0) return "";
1815
+ const compiler = compilerOf(root);
1816
+ if (compiler === void 0) return "TypeScript is not installed in the repository root: add typescript to its devDependencies and run the package manager's install.\n";
1817
+ return (await Promise.all(layers.map((layer) => typecheckLayer(root, compiler, layer, signal)))).join("");
1818
+ }
1819
+ //#endregion
1968
1820
  //#region src/guardrails/checks.ts
1969
1821
  const CHECK_STEPS = [
1970
1822
  "typecheck",
@@ -1973,11 +1825,9 @@ const CHECK_STEPS = [
1973
1825
  "knip",
1974
1826
  "test",
1975
1827
  "size",
1976
- "ratchet",
1977
1828
  "suppressions",
1978
1829
  "sync:check",
1979
1830
  "verify:types",
1980
- "verify:lockfiles",
1981
1831
  "lockfile:singletons",
1982
1832
  "dependency:ranges",
1983
1833
  "git:identity",
@@ -1993,7 +1843,6 @@ function failureOnly(check) {
1993
1843
  /** Steps `antelopejs-checks` runs itself, no package.json script behind them. */
1994
1844
  const OWN_STEPS = /* @__PURE__ */ new Map([
1995
1845
  ["verify:types", failureOnly(typecheckLayers)],
1996
- ["verify:lockfiles", failureOnly((root) => Promise.resolve(checkLockfiles(root)))],
1997
1846
  ["lockfile:singletons", failureOnly((root) => Promise.resolve(checkSingletonPackages(root)))],
1998
1847
  ["dependency:ranges", failureOnly(checkRepositoryRanges)],
1999
1848
  ["git:identity", failureOnly(checkGitIdentity)],
@@ -2001,9 +1850,7 @@ const OWN_STEPS = /* @__PURE__ */ new Map([
2001
1850
  ["published:types", checkPublishedTypes]
2002
1851
  ]);
2003
1852
  function hasWork(root, step) {
2004
- if (step === "ratchet") return existsSync(join(root, CEILINGS_FILE));
2005
1853
  if (step === "verify:types") return verifyLayers(root).length > 0;
2006
- if (step === "verify:lockfiles") return verifyInstallFolders(root).length > 0;
2007
1854
  if (step === "lockfile:singletons") return pnpmLockfiles(root).length > 0;
2008
1855
  if (step === "dependency:ranges") return isGitCheckout(root) && hasDependencyRanges(root);
2009
1856
  if (step === "git:identity") return isGitCheckout(root);
@@ -2183,4 +2030,4 @@ async function runChecks(root, options = {}) {
2183
2030
  };
2184
2031
  }
2185
2032
  //#endregion
2186
- export { stepsOf as a, installsWithPnpm as c, runPnpm as d, matchingScripts as i, verifyLayers as l, droppedChecksSteps as n, pnpmLockfiles as o, runChecks as r, inWorkspace as s, CHECKS_SKIP_ENV as t, moveDependencyRanges as u };
2033
+ export { matchingScripts as a, inWorkspace as c, runPnpm as d, verifyLayers as i, installsWithPnpm as l, droppedChecksSteps as n, stepsOf as o, runChecks as r, pnpmLockfiles as s, CHECKS_SKIP_ENV as t, moveDependencyRanges as u };
@@ -1,7 +1,7 @@
1
- import { s as parseManifest } from "./package-1pH5I0TF.mjs";
1
+ import { s as parseManifest } from "./package-7oylgBeT.mjs";
2
+ import { isMap, isScalar, isSeq, parseDocument } from "yaml";
2
3
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
3
4
  import { join } from "node:path";
4
- import { isMap, isScalar, isSeq, parseDocument } from "yaml";
5
5
  //#region src/guardrails/marker-block.ts
6
6
  /** The comment pair sync writes a generated block between. */
7
7
  function markers(name) {
package/dist/eslint.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as typeAwareRuleSetting, t as TYPE_AWARE_RULES } from "./type-aware-rules-BxhHbizU.mjs";
2
- import { t as guardrailsPlugin } from "./guardrails-CNmSFSxO.mjs";
2
+ import { t as guardrailsPlugin } from "./guardrails-Dron1AbR.mjs";
3
3
  import { createConfigForNuxt } from "@nuxt/eslint-config/flat";
4
4
  //#region src/eslint.ts
5
5
  /** Whether every rule of `plugin` has the `create` function ESLint calls, which `eslintCompatPlugin` gives each oxlint rule. */
@@ -1,8 +1,11 @@
1
- import "./ceilings-B7KayYIG.mjs";
2
1
  import { n as IGNORE_PATTERNS, r as SYNCED_AGENT_PATTERNS, t as AGENT_IGNORE_PATTERNS } from "./shared-BCFFyp3l.mjs";
3
2
  import { closeSync, existsSync, lstatSync, openSync, readSync } from "node:fs";
4
3
  import { dirname, join, matchesGlob, relative, resolve } from "node:path";
5
4
  import { execFileSync, spawnSync } from "node:child_process";
5
+ //#region src/guardrails/ceilings.ts
6
+ /** Largest authored file, in bytes, tests included. */
7
+ const MAX_FILE_BYTES = 2e4;
8
+ //#endregion
6
9
  //#region src/guardrails/files.ts
7
10
  const SIZE_EXCLUSIONS = [
8
11
  {
@@ -40,8 +43,6 @@ const SIZE_EXCLUSIONS = [
40
43
  patterns: ["**/*.{png,jpg,jpeg,gif,webp,avif,ico,svg,bmp,tiff,pdf,mp3,wav,ogg,flac,mp4,webm,mov,avi,woff,woff2,ttf,otf,eot,zip,gz,tgz,bz2,xz,7z,tar,rar,wasm,bin,exe,dll,so,dylib,db,sqlite,sqlite3,icns}"]
41
44
  }
42
45
  ];
43
- /** A lint configuration file, which a measurement at an earlier revision keeps at its current content. */
44
- const LINT_CONFIG = /(?:^|\/)(?:oxlint\.config\.[cm]?[jt]s|\.oxlintrc\.jsonc?)$/u;
45
46
  function trackedManifests(root) {
46
47
  return execFileSync("git", ["ls-files", "-z"], {
47
48
  cwd: root,
@@ -185,4 +186,4 @@ function authoredSizes(root, files = gitFiles(root), staged = false) {
185
186
  return sizes;
186
187
  }
187
188
  //#endregion
188
- export { gitFiles as a, repositoryRoot as c, generatedOutput as i, resolveRevision as l, authoredSizes as n, isAgentFile as o, changedFiles as r, repositoryPath as s, LINT_CONFIG as t, trackedManifests as u };
189
+ export { isAgentFile as a, resolveRevision as c, gitFiles as i, trackedManifests as l, changedFiles as n, repositoryPath as o, generatedOutput as r, repositoryRoot as s, authoredSizes as t, MAX_FILE_BYTES as u };
@@ -1,8 +1,8 @@
1
1
  import { c as object, f as parseJson, p as str, s as num } from "../json-CG2L7YFl.mjs";
2
2
  import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
3
3
  import path from "node:path";
4
- import { spawnSync } from "node:child_process";
5
4
  import { fileURLToPath } from "node:url";
5
+ import { spawnSync } from "node:child_process";
6
6
  import { createHash, randomUUID } from "node:crypto";
7
7
  import os from "node:os";
8
8
  //#region src/formal/index.ts