-
Notifications
You must be signed in to change notification settings - Fork 6
fix(cli): prisma-next init/plan/impl crash + stash-prisma-next skill (rc.2 M1) #683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
2563c64
fix(cli): stop init/plan/impl crashing on Prisma Next; ship stash-pri…
coderdan 229b174
docs(skills): fix three factual errors in stash-prisma-next flagged o…
coderdan 65da67c
feat(cli): refuse `stash eql install` in a Prisma Next project (#683)
coderdan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| --- | ||
| 'stash': minor | ||
| --- | ||
|
|
||
| `stash init`, `stash plan`, and `stash impl` no longer crash on a Prisma Next | ||
| project. `SKILL_MAP` was missing a `prisma-next` entry, so the skills-install | ||
| and AGENTS.md-builder steps hit `SKILL_MAP[integration]` → `undefined` and threw | ||
| "not iterable" for any repo the CLI detected as Prisma Next. The entry is added | ||
| and both consumers now resolve skills through a `skillsFor()` helper that | ||
| degrades an unmapped integration to the base skill set instead of crashing | ||
| (`tsup` ships without type-checking, so the `Record<Integration>` type alone | ||
| didn't protect the build). | ||
|
|
||
| Ships a new **`stash-prisma-next`** agent skill documenting the EQL v3 Prisma | ||
| Next surface — the domain-named encrypted column types (`EncryptedTextSearch`, | ||
| `EncryptedDoubleOrd`, …), `cipherstashFromStackV3` wiring, the runtime value | ||
| envelopes, the `eql*` query operators, and EQL installation via | ||
| `prisma-next migration apply`. It is installed for Prisma Next projects and | ||
| inlined into `AGENTS.md` for editor agents. | ||
|
|
||
| `stash eql install` now refuses to run in a Prisma Next project (pointing you | ||
| at `prisma-next migration apply`, which owns EQL installation) unless you pass | ||
| `--force` — closing the manual-invocation hole that `stash init --prisma-next` | ||
| already avoided. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
packages/cli/src/commands/db/__tests__/prisma-next-install-guard.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { mkdtempSync, rmSync, writeFileSync } from 'node:fs' | ||
| import { tmpdir } from 'node:os' | ||
| import { join } from 'node:path' | ||
| import { afterEach, beforeEach, describe, expect, it } from 'vitest' | ||
| import { messages } from '../../../messages.js' | ||
| import { prismaNextInstallGuard } from '../install.js' | ||
|
|
||
| describe('prismaNextInstallGuard', () => { | ||
| let dir: string | ||
| beforeEach(() => { | ||
| dir = mkdtempSync(join(tmpdir(), 'pn-install-guard-')) | ||
| }) | ||
| afterEach(() => { | ||
| rmSync(dir, { recursive: true, force: true }) | ||
| }) | ||
|
|
||
| it('blocks with actionable guidance when a prisma-next.config is present', () => { | ||
| writeFileSync(join(dir, 'prisma-next.config.ts'), 'export default {}') | ||
|
|
||
| const msg = prismaNextInstallGuard(dir, {}) | ||
| expect(msg).not.toBeNull() | ||
| expect(msg).toContain(messages.eql.prismaNextDetected) | ||
| expect(msg).toContain('prisma-next migration apply') | ||
| expect(msg).toContain('--force') | ||
| }) | ||
|
|
||
| it('blocks when @cipherstash/prisma-next is a dependency', () => { | ||
| writeFileSync( | ||
| join(dir, 'package.json'), | ||
| JSON.stringify({ dependencies: { '@cipherstash/prisma-next': '1.0.0' } }), | ||
| ) | ||
|
|
||
| expect(prismaNextInstallGuard(dir, {})).toContain( | ||
| messages.eql.prismaNextDetected, | ||
| ) | ||
| }) | ||
|
|
||
| it('returns null (allows) with --force, even in a prisma-next project', () => { | ||
| writeFileSync(join(dir, 'prisma-next.config.ts'), 'export default {}') | ||
|
|
||
| expect(prismaNextInstallGuard(dir, { force: true })).toBeNull() | ||
| }) | ||
|
|
||
| it('returns null (allows) when the project is not Prisma Next', () => { | ||
| writeFileSync( | ||
| join(dir, 'package.json'), | ||
| JSON.stringify({ | ||
| dependencies: { '@cipherstash/stack-drizzle': '1.0.0' }, | ||
| }), | ||
| ) | ||
|
|
||
| expect(prismaNextInstallGuard(dir, {})).toBeNull() | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/cli/tests/e2e/eql-install-prisma-next.e2e.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { mkdtempSync, rmSync, writeFileSync } from 'node:fs' | ||
| import { tmpdir } from 'node:os' | ||
| import { join } from 'node:path' | ||
| import { afterEach, beforeEach, describe, expect, it } from 'vitest' | ||
| import { messages } from '../../src/messages.js' | ||
| import { runPiped } from '../helpers/spawn-piped.js' | ||
|
|
||
| /** | ||
| * `stash eql install` must refuse in a Prisma Next project (Prisma Next owns | ||
| * EQL installation via its own migration ledger). The guard fires before any | ||
| * database I/O, so this needs no DB — and proves the wiring end-to-end (the | ||
| * pure guard is unit-tested separately). | ||
| */ | ||
| describe('stash eql install — Prisma Next guard', () => { | ||
| let dir: string | ||
| beforeEach(() => { | ||
| dir = mkdtempSync(join(tmpdir(), 'eql-install-pn-e2e-')) | ||
| }) | ||
| afterEach(() => { | ||
| rmSync(dir, { recursive: true, force: true }) | ||
| }) | ||
|
|
||
| it('refuses with actionable guidance and exits 1 (no DB needed)', async () => { | ||
| writeFileSync(join(dir, 'prisma-next.config.ts'), 'export default {}') | ||
|
|
||
| const r = await runPiped(['eql', 'install'], { cwd: dir, timeoutMs: 15000 }) | ||
|
|
||
| expect(r.timedOut).toBe(false) | ||
| expect(r.exitCode).toBe(1) | ||
| const out = r.stdout + r.stderr | ||
| expect(out).toContain(messages.eql.prismaNextDetected) | ||
| expect(out).toContain('prisma-next migration apply') | ||
| expect(out).toContain('--force') | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.