@inixiative/config 0.5.240 → 0.5.241
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/cli.js +68 -16
- package/package.json +3 -2
- package/versions.json +1 -1
package/README.md
CHANGED
|
@@ -91,13 +91,13 @@ bunx @inixiative/config bounded [--minutes=40] [--memory-gb=12] [--wait-minutes=
|
|
|
91
91
|
|
|
92
92
|
### check
|
|
93
93
|
|
|
94
|
-
`check` is read-only and exits non-zero on drift; run it in CI after a frozen-lockfile install. It verifies toolchain pins (declared once, at the root, pinned exactly: a workspace member declaring one is an error, and `bun.lock` must resolve each only to its pin, with no second copy), toolchain peer ranges (they must admit the pin and no older major; `sync` writes `>=<pin major>.<pin minor>.0`), `"latest"` ranges, `packageManager`/`.bun-version`, legacy `bun.lockb`, a committed (tracked, un-ignored) `bun.lock`, a gitignored `tmp/` (scratch space; `sync` adds `/tmp/*`, which keeps re-included files tracked), required scripts (`
|
|
94
|
+
`check` is read-only and exits non-zero on drift; run it in CI after a frozen-lockfile install. It verifies toolchain pins (declared once, at the root, pinned exactly: a workspace member declaring one is an error, and `bun.lock` must resolve each only to its pin, with no second copy), toolchain peer ranges (they must admit the pin and no older major; `sync` writes `>=<pin major>.<pin minor>.0`), `"latest"` ranges, `packageManager`/`.bun-version`, legacy `bun.lockb`, a committed (tracked, un-ignored) `bun.lock`, a gitignored `tmp/` (scratch space; `sync` adds `/tmp/*`, which keeps re-included files tracked), required scripts (`typecheck`/`lint`/`test`), the `check` script's shape (it runs `check:all` through `bounded`, see below), lefthook (dep + `lefthook.yml` extending the shared hooks + `prepare` script; git repos only), stub `extends`, presence of this package, and for every `@inixiative/*` dependency (in the root or any workspace member, of either lane) that the declared range admits the blessed version and the lockfile resolves to it (the stale-lockfile class). A package with a candidate (one no hold covers) also accepts the candidate and anything between: a range admitting either passes, and so does a lock from the blessed version up to the candidate. A range that does not admit the blessed version is rewritten to `^<blessed>`, except an exact pin, which stays exact and moves to the blessed version. An npm alias (`"@inixiative/session-archive": "npm:@inixiative/archive@^0.2.1"`) is held to its target's blessed version and rewritten as an alias; `workspace:`, `file:` and `link:` ranges are a repo linking itself and are left alone.
|
|
95
95
|
|
|
96
96
|
### bounded
|
|
97
97
|
|
|
98
|
-
`bounded -- <command>` runs a repo's full check as the machine's one check at a time, inside a time limit and a memory ceiling.
|
|
98
|
+
`bounded -- <command>` runs a repo's full check as the machine's one check at a time, inside a time limit and a memory ceiling. Every repo's `check` script is `inixiative-config bounded -- bun run check:all`, with the repo's own chain in `check:all`; `check` flags a repo whose script is anything else and `sync` rewrites it, moving the old chain to `check:all`; when both scripts already hold a chain, or `check` names `bounded` in another way, `sync` leaves them and the finding says to settle them by hand (limits of its own, `--minutes=`, `--memory-gb=`, `--wait-minutes=`, may sit before the `--`). So the full check is always plain `bun run check`. Never wrap it in `lockf … ~/.foundry/check.lock`, the command sessions used before 2026-11-21: `lockf` would hold the lock `bounded` then waits for, so a `bounded` started under one refuses at once (exit 2) and says to run the check plain. `bun run check:all` is the chain with no lock and no limits: for CI images and for looking at one failure, never for the full check on a shared machine. The `--` is required; everything after it reaches the command untouched.
|
|
99
99
|
|
|
100
|
-
- **One at a time.** It takes the machine's check lock, `~/.foundry/check.lock
|
|
100
|
+
- **One at a time.** It takes the machine's check lock, `~/.foundry/check.lock`, a flock(2) file taken through `lockf` (`flock` on Linux). The system frees the lock when its holder dies, so a file left behind is never a lock. After five seconds of waiting it says so, and it gives up with exit 75 after `--wait-minutes`. A train's own lock is another file: a train and a check can run together.
|
|
101
101
|
- **Time limit.** After `--minutes` (default 40, counted from when it holds the lock) the command's whole process group is stopped: SIGTERM, then SIGKILL ten seconds later. Exit 124.
|
|
102
102
|
- **Memory ceiling.** It adds up the memory of the group, compressed pages included (`top`'s MEM on macOS; RSS from `ps` elsewhere, or when `top` gives nothing in 30 s), and stops the group past `--memory-gb` (default 12). Exit 137. The last line names the bound, the peak and the process holding the most.
|
|
103
103
|
- **Both limits are read every ten seconds**, so a command can overrun either by up to that long.
|
|
@@ -108,7 +108,7 @@ bunx @inixiative/config bounded [--minutes=40] [--memory-gb=12] [--wait-minutes=
|
|
|
108
108
|
|
|
109
109
|
Why (Aron, 2026-11-19: "We should definitely make something that stops that from happening"): on 2026-11-18/19 a Foundry test looped to 23 GB twice; its ten-minute tool timeout only moved it to the background, and it thrashed a 64 GB machine until its owner was told. The same night three to five full checks ran at once from different sessions: the machine's load was a median 31 with one check running, 118 with two or three and 264 with four or more (`~/.foundry/evals/probes/2026-11-19-foundry-load/`). RSS would not have caught the loop: the system had compressed it to 4 to 9 GB of RSS while its footprint was 23 GB.
|
|
110
110
|
|
|
111
|
-
The train runs every repo's check through `bounded` (the re-lock check, the check after `train:adopt` with `--adopt-check-timeout` as its time limit, and this package's own before it publishes), so a train's checks queue behind a session's and behind each other, a hung check's whole process group is stopped, and time spent waiting for the lock is not counted as check time. Outside `--adopt-check-timeout` the train's own limits are a loose backstop (two hours, 24 GB); a repo
|
|
111
|
+
The train runs every repo's check through `bounded` (the re-lock check, the check after `train:adopt` with `--adopt-check-timeout` as its time limit, and this package's own before it publishes), so a train's checks queue behind a session's and behind each other, a hung check's whole process group is stopped, and time spent waiting for the lock is not counted as check time. Outside `--adopt-check-timeout` the train's own limits are a loose backstop (two hours, 24 GB); it runs a repo's `check:all`, the chain itself, so those limits are the ones that apply (a repo still without `check:all` runs its `check`).
|
|
112
112
|
|
|
113
113
|
### Retired terms
|
|
114
114
|
|
package/dist/cli.js
CHANGED
|
@@ -112,9 +112,12 @@ var consumersFor = (manifest2, lanes2) => {
|
|
|
112
112
|
var REQUIRED_SCRIPTS = {
|
|
113
113
|
typecheck: "tsc --noEmit",
|
|
114
114
|
lint: "biome check .",
|
|
115
|
-
test: "bun test"
|
|
116
|
-
check: "bun run typecheck && bun run lint && bun run test"
|
|
115
|
+
test: "bun test"
|
|
117
116
|
};
|
|
117
|
+
var DEFAULT_CHECK_CHAIN = "bun run typecheck && bun run lint && bun run test";
|
|
118
|
+
var BOUNDED_CHECK = "inixiative-config bounded -- bun run check:all";
|
|
119
|
+
var OWN_BOUNDED_CHECK = "bun src/cli.ts bounded -- bun run check:all";
|
|
120
|
+
var boundedCheckWithLimits = /^(inixiative-config|bun src\/cli\.ts) bounded( --[a-z-]+=[\d.]+)* -- bun run check:all$/;
|
|
118
121
|
var DEP_FIELDS = ["dependencies", "devDependencies", "peerDependencies"];
|
|
119
122
|
var LEFTHOOK_PREPARE = 'if git rev-parse --git-dir >/dev/null 2>&1; then root="$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")"; if [ -x "$root/node_modules/.bin/lefthook" ]; then (cd "$root" && ./node_modules/.bin/lefthook install); fi; fi';
|
|
120
123
|
var lefthookInstallInPrepare = /if [^;]*; then lefthook install; fi|lefthook install/;
|
|
@@ -508,6 +511,34 @@ function inspect(dir2, manifest2, presetOverride) {
|
|
|
508
511
|
});
|
|
509
512
|
}
|
|
510
513
|
}
|
|
514
|
+
const check = pkg.scripts?.check;
|
|
515
|
+
const chain = pkg.scripts?.["check:all"];
|
|
516
|
+
const boundedCheck = pkg.name === "@inixiative/config" ? OWN_BOUNDED_CHECK : BOUNDED_CHECK;
|
|
517
|
+
if (check && boundedCheckWithLimits.test(check)) {
|
|
518
|
+
if (!chain) {
|
|
519
|
+
findings.push({
|
|
520
|
+
level: "error",
|
|
521
|
+
message: `scripts.check:all missing \u2192 "${DEFAULT_CHECK_CHAIN}"`,
|
|
522
|
+
fix: () => {
|
|
523
|
+
pkg.scripts ??= {};
|
|
524
|
+
pkg.scripts["check:all"] = DEFAULT_CHECK_CHAIN;
|
|
525
|
+
touch();
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
} else {
|
|
530
|
+
const movable = !check?.includes("bounded") && (!check || !chain);
|
|
531
|
+
findings.push({
|
|
532
|
+
level: "error",
|
|
533
|
+
message: `scripts.check does not run through bounded (one full check at a time on the machine, inside a time limit and a memory ceiling) \u2192 "${boundedCheck}", with its chain in scripts.check:all${movable ? "" : " (not rewritten: scripts.check and scripts.check:all both hold a chain, or scripts.check names bounded another way; settle them by hand)"}`,
|
|
534
|
+
fix: movable ? () => {
|
|
535
|
+
pkg.scripts ??= {};
|
|
536
|
+
pkg.scripts["check:all"] = check ?? chain ?? DEFAULT_CHECK_CHAIN;
|
|
537
|
+
pkg.scripts.check = boundedCheck;
|
|
538
|
+
touch();
|
|
539
|
+
} : void 0
|
|
540
|
+
});
|
|
541
|
+
}
|
|
511
542
|
for (const [script, fallback] of Object.entries(REQUIRED_SCRIPTS)) {
|
|
512
543
|
if (pkg.scripts?.[script]) continue;
|
|
513
544
|
findings.push({
|
|
@@ -1107,6 +1138,18 @@ var TIME_LIMIT_EXIT_CODE = 124;
|
|
|
1107
1138
|
var checkLockPath = () => join2(homedir2(), ".foundry", "check.lock");
|
|
1108
1139
|
var LOCK_WAIT_EXIT_CODE = 75;
|
|
1109
1140
|
var underLock = (path, seconds, command2) => process.platform === "linux" ? ["flock", "-o", "-E", String(LOCK_WAIT_EXIT_CODE), "-w", String(seconds), path, ...command2] : ["lockf", "-k", "-s", "-t", String(seconds), path, ...command2];
|
|
1141
|
+
var lockWrapperAbove = (path, from = process.ppid) => {
|
|
1142
|
+
let pid = from;
|
|
1143
|
+
for (let depth = 0; depth < 40 && pid > 1; depth++) {
|
|
1144
|
+
const ps = spawnSync2("ps", ["-o", "ppid=,command=", "-p", String(pid)], { encoding: "utf8" });
|
|
1145
|
+
const match = /^\s*(\d+)\s+(.*)$/.exec((ps.stdout ?? "").trim());
|
|
1146
|
+
if (!match) return null;
|
|
1147
|
+
const command2 = match[2] ?? "";
|
|
1148
|
+
if (/(^|\/)(lockf|flock)\s/.test(command2) && command2.includes(path)) return command2;
|
|
1149
|
+
pid = Number(match[1]);
|
|
1150
|
+
}
|
|
1151
|
+
return null;
|
|
1152
|
+
};
|
|
1110
1153
|
var exitCodeOf = (code, signal) => code ?? (signal ? 128 + (constants.signals[signal] ?? 0) : 1);
|
|
1111
1154
|
var UNITS = { B: 1, K: 2 ** 10, M: 2 ** 20, G: 2 ** 30, T: 2 ** 40 };
|
|
1112
1155
|
var groupProcessesInTop = (output, pgid) => output.split("\n").flatMap((line) => {
|
|
@@ -1558,6 +1601,12 @@ if (command === "bounded") {
|
|
|
1558
1601
|
memoryBytes: memoryGb === void 0 ? DEFAULT_BOUNDS.memoryBytes : memoryGb * 2 ** 30,
|
|
1559
1602
|
waitSeconds: waitMinutes === void 0 ? DEFAULT_BOUNDS.waitSeconds : waitMinutes * 60
|
|
1560
1603
|
};
|
|
1604
|
+
if (!process.env[INSIDE_BOUNDED] && lockWrapperAbove(checkLockPath())) {
|
|
1605
|
+
console.error(
|
|
1606
|
+
`\u2717 bounded: this check was started under a lockf or flock on ${checkLockPath()}, which holds the lock the check waits for. Run it plain: \`bun run check\` queues by itself.`
|
|
1607
|
+
);
|
|
1608
|
+
process.exit(2);
|
|
1609
|
+
}
|
|
1561
1610
|
const outcome = await runBounded(positionals, { bounds, lock: !process.env[INSIDE_BOUNDED] });
|
|
1562
1611
|
const verdict = boundedVerdict(outcome, bounds);
|
|
1563
1612
|
if (verdict) console.error(verdict);
|
|
@@ -1842,20 +1891,23 @@ if (command === "train") {
|
|
|
1842
1891
|
staleLock: inspection.findings.some((finding) => finding.kind === "stale-lock")
|
|
1843
1892
|
};
|
|
1844
1893
|
};
|
|
1845
|
-
const runRepoCheck = (cwd, seconds = 2 * 60 * 60) =>
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
process.
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1894
|
+
const runRepoCheck = (cwd, seconds = 2 * 60 * 60) => {
|
|
1895
|
+
const { scripts } = JSON.parse(readFileSync3(join4(cwd, "package.json"), "utf8"));
|
|
1896
|
+
return spawnSync4(
|
|
1897
|
+
process.execPath,
|
|
1898
|
+
[
|
|
1899
|
+
process.argv[1] ?? "",
|
|
1900
|
+
"bounded",
|
|
1901
|
+
`--minutes=${seconds / 60}`,
|
|
1902
|
+
"--memory-gb=24",
|
|
1903
|
+
"--",
|
|
1904
|
+
"bun",
|
|
1905
|
+
"run",
|
|
1906
|
+
scripts?.["check:all"] ? "check:all" : "check"
|
|
1907
|
+
],
|
|
1908
|
+
{ cwd, stdio: "inherit" }
|
|
1909
|
+
).status;
|
|
1910
|
+
};
|
|
1859
1911
|
const relockAndCheck = (checkout, check = true) => effect(`re-lock ${checkout.name}${check ? " and run its check" : ""}`, void 0, () => {
|
|
1860
1912
|
const install = (...flags) => spawnSync4("bun", ["install", ...flags], { cwd: checkout.dir, stdio: "inherit" }).status === 0;
|
|
1861
1913
|
if (!install() && !install("--no-cache")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inixiative/config",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.241",
|
|
4
4
|
"description": "Shared toolchain and theme for the inixiative packages: tsconfig/biome/tsup presets, theme CSS, a version manifest (BOM), and a sync/check/train CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"typecheck": "tsc --noEmit",
|
|
52
52
|
"lint": "biome check .",
|
|
53
53
|
"format": "biome format --write .",
|
|
54
|
-
"check": "bun run typecheck && bun run lint && bun run test",
|
|
54
|
+
"check:all": "bun run typecheck && bun run lint && bun run test",
|
|
55
|
+
"check": "bun src/cli.ts bounded -- bun run check:all",
|
|
55
56
|
"prepublishOnly": "bun run check && bun run build"
|
|
56
57
|
},
|
|
57
58
|
"packageManager": "bun@1.4.4",
|