@antelopejs/tooling-configs 0.5.6 → 0.5.8

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 (34) hide show
  1. package/dist/bin/api-diff.mjs +9 -7
  2. package/dist/bin/body-check.mjs +3 -3
  3. package/dist/bin/capture.mjs +12 -4
  4. package/dist/bin/check-size.mjs +6 -4
  5. package/dist/bin/checks.mjs +2 -2
  6. package/dist/bin/comment-proof.mjs +3 -3
  7. package/dist/bin/garden.mjs +151 -15
  8. package/dist/bin/lease.mjs +142 -20
  9. package/dist/bin/ratchet.mjs +5 -5
  10. package/dist/bin/readme-strip.mjs +1 -1
  11. package/dist/bin/suppressions.mjs +9 -10
  12. package/dist/bin/sync.mjs +96 -29
  13. package/dist/bin/verify.mjs +65 -39
  14. package/dist/{checks-DqTjyKCC.mjs → checks-BC-F8bsv.mjs} +4 -537
  15. package/dist/docs-compat-Ft1r2sf0.mjs +476 -0
  16. package/dist/{files-DJ0TeaTU.mjs → files-C-JJhExM.mjs} +1 -1
  17. package/dist/launch-D5cylwvb.mjs +76 -0
  18. package/dist/{map-DRyYz_Fw.mjs → map-BYkmnvNw.mjs} +42 -10
  19. package/dist/oxc/fmt.mjs +1 -1
  20. package/dist/oxc/guardrails/index.mjs +1 -1
  21. package/dist/oxc/lint.mjs +1 -1
  22. package/dist/{oxlint-BbpTFFmf.mjs → oxlint-CCOJqj3d.mjs} +6 -2
  23. package/dist/{proof-stamp-Kg-tkM6G.mjs → proof-stamp-lyD84zmj.mjs} +4 -4
  24. package/dist/{ratchet-1O8k4Dxu.mjs → ratchet-SQ7vTR0i.mjs} +4 -4
  25. package/dist/run-command-BlFRPORx.mjs +95 -0
  26. package/dist/{shared-igPpEDpS.mjs → shared-BCFFyp3l.mjs} +9 -2
  27. package/dist/{size-DBatLT-F.mjs → size-CCGLY4Ke.mjs} +1 -1
  28. package/dist/slash-BEgSnfYw.mjs +12 -0
  29. package/dist/{suppression-base-DZgUDXiI.mjs → suppression-base-whhvw-IJ.mjs} +3 -3
  30. package/dist/{suppression-budget-DgYdu6JK.mjs → suppression-budget-CtIYSoDO.mjs} +2 -2
  31. package/dist/{suppressions-CQTcKCi1.mjs → suppressions-C79kRvYI.mjs} +1 -1
  32. package/dist/{typescript-DhavwHb7.mjs → typescript--_8og8AM.mjs} +20 -7
  33. package/dist/verify/index.d.mts +2 -0
  34. package/package.json +1 -1
@@ -1,10 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { a as VERIFY_KINDS, c as isVerifyKind, l as skillFolder } from "../shared-igPpEDpS.mjs";
2
+ import { a as VERIFY_KINDS, c as isVerifyKind, l as skillFolder } from "../shared-BCFFyp3l.mjs";
3
3
  import { a as isString, c as object, f as parseJson, i as isObject, n as children, p as str, s as num, t as child, u as optStr } from "../json-CG2L7YFl.mjs";
4
4
  import { a as exitIs, c as interrupted, i as exists, r as equal, u as refused } from "../checks-CxkSu2E6.mjs";
5
5
  import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
6
- import { c as repositoryRoot } from "../files-DJ0TeaTU.mjs";
7
- import { S as matchesPath, _ as recordProcesses, a as readFeatures, b as withLocalBins, c as allocateRun, d as isolatedEnv, f as loadRun, g as ownRun, h as operatorTmpdir, i as planFor, l as commandRecords, m as operatorEnv, n as SMOKE_FEATURE, o as CACHE_DIR, p as openWorkspace, r as checkMap, s as RUNS_DIR, u as git, v as removeTree, x as writeWhole, y as saveRun } from "../map-DRyYz_Fw.mjs";
6
+ import { c as repositoryRoot } from "../files-C-JJhExM.mjs";
7
+ import { C as pauseSync, S as writeWhole, _ as ownRun, a as readFeatures, b as saveRun, c as allocateRun, d as git, f as isolatedEnv, g as operatorTmpdir, h as operatorEnv, i as planFor, l as canonical, m as openWorkspace, n as SMOKE_FEATURE, o as CACHE_DIR, p as loadRun, r as checkMap, s as RUNS_DIR, u as commandRecords, v as recordProcesses, w as matchesPath, x as withLocalBins, y as removeTree } from "../map-BYkmnvNw.mjs";
8
+ import { t as relativeSlashed } from "../slash-BEgSnfYw.mjs";
9
+ import { n as launch, r as spawnLaunched, t as killTree } from "../launch-D5cylwvb.mjs";
8
10
  import { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, cpSync, existsSync, linkSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, rmdirSync, statSync, symlinkSync, unlinkSync, utimesSync, writeFileSync } from "node:fs";
9
11
  import { basename, dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
10
12
  import { execFileSync, spawn, spawnSync } from "node:child_process";
@@ -370,7 +372,7 @@ function inWorktree(repo, sha, action) {
370
372
  function probeFingerprint(repo, command, sha) {
371
373
  const [program, ...args] = command;
372
374
  return inWorktree(repo, sha, (dir) => {
373
- const run = spawnSync(program, [...args, dir], {
375
+ const run = spawnLaunched(program, [...args, dir], {
374
376
  cwd: repo,
375
377
  env: operatorEnv(),
376
378
  encoding: "utf8",
@@ -551,7 +553,7 @@ function rulesOf(check, run) {
551
553
  }
552
554
  function runCommand(command, cwd) {
553
555
  const [program, ...args] = command;
554
- return spawnSync(program, args, {
556
+ return spawnLaunched(program, args, {
555
557
  cwd,
556
558
  env: operatorEnv(),
557
559
  encoding: "utf8",
@@ -579,7 +581,7 @@ function gitOutput(root, args) {
579
581
  return run.status === 0 ? run.stdout : null;
580
582
  }
581
583
  function namedOnBase(workspace, check, baseSha) {
582
- const config = relative(workspace.root, join(workspace.skill, "verify.config.ts"));
584
+ const config = relativeSlashed(workspace.root, join(workspace.skill, "verify.config.ts"));
583
585
  const text = gitOutput(workspace.root, ["show", `${baseSha}:${config}`]);
584
586
  if (text === null) return false;
585
587
  return [
@@ -652,7 +654,7 @@ function runFormalCheck(workspace, state, check, diff) {
652
654
  violated: head.violated,
653
655
  passing: head.passing,
654
656
  lengths: head.lengths,
655
- folder: relative(state.evidence, folder)
657
+ folder: relativeSlashed(state.evidence, folder)
656
658
  };
657
659
  if (diff !== null) Object.assign(result, { commits: {
658
660
  baseSha: diff.baseSha,
@@ -771,6 +773,8 @@ function readFormalResult(state, name) {
771
773
  }
772
774
  //#endregion
773
775
  //#region src/verify/record.ts
776
+ /** Whether a command leads a process group of its own. Windows has none, and a detached command starts without a console, so a `.cmd` shim runs its `node` in a new console whose output never reaches the recorded pipes. */
777
+ const LEADS_GROUP = process.platform !== "win32";
774
778
  const DEFAULT_TIMEOUT_MS = 6e5;
775
779
  /** Quotes an argument the way a shell user would type it. */
776
780
  function shellQuote(value) {
@@ -821,10 +825,12 @@ function runRecorded(folder, spec) {
821
825
  writeCommand(folder, spec);
822
826
  listenForInterrupts();
823
827
  return new Promise((resolve) => {
824
- const child = spawn(spec.program, spec.args, {
828
+ const started = launch(spec.program, spec.args, spec.env);
829
+ const child = spawn(started.program, started.args, {
825
830
  cwd: spec.cwd,
826
831
  env: spec.env,
827
- detached: true,
832
+ detached: LEADS_GROUP,
833
+ windowsVerbatimArguments: started.verbatim,
828
834
  stdio: [
829
835
  "ignore",
830
836
  "pipe",
@@ -864,10 +870,12 @@ function startRecorded(folder, spec) {
864
870
  writeCommand(folder, spec);
865
871
  const stdout = openSync(join(folder, "stdout.txt"), "w");
866
872
  const stderr = openSync(join(folder, "stderr.txt"), "w");
867
- const child = spawn(spec.program, spec.args, {
873
+ const started = launch(spec.program, spec.args, spec.env);
874
+ const child = spawn(started.program, started.args, {
868
875
  cwd: spec.cwd,
869
876
  env: spec.env,
870
- detached: true,
877
+ detached: LEADS_GROUP,
878
+ windowsVerbatimArguments: started.verbatim,
871
879
  stdio: [
872
880
  "ignore",
873
881
  stdout,
@@ -897,6 +905,10 @@ function startRecorded(folder, spec) {
897
905
  }
898
906
  /** Kills the process group a detached command leads, never a lone PID the system may have reused since the command exited. */
899
907
  function killOwnGroup(pid) {
908
+ if (process.platform === "win32") {
909
+ killTree(pid);
910
+ return;
911
+ }
900
912
  try {
901
913
  process.kill(-pid, "SIGKILL");
902
914
  } catch {
@@ -905,6 +917,10 @@ function killOwnGroup(pid) {
905
917
  }
906
918
  /** Kills the process group of `pid`, or `pid` alone, ignoring a process already gone. */
907
919
  function killGroup(pid) {
920
+ if (process.platform === "win32") {
921
+ killTree(pid);
922
+ return;
923
+ }
908
924
  try {
909
925
  process.kill(-pid, "SIGKILL");
910
926
  } catch {
@@ -1042,7 +1058,7 @@ const TREE_SKIP = /* @__PURE__ */ new Set([
1042
1058
  function listTree(root, folder = root) {
1043
1059
  return readdirSync(folder, { withFileTypes: true }).filter((entry) => !TREE_SKIP.has(entry.name)).sort((left, right) => left.name.localeCompare(right.name)).flatMap((entry) => {
1044
1060
  const path = join(folder, entry.name);
1045
- const name = relative(root, path);
1061
+ const name = relativeSlashed(root, path);
1046
1062
  if (entry.isDirectory()) return [`${name}/`, ...listTree(root, path)];
1047
1063
  return [`${name} ${statSync(path).size}`];
1048
1064
  });
@@ -1291,10 +1307,11 @@ function readJudgement(file) {
1291
1307
  //#endregion
1292
1308
  //#region src/verify/docker.ts
1293
1309
  const READY_TIMEOUT_MS$1 = 9e4;
1310
+ const POLL_MS$1 = 500;
1294
1311
  /** The open-file limit of every service container, MongoDB's recommended value: Docker's default soft limit of 1024 runs out when mongod holds dropped tables open until its next checkpoint. */
1295
1312
  const OPEN_FILES = 64e3;
1296
1313
  function docker(args) {
1297
- const run = spawnSync("docker", args, { encoding: "utf8" });
1314
+ const run = spawnLaunched("docker", args, { encoding: "utf8" });
1298
1315
  return {
1299
1316
  status: run.status,
1300
1317
  stdout: run.stdout ?? "",
@@ -1326,7 +1343,7 @@ function waitReady$1(container, ready, folder) {
1326
1343
  ...ready
1327
1344
  ]);
1328
1345
  while (last.status !== 0 && Date.now() < deadline) {
1329
- spawnSync("sleep", ["0.5"]);
1346
+ pauseSync(POLL_MS$1);
1330
1347
  last = docker([
1331
1348
  "exec",
1332
1349
  container,
@@ -1343,8 +1360,8 @@ function waitReady$1(container, ready, folder) {
1343
1360
  /**
1344
1361
  * Starts every service of verify.config.ts in its own container, named
1345
1362
  * `<prefix>-<repo>-<service>-<run id>`, publishes its port on a free
1346
- * loopback port chosen by Docker, raises its open-file limit to 64000, and
1347
- * waits for its readiness command. Each
1363
+ * loopback port chosen by Docker, raises its open-file limit to 64000, passes
1364
+ * its `args` after the image, and waits for its readiness command. Each
1348
1365
  * container is recorded before it is probed, so `clean` removes it even when
1349
1366
  * it never became ready.
1350
1367
  */
@@ -1362,7 +1379,8 @@ function startServices(workspace, state, prefix) {
1362
1379
  "--ulimit",
1363
1380
  `nofile=${OPEN_FILES}:${OPEN_FILES}`,
1364
1381
  ...env,
1365
- definition.image
1382
+ definition.image,
1383
+ ...definition.args ?? []
1366
1384
  ];
1367
1385
  const folder = join(state.evidence, "services", service);
1368
1386
  const elapsed = stopwatch();
@@ -2525,10 +2543,10 @@ async function extractPublished(context, tarball) {
2525
2543
  mkdirSync(extracted, { recursive: true });
2526
2544
  const untar = await context.command("extract published", "tar", [
2527
2545
  "-xzf",
2528
- tarball,
2546
+ relativeSlashed(extracted, tarball),
2529
2547
  "-C",
2530
- extracted
2531
- ]);
2548
+ "."
2549
+ ], { cwd: extracted });
2532
2550
  context.expect(untar.folder, [exitIs(untar, 0)], { critical: true });
2533
2551
  const root = join(extracted, "package");
2534
2552
  linkDependencies(root, context.repo);
@@ -2778,7 +2796,7 @@ function setupCommands(workspace) {
2778
2796
  async function runSetup(workspace, state) {
2779
2797
  const commands = setupCommands(workspace);
2780
2798
  for (const [index, [program, ...args]] of commands.entries()) {
2781
- const name = `${String(index + 1).padStart(2, "0")}-${program}`;
2799
+ const name = `${String(index + 1).padStart(2, "0")}-${basename(program, extname(program))}`;
2782
2800
  const folder = join(state.evidence, "setup", name);
2783
2801
  const elapsed = stopwatch();
2784
2802
  const result = await runRecorded(folder, {
@@ -2821,9 +2839,9 @@ async function packInterface(workspace, state) {
2821
2839
  program: "tar",
2822
2840
  args: [
2823
2841
  "-xzf",
2824
- join(folder, tarball),
2842
+ tarball,
2825
2843
  "-C",
2826
- folder
2844
+ "."
2827
2845
  ],
2828
2846
  cwd: folder,
2829
2847
  env
@@ -2970,7 +2988,7 @@ function doctor(workspace, state) {
2970
2988
  const head = git(workspace.root, ["rev-parse", "HEAD"]);
2971
2989
  let core = "";
2972
2990
  try {
2973
- core = relative(workspace.root, installedPackage(workspace.root, "@antelopejs/core"));
2991
+ core = relativeSlashed(workspace.root, installedPackage(workspace.root, "@antelopejs/core"));
2974
2992
  } catch (error) {
2975
2993
  core = error instanceof Error ? error.message : String(error);
2976
2994
  }
@@ -3335,7 +3353,7 @@ function keep(context, kept, folder, built) {
3335
3353
  copyTree(folder, join(staging, "folder"), built.links, join(kept, "folder"));
3336
3354
  writeFileSync(join(staging, "links"), built.links.flatMap((link) => [link.path, link.target]).join("\0"));
3337
3355
  writeFileSync(join(staging, "projects.json"), JSON.stringify(built.projects));
3338
- writeFileSync(join(staging, "from.txt"), `${relative(context.state.evidence, context.folder)}\n`);
3356
+ writeFileSync(join(staging, "from.txt"), `${relativeSlashed(context.state.evidence, context.folder)}\n`);
3339
3357
  renameSync(staging, kept);
3340
3358
  return true;
3341
3359
  } catch (error) {
@@ -3396,7 +3414,7 @@ async function prepare(context, key, build) {
3396
3414
  const folder = join(context.work, key);
3397
3415
  if (existsSync(folder)) throw new Error(`${folder} already exists: a journey prepares ${key} once`);
3398
3416
  const kept = join(context.state.dir, "prepared", key);
3399
- if (existsSync(kept) && builder(kept) === relative(context.state.evidence, context.folder)) drop(kept);
3417
+ if (existsSync(kept) && builder(kept) === relativeSlashed(context.state.evidence, context.folder)) drop(kept);
3400
3418
  const where = {
3401
3419
  marker: context.step(`prepared ${key}`),
3402
3420
  key,
@@ -3774,8 +3792,10 @@ const POLL_MS = 250;
3774
3792
  const FAST_POLL_MS = 25;
3775
3793
  /** How long readiness is probed every `FAST_POLL_MS` before falling back to `POLL_MS`. */
3776
3794
  const FAST_POLL_WINDOW_MS = 3e3;
3795
+ /** How long one probe of the fast window waits for an answer. Windows takes a second or more to refuse a connection to a port nobody listens on yet, so a longer wait would hide an app that started meanwhile for that long. */
3796
+ const FAST_PROBE_TIMEOUT_MS = 200;
3777
3797
  const SETTLE_MS = 3e3;
3778
- async function probe(context, app, fixture, folder) {
3798
+ async function probe(context, app, fixture, folder, timeoutMs) {
3779
3799
  const probe = context.workspace.config.template?.probe;
3780
3800
  if (!fixture && probe?.log) {
3781
3801
  const output = readOutput(app.folder);
@@ -3786,7 +3806,7 @@ async function probe(context, app, fixture, folder) {
3786
3806
  };
3787
3807
  }
3788
3808
  const path = fixture ? "/health" : probe?.path ?? "/";
3789
- const answer = await httpRecorded(folder, `http://127.0.0.1:${app.port}${path}`);
3809
+ const answer = await httpRecorded(folder, `http://127.0.0.1:${app.port}${path}`, { timeoutMs });
3790
3810
  const status = fixture ? 200 : probe?.status ?? 200;
3791
3811
  const body = !fixture && probe?.body ? probe.body : /./s;
3792
3812
  return {
@@ -3804,10 +3824,11 @@ async function waitReady(context, app, handle, fixture) {
3804
3824
  exited = true;
3805
3825
  });
3806
3826
  const fastUntil = Date.now() + FAST_POLL_WINDOW_MS;
3807
- let check = await probe(context, app, fixture, folder);
3827
+ const patience = () => Date.now() < fastUntil ? FAST_PROBE_TIMEOUT_MS : void 0;
3828
+ let check = await probe(context, app, fixture, folder, patience());
3808
3829
  while (!check.pass && !exited && Date.now() < deadline) {
3809
3830
  await setTimeout$1(Date.now() < fastUntil ? FAST_POLL_MS : POLL_MS);
3810
- check = await probe(context, app, fixture, folder);
3831
+ check = await probe(context, app, fixture, folder, patience());
3811
3832
  }
3812
3833
  const settle = context.workspace.config.template?.probe.log ? context.workspace.config.template.probe.settleMs ?? SETTLE_MS : 0;
3813
3834
  if (check.pass && settle > 0) await setTimeout$1(settle);
@@ -4071,8 +4092,9 @@ const READINESS_RETRY_MS = [
4071
4092
  function slug(text) {
4072
4093
  return text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
4073
4094
  }
4074
- /** Sends `name` to `pid`, returning whether the signal was delivered. */
4095
+ /** Sends `name` to `pid`, returning whether the signal was delivered. Windows has no signals: there the process and everything it started end at once, without running a handler. */
4075
4096
  function signal(pid, name) {
4097
+ if (process.platform === "win32") return killTree(pid);
4076
4098
  try {
4077
4099
  process.kill(pid, name);
4078
4100
  return true;
@@ -4164,10 +4186,10 @@ var VerifyContext = class {
4164
4186
  return httpRecorded(this.step(name), url, init);
4165
4187
  }
4166
4188
  expect(folder, checks, options = {}) {
4167
- const name = relative(this.folder, folder) || "journey";
4189
+ const name = relativeSlashed(this.folder, folder) || "journey";
4168
4190
  this.steps.push({
4169
4191
  name,
4170
- folder: relative(this.state.evidence, folder),
4192
+ folder: relativeSlashed(this.state.evidence, folder),
4171
4193
  checks
4172
4194
  });
4173
4195
  appendFileSync(join(folder, "checks.json"), `${JSON.stringify(checks, null, 2)}\n`);
@@ -4317,10 +4339,14 @@ var VerifyContext = class {
4317
4339
  killGroup(app.pid);
4318
4340
  writeFileSync(join(folder, "note.txt"), `no exit within ${STOP_TIMEOUT_MS} ms of SIGINT; killed the process group\n`);
4319
4341
  }
4320
- const exit = outcome ?? {
4342
+ const ended = outcome ?? {
4321
4343
  exitCode: null,
4322
4344
  signal: "SIGKILL"
4323
4345
  };
4346
+ const exit = process.platform === "win32" && outcome && running?.sent.includes("SIGINT") ? {
4347
+ exitCode: null,
4348
+ signal: "SIGINT"
4349
+ } : ended;
4324
4350
  writeFileSync(join(folder, "exit-code.txt"), `${exit.exitCode ?? `signal ${exit.signal}`}\n`);
4325
4351
  this.untrack(app.pid);
4326
4352
  return {
@@ -4429,7 +4455,7 @@ function resetServices(context) {
4429
4455
  if (!service.reset) continue;
4430
4456
  const container = context.service(name).container;
4431
4457
  const folder = context.step(`reset ${name}`);
4432
- const run = spawnSync("docker", [
4458
+ const run = spawnLaunched("docker", [
4433
4459
  "exec",
4434
4460
  container,
4435
4461
  ...service.reset
@@ -4517,7 +4543,7 @@ async function driveJourney(context, feature, id, journey) {
4517
4543
  status,
4518
4544
  steps: context.steps,
4519
4545
  ...failure,
4520
- folder: relative(state.evidence, context.folder),
4546
+ folder: relativeSlashed(state.evidence, context.folder),
4521
4547
  stepMs: context.clock.finish(),
4522
4548
  ms: elapsed()
4523
4549
  };
@@ -4554,7 +4580,7 @@ function gitPaths(root, args) {
4554
4580
  */
4555
4581
  function treeState(root, runDir) {
4556
4582
  try {
4557
- const own = relative(root, runDir);
4583
+ const own = relativeSlashed(canonical(root), canonical(runDir));
4558
4584
  const inside = own !== "" && !own.startsWith("..") && !isAbsolute(own) ? `${own}/` : null;
4559
4585
  const hash = createHash("sha256");
4560
4586
  hash.update(git(root, ["rev-parse", "HEAD"]));
@@ -4612,7 +4638,7 @@ function reuse(state, feature, id, source) {
4612
4638
  const result = {
4613
4639
  ...source,
4614
4640
  feature,
4615
- folder: relative(state.evidence, folder),
4641
+ folder: relativeSlashed(state.evidence, folder),
4616
4642
  reusedFrom: source.folder,
4617
4643
  ms: 0,
4618
4644
  stepMs: []
@@ -4854,7 +4880,7 @@ function renderVerdict(workspace, state, pr, judgement) {
4854
4880
  "-1",
4855
4881
  "--format=%H",
4856
4882
  "--",
4857
- relative(workspace.root, workspace.skill)
4883
+ relativeSlashed(workspace.root, workspace.skill)
4858
4884
  ]) || plan.headSha;
4859
4885
  const reasons = [];
4860
4886
  if (plan.headSha !== state.headSha) reasons.push(`the run was created at ${short(state.headSha)} but HEAD is ${short(plan.headSha)}`);