Skip to content

feat(cli): report executed prisma binary path in --version output - #30585

Open
Yumihariii wants to merge 3 commits into
prisma:mainfrom
Yumihariii:fix/version-bin-path
Open

Yumihariii wants to merge 3 commits into
prisma:mainfrom
Yumihariii:fix/version-bin-path

Conversation

@Yumihariii

@Yumihariii Yumihariii commented Oct 5, 2026 •

Copy link
Copy Markdown

Summary

prisma --version only prints the version string, so when a project runs a hoisted or global prisma you cannot tell which installation is actually executing. This makes the "Output path of current Prisma in -v" request from #7771 impossible to diagnose.

This PR makes the CLI report the absolute path of the executed prisma binary in the version output:

  • human output now includes a Path: <absolute path> line (mirroring how yarn shows the resolved binary path);
  • json output (--format json) adds a path field alongside version in the result envelope.

Implementation

The --version command is settled by @prisma/cli-engine's settleVersion. I patched that package via pnpm.patchedDependencies to resolve and print the executed binary path from process.argv[1] (resolved through symlinks with realpathOr). The existing --version --format json contract is unchanged — the new path field is additive.

Verification

  • node dist/bin.mjs --version → 8.0.0-rc.14 + Path: /…/cli/dist/bin.mjs
  • node dist/bin.mjs --version --format json → { "version": "8.0.0-rc.14", "path": "/…/cli/dist/bin.mjs" }
  • pnpm vitest run test/version.test.ts → 1 passed

Closes #7771.

Summary by CodeRabbit

  • New Features
    • Version output now includes the resolved path of the current executable when available. In human-readable output, the path appears after the version; in JSON output, it is provided as a path field.
    • When the executable path is unavailable, the version is still displayed and the path is omitted from both output formats. This keeps version information available even when no executable path can be determined.

@Yumihariii
Yumihariii requested a review from a team as a code owner October 5, 2026 06:39
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: prisma/orm/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b31f44af-14fa-4b36-b244-4d0f5edc9de7
📥 Commits

Reviewing files that changed from the base of the PR and between 292da5f and fc5d4b5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • patches/@prisma__cli-engine.patch
🚧 Files skipped from review as they are similar to previous changes (1)
  • patches/@prisma__cli-engine.patch

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The root pnpm configuration registers a patch for @prisma/cli-engine. The patch adds the resolved executable path to text and JSON version output when available.

Changes

Version output path

Layer / File(s) Summary
Configure and apply executable path reporting
package.json, patches/@prisma__cli-engine.patch
The root pnpm configuration registers the cli-engine patch. The patch resolves the current executable path and adds it to text and JSON version results when available.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature · Severity of issue fixed: Low

Suggested reviewers: wmadden-electric

Merge Risk: ⚪ Minimal · up to fc5d4

The version output change appears mergeable with normal checks.

Architecture Summary

Architecture risk: 🔵 Low · up to 292da

The change affects 2 systems.

Changed systems: package.json, patches

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — package.json (service) was modified; 1 changed file maps to changed impact.
  • observed — patches (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in package.json: Added a patchedDependencies entry mapping @prisma/cli-engine to its patch file in the root pnpm configuration.
  • observed — Modified behavior in patches/@prisma__cli-engine.patch: settleVersion now obtains the current executable path and includes it in human-readable and JSON version output when available. The new currentBinPath helper returns undefined if process.argv[1] is absent; otherwise, it resolves that entry with realpathOr.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: reporting the executed Prisma binary path in --version output.
Linked Issues check ✅ Passed Issue #7771 is closed and provides historical context only. No active directly linked target remains. Therefore, no linked-issue coding requirements apply.
Out of Scope Changes check ✅ Passed The changes are limited to the @prisma/cli-engine patch and its declaration in package.json. They add the executed binary path to human-readable and JSON version output. These changes match the st…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@Yumihariii
Yumihariii force-pushed the fix/version-bin-path branch 2 times, most recently from 1c815e6 to 9ee1aca Compare October 7, 2026 11:49
@Yumihariii

Copy link
Copy Markdown
Author

@janpio this is still waiting on a human review — it's mergeable and CodeRabbit found nothing actionable. It's a small, backward-compatible change (adds a Path:/path line to the -v output). Would appreciate a look when you get a chance. Happy to adjust anything.

Yumihariii added 2 commits October 8, 2026 15:03
Signed-off-by: Yumihariii <bot@example.com>
Rebase onto latest upstream main. Upstream bumped @prisma/cli-engine to 0.7.0,
whose built dist file was renamed to dist/engine-DVJ5Ie5H.js. Update patch
target filename accordingly; patch verified to apply cleanly on cli-engine 0.7.0.
Regenerated pnpm-lock.yaml to register the new patch hash.

Signed-off-by: Yumihariii <bot@example.com>
@Yumihariii
Yumihariii force-pushed the fix/version-bin-path branch from 9ee1aca to 292da5f Compare October 8, 2026 07:07
pnpm cannot apply the previous patch: its hunks were generated from an older
cli-engine build with a 421-line offset, and the index blob hashes were stale.
Regenerated the patch as a clean git diff against @prisma/cli-engine@0.7.0
(dist/engine-DVJ5Ie5H.js) with accurate line numbers and blob hashes. pnpm now
applies it cleanly (verified: currentBinPath present in installed package).
Lockfile hash regenerated accordingly.

Signed-off-by: Yumihariii <bot@example.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output path of current Prisma in -v

1 participant