@inixiative/config 0.5.234 → 0.5.235
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 +18 -0
- package/dist/cli.js +269 -68
- package/package.json +1 -1
- package/versions.json +2 -2
package/README.md
CHANGED
|
@@ -80,6 +80,7 @@ bunx @inixiative/config scan [root] [--lane=primitives|agentic]
|
|
|
80
80
|
bunx @inixiative/config train [root] [--lane=primitives|agentic] [--push] [--dry-run] [--adopt-check-timeout=<seconds>]
|
|
81
81
|
bunx @inixiative/config ports [project]
|
|
82
82
|
bunx @inixiative/config terms [dir] [--write-baseline]
|
|
83
|
+
bunx @inixiative/config bounded [--minutes=40] [--memory-gb=12] [--wait-minutes=240] -- <command…>
|
|
83
84
|
```
|
|
84
85
|
|
|
85
86
|
`train` is the one command not run through `bunx`: run it from a git checkout of this repo (`bun src/cli.ts train …` there), because it refuses to train from a bunx or npm copy (see train).
|
|
@@ -92,6 +93,23 @@ bunx @inixiative/config terms [dir] [--write-baseline]
|
|
|
92
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 (`check`/`typecheck`/`lint`/`test`), 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.
|
|
94
95
|
|
|
96
|
+
### bounded
|
|
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.
|
|
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.
|
|
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
|
+
- **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
|
+
- **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.
|
|
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.
|
|
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
|
+
|
|
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
|
+
|
|
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`.
|
|
112
|
+
|
|
95
113
|
### Retired terms
|
|
96
114
|
|
|
97
115
|
`check` also runs the **retired-terms** rule (alone: `terms`), which keeps public copy from rotting back to names the project retired. It reads text people read, never code identifiers: every Markdown, MDX, HTML and Astro file a repo tracks, and each `package.json` `description`. Fixtures, changelogs (history records the rename), `node_modules`, generated Warden regions (`.foundry/regions/`; fix their source docs) and root `dist`, `build`, `coverage` and `tmp` are skipped. The rule runs in `check` and `terms` only; `scan`, `sync` and the train are about package drift and don't run it. The list lives in `src/retiredTerms.ts`, each term with the word to use instead, and comes from the workspace CLAUDE.md "Dead concepts" and the copy brief's "Retired words":
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import { spawnSync as
|
|
4
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
5
5
|
import {
|
|
6
6
|
existsSync as existsSync3,
|
|
7
7
|
mkdirSync as mkdirSync3,
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
rmSync as rmSync3,
|
|
12
12
|
writeFileSync as writeFileSync3
|
|
13
13
|
} from "fs";
|
|
14
|
-
import { hostname as
|
|
15
|
-
import { basename, dirname as dirname3, join as
|
|
14
|
+
import { hostname as hostname3, tmpdir } from "os";
|
|
15
|
+
import { basename, dirname as dirname3, join as join4, resolve as resolve2 } from "path";
|
|
16
16
|
|
|
17
17
|
// src/args.ts
|
|
18
18
|
import { parseArgs } from "util";
|
|
@@ -960,7 +960,8 @@ var removeStale = (path, stale) => {
|
|
|
960
960
|
rmSync(mutex, { force: true });
|
|
961
961
|
}
|
|
962
962
|
};
|
|
963
|
-
var acquireTrainLock = (path, holder) =>
|
|
963
|
+
var acquireTrainLock = (path, holder) => acquireMachineLock(path, holder);
|
|
964
|
+
var acquireMachineLock = (path, holder) => {
|
|
964
965
|
mkdirSync(dirname(path), { recursive: true });
|
|
965
966
|
const mine = `${JSON.stringify(holder, null, 2)}
|
|
966
967
|
`;
|
|
@@ -983,14 +984,26 @@ var acquireTrainLock = (path, holder) => {
|
|
|
983
984
|
}
|
|
984
985
|
};
|
|
985
986
|
var holdTrainLock = (release) => {
|
|
987
|
+
holdMachineLock(release);
|
|
988
|
+
};
|
|
989
|
+
var holdMachineLock = (release, beforeExit = async () => {
|
|
990
|
+
}) => {
|
|
986
991
|
process.on("exit", release);
|
|
987
|
-
|
|
992
|
+
const handlers = [
|
|
988
993
|
["SIGINT", 130],
|
|
989
994
|
["SIGTERM", 143],
|
|
990
995
|
["SIGHUP", 129]
|
|
991
|
-
]) {
|
|
992
|
-
|
|
993
|
-
|
|
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
|
+
};
|
|
994
1007
|
};
|
|
995
1008
|
var isConfigCheckout = (dir2) => {
|
|
996
1009
|
const top = spawnSync("git", ["rev-parse", "--show-toplevel"], { cwd: dir2, encoding: "utf8" });
|
|
@@ -999,7 +1012,7 @@ var isConfigCheckout = (dir2) => {
|
|
|
999
1012
|
};
|
|
1000
1013
|
|
|
1001
1014
|
// src/args.ts
|
|
1002
|
-
var COMMANDS = ["check", "sync", "scan", "train", "ports", "terms"];
|
|
1015
|
+
var COMMANDS = ["check", "sync", "scan", "train", "ports", "terms", "bounded"];
|
|
1003
1016
|
var PRESETS = ["base", "node", "react"];
|
|
1004
1017
|
var preset = { type: "string" };
|
|
1005
1018
|
var lane = { type: "string" };
|
|
@@ -1010,7 +1023,12 @@ var OPTIONS = {
|
|
|
1010
1023
|
scan: { lane },
|
|
1011
1024
|
train: { lane, push: flag, "dry-run": flag, "adopt-check-timeout": { type: "string" } },
|
|
1012
1025
|
ports: {},
|
|
1013
|
-
terms: { "write-baseline": flag }
|
|
1026
|
+
terms: { "write-baseline": flag },
|
|
1027
|
+
bounded: {
|
|
1028
|
+
minutes: { type: "string" },
|
|
1029
|
+
"memory-gb": { type: "string" },
|
|
1030
|
+
"wait-minutes": { type: "string" }
|
|
1031
|
+
}
|
|
1014
1032
|
};
|
|
1015
1033
|
var UsageError = class extends Error {
|
|
1016
1034
|
};
|
|
@@ -1034,7 +1052,7 @@ var parseCommandLine = (argv) => {
|
|
|
1034
1052
|
} catch (error) {
|
|
1035
1053
|
throw new UsageError(`${command2}: ${error instanceof Error ? error.message : String(error)}`);
|
|
1036
1054
|
}
|
|
1037
|
-
if (positionals2.length > 1)
|
|
1055
|
+
if (command2 !== "bounded" && positionals2.length > 1)
|
|
1038
1056
|
throw new UsageError(
|
|
1039
1057
|
`${command2}: unexpected argument ${positionals2[1]} \u2014 did you mean --${positionals2[1]}?`
|
|
1040
1058
|
);
|
|
@@ -1047,6 +1065,21 @@ var parseCommandLine = (argv) => {
|
|
|
1047
1065
|
if (typeof presetValue === "string" && !PRESETS.includes(presetValue)) {
|
|
1048
1066
|
throw new UsageError(`unknown preset: ${presetValue}`);
|
|
1049
1067
|
}
|
|
1068
|
+
const positive = (name) => {
|
|
1069
|
+
const given = values[name];
|
|
1070
|
+
if (typeof given !== "string") return void 0;
|
|
1071
|
+
const amount = Number(given);
|
|
1072
|
+
if (!Number.isFinite(amount) || amount <= 0)
|
|
1073
|
+
throw new UsageError(`--${name} takes a number above zero, got ${given}`);
|
|
1074
|
+
return amount;
|
|
1075
|
+
};
|
|
1076
|
+
const bounds = {
|
|
1077
|
+
minutes: positive("minutes"),
|
|
1078
|
+
memoryGb: positive("memory-gb"),
|
|
1079
|
+
waitMinutes: positive("wait-minutes")
|
|
1080
|
+
};
|
|
1081
|
+
if (command2 === "bounded" && (positionals2.length === 0 || !tokens.some((token) => token.kind === "option-terminator")))
|
|
1082
|
+
throw new UsageError("bounded: give the command after --, e.g. bounded -- bun run check:all");
|
|
1050
1083
|
const laneValue = values.lane;
|
|
1051
1084
|
if (typeof laneValue === "string" && !isLane(laneValue)) {
|
|
1052
1085
|
throw new UsageError(`unknown lane: ${laneValue}`);
|
|
@@ -1066,10 +1099,157 @@ var parseCommandLine = (argv) => {
|
|
|
1066
1099
|
push: values.push === true,
|
|
1067
1100
|
dryRun: values["dry-run"] === true,
|
|
1068
1101
|
adoptCheckTimeout: adoptCheckTimeout2,
|
|
1069
|
-
writeBaseline: values["write-baseline"] === true
|
|
1102
|
+
writeBaseline: values["write-baseline"] === true,
|
|
1103
|
+
bounds
|
|
1070
1104
|
};
|
|
1071
1105
|
};
|
|
1072
1106
|
|
|
1107
|
+
// src/bounded.ts
|
|
1108
|
+
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";
|
|
1111
|
+
var DEFAULT_BOUNDS = {
|
|
1112
|
+
seconds: 40 * 60,
|
|
1113
|
+
memoryBytes: 12 * 2 ** 30,
|
|
1114
|
+
waitSeconds: 4 * 60 * 60
|
|
1115
|
+
};
|
|
1116
|
+
var INSIDE_BOUNDED = "INIXIATIVE_BOUNDED";
|
|
1117
|
+
var checkLockPath = () => join2(homedir2(), ".inixiative", "check.lock");
|
|
1118
|
+
var exitCodeOf = (code, signal) => code ?? (signal ? 128 + (constants.signals[signal] ?? 0) : 1);
|
|
1119
|
+
var UNITS = { B: 1, K: 2 ** 10, M: 2 ** 20, G: 2 ** 30, T: 2 ** 40 };
|
|
1120
|
+
var groupProcessesInTop = (output, pgid) => output.split("\n").flatMap((line) => {
|
|
1121
|
+
const match = /^\s*(\d+)\s+(\d+)\s+([\d.]+)([BKMGT])\S*\s+(.*)$/.exec(line);
|
|
1122
|
+
return match && Number(match[2]) === pgid ? [
|
|
1123
|
+
{
|
|
1124
|
+
pid: Number(match[1]),
|
|
1125
|
+
bytes: Number(match[3]) * (UNITS[match[4] ?? "B"] ?? 1),
|
|
1126
|
+
command: (match[5] ?? "").trim()
|
|
1127
|
+
}
|
|
1128
|
+
] : [];
|
|
1129
|
+
});
|
|
1130
|
+
var groupProcessesInPs = (output, pgid) => output.split("\n").flatMap((line) => {
|
|
1131
|
+
const match = /^\s*(\d+)\s+(\d+)\s+(\d+)\s+(.*)$/.exec(line);
|
|
1132
|
+
return match && Number(match[2]) === pgid ? [
|
|
1133
|
+
{
|
|
1134
|
+
pid: Number(match[1]),
|
|
1135
|
+
bytes: Number(match[3]) * 1024,
|
|
1136
|
+
command: (match[4] ?? "").trim()
|
|
1137
|
+
}
|
|
1138
|
+
] : [];
|
|
1139
|
+
});
|
|
1140
|
+
var fetchGroupMemory = (pgid) => {
|
|
1141
|
+
if (process.platform === "darwin") {
|
|
1142
|
+
const top = spawnSync2("top", ["-l", "1", "-n", "5000", "-stats", "pid,pgrp,mem,command"], {
|
|
1143
|
+
encoding: "utf8",
|
|
1144
|
+
timeout: 3e4
|
|
1145
|
+
});
|
|
1146
|
+
if (top.status === 0) return groupProcessesInTop(top.stdout, pgid);
|
|
1147
|
+
}
|
|
1148
|
+
const ps = spawnSync2("ps", ["-eo", "pid=,pgid=,rss=,comm="], {
|
|
1149
|
+
encoding: "utf8",
|
|
1150
|
+
timeout: 3e4
|
|
1151
|
+
});
|
|
1152
|
+
return groupProcessesInPs(ps.stdout ?? "", pgid);
|
|
1153
|
+
};
|
|
1154
|
+
var sleep = (ms) => new Promise((done) => setTimeout(done, ms));
|
|
1155
|
+
var signalGroup = (pgid, signal) => {
|
|
1156
|
+
try {
|
|
1157
|
+
process.kill(-pgid, signal);
|
|
1158
|
+
return true;
|
|
1159
|
+
} catch {
|
|
1160
|
+
return false;
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
var stopGroup = async (pgid) => {
|
|
1164
|
+
if (!signalGroup(pgid, "SIGTERM")) return;
|
|
1165
|
+
for (let waited = 0; waited < 1e4 && signalGroup(pgid, 0); waited += 200) await sleep(200);
|
|
1166
|
+
signalGroup(pgid, "SIGKILL");
|
|
1167
|
+
};
|
|
1168
|
+
var WITH_WATCHER = '(read _ <&3; kill -KILL 0) >/dev/null 2>&1 & exec "$@"';
|
|
1169
|
+
var runBounded = async (command2, options = {}) => {
|
|
1170
|
+
if (command2.length === 0) throw new Error("bounded: no command given");
|
|
1171
|
+
const bounds = { ...DEFAULT_BOUNDS, ...options.bounds };
|
|
1172
|
+
const say = options.say ?? ((line) => console.error(line));
|
|
1173
|
+
const cwd = options.cwd ?? process.cwd();
|
|
1174
|
+
const path = options.lockPath ?? checkLockPath();
|
|
1175
|
+
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
|
+
});
|
|
1203
|
+
const pgid = child.pid;
|
|
1204
|
+
const exited = new Promise((done) => {
|
|
1205
|
+
child.on("error", (error) => done({ code: 127, reason: error.message }));
|
|
1206
|
+
child.on("exit", (code, signal) => done({ code: exitCodeOf(code, signal) }));
|
|
1207
|
+
});
|
|
1208
|
+
const stop = async () => {
|
|
1209
|
+
if (pgid) await stopGroup(pgid);
|
|
1210
|
+
};
|
|
1211
|
+
const unhold = holdMachineLock(release, stop);
|
|
1212
|
+
const deadline = Date.now() + bounds.seconds * 1e3;
|
|
1213
|
+
let peakBytes = 0;
|
|
1214
|
+
let heaviest = "";
|
|
1215
|
+
try {
|
|
1216
|
+
for (; ; ) {
|
|
1217
|
+
const end = await Promise.race([exited, sleep(sampleMs).then(() => null)]);
|
|
1218
|
+
if (end?.reason !== void 0) return { ended: "not started", code: 127, reason: end.reason };
|
|
1219
|
+
if (end) return { ended: "exited", code: end.code };
|
|
1220
|
+
if (!pgid) continue;
|
|
1221
|
+
const held = (options.memoryOf ?? fetchGroupMemory)(pgid);
|
|
1222
|
+
const bytes = held.reduce((sum, entry) => sum + entry.bytes, 0);
|
|
1223
|
+
if (bytes > peakBytes) {
|
|
1224
|
+
peakBytes = bytes;
|
|
1225
|
+
const most = held.reduce((a, b) => b.bytes > a.bytes ? b : a);
|
|
1226
|
+
heaviest = `${most.command} (pid ${most.pid})`;
|
|
1227
|
+
}
|
|
1228
|
+
const over = bytes > bounds.memoryBytes ? "memory ceiling" : Date.now() > deadline ? "time limit" : null;
|
|
1229
|
+
if (!over) continue;
|
|
1230
|
+
await stop();
|
|
1231
|
+
await exited;
|
|
1232
|
+
return { ended: over, code: over === "time limit" ? 124 : 137, peakBytes, heaviest };
|
|
1233
|
+
}
|
|
1234
|
+
} finally {
|
|
1235
|
+
await stop();
|
|
1236
|
+
unhold();
|
|
1237
|
+
release();
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
var boundedVerdict = (outcome, bounds) => {
|
|
1241
|
+
if (outcome.ended === "exited") return null;
|
|
1242
|
+
if (outcome.ended === "not started")
|
|
1243
|
+
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
|
+
}
|
|
1248
|
+
const peak = (outcome.peakBytes / 2 ** 30).toFixed(1);
|
|
1249
|
+
const most = outcome.heaviest || "unknown";
|
|
1250
|
+
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})`;
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1073
1253
|
// ports.json
|
|
1074
1254
|
var ports_default = {
|
|
1075
1255
|
$comment: "Local port registry. A project's port for a service is the service's default plus 100 times the project's block, so projects never collide. Zealot sits at block 0, the defaults, by Aron's choice 2026-10-20; every other project is off the defaults. Add a project at the next free block; add a service with its usual default.",
|
|
@@ -1113,7 +1293,7 @@ function portsFor(project) {
|
|
|
1113
1293
|
}
|
|
1114
1294
|
|
|
1115
1295
|
// src/retiredTerms.ts
|
|
1116
|
-
import { spawnSync as
|
|
1296
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
1117
1297
|
import {
|
|
1118
1298
|
existsSync as existsSync2,
|
|
1119
1299
|
lstatSync,
|
|
@@ -1123,7 +1303,7 @@ import {
|
|
|
1123
1303
|
rmSync as rmSync2,
|
|
1124
1304
|
writeFileSync as writeFileSync2
|
|
1125
1305
|
} from "fs";
|
|
1126
|
-
import { dirname as dirname2, join as
|
|
1306
|
+
import { dirname as dirname2, join as join3 } from "path";
|
|
1127
1307
|
var RETIRED_TERMS = [
|
|
1128
1308
|
{
|
|
1129
1309
|
id: "kastle",
|
|
@@ -1181,7 +1361,7 @@ var TEXT_FILE = /\.(md|mdx|html|astro)$/i;
|
|
|
1181
1361
|
var PUBLIC_FILE = /(^|\/)README[^/]*\.md$|\.(html|astro|mdx)$/i;
|
|
1182
1362
|
var SKIPPED = /(^|\/)(node_modules|\.git|\.worktrees|fixtures|rule-violations)\/|^(dist|build|coverage|tmp)\/|^\.foundry\/regions\/|(^|\/)CHANGELOG[^/]*\.md$/i;
|
|
1183
1363
|
var walk = (root, dir2 = "", out = []) => {
|
|
1184
|
-
for (const entry of readdirSync2(
|
|
1364
|
+
for (const entry of readdirSync2(join3(root, dir2), { withFileTypes: true })) {
|
|
1185
1365
|
const rel = dir2 ? `${dir2}/${entry.name}` : entry.name;
|
|
1186
1366
|
if (entry.isDirectory() && !SKIPPED.test(`${rel}/`)) walk(root, rel, out);
|
|
1187
1367
|
else if (entry.isFile()) out.push(rel);
|
|
@@ -1196,8 +1376,8 @@ var readText = (abs) => {
|
|
|
1196
1376
|
}
|
|
1197
1377
|
};
|
|
1198
1378
|
var listFiles = (root) => {
|
|
1199
|
-
if (existsSync2(
|
|
1200
|
-
const listed =
|
|
1379
|
+
if (existsSync2(join3(root, ".git"))) {
|
|
1380
|
+
const listed = spawnSync3(
|
|
1201
1381
|
"git",
|
|
1202
1382
|
["ls-files", "-z", "--cached", "--others", "--exclude-standard"],
|
|
1203
1383
|
{
|
|
@@ -1216,7 +1396,7 @@ var scanRetiredTerms = (root) => {
|
|
|
1216
1396
|
if (SKIPPED.test(path) || path.startsWith(`${RETIRED_TERMS_DIR}/`)) continue;
|
|
1217
1397
|
const isManifest = /(^|\/)package\.json$/.test(path);
|
|
1218
1398
|
if (!isManifest && !TEXT_FILE.test(path)) continue;
|
|
1219
|
-
const raw = readText(
|
|
1399
|
+
const raw = readText(join3(root, path));
|
|
1220
1400
|
if (raw === null) continue;
|
|
1221
1401
|
let text = raw;
|
|
1222
1402
|
if (isManifest) {
|
|
@@ -1244,7 +1424,7 @@ var scanRetiredTerms = (root) => {
|
|
|
1244
1424
|
return hits;
|
|
1245
1425
|
};
|
|
1246
1426
|
var readList = (root, file) => {
|
|
1247
|
-
const abs =
|
|
1427
|
+
const abs = join3(root, file);
|
|
1248
1428
|
if (!existsSync2(abs)) return [];
|
|
1249
1429
|
return readFileSync2(abs, "utf8").split("\n").map((line) => line.trimEnd()).filter((line) => line.trim() !== "" && !line.trimStart().startsWith("#"));
|
|
1250
1430
|
};
|
|
@@ -1320,7 +1500,7 @@ var checkRetiredTerms = (root) => {
|
|
|
1320
1500
|
var writeRetiredTermsBaseline = (root) => {
|
|
1321
1501
|
const allowed = allowedBy(readList(root, ALLOW_FILE));
|
|
1322
1502
|
const counts = countByKey(scanRetiredTerms(root).filter((hit) => !allowed(hit)));
|
|
1323
|
-
const path =
|
|
1503
|
+
const path = join3(root, BASELINE_FILE);
|
|
1324
1504
|
if (existsSync2(path)) {
|
|
1325
1505
|
const { counts: baseline } = readBaseline(root);
|
|
1326
1506
|
const refused = [...counts].filter(([key, count]) => count > (baseline.get(key) ?? 0)).map(
|
|
@@ -1352,12 +1532,33 @@ try {
|
|
|
1352
1532
|
if (!(error instanceof UsageError)) throw error;
|
|
1353
1533
|
console.error(`\u2717 ${error.message}`);
|
|
1354
1534
|
console.error(
|
|
1355
|
-
"Usage: inixiative-config check [dir] [--preset=base|node|react]\n inixiative-config sync [dir] [--preset=base|node|react] [--force] [--no-install]\n inixiative-config scan [root] [--lane=primitives|agentic]\n inixiative-config train [root] [--lane=primitives|agentic] [--push] [--dry-run]\n inixiative-config ports [project]\n inixiative-config terms [dir] [--write-baseline]"
|
|
1535
|
+
"Usage: inixiative-config check [dir] [--preset=base|node|react]\n inixiative-config sync [dir] [--preset=base|node|react] [--force] [--no-install]\n inixiative-config scan [root] [--lane=primitives|agentic]\n inixiative-config train [root] [--lane=primitives|agentic] [--push] [--dry-run]\n inixiative-config ports [project]\n inixiative-config terms [dir] [--write-baseline]\n inixiative-config bounded [--minutes=40] [--memory-gb=12] [--wait-minutes=240] -- <command\u2026>"
|
|
1356
1536
|
);
|
|
1357
1537
|
process.exit(2);
|
|
1358
1538
|
}
|
|
1359
1539
|
var { command, positionals, preset: presetFlag, dryRun, adoptCheckTimeout } = commandLine;
|
|
1360
|
-
var dir = resolve2(positionals[0] ?? ".");
|
|
1540
|
+
var dir = resolve2(command === "bounded" ? "." : positionals[0] ?? ".");
|
|
1541
|
+
if (command === "bounded") {
|
|
1542
|
+
if (process.env.CI || process.env[INSIDE_BOUNDED]) {
|
|
1543
|
+
const [file, ...args] = positionals;
|
|
1544
|
+
const ran = spawnSync4(file ?? "", args, { stdio: "inherit" });
|
|
1545
|
+
if (ran.error) {
|
|
1546
|
+
console.error(`\u2717 bounded: the command did not start: ${ran.error.message}`);
|
|
1547
|
+
process.exit(127);
|
|
1548
|
+
}
|
|
1549
|
+
process.exit(exitCodeOf(ran.status, ran.signal));
|
|
1550
|
+
}
|
|
1551
|
+
const { minutes, memoryGb, waitMinutes } = commandLine.bounds;
|
|
1552
|
+
const bounds = {
|
|
1553
|
+
seconds: minutes === void 0 ? DEFAULT_BOUNDS.seconds : minutes * 60,
|
|
1554
|
+
memoryBytes: memoryGb === void 0 ? DEFAULT_BOUNDS.memoryBytes : memoryGb * 2 ** 30,
|
|
1555
|
+
waitSeconds: waitMinutes === void 0 ? DEFAULT_BOUNDS.waitSeconds : waitMinutes * 60
|
|
1556
|
+
};
|
|
1557
|
+
const outcome = await runBounded(positionals, { bounds });
|
|
1558
|
+
const verdict = boundedVerdict(outcome, bounds);
|
|
1559
|
+
if (verdict) console.error(verdict);
|
|
1560
|
+
process.exit(outcome.code);
|
|
1561
|
+
}
|
|
1361
1562
|
if (command === "ports") {
|
|
1362
1563
|
const project = positionals[0];
|
|
1363
1564
|
if (project !== void 0 && !projects.includes(project)) {
|
|
@@ -1386,7 +1587,7 @@ var report = (findings) => {
|
|
|
1386
1587
|
if (process.versions.bun && process.versions.bun !== manifest.bun) {
|
|
1387
1588
|
console.log(`\u26A0 running bun ${process.versions.bun}, blessed is ${manifest.bun} (bun upgrade)`);
|
|
1388
1589
|
}
|
|
1389
|
-
var git = (cwd, ...gitArgs) =>
|
|
1590
|
+
var git = (cwd, ...gitArgs) => spawnSync4("git", gitArgs, { cwd, encoding: "utf8" });
|
|
1390
1591
|
var behindOrigin = (cwd) => {
|
|
1391
1592
|
const behind = git(cwd, "rev-list", "--count", "HEAD..@{upstream}");
|
|
1392
1593
|
return behind.status === 0 ? Number(behind.stdout.trim()) : 0;
|
|
@@ -1508,7 +1709,7 @@ if (command === "train") {
|
|
|
1508
1709
|
const path = trainLockPath();
|
|
1509
1710
|
const lock = acquireTrainLock(path, {
|
|
1510
1711
|
pid: process.pid,
|
|
1511
|
-
hostname:
|
|
1712
|
+
hostname: hostname3(),
|
|
1512
1713
|
processStart: processStart(process.pid),
|
|
1513
1714
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1514
1715
|
lanes,
|
|
@@ -1560,7 +1761,7 @@ if (command === "train") {
|
|
|
1560
1761
|
const worktrees = [];
|
|
1561
1762
|
const removeWorktree = ({ repo, path, tooling }) => {
|
|
1562
1763
|
if (tooling) {
|
|
1563
|
-
|
|
1764
|
+
spawnSync4("bun", ["run", "worktree:destroy", basename(path), "--force"], {
|
|
1564
1765
|
cwd: repo,
|
|
1565
1766
|
stdio: "inherit"
|
|
1566
1767
|
});
|
|
@@ -1612,7 +1813,7 @@ if (command === "train") {
|
|
|
1612
1813
|
}
|
|
1613
1814
|
if (!dryRun) {
|
|
1614
1815
|
console.log(`\u2193 fast-forwarded to origin (+${behind})`);
|
|
1615
|
-
checkout.pkg = JSON.parse(readFileSync3(
|
|
1816
|
+
checkout.pkg = JSON.parse(readFileSync3(join4(checkout.dir, "package.json"), "utf8"));
|
|
1616
1817
|
}
|
|
1617
1818
|
}
|
|
1618
1819
|
return true;
|
|
@@ -1638,7 +1839,7 @@ if (command === "train") {
|
|
|
1638
1839
|
};
|
|
1639
1840
|
};
|
|
1640
1841
|
const relockAndCheck = (checkout, check = true) => effect(`re-lock ${checkout.name}${check ? " and run its check" : ""}`, void 0, () => {
|
|
1641
|
-
const install = (...flags) =>
|
|
1842
|
+
const install = (...flags) => spawnSync4("bun", ["install", ...flags], { cwd: checkout.dir, stdio: "inherit" }).status === 0;
|
|
1642
1843
|
if (!install() && !install("--no-cache")) {
|
|
1643
1844
|
throw new Abort(`bun install failed in ${checkout.name}`);
|
|
1644
1845
|
}
|
|
@@ -1646,9 +1847,9 @@ if (command === "train") {
|
|
|
1646
1847
|
checkout.dir,
|
|
1647
1848
|
inspect(checkout.dir, target()).findings
|
|
1648
1849
|
)) {
|
|
1649
|
-
|
|
1850
|
+
spawnSync4("bun", ["update", ...names], { cwd, stdio: "inherit" });
|
|
1650
1851
|
}
|
|
1651
|
-
if (check &&
|
|
1852
|
+
if (check && spawnSync4("bun", ["run", "check"], { cwd: checkout.dir, stdio: "inherit" }).status !== 0) {
|
|
1652
1853
|
throw new CheckFailed(`check failed in ${checkout.name}`);
|
|
1653
1854
|
}
|
|
1654
1855
|
});
|
|
@@ -1657,7 +1858,7 @@ if (command === "train") {
|
|
|
1657
1858
|
if (git(checkout.dir, "status", "--porcelain").stdout.trim() === "") return;
|
|
1658
1859
|
git(checkout.dir, "reset", "--quiet", "--hard", "HEAD");
|
|
1659
1860
|
git(checkout.dir, "clean", "--quiet", "-fd");
|
|
1660
|
-
|
|
1861
|
+
spawnSync4("bun", ["install", "--frozen-lockfile"], { cwd: checkout.dir, stdio: "inherit" });
|
|
1661
1862
|
});
|
|
1662
1863
|
const movesOf = (checkout) => {
|
|
1663
1864
|
const candidates2 = activeCandidates(manifest);
|
|
@@ -1721,8 +1922,8 @@ if (command === "train") {
|
|
|
1721
1922
|
};
|
|
1722
1923
|
const worktree = (checkout, branch) => {
|
|
1723
1924
|
const tooling = !!checkout.pkg.scripts?.["worktree:create"];
|
|
1724
|
-
const path = tooling ?
|
|
1725
|
-
const created = tooling ?
|
|
1925
|
+
const path = tooling ? join4(checkout.dir, ".worktrees", branch.replaceAll("/", "-")) : join4(mkdtempSync(join4(tmpdir(), "inixiative-train-")), basename(checkout.dir));
|
|
1926
|
+
const created = tooling ? spawnSync4("bun", ["run", "worktree:create", defaultBranch(checkout.dir), branch], {
|
|
1726
1927
|
cwd: checkout.dir,
|
|
1727
1928
|
stdio: "inherit"
|
|
1728
1929
|
}).status === 0 && existsSync3(path) : git(checkout.dir, "worktree", "add", "--quiet", "-b", branch, path, "HEAD").status === 0;
|
|
@@ -1740,9 +1941,9 @@ if (command === "train") {
|
|
|
1740
1941
|
(file) => /(^|\/)\.env[^/]*$/.test(file) && !/(^|\/)(node_modules|\.worktrees)\//.test(file)
|
|
1741
1942
|
);
|
|
1742
1943
|
for (const file of envFiles) {
|
|
1743
|
-
if (existsSync3(
|
|
1744
|
-
mkdirSync3(dirname3(
|
|
1745
|
-
writeFileSync3(
|
|
1944
|
+
if (existsSync3(join4(path, file))) continue;
|
|
1945
|
+
mkdirSync3(dirname3(join4(path, file)), { recursive: true });
|
|
1946
|
+
writeFileSync3(join4(path, file), readFileSync3(join4(checkout.dir, file)));
|
|
1746
1947
|
}
|
|
1747
1948
|
return { ...checkout, dir: path };
|
|
1748
1949
|
};
|
|
@@ -1763,11 +1964,11 @@ if (command === "train") {
|
|
|
1763
1964
|
...git(cwd, "ls-files", "--others", "--exclude-standard", "-z").stdout.split("\0")
|
|
1764
1965
|
].filter(Boolean);
|
|
1765
1966
|
if (changed.length === 0) return null;
|
|
1766
|
-
const scratch = mkdtempSync(
|
|
1967
|
+
const scratch = mkdtempSync(join4(tmpdir(), "inixiative-train-"));
|
|
1767
1968
|
try {
|
|
1768
|
-
const env = { ...process.env, GIT_INDEX_FILE:
|
|
1969
|
+
const env = { ...process.env, GIT_INDEX_FILE: join4(scratch, "index") };
|
|
1769
1970
|
const step = (...args) => {
|
|
1770
|
-
const result =
|
|
1971
|
+
const result = spawnSync4("git", args, { cwd, env, encoding: "utf8" });
|
|
1771
1972
|
if (result.status !== 0) {
|
|
1772
1973
|
throw new Abort(`git ${args[0]} failed capturing train:adopt's output`);
|
|
1773
1974
|
}
|
|
@@ -1805,14 +2006,14 @@ if (command === "train") {
|
|
|
1805
2006
|
const { inspection } = bumpRanges(branchCheckout);
|
|
1806
2007
|
relockAndCheck(branchCheckout, false);
|
|
1807
2008
|
const owned = [...inspection.packagePaths, "bun.lock"].filter(
|
|
1808
|
-
(path) => existsSync3(
|
|
2009
|
+
(path) => existsSync3(join4(branchCheckout.dir, path))
|
|
1809
2010
|
);
|
|
1810
2011
|
if (git(branchCheckout.dir, "add", "--", ...owned).status !== 0) {
|
|
1811
2012
|
throw new Abort(`git add failed on ${branch} in ${checkout.name}`);
|
|
1812
2013
|
}
|
|
1813
2014
|
let produced = null;
|
|
1814
2015
|
if (script) {
|
|
1815
|
-
const adopted =
|
|
2016
|
+
const adopted = spawnSync4("bun", ["run", "train:adopt"], {
|
|
1816
2017
|
cwd: branchCheckout.dir,
|
|
1817
2018
|
stdio: "inherit"
|
|
1818
2019
|
}).status === 0;
|
|
@@ -1822,7 +2023,7 @@ if (command === "train") {
|
|
|
1822
2023
|
reason = "train:adopt failed";
|
|
1823
2024
|
console.log(`\u26A0 train:adopt failed in ${checkout.name} \u2014 ${leftOut}`);
|
|
1824
2025
|
} else {
|
|
1825
|
-
const check =
|
|
2026
|
+
const check = spawnSync4("bun", ["run", "check"], {
|
|
1826
2027
|
cwd: branchCheckout.dir,
|
|
1827
2028
|
stdio: "inherit",
|
|
1828
2029
|
timeout: adoptCheckTimeout * 1e3,
|
|
@@ -1843,7 +2044,7 @@ if (command === "train") {
|
|
|
1843
2044
|
"-m",
|
|
1844
2045
|
`Train-Adopt: incomplete (${reason})`
|
|
1845
2046
|
] : ["-m", `chore: adopt ${label}`];
|
|
1846
|
-
const commit =
|
|
2047
|
+
const commit = spawnSync4("git", ["commit", ...message], {
|
|
1847
2048
|
cwd: branchCheckout.dir,
|
|
1848
2049
|
stdio: "inherit"
|
|
1849
2050
|
});
|
|
@@ -1853,7 +2054,7 @@ if (command === "train") {
|
|
|
1853
2054
|
);
|
|
1854
2055
|
}
|
|
1855
2056
|
if (reason && produced) {
|
|
1856
|
-
const saving =
|
|
2057
|
+
const saving = spawnSync4(
|
|
1857
2058
|
"git",
|
|
1858
2059
|
[
|
|
1859
2060
|
"commit-tree",
|
|
@@ -1901,14 +2102,14 @@ if (command === "train") {
|
|
|
1901
2102
|
if (dryRun && !changes) return false;
|
|
1902
2103
|
return effect(`commit its package.json files + bun.lock in ${checkout.name}`, true, () => {
|
|
1903
2104
|
const tracked = [...packagePaths, "bun.lock"].filter(
|
|
1904
|
-
(path) => existsSync3(
|
|
2105
|
+
(path) => existsSync3(join4(checkout.dir, path))
|
|
1905
2106
|
);
|
|
1906
2107
|
const mutated = git(checkout.dir, "status", "--porcelain", "--", ...tracked);
|
|
1907
2108
|
if (mutated.status !== 0 || mutated.stdout.trim().length === 0) return false;
|
|
1908
2109
|
if (git(checkout.dir, "add", "--", ...tracked).status !== 0) {
|
|
1909
2110
|
throw new Abort(`git add failed in ${checkout.name} \u2014 is bun.lock ignored?`);
|
|
1910
2111
|
}
|
|
1911
|
-
const commit =
|
|
2112
|
+
const commit = spawnSync4("git", ["commit", "-m", message], {
|
|
1912
2113
|
cwd: checkout.dir,
|
|
1913
2114
|
stdio: "inherit"
|
|
1914
2115
|
});
|
|
@@ -1926,24 +2127,24 @@ if (command === "train") {
|
|
|
1926
2127
|
});
|
|
1927
2128
|
const publishToNpm = (checkout, entry) => {
|
|
1928
2129
|
if (entry.path === "package.json") {
|
|
1929
|
-
return
|
|
2130
|
+
return spawnSync4("npm", ["publish"], { cwd: checkout.dir, stdio: "inherit" }).status === 0;
|
|
1930
2131
|
}
|
|
1931
|
-
const memberDir =
|
|
1932
|
-
const out = mkdtempSync(
|
|
2132
|
+
const memberDir = join4(checkout.dir, dirname3(entry.path));
|
|
2133
|
+
const out = mkdtempSync(join4(tmpdir(), "inixiative-train-"));
|
|
1933
2134
|
try {
|
|
1934
|
-
const pack =
|
|
2135
|
+
const pack = spawnSync4("bun", ["pm", "pack", "--destination", out], {
|
|
1935
2136
|
cwd: memberDir,
|
|
1936
2137
|
stdio: "inherit"
|
|
1937
2138
|
});
|
|
1938
2139
|
const tarball = readdirSync3(out).find((name) => name.endsWith(".tgz"));
|
|
1939
2140
|
if (pack.status !== 0 || !tarball) return false;
|
|
1940
|
-
return
|
|
2141
|
+
return spawnSync4("npm", ["publish", join4(out, tarball)], { cwd: memberDir, stdio: "inherit" }).status === 0;
|
|
1941
2142
|
} finally {
|
|
1942
2143
|
rmSync3(out, { recursive: true, force: true });
|
|
1943
2144
|
}
|
|
1944
2145
|
};
|
|
1945
2146
|
const npmLatest = (name) => {
|
|
1946
|
-
const remote =
|
|
2147
|
+
const remote = spawnSync4("npm", ["view", `${name}@latest`, "version"], { encoding: "utf8" });
|
|
1947
2148
|
return remote.status === 0 ? remote.stdout.trim() : null;
|
|
1948
2149
|
};
|
|
1949
2150
|
for (const { lane: lane2, checkouts, missing, ambiguous } of plan.lanes) {
|
|
@@ -1972,7 +2173,7 @@ if (command === "train") {
|
|
|
1972
2173
|
continue;
|
|
1973
2174
|
}
|
|
1974
2175
|
const releases = checkout.packages.map((entry) => {
|
|
1975
|
-
const local = JSON.parse(readFileSync3(
|
|
2176
|
+
const local = JSON.parse(readFileSync3(join4(checkout.dir, entry.path), "utf8")).version ?? "0.0.0";
|
|
1976
2177
|
const remote = npmLatest(entry.name);
|
|
1977
2178
|
return { entry, local, remote, ahead: remote === null || compare(local, remote) > 0 };
|
|
1978
2179
|
});
|
|
@@ -2169,7 +2370,7 @@ blessed: ${promoted.length === 0 ? "nothing" : promoted.join(", ")}`);
|
|
|
2169
2370
|
version = bumpPatch(remoteVersion);
|
|
2170
2371
|
const bumped = version;
|
|
2171
2372
|
effect(`bump @inixiative/config to ${bumped} in package.json`, void 0, () => {
|
|
2172
|
-
const pkgPath =
|
|
2373
|
+
const pkgPath = join4(packageRoot, "package.json");
|
|
2173
2374
|
const pkg = JSON.parse(readFileSync3(pkgPath, "utf8"));
|
|
2174
2375
|
pkg.version = bumped;
|
|
2175
2376
|
writeFileSync3(pkgPath, `${JSON.stringify(pkg, null, 2)}
|
|
@@ -2191,7 +2392,7 @@ blessed: ${promoted.length === 0 ? "nothing" : promoted.join(", ")}`);
|
|
|
2191
2392
|
}
|
|
2192
2393
|
);
|
|
2193
2394
|
effect("run bun run check in @inixiative/config", void 0, () => {
|
|
2194
|
-
const check =
|
|
2395
|
+
const check = spawnSync4("bun", ["run", "check"], { cwd: packageRoot, stdio: "inherit" });
|
|
2195
2396
|
if (check.status !== 0) {
|
|
2196
2397
|
console.error("\u2717 check failed in @inixiative/config \u2014 aborting before publish");
|
|
2197
2398
|
process.exit(1);
|
|
@@ -2202,12 +2403,12 @@ blessed: ${promoted.length === 0 ? "nothing" : promoted.join(", ")}`);
|
|
|
2202
2403
|
recorded.length > 0 ? `candidate ${recorded.join(", ")}` : ""
|
|
2203
2404
|
].filter(Boolean).join("; ") || "release"} \u2014 ${version}`;
|
|
2204
2405
|
effect(`commit "${message}" in @inixiative/config`, void 0, () => {
|
|
2205
|
-
|
|
2406
|
+
spawnSync4("git", ["add", "--", "package.json", "versions.json", "test/fixtures"], {
|
|
2206
2407
|
cwd: packageRoot
|
|
2207
2408
|
});
|
|
2208
|
-
if (
|
|
2409
|
+
if (spawnSync4("git", ["diff", "--cached", "--quiet"], { cwd: packageRoot }).status === 0)
|
|
2209
2410
|
return;
|
|
2210
|
-
const commit =
|
|
2411
|
+
const commit = spawnSync4("git", ["commit", "-m", message], {
|
|
2211
2412
|
cwd: packageRoot,
|
|
2212
2413
|
stdio: "inherit"
|
|
2213
2414
|
});
|
|
@@ -2217,7 +2418,7 @@ blessed: ${promoted.length === 0 ? "nothing" : promoted.join(", ")}`);
|
|
|
2217
2418
|
}
|
|
2218
2419
|
});
|
|
2219
2420
|
effect(`publish @inixiative/config@${version} to npm`, void 0, () => {
|
|
2220
|
-
const publish2 =
|
|
2421
|
+
const publish2 = spawnSync4("npm", ["publish"], { cwd: packageRoot, stdio: "inherit" });
|
|
2221
2422
|
if (publish2.status !== 0 || !servedByRegistry("@inixiative/config", version)) {
|
|
2222
2423
|
console.error("\u2717 publish failed for @inixiative/config");
|
|
2223
2424
|
process.exit(1);
|
|
@@ -2262,14 +2463,14 @@ dry run complete \u2014 a real train would commit in ${committed.size} repo(s) a
|
|
|
2262
2463
|
console.log(` ${repoDir} (${branch})`);
|
|
2263
2464
|
} else if (commandLine.push) {
|
|
2264
2465
|
for (const repoDir of committed) {
|
|
2265
|
-
if (
|
|
2466
|
+
if (spawnSync4("git", ["push"], { cwd: repoDir, stdio: "inherit" }).status !== 0) {
|
|
2266
2467
|
console.error(`\u2717 push failed in ${repoDir}`);
|
|
2267
2468
|
process.exit(1);
|
|
2268
2469
|
}
|
|
2269
2470
|
}
|
|
2270
2471
|
for (const { dir: repoDir, branch, output } of adoptionBranches) {
|
|
2271
2472
|
for (const ref of output ? [branch, output] : [branch]) {
|
|
2272
|
-
const push =
|
|
2473
|
+
const push = spawnSync4("git", ["push", "-u", "origin", ref], {
|
|
2273
2474
|
cwd: repoDir,
|
|
2274
2475
|
stdio: "inherit"
|
|
2275
2476
|
});
|
|
@@ -2314,7 +2515,7 @@ function currentBranch(cwd) {
|
|
|
2314
2515
|
function servedByRegistry(name, version) {
|
|
2315
2516
|
const deadline = Date.now() + 15 * 6e4;
|
|
2316
2517
|
while (true) {
|
|
2317
|
-
const view =
|
|
2518
|
+
const view = spawnSync4("npm", ["view", `${name}@${version}`, "version", "--prefer-online"], {
|
|
2318
2519
|
encoding: "utf8"
|
|
2319
2520
|
});
|
|
2320
2521
|
if (view.status === 0 && view.stdout.trim() === version) return true;
|
|
@@ -2327,12 +2528,12 @@ function bumpPatch(version) {
|
|
|
2327
2528
|
return `${major}.${minor}.${(patch ?? 0) + 1}`;
|
|
2328
2529
|
}
|
|
2329
2530
|
function fixtureDirs() {
|
|
2330
|
-
const root =
|
|
2531
|
+
const root = join4(packageRoot, "test", "fixtures");
|
|
2331
2532
|
if (!existsSync3(root)) return [];
|
|
2332
|
-
return readdirSync3(root).map((name) =>
|
|
2533
|
+
return readdirSync3(root).map((name) => join4(root, name)).filter((dir2) => existsSync3(join4(dir2, "package.json")));
|
|
2333
2534
|
}
|
|
2334
|
-
if (existsSync3(
|
|
2335
|
-
const status =
|
|
2535
|
+
if (existsSync3(join4(dir, ".git")) && !commandLine.force) {
|
|
2536
|
+
const status = spawnSync4("git", ["status", "--porcelain"], { cwd: dir, encoding: "utf8" });
|
|
2336
2537
|
if (status.status === 0 && status.stdout.trim().length > 0) {
|
|
2337
2538
|
console.error("\u2717 working tree dirty \u2014 commit first or pass --force");
|
|
2338
2539
|
process.exit(1);
|
|
@@ -2350,10 +2551,10 @@ if (!commandLine.noInstall) {
|
|
|
2350
2551
|
)
|
|
2351
2552
|
);
|
|
2352
2553
|
for (const member of relinked) {
|
|
2353
|
-
rmSync3(
|
|
2554
|
+
rmSync3(join4(dir, member, "node_modules"), { recursive: true, force: true });
|
|
2354
2555
|
}
|
|
2355
2556
|
const install = (...extra) => {
|
|
2356
|
-
if (
|
|
2557
|
+
if (spawnSync4("bun", ["install", ...extra], { cwd: dir, stdio: "inherit" }).status !== 0) {
|
|
2357
2558
|
console.error("\u2717 bun install failed");
|
|
2358
2559
|
process.exit(1);
|
|
2359
2560
|
}
|
|
@@ -2365,7 +2566,7 @@ if (!commandLine.noInstall) {
|
|
|
2365
2566
|
installed = inspect(dir, manifest, presetFlag);
|
|
2366
2567
|
}
|
|
2367
2568
|
for (const { cwd, names } of staleUpdates(dir, installed.findings)) {
|
|
2368
|
-
if (
|
|
2569
|
+
if (spawnSync4("bun", ["update", ...names], { cwd, stdio: "inherit" }).status !== 0) {
|
|
2369
2570
|
console.error(`\u2717 bun update failed in ${cwd}`);
|
|
2370
2571
|
process.exit(1);
|
|
2371
2572
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inixiative/config",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.235",
|
|
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",
|
package/versions.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@types/bun"
|
|
14
14
|
],
|
|
15
15
|
"ecosystem": {
|
|
16
|
-
"@inixiative/config": "0.5.
|
|
16
|
+
"@inixiative/config": "0.5.235",
|
|
17
17
|
"@inixiative/field-map": "0.1.1",
|
|
18
18
|
"@inixiative/json-rules": "3.16.0",
|
|
19
19
|
"@inixiative/permissions": "0.21.1",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@inixiative/signet": "0.25.0",
|
|
58
58
|
"@inixiative/foundry": "0.5.12",
|
|
59
59
|
"@inixiative/permissions": "0.25.0",
|
|
60
|
-
"@inixiative/agent-session": "0.
|
|
60
|
+
"@inixiative/agent-session": "0.21.0",
|
|
61
61
|
"@inixiative/field-map": "0.1.2"
|
|
62
62
|
}
|
|
63
63
|
}
|