prisma icon indicating copy to clipboard operation
prisma copied to clipboard

feat(cli): show Prisma CLI path in version output

Open SadmanPinon opened this issue 6 months ago โ€ข 4 comments

/claim #7771 Fixes #7771

Summary

  • Add the Prisma CLI package path to prisma -v / prisma version output.
  • Resolve the path from the CLI package.json so the output points at the installation responsible for the running CLI.
  • Update the version command snapshot sanitization for the new path row.

Demo / Review Proof

  • Short demo video: https://github.com/SadmanPinon/bounty-proof-assets/blob/main/demos/prisma-7771-demo.mp4

Validation

  • corepack pnpm --filter "prisma..." build
  • corepack pnpm --filter prisma build
  • corepack pnpm --filter prisma test src/tests/commands/Version.test.ts
  • corepack pnpm exec eslint packages/cli/src/Version.ts packages/cli/src/tests/commands/Version.test.ts
  • corepack pnpm exec prettier --check packages/cli/src/Version.ts packages/cli/src/tests/commands/Version.test.ts
  • node packages/cli/build/index.js -v

Note: local Node was v23.7.0, so pnpm printed the repo engine warning (^20.19 || ^22.12 || >=24.0), but the build and targeted test passed.

SadmanPinon avatar May 21 '26 05:05 SadmanPinon

Review Change Stack

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: 18b7e9d5-5e9d-4803-b643-4a325a2f24c4

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 0f34153525cb6b27b8099feb4d5e073442d5b81c and 0300afebee3cd4e4d68de40a239b8c9e2e4562d6.

๐Ÿ“’ Files selected for processing (1)
  • packages/cli/src/__tests__/commands/Version.test.ts

Summary by CodeRabbit

Release Notes

  • New Features
    • The CLI version command now displays the Prisma CLI Path, showing the installation location of the Prisma CLI package alongside other version information.

Walkthrough

The PR extends the Prisma CLI version command to include the local CLI package filesystem path in its output. It resolves the package.json location at runtime, derives the directory path, and adds a "Prisma CLI Path" row to the version output table. Tests and snapshot sanitization were updated to account for the new output row.

Changes

Prisma CLI Path Version Output

Layer / File(s) Summary
Version command path output implementation
packages/cli/src/Version.ts
node:path module is imported. The Prisma CLI package path is computed from require.resolve('../package.json') using dirname() and inserted as a new "Prisma CLI Path" row in the version output table.
Test snapshot and sanitization
packages/cli/src/__tests__/commands/Version.test.ts
The version command test snapshot is updated to reflect the new Studio and Prisma CLI Path output rows. The cleanSnapshot helper is extended to sanitize the Prisma CLI Path value to sanitized_path for consistent test snapshots.

๐ŸŽฏ 1 (Trivial) | โฑ๏ธ ~3 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 'feat(cli): show Prisma CLI path in version output' clearly and specifically summarizes the main change in the PR.
Description check โœ… Passed The description is directly related to the changeset, detailing implementation of CLI path display, path resolution strategy, and test updates.
Linked Issues check โœ… Passed The PR fully implements the requirements from issue #7771: shows Prisma CLI path in version output using package.json resolution, working across different invocation methods.
Out of Scope Changes check โœ… Passed All changes are scoped to implementing the feature: modifications to Version.ts for path display and corresponding test snapshot updates are directly aligned with issue #7771.

โœ๏ธ 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.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar May 21 '26 05:05 coderabbitai[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 21 '26 06:05 CLAassistant

Thanks โ€” this is a clean, minimal implementation: the row resolution mirrors the existing require('../package.json') pattern, and the snapshot + sanitizer updates in Version.test.ts are correct.

Two asks:

  1. Please sign the CLA (link in the thread above) โ€” it's required before we can merge.
  2. Optional, but it would round this out: a --json assertion on the slugified prisma-cli-path key so both output modes are covered.

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.

tensordreams avatar Jun 04 '26 08:06 tensordreams

Thanks for the review. The CLA is signed now, and I added coverage for the --json output using the slugified prisma-cli-path key.

Validation run:

corepack pnpm --filter prisma test src/__tests__/commands/Version.test.ts

Result: passed (2 tests, 2 snapshots).

SadmanPinon avatar Jun 08 '26 04:06 SadmanPinon