@canonical/summon-core 0.34.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.
- package/dist/esm/discovery/discoverGeneratorTree.js +14 -10
- package/dist/esm/discovery/discoverGeneratorTree.js.map +1 -1
- package/dist/esm/execute/collectAnswers.js +21 -16
- package/dist/esm/execute/collectAnswers.js.map +1 -1
- package/dist/esm/execute/execute.js +67 -22
- package/dist/esm/execute/execute.js.map +1 -1
- package/dist/esm/execute/index.js +1 -1
- package/dist/esm/execute/index.js.map +1 -1
- package/dist/esm/execute/validateAnswers.js +19 -5
- package/dist/esm/execute/validateAnswers.js.map +1 -1
- package/dist/esm/format/effects.js +197 -51
- package/dist/esm/format/effects.js.map +1 -1
- package/dist/esm/format/formatFlagName.js +17 -0
- package/dist/esm/format/formatFlagName.js.map +1 -0
- package/dist/esm/format/index.js +19 -1
- package/dist/esm/format/index.js.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/projection/answers.js +84 -0
- package/dist/esm/projection/answers.js.map +1 -0
- package/dist/esm/projection/buildOptionInfo.js +77 -0
- package/dist/esm/projection/buildOptionInfo.js.map +1 -0
- package/dist/esm/projection/commander/configureGroupedHelp.js +39 -0
- package/dist/esm/projection/commander/configureGroupedHelp.js.map +1 -0
- package/dist/esm/projection/commander/emitToProcess.js +15 -0
- package/dist/esm/projection/commander/emitToProcess.js.map +1 -0
- package/dist/esm/projection/commander/index.js +20 -0
- package/dist/esm/projection/commander/index.js.map +1 -0
- package/dist/esm/projection/commander/registerGeneratorCommands.js +222 -0
- package/dist/esm/projection/commander/registerGeneratorCommands.js.map +1 -0
- package/dist/esm/projection/decideInteraction.js +73 -0
- package/dist/esm/projection/decideInteraction.js.map +1 -0
- package/dist/esm/projection/extractAnswers.js +52 -0
- package/dist/esm/projection/extractAnswers.js.map +1 -0
- package/dist/esm/projection/groupedHelp.js +74 -0
- package/dist/esm/projection/groupedHelp.js.map +1 -0
- package/dist/esm/projection/index.js +26 -0
- package/dist/esm/projection/index.js.map +1 -0
- package/dist/esm/projection/kebab.js +18 -0
- package/dist/esm/projection/kebab.js.map +1 -0
- package/dist/esm/projection/projectGenerator.js +46 -0
- package/dist/esm/projection/projectGenerator.js.map +1 -0
- package/dist/esm/projection/types.js +16 -0
- package/dist/esm/projection/types.js.map +1 -0
- package/dist/esm/projection/usage.js +144 -0
- package/dist/esm/projection/usage.js.map +1 -0
- package/dist/esm/prompt/answerPromptWithDefaults.js +7 -5
- package/dist/esm/prompt/answerPromptWithDefaults.js.map +1 -1
- package/dist/esm/prompt/autoPrompt.js +2 -3
- package/dist/esm/prompt/autoPrompt.js.map +1 -1
- package/dist/esm/prompt/ink/mount.js +1 -1
- package/dist/esm/prompt/ink/mount.js.map +1 -1
- package/dist/esm/prompt/ink/session.js +21 -6
- package/dist/esm/prompt/ink/session.js.map +1 -1
- package/dist/esm/prompt/inkPrompt.js +10 -1
- package/dist/esm/prompt/inkPrompt.js.map +1 -1
- package/dist/esm/prompt/mcpPrompt.js +1 -1
- package/dist/esm/prompt/mcpPrompt.js.map +1 -1
- package/dist/esm/stamp/applyStamp.js +50 -52
- package/dist/esm/stamp/applyStamp.js.map +1 -1
- package/dist/esm/stamp/createStampOnEffectStart.js +4 -1
- package/dist/esm/stamp/createStampOnEffectStart.js.map +1 -1
- package/dist/esm/stamp/runTaskWithStamp.js +8 -9
- package/dist/esm/stamp/runTaskWithStamp.js.map +1 -1
- package/dist/esm/template/index.js +2 -0
- package/dist/esm/template/index.js.map +1 -1
- package/dist/esm/template/loadTemplate.js +43 -0
- package/dist/esm/template/loadTemplate.js.map +1 -0
- package/dist/esm/template/prependStamp.js +11 -8
- package/dist/esm/template/prependStamp.js.map +1 -1
- package/dist/esm/template/rawFile.js +25 -0
- package/dist/esm/template/rawFile.js.map +1 -0
- package/dist/esm/template/tasks/template.js +12 -3
- package/dist/esm/template/tasks/template.js.map +1 -1
- package/dist/esm/template/tasks/templateDir.js +5 -0
- package/dist/esm/template/tasks/templateDir.js.map +1 -1
- package/dist/esm/testing/conformance/fixtures.js +0 -2
- package/dist/esm/testing/conformance/fixtures.js.map +1 -1
- package/dist/esm/testing/conformance/flagizeAnswers.js +91 -0
- package/dist/esm/testing/conformance/flagizeAnswers.js.map +1 -0
- package/dist/esm/testing/conformance/index.js +1 -0
- package/dist/esm/testing/conformance/index.js.map +1 -1
- package/dist/esm/testing/index.js +1 -1
- package/dist/esm/testing/index.js.map +1 -1
- package/dist/types/discovery/discoverGeneratorTree.d.ts +3 -3
- package/dist/types/discovery/discoverGeneratorTree.d.ts.map +1 -1
- package/dist/types/execute/collectAnswers.d.ts +4 -3
- package/dist/types/execute/collectAnswers.d.ts.map +1 -1
- package/dist/types/execute/execute.d.ts +27 -1
- package/dist/types/execute/execute.d.ts.map +1 -1
- package/dist/types/execute/index.d.ts +1 -1
- package/dist/types/execute/index.d.ts.map +1 -1
- package/dist/types/execute/validateAnswers.d.ts.map +1 -1
- package/dist/types/format/effects.d.ts +61 -7
- package/dist/types/format/effects.d.ts.map +1 -1
- package/dist/types/format/formatFlagName.d.ts +14 -0
- package/dist/types/format/formatFlagName.d.ts.map +1 -0
- package/dist/types/format/index.d.ts +20 -1
- package/dist/types/format/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/projection/answers.d.ts +54 -0
- package/dist/types/projection/answers.d.ts.map +1 -0
- package/dist/types/projection/buildOptionInfo.d.ts +25 -0
- package/dist/types/projection/buildOptionInfo.d.ts.map +1 -0
- package/dist/types/projection/commander/configureGroupedHelp.d.ts +29 -0
- package/dist/types/projection/commander/configureGroupedHelp.d.ts.map +1 -0
- package/dist/types/projection/commander/emitToProcess.d.ts +10 -0
- package/dist/types/projection/commander/emitToProcess.d.ts.map +1 -0
- package/dist/types/projection/commander/index.d.ts +21 -0
- package/dist/types/projection/commander/index.d.ts.map +1 -0
- package/dist/types/projection/commander/registerGeneratorCommands.d.ts +95 -0
- package/dist/types/projection/commander/registerGeneratorCommands.d.ts.map +1 -0
- package/dist/types/projection/decideInteraction.d.ts +70 -0
- package/dist/types/projection/decideInteraction.d.ts.map +1 -0
- package/dist/types/projection/extractAnswers.d.ts +23 -0
- package/dist/types/projection/extractAnswers.d.ts.map +1 -0
- package/dist/types/projection/groupedHelp.d.ts +25 -0
- package/dist/types/projection/groupedHelp.d.ts.map +1 -0
- package/dist/types/projection/index.d.ts +29 -0
- package/dist/types/projection/index.d.ts.map +1 -0
- package/dist/types/projection/kebab.d.ts +16 -0
- package/dist/types/projection/kebab.d.ts.map +1 -0
- package/dist/types/projection/projectGenerator.d.ts +22 -0
- package/dist/types/projection/projectGenerator.d.ts.map +1 -0
- package/dist/types/projection/types.d.ts +118 -0
- package/dist/types/projection/types.d.ts.map +1 -0
- package/dist/types/projection/usage.d.ts +92 -0
- package/dist/types/projection/usage.d.ts.map +1 -0
- package/dist/types/prompt/answerPromptWithDefaults.d.ts +5 -3
- package/dist/types/prompt/answerPromptWithDefaults.d.ts.map +1 -1
- package/dist/types/prompt/autoPrompt.d.ts.map +1 -1
- package/dist/types/prompt/ink/mount.d.ts.map +1 -1
- package/dist/types/prompt/ink/session.d.ts +1 -1
- package/dist/types/prompt/ink/session.d.ts.map +1 -1
- package/dist/types/prompt/inkPrompt.d.ts +7 -0
- package/dist/types/prompt/inkPrompt.d.ts.map +1 -1
- package/dist/types/stamp/applyStamp.d.ts +6 -2
- package/dist/types/stamp/applyStamp.d.ts.map +1 -1
- package/dist/types/stamp/createStampOnEffectStart.d.ts.map +1 -1
- package/dist/types/stamp/runTaskWithStamp.d.ts +3 -1
- package/dist/types/stamp/runTaskWithStamp.d.ts.map +1 -1
- package/dist/types/template/index.d.ts +4 -0
- package/dist/types/template/index.d.ts.map +1 -1
- package/dist/types/template/loadTemplate.d.ts +40 -0
- package/dist/types/template/loadTemplate.d.ts.map +1 -0
- package/dist/types/template/prependStamp.d.ts +5 -2
- package/dist/types/template/prependStamp.d.ts.map +1 -1
- package/dist/types/template/rawFile.d.ts +32 -0
- package/dist/types/template/rawFile.d.ts.map +1 -0
- package/dist/types/template/tasks/template.d.ts +8 -0
- package/dist/types/template/tasks/template.d.ts.map +1 -1
- package/dist/types/template/tasks/templateDir.d.ts.map +1 -1
- package/dist/types/template/tasks/types.d.ts +2 -0
- package/dist/types/template/tasks/types.d.ts.map +1 -1
- package/dist/types/testing/conformance/fixtures.d.ts.map +1 -1
- package/dist/types/testing/conformance/flagizeAnswers.d.ts +38 -0
- package/dist/types/testing/conformance/flagizeAnswers.d.ts.map +1 -0
- package/dist/types/testing/conformance/index.d.ts +1 -0
- package/dist/types/testing/conformance/index.d.ts.map +1 -1
- package/dist/types/testing/index.d.ts +1 -1
- package/dist/types/testing/index.d.ts.map +1 -1
- package/dist/types/types/GeneratorDefinition.d.ts +10 -1
- package/dist/types/types/GeneratorDefinition.d.ts.map +1 -1
- package/dist/types/types/ReservedOption.d.ts +1 -1
- package/dist/types/types/ReservedOption.d.ts.map +1 -1
- package/package.json +21 -8
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract the EXPLICITLY provided answers from parsed Commander options —
|
|
3
|
+
* moved verbatim from the summon bin's registration layer. Explicit-only is
|
|
4
|
+
* the invariant: defaults never enter the result (Commander was registered
|
|
5
|
+
* without them — see `buildOptionInfo`), so downstream decisions can tell a
|
|
6
|
+
* typed flag from an untouched one.
|
|
7
|
+
*
|
|
8
|
+
* The one unavoidable ambiguity: Commander reports a default-`true` confirm's
|
|
9
|
+
* `--no-<kebab>` as `true` when the flag was NOT passed. Equality-vs-default
|
|
10
|
+
* filters that out — a confirm value equal to its declared default is treated
|
|
11
|
+
* as unprovided. (Typing the flag that restates the default is therefore
|
|
12
|
+
* indistinguishable from omitting it; every consumer inherits that fact.)
|
|
13
|
+
*/
|
|
14
|
+
import type { PromptLike } from "./types.js";
|
|
15
|
+
/**
|
|
16
|
+
* Extract answers from Commander options based on prompts.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Commander's parsed option values.
|
|
19
|
+
* @param prompts - The command's prompts (live or projected).
|
|
20
|
+
* @returns Only the explicitly provided answers, keyed by prompt name.
|
|
21
|
+
*/
|
|
22
|
+
export default function extractAnswers(options: Record<string, unknown>, prompts: readonly PromptLike[]): Record<string, unknown>;
|
|
23
|
+
//# sourceMappingURL=extractAnswers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractAnswers.d.ts","sourceRoot":"","sources":["../../../src/projection/extractAnswers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,EAAE,SAAS,UAAU,EAAE,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiCzB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grouped `--help` for a generator command — the PURE half of the split: the
|
|
3
|
+
* group bucketing and the rendered page, with the host's standard-flag block
|
|
4
|
+
* injected as {@link HostFlags} so each binary shows its own globals above
|
|
5
|
+
* the same generated prompt groups. The Commander installer (and its
|
|
6
|
+
* install-only-when-grouped guard) lives in the adapter seam
|
|
7
|
+
* (`projection/commander/configureGroupedHelp.ts`); this module never
|
|
8
|
+
* touches Commander, not even as types.
|
|
9
|
+
*/
|
|
10
|
+
import type { HostFlags, OptionInfo, PromptLike } from "./types.js";
|
|
11
|
+
/** Collect a command's prompt options by group, in declared order. */
|
|
12
|
+
export declare function buildOptionGroups(prompts: readonly PromptLike[]): Map<string, OptionInfo[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Render the grouped help text for a command: usage, description, the host's
|
|
15
|
+
* standard-flag block, then each prompt group.
|
|
16
|
+
*
|
|
17
|
+
* @param usage - The command's usage string (the adapter supplies
|
|
18
|
+
* Commander's).
|
|
19
|
+
* @param description - The command's description; `""` skips the block.
|
|
20
|
+
* @param groups - The prompt options by group (see {@link buildOptionGroups}).
|
|
21
|
+
* @param hostFlags - The host's standard-flag rows for the global block.
|
|
22
|
+
* @returns The complete help text.
|
|
23
|
+
*/
|
|
24
|
+
export declare function renderGroupedHelp(usage: string, description: string, groups: ReadonlyMap<string, readonly OptionInfo[]>, hostFlags: HostFlags): string;
|
|
25
|
+
//# sourceMappingURL=groupedHelp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groupedHelp.d.ts","sourceRoot":"","sources":["../../../src/projection/groupedHelp.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQpE,sEAAsE;AACtE,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,UAAU,EAAE,GAC7B,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAW3B;AAmBD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC,EAClD,SAAS,EAAE,SAAS,GACnB,MAAM,CA4BR"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@canonical/summon-core/projection` — the UI-free command-surface DATA seam.
|
|
3
|
+
*
|
|
4
|
+
* Everything a CLI derives from `GeneratorDefinition.prompts` lives here:
|
|
5
|
+
* flag shapes, answer extraction, defaults/completeness arithmetic, the
|
|
6
|
+
* usage-error structures and their parity rendering, and grouped help. Both
|
|
7
|
+
* binaries consume it — the summon bin at its root, pragma mounted under
|
|
8
|
+
* `create` — so the two surfaces cannot drift. The Commander ADAPTER — the
|
|
9
|
+
* registration path, the outcome sink, `emitToProcess` — lives beside it at
|
|
10
|
+
* `@canonical/summon-core/projection/commander`.
|
|
11
|
+
*
|
|
12
|
+
* IMPORT DISCIPLINE (pinned by `lazyGraph.test.ts`): this subpath is pure and
|
|
13
|
+
* parser-agnostic — its runtime graph reaches ZERO bare dependencies (Node
|
|
14
|
+
* built-ins only), never commander (not even as types), never react/ink/ejs/
|
|
15
|
+
* chalk/@canonical/task, and never the summon-core main barrel — so a host
|
|
16
|
+
* may import it statically on its `--help`/`__complete` fast path.
|
|
17
|
+
*/
|
|
18
|
+
export { applyDefaults, explicitAnswersComplete, hasAllRequiredAnswers, pendingPrompts, } from "./answers.js";
|
|
19
|
+
export { default as buildOptionInfo } from "./buildOptionInfo.js";
|
|
20
|
+
export type { InteractionDecision, InteractionInput, InteractionMode, } from "./decideInteraction.js";
|
|
21
|
+
export { decideInteraction, missingExplicitFlags, refusalMessage, } from "./decideInteraction.js";
|
|
22
|
+
export { default as extractAnswers } from "./extractAnswers.js";
|
|
23
|
+
export { buildOptionGroups, renderGroupedHelp } from "./groupedHelp.js";
|
|
24
|
+
export { default as toKebabCase } from "./kebab.js";
|
|
25
|
+
export { default as projectGenerator } from "./projectGenerator.js";
|
|
26
|
+
export type { CommandEntry, HostFlags, OptionInfo, ProjectedPrompt, PromptLike, SurfaceCommand, SurfaceGenerator, } from "./types.js";
|
|
27
|
+
export type { UsageError, UsageKind } from "./usage.js";
|
|
28
|
+
export { excessPositionalError, renderUsageError, unknownSegmentError, } from "./usage.js";
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/projection/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,eAAe,EACf,UAAU,EACV,cAAc,EACd,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE kebab-case derivation for prompt names — the one function every flag
|
|
3
|
+
* name, refusal list, and validation message derives `--component-path` from
|
|
4
|
+
* `componentPath` with. It used to exist as three private copies (the summon
|
|
5
|
+
* bin's registration, `execute/validateAnswers`, `prompt/autoPrompt`); a
|
|
6
|
+
* message and a flag that disagree about the same prompt's spelling is the
|
|
7
|
+
* defect a single authoring point removes.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Convert a camelCase prompt name to its kebab-case CLI flag form.
|
|
11
|
+
*
|
|
12
|
+
* @param name - The prompt name (`withTests`, `componentPath`).
|
|
13
|
+
* @returns The kebab-case form (`with-tests`, `component-path`).
|
|
14
|
+
*/
|
|
15
|
+
export default function toKebabCase(name: string): string;
|
|
16
|
+
//# sourceMappingURL=kebab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kebab.d.ts","sourceRoot":"","sources":["../../../src/projection/kebab.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project a live {@link GeneratorDefinition} onto its serializable command
|
|
3
|
+
* surface — the one image both the summon bin (at run time) and a host's
|
|
4
|
+
* codegen (at build time) derive the SAME grammar from.
|
|
5
|
+
*
|
|
6
|
+
* What survives the projection is exactly what the CLI surface reads: name,
|
|
7
|
+
* type, message, default, choices, positional, group. A `when` condition
|
|
8
|
+
* collapses to `conditional: true` (only a live wizard evaluates the
|
|
9
|
+
* predicate); `validate` is dropped entirely (enforced at execute time by
|
|
10
|
+
* `validateAnswers`, identically for every front-end).
|
|
11
|
+
*/
|
|
12
|
+
import type GeneratorDefinition from "../types/GeneratorDefinition.js";
|
|
13
|
+
import type { SurfaceCommand } from "./types.js";
|
|
14
|
+
/**
|
|
15
|
+
* Project a generator onto its serializable {@link SurfaceCommand}.
|
|
16
|
+
*
|
|
17
|
+
* @param path - The command path the generator is mounted at.
|
|
18
|
+
* @param generator - The live generator definition.
|
|
19
|
+
* @returns The serializable command surface.
|
|
20
|
+
*/
|
|
21
|
+
export default function projectGenerator(path: readonly string[], generator: GeneratorDefinition): SurfaceCommand;
|
|
22
|
+
//# sourceMappingURL=projectGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectGenerator.d.ts","sourceRoot":"","sources":["../../../src/projection/projectGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,mBAAmB,MAAM,iCAAiC,CAAC;AAEvE,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,YAAY,CAAC;AAuBlE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,SAAS,EAAE,mBAAmB,GAC7B,cAAc,CAMhB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command-surface projection's vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* A generator's CLI surface — its command path, its flags, its positional, its
|
|
5
|
+
* grouped help — DERIVES from `GeneratorDefinition.prompts`. This module names
|
|
6
|
+
* the shapes of that derivation: a {@link ProjectedPrompt} is the serializable
|
|
7
|
+
* image of a prompt (functions dropped), a {@link SurfaceCommand} is one
|
|
8
|
+
* command of the projected tree, and {@link CommandEntry}/{@link OptionInfo}
|
|
9
|
+
* are the registration shapes both binaries consume (moved here from the
|
|
10
|
+
* summon bin, which was their only owner).
|
|
11
|
+
*
|
|
12
|
+
* Everything here is data: no functions, so a {@link SurfaceCommand} can be
|
|
13
|
+
* emitted by a build step, committed, and compared against the live generators.
|
|
14
|
+
*/
|
|
15
|
+
import type GeneratorDefinition from "../types/GeneratorDefinition.js";
|
|
16
|
+
/**
|
|
17
|
+
* The serializable image of a {@link import("../types/PromptDefinition.js").default}:
|
|
18
|
+
* everything the CLI surface derives from, and nothing it cannot serialize.
|
|
19
|
+
* `validate` is dropped (enforced at execute time by `validateAnswers`);
|
|
20
|
+
* a `when` condition collapses to `conditional: true` (its predicate is
|
|
21
|
+
* evaluated only by a live wizard).
|
|
22
|
+
*/
|
|
23
|
+
export interface ProjectedPrompt {
|
|
24
|
+
/** Unique identifier, used as answer key and CLI flag name. */
|
|
25
|
+
readonly name: string;
|
|
26
|
+
/** Prompt kind, deciding flag shape and answer parsing. */
|
|
27
|
+
readonly type: "text" | "confirm" | "select" | "multiselect";
|
|
28
|
+
/** Question text displayed to the user (and used as flag help). */
|
|
29
|
+
readonly message: string;
|
|
30
|
+
/** Default value if the user provides no input. */
|
|
31
|
+
readonly default?: unknown;
|
|
32
|
+
/** Choices for select/multiselect prompts. */
|
|
33
|
+
readonly choices?: ReadonlyArray<{
|
|
34
|
+
readonly label: string;
|
|
35
|
+
readonly value: string;
|
|
36
|
+
}>;
|
|
37
|
+
/** True when the prompt can be provided as the command's one positional. */
|
|
38
|
+
readonly positional?: boolean;
|
|
39
|
+
/** Group name for organizing options in `--help` output. */
|
|
40
|
+
readonly group?: string;
|
|
41
|
+
/** True when the live prompt carries a `when` condition (wizard-evaluated). */
|
|
42
|
+
readonly conditional?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A prompt as the projection's helpers accept it: either a live
|
|
46
|
+
* `PromptDefinition` (whose `when`/`validate` are functions) or a
|
|
47
|
+
* {@link ProjectedPrompt} (where `when` collapsed to `conditional`). The
|
|
48
|
+
* helpers read only the projected fields plus the presence of `when`.
|
|
49
|
+
*/
|
|
50
|
+
export type PromptLike = ProjectedPrompt & {
|
|
51
|
+
readonly when?: unknown;
|
|
52
|
+
readonly validate?: unknown;
|
|
53
|
+
};
|
|
54
|
+
/** One command of the projected generator tree, fully serializable. */
|
|
55
|
+
export interface SurfaceCommand {
|
|
56
|
+
/** Path segments to this command (e.g. `["component", "react"]`). */
|
|
57
|
+
readonly path: readonly string[];
|
|
58
|
+
/** The generator's `meta.description`. */
|
|
59
|
+
readonly description: string;
|
|
60
|
+
/** The projected prompts, in declared (asking) order. */
|
|
61
|
+
readonly prompts: readonly ProjectedPrompt[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* What the registration path actually READS of a runnable entry: a
|
|
65
|
+
* description and the prompt list. A live {@link GeneratorDefinition}
|
|
66
|
+
* satisfies it directly. A build-time {@link SurfaceCommand} does NOT — it
|
|
67
|
+
* carries a top-level `description` where this needs `meta.description`,
|
|
68
|
+
* and its readonly `path` belongs to {@link CommandEntry} (which owns a
|
|
69
|
+
* mutable one) — so a host mounting the projected tree without loading a
|
|
70
|
+
* single generator wraps each surface command in a small adapter
|
|
71
|
+
* (`{ meta: { description: surface.description }, prompts: surface.prompts }`).
|
|
72
|
+
*/
|
|
73
|
+
export interface SurfaceGenerator {
|
|
74
|
+
readonly meta: {
|
|
75
|
+
readonly description: string;
|
|
76
|
+
};
|
|
77
|
+
readonly prompts: readonly PromptLike[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A flattened representation of a command to register.
|
|
81
|
+
* Separates command discovery from registration.
|
|
82
|
+
*
|
|
83
|
+
* Generic over the runnable payload: the summon bin carries live
|
|
84
|
+
* {@link GeneratorDefinition}s (the default), a build-time host carries
|
|
85
|
+
* projected {@link SurfaceGenerator}s.
|
|
86
|
+
*/
|
|
87
|
+
export interface CommandEntry<G extends SurfaceGenerator = GeneratorDefinition> {
|
|
88
|
+
/** Path segments to this command (e.g., ["component", "react"]) */
|
|
89
|
+
path: string[];
|
|
90
|
+
/** The generator definition if this is a runnable command */
|
|
91
|
+
generator?: G;
|
|
92
|
+
/** Description for namespace-only commands */
|
|
93
|
+
description?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Option metadata built from a prompt definition for Commander.
|
|
97
|
+
*/
|
|
98
|
+
export interface OptionInfo {
|
|
99
|
+
flags: string;
|
|
100
|
+
description: string;
|
|
101
|
+
defaultValue?: string;
|
|
102
|
+
group?: string;
|
|
103
|
+
/** The original camelCase prompt name */
|
|
104
|
+
promptName: string;
|
|
105
|
+
/** The kebab-case flag name (without --) */
|
|
106
|
+
kebabName: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A host's standard per-generator flag list, injected into grouped help: each
|
|
110
|
+
* entry is a `--help` row (`flags` column + description). The projection never
|
|
111
|
+
* hard-codes a host's flags — summon's nine and pragma's mutation trio are
|
|
112
|
+
* both just data handed in here.
|
|
113
|
+
*/
|
|
114
|
+
export type HostFlags = ReadonlyArray<{
|
|
115
|
+
readonly flags: string;
|
|
116
|
+
readonly description: string;
|
|
117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AAW,EAAE,MAAM,CAAC;IAC7B,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;CAC9C;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY,CAC3B,CAAC,SAAS,gBAAgB,GAAG,mBAAmB;IAEhD,mEAAmE;IACnE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,6DAA6D;IAC7D,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAAC,CAAC"}
|
|
@@ -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
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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
|
|
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;
|
|
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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AC;IACtD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,mBAAmB,EAC9B,OAAO,GAAE,gBAAqB,GAC7B,cAAc,CAoChB"}
|
|
@@ -63,7 +63,7 @@ export declare class SessionController {
|
|
|
63
63
|
* the run produces. Omitted falls back to the process cwd, matching a run
|
|
64
64
|
* whose interpreter was given no `cwd`.
|
|
65
65
|
*/
|
|
66
|
-
constructor(generator: GeneratorDefinition, onUserCancel?: (() => void) | undefined, cwd?: string | undefined);
|
|
66
|
+
constructor(generator: GeneratorDefinition, onUserCancel?: (() => void) | undefined, cwd?: string | undefined, initialAnswers?: Readonly<Record<string, unknown>>);
|
|
67
67
|
/** Subscribe to state changes; returns an unsubscribe function. */
|
|
68
68
|
subscribe: (listener: () => void) => (() => void);
|
|
69
69
|
/** The current immutable snapshot (stable identity between changes). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/prompt/ink/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,mBAAmB,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,WAAW,GACX,YAAY,GACZ,WAAW,GACX,UAAU,GACV,OAAO,GACP,WAAW,CAAC;AAEhB,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,WA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;;;;;;;;;;;;;;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"}
|
|
@@ -38,6 +38,13 @@ export interface InkPromptOptions {
|
|
|
38
38
|
* back to the process cwd, matching a run given no `cwd` of its own.
|
|
39
39
|
*/
|
|
40
40
|
readonly cwd?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Answers already provided outside the wizard (CLI flags / MCP args).
|
|
43
|
+
* Seeded into the session so the confirm gate's preview and step counter
|
|
44
|
+
* see the full answer set — without this a partially-flagged run previews
|
|
45
|
+
* with those answers missing (`undefined` paths, wrong plan).
|
|
46
|
+
*/
|
|
47
|
+
readonly initialAnswers?: Readonly<Record<string, unknown>>;
|
|
41
48
|
}
|
|
42
49
|
/**
|
|
43
50
|
* A running Ink session's seam surface: the prompt handler plus the effect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inkPrompt.d.ts","sourceRoot":"","sources":["../../../src/prompt/inkPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAA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,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"}
|
|
@@ -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
|
-
*
|
|
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;
|
|
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,
|
|
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
|
-
*
|
|
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,
|
|
1
|
+
{"version":3,"file":"runTaskWithStamp.d.ts","sourceRoot":"","sources":["../../../src/stamp/runTaskWithStamp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;GAKG;AACH,wBAA8B,gBAAgB,CAAC,CAAC,EAC9C,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACb,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,CAAC,CAAC,CAWZ"}
|
|
@@ -2,7 +2,11 @@ export { default as ejsEngine } from "./ejsEngine.js";
|
|
|
2
2
|
export { default as generateStamp } from "./generateStamp.js";
|
|
3
3
|
export { default as generatorComment } from "./generatorComment.js";
|
|
4
4
|
export { default as getCommentStyle } from "./getCommentStyle.js";
|
|
5
|
+
export type { LoadedTemplate } from "./loadTemplate.js";
|
|
6
|
+
export { loadTemplate, loadTemplateSync } from "./loadTemplate.js";
|
|
5
7
|
export { default as prependStamp } from "./prependStamp.js";
|
|
8
|
+
export type { RawFileOptions } from "./rawFile.js";
|
|
9
|
+
export { default as rawFile } from "./rawFile.js";
|
|
6
10
|
export { default as renderFile } from "./renderFile.js";
|
|
7
11
|
export { default as renderString } from "./renderString.js";
|
|
8
12
|
export { default as renderStringAsync } from "./renderStringAsync.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,YAAY,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
|
-
*
|
|
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
|
|
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"}
|