Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe PR updates CLI command registration and user-facing examples/messages for the database CLI. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
47a7ff9 to
e9f59b1
Compare
| const dbCommand = program | ||
| .command('db') | ||
| .alias('database') | ||
| .description(`Provision a production ready Postgres database with a single command`) | ||
| .addExamples(['netlify db status', 'netlify db init', 'netlify db init --help']) | ||
|
|
There was a problem hiding this comment.
To keep previous db command as is - this totally separate dbCommand for both code paths.
Otherwise there would be 3 ternary checking EXPERIMENTAL_NETLIFY_DB_ENABLED (for command, alias and currently existing addExamples
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/commands/database/db-status.ts`:
- Around line 48-49: Tests still assert the old CLI strings (e.g., "netlify db
connect", "netlify db status --show-credentials", "netlify db migrations
apply"); update those assertions to expect the renamed command format using
"database" (e.g., "database connect", "database status --show-credentials",
"database migrations apply"). Search test assertions that reference the old
strings and replace them with the new ones (or update expected values passed to
formatCommand calls) so they match the producer code that now calls
secondary(`Run ${formatCommand('database connect')}`) and similar formatCommand
usages.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cd718753-c204-45c8-95cd-0e9b04318534
📒 Files selected for processing (2)
src/commands/database/db-status.tssrc/commands/database/util/meta-commands.ts
✅ Files skipped from review due to trivial changes (1)
- src/commands/database/util/meta-commands.ts
Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/commands/database/database.ts`:
- Around line 74-77: Test coverage is missing for the alias routing of the
database command when EXPERIMENTAL_NETLIFY_DB_ENABLED=1; add an integration test
similar to tests/integration/commands/build/build-program.test.ts that starts
the CLI with the env var set and asserts that invoking "netlify db status" (and
other subcommands) dispatches to the database command implementation defined by
program.command('database') / dbCommand.alias('db'); the test should spawn the
CLI or invoke the program entry, set EXPERIMENTAL_NETLIFY_DB_ENABLED=1, run "db
status" and verify the expected output/exit code to ensure alias routing works
end-to-end.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0e7c0d73-5d44-4916-8c36-86ecc8a78bf6
📒 Files selected for processing (1)
src/commands/database/database.ts
| const dbCommand = program | ||
| .command('database') | ||
| .alias('db') | ||
| .description(`Provision a production ready Postgres database with a single command`) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Inspect database command tests for coverage that exercises the experimental `db` alias.
# Expected: At least one test sets EXPERIMENTAL_NETLIFY_DB_ENABLED=1 and invokes a `netlify db ...`
# command such as `db status`, `db connect`, `db reset`, or `db migrations ...`.
rg -n -C3 --type=ts \
'EXPERIMENTAL_NETLIFY_DB_ENABLED|netlify db (status|connect|reset|migrations)|\bdb (status|connect|reset|migrations)\b' \
tests src/commands/databaseRepository: netlify/cli
Length of output: 4309
🏁 Script executed:
fd -type f -name "*database*.test.ts" tests/Repository: netlify/cli
Length of output: 225
🏁 Script executed:
rg -n "command.*database|netlify database" tests/ --type ts | head -20Repository: netlify/cli
Length of output: 2710
🏁 Script executed:
grep -r "EXPERIMENTAL_NETLIFY_DB_ENABLED" tests/unit/commands/database/ --include="*.ts"Repository: netlify/cli
Length of output: 37
🏁 Script executed:
head -100 tests/unit/commands/database/db-status.test.tsRepository: netlify/cli
Length of output: 3412
🏁 Script executed:
find tests -name "*database*.test.ts" -type fRepository: netlify/cli
Length of output: 37
🏁 Script executed:
grep -r "\.command.*database\|\.alias.*db" tests/ --include="*.ts" -nRepository: netlify/cli
Length of output: 37
🏁 Script executed:
grep -r "process.env.EXPERIMENTAL_NETLIFY_DB_ENABLED" tests/ --include="*.ts" -A 3 -B 3Repository: netlify/cli
Length of output: 37
🏁 Script executed:
ls -la tests/unit/commands/database/Repository: netlify/cli
Length of output: 601
🏁 Script executed:
ls -la tests/integration/commands/ | grep -i databaseRepository: netlify/cli
Length of output: 37
🏁 Script executed:
rg "createDatabaseCommand|program\.command.*database" tests/ -A 5Repository: netlify/cli
Length of output: 37
🏁 Script executed:
rg "db.*status|database.*status" tests/unit/commands/database/ -n | head -5Repository: netlify/cli
Length of output: 438
🏁 Script executed:
cat tests/unit/commands/database/db-status.test.ts | grep -A 10 "import.*statusDb"Repository: netlify/cli
Length of output: 521
🏁 Script executed:
rg "test.*\(.*db.*\)" tests/unit/commands/database/db-status.test.ts | head -10Repository: netlify/cli
Length of output: 37
🏁 Script executed:
rg "program.*command|createDatabaseCommand" src/commands/database/database.ts -A 2 -B 2Repository: netlify/cli
Length of output: 287
🏁 Script executed:
find tests -name "*.test.ts" -exec grep -l "EXPERIMENTAL\|alias" {} \; | head -10Repository: netlify/cli
Length of output: 321
🏁 Script executed:
rg "test\(" tests/integration/commands/dev/dev.programmatic-netlify-dev.test.ts | grep -i dbRepository: netlify/cli
Length of output: 256
🏁 Script executed:
ls -la tests/integration/commands/dev/Repository: netlify/cli
Length of output: 1386
🏁 Script executed:
grep -r "netlify database\|netlify db" tests/integration/commands/ --include="*.ts" -n | head -10Repository: netlify/cli
Length of output: 37
🏁 Script executed:
rg "program.*baseCommand|BaseCommand" tests/ -l | head -5Repository: netlify/cli
Length of output: 283
🏁 Script executed:
cat tests/integration/commands/build/build-program.test.ts | head -50Repository: netlify/cli
Length of output: 1522
🏁 Script executed:
rg "database|alias" tests/integration/commands/build/build-program.test.tsRepository: netlify/cli
Length of output: 37
🏁 Script executed:
find tests -name "*program*.test.ts" -type fRepository: netlify/cli
Length of output: 177
🏁 Script executed:
grep -A 20 "createBuildCommand" tests/integration/commands/build/build-program.test.ts | head -30Repository: netlify/cli
Length of output: 1194
🏁 Script executed:
rg "createDatabaseCommand" tests/ --include="*.ts"Repository: netlify/cli
Length of output: 496
🏁 Script executed:
ls -la tests/integration/commands/ | grep databaseRepository: netlify/cli
Length of output: 37
🏁 Script executed:
grep -r "const program\|new BaseCommand" tests/integration/commands/build/ --include="*.ts" -A 3Repository: netlify/cli
Length of output: 935
🏁 Script executed:
rg "createDatabaseCommand" src/ -lRepository: netlify/cli
Length of output: 140
🏁 Script executed:
grep -r "createDatabaseCommand\|createBuildCommand\|createDeployCommand" src/commands/main.ts -A 2 -B 2Repository: netlify/cli
Length of output: 1119
🏁 Script executed:
find tests -name "*database*.test.ts" -path "*/integration/*" -type fRepository: netlify/cli
Length of output: 37
🏁 Script executed:
grep -r "createDatabaseCommand\|parseAsync.*database\|parseAsync.*db" tests/ -nRepository: netlify/cli
Length of output: 37
Add integration test for the db alias dispatch.
No test coverage exists for the database command routing when EXPERIMENTAL_NETLIFY_DB_ENABLED=1 is set. While unit tests verify individual command implementations, none test the alias dispatch. Add an integration test following the pattern in tests/integration/commands/build/build-program.test.ts to ensure netlify db status (and other subcommands) correctly routes through the alias when the experimental flag is enabled.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/commands/database/database.ts` around lines 74 - 77, Test coverage is
missing for the alias routing of the database command when
EXPERIMENTAL_NETLIFY_DB_ENABLED=1; add an integration test similar to
tests/integration/commands/build/build-program.test.ts that starts the CLI with
the env var set and asserts that invoking "netlify db status" (and other
subcommands) dispatches to the database command implementation defined by
program.command('database') / dbCommand.alias('db'); the test should spawn the
CLI or invoke the program entry, set EXPERIMENTAL_NETLIFY_DB_ENABLED=1, run "db
status" and verify the expected output/exit code to ensure alias routing works
end-to-end.
…s-to-database-with-db-aliases
…s-to-database-with-db-aliases
…s-to-database-with-db-aliases
🤖 I have created a release *beep* *boop* --- ## [25.2.0](v25.1.1...v25.2.0) (2026-04-22) ### Features * use database as primary name for new db subcommands ([#8176](#8176)) ([40e56cf](40e56cf)) ### Bug Fixes * don't cause fatal issues when doing update checks inside of agent sandbox ([#8186](#8186)) ([acaf478](acaf478)) * filter out intentional user-input errors from error-reporting-lamda ([#8188](#8188)) ([b5b60e3](b5b60e3)) * improve reliability of anon deploys ([#8170](#8170)) ([95b5e52](95b5e52)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com>
🎉 Thanks for submitting a pull request! 🎉
Summary
Swaps
dbcommand (withdatabasealias) for thedatabasecommand (withdbalias). All previously working commands will continue to work. Main impact is what--helpwould printFor us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)