@nice-code/commander 0.104.0 → 0.106.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/README.md CHANGED
@@ -57,6 +57,12 @@ The GUI’s **shutdown daemon** button stops every task and service managed by t
57
57
  including processes hidden by filters or suites, then exits the daemon. Confirm the dialog to
58
58
  proceed. Run `nice-commander ui` to start it again.
59
59
 
60
+ `nice-commander ui` attaches to the daemon already running for the project, even one started by
61
+ an older build: each daemon serves the web UI it was built with, so upgrading the package never
62
+ breaks the open dashboard. `nice-commander ui --fresh` stops that daemon (and everything it runs)
63
+ and starts one on the installed build. If a page ever can't connect, it offers **reload** and
64
+ **shut down daemon** instead of a dead end.
65
+
60
66
  ## What it does that a script does not
61
67
 
62
68
  - **`dependsOn` waits for *ready*, not for *spawned*** — a real readiness contract (port, HTTP,
package/build/cli.cjs CHANGED
@@ -13,11 +13,11 @@ let jiti = require("jiti");
13
13
  let node_crypto = require("node:crypto");
14
14
  let module$1 = require("module");
15
15
  let ws = require("ws");
16
- let node_os = require("node:os");
17
16
  let node_child_process = require("node:child_process");
17
+ let node_util = require("node:util");
18
+ let node_os = require("node:os");
18
19
  let node_net = require("node:net");
19
20
  let node_dns_promises = require("node:dns/promises");
20
- let node_util = require("node:util");
21
21
  let node_readline_promises = require("node:readline/promises");
22
22
  //#region src/cli/args.ts
23
23
  const GLOBAL_VALUE_FLAGS = new Set(["--config", "--timeout"]);
@@ -151,7 +151,7 @@ function validStartStamp(value) {
151
151
  function isInstanceRecord(value) {
152
152
  if (value == null || typeof value !== "object" || Array.isArray(value)) return false;
153
153
  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.protocolVersion === 7;
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 === 7;
155
155
  }
156
156
  async function writeInstanceRecord(path, record) {
157
157
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(path), {
@@ -210,7 +210,8 @@ async function readSkewedInstanceRecord(path, expectedRealmSchemaHash) {
210
210
  protocolVersion: record["protocolVersion"],
211
211
  packageVersion: boundedString(record["packageVersion"]) ? record["packageVersion"] : "unknown",
212
212
  startStamp: validStartStamp(record["startStamp"]) ? record["startStamp"] ?? null : null,
213
- skew: sameProtocol ? "realm-schema" : "protocol"
213
+ skew: sameProtocol ? "realm-schema" : "protocol",
214
+ servesOwnClient: record["servesOwnClient"] === true
214
215
  };
215
216
  }
216
217
  /** Liveness only — enough to say "something is there", never enough to authorize a kill (C1). */
@@ -24083,6 +24084,85 @@ function createRealmAcceptor(options) {
24083
24084
  };
24084
24085
  }
24085
24086
  //#endregion
24087
+ //#region src/daemon/daemonProcesses.ts
24088
+ const exec$2 = (0, node_util.promisify)(node_child_process.execFile);
24089
+ /** `pid<space>command line` for every process this user can see. */
24090
+ async function processTable() {
24091
+ if (process.platform === "win32") {
24092
+ const { stdout } = await exec$2("powershell.exe", [
24093
+ "-NoProfile",
24094
+ "-NonInteractive",
24095
+ "-Command",
24096
+ "Get-CimInstance Win32_Process | ForEach-Object { \"$($_.ProcessId) $($_.CommandLine)\" }"
24097
+ ], {
24098
+ maxBuffer: 16 * 1024 * 1024,
24099
+ timeout: 15e3,
24100
+ windowsHide: true
24101
+ });
24102
+ return parseTable(stdout);
24103
+ }
24104
+ const { stdout } = await exec$2("ps", [
24105
+ "-axww",
24106
+ "-o",
24107
+ "pid=",
24108
+ "-o",
24109
+ "args="
24110
+ ], {
24111
+ maxBuffer: 16 * 1024 * 1024,
24112
+ timeout: 1e4
24113
+ });
24114
+ return parseTable(stdout);
24115
+ }
24116
+ function parseTable(text) {
24117
+ const rows = [];
24118
+ for (const line of text.split(/\r?\n/)) {
24119
+ const match = /^\s*(\d+)\s+(.*)$/.exec(line);
24120
+ if (match != null) rows.push({
24121
+ pid: Number(match[1]),
24122
+ commandLine: match[2] ?? ""
24123
+ });
24124
+ }
24125
+ return rows;
24126
+ }
24127
+ /**
24128
+ * Is this command line the daemon for `configPath` under `dataDir`? Quotes are dropped first:
24129
+ * Windows quotes an argument holding a space (`--data-dir "C:\…\App Data"`), `ps` does not.
24130
+ */
24131
+ function isDaemonCommandLine(commandLine, configPath, dataDir) {
24132
+ const line = ` ${commandLine.replaceAll("\"", "")} `;
24133
+ return line.includes(` daemon --config ${configPath} `) && line.includes(` --data-dir ${dataDir} `);
24134
+ }
24135
+ /** One sentence naming record-less daemons and the one command that clears them. */
24136
+ function orphanMessage(orphans) {
24137
+ const one = orphans.length === 1;
24138
+ const pids = orphans.map((orphan) => orphan.pid).join(", ");
24139
+ const them = one ? "it" : "them";
24140
+ return `${one ? "a daemon" : `${orphans.length} daemons`} for this config ${one ? "is" : "are"} running without an instance record (pid ${pids}), so this CLI cannot talk to ${them}. Run \`nice-commander shutdown\` (it stops ${them} and everything ${one ? "it runs" : "they run"}), then retry.`;
24141
+ }
24142
+ /**
24143
+ * Every live daemon process for this config and data dir, except `excludePid` (a daemon asking
24144
+ * about its peers, or a caller that already holds the recorded one). Best effort: a process
24145
+ * table that cannot be read answers "none", never an error — this is a fallback, not the path.
24146
+ */
24147
+ async function findDaemonProcesses(configPath, dataDir, excludePid) {
24148
+ let table;
24149
+ try {
24150
+ table = await processTable();
24151
+ } catch {
24152
+ return [];
24153
+ }
24154
+ const found = [];
24155
+ for (const row of table) {
24156
+ if (row.pid === process.pid || row.pid === excludePid) continue;
24157
+ if (!isDaemonCommandLine(row.commandLine, configPath, dataDir)) continue;
24158
+ found.push({
24159
+ pid: row.pid,
24160
+ startStamp: await (0, _nice_code_process.readProcessStartStamp)(row.pid)
24161
+ });
24162
+ }
24163
+ return found;
24164
+ }
24165
+ //#endregion
24086
24166
  //#region src/daemon/dataDir.ts
24087
24167
  function resolveCommanderDataDir(environment = process.env, platform = process.platform) {
24088
24168
  const override = environment["NICE_COMMANDER_DATA_DIR"];
@@ -24407,6 +24487,16 @@ async function replaceSkewedDaemon(paths, skewed) {
24407
24487
  case "identity-unverified": throw new Error(`${daemonLabel}, but pid ${skewed.pid} could not be verified as that daemon (start stamp missing or changed — possibly pid reuse). Nothing was killed. Verify the pid yourself, and if the daemon is really gone remove ${paths.instanceRecordPath}.`);
24408
24488
  }
24409
24489
  }
24490
+ /** How long `ensureDaemon` lets a record-less daemon finish exiting before calling it an orphan. */
24491
+ const ORPHAN_GRACE_MS = 5e3;
24492
+ async function waitForOrphansToExit(configPath, dataDir, recordedPid) {
24493
+ const deadline = Date.now() + ORPHAN_GRACE_MS;
24494
+ for (;;) {
24495
+ const orphans = await findDaemonProcesses(configPath, dataDir, recordedPid);
24496
+ if (orphans.length === 0 || Date.now() > deadline) return orphans;
24497
+ await new Promise((resolveWait) => setTimeout(resolveWait, 250));
24498
+ }
24499
+ }
24410
24500
  async function ensureDaemon(options) {
24411
24501
  const runtimeError = commanderRuntimeError();
24412
24502
  if (runtimeError != null) throw new Error(runtimeError);
@@ -24428,6 +24518,9 @@ async function ensureDaemon(options) {
24428
24518
  const skewed = await readSkewedInstanceRecord(paths.instanceRecordPath, commanderStatusRealm.schemaHash);
24429
24519
  if (skewed != null && pidAlive$1(skewed.pid)) replaced = await replaceSkewedDaemon(paths, skewed);
24430
24520
  }
24521
+ const recordedPid = existing != null ? existing.pid : void 0;
24522
+ const orphans = await waitForOrphansToExit(options.config.configPath, dataDir, recordedPid);
24523
+ if (orphans.length > 0) throw new Error(orphanMessage(orphans));
24431
24524
  await ensureStateDir(paths);
24432
24525
  const bootFd = (0, node_fs.openSync)(paths.bootLogPath, "w", 384);
24433
24526
  const child = (0, node_child_process.spawn)(process.execPath, [
@@ -24493,6 +24586,11 @@ const COMMANDER_TICKET_PATH = "/ticket";
24493
24586
  /** CLI liveness/discovery probe (instance-record root token only). */
24494
24587
  const COMMANDER_HEALTH_PATH = "/health";
24495
24588
  /**
24589
+ * Plain-HTTP shutdown, capability-gated. It needs no realm, so a page from another build — one
24590
+ * that can never attach the status realm — can still stop the daemon it is stuck on.
24591
+ */
24592
+ const COMMANDER_SHUTDOWN_PATH = "/shutdown";
24593
+ /**
24496
24594
  * ws tickets ride the subprotocol negotiation (browsers cannot set arbitrary ws headers):
24497
24595
  * the client offers `commander-auth.<ticket>`, the daemon selects it to complete the upgrade.
24498
24596
  */
@@ -24837,15 +24935,27 @@ async function findSkewedDaemon(config) {
24837
24935
  return {
24838
24936
  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.`,
24839
24937
  pid: skewed.pid,
24840
- startStamp: skewed.startStamp
24938
+ port: skewed.port,
24939
+ packageVersion: skewed.packageVersion,
24940
+ startStamp: skewed.startStamp,
24941
+ servesOwnClient: skewed.servesOwnClient
24841
24942
  };
24842
24943
  }
24944
+ /**
24945
+ * This config's daemons that no instance record points at (see `daemonProcesses.ts`). The CLI
24946
+ * cannot talk to them — no token — but it can name them, and `shutdown` can stop them.
24947
+ */
24948
+ async function findOrphanDaemons(config, recordedPid) {
24949
+ return findDaemonProcesses(config.configPath, resolveCommanderDataDir(), recordedPid);
24950
+ }
24843
24951
  /** Read-only commands' daemon-or-report: never starts anything, exit 3 when not running. */
24844
24952
  async function requireDaemon(config) {
24845
24953
  const handle = await findDaemon(config);
24846
24954
  if (handle != null) return handle;
24847
24955
  const skewed = await findSkewedDaemon(config);
24848
24956
  if (skewed != null) throw new CliExit(EXIT.notRunning, skewed.message);
24957
+ const orphans = await findOrphanDaemons(config);
24958
+ if (orphans.length > 0) throw new CliExit(EXIT.notRunning, orphanMessage(orphans));
24849
24959
  throw new CliExit(EXIT.notRunning, `daemon not running for "${config.name}" (start one with \`up\`)`);
24850
24960
  }
24851
24961
  /** `up`/`ui`'s spawn-or-reuse; the daemon child reruns THIS bin (`daemon` subcommand). */
@@ -25136,17 +25246,47 @@ async function cmdRestart(ctx) {
25136
25246
  async function cmdShutdown(ctx) {
25137
25247
  const bad = unknownFlags(ctx.args.flags, []);
25138
25248
  if (bad != null) throw new CliExit(EXIT.usage, bad);
25139
- const { out } = ctx;
25140
- const handle = await findDaemon(ctx.config);
25141
- if (handle != null) try {
25249
+ const { out, config } = ctx;
25250
+ const reports = [];
25251
+ let code = null;
25252
+ let recordedPid;
25253
+ const handle = await findDaemon(config);
25254
+ if (handle != null) {
25255
+ recordedPid = handle.record.pid;
25256
+ code = await shutdownRecorded(ctx, handle, reports);
25257
+ } else {
25258
+ const skewed = await findSkewedDaemon(config);
25259
+ if (skewed != null) {
25260
+ recordedPid = skewed.pid;
25261
+ if (!out.json) out.print(out.paint("gray", skewed.message));
25262
+ code = reportSignalShutdown(ctx, await signalDaemonShutdown({
25263
+ pid: skewed.pid,
25264
+ startStamp: skewed.startStamp
25265
+ }), "could not be reached over the wire", reports);
25266
+ }
25267
+ }
25268
+ for (const orphan of await findOrphanDaemons(config, recordedPid)) {
25269
+ const next = reportSignalShutdown(ctx, await signalDaemonShutdown(orphan), "was running without an instance record (the CLI had lost track of it)", reports);
25270
+ code = code == null ? next : Math.max(code, next);
25271
+ }
25272
+ if (code == null) throw new CliExit(EXIT.notRunning, `daemon not running for "${config.name}"`);
25273
+ if (out.json) out.printJson(reports.length === 1 ? reports[0] : {
25274
+ ok: reports.every((report) => report["ok"] === true),
25275
+ daemons: reports
25276
+ });
25277
+ return code;
25278
+ }
25279
+ /** The recorded daemon: the wire first (the graceful ask), a verified signal when it refuses. */
25280
+ async function shutdownRecorded(ctx, handle, reports) {
25281
+ try {
25142
25282
  const client = await connectDaemon(handle);
25143
25283
  try {
25144
25284
  await client.shutdown();
25145
- if (out.json) out.printJson({
25285
+ reports.push({
25146
25286
  ok: true,
25147
25287
  via: "wire"
25148
25288
  });
25149
- else out.print(`daemon for "${ctx.config.name}" is shutting down`);
25289
+ if (!ctx.out.json) ctx.out.print(`daemon for "${ctx.config.name}" is shutting down`);
25150
25290
  return EXIT.ok;
25151
25291
  } finally {
25152
25292
  client.dispose();
@@ -25156,42 +25296,33 @@ async function cmdShutdown(ctx) {
25156
25296
  return reportSignalShutdown(ctx, await signalDaemonShutdown({
25157
25297
  pid: handle.record.pid,
25158
25298
  startStamp: handle.record.startStamp
25159
- }));
25299
+ }), "could not be reached over the wire", reports);
25160
25300
  }
25161
- const skewed = await findSkewedDaemon(ctx.config);
25162
- if (skewed != null) {
25163
- if (!out.json) out.print(out.paint("gray", skewed.message));
25164
- return reportSignalShutdown(ctx, await signalDaemonShutdown({
25165
- pid: skewed.pid,
25166
- startStamp: skewed.startStamp
25167
- }));
25168
- }
25169
- throw new CliExit(EXIT.notRunning, `daemon not running for "${ctx.config.name}"`);
25170
25301
  }
25171
- function reportSignalShutdown(ctx, result) {
25302
+ function reportSignalShutdown(ctx, result, why, reports) {
25172
25303
  const { out } = ctx;
25173
- if (out.json) {
25174
- out.printJson({
25175
- ok: result.outcome === "exited",
25176
- via: "signal",
25177
- ...result
25178
- });
25179
- return result.outcome === "exited" ? EXIT.ok : EXIT.failure;
25180
- }
25304
+ const code = result.outcome === "exited" || result.outcome === "not-running" ? EXIT.ok : EXIT.failure;
25305
+ reports.push({
25306
+ ok: result.outcome === "exited",
25307
+ via: "signal",
25308
+ ...result
25309
+ });
25310
+ if (out.json) return code;
25181
25311
  switch (result.outcome) {
25182
25312
  case "exited":
25183
- out.print(`daemon for "${ctx.config.name}" (pid ${result.pid}) could not be reached over the wire — stopped via signal (its own shutdown ladder ran)`);
25184
- return EXIT.ok;
25313
+ out.print(`daemon for "${ctx.config.name}" (pid ${result.pid}) ${why} — stopped via signal (its own shutdown ladder ran)`);
25314
+ break;
25185
25315
  case "still-stopping":
25186
25316
  out.print(out.paint("yellow", `⚠ daemon (pid ${result.pid}) was signalled and is still stopping — run \`shutdown\` again to escalate if it stays stuck`));
25187
- return EXIT.failure;
25317
+ break;
25188
25318
  case "identity-unverified":
25189
- out.print(out.paint("yellow", `⚠ pid ${result.pid} could not be verified as the recorded daemon (start stamp missing or changed — possibly pid reuse). Nothing was killed; verify the pid yourself, and remove the instance record if the daemon is really gone.`));
25190
- return EXIT.failure;
25319
+ out.print(out.paint("yellow", `⚠ pid ${result.pid} could not be verified as this config's daemon (start stamp missing or changed — possibly pid reuse). Nothing was killed; verify the pid yourself, and remove the instance record if the daemon is really gone.`));
25320
+ break;
25191
25321
  case "not-running":
25192
25322
  out.print(`daemon not running for "${ctx.config.name}" (stale record)`);
25193
- return EXIT.ok;
25323
+ break;
25194
25324
  }
25325
+ return code;
25195
25326
  }
25196
25327
  //#endregion
25197
25328
  //#region src/daemon/envOverrides.ts
@@ -27062,6 +27193,7 @@ async function candidates() {
27062
27193
  }
27063
27194
  /** Try each opener in turn; resolves true when one spawns without an immediate failure. */
27064
27195
  async function openBrowser(url) {
27196
+ if (process.env["NICE_COMMANDER_NO_BROWSER"] === "1") return false;
27065
27197
  for (const candidate of await candidates()) if (await new Promise((resolve) => {
27066
27198
  try {
27067
27199
  const child = (0, node_child_process.spawn)(candidate.command, candidate.args(url), {
@@ -27080,20 +27212,95 @@ async function openBrowser(url) {
27080
27212
  }
27081
27213
  //#endregion
27082
27214
  //#region src/cli/commands/ui.ts
27215
+ /** How long a wire-requested shutdown gets to finish its ladder before a signal follows it. */
27216
+ const FRESH_EXIT_WAIT_MS = 3e4;
27083
27217
  async function cmdUi(ctx) {
27084
- const bad = unknownFlags(ctx.args.flags, []);
27218
+ const bad = unknownFlags(ctx.args.flags, ["--fresh"]);
27085
27219
  if (bad != null) throw new CliExit(EXIT.usage, bad);
27220
+ const { out } = ctx;
27221
+ if (ctx.args.flags.get("--fresh") === true) await stopExistingDaemon(ctx);
27222
+ else {
27223
+ const skewed = await findSkewedDaemon(ctx.config);
27224
+ if (skewed?.servesOwnClient === true) {
27225
+ const url = `http://127.0.0.1:${skewed.port}`;
27226
+ const opened = await openBrowser(url);
27227
+ if (out.json) out.printJson({
27228
+ url,
27229
+ opened,
27230
+ attached: true,
27231
+ daemonBuild: skewed.packageVersion
27232
+ });
27233
+ else {
27234
+ out.print(opened ? `opened ${url}` : `could not open a browser — visit ${url}`);
27235
+ out.print(out.paint("gray", `attached to the running daemon (build ${skewed.packageVersion}; this CLI is ${await commanderPackageVersion()}). \`nice-commander ui --fresh\` restarts it on this build — that stops everything it runs.`));
27236
+ }
27237
+ return EXIT.ok;
27238
+ }
27239
+ }
27086
27240
  const handle = await ensureDaemonRunning(ctx.config);
27087
27241
  ctx.spawnedDaemon = handle.spawned;
27088
27242
  const url = `http://127.0.0.1:${handle.record.port}`;
27089
27243
  const opened = await openBrowser(url);
27090
- if (ctx.out.json) ctx.out.printJson({
27244
+ if (out.json) out.printJson({
27091
27245
  url,
27092
- opened
27246
+ opened,
27247
+ attached: !handle.spawned
27093
27248
  });
27094
- else ctx.out.print(opened ? `opened ${url}` : `could not open a browser — visit ${url}`);
27249
+ else {
27250
+ if (handle.replaced != null) out.print(out.paint("gray", `replaced an idle daemon from build ${handle.replaced.packageVersion} (pid ${handle.replaced.pid})`));
27251
+ out.print(opened ? `opened ${url}` : `could not open a browser — visit ${url}`);
27252
+ }
27095
27253
  return EXIT.ok;
27096
27254
  }
27255
+ /**
27256
+ * `--fresh`: stop this config's daemon, whatever build it is, and wait until it has exited — the
27257
+ * boot that follows must not find (and reuse) a daemon that is still walking its ladder.
27258
+ * The wire goes first when it speaks our build: a signal is the fallback, because on Windows it
27259
+ * is a hard kill that skips the ladder.
27260
+ */
27261
+ async function stopExistingDaemon(ctx) {
27262
+ const { config, out } = ctx;
27263
+ const live = await findDaemon(config);
27264
+ const skewed = live == null ? await findSkewedDaemon(config) : null;
27265
+ const recorded = live != null ? {
27266
+ pid: live.record.pid,
27267
+ startStamp: live.record.startStamp
27268
+ } : skewed != null ? {
27269
+ pid: skewed.pid,
27270
+ startStamp: skewed.startStamp
27271
+ } : null;
27272
+ const targets = [...recorded != null ? [recorded] : [], ...await findOrphanDaemons(config, recorded?.pid)];
27273
+ for (const target of targets) {
27274
+ if (!out.json) out.print(out.paint("gray", `--fresh: stopping the daemon (pid ${target.pid})…`));
27275
+ if (target === recorded && live != null && await stopOverWire(live)) continue;
27276
+ const result = await signalDaemonShutdown(target);
27277
+ if (result.outcome === "exited" || result.outcome === "not-running") continue;
27278
+ throw new CliExit(EXIT.failure, result.outcome === "still-stopping" ? `--fresh: the daemon (pid ${target.pid}) is still stopping — retry in a moment` : `--fresh: pid ${target.pid} could not be verified as this config's daemon (possibly pid reuse), so nothing was stopped — verify it yourself, then retry`);
27279
+ }
27280
+ }
27281
+ /** The graceful ask; false when the wire refuses us or the ladder outlasts the wait. */
27282
+ async function stopOverWire(live) {
27283
+ try {
27284
+ const client = await connectDaemon(live);
27285
+ try {
27286
+ await client.shutdown();
27287
+ } finally {
27288
+ client.dispose();
27289
+ }
27290
+ } catch (error) {
27291
+ if (!(error instanceof CliExit)) throw error;
27292
+ return false;
27293
+ }
27294
+ return waitForExit(live.record.pid, FRESH_EXIT_WAIT_MS);
27295
+ }
27296
+ async function waitForExit(pid, timeoutMs) {
27297
+ const deadline = Date.now() + timeoutMs;
27298
+ while (Date.now() < deadline) {
27299
+ if (!pidAlive$1(pid)) return true;
27300
+ await new Promise((resolve) => setTimeout(resolve, 150));
27301
+ }
27302
+ return !pidAlive$1(pid);
27303
+ }
27097
27304
  //#endregion
27098
27305
  //#region src/daemon/savedFilters.ts
27099
27306
  const STORE_VERSION = 1;
@@ -27216,7 +27423,10 @@ const COMMAND_HELP = [
27216
27423
  non-zero. Children inherit THIS shell's environment;
27217
27424
  daemon-owned processes (up) inherit the daemon's
27218
27425
  boot-time snapshot instead — see doctor.`],
27219
- ["ui", " ui ensure the daemon and open the browser (prints URL)"],
27426
+ ["ui", ` ui [--fresh] open the browser at this config's daemon (prints URL),
27427
+ starting one if none runs. A running daemon is attached
27428
+ to, even from an older build. --fresh stops it (and
27429
+ everything it runs) and starts one on this build.`],
27220
27430
  ["doctor", ` doctor [--reap] [--reap-strays [--yes] [--force]]
27221
27431
  diagnostics: ledger, capability, endpoints (each port
27222
27432
  owner marked STRAY or not), env.
@@ -27296,7 +27506,7 @@ async function withTimeout(ctx, run) {
27296
27506
  async function main() {
27297
27507
  const argv = process.argv.slice(2);
27298
27508
  if (argv[0] === "daemon") {
27299
- const { runCommanderDaemon } = await Promise.resolve().then(() => require("./main-DkrkRGT6.cjs"));
27509
+ const { runCommanderDaemon } = await Promise.resolve().then(() => require("./main-BHPsC_5Q.cjs"));
27300
27510
  return runCommanderDaemon(argv.slice(1));
27301
27511
  }
27302
27512
  const parsed = parseCliArgs(argv);
@@ -27344,6 +27554,7 @@ main().then((code) => {
27344
27554
  exports.COMMANDER_BOOTSTRAP_PATH = COMMANDER_BOOTSTRAP_PATH;
27345
27555
  exports.COMMANDER_HEALTH_PATH = COMMANDER_HEALTH_PATH;
27346
27556
  exports.COMMANDER_LOGS_PATH = COMMANDER_LOGS_PATH;
27557
+ exports.COMMANDER_SHUTDOWN_PATH = COMMANDER_SHUTDOWN_PATH;
27347
27558
  exports.COMMANDER_TICKET_PATH = COMMANDER_TICKET_PATH;
27348
27559
  exports.COMMANDER_TICKET_PROTOCOL_PREFIX = COMMANDER_TICKET_PROTOCOL_PREFIX;
27349
27560
  exports.COMMANDER_WS_PATH = COMMANDER_WS_PATH;
@@ -27365,6 +27576,7 @@ exports.createRealmServerEngine = createRealmServerEngine;
27365
27576
  exports.effectiveEnv = effectiveEnv;
27366
27577
  exports.ensureStateDir = ensureStateDir;
27367
27578
  exports.envVarViews = envVarViews;
27579
+ exports.findDaemonProcesses = findDaemonProcesses;
27368
27580
  exports.hashCanonical = hashCanonical;
27369
27581
  exports.httpAcceptorCarrier = httpAcceptorCarrier;
27370
27582
  exports.identifyEndpointOwner = identifyEndpointOwner;