Skip to content

feat: Add interactive template selection prompts#30

Merged
Shooksie merged 1 commit intomainfrom
ao/task-201
Mar 22, 2026
Merged

feat: Add interactive template selection prompts#30
Shooksie merged 1 commit intomainfrom
ao/task-201

Conversation

@Shooksie
Copy link
Copy Markdown
Contributor

When running 'ao init' without --template flag, users now get an interactive template selection prompt when running in a terminal. This uses enquirer to display available templates with arrow-key navigation.

Key changes:

  • Add enquirer dependency for interactive CLI prompts
  • Create src/utils/prompts.ts with selectTemplateInteractive function
  • Add isInteractiveTerminal helper to detect TTY environments
  • Modify initCommand to show interactive selection when no --template flag is provided
  • Detection happens first, and detected type is pre-selected as default
  • Add PROMPT_CANCELLED error code for graceful handling of user cancellation
  • Add unit tests for the prompts utilities

The non-interactive behavior is preserved for CI/CD environments where stdin is not a TTY.

When running 'ao init' without --template flag, users now get an interactive
template selection prompt when running in a terminal. This uses enquirer
to display available templates with arrow-key navigation.

Key changes:
- Add enquirer dependency for interactive CLI prompts
- Create src/utils/prompts.ts with selectTemplateInteractive function
- Add isInteractiveTerminal helper to detect TTY environments
- Modify initCommand to show interactive selection when:
  - No --template flag is provided
  - Running in an interactive terminal
  - Not using --force flag
- Detection happens first, and detected type is pre-selected as default
- Add PROMPT_CANCELLED error code for graceful handling of user cancellation
- Add unit tests for the prompts utilities

The non-interactive behavior is preserved for CI/CD environments where
stdin is not a TTY. Users can still use --template to specify a template
non-interactively or rely on auto-detection.

Closes TASK-201
@Shooksie Shooksie merged commit 93857df into main Mar 22, 2026
0 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant