fix(database): Refine database create output#77
Merged
Conversation
WalkthroughThis PR implements human-readable CLI output for database and connection creation commands. The output is now split across stderr (creation summary with project/branch context) and stdout (raw connection URL only), with proper verbosity controls. The command runner was refactored to handle quiet mode early and manage output ordering. New test infrastructure tracks per-stream writes, and integration tests now verify exact stderr/stdout content and separation. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Refines the human output for creating Prisma Postgres databases and database connections. The stream contract stays automation-friendly: human status goes to stderr, the one-time URL is the only default stdout value, and
--jsonremains JSON-only.Changes
docs/product/command-spec.mdanddocs/product/output-conventions.mdto document default, verbose, quiet, and JSON behavior for one-time database URLs.database createanddatabase connection createinpackages/cli/src/presenters/database.ts, with verbose metadata rows behind--verbose.packages/cli/src/shell/command-runner.tsso non-JSON commands with both human output and raw stdout emit stderr first, then stdout.--quietstill emits only raw stdout, and--jsonbypasses human/raw stdout presenters.Why
The first database command slice was functionally correct but too bare for interactive users. This keeps the machine contract intact while giving humans a clear success message and save-now warning without burying the URL under metadata.
Verification
pnpm --filter @prisma/cli test database.test.ts command-runner.test.tspnpm --filter @prisma/cli testpnpm --filter @prisma/cli buildgit diff --checkNote: one full-suite run timed out once in
project-real-mode.test.ts; the immediate rerun passed all 407 tests.Local Review
skills/engineering/tmp-code-review/: LGTM, no actionable findings.skills/engineering/thermonuclear-review/: conditional pass initially for runner stderr-writing shape; resolved by folding the separator into the human output writer path.