-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
Milestone
Description
Summary
The dev design states: "For some of these, e.g. component, solution name, component name, etc, if they are not specified we will fallback to an interactive flow." Currently, all required parameters (--template, --component-name, --library-name) are strictly required — omitting any causes an error with no interactive recovery.
Requirements
Interactive prompts for missing parameters
When the following parameters are not provided via flags, the CLI should interactively prompt for them:
| Parameter | Prompt type | Notes |
|---|---|---|
--template |
List selection | Show available templates (from list-templates logic), let user pick |
--solution-name |
Text input | Prompt for solution name |
--component-name |
Text input | Prompt for component display name |
--library-name |
Text input | Could auto-derive from solution-name + component-name |
--package-manager |
Choice selection | npm / pnpm / yarn |
Behavior
- Interactive mode is the default when running in a TTY
- When stdin is not a TTY (piped input, CI), missing required params should still error
--ci-modeor similar flag should explicitly disable interactive prompts- Prompts should have sensible defaults where possible (e.g., derive library-name from component-name)
UX flow (example)
$ spfx create
? Choose a template: (Use arrow keys)
❯ webpart-minimal - A minimal SPFx web part
webpart-react - A React-based SPFx web part
extension-application-customizer - An application customizer
...
? Solution name: my-solution
? Component name: Hello World
? Package manager: (npm)
Implementation notes
- Consider using
inquireror@inquirer/promptsfor interactive prompts - TTY detection:
process.stdin.isTTY - Each prompt should validate input inline (e.g., solution name format)
- After all prompts, show a summary and confirm before scaffolding
Dependencies
list-templates(Implementlist-templatesCLI command #89) for template selection prompt--solution-name(Add--solution-nameflag tocreatecommand #93) for the solution name parameter--package-manager(Add--package-managerflag tocreatecommand #94) for the package manager parameter
Acceptance criteria
- Running
spfx createwith no flags enters interactive mode in a TTY - Each missing required parameter is prompted for
- Providing a flag skips its corresponding prompt
- Non-TTY environments error on missing required params
- Input validation occurs inline during prompting
- User can cancel (Ctrl+C) gracefully at any prompt
Reactions are currently unavailable