feat(cli): rename stash init --prisma-next to --prisma - #853
Conversation
Make the Prisma integration flag consistent with `--supabase` and `--drizzle`. `stash init --prisma` selects the same Prisma Next setup flow (EQL bundle installed via `prisma-next migrate`, schema derived from contract.json, no encryption-client scaffold) and records `prisma` as the referrer. The internal `Integration` value stays `prisma-next`, so skill, adapter dependency, schema, and EQL-install wiring are unchanged — only the user-facing flag and `provider.name` change. The removed `--prisma-next` flag now errors with guidance to re-run with `--prisma` rather than silently falling through to auto-detection. Updates the bundled stash-cli and stash-prisma skills and the command registry to match. CIP-3691
🦋 Changeset detectedLatest commit: fae3df0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesPrisma CLI migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant initCommand
participant buildSchemaStep
participant installEqlStep
participant PrismaNextMigration
User->>initCommand: stash init --prisma
initCommand->>buildSchemaStep: run with provider prisma
buildSchemaStep-->>initCommand: select prisma-next and skip schema scaffolding
initCommand->>installEqlStep: run Prisma Next path
installEqlStep-->>initCommand: skip standard EQL installation
PrismaNextMigration->>PrismaNextMigration: install EQL via prisma-next migrate
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
| **Authenticate before `stash init`.** Init's authenticate step uses the interactive path, so an agent running `init` unauthenticated makes the CLI try to open a browser on the agent's machine — and in a non-TTY it exits with `region_required` unless `--region` or `STASH_REGION` is set. Once a valid token exists, init logs `Using workspace X (region)` and moves on silently. | ||
|
|
||
| Flags: `--region <slug>` (env `STASH_REGION`), `--json`, `--no-open`, `--supabase` / `--drizzle` (referrer tracking only). | ||
| Flags: `--region <slug>` (env `STASH_REGION`), `--json`, `--no-open`, `--supabase` / `--drizzle` / `--prisma` (referrer tracking only). |
There was a problem hiding this comment.
Remove "(referrer tracking only)" from this text.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/commands/init/providers/prisma.ts`:
- Around line 4-14: Separate Prisma provider identity from its referrer name: in
packages/cli/src/commands/init/providers/prisma.ts:4-14 add a dedicated
provider/integration discriminator while retaining name: 'prisma'. In
packages/cli/src/commands/init/steps/build-schema.ts:64-66, use that
discriminator to force the 'prisma-next' integration, and in
packages/cli/src/commands/init/steps/install-eql.ts:49-53, use the resolved
Prisma Next discriminator when skipping standalone EQL installation.
In `@packages/cli/src/commands/init/steps/__tests__/build-schema.test.ts`:
- Line 87: Replace the type-erasing provider cast in build-schema.test.ts at
lines 87-87 with the real provider factory or a properly typed test double.
Apply the same typed construction in install-eql.test.ts at lines 119-119,
preserving the existing test behavior without adding undocumented type
assertions.
In `@skills/stash-cli/SKILL.md`:
- Line 228: Update the init — scaffold documentation to explicitly distinguish
the --prisma workflow: state that Prisma Next skips the encryption-client
placeholder and derives its schema from contract.json, and make the
./src/encryption/index.ts generated-file entry conditional or exclude it for
Prisma. Keep the standard scaffold behavior documented for non-Prisma options.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0dd9f5b7-63f8-42bd-9491-ae870829eab7
📒 Files selected for processing (12)
.changeset/cli-init-prisma-flag.mdpackages/cli/src/cli/registry.tspackages/cli/src/commands/init/__tests__/init-command.test.tspackages/cli/src/commands/init/index.tspackages/cli/src/commands/init/providers/__tests__/prisma.test.tspackages/cli/src/commands/init/providers/prisma.tspackages/cli/src/commands/init/steps/__tests__/build-schema.test.tspackages/cli/src/commands/init/steps/__tests__/install-eql.test.tspackages/cli/src/commands/init/steps/build-schema.tspackages/cli/src/commands/init/steps/install-eql.tsskills/stash-cli/SKILL.mdskills/stash-prisma/SKILL.md
There was a problem hiding this comment.
Pull request overview
This PR standardizes stash init’s Prisma integration flag by renaming --prisma-next to --prisma, aligning it with the existing --supabase / --drizzle naming and updating referrer tracking to "prisma" while keeping the internal integration identifier as prisma-next.
Changes:
- Add
stash init --prismaand wire it to the existing Prisma Next init flow (internally stillprisma-next). - Make
--prisma-nexta hard error with guidance to re-run using--prisma. - Update shipped skills/docs plus unit tests and the CLI registry/manifest surface.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| skills/stash-prisma/SKILL.md | Updates Prisma Next setup guidance to use npx stash init --prisma. |
| skills/stash-cli/SKILL.md | Updates init examples and documented flags to include --prisma (and removes --prisma-next). |
| packages/cli/src/commands/init/steps/install-eql.ts | Switches Prisma Next “skip EQL install” branching to the new provider.name === 'prisma' while preserving integration === 'prisma-next'. |
| packages/cli/src/commands/init/steps/build-schema.ts | Forces internal integration to prisma-next when --prisma provider is selected, ensuring the same Prisma Next behavior as before. |
| packages/cli/src/commands/init/steps/tests/install-eql.test.ts | Adds coverage ensuring --prisma correctly skips stash eql install. |
| packages/cli/src/commands/init/steps/tests/build-schema.test.ts | Adds coverage ensuring --prisma forces prisma-next integration and skips scaffold generation. |
| packages/cli/src/commands/init/providers/prisma.ts | Renames provider factory to createPrismaProvider() and changes provider.name to 'prisma' (referrer). |
| packages/cli/src/commands/init/providers/tests/prisma.test.ts | Updates provider tests for the new factory/name and preserves next-steps expectations. |
| packages/cli/src/commands/init/index.ts | Updates provider map key to prisma and introduces explicit retirement error for --prisma-next. |
| packages/cli/src/commands/init/tests/init-command.test.ts | Adds coverage for selecting --prisma and rejecting --prisma-next before steps run. |
| packages/cli/src/cli/registry.ts | Updates init examples and flags list to expose --prisma in stash manifest --json / help output. |
| .changeset/cli-init-prisma-flag.md | Adds release notes for the new flag and breaking removal of --prisma-next. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| **Authenticate before `stash init`.** Init's authenticate step uses the interactive path, so an agent running `init` unauthenticated makes the CLI try to open a browser on the agent's machine — and in a non-TTY it exits with `region_required` unless `--region` or `STASH_REGION` is set. Once a valid token exists, init logs `Using workspace X (region)` and moves on silently. | ||
|
|
||
| Flags: `--region <slug>` (env `STASH_REGION`), `--json`, `--no-open`, `--supabase` / `--drizzle` (referrer tracking only). | ||
| Flags: `--region <slug>` (env `STASH_REGION`), `--json`, `--no-open`, `--supabase` / `--drizzle` / `--prisma` (referrer tracking only). |
There was a problem hiding this comment.
| Flags: `--region <slug>` (env `STASH_REGION`), `--json`, `--no-open`, `--supabase` / `--drizzle` / `--prisma` (referrer tracking only). | |
| Flags: `--region <slug>` (env `STASH_REGION`), `--json`, `--no-open`, `--supabase` / `--drizzle` / `--prisma`. |
coderdan
left a comment
There was a problem hiding this comment.
Claude found a problem, posted as a comment. The auth command doesn't accept the --prisma option.
coderdan
left a comment
There was a problem hiding this comment.
Light review. The core rename is clean and correctly threaded — one real defect in the skill, plus one test-coverage nit.
What I verified as correct
- The retirement guard at
init/index.ts:84-91faithfully mirrors the--proxyretirement immediately above it, sameflags[k] === true || Object.hasOwn(values, k)shape — so--prisma-next=falseerrors too, consistent with existing behaviour. - The guard runs before
resolveProvider, so no step executes first. - All
provider.nameconsumers are swept:build-schema.ts:64andinstall-eql.ts:49are the only two comparing against the Prisma name.authenticate.ts:60,install-deps.ts:167andresolve-database.ts:26are name-agnostic or Supabase-only. resolveProvider's multi-flag path (index.ts:64,matchedKeys.sort().join('-')) already defeated the old=== 'prisma-next'check before this PR, so--prisma --supabasebehaves exactly as it did. No regression introduced.- No stale
--prisma-nextreferences outside the CHANGELOGs (correctly left as history) and the test name. --prismais already the spellingeql migrationuses (main.ts:260), so the rename increases CLI-wide consistency rather than just init-local consistency.- Changeset present,
stash: minor, breaking change called out.
Happy to push the skill fix if you'd rather not context-switch.
| **Authenticate before `stash init`.** Init's authenticate step uses the interactive path, so an agent running `init` unauthenticated makes the CLI try to open a browser on the agent's machine — and in a non-TTY it exits with `region_required` unless `--region` or `STASH_REGION` is set. Once a valid token exists, init logs `Using workspace X (region)` and moves on silently. | ||
|
|
||
| Flags: `--region <slug>` (env `STASH_REGION`), `--json`, `--no-open`, `--supabase` / `--drizzle` (referrer tracking only). | ||
| Flags: `--region <slug>` (env `STASH_REGION`), `--json`, `--no-open`, `--supabase` / `--drizzle` / `--prisma` (referrer tracking only). |
There was a problem hiding this comment.
This documents --prisma on auth login, which doesn't accept it.
This line sits under the auth login section, not init — the flags listed beside it (--region, --json, --no-open) are all auth login flags.
Against the shipped manifest:
init: --supabase, --drizzle, --prisma, --region
auth login: --region, --json, --no-open, --supabase, --drizzle <- no --prisma
registry.ts:284-286 confirms auth login has only --supabase and --drizzle referrer flags.
It fails silently, which is the worst part: parseArgs (main.ts:162-189) does no unknown-flag validation, so stash auth login --prisma won't error — the flag is just dropped and the referrer is never tracked. Since skills/ ships in the stash tarball and gets copied into customer repos, this lands as wrong guidance in someone else's project.
Two ways to fix, depending on intent:
- revert this line to
--supabase/--drizzle, or - add
--prismatoauth login's registry flags if referrer parity across the three integrations is actually wanted (that'd match the spirit of the PR).
This is what the stash manifest --json check in AGENTS.md is for — worth running before merge.
There was a problem hiding this comment.
Fixed on this branch in f90389c — pushed here rather than as a follow-up PR, at Dan's request.
Took the second option: --prisma is now registered on auth login and threaded through referrerFromFlags, at exact parity with --supabase / --drizzle. This line needed no edit — registering the flag is what made it true, so your wording stands.
Manifest now agrees:
init : --supabase, --drizzle, --prisma, --region
auth login : --region, --json, --no-open, --supabase, --drizzle, --prisma
Also made the referrer parts alphabetical, so a multi-flag referrer no longer depends on argv order. Two tests added in auth/__tests__/index.test.ts; suite is 967 passed / 10 skipped, code:check exit 0. Changeset: stash patch.
One caveat worth knowing: referrer tracking on auth login is inert today. auth/login.ts:30 names the parameter _referrer and never reads it — the comment at line 41 explains why (client_id must be cli, anything else gives INVALID_CLIENT). So --supabase and --drizzle were already accepted, threaded, and discarded; --prisma now matches them exactly. That makes the flag surface honest, but the "(referrer tracking only)" parenthetical overpromises for all three. Reviving it needs the CTS side to take a referrer separate from client_id, so I left it out of scope.
| expect(providerArg.name).toBe('prisma') | ||
| }) | ||
|
|
||
| it('errors on the renamed `--prisma-next` flag before running any step', async () => { |
There was a problem hiding this comment.
Nit: this calls initCommand({ 'prisma-next': true }, {}) directly, so it bypasses parseArgs and doesn't prove the retirement message is reachable through the real CLI — which is the interesting risk now that --prisma-next is gone from the registry.
It is reachable, for what it's worth: parseArgs is permissive and main.ts:531 passes flags/values through wholesale, so stash init --prisma-next does hit the friendly error rather than a generic failure. That chain just isn't pinned anywhere. packages/cli/tests/e2e/ would be the natural home if you think it's worth a guard.
The bundled stash-cli skill lists `--prisma` among `auth login`'s referrer flags, but the command never registered it. The CLI's argument parser does not reject unknown flags, so `stash auth login --prisma` was silently dropped rather than erroring — wrong guidance that failed quietly, in a file that ships in the tarball and is copied into customer repos. Registers the flag and threads it through `referrerFromFlags`, giving it exact parity with `--supabase` / `--drizzle`. The referrer parts are now ordered alphabetically so a multi-flag referrer no longer depends on argv order. Note: `login()` still names the parameter `_referrer` and discards it (the OAuth client_id must be `cli`), so all three flags are inert downstream. This change is parity and honesty about the flag surface, not a revival of referrer tracking. CIP-3691
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/commands/auth/index.ts`:
- Around line 37-40: Update the auth command’s HELP text to document the
--prisma option alongside --supabase and --drizzle, and add a corresponding
--prisma usage example. Keep the existing referrerFromFlags behavior unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 35a011af-b0d1-4ab3-a9be-cc0f50aa64bf
📒 Files selected for processing (4)
.changeset/auth-login-prisma-referrer.mdpackages/cli/src/cli/registry.tspackages/cli/src/commands/auth/__tests__/index.test.tspackages/cli/src/commands/auth/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/cli/src/cli/registry.ts
…ext scaffold exception Two review findings from #853. `auth --help` listed only `--supabase` and `--drizzle` under Options, so the `--prisma` flag registered in the previous commit was undiscoverable from the command itself. The stash-cli skill's `init — scaffold` section claimed step 3 always writes the placeholder encryption client, and listed `./src/encryption/index.ts` unconditionally in the generated-file table. Prisma Next derives schemas from `contract.json`, so `buildSchemaStep` writes nothing for it — the skill now says so in both places. CIP-3691
coderdan
left a comment
There was a problem hiding this comment.
Deferred any tracking work until after launch.
What & why
Closes CIP-3691. Adds
stash init --prismaas the logical equivalent of--supabase— the canonical flag that selects the Prisma (Next) integration, making the integration flags consistent:--supabase,--drizzle,--prisma.Per product direction, this replaces the old
--prisma-nextflag and tracks the referrer as"prisma".Behaviour
stash init --prismaselects the same Prisma Next setup flow as before: EQL bundle installed viaprisma-next migrate, schema derived fromcontract.json, no encryption-client scaffold.provider.name(used for referrer tracking) is now'prisma'. The internalIntegrationvalue stays'prisma-next', so skill set (stash-prisma), adapter dependency (@cipherstash/stack-prisma), schema handling, and EQL-install skip are all unchanged.stash init --prisma-nextis no longer recognized. Init now errors with guidance to re-run with--prisma(mirroring the retired---proxypattern) rather than silently falling through to auto-detection.Changes
providers/prisma.ts(renamed fromprisma-next.ts):createPrismaProvider,name: 'prisma'init/index.ts:PROVIDER_MAPkeyprisma; retirement error for--prisma-nextsteps/build-schema.ts,steps/install-eql.ts:provider.name === 'prisma'checkscli/registry.ts: init--prismaflag + exampleskills/stash-cli/SKILL.md,skills/stash-prisma/SKILL.md: flag docsVerification
pnpm --filter stash build✅stash manifest --json: init flags--supabase, --drizzle, --prisma, --region; no--prisma-next✅stashtest suite: 965 passed / 10 skipped ✅stash: minorSummary by CodeRabbit
--prismasupport tostash initfor Prisma Next setup, and expanded Prisma handling instash auth login.stash init --prisma-nextis no longer recognized; it now errors with guidance to use--prisma.stash-cli/stash-prismadocs and CLI examples to use--prisma, including Prisma Next “no placeholder encryption client” and “skip EQL install” guidance.--prisma, referrer ordering, and deprecated-flag failure behavior.