@antelopejs/tooling-configs 0.7.3 → 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 (48) hide show
  1. package/README.md +63 -80
  2. package/dist/bin/api-diff.mjs +29 -49
  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 +318 -210
  11. package/dist/bin/tsc.mjs +24 -0
  12. package/dist/bin/verify.mjs +91 -671
  13. package/dist/{checks-CSlWvky1.mjs → checks-C60vMFin.mjs} +155 -310
  14. package/dist/{docs-compat-BAZiPLZt.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-nj7NTglr.mjs → guardrails-Dron1AbR.mjs} +67 -673
  19. package/dist/{installed-typescript-6MtIWlE4.mjs → installed-typescript-CF_FR9DV.mjs} +17 -17
  20. package/dist/{map-BYkmnvNw.mjs → map-CbNbypUa.mjs} +2 -2
  21. package/dist/oxc/anti-slop/index.mjs +22 -964
  22. package/dist/oxc/guardrails/index.d.mts +1 -1
  23. package/dist/oxc/guardrails/index.mjs +1 -1
  24. package/dist/oxc/lint.d.mts +2 -14
  25. package/dist/oxc/lint.mjs +3 -20
  26. package/dist/{package-DDG3YH7W.mjs → package-7oylgBeT.mjs} +6 -19
  27. package/dist/{workflow-C-oBwL2H.mjs → renovate-D0su_v9p.mjs} +191 -91
  28. package/dist/{suppression-budget-CPDSFg4X.mjs → suppression-budget-De9nUzlD.mjs} +33 -13
  29. package/dist/{suppressions-CxPnh4sC.mjs → suppressions-CfJwL0fN.mjs} +6 -2
  30. package/dist/{templates-HG0fel2S.mjs → templates-DLW0Ubfk.mjs} +26 -29
  31. package/dist/typescript-C7eU-cig.mjs +581 -0
  32. package/dist/typescript-version-CptQKjGz.mjs +18 -0
  33. package/dist/typescript6-BWqCcXGY.mjs +2 -0
  34. package/dist/typescript6-HdyOMBv3.mjs +8 -0
  35. package/dist/verify/index.d.mts +5 -24
  36. package/package.json +27 -7
  37. package/dist/bin/body-check.mjs +0 -350
  38. package/dist/bin/ratchet.d.mts +0 -1
  39. package/dist/bin/ratchet.mjs +0 -375
  40. package/dist/ceilings-B7KayYIG.mjs +0 -76
  41. package/dist/oxlint-CIeonWMB.mjs +0 -133
  42. package/dist/proof-stamp-BFV7JTZT.mjs +0 -342
  43. package/dist/ratchet-DLCfeaPY.mjs +0 -453
  44. package/dist/renames-L2owF5GD.mjs +0 -59
  45. package/dist/size-CCGLY4Ke.mjs +0 -18
  46. package/dist/suppression-base-CYaLZAq7.mjs +0 -120
  47. package/dist/typescript-QfxkJYzd.mjs +0 -292
  48. /package/dist/bin/{body-check.d.mts → tsc.d.mts} +0 -0
@@ -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-DDG3YH7W.mjs";
1
+ import { l as serializeManifest, o as packageManager, s as parseManifest } from "./package-7oylgBeT.mjs";
2
+ import { t as typescript6_default } from "./typescript6-HdyOMBv3.mjs";
3
3
  import { a as isString, f as parseJson, i as isObject, u as optStr } from "./json-CG2L7YFl.mjs";
4
- import { a as gitFiles, u as trackedManifests } from "./files-C-JJhExM.mjs";
5
- import { i as DMS_PACKAGES, n as workspaceDirectories } from "./docs-compat-BAZiPLZt.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";
6
6
  import { n as shimInvocation, t as runCommand } from "./run-command-BlFRPORx.mjs";
7
7
  import { n as tagVersion } from "./npm-CIIqL5SG.mjs";
8
8
  import { n as packTarball } from "./pack-tarball-Cn4zGKn7.mjs";
9
9
  import { t as accepting } from "./ports-DAeEJsYh.mjs";
10
+ import { isMap, isScalar, isSeq, parseAllDocuments, parseDocument, stringify } from "yaml";
10
11
  import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
11
12
  import { basename, dirname, join, posix, relative, resolve, sep } from "node:path";
12
13
  import { spawnSync } from "node:child_process";
13
- import { isMap, isScalar, isSeq, parseAllDocuments, parseDocument, stringify } from "yaml";
14
- import ts from "@typescript/typescript6";
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";
@@ -521,17 +520,17 @@ const CONSUMER_OPTIONS = {
521
520
  const CONSUMER_FILES = {
522
521
  import: {
523
522
  file: "consumer.mts",
524
- mode: ts.ModuleKind.ESNext
523
+ mode: typescript6_default.ModuleKind.ESNext
525
524
  },
526
525
  require: {
527
526
  file: "consumer.cts",
528
- mode: ts.ModuleKind.CommonJS
527
+ mode: typescript6_default.ModuleKind.CommonJS
529
528
  }
530
529
  };
531
530
  const DECLARATION_EXTENSIONS = /* @__PURE__ */ new Set([
532
- ts.Extension.Dts,
533
- ts.Extension.Dmts,
534
- ts.Extension.Dcts
531
+ typescript6_default.Extension.Dts,
532
+ typescript6_default.Extension.Dmts,
533
+ typescript6_default.Extension.Dcts
535
534
  ]);
536
535
  const DECLARATION_FILE$1 = /\.d\.[cm]?ts$/;
537
536
  /** An `exports` value that names declarations: a `types` condition or a `.d.ts`, `.d.mts` or `.d.cts` target. */
@@ -585,10 +584,10 @@ function entrySpecifiers(name, exports, files, consumer) {
585
584
  import: [name],
586
585
  require: []
587
586
  };
588
- const { options } = ts.convertCompilerOptionsFromJson(CONSUMER_OPTIONS, consumer);
587
+ const { options } = typescript6_default.convertCompilerOptionsFromJson(CONSUMER_OPTIONS, consumer);
589
588
  const found = [...candidates(name, exports, files)];
590
589
  const kept = (mode) => found.flatMap(([specifier, namesDeclarations]) => {
591
- const { resolvedModule } = ts.resolveModuleName(specifier, join(consumer, CONSUMER_FILES[mode].file), options, ts.sys, void 0, void 0, CONSUMER_FILES[mode].mode);
590
+ const { resolvedModule } = typescript6_default.resolveModuleName(specifier, join(consumer, CONSUMER_FILES[mode].file), options, typescript6_default.sys, void 0, void 0, CONSUMER_FILES[mode].mode);
592
591
  if (!resolvedModule) return [];
593
592
  return DECLARATION_EXTENSIONS.has(resolvedModule.extension) || namesDeclarations ? [specifier] : [];
594
593
  });
@@ -1184,144 +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
- /** The packages whose `tsc` a repository runs, in order: `typescript`, else `@typescript/native` when `typescript` is the TypeScript 6 API (`@typescript/typescript6`, whose only bin is `tsc6`) installed beside TypeScript 7 for tools that need that API. */
1223
- const COMPILER_PACKAGES = ["typescript", "@typescript/native"];
1224
- /**
1225
- * The `package.json` of the package `name` in the nearest `node_modules` from `root` up, where a workspace may hoist it.
1226
- * Node's resolution is not used: it falls back to `NODE_PATH`, where a package manager's bin shim lists the pack's own
1227
- * dependencies, so a repository without TypeScript would be checked with the pack's.
1228
- */
1229
- function manifestOf(root, name) {
1230
- for (let folder = resolve(root);; folder = dirname(folder)) {
1231
- const manifestPath = join(folder, "node_modules", name, "package.json");
1232
- if (existsSync(manifestPath)) return manifestPath;
1233
- if (dirname(folder) === folder) return void 0;
1234
- }
1235
- }
1236
- /** The `bin.tsc` entry of the package `name` that `root` installs, read from its `package.json`, a file every TypeScript version ships, because TypeScript 7 declares an `exports` map that leaves `typescript/bin/tsc` out. */
1237
- function binTsc(root, name) {
1238
- const manifestPath = manifestOf(root, name);
1239
- if (manifestPath === void 0) return void 0;
1240
- try {
1241
- const tsc = parseManifest(readFileSync(manifestPath, "utf8")).bin?.tsc;
1242
- return tsc === void 0 ? void 0 : join(dirname(manifestPath), tsc);
1243
- } catch {
1244
- return;
1245
- }
1246
- }
1247
- /** The repository's own `tsc` entry, run with Node so no shell parses its path. */
1248
- function compilerOf(root) {
1249
- for (const name of COMPILER_PACKAGES) {
1250
- const tsc = binTsc(root, name);
1251
- if (tsc !== void 0) return tsc;
1252
- }
1253
- }
1254
- async function typecheckLayer(root, compiler, layer, signal) {
1255
- const configPath = join(root, layer, TSCONFIG);
1256
- 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`;
1257
- const ts = (await import("@typescript/typescript6")).default;
1258
- const parsed = ts.getParsedCommandLineOfConfigFile(configPath, void 0, {
1259
- ...ts.sys,
1260
- onUnRecoverableConfigFileDiagnostic: () => void 0
1261
- });
1262
- if (parsed === void 0) return `${layer}/${TSCONFIG}: could not read it.\n`;
1263
- const verifyConfig = join(root, layer, VERIFY_CONFIG);
1264
- 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`;
1265
- const files = parsed.fileNames.filter((file) => isLayerCode(join(root, layer), resolve(file)));
1266
- if (files.length === 0) return "";
1267
- const folder = mkdtempSync(join(tmpdir(), "antelopejs-verify-types-"));
1268
- try {
1269
- const generated = join(folder, TSCONFIG);
1270
- writeFileSync(generated, JSON.stringify({
1271
- extends: configPath,
1272
- compilerOptions: {
1273
- ...NO_OUTPUT,
1274
- typeRoots: ts.getEffectiveTypeRoots(parsed.options, ts.sys)
1275
- },
1276
- files,
1277
- include: []
1278
- }));
1279
- const result = await runCommand(process.execPath, [
1280
- compiler,
1281
- "-p",
1282
- generated,
1283
- "--pretty",
1284
- "false"
1285
- ], {
1286
- cwd: root,
1287
- env: {
1288
- ...process.env,
1289
- CI: "1"
1290
- },
1291
- signal,
1292
- shell: false
1293
- });
1294
- return result.status === 0 ? "" : result.output;
1295
- } finally {
1296
- rmSync(folder, {
1297
- recursive: true,
1298
- force: true
1299
- });
1300
- }
1301
- }
1302
- /**
1303
- * Type-checks the own code of each verify layer with the repository's own TypeScript. The files are those the layer's
1304
- * `tsconfig.json` includes, minus its `playground` folder, which verify compiles with the playground's own config after
1305
- * installing it, and any `node_modules` or `dist` folder. A config generated in the system temp folder extends the layer's,
1306
- * lists those files, turns off emit and unsets the emit and build-cache options in `NO_OUTPUT`, so nothing is written in the
1307
- * 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.
1308
- */
1309
- async function typecheckLayers(root, signal) {
1310
- const layers = verifyLayers(root);
1311
- if (layers.length === 0) return "";
1312
- const compiler = compilerOf(root);
1313
- 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";
1314
- return (await Promise.all(layers.map((layer) => typecheckLayer(root, compiler, layer, signal)))).join("");
1315
- }
1316
- //#endregion
1317
- //#region src/guardrails/verify-lockfiles.ts
1318
- /** The folder a repository's playground lives in; verify installs a fixture project from it. */
1319
- const PLAYGROUND = "playground";
1186
+ //#region src/guardrails/lockfile-reading.ts
1320
1187
  const PNPM_LOCK$1 = "pnpm-lock.yaml";
1321
1188
  const NPM_LOCK = "package-lock.json";
1322
1189
  const MANIFEST = "package.json";
1323
1190
  const PNPM_WORKSPACE = "pnpm-workspace.yaml";
1324
- /** 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. */
1325
1192
  const OTHER_LOCKS = [
1326
1193
  "npm-shrinkwrap.json",
1327
1194
  "yarn.lock",
@@ -1334,7 +1201,7 @@ const DIRECT_FIELDS = [
1334
1201
  "devDependencies",
1335
1202
  "optionalDependencies"
1336
1203
  ];
1337
- /** 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. */
1338
1205
  var Unreadable = class extends Error {};
1339
1206
  /** Parses a JSON or YAML file whose top level is a mapping; throws `Unreadable` otherwise. */
1340
1207
  function readMapping(path) {
@@ -1360,118 +1227,11 @@ function scalar(map, key) {
1360
1227
  function keys(map) {
1361
1228
  return (map?.items ?? []).flatMap((pair) => isScalar(pair.key) ? [String(pair.key.value)] : []);
1362
1229
  }
1363
- /** Reads a project's direct dependencies, with `specifierOf` reading the specifier of one name from its field. */
1364
- function directOf(node, specifierOf) {
1365
- const direct = /* @__PURE__ */ new Map();
1366
- for (const field of DIRECT_FIELDS) {
1367
- const entries = mapping(node, field);
1368
- for (const name of keys(entries)) {
1369
- const specifier = specifierOf(entries, name);
1370
- if (specifier === void 0) throw new Unreadable(name);
1371
- direct.set(name, /* @__PURE__ */ new Set([...direct.get(name) ?? [], specifier]));
1372
- }
1373
- }
1374
- return direct;
1375
- }
1376
- /** A `package.json` or a `package-lock.json` root entry, where each name maps to its specifier. */
1377
- function declared(node) {
1378
- return directOf(node, scalar);
1379
- }
1380
- /** A `pnpm-lock.yaml` importer, where each name maps to its `specifier` and resolved `version`. */
1381
- function pnpmLocked(node) {
1382
- return directOf(node, (field, name) => scalar(mapping(field, name), "specifier"));
1383
- }
1384
- function listed(specifiers) {
1385
- return specifiers === void 0 ? "none" : [...specifiers].map((specifier) => `"${specifier}"`).join(" or ");
1386
- }
1387
- /**
1388
- * The names whose specifiers differ between a manifest and what its lockfile records, in either direction. A name counts as
1389
- * present whichever of the three fields records it, and matches when the two sides share a specifier. A name the lockfile
1390
- * records and the manifest declares only as a peer passes, since the package manager may or may not install peers. `skip`
1391
- * names the manifest entries the lockfile may leave out or record with another specifier.
1392
- */
1393
- function differences(manifest, locked, skip) {
1394
- const wanted = declared(manifest);
1395
- const peers = new Set(keys(mapping(manifest, "peerDependencies")));
1396
- const line = (name) => `"${name}": package.json asks for ${listed(wanted.get(name))}, the lockfile has ${listed(locked.get(name))}.`;
1397
- const stale = [...wanted].filter(([name, specifiers]) => ![...locked.get(name) ?? []].some((specifier) => specifiers.has(specifier)) && !skip(name, specifiers)).map(([name]) => line(name));
1398
- const extra = [...locked.keys()].filter((name) => !wanted.has(name) && !peers.has(name)).map(line);
1399
- return [...stale, ...extra].sort();
1400
- }
1401
- /** Every package name an override selector such as `foo`, `@scope/foo@^1` or `bar@1>foo@2` mentions, its target among them. */
1402
- function overrideNames(selector) {
1403
- return selector.split(">").flatMap((segment) => /^(?:@[^/@]+\/)?[^@]+/u.exec(segment) ?? []);
1404
- }
1405
- function pnpmDifferences(path) {
1406
- const lockfile = readMapping(join(path, PNPM_LOCK$1));
1407
- if (Number(scalar(lockfile, "lockfileVersion") ?? "0") < 6) throw new Unreadable(path);
1408
- const overridden = new Set(keys(mapping(lockfile, "overrides")).flatMap(overrideNames));
1409
- const linksLeftOut = scalar(mapping(lockfile, "settings"), "excludeLinksFromLockfile") === "true";
1410
- const skip = (name, specifiers) => overridden.has(name) || linksLeftOut && [...specifiers].every((specifier) => specifier.startsWith("link:"));
1411
- const importers = mapping(lockfile, "importers");
1412
- return (importers ? keys(importers) : ["."]).flatMap((importer) => {
1413
- const manifest = join(path, importer, MANIFEST);
1414
- if (!existsSync(manifest)) return [];
1415
- const node = importers ? mapping(importers, importer) : lockfile;
1416
- return differences(readMapping(manifest), pnpmLocked(node), skip).map((line) => `importer "${importer}" ${line}`);
1417
- });
1418
- }
1419
- function npmDifferences(path) {
1420
- const lockfile = readMapping(join(path, NPM_LOCK));
1421
- const rootEntry = mapping(mapping(lockfile, "packages"), "");
1422
- if (Number(scalar(lockfile, "lockfileVersion") ?? "0") < 2 || rootEntry === void 0) throw new Unreadable(path);
1423
- const manifest = join(path, MANIFEST);
1424
- if (!existsSync(manifest)) return [];
1425
- return differences(readMapping(manifest), declared(rootEntry), () => false);
1426
- }
1427
1230
  function lockfileIn(path) {
1428
1231
  if (existsSync(join(path, PNPM_LOCK$1))) return PNPM_LOCK$1;
1429
1232
  if (existsSync(join(path, NPM_LOCK))) return NPM_LOCK;
1430
1233
  return OTHER_LOCKS.some((name) => existsSync(join(path, name))) ? "other" : void 0;
1431
1234
  }
1432
- /** Each folder at or under `folder`, `node_modules` and `dist` aside, that holds a lockfile. */
1433
- function lockedFolders(root, folder) {
1434
- const path = join(root, folder);
1435
- if (!existsSync(path)) return [];
1436
- const lockfile = lockfileIn(path);
1437
- return [...lockfile === void 0 ? [] : [{
1438
- folder,
1439
- lockfile
1440
- }], ...readdirSync(path, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name !== "node_modules" && entry.name !== "dist").flatMap((entry) => lockedFolders(root, `${folder}/${entry.name}`))];
1441
- }
1442
- /** Whether a `package.json` declares a direct dependency; `false` when it is missing or cannot be read, so this check cannot tell. */
1443
- function hasDependencies(path) {
1444
- try {
1445
- if (!existsSync(path)) return false;
1446
- const manifest = readMapping(path);
1447
- return DIRECT_FIELDS.some((field) => keys(mapping(manifest, field)).length > 0);
1448
- } catch (error) {
1449
- if (error instanceof Unreadable) return false;
1450
- throw error;
1451
- }
1452
- }
1453
- /**
1454
- * The folders this check reads, when a layer exists: each folder under a layer, `node_modules` and `dist` aside, and the
1455
- * root `playground`, that holds a lockfile; and each layer's `playground` and the root `playground`, the folders verify
1456
- * installs from, when its `package.json` has dependencies and it holds no lockfile.
1457
- */
1458
- function verifyInstallFolders(root) {
1459
- const layers = verifyLayers(root);
1460
- if (layers.length === 0) return [];
1461
- const playgrounds = [...layers.map((layer) => `${layer}/${PLAYGROUND}`), PLAYGROUND];
1462
- const rootPlayground = lockfileIn(join(root, PLAYGROUND));
1463
- return [
1464
- ...layers.flatMap((layer) => lockedFolders(root, layer)),
1465
- ...rootPlayground === void 0 ? [] : [{
1466
- folder: PLAYGROUND,
1467
- lockfile: rootPlayground
1468
- }],
1469
- ...playgrounds.filter((folder) => lockfileIn(join(root, folder)) === void 0 && hasDependencies(join(root, folder, MANIFEST))).map((folder) => ({
1470
- folder,
1471
- lockfile: void 0
1472
- }))
1473
- ];
1474
- }
1475
1235
  /** The folders above `folder`, nearest first, up to the repository root. */
1476
1236
  function ancestors(folder) {
1477
1237
  const parent = posix.dirname(folder);
@@ -1497,16 +1257,12 @@ function declaresPackages(path) {
1497
1257
  }
1498
1258
  /**
1499
1259
  * Whether a folder above `folder` holds a workspace that may list it, a `pnpm-workspace.yaml` with `packages` or a
1500
- * `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
1501
1261
  * lockfile may hold it.
1502
1262
  */
1503
1263
  function inWorkspace(root, folder) {
1504
1264
  return ancestors(folder).some((above) => declaresPackages(join(root, above, PNPM_WORKSPACE)) || declaresWorkspaces(join(root, above, MANIFEST)));
1505
1265
  }
1506
- function fixCommand(root, folder, lockfile) {
1507
- if (lockfile === NPM_LOCK) return `npm install --package-lock-only --prefix ${folder}`;
1508
- return existsSync(join(root, folder, PNPM_WORKSPACE)) ? `pnpm install --dir ${folder} --lockfile-only` : `pnpm install --dir ${folder} --ignore-workspace --lockfile-only`;
1509
- }
1510
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. */
1511
1267
  function unlockedLockfile(root, folder) {
1512
1268
  return ancestors(folder).some((above) => existsSync(join(root, above, NPM_LOCK))) ? NPM_LOCK : PNPM_LOCK$1;
@@ -1515,40 +1271,6 @@ function unlockedLockfile(root, folder) {
1515
1271
  function installsWithPnpm(root, folder) {
1516
1272
  return (lockfileIn(join(root, folder)) ?? unlockedLockfile(root, folder)) === PNPM_LOCK$1;
1517
1273
  }
1518
- function unlocked(root, folder) {
1519
- if (inWorkspace(root, folder)) return "";
1520
- return `${folder}/${MANIFEST} has dependencies and no lockfile: run \`${fixCommand(root, folder, unlockedLockfile(root, folder))}\`.\n`;
1521
- }
1522
- function checkFolder(root, { folder, lockfile }) {
1523
- if (lockfile === "other") return "";
1524
- try {
1525
- if (lockfile === void 0) return unlocked(root, folder);
1526
- const path = join(root, folder);
1527
- const found = lockfile === PNPM_LOCK$1 ? pnpmDifferences(path) : npmDifferences(path);
1528
- return found.length === 0 ? "" : `${folder}/${lockfile} does not match ${folder}/${MANIFEST}: run \`${fixCommand(root, folder, lockfile)}\`.\n${found.map((line) => ` ${line}\n`).join("")}`;
1529
- } catch (error) {
1530
- if (error instanceof Unreadable) return `${folder}/${lockfile ?? MANIFEST}: could not read it, or a ${MANIFEST} it locks, as a version this check knows.\n`;
1531
- throw error;
1532
- }
1533
- }
1534
- /**
1535
- * Compares, in code, the direct dependencies each lockfile records with the `package.json` files it locks, and fails on a
1536
- * difference in either direction. A `pnpm-lock.yaml` is compared importer by importer, for each importer it lists that has a
1537
- * `package.json` on disk; a `package-lock.json` by its root entry. Only `dependencies`, `devDependencies` and
1538
- * `optionalDependencies` are compared, by name and specifier: a name counts as present whichever of the three fields records
1539
- * it, and specifiers such as `catalog:` or `workspace:^` compare as written. A name the lockfile records that `package.json`
1540
- * declares only in `peerDependencies` passes. A `package.json` name that an override selector in the `pnpm-lock.yaml`
1541
- * mentions, or a `link:` one the lockfile leaves out under `excludeLinksFromLockfile`, is not compared. A missing lockfile fails only in a layer's
1542
- * `playground` or the root `playground` whose `package.json` has dependencies, unless a folder above it holds a workspace.
1543
- *
1544
- * It spawns no package manager, writes no file and fetches nothing. It does not check workspace membership, overrides,
1545
- * settings, catalogs, `.npmrc` or user configuration, resolved versions, integrity hashes, transitive entries, npm workspace
1546
- * members, or `yarn.lock` and `bun.lock`: verify's own frozen install still rejects a lockfile stale there. Returns what
1547
- * failed, empty when every lockfile matches.
1548
- */
1549
- function checkLockfiles(root) {
1550
- return verifyInstallFolders(root).map((install) => checkFolder(root, install)).join("");
1551
- }
1552
1274
  //#endregion
1553
1275
  //#region src/guardrails/singleton-packages.ts
1554
1276
  const PNPM_LOCK = "pnpm-lock.yaml";
@@ -1636,7 +1358,8 @@ function checkSingletonPackages(root) {
1636
1358
  //#region src/guardrails/script-steps.ts
1637
1359
  const SEPARATORS = /&&|\|\||[;|\n]|(?<![>&])&(?!&)/u;
1638
1360
  const ENV_ASSIGNMENT = /^[A-Za-z_]\w*=/u;
1639
- const TSC_COMMAND = /(?:^|[\\/])tsc(?:\.js)?$/u;
1361
+ /** The compilers a script runs by name: TypeScript's `tsc` and the pack's `antelopejs-tsc`, which takes the same arguments. */
1362
+ const TSC_COMMANDS = ["tsc", "antelopejs-tsc"];
1640
1363
  const MANAGERS = /* @__PURE__ */ new Set([
1641
1364
  "pnpm",
1642
1365
  "npm",
@@ -1746,15 +1469,19 @@ function skipOptions(args, from, valued) {
1746
1469
  targets
1747
1470
  };
1748
1471
  }
1749
- function isTsc(word) {
1750
- return TSC_COMMAND.test(word);
1472
+ /** The compiler `word` runs: its name or a path to it, with or without `.js`. */
1473
+ function tscCommand(word) {
1474
+ const name = word.split(/[\\/]/u).at(-1)?.replace(/\.js$/u, "");
1475
+ return TSC_COMMANDS.find((command) => command === name);
1751
1476
  }
1752
- /** `tsc`, a path to it, or `node` running one. */
1477
+ /** `tsc` or the pack's `antelopejs-tsc`, a path to either, or `node` running one. */
1753
1478
  function programSteps(line) {
1754
1479
  const [head, ...rest] = line;
1755
1480
  if (head === void 0) return [];
1756
- if (isTsc(head)) return [{
1481
+ const command = tscCommand(head);
1482
+ if (command) return [{
1757
1483
  kind: "tsc",
1484
+ command,
1758
1485
  args: rest,
1759
1486
  targets: []
1760
1487
  }];
@@ -1765,8 +1492,10 @@ function programSteps(line) {
1765
1492
  targets: []
1766
1493
  }];
1767
1494
  const at = rest.findIndex((word) => !word.startsWith("-"));
1768
- return at !== -1 && isTsc(rest[at]) ? [{
1495
+ const run = at === -1 ? void 0 : tscCommand(rest[at]);
1496
+ return run ? [{
1769
1497
  kind: "tsc",
1498
+ command: run,
1770
1499
  args: rest.slice(at + 1),
1771
1500
  targets: []
1772
1501
  }] : [];
@@ -1799,7 +1528,7 @@ function managerSteps(manager, args) {
1799
1528
  const verb = args[first.index];
1800
1529
  if (verb === void 0) return [];
1801
1530
  if (EXEC_VERBS.has(verb)) return pointedAt(execSteps(args.slice(first.index + 1)), first.targets);
1802
- if (isTsc(verb)) return pointedAt(programSteps(args.slice(first.index)), first.targets);
1531
+ if (tscCommand(verb)) return pointedAt(programSteps(args.slice(first.index)), first.targets);
1803
1532
  const run = verb === "run" || verb === "run-script";
1804
1533
  const second = run ? skipOptions(args, first.index + 1, valued) : {
1805
1534
  index: first.index,
@@ -1919,12 +1648,12 @@ function configFile(directory, project) {
1919
1648
  /** Whether a `tsc` command line writes output: `-b`, or a run whose command line or tsconfig chain leaves `noEmit` unset. */
1920
1649
  function tscWrites(directory, args) {
1921
1650
  if (/^--?b(?:uild)?$/iu.test(args[0] ?? "")) return true;
1922
- const { options } = ts.parseCommandLine([...args]);
1651
+ const { options } = typescript6_default.parseCommandLine([...args]);
1923
1652
  if (options.noEmit !== void 0) return !options.noEmit;
1924
1653
  const file = configFile(directory, options.project ?? ".");
1925
1654
  if (!existsSync(file)) return true;
1926
- return ts.getParsedCommandLineOfConfigFile(file, {}, {
1927
- ...ts.sys,
1655
+ return typescript6_default.getParsedCommandLineOfConfigFile(file, {}, {
1656
+ ...typescript6_default.sys,
1928
1657
  onUnRecoverableConfigFileDiagnostic: () => void 0
1929
1658
  })?.options.noEmit !== true;
1930
1659
  }
@@ -1967,6 +1696,127 @@ function typecheckWrites(root) {
1967
1696
  }
1968
1697
  }
1969
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
1970
1820
  //#region src/guardrails/checks.ts
1971
1821
  const CHECK_STEPS = [
1972
1822
  "typecheck",
@@ -1975,11 +1825,9 @@ const CHECK_STEPS = [
1975
1825
  "knip",
1976
1826
  "test",
1977
1827
  "size",
1978
- "ratchet",
1979
1828
  "suppressions",
1980
1829
  "sync:check",
1981
1830
  "verify:types",
1982
- "verify:lockfiles",
1983
1831
  "lockfile:singletons",
1984
1832
  "dependency:ranges",
1985
1833
  "git:identity",
@@ -1995,7 +1843,6 @@ function failureOnly(check) {
1995
1843
  /** Steps `antelopejs-checks` runs itself, no package.json script behind them. */
1996
1844
  const OWN_STEPS = /* @__PURE__ */ new Map([
1997
1845
  ["verify:types", failureOnly(typecheckLayers)],
1998
- ["verify:lockfiles", failureOnly((root) => Promise.resolve(checkLockfiles(root)))],
1999
1846
  ["lockfile:singletons", failureOnly((root) => Promise.resolve(checkSingletonPackages(root)))],
2000
1847
  ["dependency:ranges", failureOnly(checkRepositoryRanges)],
2001
1848
  ["git:identity", failureOnly(checkGitIdentity)],
@@ -2003,9 +1850,7 @@ const OWN_STEPS = /* @__PURE__ */ new Map([
2003
1850
  ["published:types", checkPublishedTypes]
2004
1851
  ]);
2005
1852
  function hasWork(root, step) {
2006
- if (step === "ratchet") return existsSync(join(root, CEILINGS_FILE));
2007
1853
  if (step === "verify:types") return verifyLayers(root).length > 0;
2008
- if (step === "verify:lockfiles") return verifyInstallFolders(root).length > 0;
2009
1854
  if (step === "lockfile:singletons") return pnpmLockfiles(root).length > 0;
2010
1855
  if (step === "dependency:ranges") return isGitCheckout(root) && hasDependencyRanges(root);
2011
1856
  if (step === "git:identity") return isGitCheckout(root);
@@ -2185,4 +2030,4 @@ async function runChecks(root, options = {}) {
2185
2030
  };
2186
2031
  }
2187
2032
  //#endregion
2188
- 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-DDG3YH7W.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-nj7NTglr.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. */