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