@canonical/summon-core 0.30.0 → 0.32.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 (103) hide show
  1. package/dist/esm/execute/GeneratorResult.js +13 -0
  2. package/dist/esm/execute/GeneratorResult.js.map +1 -0
  3. package/dist/esm/execute/collectAnswers.js +92 -0
  4. package/dist/esm/execute/collectAnswers.js.map +1 -0
  5. package/dist/esm/execute/execute.js +73 -0
  6. package/dist/esm/execute/execute.js.map +1 -0
  7. package/dist/esm/execute/index.js +4 -0
  8. package/dist/esm/execute/index.js.map +1 -0
  9. package/dist/esm/execute/validateAnswers.js +47 -0
  10. package/dist/esm/execute/validateAnswers.js.map +1 -0
  11. package/dist/esm/format/effects.js +581 -0
  12. package/dist/esm/format/effects.js.map +1 -0
  13. package/dist/esm/format/index.js +2 -0
  14. package/dist/esm/format/index.js.map +1 -0
  15. package/dist/esm/index.js +8 -1
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/prompt/answerPromptWithDefaults.js +26 -0
  18. package/dist/esm/prompt/answerPromptWithDefaults.js.map +1 -0
  19. package/dist/esm/prompt/autoPrompt.js +50 -0
  20. package/dist/esm/prompt/autoPrompt.js.map +1 -0
  21. package/dist/esm/prompt/index.js +12 -0
  22. package/dist/esm/prompt/index.js.map +1 -0
  23. package/dist/esm/prompt/ink/Spinner.js +18 -0
  24. package/dist/esm/prompt/ink/Spinner.js.map +1 -0
  25. package/dist/esm/prompt/ink/Wizard.js +107 -0
  26. package/dist/esm/prompt/ink/Wizard.js.map +1 -0
  27. package/dist/esm/prompt/ink/mount.js +41 -0
  28. package/dist/esm/prompt/ink/mount.js.map +1 -0
  29. package/dist/esm/prompt/ink/prompts.js +144 -0
  30. package/dist/esm/prompt/ink/prompts.js.map +1 -0
  31. package/dist/esm/prompt/ink/session.js +176 -0
  32. package/dist/esm/prompt/ink/session.js.map +1 -0
  33. package/dist/esm/prompt/inkPrompt.js +55 -0
  34. package/dist/esm/prompt/inkPrompt.js.map +1 -0
  35. package/dist/esm/prompt/mcpPrompt.js +29 -0
  36. package/dist/esm/prompt/mcpPrompt.js.map +1 -0
  37. package/dist/esm/prompt/types.js +12 -0
  38. package/dist/esm/prompt/types.js.map +1 -0
  39. package/dist/esm/run/index.js +2 -0
  40. package/dist/esm/run/index.js.map +1 -0
  41. package/dist/esm/run/runGeneratorTask.js +63 -0
  42. package/dist/esm/run/runGeneratorTask.js.map +1 -0
  43. package/dist/esm/stamp/createGeneratorStamp.js +19 -0
  44. package/dist/esm/stamp/createGeneratorStamp.js.map +1 -0
  45. package/dist/esm/stamp/createStampOnEffectStart.js +23 -0
  46. package/dist/esm/stamp/createStampOnEffectStart.js.map +1 -0
  47. package/dist/esm/stamp/index.js +2 -0
  48. package/dist/esm/stamp/index.js.map +1 -1
  49. package/dist/types/execute/GeneratorResult.d.ts +23 -0
  50. package/dist/types/execute/GeneratorResult.d.ts.map +1 -0
  51. package/dist/types/execute/collectAnswers.d.ts +52 -0
  52. package/dist/types/execute/collectAnswers.d.ts.map +1 -0
  53. package/dist/types/execute/execute.d.ts +57 -0
  54. package/dist/types/execute/execute.d.ts.map +1 -0
  55. package/dist/types/execute/index.d.ts +6 -0
  56. package/dist/types/execute/index.d.ts.map +1 -0
  57. package/dist/types/execute/validateAnswers.d.ts +23 -0
  58. package/dist/types/execute/validateAnswers.d.ts.map +1 -0
  59. package/dist/types/format/effects.d.ts +86 -0
  60. package/dist/types/format/effects.d.ts.map +1 -0
  61. package/dist/types/format/index.d.ts +2 -0
  62. package/dist/types/format/index.d.ts.map +1 -0
  63. package/dist/types/index.d.ts +8 -1
  64. package/dist/types/index.d.ts.map +1 -1
  65. package/dist/types/prompt/answerPromptWithDefaults.d.ts +17 -0
  66. package/dist/types/prompt/answerPromptWithDefaults.d.ts.map +1 -0
  67. package/dist/types/prompt/autoPrompt.d.ts +35 -0
  68. package/dist/types/prompt/autoPrompt.d.ts.map +1 -0
  69. package/dist/types/prompt/index.d.ts +14 -0
  70. package/dist/types/prompt/index.d.ts.map +1 -0
  71. package/dist/types/prompt/ink/Spinner.d.ts +11 -0
  72. package/dist/types/prompt/ink/Spinner.d.ts.map +1 -0
  73. package/dist/types/prompt/ink/Wizard.d.ts +14 -0
  74. package/dist/types/prompt/ink/Wizard.d.ts.map +1 -0
  75. package/dist/types/prompt/ink/mount.d.ts +31 -0
  76. package/dist/types/prompt/ink/mount.d.ts.map +1 -0
  77. package/dist/types/prompt/ink/prompts.d.ts +26 -0
  78. package/dist/types/prompt/ink/prompts.d.ts.map +1 -0
  79. package/dist/types/prompt/ink/session.d.ts +103 -0
  80. package/dist/types/prompt/ink/session.d.ts.map +1 -0
  81. package/dist/types/prompt/inkPrompt.d.ts +64 -0
  82. package/dist/types/prompt/inkPrompt.d.ts.map +1 -0
  83. package/dist/types/prompt/mcpPrompt.d.ts +20 -0
  84. package/dist/types/prompt/mcpPrompt.d.ts.map +1 -0
  85. package/dist/types/prompt/types.d.ts +23 -0
  86. package/dist/types/prompt/types.d.ts.map +1 -0
  87. package/dist/types/run/index.d.ts +3 -0
  88. package/dist/types/run/index.d.ts.map +1 -0
  89. package/dist/types/run/runGeneratorTask.d.ts +51 -0
  90. package/dist/types/run/runGeneratorTask.d.ts.map +1 -0
  91. package/dist/types/stamp/createGeneratorStamp.d.ts +16 -0
  92. package/dist/types/stamp/createGeneratorStamp.d.ts.map +1 -0
  93. package/dist/types/stamp/createStampOnEffectStart.d.ts +17 -0
  94. package/dist/types/stamp/createStampOnEffectStart.d.ts.map +1 -0
  95. package/dist/types/stamp/index.d.ts +2 -0
  96. package/dist/types/stamp/index.d.ts.map +1 -1
  97. package/dist/types/types/AnyGenerator.d.ts +1 -1
  98. package/dist/types/types/AnyGenerator.d.ts.map +1 -1
  99. package/dist/types/types/ForbidReserved.d.ts +1 -1
  100. package/dist/types/types/ForbidReserved.d.ts.map +1 -1
  101. package/dist/types/types/ReservedOption.d.ts +1 -1
  102. package/dist/types/types/ReservedOption.d.ts.map +1 -1
  103. package/package.json +17 -10
@@ -0,0 +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"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The prompt-strategy barrel. STATIC exports only — no JSX, no static
3
+ * `import` of `ink`/`react`. The Ink strategy ({@link inkPrompt}) reaches its
4
+ * React UI ONLY through `await import("./ink/mount.js")` on first draw, so
5
+ * importing this barrel (or summon-core's root) never loads React. The
6
+ * lazy-React guard test enforces exactly this boundary.
7
+ */
8
+ export { default as answerPromptWithDefaults } from "./answerPromptWithDefaults.js";
9
+ export { default as autoPrompt, MISSING_REQUIRED_ANSWER, missingRequiredError, } from "./autoPrompt.js";
10
+ export type { InkPromptOptions, InkSession } from "./inkPrompt.js";
11
+ export { default as inkPrompt } from "./inkPrompt.js";
12
+ export { default as mcpPrompt } from "./mcpPrompt.js";
13
+ export type { ConfirmPrompt, MultiselectPrompt, PromptEffect, PromptHandler, PromptQuestion, SelectPrompt, TextPrompt, } from "./types.js";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompt/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,UAAU,GACX,MAAM,YAAY,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A minimal braille loading spinner. Under `prompt/ink/**` — dynamic-only.
3
+ */
4
+ export interface SpinnerProps {
5
+ /** Color of the spinner. */
6
+ color?: string;
7
+ /** Label to show next to the spinner. */
8
+ label?: string;
9
+ }
10
+ export declare const Spinner: ({ color, label }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
11
+ //# sourceMappingURL=Spinner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/Spinner.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,YAAY;IAC3B,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,OAAO,GAAI,kBAA2B,YAAY,4CAgB9D,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The root Ink view — a pure projection of {@link SessionController} state.
3
+ * Under `prompt/ink/**` — dynamic-only. Ported from the summon wizard's App,
4
+ * but it OWNS no execution: the seam runs the task; this view only renders the
5
+ * prompt sequence, the preview/confirm gate, live progress, and the outcome.
6
+ */
7
+ import type { SessionController } from "./session.js";
8
+ export interface WizardProps {
9
+ /** The controller this view projects and drives. */
10
+ controller: SessionController;
11
+ }
12
+ /** The wizard view — subscribes to the controller and renders its phase. */
13
+ export declare const Wizard: ({ controller }: WizardProps) => import("react/jsx-runtime").JSX.Element;
14
+ //# sourceMappingURL=Wizard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Wizard.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/Wizard.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,cAAc,CAAC;AAoGnE,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,UAAU,EAAE,iBAAiB,CAAC;CAC/B;AAED,4EAA4E;AAC5E,eAAO,MAAM,MAAM,GAAI,gBAAgB,WAAW,4CAiGjD,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The dynamic-import target that stands up the Ink render.
3
+ *
4
+ * `inkPrompt` reaches this module ONLY via `await import("./ink/mount.js")` on
5
+ * the first `Prompt` effect — this is THE boundary that keeps `ink`/`react` out
6
+ * of summon-core's static graph. It wires one {@link SessionController} to one
7
+ * persistent Ink render (on stderr, so stdout carries only the machine/plain
8
+ * result the kernel prints after the run) and returns the seam handle.
9
+ */
10
+ import type { Effect, LogLevel } from "@canonical/task";
11
+ import type GeneratorDefinition from "../../types/GeneratorDefinition.js";
12
+ import type { InkPromptOptions } from "../inkPrompt.js";
13
+ import type { PromptEffect } from "../types.js";
14
+ /** The seam handle a mounted session exposes back to {@link inkPrompt}. */
15
+ export interface MountedSession {
16
+ answerPrompt: (effect: PromptEffect) => Promise<unknown>;
17
+ reportEffectStart: (effect: Effect) => void;
18
+ reportEffectComplete: (effect: Effect, duration: number) => void;
19
+ reportLog: (level: LogLevel, message: string) => void;
20
+ dispose: () => void;
21
+ }
22
+ /**
23
+ * Mount the wizard for a generator and return its seam handle.
24
+ *
25
+ * @param generator - The generator being run.
26
+ * @param options - The abort signal.
27
+ * @returns The {@link MountedSession} the prompt handler and effect callbacks drive.
28
+ * @note Impure — renders an Ink app to stderr and reads stdin.
29
+ */
30
+ export declare function mountPromptSession(generator: GeneratorDefinition, options?: InkPromptOptions): MountedSession;
31
+ //# sourceMappingURL=mount.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The single-question Ink widgets + shared display bits, ported from the summon
3
+ * wizard and retargeted at the task alphabet's {@link PromptQuestion} (the
4
+ * shape a `Prompt` effect carries). Under `prompt/ink/**` — dynamic-only.
5
+ */
6
+ import type { PromptQuestion } from "@canonical/task";
7
+ import type PromptDefinition from "../../types/PromptDefinition.js";
8
+ /** Format an answer value for the completed-answers table. */
9
+ export declare const formatAnswerValue: (value: unknown, prompt: Pick<PromptDefinition, "type" | "choices">) => string;
10
+ /** The completed-answers table (aligned, borderless). */
11
+ export declare const AnswersTable: ({ prompts, answers, }: {
12
+ prompts: PromptDefinition[];
13
+ answers: Record<string, unknown>;
14
+ }) => import("react/jsx-runtime").JSX.Element | null;
15
+ /** The "Step N of M" progress header. */
16
+ export declare const ProgressHeader: ({ current, total, }: {
17
+ current: number;
18
+ total: number;
19
+ }) => import("react/jsx-runtime").JSX.Element;
20
+ /** Render the widget for a single {@link PromptQuestion}. */
21
+ export declare const QuestionView: ({ question, onSubmit, onCancel, }: {
22
+ question: PromptQuestion;
23
+ onSubmit: (value: unknown) => void;
24
+ onCancel: () => void;
25
+ }) => import("react/jsx-runtime").JSX.Element;
26
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/prompts.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAGV,cAAc,EAGf,MAAM,iBAAiB,CAAC;AAKzB,OAAO,KAAK,gBAAgB,MAAM,iCAAiC,CAAC;AAEpE,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,GAC5B,OAAO,OAAO,EACd,QAAQ,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC,KACjD,MAiBF,CAAC;AAEF,yDAAyD;AACzD,eAAO,MAAM,YAAY,GAAI,uBAG1B;IACD,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,mDAsBA,CAAC;AAEF,yCAAyC;AACzC,eAAO,MAAM,cAAc,GAAI,qBAG5B;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,4CAMA,CAAC;AAsLF,6DAA6D;AAC7D,eAAO,MAAM,YAAY,GAAI,mCAI1B;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,4CAmCA,CAAC"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The Ink wizard's controller — plain TypeScript, NO React.
3
+ *
4
+ * It sits between the seam (which drives the task and calls it per `Prompt`
5
+ * effect + per completed effect) and the React `<Wizard>` view (which
6
+ * subscribes to it). This split keeps the answer/preview/progress state machine
7
+ * out of React and lets the view be a pure projection of controller state.
8
+ *
9
+ * Lives under `prompt/ink/**`, so it is only ever reached through the dynamic
10
+ * `import("./mount.js")` boundary — it never lands in summon-core's static
11
+ * graph, even though it carries no JSX itself.
12
+ */
13
+ import { type Effect, type LogLevel, type TaskError } from "@canonical/task";
14
+ import type GeneratorDefinition from "../../types/GeneratorDefinition.js";
15
+ import type { PromptEffect } from "../types.js";
16
+ /** The wizard's coarse lifecycle phase. */
17
+ export type WizardPhase = "idle" | "prompting" | "confirming" | "executing" | "complete" | "error" | "cancelled";
18
+ /** An effect plus the time (ms, relative to execution start) it completed. */
19
+ export interface TimedEffect {
20
+ readonly effect: Effect;
21
+ readonly timestamp: number;
22
+ }
23
+ /** The immutable snapshot the React view renders. A new object per change. */
24
+ export interface WizardState {
25
+ readonly phase: WizardPhase;
26
+ readonly generator: GeneratorDefinition;
27
+ readonly answers: Record<string, unknown>;
28
+ /** The active non-confirm prompt, when `phase === "prompting"`. */
29
+ readonly activeQuestion?: PromptEffect;
30
+ /** 1-based index of the active prompt among applicable prompts. */
31
+ readonly step: number;
32
+ /** Count of applicable prompts (respecting `when`) at this point. */
33
+ readonly total: number;
34
+ /** The dry-run plan shown at the confirm gate. */
35
+ readonly previewEffects: readonly Effect[];
36
+ /** Effects completed so far during execution. */
37
+ readonly progress: readonly TimedEffect[];
38
+ /** A failure, when `phase === "error"`. */
39
+ readonly error?: TaskError;
40
+ }
41
+ /**
42
+ * The controller: a tiny observable state machine driving the Ink wizard.
43
+ */
44
+ export declare class SessionController {
45
+ private readonly onUserCancel?;
46
+ private current;
47
+ private readonly listeners;
48
+ private pending?;
49
+ private executionStart;
50
+ /**
51
+ * @param generator - The generator being run.
52
+ * @param onUserCancel - Invoked once when the user cancels (Ctrl-C / escape).
53
+ * The seam wires this to the run's `AbortController.abort()`, so a Ctrl-C
54
+ * DURING execution actually interrupts the interpreter (its
55
+ * `checkInterrupted` fires between effects) instead of only rejecting a
56
+ * — by then non-existent — pending prompt. `abort()` is idempotent, so the
57
+ * signal→cancel→abort path cannot loop.
58
+ */
59
+ constructor(generator: GeneratorDefinition, onUserCancel?: (() => void) | undefined);
60
+ /** Subscribe to state changes; returns an unsubscribe function. */
61
+ subscribe: (listener: () => void) => (() => void);
62
+ /** The current immutable snapshot (stable identity between changes). */
63
+ getSnapshot: () => WizardState;
64
+ private set;
65
+ /**
66
+ * A `Prompt` effect arrived from the running task. Returns a promise the
67
+ * view resolves once the user answers (or the run is cancelled).
68
+ */
69
+ request(effect: PromptEffect): Promise<unknown>;
70
+ /** Feed effect start (kept for seam symmetry; progress rides completion). */
71
+ reportEffectStart(_effect: Effect): void;
72
+ /** Record a completed effect for the live progress view. */
73
+ reportEffectComplete(effect: Effect, _duration: number): void;
74
+ /** A task log line (kept for parity; not surfaced by the default view). */
75
+ reportLog(_level: LogLevel, _message: string): void;
76
+ /** Mark the run complete (the view flashes a completion summary). */
77
+ markComplete(): void;
78
+ /** Mark the run failed. */
79
+ markError(error: TaskError): void;
80
+ /** The user answered the active (non-confirm) prompt. */
81
+ submitAnswer(value: unknown): void;
82
+ /** The user answered the confirm gate. */
83
+ submitConfirm(proceed: boolean): void;
84
+ /**
85
+ * The user cancelled (Ctrl-C / escape). Two things must happen, and both are
86
+ * safe to run whether or not a prompt is pending:
87
+ *
88
+ * 1. (H2) Abort the run via `onUserCancel` — a Ctrl-C mid-execution has no
89
+ * pending prompt to reject, so the abort is what actually stops the
90
+ * interpreter (its `checkInterrupted` throws `TASK_INTERRUPTED`).
91
+ * 2. (H1) Reject any pending prompt with a `TaskExecutionError` carrying
92
+ * `GENERATOR_CANCELLED` — NOT a bare `Error`. The interpreter only
93
+ * preserves a thrown error's `.code` for a `TaskExecutionError`; a bare
94
+ * Error flattens to `INTERNAL`, which the CLI boundary renders as a scary
95
+ * "please report this issue" (exit 1). Carrying the code routes an
96
+ * at-prompt cancel through the same clean "Cancelled." (exit 0) path as
97
+ * declining the confirm gate. The reject fails the current `Prompt` effect
98
+ * before the drive loop reaches its next `checkInterrupted`, so it wins
99
+ * deterministically over the concurrent abort.
100
+ */
101
+ cancel(): void;
102
+ }
103
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AAKzB,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;IAClD,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAC5B;AAWD;;GAEG;AACH,qBAAa,iBAAiB;IAsB1B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IArBhC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IACnD,OAAO,CAAC,OAAO,CAAC,CAKd;IACF,OAAO,CAAC,cAAc,CAAK;IAE3B;;;;;;;;OAQG;gBAED,SAAS,EAAE,mBAAmB,EACb,YAAY,CAAC,GAAE,MAAM,IAAI,aAAA;IAa5C,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;IA0B/C,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"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * The interactive Ink prompt strategy — the embedded #819 wizard, seam-backed.
3
+ *
4
+ * CRITICAL (lazy-React discipline): this module's STATIC import graph contains
5
+ * NO JSX and NO `import` of `ink`/`react`. The entire React UI lives under
6
+ * `./ink/**` and is reached ONLY through `await import("./ink/mount.js")` on the
7
+ * first `Prompt` effect. So importing summon-core — or building the pragma
8
+ * command tree, or running `create --yes` (which picks {@link autoPrompt}) —
9
+ * never loads React. The lazy-React guard test enforces this boundary.
10
+ *
11
+ * The session is SESSION-backed, not per-question: one persistent Ink render is
12
+ * stood up on the first prompt and torn down on completion or abort, so it
13
+ * preserves the step-N-of-M header, the live answers table, and the
14
+ * preview/confirm gate across the whole run. The runner feeds it two streams —
15
+ * `Prompt` effects (via `promptHandler`) and effect progress (via
16
+ * `onEffectStart`/`onEffectComplete`/`onLog`) — and it renders both.
17
+ */
18
+ import type { Effect, LogLevel } from "@canonical/task";
19
+ import type GeneratorDefinition from "../types/GeneratorDefinition.js";
20
+ import type { PromptHandler } from "./types.js";
21
+ /** Options for the Ink session: the abort signal and the cancel callback. */
22
+ export interface InkPromptOptions {
23
+ /** Abort signal — tears the session down when the run is cancelled. */
24
+ readonly signal?: AbortSignal;
25
+ /**
26
+ * Invoked when the user cancels IN the wizard (Ctrl-C / escape). Threaded to
27
+ * the {@link SessionController} so an in-Ink cancel aborts the run (H2): a
28
+ * Ctrl-C during execution — where Ink's raw mode swallows SIGINT — has no
29
+ * pending prompt, so this callback (wired to the run's `AbortController`) is
30
+ * what stops the interpreter. Distinct from `signal`, which fires the OTHER
31
+ * way (an external abort tears the render down).
32
+ */
33
+ readonly onCancel?: () => void;
34
+ }
35
+ /**
36
+ * A running Ink session's seam surface: the prompt handler plus the effect
37
+ * callbacks the runner wires into `runtime.exec`, and its teardown.
38
+ */
39
+ export interface InkSession {
40
+ /** The `promptHandler` the runner interprets `Prompt` effects with. */
41
+ readonly promptHandler: PromptHandler;
42
+ /** Feed effect start into the live progress view (composed after stamping). */
43
+ readonly onEffectStart: (effect: Effect) => void;
44
+ /** Feed effect completion (with timing) into the live progress view. */
45
+ readonly onEffectComplete: (effect: Effect, duration: number) => void;
46
+ /** Feed a task log line into the live view. */
47
+ readonly onLog: (level: LogLevel, message: string) => void;
48
+ /** Tear down the Ink render. Safe to call more than once. */
49
+ readonly dispose: () => void;
50
+ }
51
+ /**
52
+ * Build the interactive Ink session for a generator.
53
+ *
54
+ * The Ink render is not created until the first `Prompt` effect arrives (which
55
+ * dynamically imports the React UI), so picking this strategy on a fast path
56
+ * that never prompts costs nothing and loads no React.
57
+ *
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.
61
+ * @returns The {@link InkSession} the `create` verb wires into `runtime.exec`.
62
+ */
63
+ export default function inkPrompt(generator: GeneratorDefinition, options?: InkPromptOptions): InkSession;
64
+ //# sourceMappingURL=inkPrompt.d.ts.map
@@ -0,0 +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;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,CA4BZ"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The MCP prompt strategy: resolve every answer from the tool arguments or the
3
+ * prompt's default, and fail structurally otherwise — never block on stdin.
4
+ *
5
+ * An MCP tool call carries all inputs up front as arguments; there is no
6
+ * interactive channel. This handler resolves each `Prompt` effect from the
7
+ * provided `params` (defensively — {@link collectAnswers} already skips provided
8
+ * answers), then the prompt's declared default, and otherwise rejects with a
9
+ * structured `MISSING_REQUIRED_ANSWER` task error. It is synchronous-resolving
10
+ * by construction, so a mutating tool can never hang waiting for input.
11
+ */
12
+ import type { PromptHandler } from "./types.js";
13
+ /**
14
+ * A prompt handler that resolves answers from MCP tool args or defaults.
15
+ *
16
+ * @param params - The tool arguments (already coerced to the answer shape).
17
+ * @returns The MCP {@link PromptHandler} — params-or-default-or-error, never a hang.
18
+ */
19
+ export default function mcpPrompt(params?: Readonly<Record<string, unknown>>): PromptHandler;
20
+ //# sourceMappingURL=mcpPrompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcpPrompt.d.ts","sourceRoot":"","sources":["../../../src/prompt/mcpPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,MAAM,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GAC7C,aAAa,CAOf"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The prompt-handling seam types.
3
+ *
4
+ * A {@link PromptHandler} is exactly the shape the task interpreter's
5
+ * `promptHandler` option expects — it receives the whole `Prompt` effect (whose
6
+ * `.question` carries name/message/type/default/choices/validate) and resolves
7
+ * the answer. Every front-end (Ink wizard, MCP args, non-interactive defaults)
8
+ * is one implementation of this single function type, injected into the runner;
9
+ * summon-core never owns a UI toolkit.
10
+ */
11
+ import type { ConfirmPrompt, Effect, MultiselectPrompt, PromptQuestion, SelectPrompt, TextPrompt } from "@canonical/task";
12
+ /** A `Prompt` effect — the argument a {@link PromptHandler} resolves. */
13
+ export type PromptEffect = Effect & {
14
+ _tag: "Prompt";
15
+ };
16
+ /**
17
+ * The one prompt-answering seam: resolve a `Prompt` effect to its answer. The
18
+ * runner (`runTask` / `runGeneratorTask`) drives the task and calls this for
19
+ * each interleaved `Prompt`.
20
+ */
21
+ export type PromptHandler = (question: PromptEffect) => Promise<unknown>;
22
+ export type { ConfirmPrompt, MultiselectPrompt, PromptQuestion, SelectPrompt, TextPrompt, };
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/prompt/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,UAAU,EACX,MAAM,iBAAiB,CAAC;AAEzB,yEAAyE;AACzE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEzE,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,UAAU,GACX,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { RunGeneratorTaskOptions } from "./runGeneratorTask.js";
2
+ export { default as runGeneratorTask } from "./runGeneratorTask.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/run/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The single, UI-free execution point for running a generator or setup Task
3
+ * for real.
4
+ *
5
+ * Every binary — pragma's kernel, summon's Ink TUI — runs its tasks through
6
+ * here. Interactivity is injected as a `promptHandler`, so this core never
7
+ * imports a UI toolkit; the terminal front-ends own that. Centralising
8
+ * execution here gives every command the same working-directory semantics and
9
+ * a single seam where cross-cutting behavior (progress, interception) can be
10
+ * added without touching the callers.
11
+ *
12
+ * Moved into summon-core (from the v1 cli-core) so it sits below both the
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.
15
+ */
16
+ import type { Task } from "@canonical/task";
17
+ import { type RunTaskOptions } from "@canonical/task/node";
18
+ /** Options controlling how {@link runGeneratorTask} executes a task. */
19
+ export interface RunGeneratorTaskOptions {
20
+ /**
21
+ * Directory to run the task in. When set and different from the current
22
+ * process directory, the process is `chdir`-ed for the duration of the run
23
+ * and restored afterwards, so effects resolve relative paths against it.
24
+ */
25
+ readonly cwd?: string;
26
+ /** Handler for interactive `Prompt` effects; the UI seam the front-ends inject. */
27
+ readonly promptHandler?: RunTaskOptions["promptHandler"];
28
+ /** Handler for `Log` effects; where task log output is routed. */
29
+ readonly onLog?: RunTaskOptions["onLog"];
30
+ /** Called before each effect is executed. */
31
+ readonly onEffectStart?: RunTaskOptions["onEffectStart"];
32
+ /** Called after each effect completes. */
33
+ readonly onEffectComplete?: RunTaskOptions["onEffectComplete"];
34
+ /** AbortSignal for interrupting execution. */
35
+ readonly signal?: AbortSignal;
36
+ }
37
+ /**
38
+ * Run a Task for real in the given working directory and return its value.
39
+ *
40
+ * Runs that request a `cwd` are serialised against each other, so concurrent
41
+ * callers cannot interleave `chdir` calls; runs without a `cwd` execute
42
+ * immediately in whatever the current process directory is.
43
+ *
44
+ * @typeParam A - The task's result type.
45
+ * @param task - A freshly-built task to run.
46
+ * @param options - Working directory and injected handlers.
47
+ * @returns The task's value.
48
+ * @note Impure — performs the task's effects and may `chdir`.
49
+ */
50
+ export default function runGeneratorTask<A>(task: Task<A>, options?: RunGeneratorTaskOptions): Promise<A>;
51
+ //# sourceMappingURL=runGeneratorTask.d.ts.map
@@ -0,0 +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,QAAQ,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IACzD,kEAAkE;IAClE,QAAQ,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,6CAA6C;IAC7C,QAAQ,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IACzD,0CAA0C;IAC1C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAC/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"}
@@ -0,0 +1,16 @@
1
+ import type GeneratorDefinition from "../types/GeneratorDefinition.js";
2
+ import type StampConfig from "../types/StampConfig.js";
3
+ /**
4
+ * Build the generated-file stamp for a generator.
5
+ *
6
+ * This is the single source of the stamp identity: every binary that stamps
7
+ * output derives its `StampConfig` here, so `pragma create X` and `summon X`
8
+ * embed the identical generator identifier — a requirement of the cross-binary
9
+ * byte-equality guarantee. The display name is preferred (summon's historical
10
+ * stamp format), falling back to the registry name.
11
+ *
12
+ * @param gen - The generator whose output is being stamped.
13
+ * @returns The stamp configuration for the seam transform.
14
+ */
15
+ export default function createGeneratorStamp(gen: GeneratorDefinition): StampConfig;
16
+ //# sourceMappingURL=createGeneratorStamp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createGeneratorStamp.d.ts","sourceRoot":"","sources":["../../../src/stamp/createGeneratorStamp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,mBAAmB,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,GAAG,EAAE,mBAAmB,GACvB,WAAW,CAKb"}
@@ -0,0 +1,17 @@
1
+ import type { Effect } from "@canonical/task";
2
+ import type StampConfig from "../types/StampConfig.js";
3
+ /**
4
+ * Build an `onEffectStart` seam callback that prepends the generated-file
5
+ * stamp to every `WriteFile` effect's content before it executes.
6
+ *
7
+ * This is THE stamping path: every binary that stamps generated output does so
8
+ * through this one transform on the shared executor's seam, so `pragma create
9
+ * X` and `summon X` write byte-identical files.
10
+ *
11
+ * @param stamp - The stamp configuration (generator name/version).
12
+ * @param next - An optional downstream `onEffectStart` (e.g. progress UI),
13
+ * invoked after stamping.
14
+ * @returns The composed `onEffectStart` callback.
15
+ */
16
+ export default function createStampOnEffectStart(stamp: StampConfig, next?: (effect: Effect) => void): (effect: Effect) => void;
17
+ //# sourceMappingURL=createStampOnEffectStart.d.ts.map
@@ -0,0 +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,4 +1,6 @@
1
1
  export { default as applyStamp } from "./applyStamp.js";
2
+ export { default as createGeneratorStamp } from "./createGeneratorStamp.js";
3
+ export { default as createStampOnEffectStart } from "./createStampOnEffectStart.js";
2
4
  export { default as runTaskWithStamp } from "./runTaskWithStamp.js";
3
5
  export type { RunTaskWithStampOptions } from "./types.js";
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stamp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stamp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
@@ -3,5 +3,5 @@ import type GeneratorDefinition from "./GeneratorDefinition.js";
3
3
  * A generator definition without type parameters, used in barrels/collections.
4
4
  */
5
5
  type AnyGenerator = GeneratorDefinition<any>;
6
- export default AnyGenerator;
6
+ export type { AnyGenerator as default };
7
7
  //# sourceMappingURL=AnyGenerator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnyGenerator.d.ts","sourceRoot":"","sources":["../../../src/types/AnyGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAEhE;;GAEG;AAEH,KAAK,YAAY,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;AAE7C,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"AnyGenerator.d.ts","sourceRoot":"","sources":["../../../src/types/AnyGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAEhE;;GAEG;AAEH,KAAK,YAAY,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;AAE7C,YAAY,EAAE,YAAY,IAAI,OAAO,EAAE,CAAC"}
@@ -16,5 +16,5 @@ import type ReservedOption from "./ReservedOption.js";
16
16
  type ForbidReserved<T> = {
17
17
  [K in keyof T]: K extends ReservedOption ? [`Error: '${K & string}' is a reserved option name`] : T[K];
18
18
  };
19
- export default ForbidReserved;
19
+ export type { ForbidReserved as default };
20
20
  //# sourceMappingURL=ForbidReserved.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ForbidReserved.d.ts","sourceRoot":"","sources":["../../../src/types/ForbidReserved.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,KAAK,cAAc,CAAC,CAAC,IAAI;KACtB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,cAAc,GACpC,CAAC,WAAW,CAAC,GAAG,MAAM,6BAA6B,CAAC,GACpD,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"ForbidReserved.d.ts","sourceRoot":"","sources":["../../../src/types/ForbidReserved.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,KAAK,cAAc,CAAC,CAAC,IAAI;KACtB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,cAAc,GACpC,CAAC,WAAW,CAAC,GAAG,MAAM,6BAA6B,CAAC,GACpD,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AAEF,YAAY,EAAE,cAAc,IAAI,OAAO,EAAE,CAAC"}
@@ -3,5 +3,5 @@
3
3
  * Generator prompts MUST NOT use these names.
4
4
  */
5
5
  type ReservedOption = "help" | "version" | "dryRun" | "dry-run" | "yes" | "output" | "preview" | "generators" | "run" | "init" | "llm" | "format" | "showFiles" | "show-files" | "verbose" | "generatedStamp";
6
- export default ReservedOption;
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,eAAe,cAAc,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,CAAC;AAErB,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.30.0",
4
+ "version": "0.32.0",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/types/index.d.ts",
@@ -39,26 +39,33 @@
39
39
  "check:biome:fix": "biome check --write",
40
40
  "check:ts": "tsc --noEmit",
41
41
  "check:webarchitect": "webarchitect library --license GPL-3.0",
42
- "test": "bun run test:vitest",
43
- "test:vitest": "vitest run --coverage",
42
+ "test": "bun run test:vitest && bun run test:ink",
43
+ "test:vitest": "vitest run --coverage --exclude '**/*.test.tsx'",
44
+ "test:ink": "vitest run --no-coverage 'src/prompt/ink/wizard.test.tsx'",
44
45
  "test:vitest:watch": "vitest"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@biomejs/biome": "2.4.9",
48
- "@canonical/biome-config": "^0.30.0",
49
- "@canonical/typescript-config": "^0.30.0",
50
- "@canonical/webarchitect": "^0.30.0",
49
+ "@canonical/biome-config": "^0.32.0",
50
+ "@canonical/typescript-config": "^0.32.0",
51
+ "@canonical/webarchitect": "^0.32.0",
51
52
  "@types/bun": "^1.3.10",
52
53
  "@types/ejs": "^3.1.5",
53
54
  "@types/node": "^24.12.0",
55
+ "@types/react": "^19.2.14",
56
+ "ink-testing-library": "^4.0.0",
54
57
  "typescript": "^5.9.3",
55
58
  "vitest": "^4.0.18"
56
59
  },
57
60
  "dependencies": {
58
- "@canonical/task": "^0.30.0",
59
- "@canonical/utils": "^0.30.0",
61
+ "@canonical/task": "^0.32.0",
62
+ "@canonical/utils": "^0.32.0",
60
63
  "chalk": "^5.6.2",
61
- "ejs": "^5.0.0"
64
+ "ejs": "^5.0.0",
65
+ "ink": "^6.8.0",
66
+ "ink-select-input": "^6.2.0",
67
+ "ink-text-input": "^6.0.0",
68
+ "react": "^19.2.4"
62
69
  },
63
- "gitHead": "40fe86ac955473536ac14f074812a9821f5b65c0"
70
+ "gitHead": "5b279d8150e3988c68c6c2a741046bcd425624ca"
64
71
  }