@canonical/summon-core 0.34.0 → 0.36.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.
Files changed (177) hide show
  1. package/dist/esm/discovery/discoverGeneratorTree.js +14 -10
  2. package/dist/esm/discovery/discoverGeneratorTree.js.map +1 -1
  3. package/dist/esm/execute/collectAnswers.js +21 -16
  4. package/dist/esm/execute/collectAnswers.js.map +1 -1
  5. package/dist/esm/execute/execute.js +67 -22
  6. package/dist/esm/execute/execute.js.map +1 -1
  7. package/dist/esm/execute/index.js +1 -1
  8. package/dist/esm/execute/index.js.map +1 -1
  9. package/dist/esm/execute/validateAnswers.js +19 -5
  10. package/dist/esm/execute/validateAnswers.js.map +1 -1
  11. package/dist/esm/format/effects.js +197 -51
  12. package/dist/esm/format/effects.js.map +1 -1
  13. package/dist/esm/format/formatFlagName.js +17 -0
  14. package/dist/esm/format/formatFlagName.js.map +1 -0
  15. package/dist/esm/format/index.js +24 -1
  16. package/dist/esm/format/index.js.map +1 -1
  17. package/dist/esm/index.js +3 -3
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/projection/answers.js +84 -0
  20. package/dist/esm/projection/answers.js.map +1 -0
  21. package/dist/esm/projection/buildOptionInfo.js +77 -0
  22. package/dist/esm/projection/buildOptionInfo.js.map +1 -0
  23. package/dist/esm/projection/commander/configureGroupedHelp.js +39 -0
  24. package/dist/esm/projection/commander/configureGroupedHelp.js.map +1 -0
  25. package/dist/esm/projection/commander/emitToProcess.js +15 -0
  26. package/dist/esm/projection/commander/emitToProcess.js.map +1 -0
  27. package/dist/esm/projection/commander/index.js +20 -0
  28. package/dist/esm/projection/commander/index.js.map +1 -0
  29. package/dist/esm/projection/commander/registerGeneratorCommands.js +222 -0
  30. package/dist/esm/projection/commander/registerGeneratorCommands.js.map +1 -0
  31. package/dist/esm/projection/decideInteraction.js +73 -0
  32. package/dist/esm/projection/decideInteraction.js.map +1 -0
  33. package/dist/esm/projection/extractAnswers.js +52 -0
  34. package/dist/esm/projection/extractAnswers.js.map +1 -0
  35. package/dist/esm/projection/groupedHelp.js +74 -0
  36. package/dist/esm/projection/groupedHelp.js.map +1 -0
  37. package/dist/esm/projection/index.js +26 -0
  38. package/dist/esm/projection/index.js.map +1 -0
  39. package/dist/esm/projection/kebab.js +18 -0
  40. package/dist/esm/projection/kebab.js.map +1 -0
  41. package/dist/esm/projection/projectGenerator.js +46 -0
  42. package/dist/esm/projection/projectGenerator.js.map +1 -0
  43. package/dist/esm/projection/types.js +16 -0
  44. package/dist/esm/projection/types.js.map +1 -0
  45. package/dist/esm/projection/usage.js +144 -0
  46. package/dist/esm/projection/usage.js.map +1 -0
  47. package/dist/esm/prompt/answerPromptWithDefaults.js +7 -5
  48. package/dist/esm/prompt/answerPromptWithDefaults.js.map +1 -1
  49. package/dist/esm/prompt/autoPrompt.js +2 -3
  50. package/dist/esm/prompt/autoPrompt.js.map +1 -1
  51. package/dist/esm/prompt/ink/Wizard.js +44 -8
  52. package/dist/esm/prompt/ink/Wizard.js.map +1 -1
  53. package/dist/esm/prompt/ink/mount.js +20 -8
  54. package/dist/esm/prompt/ink/mount.js.map +1 -1
  55. package/dist/esm/prompt/ink/progressWindow.js +131 -3
  56. package/dist/esm/prompt/ink/progressWindow.js.map +1 -1
  57. package/dist/esm/prompt/ink/session.js +135 -14
  58. package/dist/esm/prompt/ink/session.js.map +1 -1
  59. package/dist/esm/prompt/inkPrompt.js +18 -2
  60. package/dist/esm/prompt/inkPrompt.js.map +1 -1
  61. package/dist/esm/prompt/mcpPrompt.js +1 -1
  62. package/dist/esm/prompt/mcpPrompt.js.map +1 -1
  63. package/dist/esm/stamp/applyStamp.js +50 -52
  64. package/dist/esm/stamp/applyStamp.js.map +1 -1
  65. package/dist/esm/stamp/createStampOnEffectStart.js +4 -1
  66. package/dist/esm/stamp/createStampOnEffectStart.js.map +1 -1
  67. package/dist/esm/stamp/runTaskWithStamp.js +8 -9
  68. package/dist/esm/stamp/runTaskWithStamp.js.map +1 -1
  69. package/dist/esm/template/index.js +2 -0
  70. package/dist/esm/template/index.js.map +1 -1
  71. package/dist/esm/template/loadTemplate.js +43 -0
  72. package/dist/esm/template/loadTemplate.js.map +1 -0
  73. package/dist/esm/template/prependStamp.js +11 -8
  74. package/dist/esm/template/prependStamp.js.map +1 -1
  75. package/dist/esm/template/rawFile.js +25 -0
  76. package/dist/esm/template/rawFile.js.map +1 -0
  77. package/dist/esm/template/tasks/template.js +12 -3
  78. package/dist/esm/template/tasks/template.js.map +1 -1
  79. package/dist/esm/template/tasks/templateDir.js +5 -0
  80. package/dist/esm/template/tasks/templateDir.js.map +1 -1
  81. package/dist/esm/testing/conformance/fixtures.js +0 -2
  82. package/dist/esm/testing/conformance/fixtures.js.map +1 -1
  83. package/dist/esm/testing/conformance/flagizeAnswers.js +91 -0
  84. package/dist/esm/testing/conformance/flagizeAnswers.js.map +1 -0
  85. package/dist/esm/testing/conformance/index.js +1 -0
  86. package/dist/esm/testing/conformance/index.js.map +1 -1
  87. package/dist/esm/testing/index.js +1 -1
  88. package/dist/esm/testing/index.js.map +1 -1
  89. package/dist/types/discovery/discoverGeneratorTree.d.ts +3 -3
  90. package/dist/types/discovery/discoverGeneratorTree.d.ts.map +1 -1
  91. package/dist/types/execute/collectAnswers.d.ts +4 -3
  92. package/dist/types/execute/collectAnswers.d.ts.map +1 -1
  93. package/dist/types/execute/execute.d.ts +27 -1
  94. package/dist/types/execute/execute.d.ts.map +1 -1
  95. package/dist/types/execute/index.d.ts +1 -1
  96. package/dist/types/execute/index.d.ts.map +1 -1
  97. package/dist/types/execute/validateAnswers.d.ts.map +1 -1
  98. package/dist/types/format/effects.d.ts +61 -7
  99. package/dist/types/format/effects.d.ts.map +1 -1
  100. package/dist/types/format/formatFlagName.d.ts +14 -0
  101. package/dist/types/format/formatFlagName.d.ts.map +1 -0
  102. package/dist/types/format/index.d.ts +21 -1
  103. package/dist/types/format/index.d.ts.map +1 -1
  104. package/dist/types/index.d.ts +5 -5
  105. package/dist/types/index.d.ts.map +1 -1
  106. package/dist/types/projection/answers.d.ts +54 -0
  107. package/dist/types/projection/answers.d.ts.map +1 -0
  108. package/dist/types/projection/buildOptionInfo.d.ts +25 -0
  109. package/dist/types/projection/buildOptionInfo.d.ts.map +1 -0
  110. package/dist/types/projection/commander/configureGroupedHelp.d.ts +29 -0
  111. package/dist/types/projection/commander/configureGroupedHelp.d.ts.map +1 -0
  112. package/dist/types/projection/commander/emitToProcess.d.ts +10 -0
  113. package/dist/types/projection/commander/emitToProcess.d.ts.map +1 -0
  114. package/dist/types/projection/commander/index.d.ts +21 -0
  115. package/dist/types/projection/commander/index.d.ts.map +1 -0
  116. package/dist/types/projection/commander/registerGeneratorCommands.d.ts +95 -0
  117. package/dist/types/projection/commander/registerGeneratorCommands.d.ts.map +1 -0
  118. package/dist/types/projection/decideInteraction.d.ts +70 -0
  119. package/dist/types/projection/decideInteraction.d.ts.map +1 -0
  120. package/dist/types/projection/extractAnswers.d.ts +23 -0
  121. package/dist/types/projection/extractAnswers.d.ts.map +1 -0
  122. package/dist/types/projection/groupedHelp.d.ts +25 -0
  123. package/dist/types/projection/groupedHelp.d.ts.map +1 -0
  124. package/dist/types/projection/index.d.ts +29 -0
  125. package/dist/types/projection/index.d.ts.map +1 -0
  126. package/dist/types/projection/kebab.d.ts +16 -0
  127. package/dist/types/projection/kebab.d.ts.map +1 -0
  128. package/dist/types/projection/projectGenerator.d.ts +22 -0
  129. package/dist/types/projection/projectGenerator.d.ts.map +1 -0
  130. package/dist/types/projection/types.d.ts +118 -0
  131. package/dist/types/projection/types.d.ts.map +1 -0
  132. package/dist/types/projection/usage.d.ts +92 -0
  133. package/dist/types/projection/usage.d.ts.map +1 -0
  134. package/dist/types/prompt/answerPromptWithDefaults.d.ts +5 -3
  135. package/dist/types/prompt/answerPromptWithDefaults.d.ts.map +1 -1
  136. package/dist/types/prompt/autoPrompt.d.ts.map +1 -1
  137. package/dist/types/prompt/index.d.ts +1 -1
  138. package/dist/types/prompt/index.d.ts.map +1 -1
  139. package/dist/types/prompt/ink/Wizard.d.ts.map +1 -1
  140. package/dist/types/prompt/ink/mount.d.ts +3 -2
  141. package/dist/types/prompt/ink/mount.d.ts.map +1 -1
  142. package/dist/types/prompt/ink/progressWindow.d.ts +98 -2
  143. package/dist/types/prompt/ink/progressWindow.d.ts.map +1 -1
  144. package/dist/types/prompt/ink/session.d.ts +87 -4
  145. package/dist/types/prompt/ink/session.d.ts.map +1 -1
  146. package/dist/types/prompt/inkPrompt.d.ts +36 -2
  147. package/dist/types/prompt/inkPrompt.d.ts.map +1 -1
  148. package/dist/types/stamp/applyStamp.d.ts +6 -2
  149. package/dist/types/stamp/applyStamp.d.ts.map +1 -1
  150. package/dist/types/stamp/createStampOnEffectStart.d.ts.map +1 -1
  151. package/dist/types/stamp/runTaskWithStamp.d.ts +3 -1
  152. package/dist/types/stamp/runTaskWithStamp.d.ts.map +1 -1
  153. package/dist/types/template/index.d.ts +4 -0
  154. package/dist/types/template/index.d.ts.map +1 -1
  155. package/dist/types/template/loadTemplate.d.ts +40 -0
  156. package/dist/types/template/loadTemplate.d.ts.map +1 -0
  157. package/dist/types/template/prependStamp.d.ts +5 -2
  158. package/dist/types/template/prependStamp.d.ts.map +1 -1
  159. package/dist/types/template/rawFile.d.ts +32 -0
  160. package/dist/types/template/rawFile.d.ts.map +1 -0
  161. package/dist/types/template/tasks/template.d.ts +8 -0
  162. package/dist/types/template/tasks/template.d.ts.map +1 -1
  163. package/dist/types/template/tasks/templateDir.d.ts.map +1 -1
  164. package/dist/types/template/tasks/types.d.ts +2 -0
  165. package/dist/types/template/tasks/types.d.ts.map +1 -1
  166. package/dist/types/testing/conformance/fixtures.d.ts.map +1 -1
  167. package/dist/types/testing/conformance/flagizeAnswers.d.ts +38 -0
  168. package/dist/types/testing/conformance/flagizeAnswers.d.ts.map +1 -0
  169. package/dist/types/testing/conformance/index.d.ts +1 -0
  170. package/dist/types/testing/conformance/index.d.ts.map +1 -1
  171. package/dist/types/testing/index.d.ts +1 -1
  172. package/dist/types/testing/index.d.ts.map +1 -1
  173. package/dist/types/types/GeneratorDefinition.d.ts +10 -1
  174. package/dist/types/types/GeneratorDefinition.d.ts.map +1 -1
  175. package/dist/types/types/ReservedOption.d.ts +1 -1
  176. package/dist/types/types/ReservedOption.d.ts.map +1 -1
  177. package/package.json +22 -9
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import { type Effect, type LogLevel, type TaskError } from "@canonical/task";
14
14
  import type GeneratorDefinition from "../../types/GeneratorDefinition.js";
15
+ import type { StepReport } from "../inkPrompt.js";
15
16
  import type { PromptEffect } from "../types.js";
16
17
  /** The wizard's coarse lifecycle phase. */
17
18
  export type WizardPhase = "idle" | "prompting" | "confirming" | "executing" | "complete" | "error" | "cancelled";
@@ -19,6 +20,26 @@ export type WizardPhase = "idle" | "prompting" | "confirming" | "executing" | "c
19
20
  export interface TimedEffect {
20
21
  readonly effect: Effect;
21
22
  readonly timestamp: number;
23
+ /**
24
+ * How long the effect itself took, in milliseconds, as measured by the
25
+ * interpreter and handed to the seam's `onEffectComplete`. KEPT rather than
26
+ * dropped: the live view renders it as `✓ <effect> (12ms)` — the spelling
27
+ * the summon binary's own progress view already uses.
28
+ */
29
+ readonly duration: number;
30
+ }
31
+ /**
32
+ * One host-named step's live state — a {@link StepReport} folded into the
33
+ * view model. `duration` is measured HERE, from the step's `start` report to
34
+ * its completion report, so it covers the step's whole wall time (every effect
35
+ * it spans) rather than any single effect's.
36
+ */
37
+ export interface StepProgress {
38
+ readonly key: string;
39
+ readonly label: string;
40
+ readonly status: "running" | "done" | "failed";
41
+ /** Wall-clock ms from `start` to completion; set on `done`/`failed`. */
42
+ readonly duration?: number;
22
43
  }
23
44
  /** The immutable snapshot the React view renders. A new object per change. */
24
45
  export interface WizardState {
@@ -35,6 +56,12 @@ export interface WizardState {
35
56
  readonly previewEffects: readonly Effect[];
36
57
  /** Effects completed so far during execution. */
37
58
  readonly progress: readonly TimedEffect[];
59
+ /**
60
+ * Host-named steps reported so far ({@link SessionController.reportStep}).
61
+ * Non-empty ONLY for a host that narrates its run in its own units; the
62
+ * view then renders these rows instead of the per-effect transcript.
63
+ */
64
+ readonly steps: readonly StepProgress[];
38
65
  /** A failure, when `phase === "error"`. */
39
66
  readonly error?: TaskError;
40
67
  }
@@ -63,7 +90,7 @@ export declare class SessionController {
63
90
  * the run produces. Omitted falls back to the process cwd, matching a run
64
91
  * whose interpreter was given no `cwd`.
65
92
  */
66
- constructor(generator: GeneratorDefinition, onUserCancel?: (() => void) | undefined, cwd?: string | undefined);
93
+ constructor(generator: GeneratorDefinition, onUserCancel?: (() => void) | undefined, cwd?: string | undefined, initialAnswers?: Readonly<Record<string, unknown>>);
67
94
  /** Subscribe to state changes; returns an unsubscribe function. */
68
95
  subscribe: (listener: () => void) => (() => void);
69
96
  /** The current immutable snapshot (stable identity between changes). */
@@ -104,17 +131,73 @@ export declare class SessionController {
104
131
  previewSettled(): Promise<void>;
105
132
  /** Feed effect start (kept for seam symmetry; progress rides completion). */
106
133
  reportEffectStart(_effect: Effect): void;
107
- /** Record a completed effect for the live progress view. */
108
- reportEffectComplete(effect: Effect, _duration: number): void;
134
+ /**
135
+ * Record a completed effect — and what it cost — for the live progress view.
136
+ * The seam delivers a per-effect `duration`; it is stored, not discarded, so
137
+ * the view can say how long each step took.
138
+ */
139
+ reportEffectComplete(effect: Effect, duration: number): void;
109
140
  /** A task log line (kept for parity; not surfaced by the default view). */
110
141
  reportLog(_level: LogLevel, _message: string): void;
142
+ /** Per-step `start` timestamps, so completion can measure wall time. */
143
+ private readonly stepStarts;
144
+ /**
145
+ * Fold a host step report into the live view (see {@link StepProgress}).
146
+ *
147
+ * GATED to the executing phase, unlike {@link reportEffectComplete}: effect
148
+ * callbacks only ever arrive from the real interpreter through the seam, but
149
+ * step reports originate INSIDE the host's task composition, so every
150
+ * interpretation of it fires them — including the confirm gate's own honest
151
+ * preview, which walks the same task before the user has consented. Dropping
152
+ * reports outside `executing` keeps a previewed step from painting itself
153
+ * as work in progress — and the gate is sound only because of the pairing
154
+ * invariant {@link submitConfirm} enforces: `executing` begins strictly
155
+ * AFTER the preview walk has completed (consent is released on
156
+ * `previewSettled()`), so no pre-consent walk can still be emitting once
157
+ * reports are accepted. Testing arrival time alone could not close that —
158
+ * a report says nothing about which walk produced it.
159
+ *
160
+ * The phase gate alone is still not enough: `execute` walks `generate` once
161
+ * more on the MOCK interpreter right after consent — synchronously, to give
162
+ * the outcome summary its file list — so a full set of settled steps arrives
163
+ * (in-phase, near-zero durations) before the real drive begins. Steps run
164
+ * sequentially with per-walk-unique keys, so a `start` for a key that has
165
+ * ALREADY settled can only mean a new interpretation: the board resets and
166
+ * the real walk repaints it with real timings. This is also why the view
167
+ * renders steps in the LIVE region, never under `<Static>` — a static row
168
+ * cannot be taken back, and the mock walk's rows must be.
169
+ */
170
+ reportStep(report: StepReport): void;
111
171
  /** Mark the run complete (the view flashes a completion summary). */
112
172
  markComplete(): void;
113
173
  /** Mark the run failed. */
114
174
  markError(error: TaskError): void;
115
175
  /** The user answered the active (non-confirm) prompt. */
116
176
  submitAnswer(value: unknown): void;
117
- /** The user answered the confirm gate. */
177
+ /**
178
+ * The user answered the confirm gate.
179
+ *
180
+ * Consent does NOT begin execution by itself. The gate's honest preview
181
+ * ({@link loadPreview}) walks the same `generate` the run will, and it is
182
+ * async — a fast Y can land while that walk is still in flight. Entering
183
+ * `executing` at that instant re-opened the gap {@link reportStep}'s phase
184
+ * gate exists to close: the pre-consent walk's late step reports arrived
185
+ * in-phase and were accepted, and one naming a key the real walk had
186
+ * already settled hit the fresh-walk reset and cleared the board mid-run.
187
+ * Step reports carry no walk identity — they are plain closures fired from
188
+ * task continuations — so the sound closure is to ensure NO pre-consent
189
+ * walk survives into the executing phase: consent is released only once
190
+ * {@link previewSettled} resolves, which is `runPreview` COMPLETING its
191
+ * walk (loadPreview catches its failure), not merely having started it.
192
+ * The pane has usually settled long before the user answers, so the
193
+ * deferral is normally one microtask.
194
+ *
195
+ * A cancel that lands while consent waits on the preview rejects the gate
196
+ * here, with the same `GENERATOR_CANCELLED` an at-prompt cancel carries —
197
+ * {@link cancel} cannot reach it, this method already claimed the pending
198
+ * slot — so the task fails cleanly instead of hanging on a prompt that
199
+ * would otherwise never settle.
200
+ */
118
201
  submitConfirm(proceed: boolean): void;
119
202
  /**
120
203
  * The user cancelled (Ctrl-C / escape). Two things must happen, and both are
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,mBAAmB,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,WAAW,GACX,YAAY,GACZ,WAAW,GACX,UAAU,GACV,OAAO,GACP,WAAW,CAAC;AAEhB,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,mEAAmE;IACnE,QAAQ,CAAC,cAAc,CAAC,EAAE,YAAY,CAAC;IACvC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kDAAkD;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ACnE,SAAS,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CAK9C;IAEF,wEAAwE;IACxE,WAAW,QAAO,WAAW,CAAiB;IAE9C,OAAO,CAAC,GAAG;IAOX;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAyB/C;;;;;;;;;;;;;;;;OAgBG;YACW,WAAW;IAsBzB;;;;;;;;OAQG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,6EAA6E;IAC7E,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC;;;;OAIG;IACH,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAS5D,2EAA2E;IAC3E,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAEnD,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IAExD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IA4BpC,qEAAqE;IACrE,YAAY,IAAI,IAAI;IAMpB,2BAA2B;IAC3B,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAMjC,yDAAyD;IACzD,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAgBlC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAyBrC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,IAAI,IAAI;CAYf"}
@@ -38,6 +38,30 @@ export interface InkPromptOptions {
38
38
  * back to the process cwd, matching a run given no `cwd` of its own.
39
39
  */
40
40
  readonly cwd?: string;
41
+ /**
42
+ * Answers already provided outside the wizard (CLI flags / MCP args).
43
+ * Seeded into the session so the confirm gate's preview and step counter
44
+ * see the full answer set — without this a partially-flagged run previews
45
+ * with those answers missing (`undefined` paths, wrong plan).
46
+ */
47
+ readonly initialAnswers?: Readonly<Record<string, unknown>>;
48
+ }
49
+ /**
50
+ * One host-named unit of work, reported through {@link InkSession.reportStep}.
51
+ *
52
+ * The wizard's default live progress is the per-effect transcript — the right
53
+ * grain for a scaffolder, whose unit of work IS the file. A host whose unit is
54
+ * coarser (pragma's `setup`, where one step is one configured target spanning
55
+ * a dozen effects) reports its own steps instead, in its own vocabulary, and
56
+ * the view renders those rows in place of the transcript. `label` is the whole
57
+ * row body, unstyled — the glyph, spinner and duration are the view's.
58
+ */
59
+ export interface StepReport {
60
+ /** Stable identity — a `start` and its `done`/`failed` share it. */
61
+ readonly key: string;
62
+ /** The row body (unstyled); the completion report may extend it. */
63
+ readonly label: string;
64
+ readonly status: "start" | "done" | "failed";
41
65
  }
42
66
  /**
43
67
  * A running Ink session's seam surface: the prompt handler plus the effect
@@ -52,8 +76,18 @@ export interface InkSession {
52
76
  readonly onEffectComplete: (effect: Effect, duration: number) => void;
53
77
  /** Feed a task log line into the live view. */
54
78
  readonly onLog: (level: LogLevel, message: string) => void;
55
- /** Tear down the Ink render. Safe to call more than once. */
56
- readonly dispose: () => void;
79
+ /**
80
+ * Report a host-named step ({@link StepReport}). Once any step is reported,
81
+ * the live progress renders the host's step rows INSTEAD of the per-effect
82
+ * transcript; a session that never receives one renders exactly as before.
83
+ */
84
+ readonly reportStep: (report: StepReport) => void;
85
+ /**
86
+ * Tear down the Ink render. Safe to call more than once. Resolves once the
87
+ * final frame is flushed — AWAIT it before printing to the same terminal,
88
+ * or the closing frame and the caller's output interleave.
89
+ */
90
+ readonly dispose: () => Promise<void>;
57
91
  }
58
92
  /**
59
93
  * Build the interactive Ink session for a generator.
@@ -1 +1 @@
1
- {"version":3,"file":"inkPrompt.d.ts","sourceRoot":"","sources":["../../../src/prompt/inkPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH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AAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAYD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,SAAS,EAAE,mBAAmB,EAC9B,OAAO,GAAE,gBAAqB,GAC7B,UAAU,CA4CZ"}
@@ -1,7 +1,11 @@
1
1
  import type StampConfig from "../types/StampConfig.js";
2
2
  /**
3
- * Apply a stamp to file content based on file extension.
4
- * Returns the original content if the file type doesn't support comments.
3
+ * Apply a stamp to file content based on file extension. Uses the same
4
+ * comment-style table as {@link getCommentStyle} — one source, no drift.
5
+ * Returns the original content when the file type doesn't support comments,
6
+ * and is IDEMPOTENT: content already carrying this exact stamp line is
7
+ * returned unchanged, so driving the same WriteFile effect twice (preview
8
+ * then run, or a re-drive) cannot stack stamps.
5
9
  */
6
10
  export default function applyStamp(filePath: string, content: string, stamp: StampConfig): string;
7
11
  //# sourceMappingURL=applyStamp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"applyStamp.d.ts","sourceRoot":"","sources":["../../../src/stamp/applyStamp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAkDvD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,WAAW,GACjB,MAAM,CA8BR"}
1
+ {"version":3,"file":"applyStamp.d.ts","sourceRoot":"","sources":["../../../src/stamp/applyStamp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AA+BvD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,WAAW,GACjB,MAAM,CAqCR"}
@@ -1 +1 @@
1
- {"version":3,"file":"createStampOnEffectStart.d.ts","sourceRoot":"","sources":["../../../src/stamp/createStampOnEffectStart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAGvD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,KAAK,EAAE,WAAW,EAClB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAC9B,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAW1B"}
1
+ {"version":3,"file":"createStampOnEffectStart.d.ts","sourceRoot":"","sources":["../../../src/stamp/createStampOnEffectStart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAGvD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,KAAK,EAAE,WAAW,EAClB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAC9B,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAc1B"}
@@ -2,7 +2,9 @@ import type { Task } from "@canonical/task";
2
2
  import type { RunTaskWithStampOptions } from "./types.js";
3
3
  /**
4
4
  * Run a task with stamp support. Wraps `runTask` from @canonical/task,
5
- * intercepting WriteFile effects to prepend generated-file stamps.
5
+ * routing every WriteFile through THE stamping transform
6
+ * ({@link createStampOnEffectStart}) — one transform for both stamping seams,
7
+ * so the verbatim (carried-copy) skip can never diverge between them.
6
8
  */
7
9
  export default function runTaskWithStamp<A>(task: Task<A>, options?: RunTaskWithStampOptions): Promise<A>;
8
10
  //# sourceMappingURL=runTaskWithStamp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runTaskWithStamp.d.ts","sourceRoot":"","sources":["../../../src/stamp/runTaskWithStamp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGpD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D;;;GAGG;AACH,wBAA8B,gBAAgB,CAAC,CAAC,EAC9C,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACb,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,CAAC,CAAC,CAmBZ"}
1
+ {"version":3,"file":"runTaskWithStamp.d.ts","sourceRoot":"","sources":["../../../src/stamp/runTaskWithStamp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;GAKG;AACH,wBAA8B,gBAAgB,CAAC,CAAC,EAC9C,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACb,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,CAAC,CAAC,CAWZ"}
@@ -2,7 +2,11 @@ export { default as ejsEngine } from "./ejsEngine.js";
2
2
  export { default as generateStamp } from "./generateStamp.js";
3
3
  export { default as generatorComment } from "./generatorComment.js";
4
4
  export { default as getCommentStyle } from "./getCommentStyle.js";
5
+ export type { LoadedTemplate } from "./loadTemplate.js";
6
+ export { loadTemplate, loadTemplateSync } from "./loadTemplate.js";
5
7
  export { default as prependStamp } from "./prependStamp.js";
8
+ export type { RawFileOptions } from "./rawFile.js";
9
+ export { default as rawFile } from "./rawFile.js";
6
10
  export { default as renderFile } from "./renderFile.js";
7
11
  export { default as renderString } from "./renderString.js";
8
12
  export { default as renderStringAsync } from "./renderStringAsync.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,M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D,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACtE,YAAY,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Template loading: read a generator's template file from its own package.
3
+ *
4
+ * A generator's templates ship beside it — `copy-templates.ts` puts each
5
+ * package's `templates/` tree into its `dist/esm`, and the generator resolves
6
+ * them `__dirname`-relative. So a load is a file read, and a miss is a hard
7
+ * error naming the path: callers do not guard against empty content, and a
8
+ * silent `""` would write blank files.
9
+ *
10
+ * Deliberately SYNCHRONOUS, so a generator can load its templates lazily inside
11
+ * its synchronous `generate(answers)` call rather than at module eval. That is
12
+ * what keeps READ commands template-free: `--help` and completion never touch a
13
+ * template because they never reach a `generate`.
14
+ */
15
+ /** A template's source path and its contents. */
16
+ export interface LoadedTemplate {
17
+ /** Absolute path the template was read from. */
18
+ readonly source: string;
19
+ /** The template's contents. */
20
+ readonly content: string;
21
+ }
22
+ /**
23
+ * Read a template from disk.
24
+ *
25
+ * @param source - Absolute path to the template file.
26
+ * @returns The loaded template.
27
+ * @throws If the file cannot be read, naming the path.
28
+ * @note Impure — reads the filesystem.
29
+ */
30
+ export declare function loadTemplateSync(source: string): LoadedTemplate;
31
+ /**
32
+ * Async wrapper over {@link loadTemplateSync}, for callers that await a load.
33
+ * The body is fully synchronous.
34
+ *
35
+ * @param source - Absolute path to the template file.
36
+ * @returns The loaded template.
37
+ * @note Impure — reads the filesystem.
38
+ */
39
+ export declare function loadTemplate(source: string): Promise<LoadedTemplate>;
40
+ //# sourceMappingURL=loadTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadTemplate.d.ts","sourceRoot":"","sources":["../../../src/template/loadTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,iDAAiD;AACjD,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAM/D;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAE1E"}
@@ -1,6 +1,9 @@
1
1
  /**
2
- * Prepend a stamp to file content.
3
- * Handles shebang lines (#!/...) by placing stamp after them.
2
+ * Prepend a stamp comment to file content: the stamp, a blank line, then the
3
+ * content — the same byte shape {@link applyStamp} (the canonical runtime
4
+ * stamping path) produces, so output does not depend on which helper a
5
+ * caller reached for. Handles shebang lines (#!/...) by placing the stamp
6
+ * after them, even when the shebang has no trailing newline yet.
4
7
  */
5
8
  export default function prependStamp(content: string, stamp: string): string;
6
9
  //# sourceMappingURL=prependStamp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prependStamp.d.ts","sourceRoot":"","sources":["../../../src/template/prependStamp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAW3E"}
1
+ {"version":3,"file":"prependStamp.d.ts","sourceRoot":"","sources":["../../../src/template/prependStamp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAW3E"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The copy-analog that CARRIES its content: rather than `copyFile(src, dest)`,
3
+ * a generator loads the bytes and writes them VERBATIM. The `verbatim` marker
4
+ * keeps the stamping transform off them
5
+ * ({@link import("../stamp/createStampOnEffectStart.js").default} skips it), so
6
+ * a carried `.ts`/`.css` asset lands byte-identical — including relay
7
+ * `__generated__` artifacts a stamp would corrupt.
8
+ *
9
+ * Carrying rather than copying also keeps the write on ONE effect seam, so a
10
+ * `--dry-run` describes it and `--undo` reverses it like every other write.
11
+ *
12
+ * The node interpreter creates the dest's parent directories, exactly as it
13
+ * does for any write.
14
+ */
15
+ import { type Task } from "@canonical/task";
16
+ /** One carried file: where it came from, its bytes, and where it lands. */
17
+ export interface RawFileOptions {
18
+ /** The original source path (provenance; the content already carries it). */
19
+ readonly source: string;
20
+ /** The file content, already loaded by the caller. */
21
+ readonly content: string;
22
+ /** Destination path. */
23
+ readonly dest: string;
24
+ }
25
+ /**
26
+ * Write a carried file verbatim (never stamped).
27
+ *
28
+ * @param options - Source id, content, and destination.
29
+ * @returns The write task.
30
+ */
31
+ export default function rawFile(options: RawFileOptions): Task<void>;
32
+ //# sourceMappingURL=rawFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rawFile.d.ts","sourceRoot":"","sources":["../../../src/template/rawFile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,IAAI,EAAa,MAAM,iBAAiB,CAAC;AAEvD,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sDAAsD;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wBAAwB;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,CAEnE"}
@@ -6,6 +6,14 @@ import type { TemplateOptions } from "./types.js";
6
6
  * When `options.content` is provided, uses it directly instead of
7
7
  * reading from `options.source`. This supports compiled binaries
8
8
  * where template files are embedded and pre-loaded.
9
+ *
10
+ * The silent `readFile(options.source)` fallback survives ONLY outside
11
+ * embedded context: once a host has injected an embedded manifest
12
+ * ({@link hasEmbeddedTemplates}), a content-less call FAILS with a named
13
+ * error instead of falling through to a disk read that would die with a raw
14
+ * `ENOENT … /$bunfs/…` mid-generation, after directories were already made.
15
+ * Source runs (empty manifest — the summon bin, tests) are byte-identical to
16
+ * before.
9
17
  */
10
18
  export default function template(options: TemplateOptions): Task<void>;
11
19
  //# sourceMappingURL=template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/template/tasks/template.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,IAAI,EAGV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,CAoBrE"}
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/template/tasks/template.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,IAAI,EAGV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,CAqBrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"templateDir.d.ts","sourceRoot":"","sources":["../../../../src/template/tasks/templateDir.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,IAAI,EAAQ,MAAM,iBAAiB,CAAC;AAInE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAerD;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,CAoC3E"}
1
+ {"version":3,"file":"templateDir.d.ts","sourceRoot":"","sources":["../../../../src/template/tasks/templateDir.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,IAAI,EAAQ,MAAM,iBAAiB,CAAC;AAInE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAerD;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,CA2C3E"}
@@ -13,6 +13,8 @@ export interface TemplateOptions {
13
13
  * Use this when the template is embedded or pre-loaded (e.g. compiled binaries).
14
14
  */
15
15
  content?: string;
16
+ /** Applied to the rendered content before it is written. */
17
+ transform?: (content: string) => string;
16
18
  }
17
19
  export interface TemplateDirOptions {
18
20
  /** Source directory containing templates */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/template/tasks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,yC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AM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IACxD,iDAAiD;IACjD,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD;AASD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,EA0C7D,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAIxD"}
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD;AASD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,EAwC7D,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAIxD"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Turn a conformance fixture's ANSWER SET into the CLI argument vector that
3
+ * expresses it — the projection's flag grammar, driven backwards. The
4
+ * cross-CLI matrix derives each producer's argv from the SAME answers with
5
+ * this one function, so the two binaries are always handed identical inputs
6
+ * (modulo the mount prefix) and an argv hand-drift cannot fake parity.
7
+ *
8
+ * Rules (the inverse of `extractAnswers` + `buildOptionInfo`):
9
+ * - an answer equal to its prompt's default is OMITTED (it could never be
10
+ * expressed explicitly for a confirm anyway — the equality trick);
11
+ * - a confirm answers with `buildOptionInfo`'s PRIMARY registered long
12
+ * form — `--<kebab>` for `true` (registered exactly when the default is
13
+ * not `true`; a default-`true` confirm answered `true` was omitted
14
+ * above), `--no-<kebab>` for `false` (registered ONLY for a default-
15
+ * `true` confirm). PRECONDITION: a confirm answered `false` must
16
+ * declare `default: true` — a default-less (or default-`false`,
17
+ * non-omitted) confirm has NO registered spelling for `false`, and this
18
+ * helper THROWS naming the prompt rather than hand the matrix an argv
19
+ * both binaries reject as an unknown option;
20
+ * - the positional prompt's answer is emitted positionally, first;
21
+ * - text/select answers become `--<kebab>=<value>`;
22
+ * - a multiselect becomes `--<kebab>=<comma,list>`.
23
+ */
24
+ import type { PromptLike } from "../../projection/types.js";
25
+ /**
26
+ * Express an answer set as CLI arguments (positional first, flags in prompt
27
+ * order).
28
+ *
29
+ * @param prompts - The command's prompts (live or projected).
30
+ * @param answers - The answers to express.
31
+ * @returns The argument vector.
32
+ * @throws If a confirm answered `false` declares no `default: true` — no
33
+ * registered spelling exists for that answer (the module header's
34
+ * PRECONDITION), so the matrix must fail loudly rather than hand both
35
+ * binaries an argv they reject as an unknown option.
36
+ */
37
+ export declare function flagizeAnswers(prompts: readonly PromptLike[], answers: Readonly<Record<string, unknown>>): string[];
38
+ //# sourceMappingURL=flagizeAnswers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flagizeAnswers.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/flagizeAnswers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAc5D;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACzC,MAAM,EAAE,CA0CV"}
@@ -14,6 +14,7 @@ export type { TreeDiff } from "./diffTrees.js";
14
14
  export { diffTrees, formatTreeDiff, isIdentical } from "./diffTrees.js";
15
15
  export type { ConformanceFixture } from "./fixtures.js";
16
16
  export { CONFORMANCE_FIXTURES, fixture } from "./fixtures.js";
17
+ export { flagizeAnswers } from "./flagizeAnswers.js";
17
18
  export type { ReferenceRun } from "./produceReference.js";
18
19
  export { produceReference } from "./produceReference.js";
19
20
  export type { TreeSnapshot } from "./snapshotTree.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxE,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC9D,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxE,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -7,5 +7,5 @@
7
7
  * contract that may move faster.
8
8
  */
9
9
  export type { ConformanceFixture, ReferenceRun, TreeDiff, TreeSnapshot, } from "./conformance/index.js";
10
- export { CONFORMANCE_FIXTURES, diffTrees, fixture, formatTreeDiff, isIdentical, produceReference, snapshotTree, } from "./conformance/index.js";
10
+ export { CONFORMANCE_FIXTURES, diffTrees, fixture, flagizeAnswers, formatTreeDiff, isIdentical, produceReference, snapshotTree, } from "./conformance/index.js";
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,QAAQ,EACR,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,OAAO,EACP,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,YAAY,GACb,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,QAAQ,EACR,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,YAAY,GACb,MAAM,wBAAwB,CAAC"}
@@ -11,7 +11,16 @@ export default interface GeneratorDefinition<TAnswers = Record<string, unknown>>
11
11
  meta: GeneratorMeta;
12
12
  /** Prompts to collect answers from user */
13
13
  prompts: PromptDefinition[];
14
- /** Pure function that returns a Task describing the generation */
14
+ /**
15
+ * Pure function that returns a Task describing the generation.
16
+ *
17
+ * The returned task must be RE-INTERPRETABLE: compose it from combinators
18
+ * (`sequence_`, `when`, `flatMap`, …), never from a single-use `gen()` —
19
+ * a gen() task closes over one iterator, and the runners interpret a build
20
+ * more than once (dry-run preview, undo collection with backtracking).
21
+ * `execute()` shields callers by invoking `generate` freshly per
22
+ * interpretation, but direct drivers of one build get truncated re-drives.
23
+ */
15
24
  generate: (answers: TAnswers) => Task<void>;
16
25
  }
17
26
  //# sourceMappingURL=GeneratorDefinition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GeneratorDefinition.d.ts","sourceRoot":"","sources":["../../../src/types/GeneratorDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,OAAO,WAAW,mBAAmB,CAC1C,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAElC,yCAAyC;IACzC,IAAI,EAAE,aAAa,CAAC;IACpB,2CAA2C;IAC3C,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,kEAAkE;IAClE,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC;CAC7C"}
1
+ {"version":3,"file":"GeneratorDefinition.d.ts","sourceRoot":"","sources":["../../../src/types/GeneratorDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,OAAO,WAAW,mBAAmB,CAC1C,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAElC,yCAAyC;IACzC,IAAI,EAAE,aAAa,CAAC;IACpB,2CAA2C;IAC3C,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B;;;;;;;;;OASG;IACH,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC;CAC7C"}
@@ -2,6 +2,6 @@
2
2
  * Reserved option names for CLI global options.
3
3
  * Generator prompts MUST NOT use these names.
4
4
  */
5
- type ReservedOption = "help" | "version" | "dryRun" | "dry-run" | "yes" | "output" | "preview" | "generators" | "run" | "init" | "llm" | "format" | "showFiles" | "show-files" | "verbose" | "generatedStamp";
5
+ type ReservedOption = "help" | "version" | "dryRun" | "dry-run" | "yes" | "output" | "preview" | "generators" | "run" | "init" | "llm" | "format" | "showFiles" | "show-files" | "verbose" | "generatedStamp" | "generated-stamp";
6
6
  export type { ReservedOption as default };
7
7
  //# sourceMappingURL=ReservedOption.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReservedOption.d.ts","sourceRoot":"","sources":["../../../src/types/ReservedOption.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,KAAK,cAAc,GACf,MAAM,GACN,SAAS,GACT,QAAQ,GACR,SAAS,GACT,KAAK,GACL,QAAQ,GACR,SAAS,GACT,YAAY,GACZ,KAAK,GACL,MAAM,GACN,KAAK,GACL,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,SAAS,GACT,gBAAgB,CAAC;AAErB,YAAY,EAAE,cAAc,IAAI,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"ReservedOption.d.ts","sourceRoot":"","sources":["../../../src/types/ReservedOption.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,KAAK,cAAc,GACf,MAAM,GACN,SAAS,GACT,QAAQ,GACR,SAAS,GACT,KAAK,GACL,QAAQ,GACR,SAAS,GACT,YAAY,GACZ,KAAK,GACL,MAAM,GACN,KAAK,GACL,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,SAAS,GACT,gBAAgB,GAChB,iBAAiB,CAAC;AAEtB,YAAY,EAAE,cAAc,IAAI,OAAO,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@canonical/summon-core",
3
3
  "description": "Code generation framework: generator definitions, templates, stamps, discovery. Built on @canonical/task.",
4
- "version": "0.34.0",
4
+ "version": "0.36.0",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/types/index.d.ts",
@@ -13,6 +13,18 @@
13
13
  "./testing": {
14
14
  "types": "./dist/types/testing/index.d.ts",
15
15
  "import": "./dist/esm/testing/index.js"
16
+ },
17
+ "./format": {
18
+ "types": "./dist/types/format/index.d.ts",
19
+ "import": "./dist/esm/format/index.js"
20
+ },
21
+ "./projection": {
22
+ "types": "./dist/types/projection/index.d.ts",
23
+ "import": "./dist/esm/projection/index.js"
24
+ },
25
+ "./projection/commander": {
26
+ "types": "./dist/types/projection/commander/index.d.ts",
27
+ "import": "./dist/esm/projection/commander/index.js"
16
28
  }
17
29
  },
18
30
  "files": [
@@ -46,31 +58,32 @@
46
58
  "check:webarchitect": "webarchitect library --license GPL-3.0",
47
59
  "test": "bun run test:vitest && bun run test:ink",
48
60
  "test:vitest": "vitest run --coverage --exclude '**/*.test.tsx'",
49
- "test:ink": "vitest run --no-coverage 'src/prompt/ink/wizard.test.tsx'",
61
+ "test:ink": "vitest run --no-coverage src/prompt/ink/wizard.test.tsx src/prompt/ink/mount.test.tsx",
50
62
  "test:vitest:watch": "vitest"
51
63
  },
52
64
  "devDependencies": {
53
65
  "@biomejs/biome": "2.4.9",
54
- "@canonical/biome-config": "^0.34.0",
55
- "@canonical/typescript-config": "^0.34.0",
56
- "@canonical/webarchitect": "^0.34.0",
66
+ "@canonical/biome-config": "^0.36.0",
67
+ "@canonical/typescript-config": "^0.36.0",
68
+ "@canonical/webarchitect": "^0.36.0",
57
69
  "@types/bun": "^1.3.10",
58
70
  "@types/ejs": "^3.1.5",
59
- "@types/node": "^24.12.0",
71
+ "@types/node": "^26.0.0",
60
72
  "@types/react": "^19.2.14",
61
73
  "ink-testing-library": "^4.0.0",
62
74
  "typescript": "^5.9.3",
63
75
  "vitest": "^4.0.18"
64
76
  },
65
77
  "dependencies": {
66
- "@canonical/task": "^0.34.0",
67
- "@canonical/utils": "^0.34.0",
78
+ "@canonical/task": "^0.36.0",
79
+ "@canonical/utils": "^0.36.0",
68
80
  "chalk": "^5.6.2",
81
+ "commander": "^14.0.3",
69
82
  "ejs": "^5.0.0",
70
83
  "ink": "^6.8.0",
71
84
  "ink-select-input": "^6.2.0",
72
85
  "ink-text-input": "^6.0.0",
73
86
  "react": "^19.2.4"
74
87
  },
75
- "gitHead": "e8d25fecbe6e70edfc4cb300bad65f691dbbd26e"
88
+ "gitHead": "78eb47ac10104e914eeacd331795e14b832703d4"
76
89
  }