@inixiative/config 0.5.236 → 0.5.238

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 CHANGED
@@ -95,20 +95,20 @@ bunx @inixiative/config bounded [--minutes=40] [--memory-gb=12] [--wait-minutes=
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. A repo's `check` script becomes `inixiative-config bounded -- bun run check:all`, with the old chain moved to `check:all`. The `--` is required; everything after it reaches the command untouched.
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. A repo's `check` script becomes `inixiative-config bounded -- bun run check:all`, with the old chain moved to `check:all`. A repo that has done so is checked with plain `bun run check`, never under `lockf … ~/.foundry/check.lock`: `lockf` would hold the lock `bounded` then waits for. The `--` is required; everything after it reaches the command untouched.
99
99
 
100
- - **One at a time.** It waits for `~/.inixiative/check.lock`, saying whose check it waits for (directory, pid, host, since when), and gives up with exit 75 after `--wait-minutes`. This is its own lock file on the same code as the train's (`acquireMachineLock`): a train and a check can run together. A lock left by a dead process on this host is taken over. Waiters ask again every five seconds and there is no queue, so with several waiting the order is not first come, first served.
100
+ - **One at a time.** It takes the machine's check lock, `~/.foundry/check.lock`: the flock(2) file sessions already queue on with `lockf -k -t 14400 ~/.foundry/check.lock bun run check`, taken through `lockf` (`flock` on Linux), so a `bounded` check and a plain `lockf` one wait for each other. 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.
104
- - **Nothing outlives it.** When the command ends, whatever it left running in its group is stopped. When `bounded` gets SIGINT, SIGTERM or SIGHUP it stops the group before it frees the lock. When `bounded` itself is killed, a watcher inside the group kills the group at once.
104
+ - **Nothing outlives it.** When the command ends, whatever it left running in its group is stopped. When `bounded` gets SIGINT, SIGTERM or SIGHUP it stops the group, which frees the lock. When `bounded` itself is killed, a watcher inside the group kills the group at once, whether the command is running or still waiting for the lock.
105
105
  - **What escapes.** A process that leaves the group (`setsid`, a detached spawn, a container started through Docker) is neither stopped nor counted.
106
- - **Nested.** A `bounded` started under another (`INIXIATIVE_BOUNDED` set) runs its command as it is; the outer one holds the lock and the limits. **In CI** (`CI` set) likewise: one check per runner, under the runner's limits.
106
+ - **Nested.** A `bounded` started under another (`INIXIATIVE_BOUNDED` set) takes no lock, since the outer one holds it, and keeps its own time limit and memory ceiling. **In CI** (`CI` set) the command runs as it is: one check per runner, under the runner's limits.
107
107
  - **Exit codes** otherwise are the command's own: 127 when it does not exist, 128 plus the signal when a signal ended it.
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
- Not yet: the train's own check after `train:adopt` still runs `bun run check` under its `--adopt-check-timeout`, which stops only the top process and would count lock wait as check time. Move it onto `bounded` before any repo adopts `bounded` in its `check`.
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 whose `check` is `bounded` keeps its tighter ones.
112
112
 
113
113
  ### Retired terms
114
114
 
@@ -121,8 +121,7 @@ Not yet: the train's own check after `train:adopt` still runs `bun run check` un
121
121
  | `signetDemo`, `medicalQuestionStep` | every doc | nothing; demos live in template-workbench |
122
122
  | `kingdom-workspace`, `foundry-lab`, `native-candidate` | every doc | the canonical repos |
123
123
  | foundry-oracle | every doc | Foundry and Oracle, two products |
124
- | "your own LLM/API keys" | every doc | your own subscriptions |
125
- | Cartographer, Librarian, Artificer, Steward (capitalised) | READMEs, package descriptions, site pages only | say what it does; Foundry's code still has a Librarian and a Cartographer |
124
+ | Cartographer, Librarian, Artificer, Steward (capitalised) | READMEs, package descriptions, site pages only | say what it does: Wardens remind your agent of what already exists; your agent decides |
126
125
 
127
126
  Left out on purpose, because a pattern would flag mostly legitimate text: "medical" (the doctor's-visit story is allowed in marketing), "Connection" and `connectionId` (WebSocket and database connections; Foundry's viewer has a live per-socket `connectionId`), "principal" (the permissions README's glossary word for any holder, job titles, the principal–agent problem), and "Cursor as a runtime" or "token savings" (a phrase can't tell a claim from a comparison).
128
127
 
package/dist/cli.js CHANGED
@@ -4,15 +4,15 @@
4
4
  import { spawnSync as spawnSync4 } from "child_process";
5
5
  import {
6
6
  existsSync as existsSync3,
7
- mkdirSync as mkdirSync3,
7
+ mkdirSync as mkdirSync4,
8
8
  mkdtempSync,
9
9
  readdirSync as readdirSync3,
10
10
  readFileSync as readFileSync3,
11
11
  rmSync as rmSync3,
12
12
  writeFileSync as writeFileSync3
13
13
  } from "fs";
14
- import { hostname as hostname3, tmpdir } from "os";
15
- import { basename, dirname as dirname3, join as join4, resolve as resolve2 } from "path";
14
+ import { hostname as hostname2, tmpdir } from "os";
15
+ import { basename, dirname as dirname4, join as join4, resolve as resolve2 } from "path";
16
16
 
17
17
  // src/args.ts
18
18
  import { parseArgs } from "util";
@@ -116,7 +116,8 @@ var REQUIRED_SCRIPTS = {
116
116
  check: "bun run typecheck && bun run lint && bun run test"
117
117
  };
118
118
  var DEP_FIELDS = ["dependencies", "devDependencies", "peerDependencies"];
119
- var LEFTHOOK_PREPARE = "if git rev-parse --git-dir >/dev/null 2>&1; then lefthook install; fi";
119
+ 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
+ var lefthookInstallInPrepare = /if [^;]*; then lefthook install; fi|lefthook install/;
120
121
  var loadManifest = () => JSON.parse(readFileSync(join(packageRoot, "versions.json"), "utf8"));
121
122
  var ownVersion = () => JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8")).version;
122
123
  var stripJsonc = (text) => {
@@ -662,10 +663,10 @@ function inspect(dir2, manifest2, presetOverride) {
662
663
  } else if (prepare.includes("lefthook install") && !prepare.includes(LEFTHOOK_PREPARE)) {
663
664
  findings.push({
664
665
  level: "error",
665
- message: `scripts.prepare runs lefthook install unguarded (fails builds without .git) \u2192 "${LEFTHOOK_PREPARE}"`,
666
+ message: `scripts.prepare runs lefthook install outside the main-checkout guard (fails builds without .git; a worktree install points the shared hooks at itself) \u2192 "${LEFTHOOK_PREPARE}"`,
666
667
  fix: () => {
667
668
  pkg.scripts ??= {};
668
- pkg.scripts.prepare = prepare.replace("lefthook install", LEFTHOOK_PREPARE);
669
+ pkg.scripts.prepare = prepare.replace(lefthookInstallInPrepare, LEFTHOOK_PREPARE);
669
670
  touch();
670
671
  }
671
672
  });
@@ -960,8 +961,7 @@ var removeStale = (path, stale) => {
960
961
  rmSync(mutex, { force: true });
961
962
  }
962
963
  };
963
- var acquireTrainLock = (path, holder) => acquireMachineLock(path, holder);
964
- var acquireMachineLock = (path, holder) => {
964
+ var acquireTrainLock = (path, holder) => {
965
965
  mkdirSync(dirname(path), { recursive: true });
966
966
  const mine = `${JSON.stringify(holder, null, 2)}
967
967
  `;
@@ -984,26 +984,14 @@ var acquireMachineLock = (path, holder) => {
984
984
  }
985
985
  };
986
986
  var holdTrainLock = (release) => {
987
- holdMachineLock(release);
988
- };
989
- var holdMachineLock = (release, beforeExit = async () => {
990
- }) => {
991
987
  process.on("exit", release);
992
- const handlers = [
988
+ for (const [signal, code] of [
993
989
  ["SIGINT", 130],
994
990
  ["SIGTERM", 143],
995
991
  ["SIGHUP", 129]
996
- ].map(([signal, code]) => {
997
- const handler = () => {
998
- void beforeExit().finally(() => process.exit(code));
999
- };
1000
- process.on(signal, handler);
1001
- return [signal, handler];
1002
- });
1003
- return () => {
1004
- process.off("exit", release);
1005
- for (const [signal, handler] of handlers) process.off(signal, handler);
1006
- };
992
+ ]) {
993
+ process.on(signal, () => process.exit(code));
994
+ }
1007
995
  };
1008
996
  var isConfigCheckout = (dir2) => {
1009
997
  const top = spawnSync("git", ["rev-parse", "--show-toplevel"], { cwd: dir2, encoding: "utf8" });
@@ -1106,15 +1094,19 @@ var parseCommandLine = (argv) => {
1106
1094
 
1107
1095
  // src/bounded.ts
1108
1096
  import { spawn, spawnSync as spawnSync2 } from "child_process";
1109
- import { constants, homedir as homedir2, hostname as hostname2 } from "os";
1110
- import { join as join2 } from "path";
1097
+ import { mkdirSync as mkdirSync2 } from "fs";
1098
+ import { constants, homedir as homedir2 } from "os";
1099
+ import { dirname as dirname2, join as join2 } from "path";
1111
1100
  var DEFAULT_BOUNDS = {
1112
1101
  seconds: 40 * 60,
1113
1102
  memoryBytes: 12 * 2 ** 30,
1114
1103
  waitSeconds: 4 * 60 * 60
1115
1104
  };
1116
1105
  var INSIDE_BOUNDED = "INIXIATIVE_BOUNDED";
1117
- var checkLockPath = () => join2(homedir2(), ".inixiative", "check.lock");
1106
+ var TIME_LIMIT_EXIT_CODE = 124;
1107
+ var checkLockPath = () => join2(homedir2(), ".foundry", "check.lock");
1108
+ var LOCK_WAIT_EXIT_CODE = 75;
1109
+ 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];
1118
1110
  var exitCodeOf = (code, signal) => code ?? (signal ? 128 + (constants.signals[signal] ?? 0) : 1);
1119
1111
  var UNITS = { B: 1, K: 2 ** 10, M: 2 ** 20, G: 2 ** 30, T: 2 ** 40 };
1120
1112
  var groupProcessesInTop = (output, pgid) => output.split("\n").flatMap((line) => {
@@ -1165,86 +1157,104 @@ var stopGroup = async (pgid) => {
1165
1157
  for (let waited = 0; waited < 1e4 && signalGroup(pgid, 0); waited += 200) await sleep(200);
1166
1158
  signalGroup(pgid, "SIGKILL");
1167
1159
  };
1168
- var WITH_WATCHER = '(read _ <&3; kill -KILL 0) >/dev/null 2>&1 & exec "$@"';
1160
+ var WITH_WATCHER = '(exec 4>&-; read _ <&3; kill -KILL 0) >/dev/null 2>&1 & exec "$@"';
1161
+ var HOLDING_THE_LOCK = 'echo held >&4; exec 4>&- 3<&-; "$@"; exit $?';
1169
1162
  var runBounded = async (command2, options = {}) => {
1170
1163
  if (command2.length === 0) throw new Error("bounded: no command given");
1171
1164
  const bounds = { ...DEFAULT_BOUNDS, ...options.bounds };
1172
1165
  const say = options.say ?? ((line) => console.error(line));
1173
- const cwd = options.cwd ?? process.cwd();
1174
1166
  const path = options.lockPath ?? checkLockPath();
1175
1167
  const sampleMs = options.sampleMs ?? 1e4;
1176
- const holder = {
1177
- pid: process.pid,
1178
- hostname: hostname2(),
1179
- processStart: processStart(process.pid),
1180
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
1181
- cwd,
1182
- command: command2.join(" ")
1183
- };
1184
- const waitUntil = Date.now() + bounds.waitSeconds * 1e3;
1185
- let told = "";
1186
- let lock = acquireMachineLock(path, holder);
1187
- while (!lock.ok) {
1188
- if (Date.now() > waitUntil) return { ended: "lock wait", code: 75, heldBy: lock.heldBy, path };
1189
- const { heldBy } = lock;
1190
- const who = `${heldBy.cwd} (pid ${heldBy.pid} on ${heldBy.hostname}, since ${heldBy.startedAt}; lock ${path})`;
1191
- if (who !== told) say(`bounded: waiting for the check in ${who}`);
1192
- told = who;
1193
- await sleep(Math.min(5e3, sampleMs));
1194
- lock = acquireMachineLock(path, holder);
1195
- }
1196
- const { release } = lock;
1197
- const child = spawn("sh", ["-c", WITH_WATCHER, "sh", ...command2], {
1198
- cwd,
1199
- stdio: ["inherit", "inherit", "inherit", "pipe"],
1200
- detached: true,
1201
- env: { ...process.env, [INSIDE_BOUNDED]: String(process.pid) }
1202
- });
1168
+ mkdirSync2(dirname2(path), { recursive: true });
1169
+ const holding = ["sh", "-c", HOLDING_THE_LOCK, "sh", ...command2];
1170
+ const child = spawn(
1171
+ "sh",
1172
+ [
1173
+ "-c",
1174
+ WITH_WATCHER,
1175
+ "sh",
1176
+ ...options.lock === false ? holding : underLock(path, Math.ceil(bounds.waitSeconds), holding)
1177
+ ],
1178
+ {
1179
+ cwd: options.cwd ?? process.cwd(),
1180
+ stdio: ["inherit", "inherit", "inherit", "pipe", "pipe"],
1181
+ detached: true,
1182
+ env: { ...process.env, [INSIDE_BOUNDED]: String(process.pid) }
1183
+ }
1184
+ );
1203
1185
  const pgid = child.pid;
1204
1186
  const exited = new Promise((done) => {
1205
1187
  child.on("error", (error) => done({ code: 127, reason: error.message }));
1206
1188
  child.on("exit", (code, signal) => done({ code: exitCodeOf(code, signal) }));
1207
1189
  });
1190
+ const held = new Promise((done) => child.stdio[4]?.once("data", () => done(true)));
1208
1191
  const stop = async () => {
1209
1192
  if (pgid) await stopGroup(pgid);
1210
1193
  };
1211
- const unhold = holdMachineLock(release, stop);
1212
- const deadline = Date.now() + bounds.seconds * 1e3;
1194
+ let signalled = null;
1195
+ const stopOnSignal = [
1196
+ ["SIGINT", 130],
1197
+ ["SIGTERM", 143],
1198
+ ["SIGHUP", 129]
1199
+ ].map(([signal, code]) => {
1200
+ const handler = () => {
1201
+ signalled = code;
1202
+ void stop().finally(() => process.exit(code));
1203
+ };
1204
+ process.on(signal, handler);
1205
+ return [signal, handler];
1206
+ });
1213
1207
  let peakBytes = 0;
1214
1208
  let heaviest = "";
1215
1209
  try {
1210
+ const waiting = setTimeout(
1211
+ () => say(`bounded: waiting for the machine's check lock (${path})`),
1212
+ Math.min(5e3, sampleMs)
1213
+ );
1214
+ const first2 = await Promise.race([held, exited]);
1215
+ clearTimeout(waiting);
1216
+ if (first2 !== true) {
1217
+ if (first2.reason !== void 0)
1218
+ return { ended: "not started", code: 127, reason: first2.reason };
1219
+ const ran = await Promise.race([held, sleep(200).then(() => false)]);
1220
+ return !ran && first2.code === LOCK_WAIT_EXIT_CODE ? { ended: "lock wait", code: LOCK_WAIT_EXIT_CODE, path } : { ended: "exited", code: first2.code };
1221
+ }
1222
+ const deadline = Date.now() + bounds.seconds * 1e3;
1216
1223
  for (; ; ) {
1217
1224
  const end = await Promise.race([exited, sleep(sampleMs).then(() => null)]);
1218
1225
  if (end?.reason !== void 0) return { ended: "not started", code: 127, reason: end.reason };
1219
1226
  if (end) return { ended: "exited", code: end.code };
1220
1227
  if (!pgid) continue;
1221
- const held = (options.memoryOf ?? fetchGroupMemory)(pgid);
1222
- const bytes = held.reduce((sum, entry) => sum + entry.bytes, 0);
1228
+ const group = (options.memoryOf ?? fetchGroupMemory)(pgid);
1229
+ const bytes = group.reduce((sum, entry) => sum + entry.bytes, 0);
1223
1230
  if (bytes > peakBytes) {
1224
1231
  peakBytes = bytes;
1225
- const most = held.reduce((a, b) => b.bytes > a.bytes ? b : a);
1232
+ const most = group.reduce((a, b) => b.bytes > a.bytes ? b : a);
1226
1233
  heaviest = `${most.command} (pid ${most.pid})`;
1227
1234
  }
1228
1235
  const over = bytes > bounds.memoryBytes ? "memory ceiling" : Date.now() > deadline ? "time limit" : null;
1229
1236
  if (!over) continue;
1230
1237
  await stop();
1231
1238
  await exited;
1232
- return { ended: over, code: over === "time limit" ? 124 : 137, peakBytes, heaviest };
1239
+ return {
1240
+ ended: over,
1241
+ code: over === "time limit" ? TIME_LIMIT_EXIT_CODE : 137,
1242
+ peakBytes,
1243
+ heaviest
1244
+ };
1233
1245
  }
1234
1246
  } finally {
1235
1247
  await stop();
1236
- unhold();
1237
- release();
1248
+ if (signalled !== null) process.exit(signalled);
1249
+ for (const [signal, handler] of stopOnSignal) process.off(signal, handler);
1238
1250
  }
1239
1251
  };
1240
1252
  var boundedVerdict = (outcome, bounds) => {
1241
1253
  if (outcome.ended === "exited") return null;
1242
1254
  if (outcome.ended === "not started")
1243
1255
  return `\u2717 bounded: the command did not start: ${outcome.reason}`;
1244
- if (outcome.ended === "lock wait") {
1245
- const { heldBy } = outcome;
1246
- return `\u2717 bounded: gave up after ${Math.round(bounds.waitSeconds)} s waiting for the check in ${heldBy.cwd} (pid ${heldBy.pid} on ${heldBy.hostname}); if that check is gone, remove ${outcome.path}`;
1247
- }
1256
+ if (outcome.ended === "lock wait")
1257
+ return `\u2717 bounded: gave up after ${Math.round(bounds.waitSeconds)} s waiting for the machine's check lock (${outcome.path})`;
1248
1258
  const peak = (outcome.peakBytes / 2 ** 30).toFixed(1);
1249
1259
  const most = outcome.heaviest || "unknown";
1250
1260
  return outcome.ended === "time limit" ? `\u2717 bounded: stopped at the ${Math.round(bounds.seconds / 60)} min time limit (peak ${peak} GB, most in ${most})` : `\u2717 bounded: stopped at the ${(bounds.memoryBytes / 2 ** 30).toFixed(1)} GB memory ceiling (peak ${peak} GB, most in ${most})`;
@@ -1297,13 +1307,13 @@ import { spawnSync as spawnSync3 } from "child_process";
1297
1307
  import {
1298
1308
  existsSync as existsSync2,
1299
1309
  lstatSync,
1300
- mkdirSync as mkdirSync2,
1310
+ mkdirSync as mkdirSync3,
1301
1311
  readdirSync as readdirSync2,
1302
1312
  readFileSync as readFileSync2,
1303
1313
  rmSync as rmSync2,
1304
1314
  writeFileSync as writeFileSync2
1305
1315
  } from "fs";
1306
- import { dirname as dirname2, join as join3 } from "path";
1316
+ import { dirname as dirname3, join as join3 } from "path";
1307
1317
  var RETIRED_TERMS = [
1308
1318
  {
1309
1319
  id: "kastle",
@@ -1341,17 +1351,11 @@ var RETIRED_TERMS = [
1341
1351
  scope: "docs",
1342
1352
  instead: "Foundry and Oracle, two products"
1343
1353
  },
1344
- {
1345
- id: "own-llm-keys",
1346
- pattern: /\byour own (?:LLM|model|API) keys?\b/gi,
1347
- scope: "docs",
1348
- instead: "your own subscriptions (Foundry runs on subscription logins)"
1349
- },
1350
1354
  {
1351
1355
  id: "foundry-roles",
1352
1356
  pattern: /\b(?:Cartographer|Librarian|Artificer|Steward)s?\b/g,
1353
1357
  scope: "public",
1354
- instead: "say what it does: Wardens point at what exists; your agent decides"
1358
+ instead: "say what it does: Wardens remind your agent of what already exists; your agent decides"
1355
1359
  }
1356
1360
  ];
1357
1361
  var RETIRED_TERMS_DIR = "scripts/ci/retired-terms";
@@ -1518,7 +1522,7 @@ var writeRetiredTermsBaseline = (root) => {
1518
1522
  rmSync2(path, { force: true });
1519
1523
  return { written: 0, refused: [] };
1520
1524
  }
1521
- mkdirSync2(dirname2(path), { recursive: true });
1525
+ mkdirSync3(dirname3(path), { recursive: true });
1522
1526
  writeFileSync2(path, `${[...header, ...lines].join("\n")}
1523
1527
  `);
1524
1528
  return { written: lines.length, refused: [] };
@@ -1539,7 +1543,7 @@ try {
1539
1543
  var { command, positionals, preset: presetFlag, dryRun, adoptCheckTimeout } = commandLine;
1540
1544
  var dir = resolve2(command === "bounded" ? "." : positionals[0] ?? ".");
1541
1545
  if (command === "bounded") {
1542
- if (process.env.CI || process.env[INSIDE_BOUNDED]) {
1546
+ if (process.env.CI) {
1543
1547
  const [file, ...args] = positionals;
1544
1548
  const ran = spawnSync4(file ?? "", args, { stdio: "inherit" });
1545
1549
  if (ran.error) {
@@ -1554,7 +1558,7 @@ if (command === "bounded") {
1554
1558
  memoryBytes: memoryGb === void 0 ? DEFAULT_BOUNDS.memoryBytes : memoryGb * 2 ** 30,
1555
1559
  waitSeconds: waitMinutes === void 0 ? DEFAULT_BOUNDS.waitSeconds : waitMinutes * 60
1556
1560
  };
1557
- const outcome = await runBounded(positionals, { bounds });
1561
+ const outcome = await runBounded(positionals, { bounds, lock: !process.env[INSIDE_BOUNDED] });
1558
1562
  const verdict = boundedVerdict(outcome, bounds);
1559
1563
  if (verdict) console.error(verdict);
1560
1564
  process.exit(outcome.code);
@@ -1709,7 +1713,7 @@ if (command === "train") {
1709
1713
  const path = trainLockPath();
1710
1714
  const lock = acquireTrainLock(path, {
1711
1715
  pid: process.pid,
1712
- hostname: hostname3(),
1716
+ hostname: hostname2(),
1713
1717
  processStart: processStart(process.pid),
1714
1718
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
1715
1719
  lanes,
@@ -1767,7 +1771,7 @@ if (command === "train") {
1767
1771
  });
1768
1772
  } else {
1769
1773
  git(repo, "worktree", "remove", "--force", path);
1770
- rmSync3(dirname3(path), { recursive: true, force: true });
1774
+ rmSync3(dirname4(path), { recursive: true, force: true });
1771
1775
  }
1772
1776
  };
1773
1777
  process.on("exit", () => {
@@ -1838,6 +1842,20 @@ if (command === "train") {
1838
1842
  staleLock: inspection.findings.some((finding) => finding.kind === "stale-lock")
1839
1843
  };
1840
1844
  };
1845
+ const runRepoCheck = (cwd, seconds = 2 * 60 * 60) => spawnSync4(
1846
+ process.execPath,
1847
+ [
1848
+ process.argv[1] ?? "",
1849
+ "bounded",
1850
+ `--minutes=${seconds / 60}`,
1851
+ "--memory-gb=24",
1852
+ "--",
1853
+ "bun",
1854
+ "run",
1855
+ "check"
1856
+ ],
1857
+ { cwd, stdio: "inherit" }
1858
+ ).status;
1841
1859
  const relockAndCheck = (checkout, check = true) => effect(`re-lock ${checkout.name}${check ? " and run its check" : ""}`, void 0, () => {
1842
1860
  const install = (...flags) => spawnSync4("bun", ["install", ...flags], { cwd: checkout.dir, stdio: "inherit" }).status === 0;
1843
1861
  if (!install() && !install("--no-cache")) {
@@ -1849,7 +1867,7 @@ if (command === "train") {
1849
1867
  )) {
1850
1868
  spawnSync4("bun", ["update", ...names], { cwd, stdio: "inherit" });
1851
1869
  }
1852
- if (check && spawnSync4("bun", ["run", "check"], { cwd: checkout.dir, stdio: "inherit" }).status !== 0) {
1870
+ if (check && runRepoCheck(checkout.dir) !== 0) {
1853
1871
  throw new CheckFailed(`check failed in ${checkout.name}`);
1854
1872
  }
1855
1873
  });
@@ -1942,7 +1960,7 @@ if (command === "train") {
1942
1960
  );
1943
1961
  for (const file of envFiles) {
1944
1962
  if (existsSync3(join4(path, file))) continue;
1945
- mkdirSync3(dirname3(join4(path, file)), { recursive: true });
1963
+ mkdirSync4(dirname4(join4(path, file)), { recursive: true });
1946
1964
  writeFileSync3(join4(path, file), readFileSync3(join4(checkout.dir, file)));
1947
1965
  }
1948
1966
  return { ...checkout, dir: path };
@@ -2023,16 +2041,11 @@ if (command === "train") {
2023
2041
  reason = "train:adopt failed";
2024
2042
  console.log(`\u26A0 train:adopt failed in ${checkout.name} \u2014 ${leftOut}`);
2025
2043
  } else {
2026
- const check = spawnSync4("bun", ["run", "check"], {
2027
- cwd: branchCheckout.dir,
2028
- stdio: "inherit",
2029
- timeout: adoptCheckTimeout * 1e3,
2030
- killSignal: "SIGKILL"
2031
- });
2032
- if (check.status !== 0) {
2044
+ const check = runRepoCheck(branchCheckout.dir, adoptCheckTimeout);
2045
+ if (check !== 0) {
2033
2046
  reason = "check failed after train:adopt";
2034
2047
  console.log(
2035
- check.error || check.signal ? `\u26A0 check timed out after ${adoptCheckTimeout}s in ${checkout.name} after train:adopt \u2014 ${leftOut}` : `\u26A0 check still fails in ${checkout.name} after train:adopt \u2014 ${leftOut}`
2048
+ check === TIME_LIMIT_EXIT_CODE ? `\u26A0 check timed out after ${adoptCheckTimeout}s in ${checkout.name} after train:adopt \u2014 ${leftOut}` : `\u26A0 check still fails in ${checkout.name} after train:adopt \u2014 ${leftOut}`
2036
2049
  );
2037
2050
  }
2038
2051
  }
@@ -2129,7 +2142,7 @@ if (command === "train") {
2129
2142
  if (entry.path === "package.json") {
2130
2143
  return spawnSync4("npm", ["publish"], { cwd: checkout.dir, stdio: "inherit" }).status === 0;
2131
2144
  }
2132
- const memberDir = join4(checkout.dir, dirname3(entry.path));
2145
+ const memberDir = join4(checkout.dir, dirname4(entry.path));
2133
2146
  const out = mkdtempSync(join4(tmpdir(), "inixiative-train-"));
2134
2147
  try {
2135
2148
  const pack = spawnSync4("bun", ["pm", "pack", "--destination", out], {
@@ -2392,8 +2405,7 @@ blessed: ${promoted.length === 0 ? "nothing" : promoted.join(", ")}`);
2392
2405
  }
2393
2406
  );
2394
2407
  effect("run bun run check in @inixiative/config", void 0, () => {
2395
- const check = spawnSync4("bun", ["run", "check"], { cwd: packageRoot, stdio: "inherit" });
2396
- if (check.status !== 0) {
2408
+ if (runRepoCheck(packageRoot) !== 0) {
2397
2409
  console.error("\u2717 check failed in @inixiative/config \u2014 aborting before publish");
2398
2410
  process.exit(1);
2399
2411
  }
@@ -2547,7 +2559,7 @@ if (fixed > 0) console.log(`applied ${fixed} fix${fixed === 1 ? "" : "es"}`);
2547
2559
  if (!commandLine.noInstall) {
2548
2560
  const relinked = new Set(
2549
2561
  first.findings.flatMap(
2550
- (finding) => finding.kind === "member-toolchain" && finding.path ? [dirname3(finding.path)] : []
2562
+ (finding) => finding.kind === "member-toolchain" && finding.path ? [dirname4(finding.path)] : []
2551
2563
  )
2552
2564
  );
2553
2565
  for (const member of relinked) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inixiative/config",
3
- "version": "0.5.236",
3
+ "version": "0.5.238",
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",
@@ -45,7 +45,7 @@
45
45
  "./theme/fonts/*": "./theme/fonts/*"
46
46
  },
47
47
  "scripts": {
48
- "prepare": "if git rev-parse --git-dir >/dev/null 2>&1; then lefthook install; fi",
48
+ "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",
49
49
  "build": "tsup",
50
50
  "test": "bun test",
51
51
  "typecheck": "tsc --noEmit",
package/versions.json CHANGED
@@ -13,10 +13,10 @@
13
13
  "@types/bun"
14
14
  ],
15
15
  "ecosystem": {
16
- "@inixiative/config": "0.5.236",
16
+ "@inixiative/config": "0.5.238",
17
17
  "@inixiative/field-map": "0.1.1",
18
18
  "@inixiative/json-rules": "3.16.0",
19
- "@inixiative/permissions": "0.21.1",
19
+ "@inixiative/permissions": "0.25.0",
20
20
  "@inixiative/transitions": "0.8.0",
21
21
  "@inixiative/rules-builder": "0.33.0",
22
22
  "@inixiative/prisma-map": "0.4.1",
@@ -53,8 +53,7 @@
53
53
  },
54
54
  "candidates": {
55
55
  "@inixiative/atlas": "0.5.1",
56
- "@inixiative/json-rules": "4.2.0",
57
- "@inixiative/permissions": "0.25.0",
56
+ "@inixiative/json-rules": "4.3.0",
58
57
  "@inixiative/agent-session": "0.21.0",
59
58
  "@inixiative/field-map": "0.1.2",
60
59
  "@inixiative/archive": "0.35.0"