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