You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a --wizard built-in flag that launches an interactive, step-by-step guided mode for constructing and executing commands. This mode walks users through all available options, arguments, and subcommands using interactive prompts.
Motivation
Complex CLI tools with many subcommands and options can be overwhelming for new users. Wizard mode provides a guided experience that:
Improves discoverability: Users can explore all available options without reading help text
Reduces errors: Each value is validated as it's entered
Lowers the learning curve: New users can build commands interactively before memorizing flags
This is inspired by @effect/cli's --wizard flag, which is a distinctive feature among CLI frameworks.
In practice, wizard mode iterates over all command fields and uses the same prompt primitives (text, confirm, select, etc.) to collect values, regardless of whether individual fields have prompt metadata configured.
Proposed Behavior
$ mycli --wizard
? Which command would you like to run? › (Use arrow keys)
❯ greet - Greet someone
build - Build the project
deploy - Deploy to production
? What is your name? (--name) › Alice
? Enable verbose output? (--verbose) › No
? Output format? (--format) › json
Running: mycli greet --name Alice --format json
Flow
If the command has subcommands, present a selection prompt
For each argument/option in the selected command:
Show a prompt appropriate to the field type (inferred from Zod schema)
Pre-fill with default values where available
Validate input immediately using the Zod schema
Display the constructed command for confirmation
Execute the command
Schema-Driven Prompt Generation
Since politty already extracts rich metadata from Zod schemas (via schema-extractor.ts), wizard mode can automatically generate appropriate prompts:
Summary
Add a
--wizardbuilt-in flag that launches an interactive, step-by-step guided mode for constructing and executing commands. This mode walks users through all available options, arguments, and subcommands using interactive prompts.Motivation
Complex CLI tools with many subcommands and options can be overwhelming for new users. Wizard mode provides a guided experience that:
This is inspired by
@effect/cli's--wizardflag, which is a distinctive feature among CLI frameworks.Relationship with Interactive Prompts (#147)
Wizard mode is built on top of the interactive prompt infrastructure from #147. The key difference:
--wizardflag)prompt: trueIn practice, wizard mode iterates over all command fields and uses the same prompt primitives (text, confirm, select, etc.) to collect values, regardless of whether individual fields have
promptmetadata configured.Proposed Behavior
Flow
Schema-Driven Prompt Generation
Since politty already extracts rich metadata from Zod schemas (via
schema-extractor.ts), wizard mode can automatically generate appropriate prompts:z.string()z.number()z.boolean()z.enum([...])z.string().optional()z.string().default("x")z.discriminatedUnion(...)Implementation Notes
--wizardshould be a reserved built-in option (similar to--helpand--version)politty/wizardor similar) to avoid bloating the coreDepends On