@nice-code/commander 0.70.1 → 0.71.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 +527 -28
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +522 -29
- package/build/cli.mjs.map +1 -1
- package/build/client/assets/index-CQFZypxP.js +13 -0
- package/build/client/assets/{index-CGcBzzm0.js.map → index-CQFZypxP.js.map} +1 -1
- package/build/client/index.html +1 -1
- package/build/config.cjs.map +1 -1
- package/build/config.d.cts +30 -2
- package/build/config.d.mts +30 -2
- package/build/config.mjs.map +1 -1
- package/build/{main-r_PeNn4s.mjs → main-BUB2LNcg.mjs} +62 -10
- package/build/main-BUB2LNcg.mjs.map +1 -0
- package/build/{main-Cq4RCzSk.cjs → main-Cqij6RwE.cjs} +61 -9
- package/build/main-Cqij6RwE.cjs.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/client/assets/index-CGcBzzm0.js +0 -12
- package/build/main-Cq4RCzSk.cjs.map +0 -1
- package/build/main-r_PeNn4s.mjs.map +0 -1
package/build/client/index.html
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
button, input, select { font: inherit; }
|
|
16
16
|
* { box-sizing: border-box; }
|
|
17
17
|
</style>
|
|
18
|
-
<script type="module" crossorigin src="/assets/index-
|
|
18
|
+
<script type="module" crossorigin src="/assets/index-CQFZypxP.js"></script>
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
<div id="root"></div>
|
package/build/config.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.cjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["// The `./config` subpath — what a `commander.config.ts` imports. Lightweight by contract:\n// types + the identity helper only (the loader, validation and their deps stay daemon-side).\n\nimport type { ICommanderConfig } from \"./config/types\";\n\nexport {\n COMMANDER_ID_PATTERN,\n type ICommanderConfig,\n type ICommanderDefaults,\n type ICommanderEndpoint,\n type ICommanderEndpointHealth,\n type ICommanderGroupDefinition,\n type ICommanderProcessDefinition,\n type TCommanderEndpointOwnership,\n type TCommanderEndpointProtocol,\n type TCommanderReady,\n type TCommanderTagQuery,\n type TCommanderTagQueryOr,\n} from \"./config/types\";\n\n/** Identity helper so `commander.config.ts` files are typed end to end. */\nexport function defineCommanderConfig<T extends ICommanderConfig>(config: T): T {\n return config;\n}\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"config.cjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["// The `./config` subpath — what a `commander.config.ts` imports. Lightweight by contract:\n// types + the identity helper only (the loader, validation and their deps stay daemon-side).\n\nimport type { ICommanderConfig } from \"./config/types\";\n\nexport {\n COMMANDER_ID_PATTERN,\n type ICommanderConfig,\n type ICommanderDefaults,\n type ICommanderEndpoint,\n type ICommanderEndpointHealth,\n type ICommanderEnvVar,\n type ICommanderGroupDefinition,\n type ICommanderProcessDefinition,\n type TCommanderEndpointOwnership,\n type TCommanderEndpointProtocol,\n type TCommanderReady,\n type TCommanderTagQuery,\n type TCommanderTagQueryOr,\n} from \"./config/types\";\n\n/** Identity helper so `commander.config.ts` files are typed end to end. */\nexport function defineCommanderConfig<T extends ICommanderConfig>(config: T): T {\n return config;\n}\n"],"mappings":";;;;AAsBA,SAAgB,sBAAkD,QAAc;CAC9E,OAAO;AACT"}
|
package/build/config.d.cts
CHANGED
|
@@ -35,6 +35,29 @@ type TCommanderReady = TNiceProcessReady | {
|
|
|
35
35
|
timeoutMs?: number;
|
|
36
36
|
healthProbeMs?: number;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* A variable this process reads, declared so the UI and CLI can offer it. Declaring a knob is what
|
|
40
|
+
* makes it settable at all: `nice-commander env` and the web UI can only touch names that appear
|
|
41
|
+
* here, so no viewer can inject arbitrary environment into an arbitrary process.
|
|
42
|
+
*/
|
|
43
|
+
interface ICommanderEnvVar {
|
|
44
|
+
/** The variable as the process reads it. */
|
|
45
|
+
name: string;
|
|
46
|
+
/** One line — shown beside the value in `env` and in the UI. */
|
|
47
|
+
description?: string;
|
|
48
|
+
/** Used when nothing overrides it. Declaring it here replaces writing it in `env`. */
|
|
49
|
+
default?: string;
|
|
50
|
+
/** Closed set: the UI renders a picker, and a value outside it is refused. */
|
|
51
|
+
values?: readonly string[];
|
|
52
|
+
/**
|
|
53
|
+
* Never leaves the daemon — not on the realm, not in CLI output, not in logs.
|
|
54
|
+
* ⚠ Defaults to TRUE for names that look like credentials (see `looksSecret`); pass `false`
|
|
55
|
+
* explicitly to publish one. The unsafe direction is the one you have to type.
|
|
56
|
+
*/
|
|
57
|
+
secret?: boolean;
|
|
58
|
+
/** A start refuses unless a value is in hand (default, override, or inherited). */
|
|
59
|
+
required?: boolean;
|
|
60
|
+
}
|
|
38
61
|
interface ICommanderProcessDefinition {
|
|
39
62
|
id: string;
|
|
40
63
|
/** Default from `defaults.kind`, else "service". */
|
|
@@ -43,8 +66,13 @@ interface ICommanderProcessDefinition {
|
|
|
43
66
|
cwd?: string;
|
|
44
67
|
run: TNiceProcessRun;
|
|
45
68
|
shell?: TNiceProcessShell;
|
|
46
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Merged over the daemon's base env; `null` unsets. Values the operator is not meant to tune —
|
|
71
|
+
* a knob goes in `envVars`, and a name may not appear in both.
|
|
72
|
+
*/
|
|
47
73
|
env?: Record<string, string | null>;
|
|
74
|
+
/** Variables this process reads, offered for setting in the UI/CLI. */
|
|
75
|
+
envVars?: readonly ICommanderEnvVar[];
|
|
48
76
|
/** Default "pipe" (held open until stop); "ignore" is an instant EOF. */
|
|
49
77
|
stdin?: "pipe" | "ignore";
|
|
50
78
|
/** Free-form; `role` and `project` are the house convention. */
|
|
@@ -116,5 +144,5 @@ interface ICommanderConfig {
|
|
|
116
144
|
/** Identity helper so `commander.config.ts` files are typed end to end. */
|
|
117
145
|
declare function defineCommanderConfig<T extends ICommanderConfig>(config: T): T;
|
|
118
146
|
//#endregion
|
|
119
|
-
export { COMMANDER_ID_PATTERN, type ICommanderConfig, type ICommanderDefaults, type ICommanderEndpoint, type ICommanderEndpointHealth, type ICommanderGroupDefinition, type ICommanderProcessDefinition, type TCommanderEndpointOwnership, type TCommanderEndpointProtocol, type TCommanderReady, type TCommanderTagQuery, type TCommanderTagQueryOr, defineCommanderConfig };
|
|
147
|
+
export { COMMANDER_ID_PATTERN, type ICommanderConfig, type ICommanderDefaults, type ICommanderEndpoint, type ICommanderEndpointHealth, type ICommanderEnvVar, type ICommanderGroupDefinition, type ICommanderProcessDefinition, type TCommanderEndpointOwnership, type TCommanderEndpointProtocol, type TCommanderReady, type TCommanderTagQuery, type TCommanderTagQueryOr, defineCommanderConfig };
|
|
120
148
|
//# sourceMappingURL=config.d.cts.map
|
package/build/config.d.mts
CHANGED
|
@@ -35,6 +35,29 @@ type TCommanderReady = TNiceProcessReady | {
|
|
|
35
35
|
timeoutMs?: number;
|
|
36
36
|
healthProbeMs?: number;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* A variable this process reads, declared so the UI and CLI can offer it. Declaring a knob is what
|
|
40
|
+
* makes it settable at all: `nice-commander env` and the web UI can only touch names that appear
|
|
41
|
+
* here, so no viewer can inject arbitrary environment into an arbitrary process.
|
|
42
|
+
*/
|
|
43
|
+
interface ICommanderEnvVar {
|
|
44
|
+
/** The variable as the process reads it. */
|
|
45
|
+
name: string;
|
|
46
|
+
/** One line — shown beside the value in `env` and in the UI. */
|
|
47
|
+
description?: string;
|
|
48
|
+
/** Used when nothing overrides it. Declaring it here replaces writing it in `env`. */
|
|
49
|
+
default?: string;
|
|
50
|
+
/** Closed set: the UI renders a picker, and a value outside it is refused. */
|
|
51
|
+
values?: readonly string[];
|
|
52
|
+
/**
|
|
53
|
+
* Never leaves the daemon — not on the realm, not in CLI output, not in logs.
|
|
54
|
+
* ⚠ Defaults to TRUE for names that look like credentials (see `looksSecret`); pass `false`
|
|
55
|
+
* explicitly to publish one. The unsafe direction is the one you have to type.
|
|
56
|
+
*/
|
|
57
|
+
secret?: boolean;
|
|
58
|
+
/** A start refuses unless a value is in hand (default, override, or inherited). */
|
|
59
|
+
required?: boolean;
|
|
60
|
+
}
|
|
38
61
|
interface ICommanderProcessDefinition {
|
|
39
62
|
id: string;
|
|
40
63
|
/** Default from `defaults.kind`, else "service". */
|
|
@@ -43,8 +66,13 @@ interface ICommanderProcessDefinition {
|
|
|
43
66
|
cwd?: string;
|
|
44
67
|
run: TNiceProcessRun;
|
|
45
68
|
shell?: TNiceProcessShell;
|
|
46
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Merged over the daemon's base env; `null` unsets. Values the operator is not meant to tune —
|
|
71
|
+
* a knob goes in `envVars`, and a name may not appear in both.
|
|
72
|
+
*/
|
|
47
73
|
env?: Record<string, string | null>;
|
|
74
|
+
/** Variables this process reads, offered for setting in the UI/CLI. */
|
|
75
|
+
envVars?: readonly ICommanderEnvVar[];
|
|
48
76
|
/** Default "pipe" (held open until stop); "ignore" is an instant EOF. */
|
|
49
77
|
stdin?: "pipe" | "ignore";
|
|
50
78
|
/** Free-form; `role` and `project` are the house convention. */
|
|
@@ -116,5 +144,5 @@ interface ICommanderConfig {
|
|
|
116
144
|
/** Identity helper so `commander.config.ts` files are typed end to end. */
|
|
117
145
|
declare function defineCommanderConfig<T extends ICommanderConfig>(config: T): T;
|
|
118
146
|
//#endregion
|
|
119
|
-
export { COMMANDER_ID_PATTERN, type ICommanderConfig, type ICommanderDefaults, type ICommanderEndpoint, type ICommanderEndpointHealth, type ICommanderGroupDefinition, type ICommanderProcessDefinition, type TCommanderEndpointOwnership, type TCommanderEndpointProtocol, type TCommanderReady, type TCommanderTagQuery, type TCommanderTagQueryOr, defineCommanderConfig };
|
|
147
|
+
export { COMMANDER_ID_PATTERN, type ICommanderConfig, type ICommanderDefaults, type ICommanderEndpoint, type ICommanderEndpointHealth, type ICommanderEnvVar, type ICommanderGroupDefinition, type ICommanderProcessDefinition, type TCommanderEndpointOwnership, type TCommanderEndpointProtocol, type TCommanderReady, type TCommanderTagQuery, type TCommanderTagQueryOr, defineCommanderConfig };
|
|
120
148
|
//# sourceMappingURL=config.d.mts.map
|
package/build/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["// The `./config` subpath — what a `commander.config.ts` imports. Lightweight by contract:\n// types + the identity helper only (the loader, validation and their deps stay daemon-side).\n\nimport type { ICommanderConfig } from \"./config/types\";\n\nexport {\n COMMANDER_ID_PATTERN,\n type ICommanderConfig,\n type ICommanderDefaults,\n type ICommanderEndpoint,\n type ICommanderEndpointHealth,\n type ICommanderGroupDefinition,\n type ICommanderProcessDefinition,\n type TCommanderEndpointOwnership,\n type TCommanderEndpointProtocol,\n type TCommanderReady,\n type TCommanderTagQuery,\n type TCommanderTagQueryOr,\n} from \"./config/types\";\n\n/** Identity helper so `commander.config.ts` files are typed end to end. */\nexport function defineCommanderConfig<T extends ICommanderConfig>(config: T): T {\n return config;\n}\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["// The `./config` subpath — what a `commander.config.ts` imports. Lightweight by contract:\n// types + the identity helper only (the loader, validation and their deps stay daemon-side).\n\nimport type { ICommanderConfig } from \"./config/types\";\n\nexport {\n COMMANDER_ID_PATTERN,\n type ICommanderConfig,\n type ICommanderDefaults,\n type ICommanderEndpoint,\n type ICommanderEndpointHealth,\n type ICommanderEnvVar,\n type ICommanderGroupDefinition,\n type ICommanderProcessDefinition,\n type TCommanderEndpointOwnership,\n type TCommanderEndpointProtocol,\n type TCommanderReady,\n type TCommanderTagQuery,\n type TCommanderTagQueryOr,\n} from \"./config/types\";\n\n/** Identity helper so `commander.config.ts` files are typed end to end. */\nexport function defineCommanderConfig<T extends ICommanderConfig>(config: T): T {\n return config;\n}\n"],"mappings":";;;AAsBA,SAAgB,sBAAkD,QAAc;CAC9E,OAAO;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as validateCommanderConfig, C as httpAcceptorCarrier, D as ActionRuntime, E as createDefaultServeLogger, F as orderByDependency, I as withDependencies, M as envVarViews, N as overrideFingerprint, O as RuntimeCoordinate, P as loadCommanderConfigFile, S as createRealmServerEngine, T as serveChannel, _ as writeInstanceRecord, a as commanderStatusRealm, b as resolveCommanderDataDir, f as COMMANDER_TICKET_PROTOCOL_PREFIX, g as removeInstanceRecord, h as recordDaemonAlive, i as readEnvOverrides, j as effectiveEnv, k as createMemoryStorageAdapter_json, m as readInstanceRecord, n as applyEnvMutation, o as commanderChannel, r as countOverrides, s as commanderControlDomain, t as parseLogsClientMessage, v as commanderStatePaths, w as wsAcceptorCarrier, x as createRealmAcceptor, y as ensureStateDir } from "./cli.mjs";
|
|
2
2
|
import { closeSync, createReadStream, existsSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, statSync, watch, writeFileSync, writeSync } from "node:fs";
|
|
3
3
|
import { extname, join, normalize, sep } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -323,6 +323,7 @@ function projectProcess(status) {
|
|
|
323
323
|
...status.lastExit != null ? { lastExit: projectExit(status.lastExit) } : {},
|
|
324
324
|
stale: status.stale,
|
|
325
325
|
removed: status.removed,
|
|
326
|
+
envDrift: status.envDrift,
|
|
326
327
|
...status.blockedBy != null ? { blockedBy: status.blockedBy } : {},
|
|
327
328
|
degradedBy: status.degradedBy,
|
|
328
329
|
...status.unreadyReason != null ? { unreadyReason: status.unreadyReason } : {},
|
|
@@ -344,6 +345,15 @@ function projectProcess(status) {
|
|
|
344
345
|
port: endpoint.port,
|
|
345
346
|
ownership: endpoint.ownership,
|
|
346
347
|
...endpoint.url != null ? { url: endpoint.url } : {}
|
|
348
|
+
})),
|
|
349
|
+
envVars: status.detail.envVars.map((declared) => ({
|
|
350
|
+
name: declared.name,
|
|
351
|
+
...declared.description != null ? { description: declared.description } : {},
|
|
352
|
+
secret: declared.secret,
|
|
353
|
+
required: declared.required,
|
|
354
|
+
...declared.values != null ? { values: declared.values } : {},
|
|
355
|
+
source: declared.source,
|
|
356
|
+
...declared.value != null ? { value: declared.value } : {}
|
|
347
357
|
}))
|
|
348
358
|
}
|
|
349
359
|
};
|
|
@@ -408,6 +418,10 @@ function createControlPlane(options) {
|
|
|
408
418
|
staggerMs: staggerMs ?? 0
|
|
409
419
|
});
|
|
410
420
|
},
|
|
421
|
+
setEnv: async (input) => ({
|
|
422
|
+
ok: true,
|
|
423
|
+
warnings: await options.setEnvOverrides(input)
|
|
424
|
+
}),
|
|
411
425
|
reloadConfig: async () => {
|
|
412
426
|
await options.reloadConfig();
|
|
413
427
|
return {
|
|
@@ -1006,6 +1020,7 @@ var CommanderSupervisor = class {
|
|
|
1006
1020
|
_listeners = /* @__PURE__ */ new Set();
|
|
1007
1021
|
_lineListeners = /* @__PURE__ */ new Map();
|
|
1008
1022
|
_mergedListeners = /* @__PURE__ */ new Set();
|
|
1023
|
+
_envOverrides;
|
|
1009
1024
|
_stopping = false;
|
|
1010
1025
|
constructor(options) {
|
|
1011
1026
|
this._config = options.config;
|
|
@@ -1013,6 +1028,7 @@ var CommanderSupervisor = class {
|
|
|
1013
1028
|
this._sink = options.sink;
|
|
1014
1029
|
this._depWaitMs = options.depWaitMs ?? 6e4;
|
|
1015
1030
|
this._logsDir = options.logsDir;
|
|
1031
|
+
this._envOverrides = options.envOverrides ?? {};
|
|
1016
1032
|
for (const definition of options.config.processes) this._holders.set(definition.id, this._newHolder(definition));
|
|
1017
1033
|
}
|
|
1018
1034
|
get config() {
|
|
@@ -1059,6 +1075,7 @@ var CommanderSupervisor = class {
|
|
|
1059
1075
|
return {
|
|
1060
1076
|
definition,
|
|
1061
1077
|
proc: null,
|
|
1078
|
+
envFingerprint: null,
|
|
1062
1079
|
startedAt: null,
|
|
1063
1080
|
stale: false,
|
|
1064
1081
|
removed: false,
|
|
@@ -1077,14 +1094,17 @@ var CommanderSupervisor = class {
|
|
|
1077
1094
|
return run;
|
|
1078
1095
|
}
|
|
1079
1096
|
_ensureProc(holder) {
|
|
1080
|
-
if (holder.proc != null) return holder.proc;
|
|
1081
1097
|
const definition = holder.definition;
|
|
1098
|
+
const fingerprint = overrideFingerprint(definition, this._envOverrides);
|
|
1099
|
+
if (holder.proc != null && holder.envFingerprint !== fingerprint && !ACTIVE_STATES.has(holder.proc.state)) holder.proc = null;
|
|
1100
|
+
if (holder.proc != null) return holder.proc;
|
|
1101
|
+
holder.envFingerprint = fingerprint;
|
|
1082
1102
|
const proc = createNiceProcess({
|
|
1083
1103
|
id: definition.id,
|
|
1084
1104
|
run: definition.run,
|
|
1085
1105
|
...definition.shell != null ? { shell: definition.shell } : {},
|
|
1086
1106
|
cwd: definition.cwd,
|
|
1087
|
-
env: definition.
|
|
1107
|
+
env: effectiveEnv(definition, this._envOverrides),
|
|
1088
1108
|
stdin: definition.stdin,
|
|
1089
1109
|
kind: definition.kind,
|
|
1090
1110
|
...definition.ready != null ? { ready: definition.ready } : {},
|
|
@@ -1518,6 +1538,7 @@ var CommanderSupervisor = class {
|
|
|
1518
1538
|
if (active && holder.definition.definitionHash !== definition.definitionHash) holder.stale = true;
|
|
1519
1539
|
if (!active) {
|
|
1520
1540
|
holder.proc = null;
|
|
1541
|
+
holder.envFingerprint = null;
|
|
1521
1542
|
holder.stale = false;
|
|
1522
1543
|
}
|
|
1523
1544
|
holder.definition = definition;
|
|
@@ -1528,10 +1549,24 @@ var CommanderSupervisor = class {
|
|
|
1528
1549
|
this._notify(holder.definition.id);
|
|
1529
1550
|
}
|
|
1530
1551
|
}
|
|
1552
|
+
get envOverrides() {
|
|
1553
|
+
return this._envOverrides;
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* A new override store is live. Deliberately mirrors `applyConfig` rather than restarting
|
|
1557
|
+
* anything: a running process is marked drifted (see `status`), an idle one just picks the new
|
|
1558
|
+
* values up on its next start. Changing a value must never be able to kill a dev environment.
|
|
1559
|
+
*/
|
|
1560
|
+
applyEnvOverrides(next) {
|
|
1561
|
+
this._envOverrides = next;
|
|
1562
|
+
for (const holder of this._holders.values()) this._notify(holder.definition.id);
|
|
1563
|
+
}
|
|
1531
1564
|
status() {
|
|
1532
1565
|
return [...this._holders.values()].map((holder) => {
|
|
1533
1566
|
const proc = holder.proc;
|
|
1534
1567
|
const state = proc != null ? proc.state : holder.blockedBy != null ? "blocked" : "not-started";
|
|
1568
|
+
const active = proc != null && ACTIVE_STATES.has(proc.state);
|
|
1569
|
+
const envVars = envVarViews(holder.definition, this._envOverrides, process.env);
|
|
1535
1570
|
return {
|
|
1536
1571
|
id: holder.definition.id,
|
|
1537
1572
|
kind: holder.definition.kind,
|
|
@@ -1542,12 +1577,13 @@ var CommanderSupervisor = class {
|
|
|
1542
1577
|
lastExit: proc?.lastExit ?? null,
|
|
1543
1578
|
stale: holder.stale,
|
|
1544
1579
|
removed: holder.removed,
|
|
1580
|
+
envDrift: active && holder.envFingerprint !== overrideFingerprint(holder.definition, this._envOverrides),
|
|
1545
1581
|
blockedBy: holder.blockedBy,
|
|
1546
1582
|
degradedBy: [...holder.degradedBy],
|
|
1547
1583
|
unreadyReason: proc?.unreadyReason ?? null,
|
|
1548
1584
|
capability: proc?.capability ?? null,
|
|
1549
1585
|
tags: holder.definition.tags,
|
|
1550
|
-
detail: describe(holder.definition)
|
|
1586
|
+
detail: describe(holder.definition, envVars)
|
|
1551
1587
|
};
|
|
1552
1588
|
});
|
|
1553
1589
|
}
|
|
@@ -1593,15 +1629,17 @@ var CommanderSupervisor = class {
|
|
|
1593
1629
|
/** Reverse-DAG order over the given ids (dependents stop first); definition order breaks ties. */
|
|
1594
1630
|
/**
|
|
1595
1631
|
* The parts of a resolved definition a viewer needs to answer "what is this, exactly?" without
|
|
1596
|
-
* opening the config — and nothing more. ⚠ `env` is deliberately absent: it routinely
|
|
1597
|
-
* tokens, and every attached viewer would see it.
|
|
1632
|
+
* opening the config — and nothing more. ⚠ The resolved `env` is deliberately absent: it routinely
|
|
1633
|
+
* holds tokens, and every attached viewer would see it. `envVars` carries only what the config
|
|
1634
|
+
* declared as a knob, already stripped of secrets and of inherited values by `envVarViews`.
|
|
1598
1635
|
*/
|
|
1599
|
-
function describe(definition) {
|
|
1636
|
+
function describe(definition, envVars) {
|
|
1600
1637
|
const run = definition.run;
|
|
1601
1638
|
return {
|
|
1602
1639
|
command: typeof run === "string" ? run : run.join(" "),
|
|
1603
1640
|
cwd: definition.cwd,
|
|
1604
1641
|
dependsOn: [...definition.dependsOn],
|
|
1642
|
+
envVars,
|
|
1605
1643
|
...definition.ready == null ? {} : { ready: describeReady(definition.ready) },
|
|
1606
1644
|
endpoints: definition.endpoints.map((endpoint) => ({
|
|
1607
1645
|
name: endpoint.name,
|
|
@@ -1703,21 +1741,35 @@ async function startCommanderDaemon(argv) {
|
|
|
1703
1741
|
ownerKind: "daemon"
|
|
1704
1742
|
});
|
|
1705
1743
|
const sink = new AggregateSink(paths.logsDir, paths.ingestSeqPath, generation);
|
|
1744
|
+
const envOverrides = await readEnvOverrides(paths.envOverridesPath);
|
|
1706
1745
|
const supervisor = new CommanderSupervisor({
|
|
1707
1746
|
config: resolved,
|
|
1708
1747
|
ledger,
|
|
1709
1748
|
sink,
|
|
1710
|
-
logsDir: paths.logsDir
|
|
1749
|
+
logsDir: paths.logsDir,
|
|
1750
|
+
envOverrides
|
|
1711
1751
|
});
|
|
1712
1752
|
const token = randomUUID();
|
|
1713
1753
|
const auth = new CommanderAuth(token);
|
|
1714
1754
|
const startedAt = Date.now();
|
|
1715
1755
|
let watcher = null;
|
|
1716
1756
|
let shutdown = async () => {};
|
|
1757
|
+
let envWrites = Promise.resolve();
|
|
1758
|
+
const setEnvOverrides = (input) => {
|
|
1759
|
+
const run = envWrites.then(async () => {
|
|
1760
|
+
const applied = await applyEnvMutation(paths.envOverridesPath, supervisor.config, input);
|
|
1761
|
+
supervisor.applyEnvOverrides(applied.overrides);
|
|
1762
|
+
log(`env: ${countOverrides(applied.overrides)} override(s) live`);
|
|
1763
|
+
return applied.warnings;
|
|
1764
|
+
});
|
|
1765
|
+
envWrites = run.catch(() => {});
|
|
1766
|
+
return run;
|
|
1767
|
+
};
|
|
1717
1768
|
const plane = createControlPlane({
|
|
1718
1769
|
supervisor,
|
|
1719
1770
|
generation,
|
|
1720
1771
|
reloadConfig: () => watcher?.reloadNow() ?? Promise.resolve(),
|
|
1772
|
+
setEnvOverrides,
|
|
1721
1773
|
requestShutdown: () => void shutdown(),
|
|
1722
1774
|
log
|
|
1723
1775
|
});
|
|
@@ -1867,7 +1919,7 @@ async function startCommanderDaemon(argv) {
|
|
|
1867
1919
|
configKey: resolved.configKey,
|
|
1868
1920
|
configRevisionHash: resolved.configRevisionHash,
|
|
1869
1921
|
configPath: resolved.configPath,
|
|
1870
|
-
protocolVersion:
|
|
1922
|
+
protocolVersion: 2,
|
|
1871
1923
|
packageVersion: await packageVersion()
|
|
1872
1924
|
});
|
|
1873
1925
|
watcher = watchCommanderConfig({
|
|
@@ -1951,4 +2003,4 @@ async function runCommanderDaemon(argv) {
|
|
|
1951
2003
|
//#endregion
|
|
1952
2004
|
export { runCommanderDaemon };
|
|
1953
2005
|
|
|
1954
|
-
//# sourceMappingURL=main-
|
|
2006
|
+
//# sourceMappingURL=main-BUB2LNcg.mjs.map
|