@prisma/composer-cli 0.39.0-dev.3 → 0.39.0-dev.5

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.
Files changed (43) hide show
  1. package/dist/{app-configuration-file-Cw9autUL-CPnePaG6.mjs → app-configuration-file-Bbfq5PR3-CYdGtitc.mjs} +39 -39
  2. package/dist/app-configuration-file-Bbfq5PR3-CYdGtitc.mjs.map +1 -0
  3. package/dist/{dev-current-D8GwJQex-D4xWpddG.mjs → dev-current-Dp3jvXGN-D70LmiKM.mjs} +5 -5
  4. package/dist/{dev-current-D8GwJQex-D4xWpddG.mjs.map → dev-current-Dp3jvXGN-D70LmiKM.mjs.map} +1 -1
  5. package/dist/{dev-environment-name-6eEr5PW8-DuiDkcM6.mjs → dev-environment-name-6eEr5PW8-kDiScOL8.mjs} +2 -2
  6. package/dist/{dev-environment-name-6eEr5PW8-DuiDkcM6.mjs.map → dev-environment-name-6eEr5PW8-kDiScOL8.mjs.map} +1 -1
  7. package/dist/{dist-qqNor5kl.mjs → dist-BDdABTj4.mjs} +2 -2
  8. package/dist/{dist-qqNor5kl.mjs.map → dist-BDdABTj4.mjs.map} +1 -1
  9. package/dist/{execute-deploy-destroy-1SIH5uAu-SJMSVJ-C.mjs → execute-deploy-destroy-J0buFSWK-9ELg3Sll.mjs} +302 -71
  10. package/dist/execute-deploy-destroy-J0buFSWK-9ELg3Sll.mjs.map +1 -0
  11. package/dist/{execute-dev-xPaS5SAl-Pf5LvC3G.mjs → execute-dev-B5YaMqpD-B_vgpelT.mjs} +11 -13
  12. package/dist/{execute-dev-xPaS5SAl-Pf5LvC3G.mjs.map → execute-dev-B5YaMqpD-B_vgpelT.mjs.map} +1 -1
  13. package/dist/{execute-dev-current-DsAsDBB1-C_Pqg6lv.mjs → execute-dev-current-C7le-kh2-Dg2L_3P3.mjs} +6 -6
  14. package/dist/{execute-dev-current-DsAsDBB1-C_Pqg6lv.mjs.map → execute-dev-current-C7le-kh2-Dg2L_3P3.mjs.map} +1 -1
  15. package/dist/{redaction-CqdeMBKw-B6ldtfDI.d.mts → family-D52hWFMF-Cj-y7XrD.d.mts} +199 -92
  16. package/dist/family-D52hWFMF-Cj-y7XrD.d.mts.map +1 -0
  17. package/dist/family.d.mts +1 -1
  18. package/dist/family.mjs +221 -197
  19. package/dist/family.mjs.map +1 -1
  20. package/dist/{generate-dev-stack-BEpqJ3AH-BwP97FIX.mjs → generate-dev-stack-BEpqJ3AH-B7o7JyER.mjs} +2 -2
  21. package/dist/{generate-dev-stack-BEpqJ3AH-BwP97FIX.mjs.map → generate-dev-stack-BEpqJ3AH-B7o7JyER.mjs.map} +1 -1
  22. package/dist/{list-deployed-BAKSI43Y.mjs → list-deployed-Cq5EKrVn.mjs} +4 -4
  23. package/dist/list-deployed-Cq5EKrVn.mjs.map +1 -0
  24. package/dist/{redaction-C-NnlVUh-xg-a8RGt.mjs → redaction-CjMYXtGp-CYefSG9A.mjs} +17 -6
  25. package/dist/redaction-CjMYXtGp-CYefSG9A.mjs.map +1 -0
  26. package/dist/{run-alchemy-CyciV8i0-Djfa6x3a.mjs → run-alchemy-BlYyc4Oh-BnFv0AaY.mjs} +70 -4
  27. package/dist/run-alchemy-BlYyc4Oh-BnFv0AaY.mjs.map +1 -0
  28. package/dist/testing.d.mts +4 -4
  29. package/dist/testing.d.mts.map +1 -1
  30. package/dist/testing.mjs +4 -74
  31. package/dist/testing.mjs.map +1 -1
  32. package/dist/{validate-environment-DyW59rJ7-B1PoUO20.mjs → validate-environment-XwVDifWN-BtzIWXJF.mjs} +9 -6
  33. package/dist/validate-environment-XwVDifWN-BtzIWXJF.mjs.map +1 -0
  34. package/package.json +9 -9
  35. package/dist/app-configuration-file-Cw9autUL-CPnePaG6.mjs.map +0 -1
  36. package/dist/execute-deploy-destroy-1SIH5uAu-SJMSVJ-C.mjs.map +0 -1
  37. package/dist/list-deployed-BAKSI43Y.mjs.map +0 -1
  38. package/dist/preflight-transport-DJjTWvyH-C98XN-K2.mjs +0 -76
  39. package/dist/preflight-transport-DJjTWvyH-C98XN-K2.mjs.map +0 -1
  40. package/dist/redaction-C-NnlVUh-xg-a8RGt.mjs.map +0 -1
  41. package/dist/redaction-CqdeMBKw-B6ldtfDI.d.mts.map +0 -1
  42. package/dist/run-alchemy-CyciV8i0-Djfa6x3a.mjs.map +0 -1
  43. package/dist/validate-environment-DyW59rJ7-B1PoUO20.mjs.map +0 -1
package/dist/family.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { d as checkComposerConfig, h as sectionMissing } from "./redaction-C-NnlVUh-xg-a8RGt.mjs";
2
- import { n as platformVariableReaderText } from "./preflight-transport-DJjTWvyH-C98XN-K2.mjs";
1
+ import { d as checkComposerConfig, h as sectionMissing, n as SecretRedaction } from "./redaction-CjMYXtGp-CYefSG9A.mjs";
3
2
  import { a as quotedList } from "./result-DlBttLS8.mjs";
4
- import { a as devWithDeps, i as devUrl, n as deployWithDeps, o as executionDiagnostics, r as devStop, t as DEFAULT_DEPLOY_ENVIRONMENT } from "./dev-current-D8GwJQex-D4xWpddG.mjs";
5
- import { t as alchemyCommandLine } from "./run-alchemy-CyciV8i0-Djfa6x3a.mjs";
3
+ import { o as platformVariableReaderText, t as alchemyCommandLine } from "./run-alchemy-BlYyc4Oh-BnFv0AaY.mjs";
4
+ import { a as devWithDeps, i as devUrl, n as deployWithDeps, o as executionDiagnostics, r as devStop, t as DEFAULT_DEPLOY_ENVIRONMENT } from "./dev-current-Dp3jvXGN-D70LmiKM.mjs";
6
5
  import * as path from "node:path";
6
+ import { format } from "node:util";
7
7
  import { defineCommand, defineCommandFamily, defineConfigSection, defineSessionCommand, exitWithChildStatus, flag, positional } from "@prisma/cli-engine";
8
8
  import { CliStructuredError, notOk, ok } from "@prisma/cli-engine/protocol";
9
9
  //#region ../../0-framework/3-tooling/cli/dist/unset-platform-variables-B0aMhHaR.mjs
@@ -32,137 +32,30 @@ function fieldText(field) {
32
32
  function dataLine(fields) {
33
33
  return fields.map(fieldText).join(" ");
34
34
  }
35
+ const METHODS = [
36
+ "log",
37
+ "info",
38
+ "debug",
39
+ "dir",
40
+ "table",
41
+ "warn",
42
+ "error"
43
+ ];
35
44
  /**
36
- * The family boundary's error translation.
37
- *
38
- * Composer and the engine each carry a class called `CliStructuredError`, both
39
- * descended from the same prisma/prisma foundation, and both recognize errors
40
- * by duck-typing on `name === 'CliStructuredError'`. That means a composer
41
- * error handed to the engine untranslated is ACCEPTED — it does not fail
42
- * loudly, it renders. What it loses is its `fix`: composer's foundation
43
- * carries remediation as one prose string on that field, the engine carries it
44
- * as a `nextActions` list and has no `fix` at all, so the fix text is dropped
45
- * silently and the user is told what broke with no word on what to do about
46
- * it. Nothing about that failure is visible without a test that looks for the
47
- * fix on the other side, which is why there is one.
48
- *
49
- * Everything else on the envelope survives as-is; only remediation changes
50
- * representation.
51
- */
52
- /**
53
- * Composer's `fix` is free prose — "add this overrides block and reinstall",
54
- * "run the build, then retry" — with no machine-readable command inside it.
55
- * `user-choice` is the engine's own kind for exactly that (it is what the
56
- * engine uses for its own config and prompt failures), so the text carries
57
- * over verbatim as one action rather than being parsed into a command the
58
- * author never wrote.
59
- */
60
- function fixAsNextActions(fix) {
61
- return fix === void 0 ? [] : [{
62
- kind: "user-choice",
63
- label: fix
64
- }];
65
- }
66
- /** Translates a composer failure into the engine's error type. Composer-side detail — `meta`, `where`, `docsUrl` — rides along untouched. */
67
- function toEngineError(error) {
68
- return new CliStructuredError(error.code, error.message, {
69
- severity: error.severity,
70
- nextActions: fixAsNextActions(error.fix),
71
- ...error.why === void 0 ? {} : { why: error.why },
72
- ...error.where === void 0 ? {} : { where: error.where },
73
- ...error.meta === void 0 ? {} : { meta: error.meta },
74
- ...error.docsUrl === void 0 ? {} : { docsUrl: error.docsUrl },
75
- cause: error
76
- });
77
- }
78
- /**
79
- * Node's `--import` of a module that sends the child's stdout to stderr when
80
- * stdout is not a terminal. In human format the engine hands a piped run's
81
- * stdout to the child, and that pipe carries only the parent's data lines.
82
- */
83
- const STDOUT_TO_STDERR = ["--import", `data:text/javascript,${encodeURIComponent("if (process.stdout.isTTY !== true) process.stdout.write = process.stderr.write.bind(process.stderr);")}`];
84
- /** The adapter the operations call, backed by the engine's `ctx.spawn` so the
85
- * terminal reaches alchemy natively and the engine owns signal policy. It
86
- * ignores `invocation.redactedValues`: the child writes to the terminal, so
87
- * its output is not redacted (ADR-0062). */
88
- function convergeSpawn(ctx) {
89
- return async (invocation) => {
90
- const commandLine = alchemyCommandLine(invocation);
91
- return {
92
- ...await ctx.spawn({
93
- command: commandLine.command,
94
- args: [...STDOUT_TO_STDERR, ...commandLine.args],
95
- cwd: commandLine.cwd,
96
- env: commandLine.env
97
- }),
98
- commandLine
99
- };
100
- };
101
- }
102
- /** The in-process leg's deps: composer's existing seam, carrying the engine's
103
- * own client and workspace id rather than anything read from the env. */
104
- function operationDeps(spec) {
105
- return {
106
- alchemy: spec.alchemy,
107
- credentials: {
108
- workspaceId: spec.workspaceId,
109
- client: spec.client
110
- }
111
- };
112
- }
113
- /**
114
- * The reproduce hint a failed converge carries. Deliberately absent for an
115
- * aborted one: the user stopped it, so there is nothing to reproduce.
116
- */
117
- function reproduceHint(failure) {
118
- const diagnostics = executionDiagnostics(failure);
119
- if (diagnostics === void 0) return [];
120
- return [{
121
- kind: "run-command",
122
- label: `Run the converge directly from ${diagnostics.cwd} to reproduce this`,
123
- command: diagnostics.reproduceCommand,
124
- reason: `Generated stack file: ${diagnostics.stackFilePath}`
125
- }];
126
- }
127
- /**
128
- * How a FAILED converge settles. `deploy` and `dev` both end this
129
- * way and must not drift apart, so the decision lives here once rather than
130
- * inline in each handler.
131
- *
132
- * A failure that reached the child exits with the child's status verbatim and
133
- * carries the reproduce hint; a failure that never reached the child is an
134
- * ordinary structured error and gets the normal envelope. Nothing here reads
135
- * `signal` — see settleConverge.
136
- */
137
- function settleConvergeFailure(failure, ctx) {
138
- const child = ctx.lastChild();
139
- if (child !== void 0 && child.exitCode !== 0) return ok(exitWithChildStatus({ nextActions: reproduceHint(failure) }));
140
- return notOk(toEngineError(failure));
141
- }
142
- /**
143
- * How a converge settles, now that the engine owns the child's status.
144
- *
145
- * Nothing here reads `signal`. `exitWithChildStatus` settles from the engine's
146
- * own record of the child, and a signal-killed one overrules whatever this
147
- * function asked for: 128 + the signal, no failure envelope, and the reproduce
148
- * hint dropped, because the user stopped the run and there is nothing to
149
- * reproduce.
150
- *
151
- * What is left is the operation's own verdict. A failure that reached the
152
- * child exits with the child's status verbatim and carries the reproduce hint;
153
- * a failure that never reached the child is an ordinary structured error and
154
- * gets the normal envelope.
155
- *
156
- * A SUCCESS presents its result even when the child was signal-killed. No
157
- * composer operation produces that pair today — each one reports a
158
- * signal-killed converge as a failure — and an operation that ever did would
159
- * have a real result worth showing. The run still exits 130, because the
160
- * engine settles a signal-terminated run from its own record of the signal
161
- * whatever the handler returns.
45
+ * Runs `run` with every `console` method writing to stderr through `redact`,
46
+ * and restores them after: stdout carries the command's data lines and JSON
47
+ * frames, so a provider's `console.log` during the apply must not land among
48
+ * them.
162
49
  */
163
- function settleConverge(result, ctx, present) {
164
- if (!result.ok) return settleConvergeFailure(result.failure, ctx);
165
- return ok(present(result.value));
50
+ async function withConsoleOnStderr(redact, run) {
51
+ const saved = METHODS.map((method) => [method, console[method]]);
52
+ const error = console.error;
53
+ try {
54
+ for (const method of METHODS) console[method] = (...args) => error.call(console, redact(format(...args)));
55
+ return await run();
56
+ } finally {
57
+ for (const [method, original] of saved) Object.assign(console, { [method]: original });
58
+ }
166
59
  }
167
60
  function diagnostic(finding, file) {
168
61
  const where = finding.where ?? file;
@@ -205,18 +98,47 @@ const composerSection = defineConfigSection({
205
98
  merge: (_parent, child) => child
206
99
  });
207
100
  /**
208
- * The workspace the in-process leg acts in, from the engine's credential
209
- * read. Handlers never decode a token and never read PRISMA_WORKSPACE_ID:
210
- * whether the credential came from a stored session or the environment, the
211
- * engine has already resolved it, and branching on where it came from is a
212
- * defect by the credential-manager design.
101
+ * The family boundary's error translation.
102
+ *
103
+ * Composer and the engine each carry a class called `CliStructuredError`, both
104
+ * descended from the same prisma/prisma foundation, and both recognize errors
105
+ * by duck-typing on `name === 'CliStructuredError'`. That means a composer
106
+ * error handed to the engine untranslated is ACCEPTED — it does not fail
107
+ * loudly, it renders. What it loses is its `fix`: composer's foundation
108
+ * carries remediation as one prose string on that field, the engine carries it
109
+ * as a `nextActions` list and has no `fix` at all, so the fix text is dropped
110
+ * silently and the user is told what broke with no word on what to do about
111
+ * it. Nothing about that failure is visible without a test that looks for the
112
+ * fix on the other side, which is why there is one.
213
113
  *
214
- * Undefined when the active credential names no workspace — an environment
215
- * token whose claims carry none. The container descriptors raise their own
216
- * "workspace required" error in that case, which is the error the user needs.
114
+ * Everything else on the envelope survives as-is; only remediation changes
115
+ * representation.
217
116
  */
218
- async function workspaceIdOf(ctx) {
219
- return (await ctx.activeCredential())?.workspaceId;
117
+ /**
118
+ * Composer's `fix` is free prose — "add this overrides block and reinstall",
119
+ * "run the build, then retry" — with no machine-readable command inside it.
120
+ * `user-choice` is the engine's own kind for exactly that (it is what the
121
+ * engine uses for its own config and prompt failures), so the text carries
122
+ * over verbatim as one action rather than being parsed into a command the
123
+ * author never wrote.
124
+ */
125
+ function fixAsNextActions(fix) {
126
+ return fix === void 0 ? [] : [{
127
+ kind: "user-choice",
128
+ label: fix
129
+ }];
130
+ }
131
+ /** Translates a composer failure into the engine's error type. Composer-side detail — `meta`, `where`, `docsUrl` — rides along untouched. */
132
+ function toEngineError(error) {
133
+ return new CliStructuredError(error.code, error.message, {
134
+ severity: error.severity,
135
+ nextActions: fixAsNextActions(error.fix),
136
+ ...error.why === void 0 ? {} : { why: error.why },
137
+ ...error.where === void 0 ? {} : { where: error.where },
138
+ ...error.meta === void 0 ? {} : { meta: error.meta },
139
+ ...error.docsUrl === void 0 ? {} : { docsUrl: error.docsUrl },
140
+ cause: error
141
+ });
220
142
  }
221
143
  const STEP_LABELS = {
222
144
  prepare: "load config and app",
@@ -227,10 +149,25 @@ const STEP_LABELS = {
227
149
  record: "record result"
228
150
  };
229
151
  function stepLabel(step) {
230
- return step.name === "assemble-service" ? `assemble ${step.address}` : STEP_LABELS[step.name];
152
+ switch (step.name) {
153
+ case "assemble-service": return `assemble ${step.address}`;
154
+ case "apply-resource": return `${step.status} ${step.resourceId}`;
155
+ default: return STEP_LABELS[step.name];
156
+ }
231
157
  }
232
158
  function stepId(step) {
233
- return step.name === "assemble-service" ? `deploy.assemble.${step.address}` : `deploy.${step.name}`;
159
+ switch (step.name) {
160
+ case "assemble-service": return `deploy.assemble.${step.address}`;
161
+ case "apply-resource": return `deploy.apply.${step.resourceId}`;
162
+ default: return `deploy.${step.name}`;
163
+ }
164
+ }
165
+ function parentId(step) {
166
+ switch (step.name) {
167
+ case "assemble-service": return "deploy.assemble";
168
+ case "apply-resource": return "deploy.apply";
169
+ default: return;
170
+ }
234
171
  }
235
172
  /** `850ms`, `12.3s`, `9m 35s`. */
236
173
  function formatDuration(ms) {
@@ -239,8 +176,13 @@ function formatDuration(ms) {
239
176
  const seconds = Math.round(ms / 1e3);
240
177
  return `${String(Math.floor(seconds / 60))}m ${String(seconds % 60)}s`;
241
178
  }
242
- /** The operation's events as engine events. */
179
+ /** The operation's events as engine events. The engine prints only `step`, so a finished step carries its duration in the text too. */
243
180
  function toEngineEvent(event) {
181
+ if (event.kind === "message") return {
182
+ kind: "message",
183
+ severity: event.severity,
184
+ text: event.text
185
+ };
244
186
  if (event.kind === "preflight-findings") {
245
187
  const text = unsetPlatformVariablesText(event.findings.unset);
246
188
  return text === void 0 ? void 0 : {
@@ -251,12 +193,16 @@ function toEngineEvent(event) {
251
193
  };
252
194
  }
253
195
  const id = stepId(event.step);
254
- if (event.kind === "step-started") return {
255
- kind: "step-started",
256
- step: stepLabel(event.step),
257
- id,
258
- ...event.step.name === "assemble-service" ? { parentId: "deploy.assemble" } : {}
259
- };
196
+ if (event.kind === "step-started") {
197
+ const parent = parentId(event.step);
198
+ return {
199
+ kind: "step-started",
200
+ step: stepLabel(event.step),
201
+ id,
202
+ ...parent === void 0 ? {} : { parentId: parent },
203
+ ...event.step.name === "apply-resource" ? { data: { resourceType: event.step.resourceType } } : {}
204
+ };
205
+ }
260
206
  return {
261
207
  kind: "step-finished",
262
208
  step: `${stepLabel(event.step)} (${formatDuration(event.durationMs)})`,
@@ -302,12 +248,12 @@ const createDeployCommand = (operations) => defineCommand({
302
248
  } },
303
249
  needs: {
304
250
  config: composerSection,
305
- credentials: "child"
251
+ credentials: true
306
252
  },
307
- maySpawn: true,
308
253
  handler: async (args, ctx) => {
309
- const alchemy = convergeSpawn(ctx);
310
- return settleConverge(await operations.deploy({
254
+ const credential = await ctx.activeCredential();
255
+ const redaction = new SecretRedaction(process.env);
256
+ const result = await withConsoleOnStderr((text) => redaction.redact(text), () => operations.deploy({
311
257
  entry: args.flags.entry,
312
258
  config: ctx.config,
313
259
  name: args.flags.name,
@@ -318,51 +264,129 @@ const createDeployCommand = (operations) => defineCommand({
318
264
  onEvent: (event) => {
319
265
  const engineEvent = toEngineEvent(event);
320
266
  if (engineEvent !== void 0) ctx.report(engineEvent);
267
+ },
268
+ signal: ctx.signal
269
+ }, {
270
+ credentials: {
271
+ workspaceId: credential?.workspaceId,
272
+ client: ctx.api
273
+ },
274
+ redaction
275
+ }));
276
+ if (!result.ok) {
277
+ if (result.failure.code === "DEPLOY.INTERRUPTED" && ctx.signal.aborted) {
278
+ const { code, message, why, fix } = result.failure;
279
+ ctx.report({
280
+ kind: "message",
281
+ severity: "warn",
282
+ text: `${message} ${fix ?? ""}`.trim(),
283
+ data: {
284
+ code,
285
+ message,
286
+ why,
287
+ fix
288
+ }
289
+ });
290
+ throw ctx.signal.reason;
321
291
  }
322
- }, operationDeps({
323
- alchemy,
324
- workspaceId: await workspaceIdOf(ctx),
325
- client: ctx.api
326
- })), ctx, ({ summary, durationMs }) => {
327
- const target = `to ${args.flags.environment ?? "production"} in ${formatDuration(durationMs)}`;
328
- for (const node of summary?.nodes ?? []) for (const entity of node.entities) if (entity.url !== void 0) ctx.report({
329
- kind: "endpoint",
330
- name: node.address,
331
- url: entity.url
332
- });
333
- return ctx.present({ data: {
292
+ return notOk(toEngineError(result.failure));
293
+ }
294
+ const { summary, durationMs } = result.value;
295
+ const unsetText = summary === void 0 ? void 0 : unsetPlatformVariablesText(summary.findings.unset);
296
+ const target = `to ${args.flags.environment ?? "production"} in ${formatDuration(durationMs)}`;
297
+ for (const node of summary?.nodes ?? []) for (const entity of node.entities) if (entity.url !== void 0) ctx.report({
298
+ kind: "endpoint",
299
+ name: node.address,
300
+ url: entity.url
301
+ });
302
+ return ok(ctx.present({ data: {
303
+ summary: summary ?? null,
304
+ durationMs
305
+ } }, {
306
+ human: (ui) => [...summary === void 0 ? [{
307
+ kind: "summary",
308
+ status: "ok",
309
+ text: `Deployed ${target}.`
310
+ }] : [{
311
+ kind: "summary",
312
+ status: "ok",
313
+ text: `Deployed ${ui.emphasize(summary.app)} ${target}.`
314
+ }, {
315
+ kind: "table",
316
+ columns: ["Address", "Deployed"],
317
+ rows: summary.nodes.map((node) => [node.address, node.entities.map((entity) => `${entity.kind} ${entity.id}`).join(", ")])
318
+ }], ...unsetText === void 0 ? [] : [{
319
+ kind: "drawing",
320
+ lines: unsetText.split("\n")
321
+ }]],
322
+ stdout: () => (summary?.nodes ?? []).flatMap((node) => node.entities.map((entity) => dataLine([
323
+ node.address,
324
+ entity.kind,
325
+ entity.id,
326
+ entity.url
327
+ ]))),
328
+ json: () => ({
334
329
  summary: summary ?? null,
335
330
  durationMs
336
- } }, {
337
- human: (ui) => summary === void 0 ? [{
338
- kind: "summary",
339
- status: "ok",
340
- text: `Deployed ${target}.`
341
- }] : [{
342
- kind: "summary",
343
- status: "ok",
344
- text: `Deployed ${ui.emphasize(summary.app)} ${target}.`
345
- }, {
346
- kind: "table",
347
- columns: ["Address", "Deployed"],
348
- rows: summary.nodes.map((node) => [node.address, node.entities.map((entity) => `${entity.kind} ${entity.id}`).join(", ")])
349
- }],
350
- stdout: () => (summary?.nodes ?? []).flatMap((node) => node.entities.map((entity) => dataLine([
351
- node.address,
352
- entity.kind,
353
- entity.id,
354
- entity.url
355
- ]))),
356
- json: () => ({
357
- summary: summary ?? null,
358
- durationMs
359
- }),
360
- next: () => []
361
- });
362
- });
331
+ }),
332
+ next: () => []
333
+ }));
363
334
  }
364
335
  });
365
336
  /**
337
+ * Node's `--import` of a module that sends the child's stdout to stderr when
338
+ * stdout is not a terminal. In human format the engine hands a piped run's
339
+ * stdout to the child, and that pipe carries only the parent's data lines.
340
+ */
341
+ const STDOUT_TO_STDERR = ["--import", `data:text/javascript,${encodeURIComponent("if (process.stdout.isTTY !== true) process.stdout.write = process.stderr.write.bind(process.stderr);")}`];
342
+ /** The adapter the operations call, backed by the engine's `ctx.spawn` so the
343
+ * terminal reaches alchemy natively and the engine owns signal policy. It
344
+ * ignores `invocation.redactedValues`: the child writes to the terminal, so
345
+ * its output is not redacted (ADR-0062). */
346
+ function convergeSpawn(ctx) {
347
+ return async (invocation) => {
348
+ const commandLine = alchemyCommandLine(invocation);
349
+ return {
350
+ ...await ctx.spawn({
351
+ command: commandLine.command,
352
+ args: [...STDOUT_TO_STDERR, ...commandLine.args],
353
+ cwd: commandLine.cwd,
354
+ env: commandLine.env
355
+ }),
356
+ commandLine
357
+ };
358
+ };
359
+ }
360
+ /**
361
+ * The reproduce hint a failed converge carries. Deliberately absent for an
362
+ * aborted one: the user stopped it, so there is nothing to reproduce.
363
+ */
364
+ function reproduceHint(failure) {
365
+ const diagnostics = executionDiagnostics(failure);
366
+ if (diagnostics === void 0) return [];
367
+ return [{
368
+ kind: "run-command",
369
+ label: `Run the converge directly from ${diagnostics.cwd} to reproduce this`,
370
+ command: diagnostics.reproduceCommand,
371
+ reason: `Generated stack file: ${diagnostics.stackFilePath}`
372
+ }];
373
+ }
374
+ /**
375
+ * How a FAILED `dev` converge settles.
376
+ *
377
+ * A failure that reached the child exits with the child's status verbatim and
378
+ * carries the reproduce hint; a failure that never reached the child is an
379
+ * ordinary structured error and gets the normal envelope. Nothing here reads
380
+ * `signal`: `exitWithChildStatus` settles from the engine's own record of the
381
+ * child, and a signal-killed one overrules it with 128 + the signal and no
382
+ * reproduce hint.
383
+ */
384
+ function settleConvergeFailure(failure, ctx) {
385
+ const child = ctx.lastChild();
386
+ if (child !== void 0 && child.exitCode !== 0) return ok(exitWithChildStatus({ nextActions: reproduceHint(failure) }));
387
+ return notOk(toEngineError(failure));
388
+ }
389
+ /**
366
390
  * `dev` — a session command that runs the local dev loop until the
367
391
  * user interrupts it.
368
392
  *
@@ -880,7 +904,7 @@ function createComposerFamily$1(options = {}) {
880
904
  * assembled into the family here, where both domains may be imported.
881
905
  */
882
906
  /** Loaded on first use, so nothing of the Management API reads loads with the family. */
883
- const listDeployed = async (input) => (await import("./list-deployed-BAKSI43Y.mjs")).listDeployed(input);
907
+ const listDeployed = async (input) => (await import("./list-deployed-Cq5EKrVn.mjs")).listDeployed(input);
884
908
  const createDeployListCommand = (list) => defineCommand({
885
909
  help: {
886
910
  summary: "List every node the app has deployed in an environment, with its platform ID and URL.",
@@ -959,7 +983,7 @@ const createDeployListCommand = (list) => defineCommand({
959
983
  * family here, where both domains may be imported.
960
984
  */
961
985
  /** Loaded on first use, so nothing of the emulators' clients loads with the family. */
962
- const listEmulators = async () => (await import("./dist-qqNor5kl.mjs")).listEmulators();
986
+ const listEmulators = async () => (await import("./dist-BDdABTj4.mjs")).listEmulators();
963
987
  const EMULATOR_NAMES = {
964
988
  service: "Service emulator",
965
989
  database: "Database emulator",