feat(cli): add --migrations and --verbose flags to setup neon#1830
feat(cli): add --migrations and --verbose flags to setup neon#1830lisa-assistant wants to merge 1 commit into
Conversation
- Prompt user whether to run Prisma migrations (instead of always running) - Add --migrations boolean flag to skip the prompt; --no-migrations skips migrations - Add --verbose flag to pipe stderr to stdout for better diagnostics
👷 Deploy request for cedarjs pending review.Visit the deploys page to approve it
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t build:pack --exclude create-ceda... |
✅ Succeeded | 4s | View ↗ |
nx run-many -t build |
✅ Succeeded | 5s | View ↗ |
nx run-many -t test --minWorkers=1 --maxWorkers=4 |
✅ Succeeded | 1m 11s | View ↗ |
nx run-many -t test:types |
✅ Succeeded | 7s | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-05-27 09:58:00 UTC
Greptile SummaryThis PR adds
Confidence Score: 3/5The command can silently abort mid-run in CI; needs a non-TTY guard before merging. The prompt-before-tasks placement means that in any environment where stdin is not a TTY (CI pipelines, scripted deployments), packages/cli/src/commands/setup/neon/neonHandler.ts — specifically the prompt block and its non-TTY handling around lines 47–61 Important Files Changed
Reviews (1): Last reviewed commit: "feat(cli): add --migrations and --verbos..." | Re-trigger Greptile |
| if (runMigrations === undefined) { | ||
| const response = await prompts({ | ||
| type: 'toggle', | ||
| name: 'runMigrations', | ||
| message: 'Run Prisma migrations now?', | ||
| initial: true, | ||
| active: 'Yes', | ||
| inactive: 'No', | ||
| }) | ||
| // prompts returns undefined for the value if the user ctrl-c's | ||
| if (response.runMigrations === undefined) { | ||
| process.exit(0) | ||
| } | ||
| runMigrations = response.runMigrations | ||
| } |
There was a problem hiding this comment.
Silent exit in non-interactive (CI) environments
When migrations is not provided and stdin is not a TTY — the typical case in CI — prompts returns an empty object {} immediately, so response.runMigrations is undefined. The code then calls process.exit(0), silently aborting setup after all earlier tasks (schema switch, adapter update, Neon provisioning, .env write) have already completed. A CI pipeline that relied on migrations running automatically will now silently exit with code 0 partway through, leaving the database un-migrated with no diagnostic output.
A safe guard would be to detect a non-TTY stdin before calling prompts and either default to true or exit with a clear error message instructing the caller to pass --migrations or --no-migrations explicitly.
| if (!runMigrations) { | ||
| return 'Skipped (--no-migrations)' | ||
| } |
There was a problem hiding this comment.
The skip message
'Skipped (--no-migrations)' is displayed even when the user simply answered "No" to the interactive prompt rather than passing the flag. A user who answered the prompt will see a message that implies they used a command-line flag they never typed, which is confusing.
| if (!runMigrations) { | |
| return 'Skipped (--no-migrations)' | |
| } | |
| if (!runMigrations) { | |
| return migrations === false | |
| ? 'Skipped (--no-migrations)' | |
| : 'Skipped' | |
| } |
| .option('verbose', { | ||
| alias: 'v', | ||
| default: false, | ||
| description: 'Show full output from migration commands (stderr → stdout)', |
There was a problem hiding this comment.
The description says "stderr → stdout" but the implementation uses
stdio: 'inherit', which keeps stderr on the parent's stderr stream — it does not redirect it to stdout. A reader of --help output would expect the two streams to be merged, but that's not what happens.
| description: 'Show full output from migration commands (stderr → stdout)', | |
| description: 'Show full output from migration commands (stderr visible in terminal)', |

What
Adds two new flags to
yarn cedar setup neonand changes the default migration behavior:Before: migrations always ran automatically after setup.
After: the command prompts whether to run migrations. The prompt can be bypassed with flags:
--migrations/--no-migrations— skip the prompt, run or skip migrations explicitly--verbose/-v— pipe migration command stderr to stdout for better diagnostics (useful when debugging migration failures)Changes
neon.ts: added--migrations(optional boolean, no default → prompts when absent) and--verbose(boolean, default false) to yargs builder andArgsinterfaceneonHandler.ts:import prompts from 'prompts'(already a dep of@cedarjs/cli)skipchecks!runMigrations→'Skipped (--no-migrations)'stdioswitches between'inherit'(verbose) and['inherit', 'inherit', 'pipe'](non-verbose)