@nice-code/commander 0.110.0 → 0.111.0
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/build/cli.cjs +351 -19
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +343 -20
- package/build/cli.mjs.map +1 -1
- package/build/client/assets/{index-DLZZdohI.css → index-B5u-kfUT.css} +1 -1
- package/build/client/assets/{index-dItAKcyH.js → index-ChNWrJqv.js} +5 -5
- package/build/client/assets/{index-dItAKcyH.js.map → index-ChNWrJqv.js.map} +1 -1
- package/build/client/index.html +2 -2
- package/build/config.cjs.map +1 -1
- package/build/config.d.cts +19 -1
- package/build/config.d.mts +19 -1
- package/build/config.mjs.map +1 -1
- package/build/{main-CVu9gjbx.cjs → main-C3BG9bju.cjs} +157 -75
- package/build/main-C3BG9bju.cjs.map +1 -0
- package/build/{main-CWWlV2U5.mjs → main-DSPhWTfM.mjs} +159 -77
- package/build/main-DSPhWTfM.mjs.map +1 -0
- package/build/types-B3WIUo4S.mjs.map +1 -1
- package/build/types-CIdWQGjF.cjs.map +1 -1
- package/package.json +6 -6
- package/build/main-CVu9gjbx.cjs.map +0 -1
- package/build/main-CWWlV2U5.mjs.map +0 -1
package/build/cli.mjs
CHANGED
|
@@ -27,7 +27,11 @@ const GLOBAL_VALUE_FLAGS = new Set(["--config", "--timeout"]);
|
|
|
27
27
|
* plain Map keeps only the last. The name still lands in `flags` so `unknownFlags` keeps rejecting
|
|
28
28
|
* it on every command that does not accept it.
|
|
29
29
|
*/
|
|
30
|
-
const REPEATABLE_VALUE_FLAGS = new Set([
|
|
30
|
+
const REPEATABLE_VALUE_FLAGS = new Set([
|
|
31
|
+
"--set",
|
|
32
|
+
"--unset",
|
|
33
|
+
"--with"
|
|
34
|
+
]);
|
|
31
35
|
/**
|
|
32
36
|
* Per-command flags that take a VALUE. Everything else is boolean — and that distinction is
|
|
33
37
|
* load-bearing: a greedy "consume the next token" parse turned `up --no-wait demo` into
|
|
@@ -39,6 +43,7 @@ function parseCliArgs(argv) {
|
|
|
39
43
|
const flags = /* @__PURE__ */ new Map();
|
|
40
44
|
const repeated = /* @__PURE__ */ new Map();
|
|
41
45
|
const positionals = [];
|
|
46
|
+
const passthrough = [];
|
|
42
47
|
let command = null;
|
|
43
48
|
let json = false;
|
|
44
49
|
let noColor = false;
|
|
@@ -47,6 +52,10 @@ function parseCliArgs(argv) {
|
|
|
47
52
|
let timeoutMs;
|
|
48
53
|
for (let i = 0; i < argv.length; i += 1) {
|
|
49
54
|
const token = argv[i];
|
|
55
|
+
if (token === "--") {
|
|
56
|
+
passthrough.push(...argv.slice(i + 1));
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
50
59
|
const eq = token.startsWith("--") ? token.indexOf("=") : -1;
|
|
51
60
|
const arg = eq > 2 ? token.slice(0, eq) : token;
|
|
52
61
|
const inlineValue = eq > 2 ? token.slice(eq + 1) : null;
|
|
@@ -109,7 +118,8 @@ function parseCliArgs(argv) {
|
|
|
109
118
|
noColor,
|
|
110
119
|
help,
|
|
111
120
|
flags,
|
|
112
|
-
repeated
|
|
121
|
+
repeated,
|
|
122
|
+
passthrough
|
|
113
123
|
};
|
|
114
124
|
if (configPath != null) args.configPath = configPath;
|
|
115
125
|
if (timeoutMs != null) args.timeoutMs = timeoutMs;
|
|
@@ -152,7 +162,7 @@ function validStartStamp(value) {
|
|
|
152
162
|
function isInstanceRecord(value) {
|
|
153
163
|
if (value == null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
154
164
|
const record = value;
|
|
155
|
-
return record.service === "nice-commander" && boundedString(record.instanceId) && boundedInt(record.generation, 0, Number.MAX_SAFE_INTEGER) && boundedInt(record.pid, 1, Number.MAX_SAFE_INTEGER) && boundedInt(record.port, 1, 65535) && boundedString(record.token) && boundedString(record.configKey) && boundedString(record.configRevisionHash) && boundedString(record.configPath) && boundedString(record.packageVersion) && boundedString(record.realmSchemaHash) && validStartStamp(record.startStamp) && (record.servesOwnClient == null || typeof record.servesOwnClient === "boolean") && record.protocolVersion ===
|
|
165
|
+
return record.service === "nice-commander" && boundedString(record.instanceId) && boundedInt(record.generation, 0, Number.MAX_SAFE_INTEGER) && boundedInt(record.pid, 1, Number.MAX_SAFE_INTEGER) && boundedInt(record.port, 1, 65535) && boundedString(record.token) && boundedString(record.configKey) && boundedString(record.configRevisionHash) && boundedString(record.configPath) && boundedString(record.packageVersion) && boundedString(record.realmSchemaHash) && validStartStamp(record.startStamp) && (record.servesOwnClient == null || typeof record.servesOwnClient === "boolean") && record.protocolVersion === 8;
|
|
156
166
|
}
|
|
157
167
|
async function writeInstanceRecord(path, record) {
|
|
158
168
|
await mkdir(dirname(path), {
|
|
@@ -202,7 +212,7 @@ async function readSkewedInstanceRecord(path, expectedRealmSchemaHash) {
|
|
|
202
212
|
if (!boundedInt(record["protocolVersion"], 0, Number.MAX_SAFE_INTEGER)) return null;
|
|
203
213
|
if (!boundedInt(record["pid"], 1, Number.MAX_SAFE_INTEGER)) return null;
|
|
204
214
|
if (!boundedInt(record["port"], 1, 65535)) return null;
|
|
205
|
-
const sameProtocol = record["protocolVersion"] ===
|
|
215
|
+
const sameProtocol = record["protocolVersion"] === 8;
|
|
206
216
|
const sameRealm = boundedString(record["realmSchemaHash"]) && record["realmSchemaHash"] === expectedRealmSchemaHash;
|
|
207
217
|
if (sameProtocol && sameRealm) return null;
|
|
208
218
|
return {
|
|
@@ -298,6 +308,31 @@ async function pingDaemon(record, timeoutMs = 2e3) {
|
|
|
298
308
|
}
|
|
299
309
|
}
|
|
300
310
|
//#endregion
|
|
311
|
+
//#region src/config/flags.ts
|
|
312
|
+
/**
|
|
313
|
+
* An argument a shell-string `run` can take appended unquoted in sh, cmd and PowerShell alike.
|
|
314
|
+
* Anything else (spaces, quotes, `$`, `%`, `,`, `;`…) would need per-shell quoting.
|
|
315
|
+
*/
|
|
316
|
+
const SHELL_PLAIN_ARG = /^[A-Za-z0-9_+=:./-]+$/;
|
|
317
|
+
/** `run` with `args` appended — after the argv, or after the shell string. */
|
|
318
|
+
function runWithArgs(run, args) {
|
|
319
|
+
if (args.length === 0) return run;
|
|
320
|
+
return typeof run === "string" ? `${run} ${args.join(" ")}` : [...run, ...args];
|
|
321
|
+
}
|
|
322
|
+
/** Requested names against a definition's declared flags; an undeclared name is an error. */
|
|
323
|
+
function resolveFlags(definition, names) {
|
|
324
|
+
const unknown = names.filter((name) => !definition.flags.some((flag) => flag.name === name));
|
|
325
|
+
if (unknown.length > 0) {
|
|
326
|
+
const declared = definition.flags.map((flag) => flag.name);
|
|
327
|
+
return { error: `"${definition.id}" declares no flag ${unknown.map((name) => `"${name}"`).join(", ")} — ` + (declared.length > 0 ? `its flags: ${declared.join(", ")}` : "it declares none") };
|
|
328
|
+
}
|
|
329
|
+
const on = definition.flags.filter((flag) => names.includes(flag.name));
|
|
330
|
+
return {
|
|
331
|
+
flags: on.map((flag) => flag.name),
|
|
332
|
+
args: on.flatMap((flag) => flag.args)
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
//#endregion
|
|
301
336
|
//#region src/config/tags.ts
|
|
302
337
|
/** `key=value` → `[key, value]`, or null when the term is not tag-shaped. */
|
|
303
338
|
function parseTagTerm(term) {
|
|
@@ -833,6 +868,54 @@ function readEnvVarFields(declared, name, at, errors) {
|
|
|
833
868
|
required: required === true
|
|
834
869
|
};
|
|
835
870
|
}
|
|
871
|
+
const MAX_FLAGS = 32;
|
|
872
|
+
function readFlags(raw, shellString, at, errors) {
|
|
873
|
+
if (raw == null) return [];
|
|
874
|
+
if (!Array.isArray(raw)) {
|
|
875
|
+
errors.push(`${at}.flags: expected an array of flag declarations`);
|
|
876
|
+
return [];
|
|
877
|
+
}
|
|
878
|
+
if (raw.length > MAX_FLAGS) errors.push(`${at}.flags: ${raw.length} entries exceeds the ${MAX_FLAGS} bound`);
|
|
879
|
+
const flags = [];
|
|
880
|
+
for (const [index, declared] of raw.entries()) {
|
|
881
|
+
const atF = `${at}.flags[${index}]`;
|
|
882
|
+
if (!isRecord(declared)) {
|
|
883
|
+
errors.push(`${atF}: expected an object`);
|
|
884
|
+
continue;
|
|
885
|
+
}
|
|
886
|
+
const name = declared["name"];
|
|
887
|
+
if (typeof name !== "string" || !COMMANDER_ID_PATTERN.test(name)) {
|
|
888
|
+
errors.push(`${atF}.name: must match ${COMMANDER_ID_PATTERN}`);
|
|
889
|
+
continue;
|
|
890
|
+
}
|
|
891
|
+
if (flags.some((existing) => existing.name === name)) {
|
|
892
|
+
errors.push(`${atF}.name: duplicate flag "${name}"`);
|
|
893
|
+
continue;
|
|
894
|
+
}
|
|
895
|
+
const description = declared["description"];
|
|
896
|
+
if (description != null && typeof description !== "string") {
|
|
897
|
+
errors.push(`${atF}.description: expected a string`);
|
|
898
|
+
continue;
|
|
899
|
+
}
|
|
900
|
+
const rawArgs = declared["args"] ?? [`--${name}`];
|
|
901
|
+
if (!Array.isArray(rawArgs) || rawArgs.length === 0 || rawArgs.some((arg) => typeof arg !== "string" || arg === "" || hasControlChars(arg))) {
|
|
902
|
+
errors.push(`${atF}.args: expected a non-empty array of non-empty strings`);
|
|
903
|
+
continue;
|
|
904
|
+
}
|
|
905
|
+
const args = rawArgs.filter((arg) => typeof arg === "string");
|
|
906
|
+
const unquotable = shellString ? args.find((arg) => !SHELL_PLAIN_ARG.test(arg)) : void 0;
|
|
907
|
+
if (unquotable != null) {
|
|
908
|
+
errors.push(`${atF}.args: ${JSON.stringify(unquotable)} would need shell quoting, and a shell-string \`run\` takes its flags unquoted — use the argv form of \`run\`, or a plain argument`);
|
|
909
|
+
continue;
|
|
910
|
+
}
|
|
911
|
+
flags.push({
|
|
912
|
+
name,
|
|
913
|
+
args,
|
|
914
|
+
...typeof description === "string" ? { description } : {}
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
return flags;
|
|
918
|
+
}
|
|
836
919
|
function isUrlCleanHttp(url) {
|
|
837
920
|
try {
|
|
838
921
|
const parsed = new URL(url);
|
|
@@ -1012,6 +1095,7 @@ function validateCommanderConfig(raw, anchor) {
|
|
|
1012
1095
|
if (resolved != null) envVars.push(resolved);
|
|
1013
1096
|
}
|
|
1014
1097
|
for (const declared of envVars) if (declared.default != null) env[declared.name] = declared.default;
|
|
1098
|
+
const flags = readFlags(proc.flags, typeof proc.run === "string", at, errors);
|
|
1015
1099
|
const tagEntries = Object.entries({
|
|
1016
1100
|
...config.defaults?.tags,
|
|
1017
1101
|
...proc.tags
|
|
@@ -1115,6 +1199,7 @@ function validateCommanderConfig(raw, anchor) {
|
|
|
1115
1199
|
...proc.shell != null ? { shell: proc.shell } : {},
|
|
1116
1200
|
env,
|
|
1117
1201
|
envVars,
|
|
1202
|
+
flags,
|
|
1118
1203
|
stdin,
|
|
1119
1204
|
tags,
|
|
1120
1205
|
optIn: proc.optIn === true,
|
|
@@ -1307,6 +1392,28 @@ function selectOrExit(ctx, options) {
|
|
|
1307
1392
|
if (!result.ok) throw new CliExit(EXIT.usage, result.errors.join("\n"));
|
|
1308
1393
|
return result.selection;
|
|
1309
1394
|
}
|
|
1395
|
+
/**
|
|
1396
|
+
* The one process a per-process option (`--with`, `-- args`) applies to: the selection must be
|
|
1397
|
+
* exactly its id — a flag set means nothing to a suite or a tag.
|
|
1398
|
+
*/
|
|
1399
|
+
function singleProcessOrExit(ctx, option) {
|
|
1400
|
+
const [term, ...rest] = ctx.args.positionals;
|
|
1401
|
+
const definition = ctx.config.processes.find((proc) => proc.id === term);
|
|
1402
|
+
if (definition == null || rest.length > 0 || ctx.args.flags.has("--all")) throw new CliExit(EXIT.usage, `${option} applies to one process — select it by its id alone (\`${ctx.args.command} <id> ${option} …\`)`);
|
|
1403
|
+
return definition;
|
|
1404
|
+
}
|
|
1405
|
+
/** `--with a --with b` / `--with a,b`, resolved against the selected process's declared flags. */
|
|
1406
|
+
function flagsOrExit(ctx) {
|
|
1407
|
+
const raw = ctx.args.repeated.get("--with") ?? [];
|
|
1408
|
+
if (raw.length === 0) return null;
|
|
1409
|
+
const definition = singleProcessOrExit(ctx, "--with");
|
|
1410
|
+
const resolved = resolveFlags(definition, raw.flatMap((value) => value.split(",")).filter((name) => name !== ""));
|
|
1411
|
+
if ("error" in resolved) throw new CliExit(EXIT.usage, resolved.error);
|
|
1412
|
+
return {
|
|
1413
|
+
id: definition.id,
|
|
1414
|
+
...resolved
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1310
1417
|
/** Suite stagger for a start: the widest stagger among the suites named in the terms. */
|
|
1311
1418
|
function staggerFor(config, terms) {
|
|
1312
1419
|
let stagger = 0;
|
|
@@ -24430,7 +24537,8 @@ function commanderStatePaths(dataDir, configKey) {
|
|
|
24430
24537
|
ingestSeqPath: join(stateDir, "ingest-seq"),
|
|
24431
24538
|
envOverridesPath: join(stateDir, "env-overrides.json"),
|
|
24432
24539
|
savedFiltersPath: join(stateDir, "saved-filters.json"),
|
|
24433
|
-
lastStartsPath: join(stateDir, "last-starts.json")
|
|
24540
|
+
lastStartsPath: join(stateDir, "last-starts.json"),
|
|
24541
|
+
taskDurationsPath: join(stateDir, "task-durations.json")
|
|
24434
24542
|
};
|
|
24435
24543
|
}
|
|
24436
24544
|
async function ensureStateDir(paths) {
|
|
@@ -24495,6 +24603,8 @@ const commanderStatusRealm = defineRealm({
|
|
|
24495
24603
|
pid: t.optional(t.number()),
|
|
24496
24604
|
startedAt: t.optional(t.number()),
|
|
24497
24605
|
lastStartedAt: t.optional(t.number()),
|
|
24606
|
+
flags: t.array(t.string()),
|
|
24607
|
+
estimatedMs: t.optional(t.number()),
|
|
24498
24608
|
sawOutputAt: t.optional(t.number()),
|
|
24499
24609
|
lastTask: t.optional(t.object({
|
|
24500
24610
|
outcome: t.string(),
|
|
@@ -24551,6 +24661,11 @@ const commanderStatusRealm = defineRealm({
|
|
|
24551
24661
|
values: t.optional(t.array(t.string())),
|
|
24552
24662
|
source: t.string(),
|
|
24553
24663
|
value: t.optional(t.string())
|
|
24664
|
+
})),
|
|
24665
|
+
flags: t.array(t.object({
|
|
24666
|
+
name: t.string(),
|
|
24667
|
+
args: t.string(),
|
|
24668
|
+
description: t.optional(t.string())
|
|
24554
24669
|
}))
|
|
24555
24670
|
})
|
|
24556
24671
|
})),
|
|
@@ -24710,7 +24825,7 @@ var CommanderDaemonBootError = class extends Error {
|
|
|
24710
24825
|
* a live dev environment, and an upgrade must never be the thing that kills one.
|
|
24711
24826
|
*/
|
|
24712
24827
|
async function replaceSkewedDaemon(paths, skewed) {
|
|
24713
|
-
const daemonLabel = `the daemon for this config (pid ${skewed.pid}, build ${skewed.packageVersion}, protocol v${skewed.protocolVersion}) predates this CLI (protocol
|
|
24828
|
+
const daemonLabel = `the daemon for this config (pid ${skewed.pid}, build ${skewed.packageVersion}, protocol v${skewed.protocolVersion}) predates this CLI (protocol v8${skewed.skew === "realm-schema" ? ", different status schema" : ""})`;
|
|
24714
24829
|
let liveIds;
|
|
24715
24830
|
try {
|
|
24716
24831
|
liveIds = (await openProcessLedger({
|
|
@@ -24940,8 +25055,50 @@ function checkStart(value) {
|
|
|
24940
25055
|
if (wait != null) input.wait = wait;
|
|
24941
25056
|
if (staggerMs != null) input.staggerMs = staggerMs;
|
|
24942
25057
|
if (replaceSame != null) input.replaceSame = replaceSame;
|
|
25058
|
+
if (record["flags"] != null) {
|
|
25059
|
+
const flags = checkFlagsById(record["flags"]);
|
|
25060
|
+
if (typeof flags === "string") return `flags${flags}`;
|
|
25061
|
+
input.flags = flags;
|
|
25062
|
+
}
|
|
24943
25063
|
return input;
|
|
24944
25064
|
}
|
|
25065
|
+
function checkFlagsById(value) {
|
|
25066
|
+
const record = asRecord(value);
|
|
25067
|
+
if (record == null) return ": expected an object keyed by process id";
|
|
25068
|
+
const checked = {};
|
|
25069
|
+
for (const [id, names] of Object.entries(record)) {
|
|
25070
|
+
const list = asIdList(names);
|
|
25071
|
+
if (list == null) return `[${JSON.stringify(id)}]: expected an array of flag names`;
|
|
25072
|
+
checked[id] = list;
|
|
25073
|
+
}
|
|
25074
|
+
return checked;
|
|
25075
|
+
}
|
|
25076
|
+
function checkNoteRuns(value) {
|
|
25077
|
+
const runs = asRecord(value)?.["runs"];
|
|
25078
|
+
if (!Array.isArray(runs)) return "runs: expected an array";
|
|
25079
|
+
const checked = [];
|
|
25080
|
+
for (const entry of runs) {
|
|
25081
|
+
const run = asRecord(entry);
|
|
25082
|
+
if (run == null) return "runs: expected objects";
|
|
25083
|
+
const { id, startedAt, durationMs } = run;
|
|
25084
|
+
const flags = asIdList(run["flags"]);
|
|
25085
|
+
if (typeof id !== "string" || id === "") return "runs: id expected a process id";
|
|
25086
|
+
if (typeof startedAt !== "number" || !Number.isFinite(startedAt)) return "runs: startedAt expected epoch ms";
|
|
25087
|
+
if (flags == null) return "runs: flags expected an array of flag names";
|
|
25088
|
+
if (durationMs != null && (typeof durationMs !== "number" || !(durationMs >= 0))) return "runs: durationMs expected a non-negative number";
|
|
25089
|
+
checked.push(typeof durationMs === "number" ? {
|
|
25090
|
+
id,
|
|
25091
|
+
startedAt,
|
|
25092
|
+
flags,
|
|
25093
|
+
durationMs
|
|
25094
|
+
} : {
|
|
25095
|
+
id,
|
|
25096
|
+
startedAt,
|
|
25097
|
+
flags
|
|
25098
|
+
});
|
|
25099
|
+
}
|
|
25100
|
+
return { runs: checked };
|
|
25101
|
+
}
|
|
24945
25102
|
function checkSetEnv(value) {
|
|
24946
25103
|
const record = asRecord(value);
|
|
24947
25104
|
if (record == null) return "expected an object";
|
|
@@ -25133,6 +25290,7 @@ const commanderControlDomain = createActionRootDomain({ domain: "commander" }).c
|
|
|
25133
25290
|
saveFilter: actionSchema().input({ schema: handSchema(checkSaveFilter) }).output({ schema: handSchema(checkOk) }),
|
|
25134
25291
|
removeFilter: actionSchema().input({ schema: handSchema(checkRemoveFilter) }).output({ schema: handSchema(checkOk) }),
|
|
25135
25292
|
setEnv: actionSchema().input({ schema: handSchema(checkSetEnv) }).output({ schema: handSchema(checkEnvReport) }),
|
|
25293
|
+
noteRuns: actionSchema().input({ schema: handSchema(checkNoteRuns) }).output({ schema: handSchema(checkOk) }),
|
|
25136
25294
|
reloadConfig: actionSchema().input({ schema: handSchema(checkEmpty) }).output({ schema: handSchema(checkReloadResult) }),
|
|
25137
25295
|
shutdown: actionSchema().input({ schema: handSchema(checkEmpty) }).output({ schema: handSchema(checkOk) })
|
|
25138
25296
|
}
|
|
@@ -25178,7 +25336,7 @@ async function findDaemon(config) {
|
|
|
25178
25336
|
async function findSkewedDaemon(config) {
|
|
25179
25337
|
const skewed = await readSkewedInstanceRecord(commanderStatePaths(resolveCommanderDataDir(), config.configKey).instanceRecordPath, commanderStatusRealm.schemaHash);
|
|
25180
25338
|
if (skewed == null || !pidAlive$1(skewed.pid)) return null;
|
|
25181
|
-
const difference = skewed.skew === "protocol" ? `speaks protocol v${skewed.protocolVersion}; this build speaks
|
|
25339
|
+
const difference = skewed.skew === "protocol" ? `speaks protocol v${skewed.protocolVersion}; this build speaks v8` : "was started before an upgrade changed the status schema";
|
|
25182
25340
|
return {
|
|
25183
25341
|
message: `the daemon for this config (pid ${skewed.pid}, port ${skewed.port}, build ${skewed.packageVersion}) ${difference} — this CLI (build ${await commanderPackageVersion()}) cannot talk to it. Run \`nice-commander shutdown\` (it stops a daemon from any build), then retry.`,
|
|
25184
25342
|
pid: skewed.pid,
|
|
@@ -25288,7 +25446,7 @@ async function connectDaemon(handle) {
|
|
|
25288
25446
|
const payload = await (await runtime.handleActionPayload(request)).waitForResultPayload();
|
|
25289
25447
|
if (!payload.result.ok) throw new CliExit(EXIT.failure, `action "${action}" rejected by the daemon`);
|
|
25290
25448
|
const report = parseActionReport(payload.result.output);
|
|
25291
|
-
if (report == null) throw new CliExit(EXIT.failure, `the daemon answered "${action}" with something this CLI does not recognise — protocol ${record.protocolVersion} vs
|
|
25449
|
+
if (report == null) throw new CliExit(EXIT.failure, `the daemon answered "${action}" with something this CLI does not recognise — protocol ${record.protocolVersion} vs 8`);
|
|
25292
25450
|
return report;
|
|
25293
25451
|
},
|
|
25294
25452
|
setEnv: async (input) => {
|
|
@@ -25298,6 +25456,10 @@ async function connectDaemon(handle) {
|
|
|
25298
25456
|
const warnings = payload.result.output.warnings;
|
|
25299
25457
|
return Array.isArray(warnings) ? warnings.filter((entry) => typeof entry === "string") : [];
|
|
25300
25458
|
},
|
|
25459
|
+
noteRuns: async (input) => {
|
|
25460
|
+
const request = commanderControlDomain.actionForId("noteRuns").request(input);
|
|
25461
|
+
if (!(await (await runtime.handleActionPayload(request)).waitForResultPayload()).result.ok) throw new CliExit(EXIT.failure, `action "noteRuns" rejected by the daemon`);
|
|
25462
|
+
},
|
|
25301
25463
|
shutdown: async () => {
|
|
25302
25464
|
const request = commanderControlDomain.actionForId("shutdown").request({});
|
|
25303
25465
|
if (!(await (await runtime.handleActionPayload(request)).waitForResultPayload()).result.ok) throw new CliExit(EXIT.failure, `action "shutdown" rejected by the daemon`);
|
|
@@ -25412,11 +25574,13 @@ async function cmdUp(ctx) {
|
|
|
25412
25574
|
"--no-wait",
|
|
25413
25575
|
"--dry-run",
|
|
25414
25576
|
"--replace-same",
|
|
25577
|
+
"--with",
|
|
25415
25578
|
"--all",
|
|
25416
25579
|
"--any"
|
|
25417
25580
|
]);
|
|
25418
25581
|
if (bad != null) throw new CliExit(EXIT.usage, bad);
|
|
25419
25582
|
const selection = selectOrExit(ctx, { bare: "default" });
|
|
25583
|
+
const flags = flagsOrExit(ctx);
|
|
25420
25584
|
if (ctx.args.flags.has("--dry-run")) {
|
|
25421
25585
|
const { out } = ctx;
|
|
25422
25586
|
if (out.json) out.printJson(selection);
|
|
@@ -25441,7 +25605,8 @@ async function cmdUp(ctx) {
|
|
|
25441
25605
|
ids: selection.ordered,
|
|
25442
25606
|
wait,
|
|
25443
25607
|
...staggerMs > 0 ? { staggerMs } : {},
|
|
25444
|
-
...replaceSame ? { replaceSame } : {}
|
|
25608
|
+
...replaceSame ? { replaceSame } : {},
|
|
25609
|
+
...flags != null ? { flags: { [flags.id]: flags.flags } } : {}
|
|
25445
25610
|
}));
|
|
25446
25611
|
return printReport(ctx.out, report, client.state());
|
|
25447
25612
|
} finally {
|
|
@@ -25452,6 +25617,7 @@ async function controlVerb(ctx, verb) {
|
|
|
25452
25617
|
const known = verb === "restart" ? [
|
|
25453
25618
|
"--no-wait",
|
|
25454
25619
|
"--replace-same",
|
|
25620
|
+
"--with",
|
|
25455
25621
|
"--all",
|
|
25456
25622
|
"--any"
|
|
25457
25623
|
] : ["--all", "--any"];
|
|
@@ -25466,11 +25632,13 @@ async function controlVerb(ctx, verb) {
|
|
|
25466
25632
|
extraIds: Object.keys(client.state().processes ?? {}).filter((id) => !declared.has(id))
|
|
25467
25633
|
});
|
|
25468
25634
|
const replaceSame = ctx.args.flags.has("--replace-same");
|
|
25635
|
+
const flags = verb === "restart" ? flagsOrExit(ctx) : null;
|
|
25469
25636
|
const report = await withProgress(client, ctx.out, new Set(selection.ordered), () => verb === "stop" ? client.control("stop", { ids: selection.ordered }) : client.control("restart", {
|
|
25470
25637
|
ids: selection.ordered,
|
|
25471
25638
|
wait: !ctx.args.flags.has("--no-wait"),
|
|
25472
25639
|
staggerMs: staggerFor(ctx.config, ctx.args.positionals),
|
|
25473
|
-
...replaceSame ? { replaceSame } : {}
|
|
25640
|
+
...replaceSame ? { replaceSame } : {},
|
|
25641
|
+
...flags != null ? { flags: { [flags.id]: flags.flags } } : {}
|
|
25474
25642
|
}));
|
|
25475
25643
|
return printReport(ctx.out, report, client.state());
|
|
25476
25644
|
} finally {
|
|
@@ -25573,7 +25741,7 @@ function reportSignalShutdown(ctx, result, why, reports) {
|
|
|
25573
25741
|
}
|
|
25574
25742
|
//#endregion
|
|
25575
25743
|
//#region src/daemon/envOverrides.ts
|
|
25576
|
-
const STORE_VERSION$
|
|
25744
|
+
const STORE_VERSION$3 = 1;
|
|
25577
25745
|
/** A knob is a port or a log level, not a payload. Bounds keep a mistake from becoming a file. */
|
|
25578
25746
|
const MAX_VALUE_LENGTH = 4096;
|
|
25579
25747
|
const EMPTY_ENV_OVERRIDES = Object.freeze({});
|
|
@@ -25609,7 +25777,7 @@ async function writeEnvOverrides(path, overrides) {
|
|
|
25609
25777
|
mode: 448
|
|
25610
25778
|
});
|
|
25611
25779
|
const store = {
|
|
25612
|
-
version: STORE_VERSION$
|
|
25780
|
+
version: STORE_VERSION$3,
|
|
25613
25781
|
processes: Object.fromEntries(Object.entries(overrides).filter(([, values]) => Object.keys(values).length > 0).map(([id, values]) => [id, { ...values }]))
|
|
25614
25782
|
};
|
|
25615
25783
|
const temp = `${path}.${process.pid}.tmp`;
|
|
@@ -26565,6 +26733,7 @@ async function cmdList(ctx) {
|
|
|
26565
26733
|
endpoints: proc.endpoints,
|
|
26566
26734
|
url: proc.url ?? null,
|
|
26567
26735
|
envVars: proc.envVars,
|
|
26736
|
+
flags: proc.flags,
|
|
26568
26737
|
optIn: proc.optIn
|
|
26569
26738
|
})),
|
|
26570
26739
|
suites: Object.fromEntries(Object.entries(config.suites).map(([name, { name: _name, ...suite }]) => [name, suite])),
|
|
@@ -26626,6 +26795,12 @@ async function cmdExplain(ctx) {
|
|
|
26626
26795
|
selection.ordered.forEach((id, index) => {
|
|
26627
26796
|
out.print(` ${index + 1}. ${id}`);
|
|
26628
26797
|
});
|
|
26798
|
+
const flagged = ctx.config.processes.filter((proc) => selection.direct.includes(proc.id) && proc.flags.length > 0);
|
|
26799
|
+
if (flagged.length > 0) out.print("flags:");
|
|
26800
|
+
for (const proc of flagged) for (const flag of proc.flags) {
|
|
26801
|
+
const about = flag.description != null ? ` — ${flag.description}` : "";
|
|
26802
|
+
out.print(` ${proc.id} --with ${flag.name} appends ${flag.args.join(" ")}${about}`);
|
|
26803
|
+
}
|
|
26629
26804
|
if (!ctx.args.flags.has("--env")) {
|
|
26630
26805
|
out.print(out.paint("gray", "env: `explain <sel> --env` shows each id's spawn environment"));
|
|
26631
26806
|
return EXIT.ok;
|
|
@@ -26878,6 +27053,91 @@ async function cmdLogs(ctx) {
|
|
|
26878
27053
|
}
|
|
26879
27054
|
}
|
|
26880
27055
|
//#endregion
|
|
27056
|
+
//#region src/daemon/lastStarts.ts
|
|
27057
|
+
const STORE_VERSION$2 = 1;
|
|
27058
|
+
/** Newest first, capped at `MAX_LAST_STARTS`. */
|
|
27059
|
+
function bounded$1(entries) {
|
|
27060
|
+
return Object.fromEntries([...entries].sort(([, a], [, b]) => b - a).slice(0, 256));
|
|
27061
|
+
}
|
|
27062
|
+
/** Missing, unreadable or corrupt all read as "nothing started yet" — never a reason to fail a boot. */
|
|
27063
|
+
async function readLastStarts(path) {
|
|
27064
|
+
try {
|
|
27065
|
+
const parsed = JSON.parse(await readFile(path, "utf8"));
|
|
27066
|
+
if (parsed == null || typeof parsed !== "object" || !("processes" in parsed)) return {};
|
|
27067
|
+
const processes = parsed.processes;
|
|
27068
|
+
if (processes == null || typeof processes !== "object" || Array.isArray(processes)) return {};
|
|
27069
|
+
return bounded$1(Object.entries(processes).filter((entry) => typeof entry[1] === "number" && Number.isFinite(entry[1])));
|
|
27070
|
+
} catch {
|
|
27071
|
+
return {};
|
|
27072
|
+
}
|
|
27073
|
+
}
|
|
27074
|
+
async function writeLastStarts(path, lastStarts) {
|
|
27075
|
+
await mkdir(dirname(path), {
|
|
27076
|
+
recursive: true,
|
|
27077
|
+
mode: 448
|
|
27078
|
+
});
|
|
27079
|
+
const temp = `${path}.${process.pid}.tmp`;
|
|
27080
|
+
const store = {
|
|
27081
|
+
version: STORE_VERSION$2,
|
|
27082
|
+
processes: bounded$1(Object.entries(lastStarts))
|
|
27083
|
+
};
|
|
27084
|
+
await writeFile(temp, `${JSON.stringify(store, null, 2)}\n`, {
|
|
27085
|
+
encoding: "utf8",
|
|
27086
|
+
mode: 384
|
|
27087
|
+
});
|
|
27088
|
+
await rename(temp, path);
|
|
27089
|
+
}
|
|
27090
|
+
//#endregion
|
|
27091
|
+
//#region src/daemon/taskDurations.ts
|
|
27092
|
+
const STORE_VERSION$1 = 1;
|
|
27093
|
+
/** Each flag set keeps its own samples — `dev-reset+hosted` runs as long as it runs, not as `dev-reset`. */
|
|
27094
|
+
function durationKey(id, flags) {
|
|
27095
|
+
return [id, ...flags].join("+");
|
|
27096
|
+
}
|
|
27097
|
+
/** `durations` with one more sample under `key`, which moves to the newest end of the bound. */
|
|
27098
|
+
function withDuration(durations, key, ms) {
|
|
27099
|
+
const samples = [...durations[key] ?? [], ms].slice(-3);
|
|
27100
|
+
const rest = Object.entries(durations).filter(([existing]) => existing !== key);
|
|
27101
|
+
return Object.fromEntries([...rest, [key, samples]].slice(-256));
|
|
27102
|
+
}
|
|
27103
|
+
/** The mean of the samples, or null with nothing to go on. */
|
|
27104
|
+
function estimateMs(samples) {
|
|
27105
|
+
if (samples == null || samples.length === 0) return null;
|
|
27106
|
+
return Math.round(samples.reduce((total, ms) => total + ms, 0) / samples.length);
|
|
27107
|
+
}
|
|
27108
|
+
/** Missing, unreadable or corrupt all read as "no history yet" — never a reason to fail a boot. */
|
|
27109
|
+
async function readTaskDurations(path) {
|
|
27110
|
+
try {
|
|
27111
|
+
const parsed = JSON.parse(await readFile(path, "utf8"));
|
|
27112
|
+
if (parsed == null || typeof parsed !== "object" || !("tasks" in parsed)) return {};
|
|
27113
|
+
const tasks = parsed.tasks;
|
|
27114
|
+
if (tasks == null || typeof tasks !== "object" || Array.isArray(tasks)) return {};
|
|
27115
|
+
const entries = Object.entries(tasks).flatMap(([key, samples]) => {
|
|
27116
|
+
if (!Array.isArray(samples)) return [];
|
|
27117
|
+
const valid = samples.filter((ms) => typeof ms === "number" && Number.isFinite(ms) && ms >= 0);
|
|
27118
|
+
return valid.length > 0 ? [[key, valid.slice(-3)]] : [];
|
|
27119
|
+
});
|
|
27120
|
+
return Object.fromEntries(entries.slice(-256));
|
|
27121
|
+
} catch {
|
|
27122
|
+
return {};
|
|
27123
|
+
}
|
|
27124
|
+
}
|
|
27125
|
+
async function writeTaskDurations(path, durations) {
|
|
27126
|
+
await mkdir(dirname(path), {
|
|
27127
|
+
recursive: true,
|
|
27128
|
+
mode: 448
|
|
27129
|
+
});
|
|
27130
|
+
const temp = `${path}.${process.pid}.tmp`;
|
|
27131
|
+
await writeFile(temp, `${JSON.stringify({
|
|
27132
|
+
version: STORE_VERSION$1,
|
|
27133
|
+
tasks: durations
|
|
27134
|
+
}, null, 2)}\n`, {
|
|
27135
|
+
encoding: "utf8",
|
|
27136
|
+
mode: 384
|
|
27137
|
+
});
|
|
27138
|
+
await rename(temp, path);
|
|
27139
|
+
}
|
|
27140
|
+
//#endregion
|
|
26881
27141
|
//#region src/run/scheduler.ts
|
|
26882
27142
|
async function runTaskPool(options) {
|
|
26883
27143
|
const { failFast } = options;
|
|
@@ -26988,6 +27248,36 @@ function startPump(out, proc) {
|
|
|
26988
27248
|
}
|
|
26989
27249
|
};
|
|
26990
27250
|
}
|
|
27251
|
+
/**
|
|
27252
|
+
* What this run ran reaches the "recently started" order and the task estimates — through the
|
|
27253
|
+
* daemon when one is up (it owns those stores while it runs), else straight into the stores.
|
|
27254
|
+
*/
|
|
27255
|
+
async function noteForegroundRuns(config, paths, runs) {
|
|
27256
|
+
if (runs.length === 0) return;
|
|
27257
|
+
try {
|
|
27258
|
+
const handle = await findDaemon(config);
|
|
27259
|
+
if (handle != null) {
|
|
27260
|
+
const client = await connectDaemon(handle);
|
|
27261
|
+
try {
|
|
27262
|
+
await client.noteRuns({ runs: [...runs] });
|
|
27263
|
+
} finally {
|
|
27264
|
+
client.dispose();
|
|
27265
|
+
}
|
|
27266
|
+
return;
|
|
27267
|
+
}
|
|
27268
|
+
let lastStarts = await readLastStarts(paths.lastStartsPath);
|
|
27269
|
+
let durations = await readTaskDurations(paths.taskDurationsPath);
|
|
27270
|
+
for (const run of runs) {
|
|
27271
|
+
if ((lastStarts[run.id] ?? 0) < run.startedAt) lastStarts = {
|
|
27272
|
+
...lastStarts,
|
|
27273
|
+
[run.id]: run.startedAt
|
|
27274
|
+
};
|
|
27275
|
+
if (run.durationMs != null) durations = withDuration(durations, durationKey(run.id, run.flags), run.durationMs);
|
|
27276
|
+
}
|
|
27277
|
+
await writeLastStarts(paths.lastStartsPath, lastStarts);
|
|
27278
|
+
await writeTaskDurations(paths.taskDurationsPath, durations);
|
|
27279
|
+
} catch {}
|
|
27280
|
+
}
|
|
26991
27281
|
/** Let the last lines flush, then close every pump — the only way each one is guaranteed to end. */
|
|
26992
27282
|
async function drainPumps(pumps, graceMs = 250) {
|
|
26993
27283
|
if (pumps.length === 0) return;
|
|
@@ -26999,10 +27289,18 @@ async function cmdRun(ctx) {
|
|
|
26999
27289
|
const bad = unknownFlags(ctx.args.flags, [
|
|
27000
27290
|
"--parallel",
|
|
27001
27291
|
"--fail-fast",
|
|
27292
|
+
"--with",
|
|
27002
27293
|
"--all",
|
|
27003
27294
|
"--any"
|
|
27004
27295
|
]);
|
|
27005
27296
|
if (bad != null) throw new CliExit(EXIT.usage, bad);
|
|
27297
|
+
const flags = flagsOrExit(ctx);
|
|
27298
|
+
const passthrough = ctx.args.passthrough;
|
|
27299
|
+
const target = passthrough.length > 0 ? singleProcessOrExit(ctx, "--") : null;
|
|
27300
|
+
const unquotable = typeof target?.run === "string" ? passthrough.find((arg) => !SHELL_PLAIN_ARG.test(arg)) : void 0;
|
|
27301
|
+
if (target != null && unquotable != null) throw new CliExit(EXIT.usage, `"${target.id}" runs through a shell, where ${JSON.stringify(unquotable)} would need quoting — pass plain arguments, or declare a flag for it`);
|
|
27302
|
+
/** The one id `--with` / `--` select gets its flags' arguments, then the raw ones. */
|
|
27303
|
+
const extraArgs = (id) => [...flags?.id === id ? flags.args : [], ...target?.id === id ? passthrough : []];
|
|
27006
27304
|
const parallel = numericFlag(ctx.args.flags, "--parallel");
|
|
27007
27305
|
if (parallel != null && typeof parallel === "object") throw new CliExit(EXIT.usage, parallel.error);
|
|
27008
27306
|
const selection = selectOrExit(ctx, { bare: "required" });
|
|
@@ -27051,7 +27349,7 @@ async function cmdRun(ctx) {
|
|
|
27051
27349
|
}
|
|
27052
27350
|
return createNiceProcess({
|
|
27053
27351
|
id: def.id,
|
|
27054
|
-
run: def.run,
|
|
27352
|
+
run: runWithArgs(def.run, extraArgs(def.id)),
|
|
27055
27353
|
...def.shell != null ? { shell: def.shell } : {},
|
|
27056
27354
|
cwd: def.cwd,
|
|
27057
27355
|
env: effectiveEnv(def, overrides),
|
|
@@ -27093,6 +27391,16 @@ async function cmdRun(ctx) {
|
|
|
27093
27391
|
if (await Promise.race([graceful.then(() => true), new Promise((settle) => setTimeout(() => settle(false), TIMEOUT_STOP_GRACE_MS))])) return;
|
|
27094
27392
|
for (const proc of procs) if (proc.pid != null) forceKillTree(proc.pid);
|
|
27095
27393
|
};
|
|
27394
|
+
const ran = [];
|
|
27395
|
+
const noteStart = (def) => {
|
|
27396
|
+
const run = {
|
|
27397
|
+
id: def.id,
|
|
27398
|
+
startedAt: Date.now(),
|
|
27399
|
+
flags: flags?.id === def.id ? flags.flags : []
|
|
27400
|
+
};
|
|
27401
|
+
ran.push(run);
|
|
27402
|
+
return run;
|
|
27403
|
+
};
|
|
27096
27404
|
const runTask = async (def) => {
|
|
27097
27405
|
const proc = procFor(def.id);
|
|
27098
27406
|
if (!single) out.print(`${out.paint("cyan", "▸")} ${out.accent(def.id, def.id)} running…`);
|
|
@@ -27104,8 +27412,10 @@ async function cmdRun(ctx) {
|
|
|
27104
27412
|
});
|
|
27105
27413
|
let timer = null;
|
|
27106
27414
|
let timedOut = false;
|
|
27415
|
+
let run = null;
|
|
27107
27416
|
try {
|
|
27108
27417
|
await proc.start();
|
|
27418
|
+
run = noteStart(def);
|
|
27109
27419
|
if (def.timeoutMs != null) {
|
|
27110
27420
|
timer = setTimeout(() => {
|
|
27111
27421
|
timedOut = true;
|
|
@@ -27134,6 +27444,7 @@ async function cmdRun(ctx) {
|
|
|
27134
27444
|
}
|
|
27135
27445
|
const code = proc.lastExit?.code ?? (proc.state === "succeeded" ? 0 : 1);
|
|
27136
27446
|
const failed = code !== 0;
|
|
27447
|
+
if (!failed && run != null && passthrough.length === 0) run.durationMs = Date.now() - run.startedAt;
|
|
27137
27448
|
out.print(failed ? `${out.paint("red", "✗")} ${out.accent(def.id, def.id)} exit ${code}` : `${out.paint("green", "✓")} ${out.accent(def.id, def.id)} ok`);
|
|
27138
27449
|
return {
|
|
27139
27450
|
id: def.id,
|
|
@@ -27222,6 +27533,7 @@ async function cmdRun(ctx) {
|
|
|
27222
27533
|
}
|
|
27223
27534
|
const proc = procFor(def.id);
|
|
27224
27535
|
await proc.start();
|
|
27536
|
+
noteStart(def);
|
|
27225
27537
|
if (!single) out.print(`${out.paint("cyan", "▸")} ${out.accent(def.id, def.id)} started (pid ${proc.pid ?? "?"})`);
|
|
27226
27538
|
}
|
|
27227
27539
|
if (services.length > 0 && !(failFast && failures.length > 0)) {
|
|
@@ -27244,6 +27556,7 @@ async function cmdRun(ctx) {
|
|
|
27244
27556
|
} finally {
|
|
27245
27557
|
process.removeListener("SIGINT", onSigint);
|
|
27246
27558
|
await Promise.allSettled(procs.filter((proc) => !TERMINAL_STATES.has(proc.state)).map((proc) => proc.stop()));
|
|
27559
|
+
await noteForegroundRuns(config, paths, ran);
|
|
27247
27560
|
}
|
|
27248
27561
|
}
|
|
27249
27562
|
//#endregion
|
|
@@ -27642,16 +27955,19 @@ bare down/restart/logs/run always require a selection — omission never means -
|
|
|
27642
27955
|
* block followed by every entry, in this order.
|
|
27643
27956
|
*/
|
|
27644
27957
|
const COMMAND_HELP = [
|
|
27645
|
-
["up", ` up [sel] [--no-wait] [--dry-run] [--replace-same]
|
|
27958
|
+
["up", ` up [sel] [--no-wait] [--dry-run] [--replace-same] [--with <flag>]
|
|
27646
27959
|
start: deps auto-included, DAG order, live progress;
|
|
27647
|
-
a ready service prints its URL. --
|
|
27960
|
+
a ready service prints its URL. --with turns on a
|
|
27961
|
+
flag the selected process declares (repeat it, or
|
|
27962
|
+
a,b) — one id only. --replace-same lets a
|
|
27648
27963
|
start take an exclusive port from a STRAY — this same
|
|
27649
27964
|
command in the same cwd, started outside the daemon
|
|
27650
27965
|
(a stranger on the port still refuses). --json reports
|
|
27651
27966
|
every id's outcome, state, pid and endpoints as data.`],
|
|
27652
27967
|
["down", " down <sel> stop (reverse-DAG order)"],
|
|
27653
|
-
["restart", ` restart <sel> [--no-wait] [--replace-same]
|
|
27654
|
-
stop + start
|
|
27968
|
+
["restart", ` restart <sel> [--no-wait] [--replace-same] [--with <flag>]
|
|
27969
|
+
stop + start, with the flags of the run it replaces
|
|
27970
|
+
unless --with names others`],
|
|
27655
27971
|
["status", " status [--watch] table from the live status realm"],
|
|
27656
27972
|
["logs", " logs <sel> [-f] merged interleaved tail with colored id prefixes"],
|
|
27657
27973
|
["list", " list config introspection (processes, suites, warnings)"],
|
|
@@ -27660,9 +27976,12 @@ const COMMAND_HELP = [
|
|
|
27660
27976
|
["env", ` env [sel] [--set N=V] [--unset N] declared env vars and their values; --clear drops
|
|
27661
27977
|
overrides. A set value is STICKY: it applies to every
|
|
27662
27978
|
later start until cleared, and never restarts anything.`],
|
|
27663
|
-
["run", ` run <sel> [--parallel N] [--fail-fast]
|
|
27979
|
+
["run", ` run <sel> [--parallel N] [--fail-fast] [--with <flag>] [-- <args>]
|
|
27980
|
+
foreground, no daemon; tasks = local CI shape
|
|
27664
27981
|
(a suite supplies its own parallel/fail-fast),
|
|
27665
27982
|
a single id gets raw inherited stdio (interactive).
|
|
27983
|
+
--with turns on declared flags; anything after --
|
|
27984
|
+
is appended to that one id's command as-is.
|
|
27666
27985
|
--fail-fast = stop at the FIRST failure and stop the
|
|
27667
27986
|
survivors; without it every task still runs, every
|
|
27668
27987
|
failure is reported, and the exit code is still
|
|
@@ -27752,7 +28071,7 @@ async function withTimeout(ctx, run) {
|
|
|
27752
28071
|
async function main() {
|
|
27753
28072
|
const argv = process.argv.slice(2);
|
|
27754
28073
|
if (argv[0] === "daemon") {
|
|
27755
|
-
const { runCommanderDaemon } = await import("./main-
|
|
28074
|
+
const { runCommanderDaemon } = await import("./main-DSPhWTfM.mjs");
|
|
27756
28075
|
return runCommanderDaemon(argv.slice(1));
|
|
27757
28076
|
}
|
|
27758
28077
|
const parsed = parseCliArgs(argv);
|
|
@@ -27760,6 +28079,10 @@ async function main() {
|
|
|
27760
28079
|
process.stderr.write(`nice-commander: ${parsed.error}\n`);
|
|
27761
28080
|
return EXIT.usage;
|
|
27762
28081
|
}
|
|
28082
|
+
if (parsed.passthrough.length > 0 && parsed.command !== "run") {
|
|
28083
|
+
process.stderr.write("nice-commander: arguments after `--` go to a foreground `run` only — a daemon start appends only the flags a process declares (`--with <flag>`)\n");
|
|
28084
|
+
return EXIT.usage;
|
|
28085
|
+
}
|
|
27763
28086
|
if (parsed.help || parsed.command === "help") {
|
|
27764
28087
|
process.stdout.write(helpFor(parsed.command === "help" ? null : parsed.command));
|
|
27765
28088
|
return EXIT.ok;
|
|
@@ -27797,6 +28120,6 @@ main().then((code) => {
|
|
|
27797
28120
|
process.exitCode = EXIT.failure;
|
|
27798
28121
|
});
|
|
27799
28122
|
//#endregion
|
|
27800
|
-
export {
|
|
28123
|
+
export { savedFilterId as $, commanderRuntimeError as A, createDefaultServeLogger as B, COMMANDER_HEALTH_PATH as C, COMMANDER_TICKET_PROTOCOL_PREFIX as D, COMMANDER_TICKET_PATH as E, findDaemonProcesses as F, effectiveEnv as G, createMemoryStorageAdapter_json as H, createRealmAcceptor as I, hashCanonical as J, envVarViews as K, createRealmServerEngine as L, commanderStatePaths as M, ensureStateDir as N, COMMANDER_WS_PATH as O, resolveCommanderDataDir as P, withDependencies as Q, httpAcceptorCarrier as R, COMMANDER_BOOTSTRAP_PATH as S, COMMANDER_SHUTDOWN_PATH as T, wsAcceptorCarrier as U, RuntimeCoordinate as V, validateCommanderConfig as W, orderByDependency as X, loadCommanderConfigFile as Y, stopSetWithDependencies as Z, applyEnvMutation as _, durationKey as a, writeInstanceRecord as at, commanderChannel as b, withDuration as c, writeLastStarts as d, resolveFlags as et, parseLogsClientMessage as f, signalStray as g, identifyEndpointOwner as h, runTaskPool as i, removeInstanceRecord as it, commanderPackageVersion as j, commanderStatusRealm as k, writeTaskDurations as l, createPortInspector as m, readSavedFilters as n, readInstanceRecord as nt, estimateMs as o, ancestors as p, overrideFingerprint as q, writeSavedFilters as r, recordDaemonAlive as rt, readTaskDurations as s, mutateSavedFilters as t, runWithArgs as tt, readLastStarts as u, countOverrides as v, COMMANDER_LOGS_PATH as w, commanderControlDomain as x, readEnvOverrides as y, serveChannel as z };
|
|
27801
28124
|
|
|
27802
28125
|
//# sourceMappingURL=cli.mjs.map
|