Show Prisma CLI path in version output
Summary
- add the resolved Prisma CLI script path to
prisma -v/prisma versionoutput - sanitize the path in the existing version command snapshot
Tests
npx prettier --check packages/cli/src/Version.ts packages/cli/src/__tests__/commands/Version.test.tsgit diff --check
Note: I attempted corepack pnpm --filter prisma test -- Version.test.ts, but this local Windows checkout could not build/link workspace packages such as @prisma/engines after install. The changed snapshot covers the intended output shape.
Fixes #7771
@algora-pbc /claim #7771
No actionable comments were generated in the recent review. ๐
โน๏ธ Recent review info
โ๏ธ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 88ce86c6-5794-455e-a9b2-987ac31966da
๐ฅ Commits
Reviewing files that changed from the base of the PR and between 42f91027828f3581066d01cc7f5d22a3006327d9 and 3c2629fd5b5e62cf4096509fad61df0efb860396.
๐ Files selected for processing (2)
packages/cli/src/Version.tspackages/cli/src/__tests__/commands/Version.test.ts
Summary by CodeRabbit
- New Features
- The
prisma versioncommand now displays the path to the Prisma CLI executable, showing the location of the CLI binary on your system.
- The
Walkthrough
This PR adds a "Prisma CLI path" field to the prisma -v version output, displaying the resolved absolute path of the executing Prisma CLI binary or "Unknown" if unavailable. Implementation and test snapshot are updated together.
Changes
CLI Path Output
| Layer / File(s) | Summary |
|---|---|
CLI path output implementation packages/cli/src/Version.ts |
Imports Node's path module and adds a "Prisma CLI path" row to the version table, resolving process.argv[1] via path.resolve() with "Unknown" fallback. |
Test snapshot and sanitization packages/cli/src/__tests__/commands/Version.test.ts |
Version test snapshot is updated to include the new "Prisma CLI path" line, and cleanSnapshot is extended to replace the path value with PRISMA_CLI_PATH placeholder for stable test runs. |
Estimated code review effort
๐ฏ 1 (Trivial) | โฑ๏ธ ~2 minutes
๐ฅ Pre-merge checks | โ 4 | โ 1
โ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | โ ๏ธ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
โ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | โ Passed | The title clearly and concisely describes the main change: adding the Prisma CLI path to version output. |
| Description check | โ Passed | The description is related to the changeset, explaining the addition of CLI path to version output and snapshot sanitization. |
| Linked Issues check | โ Passed | The PR successfully implements the requirement from issue #7771 by adding the resolved Prisma CLI script path to the prisma -v output. |
| Out of Scope Changes check | โ Passed | All changes are directly related to the linked issue #7771: adding CLI path reporting to version output and updating test snapshots accordingly. |
โ๏ธ Tip: You can configure your own custom pre-merge checks in the settings.
โจ Finishing Touches
๐งช Generate unit tests (beta)
- [ ] Create PR with unit tests
โจ Simplify code
- [ ] Create PR with simplified 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 @coderabbitai help to get the list of available commands and usage tips.
Thanks for the focused change โ the integration point (the rows array) and the sanitizer are right.
Blocking: the hand-written snapshot line is misaligned by one space. formatTable pads each label to the longest one (Default Engines Hash, 20 chars), so Prisma CLI path (15 chars) gets exactly 5 trailing spaces + : โ 6 spaces before the colon; the snapshot line has 7. Since your sanitizer preserves the real padding, the snapshot can never match and the test fails. The fix is to actually run the test and let Jest write the snapshot rather than hand-editing it (the PR notes the local environment couldn't build โ that's the missing step).
Also worth considering: path.resolve(process.argv[1]) points at the bin shim; fs.realpathSync would surface the actual install location.
We're triaging a large number of overlapping PRs for this issue. If we don't hear back within the next few days, we'll close this PR to keep the queue manageable.