GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix prisma/prisma#7771 by baronguyen001 · Pull Request #29585 · prisma/orm

Conversation

@baronguyen001

@baronguyen001 baronguyen001 commented May 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Summary

Adds an installed-path row to prisma -v / prisma version so users can see which prisma package the running CLI was loaded from.

This is the exact debugging information requested in #7771: in the original report, yarn prisma -v told the user that engines came from node_modules/@prisma/engines, but that directory did not exist in the project - because the executed CLI actually lived in a parent project's node_modules. Today the -v output gives no way to tell that the running CLI is outside the local install.

Closes #7771

Changes

packages/cli/src/Version.ts (+4)

  • Imports path.
  • Computes prismaCliPath = path.resolve(__dirname, '..'). This resolves to the package root in both source layout (src/..) and bundled layout (build/..), so it points at the directory containing the package.json that defines the running CLI - matching the issue author's suggested solution.
  • Appends a ['Prisma CLI Path', prismaCliPath] row at the end of the rows array. Putting it last avoids reflowing any existing snapshot order above it, and it shows up automatically in --json output as the prisma-cli-path key (since formatTable slugifies row labels for JSON mode).

packages/cli/src/__tests__/commands/Version.test.ts (+3/-1)

  • Adds the new Prisma CLI Path : sanitized_cli_path line to the inline snapshot. Padding (6 chars between Path and :) matches formatTable's padEnd(maxPad) where maxPad stays at 20 (Default Engines Hash is still the longest label, Prisma CLI Path is 15 chars, so 5 spaces of padding plus :).

  • Adds a sanitizer line to cleanSnapshot:

    str = str.replace(new RegExp('(Prisma CLI Path\\s+:).*', 'g'), '$1 sanitized_cli_path')

    The double-escaped \\s+ (two backslashes in the TS source, one in the resulting regex) mirrors the existing Operating System / Architecture sanitizers two lines above it. A single-escaped \s+ inside a string-form RegExp would be parsed as the literal characters s+, which is the bug that prevented snapshots from stabilising in the prior attempt at this issue (PR feat(cli): add Prisma CLI path to version output #29275).

How tested

  • Verified the snapshot alignment by reading packages/internals/src/utils/formatTable.ts: maxPad = max(label.length), then each row renders as ${label.padEnd(maxPad)} : ${value}. With Default Engines Hash (20) still the longest label and Prisma CLI Path being 15 characters, the row formats to Prisma CLI Path plus 5 spaces, then : value - which is exactly what the updated inline snapshot shows.
  • Verified the sanitizer regex by mirroring the exact form used for Operating System and Architecture two lines above it in the same cleanSnapshot function (string-form RegExp with double-escaped \\s+).
  • Did not run pnpm --filter prisma test -- Version.test.ts locally. The fork was a shallow clone without node_modules, and a full pnpm install on this monorepo would not have finished in the time I had. If the inline snapshot drifts for an unrelated reason (e.g. row order changes elsewhere), regenerating with pnpm jest -u should produce a one-line diff. Happy to push a follow-up commit with the regenerated snapshot once CI surfaces any drift.
  • Cross-checked prior attempts on this issue: PR feat(cli): add Prisma CLI path to version output #29275 (currently the lead, but stale since 2026-02-28) uses the same path.resolve(__dirname, '..') approach and got CHANGES_REQUESTED from @jacek-prisma for snapshot failures - the root cause being the single-escaped \s+ in their sanitizer. This PR uses the correctly escaped \\s+ form.

Notes for reviewers

  • No behavioural change to the rest of the version command - only an additional row.
  • --json output gains a prisma-cli-path key without any extra plumbing (handled by formatTable's existing slugify).
  • The path value is absolute. On Windows it will be backslash-separated, on POSIX forward-slash - same as Node's path.resolve everywhere else in the CLI.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@baronguyen001
feat(cli): add Prisma CLI install path to version output
a199bf4
Resolves the path of the installed `prisma` package (which `package.json`
the running CLI was loaded from) and surfaces it as a new `Prisma CLI Path`
row in `prisma -v` / `prisma version` output. Helps debug the
"yarn prisma uses a higher node_modules" case described in prisma#7771 where
the executed CLI lives outside the project's local node_modules.

- Adds `path.resolve(__dirname, '..')` — works in both source (`src/..`)
  and bundled (`build/..`) layouts.
- Row is appended at the end so existing snapshot ordering above it stays
  stable, and shows up automatically in `--json` output as
  `prisma-cli-path`.
- Updates `Version.test.ts` inline snapshot and adds a sanitizer rule
  matching the existing `(Label\s+:).*` pattern (so the test passes
  cross-platform regardless of the actual install directory).

Closes prisma#7771
@baronguyen001 baronguyen001 mentioned this pull request May 24, 2026
Output path of current Prisma in -v #7771
Closed
@CLAassistant

CLAassistant commented May 24, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented May 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 62085b4c-acb6-4921-9736-721a402cebb2

📥 Commits

Reviewing files that changed from the base of the PR and between 42f9102 and a199bf4.

📒 Files selected for processing (2)
  • packages/cli/src/Version.ts
  • packages/cli/src/__tests__/commands/Version.test.ts

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting


Summary by CodeRabbit

  • New Features
    • The prisma version command now displays the resolved Prisma CLI Path in its output, providing additional diagnostic information when running prisma -v or prisma version.

Walkthrough

The PR adds a "Prisma CLI Path" field to the prisma version command output. The implementation computes the CLI root path via path.resolve(__dirname, '..') and includes it in the output table. Tests and snapshot helpers are updated to expect and validate this new field.

Changes

CLI Path Display

Layer / File(s) Summary
CLI path computation and output
packages/cli/src/Version.ts, packages/cli/src/__tests__/commands/Version.test.ts
prismaCliPath is computed from __dirname and added as a row to the version output table. Test snapshots and the cleanSnapshot helper are updated to verify the new field with environment-agnostic path sanitization.

🎯 2 (Simple) | ⏱️ ~8 minutes

✨ 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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@baronguyen001
baronguyen001 marked this pull request as ready for review May 24, 2026 08:31
@baronguyen001 baronguyen001 closed this May 24, 2026
@baronguyen001 baronguyen001 reopened this May 24, 2026
@tensordreams
tensordreams changed the base branch from main to v7 July 21, 2026 12:05
@tensordreams
tensordreams changed the base branch from v7 to main July 21, 2026 15:11
@tensordreams

tensordreams commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Hi @baronguyen001 — thanks for this, and apologies for the slow reply.

We're clearing the open PR backlog ahead of moving this codebase to a v7 branch, with the Prisma Next rewrite taking over main.

We are closing this one: the CLI path output has already landed in #29573, and the remaining test coverage and follow-up are being consolidated in #29613. Keeping another implementation open would duplicate that work.

Thanks for the time you put into it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tensordreams tensordreams closed this Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Output path of current Prisma in -v

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@baronguyen001 @CLAassistant @tensordreams
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.