@speedkit/cli 4.39.0 → 4.40.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/CHANGELOG.md +12 -0
- package/README.md +10 -1
- package/dist/commands/airports_iata.json +9202 -1
- package/dist/commands/generate-customer-config.d.ts +2 -0
- package/dist/commands/generate-customer-config.js +7 -1
- package/dist/services/customer-config/customer-config-service-build-context.d.ts +8 -0
- package/dist/services/customer-config/customer-config-service-build-context.js +8 -0
- package/dist/services/customer-config/customer-config-service-factory.js +3 -1
- package/dist/services/customer-config/customer-config-service.d.ts +10 -7
- package/dist/services/customer-config/customer-config-service.js +138 -308
- package/dist/services/customer-config/index.d.ts +2 -0
- package/dist/services/customer-config/index.js +2 -0
- package/dist/services/customer-config/spec/wizard-answers.spec.d.ts +1 -0
- package/dist/services/customer-config/spec/wizard-answers.spec.js +207 -0
- package/dist/services/customer-config/wizard-answers.d.ts +48 -0
- package/dist/services/customer-config/wizard-answers.js +67 -0
- package/dist/services/customer-config/wizard-questions.d.ts +86 -0
- package/dist/services/customer-config/wizard-questions.js +400 -0
- package/dist/templates/speedKit.Revalidated.js +5 -1
- package/oclif.manifest.json +98 -83
- package/package.json +1 -1
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as os from "node:os";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { expect } from "chai";
|
|
5
|
+
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
6
|
+
import { CustomerConfigService } from "../customer-config-service.js";
|
|
7
|
+
import { readWizardAnswers, WizardAnswerSource, } from "../wizard-answers.js";
|
|
8
|
+
import { describeWizardQuestions } from "../wizard-questions.js";
|
|
9
|
+
/** A CLI whose every question fails the test: with an answers file, the wizard must ask nothing. */
|
|
10
|
+
function silentCli(output) {
|
|
11
|
+
const asks = new Set(["prompt", "confirm", "select", "multiSelect"]);
|
|
12
|
+
return new Proxy({}, {
|
|
13
|
+
get(_target, name) {
|
|
14
|
+
if (asks.has(name)) {
|
|
15
|
+
return () => {
|
|
16
|
+
throw new Error(`the wizard asked "${name}" despite --answers`);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (name === "write" || name === "writeWarning") {
|
|
20
|
+
return (text) => output.push(text);
|
|
21
|
+
}
|
|
22
|
+
return () => undefined;
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const noAnalysis = {
|
|
27
|
+
analyze: async () => null,
|
|
28
|
+
};
|
|
29
|
+
describe("wizard --answers", () => {
|
|
30
|
+
let root;
|
|
31
|
+
let cwd;
|
|
32
|
+
let output;
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
cwd = process.cwd();
|
|
35
|
+
root = fs.mkdtempSync(path.join(os.tmpdir(), "sk-wizard-"));
|
|
36
|
+
const set = path.join(root, "templates", "customer-config");
|
|
37
|
+
fs.mkdirSync(set, { recursive: true });
|
|
38
|
+
fs.writeFileSync(path.join(set, "manifest.json"), JSON.stringify({
|
|
39
|
+
engine: "nunjucks",
|
|
40
|
+
engineOptions: {},
|
|
41
|
+
files: ["out.txt.njk"],
|
|
42
|
+
variables: { appName: { type: "string" } },
|
|
43
|
+
}));
|
|
44
|
+
fs.writeFileSync(path.join(set, "out.txt.njk"), "{{ appName }}|{{ production.host }}|{{ production.forceInstall }}|" +
|
|
45
|
+
"{{ isShopify }}|{{ hasSoftNavigations }}|{{ convertSoftToHardNavigations }}|" +
|
|
46
|
+
"{{ needsCustomerApproval }}");
|
|
47
|
+
process.chdir(root);
|
|
48
|
+
output = [];
|
|
49
|
+
});
|
|
50
|
+
afterEach(() => {
|
|
51
|
+
process.chdir(cwd);
|
|
52
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
53
|
+
});
|
|
54
|
+
function wizard(answers, appName = "example-shop") {
|
|
55
|
+
return new CustomerConfigService({
|
|
56
|
+
appName,
|
|
57
|
+
customersDirectory: "customers",
|
|
58
|
+
templatesPath: path.join(root, "templates"),
|
|
59
|
+
mode: "customer-config",
|
|
60
|
+
}, silentCli(output), noAnalysis, new WizardAnswerSource(answers));
|
|
61
|
+
}
|
|
62
|
+
const rendered = () => fs.readFileSync(path.join(root, "customers", "example-shop", "out.txt"), "utf-8");
|
|
63
|
+
it("renders the scaffold from the answers without asking", async () => {
|
|
64
|
+
await wizard({
|
|
65
|
+
productionHost: "www.example.com",
|
|
66
|
+
shopSystem: "Shopify",
|
|
67
|
+
productionInstallJsPresent: true,
|
|
68
|
+
features: ["hasSoftNavigations"],
|
|
69
|
+
}).generateConfig();
|
|
70
|
+
expect(rendered()).to.equal(
|
|
71
|
+
// soft navigations stay soft unless the answers convert them
|
|
72
|
+
"example-shop|www.example.com|false|true|true|false|false");
|
|
73
|
+
});
|
|
74
|
+
it("gives a missing key the question's default", async () => {
|
|
75
|
+
await wizard({
|
|
76
|
+
productionHost: "shop.example.jp",
|
|
77
|
+
shopSystem: "Shopify",
|
|
78
|
+
}).generateConfig();
|
|
79
|
+
// no install.js detected → forced install; no features; a .jp host needs approval
|
|
80
|
+
expect(rendered()).to.equal("example-shop|shop.example.jp|true|true|false||true");
|
|
81
|
+
});
|
|
82
|
+
it("prints the answers it used, so the run can be replayed", async () => {
|
|
83
|
+
await wizard({
|
|
84
|
+
productionHost: "www.example.com",
|
|
85
|
+
shopSystem: "Shopify",
|
|
86
|
+
}).generateConfig();
|
|
87
|
+
const replay = output.find((line) => line.includes("--answers"));
|
|
88
|
+
const used = JSON.parse(replay.slice(replay.indexOf("{")));
|
|
89
|
+
expect(used).to.include({
|
|
90
|
+
appName: "example-shop",
|
|
91
|
+
productionHost: "www.example.com",
|
|
92
|
+
shopSystem: "Shopify",
|
|
93
|
+
analyzeSite: true,
|
|
94
|
+
productionInstallJsPresent: false,
|
|
95
|
+
});
|
|
96
|
+
// the pre-checked features of the multi-select
|
|
97
|
+
expect(used.features).to.deep.equal(["removeLazyLoading"]);
|
|
98
|
+
});
|
|
99
|
+
it("writes no wizard record into config_customer.json", async () => {
|
|
100
|
+
const set = path.join(root, "templates", "customer-config");
|
|
101
|
+
fs.writeFileSync(path.join(set, "manifest.json"), JSON.stringify({
|
|
102
|
+
engine: "nunjucks",
|
|
103
|
+
engineOptions: {},
|
|
104
|
+
files: ["config_customer.json.njk"],
|
|
105
|
+
variables: { appName: { type: "string" } },
|
|
106
|
+
}));
|
|
107
|
+
const template = '{ "production": { "_meta": { "shopSystem": "{{ shopSystemName }}" }, "app": "{{ appName }}" } }';
|
|
108
|
+
fs.writeFileSync(path.join(set, "config_customer.json.njk"), template);
|
|
109
|
+
await wizard({
|
|
110
|
+
productionHost: "www.example.com",
|
|
111
|
+
shopSystem: "Shopify",
|
|
112
|
+
features: ["addSSR"],
|
|
113
|
+
}).generateConfig();
|
|
114
|
+
// the file is exactly the rendered template: the decisions change while a config is built
|
|
115
|
+
expect(fs.readFileSync(path.join(root, "customers", "example-shop", "config_customer.json"), "utf-8")).to.equal('{ "production": { "_meta": { "shopSystem": "Shopify" }, "app": "example-shop" } }');
|
|
116
|
+
});
|
|
117
|
+
it("ignores, with a warning, an answer whose question does not apply", async () => {
|
|
118
|
+
await wizard({
|
|
119
|
+
productionHost: "www.example.com",
|
|
120
|
+
shopSystem: "Shopify",
|
|
121
|
+
staging: { host: "staging.example.com" },
|
|
122
|
+
convertSoftToHardNavigations: false,
|
|
123
|
+
}).generateConfig();
|
|
124
|
+
expect(output.filter((line) => line.includes("does not apply"))).to.have.length(2);
|
|
125
|
+
});
|
|
126
|
+
it("takes feature defaults from the site analysis", async () => {
|
|
127
|
+
const analysis = {
|
|
128
|
+
analyze: async () => ({
|
|
129
|
+
shopSystem: "shopware",
|
|
130
|
+
hasInstallJs: true,
|
|
131
|
+
removeLazyLoading: false,
|
|
132
|
+
hasSoftNavigations: true,
|
|
133
|
+
includeServiceWorker: false,
|
|
134
|
+
useGATracking: false,
|
|
135
|
+
withGoogleOptimize: false,
|
|
136
|
+
activateCfRocketLoaderPlugin: false,
|
|
137
|
+
handleUsercentrics: false,
|
|
138
|
+
}),
|
|
139
|
+
};
|
|
140
|
+
await new CustomerConfigService({
|
|
141
|
+
appName: "example-shop",
|
|
142
|
+
customersDirectory: "customers",
|
|
143
|
+
templatesPath: path.join(root, "templates"),
|
|
144
|
+
mode: "customer-config",
|
|
145
|
+
}, silentCli(output), analysis, new WizardAnswerSource({ productionHost: "www.example.com" })).generateConfig();
|
|
146
|
+
// Shopware detected; install.js detected; lazy-loading falls back to checked
|
|
147
|
+
expect(rendered()).to.equal("example-shop|www.example.com|false||true|false|false");
|
|
148
|
+
});
|
|
149
|
+
it("stops at a question that has no default", async () => {
|
|
150
|
+
let error;
|
|
151
|
+
try {
|
|
152
|
+
await wizard({ shopSystem: "Shopify" }).generateConfig();
|
|
153
|
+
}
|
|
154
|
+
catch (caught) {
|
|
155
|
+
error = caught;
|
|
156
|
+
}
|
|
157
|
+
expect(error?.message).to.contain('no "productionHost"');
|
|
158
|
+
});
|
|
159
|
+
it("never empties a directory it was not told to", async () => {
|
|
160
|
+
fs.mkdirSync(path.join(root, "customers", "example-shop"), {
|
|
161
|
+
recursive: true,
|
|
162
|
+
});
|
|
163
|
+
fs.writeFileSync(path.join(root, "customers", "example-shop", "keep"), "");
|
|
164
|
+
let error;
|
|
165
|
+
try {
|
|
166
|
+
await wizard({
|
|
167
|
+
productionHost: "www.example.com",
|
|
168
|
+
shopSystem: "Shopify",
|
|
169
|
+
}).generateConfig();
|
|
170
|
+
}
|
|
171
|
+
catch (caught) {
|
|
172
|
+
error = caught;
|
|
173
|
+
}
|
|
174
|
+
expect(error?.message).to.contain('no "existingDirectory"');
|
|
175
|
+
expect(fs.existsSync(path.join(root, "customers", "example-shop", "keep"))).to.equal(true);
|
|
176
|
+
});
|
|
177
|
+
it("rejects a feature the shop system does not offer", async () => {
|
|
178
|
+
let error;
|
|
179
|
+
try {
|
|
180
|
+
await wizard({
|
|
181
|
+
productionHost: "www.example.com",
|
|
182
|
+
shopSystem: "Shopify",
|
|
183
|
+
features: ["useGATracking"],
|
|
184
|
+
}).generateConfig();
|
|
185
|
+
}
|
|
186
|
+
catch (caught) {
|
|
187
|
+
error = caught;
|
|
188
|
+
}
|
|
189
|
+
expect(error?.message).to.contain("Unknown features");
|
|
190
|
+
});
|
|
191
|
+
it("prints every question with its condition, so a caller needs no other source", () => {
|
|
192
|
+
const described = describeWizardQuestions("9.9.9");
|
|
193
|
+
const json = JSON.parse(JSON.stringify(described));
|
|
194
|
+
const keys = json.questions.map((question) => question.key);
|
|
195
|
+
expect(keys).to.include.members(["productionHost", "features", "staging"]);
|
|
196
|
+
const ssr = json.questions.find((q) => q.key === "ssrInnerShadowDomSupport");
|
|
197
|
+
expect(ssr.when).to.deep.equal({ key: "features", includes: "addSSR" });
|
|
198
|
+
expect(Object.keys(json.defaultRules)).to.include("japaneseHost");
|
|
199
|
+
// nothing but data, so the printed table is the whole table
|
|
200
|
+
expect(json.questions).to.deep.equal(described.questions);
|
|
201
|
+
});
|
|
202
|
+
it("rejects an unknown key in the answers file", () => {
|
|
203
|
+
const file = path.join(root, "answers.json");
|
|
204
|
+
fs.writeFileSync(file, JSON.stringify({ productionHots: "x" }));
|
|
205
|
+
expect(() => readWizardAnswers(file)).to.throw(/unknown keys: productionHots/);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The answers to every wizard question, each under a stable key. `--answers <file>`
|
|
3
|
+
* reads them from a JSON file, so the wizard runs without a terminal.
|
|
4
|
+
*/
|
|
5
|
+
export interface WizardAnswers {
|
|
6
|
+
appName?: string;
|
|
7
|
+
productionHost?: string;
|
|
8
|
+
analyzeSite?: boolean;
|
|
9
|
+
/** A ShopSystem value, e.g. "Shopify". Overrides the site analysis. */
|
|
10
|
+
shopSystem?: string;
|
|
11
|
+
productionInstallJsPresent?: boolean;
|
|
12
|
+
/** `null` adds no staging config. Shopify configs never get one. */
|
|
13
|
+
staging?: {
|
|
14
|
+
host: string;
|
|
15
|
+
installJsPresent?: boolean;
|
|
16
|
+
} | null;
|
|
17
|
+
needsCustomerApproval?: boolean;
|
|
18
|
+
/** The feature values of the multi-select, e.g. "hasSoftNavigations", "addSSR". */
|
|
19
|
+
features?: string[];
|
|
20
|
+
serviceWorkerPath?: string;
|
|
21
|
+
ssrInnerShadowDomSupport?: boolean;
|
|
22
|
+
convertSoftToHardNavigations?: boolean;
|
|
23
|
+
/** How to treat an output directory that is not empty. */
|
|
24
|
+
existingDirectory?: "new-name" | "overwrite-file-wise" | "empty";
|
|
25
|
+
newDirectoryName?: string;
|
|
26
|
+
graduatePrePoc?: boolean;
|
|
27
|
+
/** Answers every "file already exists. Overwrite?" question. */
|
|
28
|
+
overwriteExistingFiles?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Reads and checks an answers file. An unknown key fails, so a typo cannot pass silently. */
|
|
31
|
+
export declare function readWizardAnswers(filePath: string): WizardAnswers;
|
|
32
|
+
/**
|
|
33
|
+
* Answers a wizard question from the answers file, or asks it in the terminal.
|
|
34
|
+
* Without a file, every question is asked. With one, a missing key takes the
|
|
35
|
+
* question's default; a question without a default stops the run.
|
|
36
|
+
*/
|
|
37
|
+
export declare class WizardAnswerSource {
|
|
38
|
+
private readonly answers?;
|
|
39
|
+
/** Every answer the run used, in the answers-file format, so the run can be repeated. */
|
|
40
|
+
readonly used: WizardAnswers;
|
|
41
|
+
constructor(answers?: WizardAnswers);
|
|
42
|
+
get active(): boolean;
|
|
43
|
+
has(key: keyof WizardAnswers): boolean;
|
|
44
|
+
/** The raw value of a key the answers file sets. */
|
|
45
|
+
provided<K extends keyof WizardAnswers>(key: K): WizardAnswers[K];
|
|
46
|
+
get<K extends keyof WizardAnswers>(key: K, ask: () => Promise<WizardAnswers[K]>, fallback?: WizardAnswers[K]): Promise<WizardAnswers[K]>;
|
|
47
|
+
record<K extends keyof WizardAnswers>(key: K, value: WizardAnswers[K]): void;
|
|
48
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import { WIZARD_QUESTIONS } from "./wizard-questions.js";
|
|
3
|
+
/** Every key the question table knows. */
|
|
4
|
+
const knownKeys = () => WIZARD_QUESTIONS.map((question) => question.key);
|
|
5
|
+
/** Reads and checks an answers file. An unknown key fails, so a typo cannot pass silently. */
|
|
6
|
+
export function readWizardAnswers(filePath) {
|
|
7
|
+
let answers;
|
|
8
|
+
try {
|
|
9
|
+
answers = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
throw new Error(`Cannot read the answers file ${filePath}: ${error.message}`, { cause: error });
|
|
13
|
+
}
|
|
14
|
+
if (!answers || typeof answers !== "object" || Array.isArray(answers)) {
|
|
15
|
+
throw new Error(`The answers file ${filePath} must hold a JSON object.`);
|
|
16
|
+
}
|
|
17
|
+
const known = knownKeys();
|
|
18
|
+
const unknown = Object.keys(answers).filter((key) => !known.includes(key));
|
|
19
|
+
if (unknown.length > 0) {
|
|
20
|
+
throw new Error(`The answers file has unknown keys: ${unknown.join(", ")}. ` +
|
|
21
|
+
`Known keys: ${known.join(", ")}. sk generate-customer-config --print-questions describes them.`);
|
|
22
|
+
}
|
|
23
|
+
return answers;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Answers a wizard question from the answers file, or asks it in the terminal.
|
|
27
|
+
* Without a file, every question is asked. With one, a missing key takes the
|
|
28
|
+
* question's default; a question without a default stops the run.
|
|
29
|
+
*/
|
|
30
|
+
export class WizardAnswerSource {
|
|
31
|
+
answers;
|
|
32
|
+
/** Every answer the run used, in the answers-file format, so the run can be repeated. */
|
|
33
|
+
used = {};
|
|
34
|
+
constructor(answers) {
|
|
35
|
+
this.answers = answers;
|
|
36
|
+
}
|
|
37
|
+
get active() {
|
|
38
|
+
return this.answers !== undefined;
|
|
39
|
+
}
|
|
40
|
+
has(key) {
|
|
41
|
+
return this.active && this.answers[key] !== undefined;
|
|
42
|
+
}
|
|
43
|
+
/** The raw value of a key the answers file sets. */
|
|
44
|
+
provided(key) {
|
|
45
|
+
return this.answers[key];
|
|
46
|
+
}
|
|
47
|
+
async get(key, ask, fallback) {
|
|
48
|
+
let value;
|
|
49
|
+
if (!this.active) {
|
|
50
|
+
value = await ask();
|
|
51
|
+
}
|
|
52
|
+
else if (this.answers[key] !== undefined) {
|
|
53
|
+
value = this.answers[key];
|
|
54
|
+
}
|
|
55
|
+
else if (fallback !== undefined) {
|
|
56
|
+
value = fallback;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
throw new Error(`The answers file has no "${key}", and this question has no default.`);
|
|
60
|
+
}
|
|
61
|
+
this.record(key, value);
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
record(key, value) {
|
|
65
|
+
this.used[key] = value;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { SiteAnalysisResult } from "./site-analyzer/index.js";
|
|
2
|
+
import { CustomerConfigSettings } from "./customer-config-service-model.js";
|
|
3
|
+
import type { WizardAnswers } from "./wizard-answers.js";
|
|
4
|
+
/**
|
|
5
|
+
* When a question or a choice applies. Plain data, so `--print-questions` can
|
|
6
|
+
* print it: it compares an earlier answer, or the wizard mode.
|
|
7
|
+
*/
|
|
8
|
+
export type Condition = {
|
|
9
|
+
key: keyof WizardAnswers;
|
|
10
|
+
equals?: unknown;
|
|
11
|
+
notEquals?: unknown;
|
|
12
|
+
/** For a list answer: the list holds this value. */
|
|
13
|
+
includes?: string;
|
|
14
|
+
} | {
|
|
15
|
+
mode: "customer-config" | "pre-poc";
|
|
16
|
+
} | {
|
|
17
|
+
allOf: Condition[];
|
|
18
|
+
};
|
|
19
|
+
/** A default the wizard computes. `DEFAULT_RULES` describes each one. */
|
|
20
|
+
export type DefaultRule = "appFlag" | "detectedShopSystem" | "japaneseHost" | "preCheckedFeatures";
|
|
21
|
+
export type QuestionDefault = string | boolean | null | {
|
|
22
|
+
fromAnalysis: keyof SiteAnalysisResult;
|
|
23
|
+
fallback: boolean;
|
|
24
|
+
} | {
|
|
25
|
+
rule: DefaultRule;
|
|
26
|
+
};
|
|
27
|
+
export interface QuestionChoice {
|
|
28
|
+
value: string;
|
|
29
|
+
/** The label of the interactive prompt. */
|
|
30
|
+
label?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
when?: Condition;
|
|
33
|
+
/** For a multi-select: whether the choice starts checked. */
|
|
34
|
+
default?: QuestionDefault;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* One wizard question. The interactive flow, `--answers` and
|
|
38
|
+
* `--print-questions` all read this table, so a new question or branch is one
|
|
39
|
+
* entry here.
|
|
40
|
+
*/
|
|
41
|
+
export interface WizardQuestion {
|
|
42
|
+
key: keyof WizardAnswers;
|
|
43
|
+
type: "string" | "boolean" | "select" | "multiSelect" | "object";
|
|
44
|
+
prompt: string;
|
|
45
|
+
/** The fact that decides the answer. An agent turns it into a finding it must establish. */
|
|
46
|
+
description: string;
|
|
47
|
+
choices?: QuestionChoice[];
|
|
48
|
+
/** Without a default, an answers file must set the key. */
|
|
49
|
+
default?: QuestionDefault;
|
|
50
|
+
/** Only the interactive prompt shows it; an answers file gets no such default. */
|
|
51
|
+
suggestion?: string;
|
|
52
|
+
when?: Condition;
|
|
53
|
+
/** A destructive or business choice: an agent asks the engineer before it answers. */
|
|
54
|
+
engineerDecision?: boolean;
|
|
55
|
+
/** "settings" questions decide the scaffold; "output" questions only steer this run's directory. */
|
|
56
|
+
phase: "settings" | "output";
|
|
57
|
+
/** Interactive only: skip the prompt when the default resolves, e.g. a detected shop system. */
|
|
58
|
+
skipPromptWhenDefaulted?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export declare const DEFAULT_RULES: Record<DefaultRule, string>;
|
|
61
|
+
export declare const WIZARD_QUESTIONS: readonly WizardQuestion[];
|
|
62
|
+
export declare function wizardQuestion(key: keyof WizardAnswers): WizardQuestion;
|
|
63
|
+
/** Whether a condition holds for the answers so far and the wizard mode. */
|
|
64
|
+
export declare function conditionHolds(condition: Condition | undefined, answers: WizardAnswers, mode: string): boolean;
|
|
65
|
+
/** The facts a default can depend on. */
|
|
66
|
+
export interface DefaultContext {
|
|
67
|
+
answers: WizardAnswers;
|
|
68
|
+
analysis: SiteAnalysisResult | null;
|
|
69
|
+
appName: string;
|
|
70
|
+
mode: string;
|
|
71
|
+
}
|
|
72
|
+
/** The choices of a question that apply to the answers so far. */
|
|
73
|
+
export declare function applicableChoices(question: WizardQuestion, context: DefaultContext): QuestionChoice[];
|
|
74
|
+
/** Resolves a default to a value; `undefined` means the question has none here. */
|
|
75
|
+
export declare function resolveDefault(question: WizardQuestion, value: QuestionDefault | undefined, context: DefaultContext): unknown;
|
|
76
|
+
/** Checks one answer against its question; returns the problem, or undefined. */
|
|
77
|
+
export declare function validateAnswer(question: WizardQuestion, value: unknown, context: DefaultContext): string | undefined;
|
|
78
|
+
/** The template variables that the answers decide. */
|
|
79
|
+
export declare function settingsFromAnswers(answers: WizardAnswers, mode: string): CustomerConfigSettings;
|
|
80
|
+
/** The table as `--print-questions` prints it. */
|
|
81
|
+
export declare function describeWizardQuestions(cliVersion: string): {
|
|
82
|
+
cliVersion: string;
|
|
83
|
+
usage: string;
|
|
84
|
+
defaultRules: Record<DefaultRule, string>;
|
|
85
|
+
questions: readonly WizardQuestion[];
|
|
86
|
+
};
|