grimoire-wizard 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +173 -18
  2. package/dist/cli.js +503 -97
  3. package/dist/cli.js.map +1 -1
  4. package/dist/index.d.ts +107 -3
  5. package/dist/index.js +832 -367
  6. package/dist/index.js.map +1 -1
  7. package/examples/json/all-features.json +66 -0
  8. package/examples/json/appstore-screenshot-wizard.json +362 -0
  9. package/examples/json/appstore-upload.json +104 -0
  10. package/examples/json/basic.json +72 -0
  11. package/examples/json/batch-generate.json +186 -0
  12. package/examples/json/brief-builder.json +519 -0
  13. package/examples/json/conditional.json +155 -0
  14. package/examples/json/cost-analyzer.json +83 -0
  15. package/examples/json/demo.json +130 -0
  16. package/examples/json/scraper-selector.json +63 -0
  17. package/examples/json/themed-catppuccin.json +39 -0
  18. package/examples/json/themed.json +103 -0
  19. package/examples/json/with-checks.json +47 -0
  20. package/examples/yaml/appstore-screenshot-wizard.yaml +321 -0
  21. package/examples/yaml/appstore-upload.yaml +84 -0
  22. package/examples/yaml/batch-generate.yaml +156 -0
  23. package/examples/yaml/brief-builder.yaml +429 -0
  24. package/examples/yaml/cost-analyzer.yaml +69 -0
  25. package/examples/yaml/pipeline.yaml +35 -0
  26. package/examples/yaml/scraper-selector.yaml +52 -0
  27. package/examples/yaml/themed-catppuccin.yaml +31 -0
  28. package/package.json +1 -1
  29. /package/examples/{all-features.yaml → yaml/all-features.yaml} +0 -0
  30. /package/examples/{base.yaml → yaml/base.yaml} +0 -0
  31. /package/examples/{basic.yaml → yaml/basic.yaml} +0 -0
  32. /package/examples/{conditional.yaml → yaml/conditional.yaml} +0 -0
  33. /package/examples/{demo.yaml → yaml/demo.yaml} +0 -0
  34. /package/examples/{ebay-mcp-setup.yaml → yaml/ebay-mcp-setup.yaml} +0 -0
  35. /package/examples/{extended.yaml → yaml/extended.yaml} +0 -0
  36. /package/examples/{themed.yaml → yaml/themed.yaml} +0 -0
  37. /package/examples/{with-checks.yaml → yaml/with-checks.yaml} +0 -0
package/dist/index.d.ts CHANGED
@@ -143,8 +143,12 @@ interface ToggleStepConfig extends BaseStepConfig {
143
143
  interface MessageStepConfig extends BaseStepConfig {
144
144
  type: 'message';
145
145
  }
146
- type StepConfig = TextStepConfig | SelectStepConfig | MultiSelectStepConfig | ConfirmStepConfig | PasswordStepConfig | NumberStepConfig | SearchStepConfig | EditorStepConfig | PathStepConfig | ToggleStepConfig | MessageStepConfig;
146
+ interface NoteStepConfig extends BaseStepConfig {
147
+ type: 'note';
148
+ }
149
+ type StepConfig = TextStepConfig | SelectStepConfig | MultiSelectStepConfig | ConfirmStepConfig | PasswordStepConfig | NumberStepConfig | SearchStepConfig | EditorStepConfig | PathStepConfig | ToggleStepConfig | MessageStepConfig | NoteStepConfig;
147
150
  interface ThemeConfig {
151
+ preset?: string;
148
152
  tokens?: {
149
153
  primary?: string;
150
154
  success?: string;
@@ -176,6 +180,7 @@ interface WizardConfig {
176
180
  name: string;
177
181
  version?: string;
178
182
  description?: string;
183
+ review?: boolean;
179
184
  };
180
185
  theme?: ThemeConfig;
181
186
  steps: StepConfig[];
@@ -205,6 +210,65 @@ type WizardTransition = {
205
210
  } | {
206
211
  type: 'CANCEL';
207
212
  };
213
+ type WizardEvent = {
214
+ type: 'session:start';
215
+ wizard: string;
216
+ description?: string;
217
+ totalSteps: number;
218
+ } | {
219
+ type: 'session:end';
220
+ answers: Record<string, unknown>;
221
+ cancelled: boolean;
222
+ } | {
223
+ type: 'group:start';
224
+ group: string;
225
+ } | {
226
+ type: 'step:start';
227
+ stepId: string;
228
+ stepIndex: number;
229
+ totalVisible: number;
230
+ step: StepConfig;
231
+ } | {
232
+ type: 'step:complete';
233
+ stepId: string;
234
+ value: unknown;
235
+ step: StepConfig;
236
+ } | {
237
+ type: 'step:error';
238
+ stepId: string;
239
+ error: string;
240
+ } | {
241
+ type: 'step:back';
242
+ stepId: string;
243
+ } | {
244
+ type: 'spinner:start';
245
+ message: string;
246
+ } | {
247
+ type: 'spinner:stop';
248
+ message?: string;
249
+ } | {
250
+ type: 'note';
251
+ title: string;
252
+ body: string;
253
+ } | {
254
+ type: 'checks:start';
255
+ checks: PreFlightCheck[];
256
+ } | {
257
+ type: 'check:pass';
258
+ name: string;
259
+ } | {
260
+ type: 'check:fail';
261
+ name: string;
262
+ message: string;
263
+ } | {
264
+ type: 'actions:start';
265
+ } | {
266
+ type: 'action:pass';
267
+ name: string;
268
+ } | {
269
+ type: 'action:fail';
270
+ name: string;
271
+ };
208
272
  interface ResolvedTheme {
209
273
  primary: (text: string) => string;
210
274
  success: (text: string) => string;
@@ -232,6 +296,7 @@ interface WizardRenderer {
232
296
  renderGroupHeader(group: string, theme: ResolvedTheme): void;
233
297
  renderSummary(answers: Record<string, unknown>, steps: StepConfig[], theme: ResolvedTheme): void;
234
298
  clear(): void;
299
+ onEvent?(event: WizardEvent, theme: ResolvedTheme): void;
235
300
  }
236
301
 
237
302
  declare function parseWizardConfig(raw: unknown): WizardConfig;
@@ -280,8 +345,9 @@ interface RunWizardOptions {
280
345
  dir?: string;
281
346
  };
282
347
  mru?: boolean;
348
+ resume?: boolean;
283
349
  }
284
- declare function runPreFlightChecks(checks: PreFlightCheck[], theme: ResolvedTheme): void;
350
+ declare function runPreFlightChecks(checks: PreFlightCheck[], theme: ResolvedTheme, renderer?: WizardRenderer): void;
285
351
  declare function runWizard(config: WizardConfig, options?: RunWizardOptions): Promise<Record<string, unknown>>;
286
352
 
287
353
  declare function defineWizard(config: WizardConfig): WizardConfig;
@@ -346,9 +412,47 @@ declare class InkRenderer implements WizardRenderer {
346
412
  clear(): void;
347
413
  }
348
414
 
415
+ declare class ClackRenderer extends InquirerRenderer {
416
+ private spinnerInterval;
417
+ private spinnerFrameIndex;
418
+ renderStepHeader(): void;
419
+ renderGroupHeader(): void;
420
+ renderSummary(answers: Record<string, unknown>, steps: StepConfig[], theme: ResolvedTheme): void;
421
+ onEvent(event: WizardEvent, theme: ResolvedTheme): void;
422
+ private handleSessionStart;
423
+ private handleSessionEnd;
424
+ private handleStepComplete;
425
+ private formatValue;
426
+ private writeNoteBox;
427
+ private startSpinner;
428
+ private stopSpinner;
429
+ }
430
+
349
431
  declare function saveTemplate(wizardName: string, templateName: string, answers: Record<string, unknown>, excludeKeys?: string[]): void;
350
432
  declare function loadTemplate(wizardName: string, templateName: string): Record<string, unknown> | undefined;
351
433
  declare function listTemplates(wizardName: string): string[];
352
434
  declare function deleteTemplate(wizardName: string, templateName: string): void;
353
435
 
354
- export { type ActionConfig, type Condition, type ConfirmStepConfig, type EditorStepConfig, type GrimoirePlugin, InkRenderer, InquirerRenderer, type MessageStepConfig, type MultiSelectStepConfig, type NumberStepConfig, type PasswordStepConfig, type PathStepConfig, type PreFlightCheck, type ResolvedTheme, type RunWizardOptions, type SearchStepConfig, type SelectChoice, type SelectOption, type SelectStepConfig, type SeparatorOption, type StepConfig, type StepPlugin, type TextStepConfig, type ThemeConfig, type ToggleStepConfig, type ValidationRule, type WizardConfig, type WizardRenderer, type WizardState, type WizardTransition, clearCache, clearMruData, clearPlugins, createWizardState, defineWizard, deleteTemplate, evaluateCondition, getCacheDir, getOrderedOptions, getPluginStep, getVisibleSteps, isStepVisible, listTemplates, loadCachedAnswers, loadTemplate, loadWizardConfig, parseWizardConfig, parseWizardYAML, recordSelection, registerPlugin, renderBanner, resolveEnvDefault, resolveNextStep, resolveTemplate, resolveTheme, runPreFlightChecks, runWizard, saveCachedAnswers, saveTemplate, slugify, validateStepAnswer, wizardReducer };
436
+ interface SavedProgress {
437
+ currentStepId: string;
438
+ answers: Record<string, unknown>;
439
+ history: string[];
440
+ savedAt: string;
441
+ }
442
+ declare function saveProgress(wizardName: string, state: {
443
+ currentStepId: string;
444
+ answers: Record<string, unknown>;
445
+ history: string[];
446
+ }, customDir?: string, excludeStepIds?: string[]): void;
447
+ declare function loadProgress(wizardName: string, customDir?: string): SavedProgress | null;
448
+ declare function clearProgress(wizardName: string, customDir?: string): void;
449
+
450
+ interface PipelineStep {
451
+ config: WizardConfig | string;
452
+ when?: Condition;
453
+ mockAnswers?: Record<string, unknown>;
454
+ options?: Omit<RunWizardOptions, 'mockAnswers' | 'templateAnswers'>;
455
+ }
456
+ declare function runPipeline(steps: PipelineStep[], globalOptions?: Omit<RunWizardOptions, 'mockAnswers' | 'templateAnswers'>): Promise<Record<string, Record<string, unknown>>>;
457
+
458
+ export { type ActionConfig, ClackRenderer, type Condition, type ConfirmStepConfig, type EditorStepConfig, type GrimoirePlugin, InkRenderer, InquirerRenderer, type MessageStepConfig, type MultiSelectStepConfig, type NoteStepConfig, type NumberStepConfig, type PasswordStepConfig, type PathStepConfig, type PipelineStep, type PreFlightCheck, type ResolvedTheme, type RunWizardOptions, type SavedProgress, type SearchStepConfig, type SelectChoice, type SelectOption, type SelectStepConfig, type SeparatorOption, type StepConfig, type StepPlugin, type TextStepConfig, type ThemeConfig, type ToggleStepConfig, type ValidationRule, type WizardConfig, type WizardEvent, type WizardRenderer, type WizardState, type WizardTransition, clearCache, clearMruData, clearPlugins, clearProgress, createWizardState, defineWizard, deleteTemplate, evaluateCondition, getCacheDir, getOrderedOptions, getPluginStep, getVisibleSteps, isStepVisible, listTemplates, loadCachedAnswers, loadProgress, loadTemplate, loadWizardConfig, parseWizardConfig, parseWizardYAML, recordSelection, registerPlugin, renderBanner, resolveEnvDefault, resolveNextStep, resolveTemplate, resolveTheme, runPipeline, runPreFlightChecks, runWizard, saveCachedAnswers, saveProgress, saveTemplate, slugify, validateStepAnswer, wizardReducer };