@nice-code/commander 0.96.0 → 0.97.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.mjs CHANGED
@@ -445,6 +445,29 @@ function withDependencies(processes, ids) {
445
445
  return closed;
446
446
  }
447
447
  /**
448
+ * What stopping `direct` AND its dependencies may take down. A dependency is kept when a live
449
+ * process outside the stop set still needs it — and keeping one keeps what IT needs, hence the
450
+ * loop. Dependencies that simply are not running are not reported either way.
451
+ */
452
+ function stopSetWithDependencies(processes, direct, isLive) {
453
+ const stop = withDependencies(processes, direct);
454
+ const kept = [];
455
+ for (let changed = true; changed;) {
456
+ changed = false;
457
+ const needed = withDependencies(processes, processes.filter((proc) => !stop.has(proc.id) && isLive(proc.id)).map((proc) => proc.id));
458
+ for (const id of [...stop]) {
459
+ if (direct.includes(id) || !needed.has(id)) continue;
460
+ stop.delete(id);
461
+ if (isLive(id)) kept.push(id);
462
+ changed = true;
463
+ }
464
+ }
465
+ return {
466
+ stop: orderByDependency(processes, stop),
467
+ kept
468
+ };
469
+ }
470
+ /**
448
471
  * Resolve CLI/UI selection terms against the model. An empty `terms` is the caller's problem
449
472
  * (bare `up` consults `defaultSelection` before ever reaching here).
450
473
  */
@@ -24098,11 +24121,17 @@ function checkEnvReport(value) {
24098
24121
  warnings
24099
24122
  };
24100
24123
  }
24101
- function checkIds(value) {
24124
+ function checkStop(value) {
24102
24125
  const record = asRecord(value);
24103
24126
  if (record == null) return "expected an object";
24104
24127
  const ids = asIdList(record["ids"]);
24105
- return ids == null ? "ids: expected an array of process ids" : { ids };
24128
+ if (ids == null) return "ids: expected an array of process ids";
24129
+ const withDependencies = record["withDependencies"];
24130
+ if (withDependencies != null && typeof withDependencies !== "boolean") return "withDependencies: expected a boolean";
24131
+ return withDependencies === true ? {
24132
+ ids,
24133
+ withDependencies
24134
+ } : { ids };
24106
24135
  }
24107
24136
  function checkRunSuite(value) {
24108
24137
  const record = asRecord(value);
@@ -24243,7 +24272,7 @@ const commanderControlDomain = createActionRootDomain({ domain: "commander" }).c
24243
24272
  actions: {
24244
24273
  ports: actionSchema().input({ schema: handSchema(checkPortsInput) }).output({ schema: handSchema(checkPortsReport) }),
24245
24274
  start: actionSchema().input({ schema: handSchema(checkStart) }).output({ schema: handSchema(checkReport) }),
24246
- stop: actionSchema().input({ schema: handSchema(checkIds) }).output({ schema: handSchema(checkReport) }),
24275
+ stop: actionSchema().input({ schema: handSchema(checkStop) }).output({ schema: handSchema(checkReport) }),
24247
24276
  restart: actionSchema().input({ schema: handSchema(checkStart) }).output({ schema: handSchema(checkReport) }),
24248
24277
  runSuite: actionSchema().input({ schema: handSchema(checkRunSuite) }).output({ schema: handSchema(checkRunSuiteReport) }),
24249
24278
  saveFilter: actionSchema().input({ schema: handSchema(checkSaveFilter) }).output({ schema: handSchema(checkOk) }),
@@ -26421,7 +26450,7 @@ async function withTimeout(ctx, run) {
26421
26450
  async function main() {
26422
26451
  const argv = process.argv.slice(2);
26423
26452
  if (argv[0] === "daemon") {
26424
- const { runCommanderDaemon } = await import("./main-DrNJc_xN.mjs");
26453
+ const { runCommanderDaemon } = await import("./main-BBH2T2OI.mjs");
26425
26454
  return runCommanderDaemon(argv.slice(1));
26426
26455
  }
26427
26456
  const parsed = parseCliArgs(argv);
@@ -26466,6 +26495,6 @@ main().then((code) => {
26466
26495
  process.exitCode = EXIT.failure;
26467
26496
  });
26468
26497
  //#endregion
26469
- export { ActionRuntime as A, withDependencies as B, resolveCommanderDataDir as C, wsAcceptorCarrier as D, httpAcceptorCarrier as E, envVarViews as F, writeInstanceRecord as G, readInstanceRecord as H, overrideFingerprint as I, hashCanonical as L, createMemoryStorageAdapter_json as M, validateCommanderConfig as N, serveChannel as O, effectiveEnv as P, loadCommanderConfigFile as R, ensureStateDir as S, createRealmServerEngine as T, recordDaemonAlive as U, savedFilterId as V, removeInstanceRecord as W, COMMANDER_WS_PATH as _, parseLogsClientMessage as a, commanderPackageVersion as b, countOverrides as c, commanderControlDomain as d, COMMANDER_BOOTSTRAP_PATH as f, COMMANDER_TICKET_PROTOCOL_PREFIX as g, COMMANDER_TICKET_PATH as h, runTaskPool as i, RuntimeCoordinate as j, createDefaultServeLogger as k, readEnvOverrides as l, COMMANDER_LOGS_PATH as m, readSavedFilters as n, createPortInspector as o, COMMANDER_HEALTH_PATH as p, writeSavedFilters as r, applyEnvMutation as s, mutateSavedFilters as t, commanderChannel as u, commanderStatusRealm as v, createRealmAcceptor as w, commanderStatePaths as x, commanderRuntimeError as y, orderByDependency as z };
26498
+ export { ActionRuntime as A, stopSetWithDependencies as B, resolveCommanderDataDir as C, wsAcceptorCarrier as D, httpAcceptorCarrier as E, envVarViews as F, removeInstanceRecord as G, savedFilterId as H, overrideFingerprint as I, writeInstanceRecord as K, hashCanonical as L, createMemoryStorageAdapter_json as M, validateCommanderConfig as N, serveChannel as O, effectiveEnv as P, loadCommanderConfigFile as R, ensureStateDir as S, createRealmServerEngine as T, readInstanceRecord as U, withDependencies as V, recordDaemonAlive as W, COMMANDER_WS_PATH as _, parseLogsClientMessage as a, commanderPackageVersion as b, countOverrides as c, commanderControlDomain as d, COMMANDER_BOOTSTRAP_PATH as f, COMMANDER_TICKET_PROTOCOL_PREFIX as g, COMMANDER_TICKET_PATH as h, runTaskPool as i, RuntimeCoordinate as j, createDefaultServeLogger as k, readEnvOverrides as l, COMMANDER_LOGS_PATH as m, readSavedFilters as n, createPortInspector as o, COMMANDER_HEALTH_PATH as p, writeSavedFilters as r, applyEnvMutation as s, mutateSavedFilters as t, commanderChannel as u, commanderStatusRealm as v, createRealmAcceptor as w, commanderStatePaths as x, commanderRuntimeError as y, orderByDependency as z };
26470
26499
 
26471
26500
  //# sourceMappingURL=cli.mjs.map