@canonical/summon-core 0.33.0 → 0.35.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 (185) 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 +23 -17
  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 +199 -53
  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 +19 -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/mount.js +4 -2
  52. package/dist/esm/prompt/ink/mount.js.map +1 -1
  53. package/dist/esm/prompt/ink/session.js +78 -15
  54. package/dist/esm/prompt/ink/session.js.map +1 -1
  55. package/dist/esm/prompt/inkPrompt.js +13 -4
  56. package/dist/esm/prompt/inkPrompt.js.map +1 -1
  57. package/dist/esm/prompt/mcpPrompt.js +1 -1
  58. package/dist/esm/prompt/mcpPrompt.js.map +1 -1
  59. package/dist/esm/run/runGeneratorTask.js +3 -1
  60. package/dist/esm/run/runGeneratorTask.js.map +1 -1
  61. package/dist/esm/stamp/applyStamp.js +50 -52
  62. package/dist/esm/stamp/applyStamp.js.map +1 -1
  63. package/dist/esm/stamp/createStampOnEffectStart.js +4 -1
  64. package/dist/esm/stamp/createStampOnEffectStart.js.map +1 -1
  65. package/dist/esm/stamp/runTaskWithStamp.js +8 -9
  66. package/dist/esm/stamp/runTaskWithStamp.js.map +1 -1
  67. package/dist/esm/template/index.js +2 -0
  68. package/dist/esm/template/index.js.map +1 -1
  69. package/dist/esm/template/loadTemplate.js +43 -0
  70. package/dist/esm/template/loadTemplate.js.map +1 -0
  71. package/dist/esm/template/prependStamp.js +11 -8
  72. package/dist/esm/template/prependStamp.js.map +1 -1
  73. package/dist/esm/template/rawFile.js +25 -0
  74. package/dist/esm/template/rawFile.js.map +1 -0
  75. package/dist/esm/template/tasks/template.js +12 -3
  76. package/dist/esm/template/tasks/template.js.map +1 -1
  77. package/dist/esm/template/tasks/templateDir.js +5 -0
  78. package/dist/esm/template/tasks/templateDir.js.map +1 -1
  79. package/dist/esm/testing/conformance/diffTrees.js +61 -0
  80. package/dist/esm/testing/conformance/diffTrees.js.map +1 -0
  81. package/dist/esm/testing/conformance/fixtures.js +81 -0
  82. package/dist/esm/testing/conformance/fixtures.js.map +1 -0
  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 +18 -0
  86. package/dist/esm/testing/conformance/index.js.map +1 -0
  87. package/dist/esm/testing/conformance/produceReference.js +47 -0
  88. package/dist/esm/testing/conformance/produceReference.js.map +1 -0
  89. package/dist/esm/testing/conformance/snapshotTree.js +35 -0
  90. package/dist/esm/testing/conformance/snapshotTree.js.map +1 -0
  91. package/dist/esm/testing/index.js +10 -0
  92. package/dist/esm/testing/index.js.map +1 -0
  93. package/dist/types/discovery/discoverGeneratorTree.d.ts +3 -3
  94. package/dist/types/discovery/discoverGeneratorTree.d.ts.map +1 -1
  95. package/dist/types/execute/collectAnswers.d.ts +6 -4
  96. package/dist/types/execute/collectAnswers.d.ts.map +1 -1
  97. package/dist/types/execute/execute.d.ts +27 -1
  98. package/dist/types/execute/execute.d.ts.map +1 -1
  99. package/dist/types/execute/index.d.ts +1 -1
  100. package/dist/types/execute/index.d.ts.map +1 -1
  101. package/dist/types/execute/validateAnswers.d.ts.map +1 -1
  102. package/dist/types/format/effects.d.ts +63 -9
  103. package/dist/types/format/effects.d.ts.map +1 -1
  104. package/dist/types/format/formatFlagName.d.ts +14 -0
  105. package/dist/types/format/formatFlagName.d.ts.map +1 -0
  106. package/dist/types/format/index.d.ts +20 -1
  107. package/dist/types/format/index.d.ts.map +1 -1
  108. package/dist/types/index.d.ts +4 -4
  109. package/dist/types/index.d.ts.map +1 -1
  110. package/dist/types/projection/answers.d.ts +54 -0
  111. package/dist/types/projection/answers.d.ts.map +1 -0
  112. package/dist/types/projection/buildOptionInfo.d.ts +25 -0
  113. package/dist/types/projection/buildOptionInfo.d.ts.map +1 -0
  114. package/dist/types/projection/commander/configureGroupedHelp.d.ts +29 -0
  115. package/dist/types/projection/commander/configureGroupedHelp.d.ts.map +1 -0
  116. package/dist/types/projection/commander/emitToProcess.d.ts +10 -0
  117. package/dist/types/projection/commander/emitToProcess.d.ts.map +1 -0
  118. package/dist/types/projection/commander/index.d.ts +21 -0
  119. package/dist/types/projection/commander/index.d.ts.map +1 -0
  120. package/dist/types/projection/commander/registerGeneratorCommands.d.ts +95 -0
  121. package/dist/types/projection/commander/registerGeneratorCommands.d.ts.map +1 -0
  122. package/dist/types/projection/decideInteraction.d.ts +70 -0
  123. package/dist/types/projection/decideInteraction.d.ts.map +1 -0
  124. package/dist/types/projection/extractAnswers.d.ts +23 -0
  125. package/dist/types/projection/extractAnswers.d.ts.map +1 -0
  126. package/dist/types/projection/groupedHelp.d.ts +25 -0
  127. package/dist/types/projection/groupedHelp.d.ts.map +1 -0
  128. package/dist/types/projection/index.d.ts +29 -0
  129. package/dist/types/projection/index.d.ts.map +1 -0
  130. package/dist/types/projection/kebab.d.ts +16 -0
  131. package/dist/types/projection/kebab.d.ts.map +1 -0
  132. package/dist/types/projection/projectGenerator.d.ts +22 -0
  133. package/dist/types/projection/projectGenerator.d.ts.map +1 -0
  134. package/dist/types/projection/types.d.ts +118 -0
  135. package/dist/types/projection/types.d.ts.map +1 -0
  136. package/dist/types/projection/usage.d.ts +92 -0
  137. package/dist/types/projection/usage.d.ts.map +1 -0
  138. package/dist/types/prompt/answerPromptWithDefaults.d.ts +5 -3
  139. package/dist/types/prompt/answerPromptWithDefaults.d.ts.map +1 -1
  140. package/dist/types/prompt/autoPrompt.d.ts.map +1 -1
  141. package/dist/types/prompt/ink/mount.d.ts.map +1 -1
  142. package/dist/types/prompt/ink/session.d.ts +36 -1
  143. package/dist/types/prompt/ink/session.d.ts.map +1 -1
  144. package/dist/types/prompt/inkPrompt.d.ts +17 -3
  145. package/dist/types/prompt/inkPrompt.d.ts.map +1 -1
  146. package/dist/types/run/runGeneratorTask.d.ts +3 -1
  147. package/dist/types/run/runGeneratorTask.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/diffTrees.d.ts +38 -0
  167. package/dist/types/testing/conformance/diffTrees.d.ts.map +1 -0
  168. package/dist/types/testing/conformance/fixtures.d.ts +39 -0
  169. package/dist/types/testing/conformance/fixtures.d.ts.map +1 -0
  170. package/dist/types/testing/conformance/flagizeAnswers.d.ts +38 -0
  171. package/dist/types/testing/conformance/flagizeAnswers.d.ts.map +1 -0
  172. package/dist/types/testing/conformance/index.d.ts +22 -0
  173. package/dist/types/testing/conformance/index.d.ts.map +1 -0
  174. package/dist/types/testing/conformance/produceReference.d.ts +35 -0
  175. package/dist/types/testing/conformance/produceReference.d.ts.map +1 -0
  176. package/dist/types/testing/conformance/snapshotTree.d.ts +21 -0
  177. package/dist/types/testing/conformance/snapshotTree.d.ts.map +1 -0
  178. package/dist/types/testing/index.d.ts +11 -0
  179. package/dist/types/testing/index.d.ts.map +1 -0
  180. package/dist/types/types/GeneratorDefinition.d.ts +10 -1
  181. package/dist/types/types/GeneratorDefinition.d.ts.map +1 -1
  182. package/dist/types/types/ReservedOption.d.ts +1 -1
  183. package/dist/types/types/ReservedOption.d.ts.map +1 -1
  184. package/package.json +27 -9
  185. package/spec/generator-definition.v1.schema.json +122 -0
@@ -0,0 +1,92 @@
1
+ /**
2
+ * The usage-error authority, structure-first: the projection's two designed
3
+ * usage-error classes as STRUCTURED FACTS ({@link UsageError}), with the
4
+ * parity prose a pure function of them ({@link renderUsageError}). No host
5
+ * ever parses a message — a host reframing an error for a machine format
6
+ * reads the fields; a host wanting the default presentation renders them.
7
+ *
8
+ * Parser-agnostic and pure: no Commander, no process, no I/O. The adapter
9
+ * (`projection/commander/`) builds these from Commander state and delivers
10
+ * them through the host's `emit` sink.
11
+ */
12
+ /** The projection's two designed usage-error classes. */
13
+ export type UsageKind = "unknown-segment" | "excess-positional";
14
+ /**
15
+ * The structured facts of one designed usage error — the PRIMARY form.
16
+ * No `stray` field: the offending token is already embedded in `headline`
17
+ * (per-kind quotes included) and nothing reads it — pragma's reframer
18
+ * consumes only `suggestion` and `chain`, and the renderer needs only
19
+ * `headline`. A field with zero consumers is cut.
20
+ */
21
+ export interface UsageError {
22
+ readonly kind: UsageKind;
23
+ /**
24
+ * Single-line problem clause, prefix-free: `unknown command 'reakt'`,
25
+ * `unexpected argument "Extra"`. Exactly the envelope `message` pragma
26
+ * used to reconstruct by string surgery.
27
+ */
28
+ readonly headline: string;
29
+ /**
30
+ * The matched segment, when one matched — per-kind: for `unknown-segment`
31
+ * the candidate that RANKED closest to the stray (fuzzy, substitutable for
32
+ * it); for `excess-positional` the first OPERAND — bound or excess,
33
+ * possibly the stray itself — that exactly names a sibling or child
34
+ * segment (structural, not a substitution).
35
+ */
36
+ readonly suggestion?: string;
37
+ /**
38
+ * The invocation chain the suggestion completes, bin name first:
39
+ * `[...chain, suggestion].join(" ")` IS the corrected invocation the
40
+ * rendered did-you-mean line names.
41
+ */
42
+ readonly chain: readonly string[];
43
+ }
44
+ /**
45
+ * The designed unknown-segment error beneath a namespace. Commander's own
46
+ * handling is host-divergent by construction — pragma's namespaces carry an
47
+ * action, so its `unknownCommand` never fires and the mount used to
48
+ * re-implement the line, while summon got commander's `(Did you mean x?)` —
49
+ * so the projection owns this error in BOTH CLIs, in the same
50
+ * `Did you mean '<chain> <segment>'?` shape the excess-positional path
51
+ * already uses, suggesting the closest child segment.
52
+ *
53
+ * @param chain - The invoked namespace's full name chain, root (bin name)
54
+ * first — host-agnostic, so a mounted subtree suggests its real invocation
55
+ * (`pragma create component react`, not a truncated one).
56
+ * @param stray - The unrecognized segment.
57
+ * @param children - The namespace's child segments.
58
+ * @returns The structured error; {@link renderUsageError} yields the bytes.
59
+ */
60
+ export declare function unknownSegmentError(chain: readonly string[], stray: string, children: readonly string[]): UsageError;
61
+ /**
62
+ * The designed excess-positional error. Commander's default is a generic "too
63
+ * many arguments"; the projection owns this error in BOTH CLIs: the stray is
64
+ * named, and when an operand matches a sibling or child tree segment the
65
+ * corrected command is suggested (`summon component react svelte …` almost
66
+ * certainly meant `summon component svelte …`).
67
+ *
68
+ * The suggestion scans EVERY operand, not just the excess ones: in
69
+ * `summon component react svelte MyComponent` it is `svelte` — bound as the
70
+ * positional — that names the intended sibling, while `MyComponent` is what
71
+ * overflowed. First matching operand wins; a child segment beats a sibling.
72
+ * A sibling match slices the leaf off the chain BEFORE storing it, so
73
+ * `[...chain, suggestion].join(" ")` is the corrected invocation on every
74
+ * branch.
75
+ *
76
+ * @param chain - The invoked command's full name chain, root (bin name)
77
+ * first — host-agnostic (see {@link unknownSegmentError}).
78
+ * @param stray - The first unexpected operand.
79
+ * @param operands - Every operand the command received (bound + excess).
80
+ * @param siblings - The leaf's sibling segments (other children of its parent).
81
+ * @param children - The leaf's own child segments (runnable-namespace case).
82
+ * @returns The structured error; {@link renderUsageError} yields the bytes.
83
+ */
84
+ export declare function excessPositionalError(chain: readonly string[], stray: string, operands: readonly string[], siblings: ReadonlySet<string>, children: ReadonlySet<string>): UsageError;
85
+ /**
86
+ * The parity bytes of a usage error (one or two lines, no trailing newline):
87
+ * `error: ${headline}`, then the did-you-mean line when a segment matched —
88
+ * `[...chain, suggestion].join(" ")` is the corrected invocation on every
89
+ * builder branch.
90
+ */
91
+ export declare function renderUsageError(error: UsageError): string;
92
+ //# sourceMappingURL=usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/projection/usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,yDAAyD;AACzD,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AA4DD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,UAAU,CAMZ;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,EAC7B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAC5B,UAAU,CAqBZ;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAK1D"}
@@ -4,9 +4,11 @@ import type { Effect } from "@canonical/task";
4
4
  * defaults-only handler the summon Ink progress view drives, and the base the
5
5
  * seam's {@link autoPrompt} strategy layers required-missing detection on.
6
6
  *
7
- * Each prompt type yields the value a non-interactive run should assume: a
8
- * confirm's default (or `true`), a select's default (or its first choice), an
9
- * empty multiselect, or a text default (or `""`).
7
+ * Each prompt type yields the value a non-interactive run should assume,
8
+ * ALIGNED with the dry-run interpreter's mock so a plan and a defaults-driven
9
+ * run take the same branches: a confirm's default (or `false`), a select's
10
+ * default (or its first choice, or `""`), an empty multiselect, or a text
11
+ * default (or `""`).
10
12
  *
11
13
  * @param effect - A `Prompt` effect to resolve.
12
14
  * @returns The default answer for the prompt's type.
@@ -1 +1 @@
1
- {"version":3,"file":"answerPromptWithDefaults.d.ts","sourceRoot":"","sources":["../../../src/prompt/answerPromptWithDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClC,OAAO,CAAC,OAAO,CAAC,CAYlB"}
1
+ {"version":3,"file":"answerPromptWithDefaults.d.ts","sourceRoot":"","sources":["../../../src/prompt/answerPromptWithDefaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClC,OAAO,CAAC,OAAO,CAAC,CAclB"}
@@ -1 +1 @@
1
- {"version":3,"file":"autoPrompt.d.ts","sourceRoot":"","sources":["../../../src/prompt/autoPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D,2FAA2F;AAC3F,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAMjE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,IAAI,GAAE,MAAM,GAAG,UAAmB,GACjC,kBAAkB,CAOpB;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,OAAO,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GAC9C,aAAa,CAMf"}
1
+ {"version":3,"file":"autoPrompt.d.ts","sourceRoot":"","sources":["../../../src/prompt/autoPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D,2FAA2F;AAC3F,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAIjE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,IAAI,GAAE,MAAM,GAAG,UAAmB,GACjC,kBAAkB,CAOpB;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,OAAO,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GAC9C,aAAa,CAMf"}
@@ -1 +1 @@
1
- {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/mount.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,mBAAmB,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,mBAAmB,EAC9B,OAAO,GAAE,gBAAqB,GAC7B,cAAc,CA6BhB"}
1
+ {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/mount.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,mBAAmB,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,mBAAmB,EAC9B,OAAO,GAAE,gBAAqB,GAC7B,cAAc,CAoChB"}
@@ -43,10 +43,13 @@ export interface WizardState {
43
43
  */
44
44
  export declare class SessionController {
45
45
  private readonly onUserCancel?;
46
+ private readonly cwd?;
46
47
  private current;
47
48
  private readonly listeners;
48
49
  private pending?;
49
50
  private executionStart;
51
+ /** The confirm gate's in-flight preview, awaited only by {@link previewSettled}. */
52
+ private previewInFlight?;
50
53
  /**
51
54
  * @param generator - The generator being run.
52
55
  * @param onUserCancel - Invoked once when the user cancels (Ctrl-C / escape).
@@ -55,8 +58,12 @@ export declare class SessionController {
55
58
  * `checkInterrupted` fires between effects) instead of only rejecting a
56
59
  * — by then non-existent — pending prompt. `abort()` is idempotent, so the
57
60
  * signal→cancel→abort path cannot loop.
61
+ * @param cwd - The write root the run will resolve relative effect paths
62
+ * against. The preview reads the SAME tree, so the gate's plan is the plan
63
+ * the run produces. Omitted falls back to the process cwd, matching a run
64
+ * whose interpreter was given no `cwd`.
58
65
  */
59
- constructor(generator: GeneratorDefinition, onUserCancel?: (() => void) | undefined);
66
+ constructor(generator: GeneratorDefinition, onUserCancel?: (() => void) | undefined, cwd?: string | undefined, initialAnswers?: Readonly<Record<string, unknown>>);
60
67
  /** Subscribe to state changes; returns an unsubscribe function. */
61
68
  subscribe: (listener: () => void) => (() => void);
62
69
  /** The current immutable snapshot (stable identity between changes). */
@@ -67,6 +74,34 @@ export declare class SessionController {
67
74
  * view resolves once the user answers (or the run is cancelled).
68
75
  */
69
76
  request(effect: PromptEffect): Promise<unknown>;
77
+ /**
78
+ * Fill the confirm gate's preview pane with the HONEST plan.
79
+ *
80
+ * `runPreview` reads the real filesystem (through a virtual write overlay, so
81
+ * a step sees what the step before it planned) and records writes without
82
+ * performing them — the gate is shown BEFORE the user consents, so it must
83
+ * not touch the disk, and it must not lie about what will happen. The mock it
84
+ * replaces answered every read with a placeholder and `Exists` with `true`,
85
+ * so the pane could promise files a run would never reach.
86
+ *
87
+ * Failure shows an EMPTY pane rather than a fictional one: the generator's
88
+ * own error belongs to the run, which reports it with its real message, and
89
+ * the decision at the gate stays the user's. A result that arrives after the
90
+ * gate is gone — the user answered or cancelled while the reads were in
91
+ * flight — is dropped, so a slow preview can never repaint a pane the wizard
92
+ * has already left.
93
+ */
94
+ private loadPreview;
95
+ /**
96
+ * Resolves once the confirm gate's preview has been applied (or dropped as
97
+ * stale). The wizard itself never awaits this — the pane repaints when the
98
+ * preview lands, which is the whole point of making it async — but a caller
99
+ * that asserts ON the pane has to synchronise with the real filesystem reads
100
+ * the preview performs, and a wall-clock delay would only be flaky.
101
+ *
102
+ * @returns A promise for the in-flight preview, already resolved when none is.
103
+ */
104
+ previewSettled(): Promise<void>;
70
105
  /** Feed effect start (kept for seam symmetry; progress rides completion). */
71
106
  reportEffectStart(_effect: Effect): void;
72
107
  /** Record a completed effect for the live progress view. */
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAEL,KAAK,M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,EACzB,GAAG,CAAC,EAAE,MAAM,YAAA,EAC7B,cAAc,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IAgBxD,mEAAmE;IACnE,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;IAezB;;;;;;;;OAQG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,6EAA6E;IAC7E,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC,4DAA4D;IAC5D,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAS7D,2EAA2E;IAC3E,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAEnD,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,0CAA0C;IAC1C,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IASrC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,IAAI,IAAI;CAYf"}
@@ -31,6 +31,20 @@ export interface InkPromptOptions {
31
31
  * way (an external abort tears the render down).
32
32
  */
33
33
  readonly onCancel?: () => void;
34
+ /**
35
+ * The write root the run resolves relative effect paths against — pass the
36
+ * same value the interpreter will receive. The confirm gate's preview reads
37
+ * that tree, so the pane's plan is the plan the run produces. Omitted falls
38
+ * back to the process cwd, matching a run given no `cwd` of its own.
39
+ */
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>>;
34
48
  }
35
49
  /**
36
50
  * A running Ink session's seam surface: the prompt handler plus the effect
@@ -55,9 +69,9 @@ export interface InkSession {
55
69
  * dynamically imports the React UI), so picking this strategy on a fast path
56
70
  * that never prompts costs nothing and loads no React.
57
71
  *
58
- * @param generator - The generator being run (the session dry-runs it to build
59
- * the confirm gate's preview).
60
- * @param options - The abort signal.
72
+ * @param generator - The generator being run (the session previews it to build
73
+ * the confirm gate's plan).
74
+ * @param options - The abort signal, cancel callback, and preview write root.
61
75
  * @returns The {@link InkSession} the `create` verb wires into `runtime.exec`.
62
76
  */
63
77
  export default function inkPrompt(generator: GeneratorDefinition, options?: InkPromptOptions): InkSession;
@@ -1 +1 @@
1
- {"version":3,"file":"inkPrompt.d.ts","sourceRoot":"","sources":["../../../src/prompt/inkPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,mBAAmB,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,+EAA+E;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QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,wEAAwE;IACxE,QAAQ,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAWD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,SAAS,EAAE,mBAAmB,EAC9B,OAAO,GAAE,gBAAqB,GAC7B,UAAU,CAqCZ"}
@@ -11,7 +11,9 @@
11
11
  *
12
12
  * Moved into summon-core (from the v1 cli-core) so it sits below both the
13
13
  * summon bin and the pragma kernel — the shared seam the byte-equality
14
- * guarantee rests on. cli-core re-exports it while it is retired.
14
+ * guarantee rests on, and the one `testing/conformance/produceReference` runs.
15
+ * Both bins import it from HERE; the cli-core re-export shim is gone with that
16
+ * package.
15
17
  */
16
18
  import type { Task } from "@canonical/task";
17
19
  import { type RunTaskOptions } from "@canonical/task/node";
@@ -1 +1 @@
1
- {"version":3,"file":"runGeneratorTask.d.ts","sourceRoot":"","sources":["../../../src/run/runGeneratorTask.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,KAAK,cAAc,EAAW,MAAM,sBAAsB,CAAC;AAEpE,wEAAwE;AACxE,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,Q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D,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAaD;;;;;;;;;;;;GAYG;AACH,wBAA8B,gBAAgB,CAAC,CAAC,EAC9C,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACb,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,CAAC,CAAC,CA0BZ"}
@@ -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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,EAAE,MAAM,mBAAmB,CAAC;AAC5D,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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kBAAkB;IACjC,4CAA4C;IAC5C,MAAM,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"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Compare two generated trees and say precisely how they differ.
3
+ *
4
+ * A bare `expect(a).toEqual(b)` over two trees reports "objects differ" and
5
+ * leaves the reader to find the byte. This returns the three ways a tree can
6
+ * diverge — a path only one side wrote, and a path both wrote with different
7
+ * contents — so a conformance failure names the file that broke the seam.
8
+ */
9
+ import type { TreeSnapshot } from "./snapshotTree.js";
10
+ /** How two trees differ. Empty in all three fields means byte-identical. */
11
+ export interface TreeDiff {
12
+ /** Paths the first tree has and the second does not. */
13
+ readonly onlyInFirst: readonly string[];
14
+ /** Paths the second tree has and the first does not. */
15
+ readonly onlyInSecond: readonly string[];
16
+ /** Paths both trees have, whose contents differ. */
17
+ readonly differingContent: readonly string[];
18
+ }
19
+ /**
20
+ * Diff two snapshots.
21
+ *
22
+ * @param first - One producer's tree.
23
+ * @param second - The other producer's tree.
24
+ * @returns The three divergence sets, each sorted.
25
+ */
26
+ export declare function diffTrees(first: TreeSnapshot, second: TreeSnapshot): TreeDiff;
27
+ /** Whether a diff reports no divergence at all — the conformance condition. */
28
+ export declare function isIdentical(diff: TreeDiff): boolean;
29
+ /**
30
+ * Render a diff as an assertion message.
31
+ *
32
+ * @param diff - The divergence to describe.
33
+ * @param firstLabel - What produced the first tree (e.g. the bin's name).
34
+ * @param secondLabel - What produced the second tree.
35
+ * @returns A multi-line message, or the empty string when the trees match.
36
+ */
37
+ export declare function formatTreeDiff(diff: TreeDiff, firstLabel: string, secondLabel: string): string;
38
+ //# sourceMappingURL=diffTrees.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diffTrees.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance/diffTrees.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,4EAA4E;AAC5E,MAAM,WAAW,QAAQ;IACvB,wDAAwD;IACxD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,wDAAwD;IACxD,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,oDAAoD;IACpD,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,GAAG,QAAQ,CAa7E;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAMnD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,MAAM,CAaR"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The shared answer sets both binaries run their conformance cases from.
3
+ *
4
+ * DATA ONLY — this module imports no generator, by design. summon-core sits
5
+ * BELOW both bins, so reaching up for `@canonical/summon`'s `example/hello` or
6
+ * for pragma's bundled component/package/application generators would invert
7
+ * the dependency direction the whole fold rests on. A fixture therefore names
8
+ * its generator by a logical id and carries the answers; the CONSUMING package
9
+ * resolves that id to a real `GeneratorDefinition` it already owns and hands it
10
+ * to {@link produceReference}.
11
+ *
12
+ * The ids are conventional, not enforced: a consumer covers the ones it ships
13
+ * and ignores the rest, and adds its own fixtures where it has generators no
14
+ * one else does.
15
+ */
16
+ /** One conformance case: which generator, and the complete answers for it. */
17
+ export interface ConformanceFixture {
18
+ /** Human-readable case name, used in test titles. */
19
+ readonly name: string;
20
+ /** Logical generator id the consuming package resolves (e.g. `component/react`). */
21
+ readonly generator: string;
22
+ /** A COMPLETE answer set — every prompt answered, so no interaction occurs. */
23
+ readonly answers: Readonly<Record<string, unknown>>;
24
+ }
25
+ /**
26
+ * The design-system generator fixtures — the five trees pragma's `create` verbs
27
+ * and summon's `execute` must agree on byte for byte.
28
+ */
29
+ export declare const CONFORMANCE_FIXTURES: readonly ConformanceFixture[];
30
+ /**
31
+ * Look up a fixture by name.
32
+ *
33
+ * @param name - The fixture's {@link ConformanceFixture.name}.
34
+ * @returns The fixture.
35
+ * @throws If no fixture carries that name — a typo must fail loudly rather
36
+ * than silently skip a conformance case.
37
+ */
38
+ export declare function fixture(name: string): ConformanceFixture;
39
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +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,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"}