@nice-code/commander 0.79.0 → 0.80.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 +43 -9
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +43 -9
- package/build/cli.mjs.map +1 -1
- package/build/client/assets/{index-Cw6AoXd7.js → index-BaHIV1eO.js} +4 -4
- package/build/client/assets/{index-Cw6AoXd7.js.map → index-BaHIV1eO.js.map} +1 -1
- package/build/client/index.html +1 -1
- package/build/{main-B5pT7VaY.mjs → main-BfXI8q29.mjs} +45 -20
- package/build/main-BfXI8q29.mjs.map +1 -0
- package/build/{main-7LbBMrpF.cjs → main-d60iXc8C.cjs} +45 -20
- package/build/main-d60iXc8C.cjs.map +1 -0
- package/package.json +6 -6
- package/build/main-7LbBMrpF.cjs.map +0 -1
- package/build/main-B5pT7VaY.mjs.map +0 -1
package/build/cli.mjs
CHANGED
|
@@ -23415,6 +23415,14 @@ const commanderStatusRealm = defineRealm({
|
|
|
23415
23415
|
state: t.string(),
|
|
23416
23416
|
pid: t.optional(t.number()),
|
|
23417
23417
|
startedAt: t.optional(t.number()),
|
|
23418
|
+
sawOutputAt: t.optional(t.number()),
|
|
23419
|
+
lastTask: t.optional(t.object({
|
|
23420
|
+
outcome: t.string(),
|
|
23421
|
+
reason: t.optional(t.string()),
|
|
23422
|
+
timedOut: t.boolean(),
|
|
23423
|
+
endedAt: t.number(),
|
|
23424
|
+
durationMs: t.optional(t.number())
|
|
23425
|
+
})),
|
|
23418
23426
|
restarts: t.number(),
|
|
23419
23427
|
lastExit: t.optional(t.object({
|
|
23420
23428
|
code: t.optional(t.number()),
|
|
@@ -24422,7 +24430,7 @@ async function cmdLogs(ctx) {
|
|
|
24422
24430
|
}
|
|
24423
24431
|
//#endregion
|
|
24424
24432
|
//#region src/cli/commands/run.ts
|
|
24425
|
-
const ACTIVE_STATES = new Set([
|
|
24433
|
+
const ACTIVE_STATES$1 = new Set([
|
|
24426
24434
|
"starting",
|
|
24427
24435
|
"running",
|
|
24428
24436
|
"ready",
|
|
@@ -24510,7 +24518,7 @@ async function cmdRun(ctx) {
|
|
|
24510
24518
|
if (handle != null) {
|
|
24511
24519
|
const client = await connectDaemon(handle);
|
|
24512
24520
|
try {
|
|
24513
|
-
const owned = defs.filter((def) => ACTIVE_STATES.has(client.state().processes[def.id]?.state ?? ""));
|
|
24521
|
+
const owned = defs.filter((def) => ACTIVE_STATES$1.has(client.state().processes[def.id]?.state ?? ""));
|
|
24514
24522
|
if (owned.length > 0) throw new CliExit(EXIT.failure, `"${owned.map((def) => def.id).join("\", \"")}" is owned by the running daemon — \`down\` it there first (silent double-start is never allowed).`);
|
|
24515
24523
|
} finally {
|
|
24516
24524
|
client.dispose();
|
|
@@ -24729,7 +24737,7 @@ async function cmdRun(ctx) {
|
|
|
24729
24737
|
}
|
|
24730
24738
|
for (const depId of def.dependsOn) {
|
|
24731
24739
|
const dep = procs.find((candidate) => candidate.id === depId);
|
|
24732
|
-
if (dep != null && byId.get(depId)?.kind === "service" && ACTIVE_STATES.has(dep.state)) await dep.whenReady().catch(() => {
|
|
24740
|
+
if (dep != null && byId.get(depId)?.kind === "service" && ACTIVE_STATES$1.has(dep.state)) await dep.whenReady().catch(() => {
|
|
24733
24741
|
out.warn(out.paint("yellow", `⚠ dependency "${depId}" did not become ready — starting anyway`));
|
|
24734
24742
|
});
|
|
24735
24743
|
}
|
|
@@ -24812,28 +24820,54 @@ function formatUptime(sinceMs, now = Date.now()) {
|
|
|
24812
24820
|
}
|
|
24813
24821
|
//#endregion
|
|
24814
24822
|
//#region src/cli/commands/status.ts
|
|
24815
|
-
|
|
24823
|
+
const ACTIVE_STATES = new Set([
|
|
24824
|
+
"starting",
|
|
24825
|
+
"running",
|
|
24826
|
+
"ready",
|
|
24827
|
+
"unready",
|
|
24828
|
+
"backoff",
|
|
24829
|
+
"stopping"
|
|
24830
|
+
]);
|
|
24831
|
+
/** Beyond this, a run that has printed nothing reads as wedged, not quiet — say so. */
|
|
24832
|
+
const SILENT_START_NOTE_MS = 15e3;
|
|
24833
|
+
function notesFor(proc, now) {
|
|
24816
24834
|
const notes = [];
|
|
24817
24835
|
if (proc.blockedBy != null) notes.push(`blocked: ${proc.blockedBy}`);
|
|
24818
24836
|
if (proc.degradedBy.length > 0) notes.push(`degraded by ${proc.degradedBy.join(", ")}`);
|
|
24819
24837
|
if (proc.unreadyReason != null) notes.push(`unready: ${proc.unreadyReason}`);
|
|
24838
|
+
if (ACTIVE_STATES.has(proc.state) && proc.sawOutputAt == null && proc.startedAt != null && now - proc.startedAt > SILENT_START_NOTE_MS) notes.push(`no output since start (${formatUptime(proc.startedAt, now)})`);
|
|
24839
|
+
const lastTask = proc.lastTask;
|
|
24840
|
+
if (!ACTIVE_STATES.has(proc.state) && lastTask?.outcome === "failed" && lastTask.reason != null) notes.push(`last run failed: ${lastTask.reason} (${formatUptime(lastTask.endedAt, now)} ago)`);
|
|
24820
24841
|
if (proc.stale) notes.push("stale (config changed — restart to apply)");
|
|
24821
24842
|
const sticky = proc.detail.envVars.filter((declared) => declared.source === "override").length;
|
|
24822
24843
|
if (sticky > 0) notes.push(`${sticky} sticky env override${sticky === 1 ? "" : "s"} (see \`env\`)`);
|
|
24823
24844
|
if (proc.envDrift) notes.push("env override changed — restart to apply");
|
|
24824
24845
|
if (proc.removed) notes.push("removed from config");
|
|
24825
|
-
if (proc.capability?.degraded === true) notes.push(proc.capability.treeMechanism);
|
|
24826
24846
|
return notes.join("; ");
|
|
24827
24847
|
}
|
|
24848
|
+
/**
|
|
24849
|
+
* Degraded tree ownership is a host-wide fact (every process shares one mechanism), so it prints
|
|
24850
|
+
* once under the table instead of drowning every row's NOTES — on WSL that would be every row.
|
|
24851
|
+
*/
|
|
24852
|
+
function capabilityFooter(state) {
|
|
24853
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24854
|
+
for (const proc of Object.values(state.processes)) {
|
|
24855
|
+
if (proc.capability?.degraded !== true) continue;
|
|
24856
|
+
const notes = proc.capability.notes.length > 0 ? `: ${proc.capability.notes.join(" ")}` : "";
|
|
24857
|
+
seen.add(`⚠ tree ownership degraded (${proc.capability.treeMechanism})${notes}`);
|
|
24858
|
+
}
|
|
24859
|
+
return [...seen].map((line) => `\n${line}`).join("");
|
|
24860
|
+
}
|
|
24828
24861
|
function renderTable(out, state) {
|
|
24862
|
+
const now = Date.now();
|
|
24829
24863
|
const rows = Object.entries(state.processes).map(([id, proc]) => [
|
|
24830
24864
|
id,
|
|
24831
24865
|
proc.kind,
|
|
24832
24866
|
proc.state,
|
|
24833
24867
|
proc.pid != null ? String(proc.pid) : "-",
|
|
24834
|
-
proc.startedAt != null ? formatUptime(proc.startedAt) : "-",
|
|
24868
|
+
ACTIVE_STATES.has(proc.state) && proc.startedAt != null ? formatUptime(proc.startedAt, now) : "-",
|
|
24835
24869
|
String(proc.restarts),
|
|
24836
|
-
notesFor(proc)
|
|
24870
|
+
notesFor(proc, now)
|
|
24837
24871
|
]);
|
|
24838
24872
|
const head = `generation ${state.generation} · revision ${state.configRevisionHash}`;
|
|
24839
24873
|
const configError = state.configError.length > 0 ? `\nconfig error (last-good kept): ${state.configError[0]}` : "";
|
|
@@ -24845,7 +24879,7 @@ function renderTable(out, state) {
|
|
|
24845
24879
|
"UPTIME",
|
|
24846
24880
|
"R",
|
|
24847
24881
|
"NOTES"
|
|
24848
|
-
], rows)}${configError}`;
|
|
24882
|
+
], rows)}${capabilityFooter(state)}${configError}`;
|
|
24849
24883
|
}
|
|
24850
24884
|
async function cmdStatus(ctx) {
|
|
24851
24885
|
const bad = unknownFlags(ctx.args.flags, ["--watch"]);
|
|
@@ -25044,7 +25078,7 @@ async function withTimeout(ctx, run) {
|
|
|
25044
25078
|
async function main() {
|
|
25045
25079
|
const argv = process.argv.slice(2);
|
|
25046
25080
|
if (argv[0] === "daemon") {
|
|
25047
|
-
const { runCommanderDaemon } = await import("./main-
|
|
25081
|
+
const { runCommanderDaemon } = await import("./main-BfXI8q29.mjs");
|
|
25048
25082
|
return runCommanderDaemon(argv.slice(1));
|
|
25049
25083
|
}
|
|
25050
25084
|
const parsed = parseCliArgs(argv);
|