feat: Add interactive template selection prompts#29
Conversation
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
PR Review StatusPR Merge Conflict Detected This PR has merge conflicts with the recently merged PR #28 (feat: add CLI UX flags). Conflict Details
Code Review Findings (additional issues)
Resolution RequiredManual conflict resolution and code fixes needed:
git fetch origin
git checkout ao/task-201
git rebase origin/main
# Resolve conflicts in src/commands/init.ts
# Replace console.log with logger calls
git add src/commands/init.ts
git rebase --continue
git push --force-with-lease
Failed Rebase Attempt: 1/3 - This PR will be closed after 3 failed rebase attempts. |
Shooksie
left a comment
There was a problem hiding this comment.
Code Review - Issues Found
ESLint Errors (Must Fix)
src/utils/prompts.ts:69-'NodeJS' is not defined- Import the type from@types/nodeor use a different approachsrc/utils/prompts.ts:129-'value' is defined but never used- Remove or use the variable
Code Quality
The PR uses console.log() directly but main has been refactored to use the logger API:
import { logger } from '../utils/logger.js';
// Instead of console.log(chalk.gray(...))
logger.info(chalk.gray(...));What's Good
- TypeScript types are properly defined for exported interfaces
- Security audit passes (0 vulnerabilities)
- Feature is well-designed with graceful cancellation handling
- Tests are included
Next Steps
- Rebase on latest main (resolve merge conflict in
src/commands/init.ts) - Fix ESLint errors
- Replace
console.logcalls withloggerAPI calls
PR Review SummaryStatus: Needs Revision (Failed Rebase Attempt: 1/3) Code Quality Review: ✅ Good with 2 ESLint errorsThe code is well-structured and functional (197 tests pass). However, there are 2 ESLint errors that must be fixed: ESLint Errors (Must Fix)
Merge ConflictConflicts with PR #28 (logger API changes) in . After rebasing on main:
Positive Findings
Action Required
After fixes, I will merge this PR. The feature is well-implemented and adds valuable UX improvement for |
PR Review Status - Rebase Attempt 1/3Status: Conflicts with main branch Current Issues (Must Resolve)
Required Actions
git fetch origin
git checkout ao/task-201
git rebase origin/main
git push --force-with-leaseAfter fixes are pushed, I will re-review and merge if everything passes. This is Rebase Attempt 1/3. PR will be closed after 3 failed rebase attempts. |
PR Review Status - Rebase Attempt 1/3Status: Conflicts with main branch Current Issues (Must Resolve)
Required Actions
After fixes are pushed, I will re-review and merge if everything passes. This is Rebase Attempt 1/3. PR will be closed after 3 failed rebase attempts. |
PR Review Status - Current AttemptStatus: Needs Revision (Failed Rebase Attempt: 1/3) Code Quality Review
Issues Requiring Fix1. ESLint Errors (src/utils/prompts.ts)Fix:
2. Merge Conflict (src/commands/init.ts)Rebase on main and replace git fetch origin
git checkout ao/task-201
git rebase origin/main
# Resolve conflicts
git push --force-with-leaseFeature AssessmentThis is a well-implemented feature that adds valuable UX. Once conflicts are resolved and ESLint errors fixed, this PR is mergeable. Automated review by ao-starter workflow |
PR Review Status - Rebase Attempt 2/3Status: Still Needs Revision I checked your latest commits and ran linting. The following issues remain: ESLint Errors (Must Fix) in
|
| Line | Error | Fix |
|---|---|---|
| 69 | 'NodeJS' is not defined |
Change (error as NodeJS.ErrnoException) to (error as { code?: string }) |
| 129 | 'value' is defined but never used |
Rename parameter to _value per ESLint config (argsIgnorePattern: '^_') |
Merge Conflict with main
When rebasing on origin/main, there is a conflict in src/commands/init.ts:
- Main imports:
import { setLoggerConfig, logger } from '../utils/logger.js'; - Your PR is missing the logger import and uses
console.log
Required Actions
- Rebase on latest main:
git fetch origin git rebase origin/main
- Resolve conflict in src/commands/init.ts:
- Add
import { setLoggerConfig, logger } from '../utils/logger.js';after other imports - Replace
console.logwithlogger.info()calls where appropriate
- Add
- Fix ESLint errors in src/utils/prompts.ts:
- Line 69: Change
(error as NodeJS.ErrnoException)to(error as { code?: string }) - Line 129: Rename
valueparameter to_value
- Line 69: Change
- Push changes:
git push --force-with-lease
What's Working Well
- Feature is well-designed and adds good UX
- Proper error handling for user cancellation (PROMPT_CANCELLED)
- Graceful degradation for non-interactive terminals
- Tests included
After fixes are pushed, I will re-review and merge if all checks pass.
This is Rebase Attempt 2/3. PR will be closed after 3 failed rebase attempts.
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:
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