grimoire-wizard 0.5.2 → 0.6.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/README.md CHANGED
@@ -146,33 +146,33 @@ grimoire run setup.yaml
146
146
 
147
147
  ## Step Types
148
148
 
149
- | type | returns | use case |
150
- |------|---------|----------|
151
- | `text` | `string` | Free-form input with validation |
152
- | `select` | `string` | Single choice from a list; supports `routes` |
153
- | `multiselect` | `string[]` | Multiple choices; `min`/`max` constraints |
154
- | `confirm` | `boolean` | Yes/no prompt |
155
- | `password` | `string` | Masked input, never cached |
156
- | `number` | `number` | Numeric input with `min`/`max`/`step` |
157
- | `search` | `string` | Fuzzy-searchable single choice |
158
- | `editor` | `string` | Opens terminal editor, returns full text |
159
- | `path` | `string` | Path input with tab-completion |
160
- | `toggle` | `boolean` | Binary toggle with custom labels |
161
- | `note` | — | Inline info box, no input collected |
149
+ | type | returns | use case |
150
+ | ------------- | ---------- | -------------------------------------------- |
151
+ | `text` | `string` | Free-form input with validation |
152
+ | `select` | `string` | Single choice from a list; supports `routes` |
153
+ | `multiselect` | `string[]` | Multiple choices; `min`/`max` constraints |
154
+ | `confirm` | `boolean` | Yes/no prompt |
155
+ | `password` | `string` | Masked input, never cached |
156
+ | `number` | `number` | Numeric input with `min`/`max`/`step` |
157
+ | `search` | `string` | Fuzzy-searchable single choice |
158
+ | `editor` | `string` | Opens terminal editor, returns full text |
159
+ | `path` | `string` | Path input with tab-completion |
160
+ | `toggle` | `boolean` | Binary toggle with custom labels |
161
+ | `note` | — | Inline info box, no input collected |
162
162
 
163
163
  ---
164
164
 
165
165
  ## CLI
166
166
 
167
- | command | description |
168
- |---------|-------------|
169
- | `grimoire run <config>` | Run a wizard. Flags: `--mock`, `--json`, `--dry-run`, `--template`, `--renderer` |
170
- | `grimoire validate <config>` | Parse and validate without running |
171
- | `grimoire create [output]` | Scaffold a new wizard config interactively |
172
- | `grimoire demo` | Run the built-in demo (all 11 step types) |
173
- | `grimoire completion <shell>` | Print bash/zsh/fish completion script |
174
- | `grimoire cache clear [name]` | Clear cached answers |
175
- | `grimoire template list/delete` | Manage named answer presets |
167
+ | command | description |
168
+ | ------------------------------- | -------------------------------------------------------------------------------- |
169
+ | `grimoire run <config>` | Run a wizard. Flags: `--mock`, `--json`, `--dry-run`, `--template`, `--renderer` |
170
+ | `grimoire validate <config>` | Parse and validate without running |
171
+ | `grimoire create [output]` | Scaffold a new wizard config interactively |
172
+ | `grimoire demo` | Run the built-in demo (all 11 step types) |
173
+ | `grimoire completion <shell>` | Print bash/zsh/fish completion script |
174
+ | `grimoire cache clear [name]` | Clear cached answers |
175
+ | `grimoire template list/delete` | Manage named answer presets |
176
176
 
177
177
  ---
178
178
 
@@ -181,10 +181,10 @@ grimoire run setup.yaml
181
181
  ```yaml
182
182
  # meta (required)
183
183
  meta:
184
- name: string # wizard title
185
- version: string # optional semver
186
- description: string # shown at startup
187
- review: boolean # show review screen before submit
184
+ name: string # wizard title
185
+ version: string # optional semver
186
+ description: string # shown at startup
187
+ review: boolean # show review screen before submit
188
188
 
189
189
  # extends (optional) — inherit from a base config
190
190
  extends: ./base.yaml
@@ -192,29 +192,29 @@ extends: ./base.yaml
192
192
  # checks (optional) — pre-flight shell commands, abort on failure
193
193
  checks:
194
194
  - name: string
195
- run: string # shell command
196
- message: string # error if non-zero exit
195
+ run: string # shell command
196
+ message: string # error if non-zero exit
197
197
 
198
198
  # steps (required) — array of step definitions
199
199
  steps:
200
- - id: string # unique key in answers output
201
- type: string # see step types table
202
- message: string # prompt text
203
- group: string # section header (shown once per group)
204
- when: Condition # show only if condition passes
205
- next: string # override sequential flow; "__done__" to end
206
- default: any # initial value; "$ENV_VAR" reads from env
207
- validate: Rule[] # required, minLength, maxLength, pattern, min, max
200
+ - id: string # unique key in answers output
201
+ type: string # see step types table
202
+ message: string # prompt text
203
+ group: string # section header (shown once per group)
204
+ when: Condition # show only if condition passes
205
+ next: string # override sequential flow; "__done__" to end
206
+ default: any # initial value; "$ENV_VAR" reads from env
207
+ validate: Rule[] # required, minLength, maxLength, pattern, min, max
208
208
 
209
209
  # output (optional)
210
210
  output:
211
211
  format: json | yaml | env
212
- path: string # write answers to file
212
+ path: string # write answers to file
213
213
 
214
214
  # theme (optional)
215
215
  theme:
216
216
  preset: catppuccin | dracula | nord | tokyonight | monokai
217
- tokens: # override individual color tokens
217
+ tokens: # override individual color tokens
218
218
  primary: "#hex"
219
219
  icons:
220
220
  pointer: ">"
@@ -225,29 +225,36 @@ theme:
225
225
  ## Programmatic API
226
226
 
227
227
  ```typescript
228
- import { defineWizard, runWizard, runPipeline } from 'grimoire-wizard'
228
+ import { defineWizard, runWizard, runPipeline } from "grimoire-wizard";
229
229
 
230
230
  const config = defineWizard({
231
- meta: { name: 'Deploy' },
231
+ meta: { name: "Deploy" },
232
232
  steps: [
233
- { id: 'env', type: 'select', message: 'Target?',
234
- options: [{ value: 'prod', label: 'Production' }, { value: 'staging', label: 'Staging' }] },
235
- { id: 'confirm', type: 'confirm', message: 'Deploy now?', default: false },
233
+ {
234
+ id: "env",
235
+ type: "select",
236
+ message: "Target?",
237
+ options: [
238
+ { value: "prod", label: "Production" },
239
+ { value: "staging", label: "Staging" },
240
+ ],
241
+ },
242
+ { id: "confirm", type: "confirm", message: "Deploy now?", default: false },
236
243
  ],
237
- output: { format: 'json' },
238
- })
244
+ output: { format: "json" },
245
+ });
239
246
 
240
247
  const answers = await runWizard(config, {
241
- mockAnswers: { env: 'staging', confirm: true }, // CI mode
248
+ mockAnswers: { env: "staging", confirm: true }, // CI mode
242
249
  onStepComplete: (stepId, value) => console.log(stepId, value),
243
250
  onCancel: () => process.exit(1),
244
251
  asyncValidate: async (stepId, value) => {
245
- if (stepId === 'env' && value === 'prod') return 'Use staging first'
246
- return null
252
+ if (stepId === "env" && value === "prod") return "Use staging first";
253
+ return null;
247
254
  },
248
- plugins: [], // GrimoirePlugin[] for custom step types
249
- cache: true, // persist answers as defaults on next run
250
- })
255
+ plugins: [], // GrimoirePlugin[] for custom step types
256
+ cache: true, // persist answers as defaults on next run
257
+ });
251
258
  ```
252
259
 
253
260
  Key `RunWizardOptions`: `mockAnswers`, `templateAnswers`, `onBeforeStep`, `onAfterStep`, `onStepComplete`, `onCancel`, `asyncValidate`, `plugins`, `cache`, `mru`, `renderer`, `quiet`, `plain`.
@@ -266,6 +273,14 @@ The reference doc covers the full schema, all step types, conditions, routes, ac
266
273
 
267
274
  ---
268
275
 
276
+ ## Contributors
277
+
278
+ Thanks to all the amazing contributors who have helped make this project better! 🎉
279
+
280
+ <a href="https://github.com/YosefHayim/grimoire/graphs/contributors">
281
+ <img src="https://contrib.rocks/image?repo=YosefHayim/grimoire" alt="Contributors" />
282
+ </a>
283
+
269
284
  ## Contributing
270
285
 
271
286
  Open to contributors. Check the [issues](https://github.com/YosefHayim/grimoire/issues) for good first tasks, or open one if you have an idea.