@canonical/summon-core 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/discovery/discoverGeneratorTree.js +14 -10
- package/dist/esm/discovery/discoverGeneratorTree.js.map +1 -1
- package/dist/esm/execute/collectAnswers.js +23 -17
- 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 +199 -53
- 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 +4 -2
- package/dist/esm/prompt/ink/mount.js.map +1 -1
- package/dist/esm/prompt/ink/session.js +78 -15
- package/dist/esm/prompt/ink/session.js.map +1 -1
- package/dist/esm/prompt/inkPrompt.js +13 -4
- 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/run/runGeneratorTask.js +3 -1
- package/dist/esm/run/runGeneratorTask.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/diffTrees.js +61 -0
- package/dist/esm/testing/conformance/diffTrees.js.map +1 -0
- package/dist/esm/testing/conformance/fixtures.js +81 -0
- package/dist/esm/testing/conformance/fixtures.js.map +1 -0
- 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 +18 -0
- package/dist/esm/testing/conformance/index.js.map +1 -0
- package/dist/esm/testing/conformance/produceReference.js +47 -0
- package/dist/esm/testing/conformance/produceReference.js.map +1 -0
- package/dist/esm/testing/conformance/snapshotTree.js +35 -0
- package/dist/esm/testing/conformance/snapshotTree.js.map +1 -0
- package/dist/esm/testing/index.js +10 -0
- package/dist/esm/testing/index.js.map +1 -0
- 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 +6 -4
- 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 +63 -9
- 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 +36 -1
- package/dist/types/prompt/ink/session.d.ts.map +1 -1
- package/dist/types/prompt/inkPrompt.d.ts +17 -3
- package/dist/types/prompt/inkPrompt.d.ts.map +1 -1
- package/dist/types/run/runGeneratorTask.d.ts +3 -1
- package/dist/types/run/runGeneratorTask.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/diffTrees.d.ts +38 -0
- package/dist/types/testing/conformance/diffTrees.d.ts.map +1 -0
- package/dist/types/testing/conformance/fixtures.d.ts +39 -0
- package/dist/types/testing/conformance/fixtures.d.ts.map +1 -0
- 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 +22 -0
- package/dist/types/testing/conformance/index.d.ts.map +1 -0
- package/dist/types/testing/conformance/produceReference.d.ts +35 -0
- package/dist/types/testing/conformance/produceReference.d.ts.map +1 -0
- package/dist/types/testing/conformance/snapshotTree.d.ts +21 -0
- package/dist/types/testing/conformance/snapshotTree.d.ts.map +1 -0
- package/dist/types/testing/index.d.ts +11 -0
- package/dist/types/testing/index.d.ts.map +1 -0
- 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 +27 -9
- package/spec/generator-definition.v1.schema.json +122 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../../src/testing/conformance/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,mFAAmF;AACnF,MAAM,iBAAiB,GAAG;IACxB,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,KAAK;CACX,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkC;IACjE;QACE,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,iBAAiB;QAC5B,OAAO,EAAE,EAAE,aAAa,EAAE,uBAAuB,EAAE,GAAG,iBAAiB,EAAE;KAC1E;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,SAAS,EAAE,kBAAkB;QAC7B,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,EAAE;KACnE;IACD;QACE,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,eAAe;QAC1B,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,EAAE;KACnE;IACD;QACE,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE;YACP,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,YAAY;YACzB,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,KAAK;YACpB,OAAO,EAAE,KAAK;YACd,cAAc,EAAE,KAAK;YACrB,UAAU,EAAE,KAAK;SAClB;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,aAAa;QACxB,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,KAAK;YACZ,UAAU,EAAE,KAAK;SAClB;KACF;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACxE,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;IACtE,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn a conformance fixture's ANSWER SET into the CLI argument vector that
|
|
3
|
+
* expresses it — the projection's flag grammar, driven backwards. The
|
|
4
|
+
* cross-CLI matrix derives each producer's argv from the SAME answers with
|
|
5
|
+
* this one function, so the two binaries are always handed identical inputs
|
|
6
|
+
* (modulo the mount prefix) and an argv hand-drift cannot fake parity.
|
|
7
|
+
*
|
|
8
|
+
* Rules (the inverse of `extractAnswers` + `buildOptionInfo`):
|
|
9
|
+
* - an answer equal to its prompt's default is OMITTED (it could never be
|
|
10
|
+
* expressed explicitly for a confirm anyway — the equality trick);
|
|
11
|
+
* - a confirm answers with `buildOptionInfo`'s PRIMARY registered long
|
|
12
|
+
* form — `--<kebab>` for `true` (registered exactly when the default is
|
|
13
|
+
* not `true`; a default-`true` confirm answered `true` was omitted
|
|
14
|
+
* above), `--no-<kebab>` for `false` (registered ONLY for a default-
|
|
15
|
+
* `true` confirm). PRECONDITION: a confirm answered `false` must
|
|
16
|
+
* declare `default: true` — a default-less (or default-`false`,
|
|
17
|
+
* non-omitted) confirm has NO registered spelling for `false`, and this
|
|
18
|
+
* helper THROWS naming the prompt rather than hand the matrix an argv
|
|
19
|
+
* both binaries reject as an unknown option;
|
|
20
|
+
* - the positional prompt's answer is emitted positionally, first;
|
|
21
|
+
* - text/select answers become `--<kebab>=<value>`;
|
|
22
|
+
* - a multiselect becomes `--<kebab>=<comma,list>`.
|
|
23
|
+
*/
|
|
24
|
+
import buildOptionInfo from "../../projection/buildOptionInfo.js";
|
|
25
|
+
import toKebabCase from "../../projection/kebab.js";
|
|
26
|
+
/** Whether an answer equals the prompt's declared default. */
|
|
27
|
+
function sameAsDefault(value, defaultValue) {
|
|
28
|
+
if (Object.is(value, defaultValue))
|
|
29
|
+
return true;
|
|
30
|
+
if (Array.isArray(value) && Array.isArray(defaultValue)) {
|
|
31
|
+
return (value.length === defaultValue.length &&
|
|
32
|
+
value.every((item, index) => Object.is(item, defaultValue[index])));
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Express an answer set as CLI arguments (positional first, flags in prompt
|
|
38
|
+
* order).
|
|
39
|
+
*
|
|
40
|
+
* @param prompts - The command's prompts (live or projected).
|
|
41
|
+
* @param answers - The answers to express.
|
|
42
|
+
* @returns The argument vector.
|
|
43
|
+
* @throws If a confirm answered `false` declares no `default: true` — no
|
|
44
|
+
* registered spelling exists for that answer (the module header's
|
|
45
|
+
* PRECONDITION), so the matrix must fail loudly rather than hand both
|
|
46
|
+
* binaries an argv they reject as an unknown option.
|
|
47
|
+
*/
|
|
48
|
+
export function flagizeAnswers(prompts, answers) {
|
|
49
|
+
const positionals = [];
|
|
50
|
+
const flags = [];
|
|
51
|
+
for (const prompt of prompts) {
|
|
52
|
+
if (!Object.hasOwn(answers, prompt.name))
|
|
53
|
+
continue;
|
|
54
|
+
const value = answers[prompt.name];
|
|
55
|
+
if (sameAsDefault(value, prompt.default))
|
|
56
|
+
continue;
|
|
57
|
+
const kebab = toKebabCase(prompt.name);
|
|
58
|
+
if (prompt.type === "confirm") {
|
|
59
|
+
// The registered form, from the single flag-shape authority — never a
|
|
60
|
+
// kebab-cased guess (the round-14 F3 class: a spelling no host
|
|
61
|
+
// registers hands the matrix an argv both binaries reject).
|
|
62
|
+
const primary = buildOptionInfo(prompt).flags.split(" ")[0];
|
|
63
|
+
if (value === true) {
|
|
64
|
+
// `true` differs from the default here, so the default is not
|
|
65
|
+
// `true` and the registered form IS the positive `--<kebab>`.
|
|
66
|
+
flags.push(primary);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (primary.startsWith("--no-")) {
|
|
70
|
+
flags.push(primary);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
// `false` on a confirm whose registered form is the positive flag
|
|
74
|
+
// (no declared `default: true`): no spelling exists — fail loudly.
|
|
75
|
+
throw new Error(`flagizeAnswers: confirm "${prompt.name}" answered false has no ` +
|
|
76
|
+
`registered spelling (buildOptionInfo registers only "${primary}"` +
|
|
77
|
+
") — declare `default: true` on the prompt or drop the answer");
|
|
78
|
+
}
|
|
79
|
+
if (prompt.positional === true) {
|
|
80
|
+
positionals.push(String(value));
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (prompt.type === "multiselect" && Array.isArray(value)) {
|
|
84
|
+
flags.push(`--${kebab}=${value.join(",")}`);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
flags.push(`--${kebab}=${String(value)}`);
|
|
88
|
+
}
|
|
89
|
+
return [...positionals, ...flags];
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=flagizeAnswers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagizeAnswers.js","sourceRoot":"","sources":["../../../../src/testing/conformance/flagizeAnswers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,WAAW,MAAM,2BAA2B,CAAC;AAGpD,8DAA8D;AAC9D,SAAS,aAAa,CAAC,KAAc,EAAE,YAAqB;IAC1D,IAAI,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC;QAAE,OAAO,IAAI,CAAC;IAChD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAA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AK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACpB,SAAS;YACX,CAAC;YACD,kEAAkE;YAClE,mEAAmE;YACnE,MAAM,IAAI,KAAK,CACb,4BAA4B,MAAM,CAAC,IAAI,0BAA0B;gBAC/D,wDAAwD,OAAO,GAAG;gBAClE,8DAA8D,CACjE,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC/B,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAChC,SAAS;QACX,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1D,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC5C,SAAS;QACX,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,CAAC,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The byte-equality conformance suite: the seam's definition, plus the tools to
|
|
3
|
+
* assert against it.
|
|
4
|
+
*
|
|
5
|
+
* Both binaries generate the same trees from the same generators. That was a
|
|
6
|
+
* guarantee asserted inside ONE bin's test file, which meant the other bin
|
|
7
|
+
* could drift with nothing to catch it. Here it is a named suite that either
|
|
8
|
+
* bin runs: {@link produceReference} IS the definition (summon-core `execute` +
|
|
9
|
+
* `autoPrompt` + `runGeneratorTask` + the shared stamp), {@link snapshotTree}
|
|
10
|
+
* and {@link diffTrees} make "the same tree" a value comparison with a legible
|
|
11
|
+
* failure, and {@link CONFORMANCE_FIXTURES} keeps the answer sets in one place.
|
|
12
|
+
*/
|
|
13
|
+
export { diffTrees, formatTreeDiff, isIdentical } from "./diffTrees.js";
|
|
14
|
+
export { CONFORMANCE_FIXTURES, fixture } from "./fixtures.js";
|
|
15
|
+
export { flagizeAnswers } from "./flagizeAnswers.js";
|
|
16
|
+
export { produceReference } from "./produceReference.js";
|
|
17
|
+
export { snapshotTree } from "./snapshotTree.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/testing/conformance/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE definition of the seam a conforming binary must match.
|
|
3
|
+
*
|
|
4
|
+
* A binary conforms iff, for a given generator and answer set, the tree it
|
|
5
|
+
* writes byte-equals the tree produced HERE: summon-core's `execute` with
|
|
6
|
+
* `autoPrompt`, run through `runGeneratorTask` with the shared stamp
|
|
7
|
+
* (`createStampOnEffectStart(createGeneratorStamp(generator))`). Every other
|
|
8
|
+
* path — the summon bin's Ink front-end, the pragma kernel's `create` verbs —
|
|
9
|
+
* is a UI over exactly this, so the reference is not "one more implementation
|
|
10
|
+
* to keep in sync"; it is the implementation, called without a front-end.
|
|
11
|
+
*
|
|
12
|
+
* Writing that definition down once is the point. Before this module, the
|
|
13
|
+
* guarantee lived only inside one bin's test file, so the OTHER bin could drift
|
|
14
|
+
* and nothing would notice.
|
|
15
|
+
*/
|
|
16
|
+
import { mkdtempSync } from "node:fs";
|
|
17
|
+
import { tmpdir } from "node:os";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
import execute from "../../execute/execute.js";
|
|
20
|
+
import autoPrompt from "../../prompt/autoPrompt.js";
|
|
21
|
+
import runGeneratorTask from "../../run/runGeneratorTask.js";
|
|
22
|
+
import createGeneratorStamp from "../../stamp/createGeneratorStamp.js";
|
|
23
|
+
import createStampOnEffectStart from "../../stamp/createStampOnEffectStart.js";
|
|
24
|
+
import { snapshotTree } from "./snapshotTree.js";
|
|
25
|
+
/** Create the throwaway directory a reference run writes into by default. */
|
|
26
|
+
function freshCwd() {
|
|
27
|
+
return mkdtempSync(join(tmpdir(), "summon-conformance-"));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Produce the reference tree for one generator + answer set.
|
|
31
|
+
*
|
|
32
|
+
* @param run - The generator, its answers, and an optional target directory.
|
|
33
|
+
* @returns The generated tree, snapshotted.
|
|
34
|
+
* @note Impure — writes files and reads them back.
|
|
35
|
+
*/
|
|
36
|
+
export async function produceReference(run) {
|
|
37
|
+
const cwd = run.cwd ?? freshCwd();
|
|
38
|
+
const answers = { ...run.answers };
|
|
39
|
+
await runGeneratorTask(execute(run.generator, { prompt: autoPrompt(answers), params: answers }), {
|
|
40
|
+
cwd,
|
|
41
|
+
promptHandler: autoPrompt(answers),
|
|
42
|
+
onEffectStart: createStampOnEffectStart(createGeneratorStamp(run.generator)),
|
|
43
|
+
onLog: () => { },
|
|
44
|
+
});
|
|
45
|
+
return snapshotTree(cwd);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=produceReference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"produceReference.js","sourceRoot":"","sources":["../../../../src/testing/conformance/produceReference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAC7D,OAAO,oBAAoB,MAAM,qCAAqC,CAAC;AACvE,OAAO,wBAAwB,MAAM,yCAAyC,CAAC;AAE/E,OAAO,EAAE,YAAY,EAAqB,MAAM,mBAAmB,CAAC;AAapE,6EAA6E;AAC7E,SAAS,QAAQ;IACf,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,GAAiB;IAEjB,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,QAAQ,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACnC,MAAM,gBAAgB,CACpB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EACxE;QACE,GAAG;QACH,aAAa,EAAE,UAAU,CAAC,OAAO,CAAC;QAClC,aAAa,EAAE,wBAAwB,CACrC,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,CACpC;QACD,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;KAChB,CACF,CAAC;IACF,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a generated directory tree into a comparable value.
|
|
3
|
+
*
|
|
4
|
+
* The conformance suite's unit of comparison. A tree is a sorted map of
|
|
5
|
+
* POSIX-style relative path → file contents, which makes "the same tree" an
|
|
6
|
+
* ordinary value equality rather than a filesystem walk each caller reinvents.
|
|
7
|
+
* Directory entries are not recorded: an empty directory a generator creates and
|
|
8
|
+
* never fills is not part of what a consumer sees, and recording it would make
|
|
9
|
+
* two conforming bins differ over a `mkdir` neither materialized.
|
|
10
|
+
*/
|
|
11
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
/**
|
|
14
|
+
* Snapshot a directory tree.
|
|
15
|
+
*
|
|
16
|
+
* @param dir - The root to walk. Every file below it is read as UTF-8.
|
|
17
|
+
* @returns The tree as a sorted path → contents map.
|
|
18
|
+
* @note Impure — reads the filesystem.
|
|
19
|
+
*/
|
|
20
|
+
export function snapshotTree(dir) {
|
|
21
|
+
const out = new Map();
|
|
22
|
+
const walk = (current, base) => {
|
|
23
|
+
const entries = readdirSync(current, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
const rel = base ? `${base}/${entry.name}` : entry.name;
|
|
26
|
+
if (entry.isDirectory())
|
|
27
|
+
walk(join(current, entry.name), rel);
|
|
28
|
+
else
|
|
29
|
+
out.set(rel, readFileSync(join(current, entry.name), "utf-8"));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
walk(dir, "");
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=snapshotTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshotTree.js","sourceRoot":"","sources":["../../../../src/testing/conformance/snapshotTree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAKjC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,MAAM,IAAI,GAAG,CAAC,OAAe,EAAE,IAAY,EAAQ,EAAE;QACnD,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC1E,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAC7B,CAAC;QACF,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;YACxD,IAAI,KAAK,CAAC,WAAW,EAAE;gBAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;;gBACzD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACtE,CAAC;IACH,CAAC,CAAC;IACF,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACd,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@canonical/summon-core/testing` — test-only helpers a CONSUMER runs.
|
|
3
|
+
*
|
|
4
|
+
* A separate subpath, not part of the main barrel, for two reasons: nothing on
|
|
5
|
+
* a production path should be able to import a temp-directory writer by
|
|
6
|
+
* accident, and the main barrel is the runtime contract while this is a testing
|
|
7
|
+
* contract that may move faster.
|
|
8
|
+
*/
|
|
9
|
+
export { CONFORMANCE_FIXTURES, diffTrees, fixture, flagizeAnswers, formatTreeDiff, isIdentical, produceReference, snapshotTree, } from "./conformance/index.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,YAAY,GACb,MAAM,wBAAwB,CAAC"}
|
|
@@ -11,7 +11,7 @@ import type { GeneratorNode } from "./types.js";
|
|
|
11
11
|
interface DiscoverOptions {
|
|
12
12
|
/** When set, ONLY load from this path (for testing). */
|
|
13
13
|
explicitPath?: string;
|
|
14
|
-
/** Directory containing built-in generators.
|
|
14
|
+
/** Directory containing built-in generators. When omitted, no built-ins are scanned. */
|
|
15
15
|
builtinDir?: string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -19,8 +19,8 @@ interface DiscoverOptions {
|
|
|
19
19
|
*
|
|
20
20
|
* When `explicitPath` is provided, ONLY load from that path (for testing).
|
|
21
21
|
*
|
|
22
|
-
* Otherwise, priority (
|
|
23
|
-
* 1. Built-in generators
|
|
22
|
+
* Otherwise, priority (lowest to highest, later overrides earlier):
|
|
23
|
+
* 1. Built-in generators — only when the caller supplies `builtinDir`
|
|
24
24
|
* 2. Global packages (bun link / npm link locations)
|
|
25
25
|
* 3. Project ./node_modules/summon-* packages (highest priority)
|
|
26
26
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discoverGeneratorTree.d.ts","sourceRoot":"","sources":["../../../src/discovery/discoverGeneratorTree.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,KAAK,EAAE,aAAa,EAAmB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"discoverGeneratorTree.d.ts","sourceRoot":"","sources":["../../../src/discovery/discoverGeneratorTree.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,KAAK,EAAE,aAAa,EAAmB,MAAM,YAAY,CAAC;AAuYjE,UAAU,eAAe;IACvB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wFAAwF;IACxF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAA8B,qBAAqB,CACjD,qBAAqB,CAAC,EAAE,MAAM,GAAG,eAAe,GAC/C,OAAO,CAAC,aAAa,CAAC,CAyDxB"}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* remaining definition maps onto the task alphabet's `PromptQuestion`.
|
|
11
11
|
*
|
|
12
12
|
* Moved into summon-core (from the v1 cli-core `promptForAnswers`) as the
|
|
13
|
-
* answer-collection phase of {@link execute}.
|
|
13
|
+
* answer-collection phase of {@link execute}. The cli-core export that kept the
|
|
14
|
+
* old name alive is gone with that package.
|
|
14
15
|
*/
|
|
15
16
|
import { type Task } from "@canonical/task";
|
|
16
17
|
/**
|
|
@@ -40,9 +41,10 @@ export interface AnswerablePrompt {
|
|
|
40
41
|
* Build a Task that collects answers for the given prompt definitions by
|
|
41
42
|
* asking each unanswered, applicable one as a `Prompt` effect.
|
|
42
43
|
*
|
|
43
|
-
* The returned task is
|
|
44
|
-
*
|
|
45
|
-
* asked; `when` predicates observe flags and earlier
|
|
44
|
+
* The returned task is re-interpretable — every walk evaluates the chain's
|
|
45
|
+
* continuations fresh. Prompts whose `name` is already present in
|
|
46
|
+
* `partialAnswers` are not asked; `when` predicates observe flags and earlier
|
|
47
|
+
* answers alike.
|
|
46
48
|
*
|
|
47
49
|
* @param prompts - The prompt definitions, in asking order.
|
|
48
50
|
* @param partialAnswers - Answers already provided (e.g. CLI flags / MCP args).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectAnswers.d.ts","sourceRoot":"","sources":["../../../src/execute/collectAnswers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"collectAnswers.d.ts","sourceRoot":"","sources":["../../../src/execute/collectAnswers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;IAC7D,qDAAqD;IACrD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;QAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACxB,CAAC,CAAC;IACH,yEAAyE;IACzE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;IAC9D,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,CAAC;CACzD;AAuDD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,cAAc,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GACrD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAyB/B"}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* the single signal that answer collection is complete — which a streaming
|
|
23
23
|
* per-question handler otherwise cannot know.
|
|
24
24
|
*/
|
|
25
|
-
import { type Task } from "@canonical/task";
|
|
25
|
+
import { type Task, TaskExecutionError } from "@canonical/task";
|
|
26
26
|
import type { PromptHandler } from "../prompt/types.js";
|
|
27
27
|
import type GeneratorDefinition from "../types/GeneratorDefinition.js";
|
|
28
28
|
import type { GeneratorResult } from "./GeneratorResult.js";
|
|
@@ -32,6 +32,32 @@ export declare const CONFIRM_ANSWER_KEY = "__summon_proceed__";
|
|
|
32
32
|
export declare const GENERATOR_INVALID_ANSWER = "GENERATOR_INVALID_ANSWER";
|
|
33
33
|
/** Task-error code for a run cancelled at the interactive confirm gate. */
|
|
34
34
|
export declare const GENERATOR_CANCELLED = "GENERATOR_CANCELLED";
|
|
35
|
+
/**
|
|
36
|
+
* Build the typed error a generator's `generate` throws for a CROSS-answer
|
|
37
|
+
* constraint no single prompt's `validate` can see — two answers only valid
|
|
38
|
+
* together. No shipped generator declares one today (application/react's
|
|
39
|
+
* former ssr+router guard is gone with its prompts); the `guarded` fixture
|
|
40
|
+
* in cli/summon's interaction tests shows the shape. It carries the same
|
|
41
|
+
* {@link GENERATOR_INVALID_ANSWER} code the validation failure inside
|
|
42
|
+
* {@link execute} raises, so a host routes it down its existing invalid-input
|
|
43
|
+
* pathway — pragma maps the code to `INVALID_INPUT` (exit 2), the summon bin
|
|
44
|
+
* prints the bare message (exit 2 in a batch mode, the App's error phase in a
|
|
45
|
+
* wizard) — instead of collapsing it into an internal error with a stack.
|
|
46
|
+
*
|
|
47
|
+
* @param message - The human-readable constraint, naming REGISTERED flag
|
|
48
|
+
* spellings (what a user can actually type).
|
|
49
|
+
* @returns The typed error for `generate` to `throw`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function invalidAnswersError(message: string): TaskExecutionError;
|
|
52
|
+
/**
|
|
53
|
+
* True when a thrown value is a generator-raised invalid answer — matched by
|
|
54
|
+
* the {@link GENERATOR_INVALID_ANSWER} code, never by class identity, so the
|
|
55
|
+
* check survives a duplicate module instance across build outputs.
|
|
56
|
+
*
|
|
57
|
+
* @param error - The caught value.
|
|
58
|
+
* @returns Whether the value is an {@link invalidAnswersError} throw.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isInvalidAnswersError(error: unknown): error is Error;
|
|
35
61
|
/** The context {@link execute} builds its task from. */
|
|
36
62
|
export interface ExecuteContext {
|
|
37
63
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/execute/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/execute/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAML,KAAK,IAAI,EACT,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,mBAAmB,MAAM,iCAAiC,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,6EAA6E;AAC7E,eAAO,MAAM,wBAAwB,6BAA6B,CAAC;AAEnE,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAEvE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAKpE;AAED,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,iEAAiE;IACjE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,SAAS,EAAE,mBAAmB,EAC9B,GAAG,EAAE,cAAc,GAClB,IAAI,CAAC,eAAe,CAAC,CAsDvB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { AnswerablePrompt } from "./collectAnswers.js";
|
|
2
2
|
export { default as collectAnswers } from "./collectAnswers.js";
|
|
3
|
-
export { CONFIRM_ANSWER_KEY, default as execute, type ExecuteContext, GENERATOR_CANCELLED, GENERATOR_INVALID_ANSWER, } from "./execute.js";
|
|
3
|
+
export { CONFIRM_ANSWER_KEY, default as execute, type ExecuteContext, GENERATOR_CANCELLED, GENERATOR_INVALID_ANSWER, invalidAnswersError, isInvalidAnswersError, } from "./execute.js";
|
|
4
4
|
export type { GeneratorResult } from "./GeneratorResult.js";
|
|
5
5
|
export { default as validateAnswers } from "./validateAnswers.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/execute/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,OAAO,IAAI,OAAO,EAClB,KAAK,cAAc,EACnB,mBAAmB,EACnB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/execute/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,OAAO,IAAI,OAAO,EAClB,KAAK,cAAc,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateAnswers.d.ts","sourceRoot":"","sources":["../../../src/execute/validateAnswers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"validateAnswers.d.ts","sourceRoot":"","sources":["../../../src/execute/validateAnswers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,gBAAgB,MAAM,8BAA8B,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,MAAM,GAAG,IAAI,CA+Cf"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Moved into summon-core (from the v1 cli-core `formatEffects`) so both the
|
|
5
5
|
* summon bin and the pragma kernel share one effect-formatting surface without
|
|
6
6
|
* either importing the other. The pragma `create` render layer reuses these
|
|
7
|
-
* helpers to project a {@link GeneratorResult}
|
|
8
|
-
*
|
|
7
|
+
* helpers to project a {@link GeneratorResult}. Both bins now import them from
|
|
8
|
+
* HERE — the cli-core re-export shim went with that package.
|
|
9
9
|
*/
|
|
10
10
|
import type { Effect } from "@canonical/task";
|
|
11
11
|
import type GeneratorDefinition from "../types/GeneratorDefinition.js";
|
|
@@ -16,6 +16,55 @@ import type PromptDefinition from "../types/PromptDefinition.js";
|
|
|
16
16
|
* @param verbose - If true, include debug logs
|
|
17
17
|
*/
|
|
18
18
|
export declare const isVisibleEffect: (effect: Effect, verbose?: boolean) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The rows a plan shows: the user-relevant effects, each directory named once.
|
|
21
|
+
*
|
|
22
|
+
* The visibility filter and the `MakeDir` de-duplication are ONE rule with
|
|
23
|
+
* several readers — the summon bin's dry-run, the `--llm` / `--format json`
|
|
24
|
+
* projections below, and the pragma kernel's CLI and MCP previews — and each
|
|
25
|
+
* reader used to carry its own copy of the two steps. A generator that ensures
|
|
26
|
+
* its output directory before every file plans that directory once per file,
|
|
27
|
+
* so the de-duplication is what makes a plan a list of artifacts rather than a
|
|
28
|
+
* list of mkdir calls.
|
|
29
|
+
*
|
|
30
|
+
* @param effects - The effects a run would apply, in order.
|
|
31
|
+
* @param verbose - If true, debug logs stay in the plan.
|
|
32
|
+
* @returns The visible effects, first occurrence of each directory kept.
|
|
33
|
+
*/
|
|
34
|
+
export declare const visiblePlanEffects: (effects: readonly Effect[], verbose?: boolean) => Effect[];
|
|
35
|
+
/**
|
|
36
|
+
* The colour decision a row is rendered under, carried as DATA.
|
|
37
|
+
*
|
|
38
|
+
* {@link formatEffectLine} used to call `chalk` directly, which meant whether a
|
|
39
|
+
* row carried ANSI was decided by chalk's environment detection at the moment
|
|
40
|
+
* of the call. Two of its callers cannot live with that: pragma's CLI preview
|
|
41
|
+
* gates colour on `process.stdout.isTTY` AND chalk's level (so a piped run
|
|
42
|
+
* under `FORCE_COLOR` — which nx exports to every test task — must stay plain
|
|
43
|
+
* while chalk alone would colour it), and the MCP plan payload is structured
|
|
44
|
+
* data read by a model, which must be plain whatever the editor that spawned
|
|
45
|
+
* the server put in the environment.
|
|
46
|
+
*
|
|
47
|
+
* So the decision arrives as an argument. Stripping escapes afterwards would
|
|
48
|
+
* work too and would be wrong: it puts the rule in a second place.
|
|
49
|
+
*/
|
|
50
|
+
export interface EffectStyle {
|
|
51
|
+
/** Whether this style emits ANSI at all. */
|
|
52
|
+
readonly enabled: boolean;
|
|
53
|
+
/** De-emphasize a connector or indent. */
|
|
54
|
+
dim(text: string): string;
|
|
55
|
+
/** Tint an action label, or pass it through when the effect has no colour. */
|
|
56
|
+
paint(color: EffectColor | undefined, text: string): string;
|
|
57
|
+
}
|
|
58
|
+
/** The colours {@link getActionColor} may ask for. */
|
|
59
|
+
export type EffectColor = "green" | "red" | "yellow" | "cyan" | "blue" | "magenta";
|
|
60
|
+
/**
|
|
61
|
+
* Build an {@link EffectStyle} for a known colour decision.
|
|
62
|
+
*
|
|
63
|
+
* @param enabled - True to colour through chalk; false for the identity
|
|
64
|
+
* styler, which emits no escape under any environment.
|
|
65
|
+
* @returns A style whose functions colour, or pass through, accordingly.
|
|
66
|
+
*/
|
|
67
|
+
export declare const effectStyleFor: (enabled: boolean) => EffectStyle;
|
|
19
68
|
/**
|
|
20
69
|
* Get human-readable action label for an effect.
|
|
21
70
|
*/
|
|
@@ -23,15 +72,23 @@ export declare const getActionLabel: (effect: Effect) => string;
|
|
|
23
72
|
/**
|
|
24
73
|
* Get color for action label based on effect type.
|
|
25
74
|
*/
|
|
26
|
-
export declare const getActionColor: (effect: Effect) =>
|
|
75
|
+
export declare const getActionColor: (effect: Effect) => EffectColor | undefined;
|
|
27
76
|
/**
|
|
28
77
|
* Get the payload (description) for an effect.
|
|
29
78
|
*/
|
|
30
79
|
export declare const getEffectPayload: (effect: Effect) => string;
|
|
31
80
|
/**
|
|
32
81
|
* Format a single effect as a CLI line (for non-interactive output).
|
|
82
|
+
*
|
|
83
|
+
* @param effect - The effect to name.
|
|
84
|
+
* @param isLast - True for the final row, which closes the tree connector.
|
|
85
|
+
* @param style - The colour decision. Defaults to chalk's ambient one, which
|
|
86
|
+
* is what the summon bin has always rendered under; a host with its own gate
|
|
87
|
+
* passes {@link effectStyleFor} so the row cannot disagree with the rest of
|
|
88
|
+
* that host's output.
|
|
89
|
+
* @returns The rendered row.
|
|
33
90
|
*/
|
|
34
|
-
export declare const formatEffectLine: (effect: Effect, isLast: boolean) => string;
|
|
91
|
+
export declare const formatEffectLine: (effect: Effect, isLast: boolean, style?: EffectStyle) => string;
|
|
35
92
|
/**
|
|
36
93
|
* Format file content for preview display.
|
|
37
94
|
* Shows line numbers and truncates long content.
|
|
@@ -39,7 +96,7 @@ export declare const formatEffectLine: (effect: Effect, isLast: boolean) => stri
|
|
|
39
96
|
* @param content - The file content to format
|
|
40
97
|
* @param maxLines - Maximum number of lines to show (default: MAX_PREVIEW_LINES)
|
|
41
98
|
*/
|
|
42
|
-
export declare const formatContentPreview: (content: string, maxLines?: number) => string;
|
|
99
|
+
export declare const formatContentPreview: (content: string, maxLines?: number, style?: EffectStyle) => string;
|
|
43
100
|
/**
|
|
44
101
|
* Format an effect with its content (for verbose dry-run mode).
|
|
45
102
|
* This is useful for LLM agents that need to see generated file contents.
|
|
@@ -47,7 +104,7 @@ export declare const formatContentPreview: (content: string, maxLines?: number)
|
|
|
47
104
|
* @param effect - The effect to format
|
|
48
105
|
* @param isLast - Whether this is the last effect in the list
|
|
49
106
|
*/
|
|
50
|
-
export declare const formatEffectWithContent: (effect: Effect, isLast: boolean) => string;
|
|
107
|
+
export declare const formatEffectWithContent: (effect: Effect, isLast: boolean, style?: EffectStyle) => string;
|
|
51
108
|
/**
|
|
52
109
|
* Map file extension to markdown code fence language hint.
|
|
53
110
|
*/
|
|
@@ -60,9 +117,6 @@ export declare const getLlmActionLabel: (effect: Effect) => string;
|
|
|
60
117
|
* Get the path/description for an effect (plain text, for LLM output).
|
|
61
118
|
*/
|
|
62
119
|
export declare const getLlmEffectPath: (effect: Effect) => string;
|
|
63
|
-
/**
|
|
64
|
-
* Build the replay command string from generator name and answers.
|
|
65
|
-
*/
|
|
66
120
|
export declare const buildReplayCommand: (generatorName: string, answers: Record<string, unknown>, prompts: PromptDefinition[]) => string;
|
|
67
121
|
/**
|
|
68
122
|
* Format the full LLM output as a markdown document.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effects.d.ts","sourceRoot":"","sources":["../../../src/format/effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA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,aAAa,GACxB,WAAW,mBAAmB,EAC9B,aAAa,MAAM,KAClB,MAkHF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kebab-case CLI flag form of a camelCase prompt name — a named seam
|
|
3
|
+
* over the projection's {@link toKebabCase}, the SINGLE algorithm every
|
|
4
|
+
* user-facing surface uses. Error messages, `--llm` help, and replay
|
|
5
|
+
* commands must all name the same flag the CLI actually registers
|
|
6
|
+
* (`buildOptionInfo` derives registration from the same function), or an
|
|
7
|
+
* error tells the user to pass a flag that does not exist: a private
|
|
8
|
+
* reimplementation here split on `([a-z])([A-Z])` while registration split
|
|
9
|
+
* on `([a-z0-9])([A-Z])`, so `es2015Style` registered as `--es2015-style`
|
|
10
|
+
* but validation and help said `--es2015style`. Delegating — not copying —
|
|
11
|
+
* is what keeps the two surfaces from disagreeing again.
|
|
12
|
+
*/
|
|
13
|
+
export default function formatFlagName(promptName: string): string;
|
|
14
|
+
//# sourceMappingURL=formatFlagName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatFlagName.d.ts","sourceRoot":"","sources":["../../../src/format/formatFlagName.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEjE"}
|
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The effect-formatting seam, served as its own export subpath.
|
|
3
|
+
*
|
|
4
|
+
* `@canonical/summon-core/format` exists so a host can reach the plan rules —
|
|
5
|
+
* {@link visiblePlanEffects}, {@link formatEffectLine} and friends — WITHOUT
|
|
6
|
+
* loading summon-core proper: the barrel pulls the generator runtime and, with
|
|
7
|
+
* it, React, which the pragma CLI keeps off its `--help` / `__complete` fast
|
|
8
|
+
* paths. This module's runtime graph is `chalk` and Node built-ins, so a host
|
|
9
|
+
* pays for the plan rules and nothing else — whether it imports them eagerly,
|
|
10
|
+
* as the summon bin does, or behind a dynamic `import()` at render time, as
|
|
11
|
+
* the pragma kernel does to keep its own fast paths free of this package
|
|
12
|
+
* altogether.
|
|
13
|
+
*
|
|
14
|
+
* One surface, two bins: the summon bin renders its dry-run through these, and
|
|
15
|
+
* so now does the pragma kernel — the reason the rules live here rather than
|
|
16
|
+
* in either host.
|
|
17
|
+
*/
|
|
18
|
+
export type { EffectColor, EffectStyle } from "./effects.js";
|
|
19
|
+
export { buildReplayCommand, effectStyleFor, formatContentPreview, formatEffectLine, formatEffectWithContent, formatLlmHelp, formatLlmJson, formatLlmMarkdown, getActionColor, getActionLabel, getEffectPayload, getLanguageHint, getLlmActionLabel, getLlmEffectPath, isVisibleEffect, visiblePlanEffects, } from "./effects.js";
|
|
20
|
+
export { default as formatFlagName } from "./formatFlagName.js";
|
|
2
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/format/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/format/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,14 +11,14 @@ export type { AnyGenerator, ForbidReserved, GeneratorDefinition, GeneratorMeta,
|
|
|
11
11
|
export type { RunTaskWithStampOptions } from "./stamp/index.js";
|
|
12
12
|
export { applyStamp, createGeneratorStamp, createStampOnEffectStart, runTaskWithStamp, } from "./stamp/index.js";
|
|
13
13
|
export type { AnswerablePrompt, ExecuteContext, GeneratorResult, } from "./execute/index.js";
|
|
14
|
-
export { CONFIRM_ANSWER_KEY, collectAnswers, execute, GENERATOR_CANCELLED, GENERATOR_INVALID_ANSWER, validateAnswers, } from "./execute/index.js";
|
|
14
|
+
export { CONFIRM_ANSWER_KEY, collectAnswers, execute, GENERATOR_CANCELLED, GENERATOR_INVALID_ANSWER, invalidAnswersError, isInvalidAnswersError, validateAnswers, } from "./execute/index.js";
|
|
15
15
|
export type { ConfirmPrompt, InkPromptOptions, InkSession, MultiselectPrompt, PromptEffect, PromptHandler, PromptQuestion, SelectPrompt, TextPrompt, } from "./prompt/index.js";
|
|
16
16
|
export { answerPromptWithDefaults, autoPrompt, inkPrompt, MISSING_REQUIRED_ANSWER, mcpPrompt, missingRequiredError, } from "./prompt/index.js";
|
|
17
|
-
export { buildReplayCommand, formatContentPreview, formatEffectLine, formatEffectWithContent, formatLlmHelp, formatLlmJson, formatLlmMarkdown, getActionColor, getActionLabel, getEffectPayload, getLanguageHint, getLlmActionLabel, getLlmEffectPath, isVisibleEffect, } from "./format/index.js";
|
|
17
|
+
export { buildReplayCommand, effectStyleFor, formatContentPreview, formatEffectLine, formatEffectWithContent, formatLlmHelp, formatLlmJson, formatLlmMarkdown, getActionColor, getActionLabel, getEffectPayload, getLanguageHint, getLlmActionLabel, getLlmEffectPath, isVisibleEffect, visiblePlanEffects, } from "./format/index.js";
|
|
18
18
|
export type { RunGeneratorTaskOptions } from "./run/index.js";
|
|
19
19
|
export { runGeneratorTask } from "./run/index.js";
|
|
20
|
-
export type { TemplateDirOptions, TemplateOptions, TemplatingEngine, } from "./template/index.js";
|
|
21
|
-
export { ejsEngine, generateStamp, generatorComment, getCommentStyle, prependStamp, renderFile, renderString, renderStringAsync, template, templateDir, templateHelpers, withHelpers, } from "./template/index.js";
|
|
20
|
+
export type { LoadedTemplate, RawFileOptions, TemplateDirOptions, TemplateOptions, TemplatingEngine, } from "./template/index.js";
|
|
21
|
+
export { ejsEngine, generateStamp, generatorComment, getCommentStyle, loadTemplate, loadTemplateSync, prependStamp, rawFile, renderFile, renderString, renderStringAsync, template, templateDir, templateHelpers, withHelpers, } from "./template/index.js";
|
|
22
22
|
export { default as discoverGeneratorTree } from "./discovery/discoverGeneratorTree.js";
|
|
23
23
|
export { generatorCache } from "./discovery/generatorCache.js";
|
|
24
24
|
export type { GeneratorNode, GeneratorOrigin } from "./discovery/types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,YAAY,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAO5B,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,SAAS,EACT,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,YAAY,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAO5B,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,SAAS,EACT,oBAAoB,GACrB,MAAM,mBAAm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