@antelopejs/tooling-configs 0.5.7 → 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.
- package/dist/bin/api-diff.mjs +9 -7
- package/dist/bin/body-check.mjs +3 -3
- package/dist/bin/capture.mjs +12 -4
- package/dist/bin/check-size.mjs +6 -4
- package/dist/bin/checks.mjs +2 -2
- package/dist/bin/comment-proof.mjs +3 -3
- package/dist/bin/garden.mjs +151 -15
- package/dist/bin/lease.mjs +142 -20
- package/dist/bin/ratchet.mjs +5 -5
- package/dist/bin/readme-strip.mjs +1 -1
- package/dist/bin/suppressions.mjs +9 -10
- package/dist/bin/sync.mjs +66 -22
- package/dist/bin/verify.mjs +61 -36
- package/dist/{checks-CD2oFGrt.mjs → checks-BC-F8bsv.mjs} +2 -66
- package/dist/{files-DJ0TeaTU.mjs → files-C-JJhExM.mjs} +1 -1
- package/dist/launch-D5cylwvb.mjs +76 -0
- package/dist/{map-DRyYz_Fw.mjs → map-BYkmnvNw.mjs} +42 -10
- package/dist/oxc/fmt.mjs +1 -1
- package/dist/oxc/guardrails/index.mjs +1 -1
- package/dist/oxc/lint.mjs +1 -1
- package/dist/{oxlint-BbpTFFmf.mjs → oxlint-CCOJqj3d.mjs} +6 -2
- package/dist/{proof-stamp-Kg-tkM6G.mjs → proof-stamp-lyD84zmj.mjs} +4 -4
- package/dist/{ratchet-1O8k4Dxu.mjs → ratchet-SQ7vTR0i.mjs} +4 -4
- package/dist/run-command-BlFRPORx.mjs +95 -0
- package/dist/{shared-igPpEDpS.mjs → shared-BCFFyp3l.mjs} +9 -2
- package/dist/{size-DBatLT-F.mjs → size-CCGLY4Ke.mjs} +1 -1
- package/dist/slash-BEgSnfYw.mjs +12 -0
- package/dist/{suppression-base-DZgUDXiI.mjs → suppression-base-whhvw-IJ.mjs} +3 -3
- package/dist/{suppression-budget-DgYdu6JK.mjs → suppression-budget-CtIYSoDO.mjs} +2 -2
- package/dist/{suppressions-CQTcKCi1.mjs → suppressions-C79kRvYI.mjs} +1 -1
- package/dist/{typescript-CqcOaci8.mjs → typescript--_8og8AM.mjs} +1 -1
- package/package.json +1 -1
package/dist/bin/verify.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as VERIFY_KINDS, c as isVerifyKind, l as skillFolder } from "../shared-
|
|
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-
|
|
7
|
-
import { S as
|
|
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 =
|
|
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
|
|
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 =
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
1346
|
+
pauseSync(POLL_MS$1);
|
|
1330
1347
|
last = docker([
|
|
1331
1348
|
"exec",
|
|
1332
1349
|
container,
|
|
@@ -2526,10 +2543,10 @@ async function extractPublished(context, tarball) {
|
|
|
2526
2543
|
mkdirSync(extracted, { recursive: true });
|
|
2527
2544
|
const untar = await context.command("extract published", "tar", [
|
|
2528
2545
|
"-xzf",
|
|
2529
|
-
tarball,
|
|
2546
|
+
relativeSlashed(extracted, tarball),
|
|
2530
2547
|
"-C",
|
|
2531
|
-
|
|
2532
|
-
]);
|
|
2548
|
+
"."
|
|
2549
|
+
], { cwd: extracted });
|
|
2533
2550
|
context.expect(untar.folder, [exitIs(untar, 0)], { critical: true });
|
|
2534
2551
|
const root = join(extracted, "package");
|
|
2535
2552
|
linkDependencies(root, context.repo);
|
|
@@ -2779,7 +2796,7 @@ function setupCommands(workspace) {
|
|
|
2779
2796
|
async function runSetup(workspace, state) {
|
|
2780
2797
|
const commands = setupCommands(workspace);
|
|
2781
2798
|
for (const [index, [program, ...args]] of commands.entries()) {
|
|
2782
|
-
const name = `${String(index + 1).padStart(2, "0")}-${program}`;
|
|
2799
|
+
const name = `${String(index + 1).padStart(2, "0")}-${basename(program, extname(program))}`;
|
|
2783
2800
|
const folder = join(state.evidence, "setup", name);
|
|
2784
2801
|
const elapsed = stopwatch();
|
|
2785
2802
|
const result = await runRecorded(folder, {
|
|
@@ -2822,9 +2839,9 @@ async function packInterface(workspace, state) {
|
|
|
2822
2839
|
program: "tar",
|
|
2823
2840
|
args: [
|
|
2824
2841
|
"-xzf",
|
|
2825
|
-
|
|
2842
|
+
tarball,
|
|
2826
2843
|
"-C",
|
|
2827
|
-
|
|
2844
|
+
"."
|
|
2828
2845
|
],
|
|
2829
2846
|
cwd: folder,
|
|
2830
2847
|
env
|
|
@@ -2971,7 +2988,7 @@ function doctor(workspace, state) {
|
|
|
2971
2988
|
const head = git(workspace.root, ["rev-parse", "HEAD"]);
|
|
2972
2989
|
let core = "";
|
|
2973
2990
|
try {
|
|
2974
|
-
core =
|
|
2991
|
+
core = relativeSlashed(workspace.root, installedPackage(workspace.root, "@antelopejs/core"));
|
|
2975
2992
|
} catch (error) {
|
|
2976
2993
|
core = error instanceof Error ? error.message : String(error);
|
|
2977
2994
|
}
|
|
@@ -3336,7 +3353,7 @@ function keep(context, kept, folder, built) {
|
|
|
3336
3353
|
copyTree(folder, join(staging, "folder"), built.links, join(kept, "folder"));
|
|
3337
3354
|
writeFileSync(join(staging, "links"), built.links.flatMap((link) => [link.path, link.target]).join("\0"));
|
|
3338
3355
|
writeFileSync(join(staging, "projects.json"), JSON.stringify(built.projects));
|
|
3339
|
-
writeFileSync(join(staging, "from.txt"), `${
|
|
3356
|
+
writeFileSync(join(staging, "from.txt"), `${relativeSlashed(context.state.evidence, context.folder)}\n`);
|
|
3340
3357
|
renameSync(staging, kept);
|
|
3341
3358
|
return true;
|
|
3342
3359
|
} catch (error) {
|
|
@@ -3397,7 +3414,7 @@ async function prepare(context, key, build) {
|
|
|
3397
3414
|
const folder = join(context.work, key);
|
|
3398
3415
|
if (existsSync(folder)) throw new Error(`${folder} already exists: a journey prepares ${key} once`);
|
|
3399
3416
|
const kept = join(context.state.dir, "prepared", key);
|
|
3400
|
-
if (existsSync(kept) && builder(kept) ===
|
|
3417
|
+
if (existsSync(kept) && builder(kept) === relativeSlashed(context.state.evidence, context.folder)) drop(kept);
|
|
3401
3418
|
const where = {
|
|
3402
3419
|
marker: context.step(`prepared ${key}`),
|
|
3403
3420
|
key,
|
|
@@ -3775,8 +3792,10 @@ const POLL_MS = 250;
|
|
|
3775
3792
|
const FAST_POLL_MS = 25;
|
|
3776
3793
|
/** How long readiness is probed every `FAST_POLL_MS` before falling back to `POLL_MS`. */
|
|
3777
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;
|
|
3778
3797
|
const SETTLE_MS = 3e3;
|
|
3779
|
-
async function probe(context, app, fixture, folder) {
|
|
3798
|
+
async function probe(context, app, fixture, folder, timeoutMs) {
|
|
3780
3799
|
const probe = context.workspace.config.template?.probe;
|
|
3781
3800
|
if (!fixture && probe?.log) {
|
|
3782
3801
|
const output = readOutput(app.folder);
|
|
@@ -3787,7 +3806,7 @@ async function probe(context, app, fixture, folder) {
|
|
|
3787
3806
|
};
|
|
3788
3807
|
}
|
|
3789
3808
|
const path = fixture ? "/health" : probe?.path ?? "/";
|
|
3790
|
-
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 });
|
|
3791
3810
|
const status = fixture ? 200 : probe?.status ?? 200;
|
|
3792
3811
|
const body = !fixture && probe?.body ? probe.body : /./s;
|
|
3793
3812
|
return {
|
|
@@ -3805,10 +3824,11 @@ async function waitReady(context, app, handle, fixture) {
|
|
|
3805
3824
|
exited = true;
|
|
3806
3825
|
});
|
|
3807
3826
|
const fastUntil = Date.now() + FAST_POLL_WINDOW_MS;
|
|
3808
|
-
|
|
3827
|
+
const patience = () => Date.now() < fastUntil ? FAST_PROBE_TIMEOUT_MS : void 0;
|
|
3828
|
+
let check = await probe(context, app, fixture, folder, patience());
|
|
3809
3829
|
while (!check.pass && !exited && Date.now() < deadline) {
|
|
3810
3830
|
await setTimeout$1(Date.now() < fastUntil ? FAST_POLL_MS : POLL_MS);
|
|
3811
|
-
check = await probe(context, app, fixture, folder);
|
|
3831
|
+
check = await probe(context, app, fixture, folder, patience());
|
|
3812
3832
|
}
|
|
3813
3833
|
const settle = context.workspace.config.template?.probe.log ? context.workspace.config.template.probe.settleMs ?? SETTLE_MS : 0;
|
|
3814
3834
|
if (check.pass && settle > 0) await setTimeout$1(settle);
|
|
@@ -4072,8 +4092,9 @@ const READINESS_RETRY_MS = [
|
|
|
4072
4092
|
function slug(text) {
|
|
4073
4093
|
return text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
4074
4094
|
}
|
|
4075
|
-
/** 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. */
|
|
4076
4096
|
function signal(pid, name) {
|
|
4097
|
+
if (process.platform === "win32") return killTree(pid);
|
|
4077
4098
|
try {
|
|
4078
4099
|
process.kill(pid, name);
|
|
4079
4100
|
return true;
|
|
@@ -4165,10 +4186,10 @@ var VerifyContext = class {
|
|
|
4165
4186
|
return httpRecorded(this.step(name), url, init);
|
|
4166
4187
|
}
|
|
4167
4188
|
expect(folder, checks, options = {}) {
|
|
4168
|
-
const name =
|
|
4189
|
+
const name = relativeSlashed(this.folder, folder) || "journey";
|
|
4169
4190
|
this.steps.push({
|
|
4170
4191
|
name,
|
|
4171
|
-
folder:
|
|
4192
|
+
folder: relativeSlashed(this.state.evidence, folder),
|
|
4172
4193
|
checks
|
|
4173
4194
|
});
|
|
4174
4195
|
appendFileSync(join(folder, "checks.json"), `${JSON.stringify(checks, null, 2)}\n`);
|
|
@@ -4318,10 +4339,14 @@ var VerifyContext = class {
|
|
|
4318
4339
|
killGroup(app.pid);
|
|
4319
4340
|
writeFileSync(join(folder, "note.txt"), `no exit within ${STOP_TIMEOUT_MS} ms of SIGINT; killed the process group\n`);
|
|
4320
4341
|
}
|
|
4321
|
-
const
|
|
4342
|
+
const ended = outcome ?? {
|
|
4322
4343
|
exitCode: null,
|
|
4323
4344
|
signal: "SIGKILL"
|
|
4324
4345
|
};
|
|
4346
|
+
const exit = process.platform === "win32" && outcome && running?.sent.includes("SIGINT") ? {
|
|
4347
|
+
exitCode: null,
|
|
4348
|
+
signal: "SIGINT"
|
|
4349
|
+
} : ended;
|
|
4325
4350
|
writeFileSync(join(folder, "exit-code.txt"), `${exit.exitCode ?? `signal ${exit.signal}`}\n`);
|
|
4326
4351
|
this.untrack(app.pid);
|
|
4327
4352
|
return {
|
|
@@ -4430,7 +4455,7 @@ function resetServices(context) {
|
|
|
4430
4455
|
if (!service.reset) continue;
|
|
4431
4456
|
const container = context.service(name).container;
|
|
4432
4457
|
const folder = context.step(`reset ${name}`);
|
|
4433
|
-
const run =
|
|
4458
|
+
const run = spawnLaunched("docker", [
|
|
4434
4459
|
"exec",
|
|
4435
4460
|
container,
|
|
4436
4461
|
...service.reset
|
|
@@ -4518,7 +4543,7 @@ async function driveJourney(context, feature, id, journey) {
|
|
|
4518
4543
|
status,
|
|
4519
4544
|
steps: context.steps,
|
|
4520
4545
|
...failure,
|
|
4521
|
-
folder:
|
|
4546
|
+
folder: relativeSlashed(state.evidence, context.folder),
|
|
4522
4547
|
stepMs: context.clock.finish(),
|
|
4523
4548
|
ms: elapsed()
|
|
4524
4549
|
};
|
|
@@ -4555,7 +4580,7 @@ function gitPaths(root, args) {
|
|
|
4555
4580
|
*/
|
|
4556
4581
|
function treeState(root, runDir) {
|
|
4557
4582
|
try {
|
|
4558
|
-
const own =
|
|
4583
|
+
const own = relativeSlashed(canonical(root), canonical(runDir));
|
|
4559
4584
|
const inside = own !== "" && !own.startsWith("..") && !isAbsolute(own) ? `${own}/` : null;
|
|
4560
4585
|
const hash = createHash("sha256");
|
|
4561
4586
|
hash.update(git(root, ["rev-parse", "HEAD"]));
|
|
@@ -4613,7 +4638,7 @@ function reuse(state, feature, id, source) {
|
|
|
4613
4638
|
const result = {
|
|
4614
4639
|
...source,
|
|
4615
4640
|
feature,
|
|
4616
|
-
folder:
|
|
4641
|
+
folder: relativeSlashed(state.evidence, folder),
|
|
4617
4642
|
reusedFrom: source.folder,
|
|
4618
4643
|
ms: 0,
|
|
4619
4644
|
stepMs: []
|
|
@@ -4855,7 +4880,7 @@ function renderVerdict(workspace, state, pr, judgement) {
|
|
|
4855
4880
|
"-1",
|
|
4856
4881
|
"--format=%H",
|
|
4857
4882
|
"--",
|
|
4858
|
-
|
|
4883
|
+
relativeSlashed(workspace.root, workspace.skill)
|
|
4859
4884
|
]) || plan.headSha;
|
|
4860
4885
|
const reasons = [];
|
|
4861
4886
|
if (plan.headSha !== state.headSha) reasons.push(`the run was created at ${short(state.headSha)} but HEAD is ${short(plan.headSha)}`);
|
|
@@ -1,81 +1,17 @@
|
|
|
1
1
|
import { t as CEILINGS_FILE } from "./ceilings-B7KayYIG.mjs";
|
|
2
2
|
import { o as packageManager, s as parseManifest } from "./package-DnxZ2CXZ.mjs";
|
|
3
|
-
import { a as gitFiles } from "./files-
|
|
3
|
+
import { a as gitFiles } from "./files-C-JJhExM.mjs";
|
|
4
4
|
import { n as workspaceDirectories } from "./docs-compat-Ft1r2sf0.mjs";
|
|
5
|
+
import { t as runCommand } from "./run-command-BlFRPORx.mjs";
|
|
5
6
|
import { t as accepting } from "./ports-DGP6bPJy.mjs";
|
|
6
7
|
import { createRequire } from "node:module";
|
|
7
8
|
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
8
9
|
import { basename, dirname, join, posix, relative, resolve, sep } from "node:path";
|
|
9
|
-
import { spawn } from "node:child_process";
|
|
10
10
|
import { isMap, isScalar, isSeq, parseAllDocuments, parseDocument } from "yaml";
|
|
11
11
|
import ts from "typescript";
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
13
13
|
import { tmpdir } from "node:os";
|
|
14
14
|
import { minimatch } from "minimatch";
|
|
15
|
-
//#region src/guardrails/run-command.ts
|
|
16
|
-
const KILL_GRACE_MS = 5e3;
|
|
17
|
-
function stopGroup(child, signal) {
|
|
18
|
-
if (child.pid === void 0 || child.exitCode !== null) return;
|
|
19
|
-
try {
|
|
20
|
-
if (process.platform === "win32") child.kill(signal);
|
|
21
|
-
else process.kill(-child.pid, signal);
|
|
22
|
-
} catch {
|
|
23
|
-
child.kill(signal);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Runs `command` in its own process group and collects stdout and stderr together. When `signal` aborts, the group
|
|
28
|
-
* gets SIGTERM, then SIGKILL after a grace period, so a step's own children stop with it. On Windows the command runs
|
|
29
|
-
* through a shell, so `npm` and `pnpm` resolve to their `.cmd` shims, unless `shell` is `false`: pass that for an
|
|
30
|
-
* executable path and arguments that a shell must not split, such as paths with spaces.
|
|
31
|
-
*/
|
|
32
|
-
function runCommand(command, args, options) {
|
|
33
|
-
const { cwd, env = process.env, signal, shell = process.platform === "win32" } = options;
|
|
34
|
-
return new Promise((resolve) => {
|
|
35
|
-
const child = spawn(command, args, {
|
|
36
|
-
cwd,
|
|
37
|
-
env,
|
|
38
|
-
shell,
|
|
39
|
-
detached: process.platform !== "win32",
|
|
40
|
-
stdio: [
|
|
41
|
-
"ignore",
|
|
42
|
-
"pipe",
|
|
43
|
-
"pipe"
|
|
44
|
-
]
|
|
45
|
-
});
|
|
46
|
-
const chunks = [];
|
|
47
|
-
const stdout = [];
|
|
48
|
-
child.stdout.on("data", (chunk) => {
|
|
49
|
-
chunks.push(chunk);
|
|
50
|
-
stdout.push(chunk);
|
|
51
|
-
});
|
|
52
|
-
child.stderr.on("data", (chunk) => chunks.push(chunk));
|
|
53
|
-
const interrupt = () => {
|
|
54
|
-
stopGroup(child, "SIGTERM");
|
|
55
|
-
setTimeout(() => stopGroup(child, "SIGKILL"), KILL_GRACE_MS).unref();
|
|
56
|
-
};
|
|
57
|
-
if (signal?.aborted) interrupt();
|
|
58
|
-
else signal?.addEventListener("abort", interrupt, { once: true });
|
|
59
|
-
child.once("error", (error) => {
|
|
60
|
-
signal?.removeEventListener("abort", interrupt);
|
|
61
|
-
resolve({
|
|
62
|
-
status: null,
|
|
63
|
-
stdout: "",
|
|
64
|
-
output: `${error.message}\n`
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
child.once("close", (code, killed) => {
|
|
68
|
-
signal?.removeEventListener("abort", interrupt);
|
|
69
|
-
const text = Buffer.concat(chunks).toString("utf8");
|
|
70
|
-
resolve({
|
|
71
|
-
status: code,
|
|
72
|
-
stdout: Buffer.concat(stdout).toString("utf8"),
|
|
73
|
-
output: `${text}${killed ? `Terminated by ${killed}\n` : ""}`
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
//#endregion
|
|
79
15
|
//#region src/guardrails/git-identity.ts
|
|
80
16
|
/** Config scopes stored inside the repository, which every checkout and agent sharing it commits under. */
|
|
81
17
|
const SHARED_SCOPES = /* @__PURE__ */ new Set(["local", "worktree"]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./ceilings-B7KayYIG.mjs";
|
|
2
|
-
import { n as IGNORE_PATTERNS, r as SYNCED_AGENT_PATTERNS, t as AGENT_IGNORE_PATTERNS } from "./shared-
|
|
2
|
+
import { n as IGNORE_PATTERNS, r as SYNCED_AGENT_PATTERNS, t as AGENT_IGNORE_PATTERNS } from "./shared-BCFFyp3l.mjs";
|
|
3
3
|
import { closeSync, existsSync, lstatSync, openSync, readSync } from "node:fs";
|
|
4
4
|
import { dirname, join, matchesGlob, relative, resolve } from "node:path";
|
|
5
5
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { r as windowsArgument } from "./run-command-BlFRPORx.mjs";
|
|
2
|
+
import { existsSync, statSync } from "node:fs";
|
|
3
|
+
import { delimiter, extname, isAbsolute, join } from "node:path";
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
//#region src/verify/launch.ts
|
|
6
|
+
const DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
7
|
+
const SHIM_EXTENSIONS = /* @__PURE__ */ new Set([".cmd", ".bat"]);
|
|
8
|
+
/** The value of `name` in `env`, whatever the case its key has, as Windows reads its environment. */
|
|
9
|
+
function envValue(env, name) {
|
|
10
|
+
const key = Object.keys(env).find((candidate) => candidate.toLowerCase() === name.toLowerCase());
|
|
11
|
+
return key === void 0 ? void 0 : env[key];
|
|
12
|
+
}
|
|
13
|
+
function isFile(path) {
|
|
14
|
+
return existsSync(path) && statSync(path).isFile();
|
|
15
|
+
}
|
|
16
|
+
/** The file Windows would start for `program`: the first PATH folder holding it under one of the PATHEXT extensions, or `program` itself when it names a path. */
|
|
17
|
+
function findProgram(program, env) {
|
|
18
|
+
const extensions = (envValue(env, "PATHEXT") ?? DEFAULT_PATHEXT).split(";").filter((extension) => extension !== "");
|
|
19
|
+
const names = extname(program) === "" ? extensions.map((extension) => `${program}${extension}`) : [program];
|
|
20
|
+
const folders = isAbsolute(program) || /[\\/]/.test(program) ? [""] : (envValue(env, "PATH") ?? "").split(delimiter);
|
|
21
|
+
for (const folder of folders) for (const name of names) {
|
|
22
|
+
const candidate = folder === "" ? name : join(folder, name);
|
|
23
|
+
if (isFile(candidate)) return candidate;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* How to start `program` with `args` for `env`. Off Windows it is the call as
|
|
29
|
+
* given. On Windows `pnpm`, `ajs` and every other npm shim is a `.cmd` file
|
|
30
|
+
* that `spawn` can neither find by its bare name nor start without a shell, so
|
|
31
|
+
* a program that resolves to one runs through `cmd.exe`, and any other
|
|
32
|
+
* program is spawned directly with the arguments untouched.
|
|
33
|
+
*/
|
|
34
|
+
function launch(program, args, env) {
|
|
35
|
+
if (process.platform !== "win32") return {
|
|
36
|
+
program,
|
|
37
|
+
args,
|
|
38
|
+
verbatim: false
|
|
39
|
+
};
|
|
40
|
+
const found = findProgram(program, env);
|
|
41
|
+
if (found === null || !SHIM_EXTENSIONS.has(extname(found).toLowerCase())) return {
|
|
42
|
+
program: found ?? program,
|
|
43
|
+
args,
|
|
44
|
+
verbatim: false
|
|
45
|
+
};
|
|
46
|
+
const line = [found, ...args].map(windowsArgument).join(" ");
|
|
47
|
+
return {
|
|
48
|
+
program: envValue(env, "ComSpec") ?? "cmd.exe",
|
|
49
|
+
args: [
|
|
50
|
+
"/d",
|
|
51
|
+
"/s",
|
|
52
|
+
"/c",
|
|
53
|
+
`"${line}"`
|
|
54
|
+
],
|
|
55
|
+
verbatim: true
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** `spawnSync` of `program` the way `launch` starts it, so a `.cmd` shim runs on Windows. */
|
|
59
|
+
function spawnLaunched(program, args, options) {
|
|
60
|
+
const started = launch(program, args, options.env ?? process.env);
|
|
61
|
+
return spawnSync(started.program, started.args, {
|
|
62
|
+
...options,
|
|
63
|
+
windowsVerbatimArguments: started.verbatim
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/** Kills the process `pid` and everything it started, since Windows has no process groups to signal; whether it found the process. */
|
|
67
|
+
function killTree(pid) {
|
|
68
|
+
return spawnSync("taskkill", [
|
|
69
|
+
"/pid",
|
|
70
|
+
String(pid),
|
|
71
|
+
"/t",
|
|
72
|
+
"/f"
|
|
73
|
+
], { stdio: "ignore" }).status === 0;
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { launch as n, spawnLaunched as r, killTree as t };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { l as skillFolder } from "./shared-
|
|
1
|
+
import { l as skillFolder } from "./shared-BCFFyp3l.mjs";
|
|
2
2
|
import { c as object, f as parseJson, i as isObject, o as list, p as str, s as num } from "./json-CG2L7YFl.mjs";
|
|
3
3
|
import { c as leaseTmpDir, i as PARENT_TMPDIR, n as LEASE_DIR, r as LEASE_MARKER, t as DEV_STACK_VARIABLES } from "./env-DT0UJNeL.mjs";
|
|
4
|
+
import { t as relativeSlashed } from "./slash-BEgSnfYw.mjs";
|
|
4
5
|
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, utimesSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { basename, delimiter, dirname, join,
|
|
6
|
+
import { basename, delimiter, dirname, join, resolve } from "node:path";
|
|
6
7
|
import { execFileSync } from "node:child_process";
|
|
7
8
|
import { pathToFileURL } from "node:url";
|
|
8
9
|
import { randomBytes } from "node:crypto";
|
|
@@ -20,6 +21,37 @@ function matchesPath(file, glob) {
|
|
|
20
21
|
return minimatch(file, glob, { dot: true });
|
|
21
22
|
}
|
|
22
23
|
//#endregion
|
|
24
|
+
//#region src/verify/busy.ts
|
|
25
|
+
const BUSY_CODES = /* @__PURE__ */ new Set([
|
|
26
|
+
"EPERM",
|
|
27
|
+
"EBUSY",
|
|
28
|
+
"EACCES"
|
|
29
|
+
]);
|
|
30
|
+
const BUSY_WINDOW_MS = 5e3;
|
|
31
|
+
const BUSY_STEP_MS = 5;
|
|
32
|
+
/** Blocks this thread for `ms` milliseconds. */
|
|
33
|
+
function pauseSync(ms) {
|
|
34
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Runs a file operation that replaces or reads a file another process may
|
|
38
|
+
* replace at the same moment. Windows refuses such an operation with EPERM,
|
|
39
|
+
* EBUSY or EACCES while the other side holds the file, where POSIX never
|
|
40
|
+
* does, so on Windows the operation is retried for a few seconds before its
|
|
41
|
+
* error is thrown. Elsewhere it runs once.
|
|
42
|
+
*/
|
|
43
|
+
function retryBusy(operation) {
|
|
44
|
+
if (process.platform !== "win32") return operation();
|
|
45
|
+
const deadline = Date.now() + BUSY_WINDOW_MS;
|
|
46
|
+
for (;;) try {
|
|
47
|
+
return operation();
|
|
48
|
+
} catch (error) {
|
|
49
|
+
const code = error instanceof Error && "code" in error ? String(error.code) : "";
|
|
50
|
+
if (!BUSY_CODES.has(code) || Date.now() >= deadline) throw error;
|
|
51
|
+
pauseSync(BUSY_STEP_MS);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
23
55
|
//#region src/verify/workspace.ts
|
|
24
56
|
/**
|
|
25
57
|
* Caches shared by every run: the warm pnpm store, the npm cache and the
|
|
@@ -101,7 +133,7 @@ function loadRun(dir) {
|
|
|
101
133
|
if (!existsSync(file)) throw new Error(`No run at ${dir}: run.json is missing. Create one with \`new\`.`);
|
|
102
134
|
const now = /* @__PURE__ */ new Date();
|
|
103
135
|
utimesSync(file, now, now);
|
|
104
|
-
const stored = JSON.parse(readFileSync(file, "utf8"));
|
|
136
|
+
const stored = JSON.parse(retryBusy(() => readFileSync(file, "utf8")));
|
|
105
137
|
return {
|
|
106
138
|
...stored,
|
|
107
139
|
processes: [...stored.processes, ...commandRecords(stored.dir)],
|
|
@@ -121,7 +153,7 @@ function ownRun(workspace, dir) {
|
|
|
121
153
|
if (dirname(folder) !== canonical(runs)) throw new Error(`${dir} is not one run of ${workspace.name}: pass the folder \`new\` printed, one level under ${runs}.`);
|
|
122
154
|
const file = stateFile(resolve(dir));
|
|
123
155
|
if (!existsSync(file)) throw new Error(`No run at ${dir}: run.json is missing. Create one with \`new\`.`);
|
|
124
|
-
const stored = object(parseJson(readFileSync(file, "utf8")), file);
|
|
156
|
+
const stored = object(parseJson(retryBusy(() => readFileSync(file, "utf8"))), file);
|
|
125
157
|
const recordedDir = str(stored, "dir");
|
|
126
158
|
if (canonical(recordedDir) !== folder) throw new Error(`${file} records the folder ${recordedDir}, not ${dir}: it was copied from another run.`);
|
|
127
159
|
const repo = str(stored, "repo");
|
|
@@ -133,7 +165,7 @@ function writeWhole(file, text) {
|
|
|
133
165
|
const staging = `${file}.${randomBytes(6).toString("hex")}.tmp`;
|
|
134
166
|
try {
|
|
135
167
|
writeFileSync(staging, text);
|
|
136
|
-
renameSync(staging, file);
|
|
168
|
+
retryBusy(() => renameSync(staging, file));
|
|
137
169
|
} finally {
|
|
138
170
|
rmSync(staging, { force: true });
|
|
139
171
|
}
|
|
@@ -167,7 +199,7 @@ function commandRecords(dir, command) {
|
|
|
167
199
|
const match = RECORDS_FILE.exec(name);
|
|
168
200
|
if (match === null || command !== void 0 && Number(match[1]) !== command) return [];
|
|
169
201
|
try {
|
|
170
|
-
return list(parseJson(readFileSync(join(dir, name), "utf8")), name).map((entry) => {
|
|
202
|
+
return list(parseJson(retryBusy(() => readFileSync(join(dir, name), "utf8"))), name).map((entry) => {
|
|
171
203
|
const record = object(entry, name);
|
|
172
204
|
return {
|
|
173
205
|
name: str(record, "name"),
|
|
@@ -232,11 +264,11 @@ const INHERITED_PREFIXES = [
|
|
|
232
264
|
"PNPM_",
|
|
233
265
|
"XDG_"
|
|
234
266
|
];
|
|
235
|
-
/** The real path of `path`, resolved through its nearest existing ancestor when the path itself is gone. */
|
|
267
|
+
/** The real path of `path`, resolved through its nearest existing ancestor when the path itself is gone; on Windows also the long spelling of an 8.3 short name such as `RUNNER~1`. */
|
|
236
268
|
function canonical(path) {
|
|
237
269
|
const full = resolve(path);
|
|
238
270
|
try {
|
|
239
|
-
return realpathSync(full);
|
|
271
|
+
return realpathSync.native(full);
|
|
240
272
|
} catch {
|
|
241
273
|
const parent = dirname(full);
|
|
242
274
|
return parent === full ? full : join(canonical(parent), basename(full));
|
|
@@ -388,7 +420,7 @@ function readFeatures(workspace) {
|
|
|
388
420
|
const lists = frontmatterLists(body);
|
|
389
421
|
return {
|
|
390
422
|
name: file.replace(/\.md$/, ""),
|
|
391
|
-
file:
|
|
423
|
+
file: relativeSlashed(workspace.root, join(folder, file)),
|
|
392
424
|
covers: lists.get("covers") ?? [],
|
|
393
425
|
docs: lists.get("docs") ?? [],
|
|
394
426
|
journeys: lists.get("journeys") ?? [],
|
|
@@ -513,4 +545,4 @@ function planFor(workspace, baseRef, all = false) {
|
|
|
513
545
|
};
|
|
514
546
|
}
|
|
515
547
|
//#endregion
|
|
516
|
-
export {
|
|
548
|
+
export { pauseSync as C, writeWhole as S, ownRun as _, readFeatures as a, saveRun as b, allocateRun as c, git as d, isolatedEnv as f, operatorTmpdir as g, operatorEnv as h, planFor as i, canonical as l, openWorkspace as m, SMOKE_FEATURE as n, CACHE_DIR as o, loadRun as p, checkMap as r, RUNS_DIR as s, DEFAULT_SHARED as t, commandRecords as u, recordProcesses as v, matchesPath as w, withLocalBins as x, removeTree as y };
|
package/dist/oxc/fmt.mjs
CHANGED
|
@@ -1319,7 +1319,7 @@ function exportsCover(exportsField, subpath) {
|
|
|
1319
1319
|
function isSelfLinked(directory, name) {
|
|
1320
1320
|
const installed = join(directory, "node_modules", ...name.split("/"));
|
|
1321
1321
|
try {
|
|
1322
|
-
return lstatSync(installed).isSymbolicLink() && realpathSync(installed) === realpathSync(directory);
|
|
1322
|
+
return lstatSync(installed).isSymbolicLink() && realpathSync.native(installed) === realpathSync.native(directory);
|
|
1323
1323
|
} catch {
|
|
1324
1324
|
return false;
|
|
1325
1325
|
}
|
package/dist/oxc/lint.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { t as readCarriedCeilings } from "../renames-L2owF5GD.mjs";
|
|
|
3
3
|
import { t as PRESET_CONFIGS } from "../templates-Dg188oRC.mjs";
|
|
4
4
|
import { t as TYPE_AWARE_RULES } from "../type-aware-rules-DMuN6sHb.mjs";
|
|
5
5
|
import { n as TEST_FILE_GLOBS, t as ASSERTION_FUNCTION_NAMES } from "../shared-WC0z3y9F.mjs";
|
|
6
|
-
import { n as IGNORE_PATTERNS, r as SYNCED_AGENT_PATTERNS } from "../shared-
|
|
6
|
+
import { n as IGNORE_PATTERNS, r as SYNCED_AGENT_PATTERNS } from "../shared-BCFFyp3l.mjs";
|
|
7
7
|
import { defineConfig } from "oxlint";
|
|
8
8
|
//#region src/oxc/lint.ts
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as MEASURE_ENV } from "./ceilings-B7KayYIG.mjs";
|
|
2
|
-
import { s as repositoryPath } from "./files-
|
|
2
|
+
import { s as repositoryPath } from "./files-C-JJhExM.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { basename, dirname, join } from "node:path";
|
|
@@ -25,8 +25,11 @@ const NO_FILES = "No files found to lint.";
|
|
|
25
25
|
function foundNoFiles(stdout) {
|
|
26
26
|
return stdout.startsWith(NO_FILES) && stdout.includes("{");
|
|
27
27
|
}
|
|
28
|
+
/** The `-f json` report in oxlint's stdout, or undefined when oxlint printed an error in its place. */
|
|
28
29
|
function parseReport(text) {
|
|
29
|
-
const
|
|
30
|
+
const json = foundNoFiles(text) ? text.slice(text.indexOf("{")) : text;
|
|
31
|
+
if (!json.startsWith("{")) return void 0;
|
|
32
|
+
const report = JSON.parse(json);
|
|
30
33
|
if (!Array.isArray(report?.diagnostics)) throw new Error("oxlint did not return a JSON diagnostics array.");
|
|
31
34
|
return report.diagnostics;
|
|
32
35
|
}
|
|
@@ -70,6 +73,7 @@ function runOxlint(root, config, files, flags) {
|
|
|
70
73
|
if (result.error) throw result.error;
|
|
71
74
|
if (result.status !== 0 && result.status !== 1) throw new Error(`oxlint failed (${result.status ?? result.signal}): ${result.stderr || result.stdout}`);
|
|
72
75
|
const diagnostics = parseReport(result.stdout);
|
|
76
|
+
if (diagnostics === void 0) throw new Error(`oxlint failed (exit ${result.status}): ${result.stdout}${result.stderr}`.trimEnd());
|
|
73
77
|
if (result.status !== 0 && diagnostics.length === 0 && !foundNoFiles(result.stdout)) throw new Error(`oxlint failed without diagnostics: ${result.stderr || result.stdout}`);
|
|
74
78
|
return diagnostics;
|
|
75
79
|
} finally {
|