Repository navigation
Commit 2361800
Answer Prisma 7 commands with what to run in Prisma 8: engine redirects and the shell's paths (#390)
## Intent
When someone runs a Prisma 7 command against the Prisma 8 CLI, they
should learn in that same run what replaced it and what to run next.
Today they get only `No command registered for '<command>'`. This
applies to people and to agents trained on Prisma 7.
This PR is the first of four. It extends the engine's redirect
mechanism, publishes it as `@prisma/cli-engine@0.10.0`, and covers the
Prisma 7 commands and flags the shell owns. orm-toolchain and
composer-cli add the Prisma 7 paths they own once this engine version is
published. A final PR here then pins those releases and adds one test
that covers every Prisma 7 path.
## Changes
**Engine (`@prisma/cli-engine` 0.9.0 → 0.10.0)**
- `RedirectSpec.replacement` may now be one step, an ordered list of
steps, or absent.
- A redirect may also set:
- its own error `code` (default `CLI.COMMAND_MOVED`)
- a `summary` (`{bin}` is substituted)
- `help`, a command whose `--help` the error points at
- `docsUrl`, rendered as an `open-url` next action
- Next actions are ordered: steps, then help, then docs.
- A redirect that names none of replacement, help, or docsUrl is a
construction error.
- A redirect that uses only the old fields renders exactly as before;
the existing tests pass unchanged.
- The minor version moves because the normalized
`CommandRedirect.replacement` changed from `string` to `readonly
string[]`.
**Shell (`packages/cli/src/v7-redirects.ts`)**
- A command family with no commands, holding the shell's Prisma 7
redirects:
- **Paths, answered with `CLI.V7_COMMAND`:** `bootstrap`, `postgres
link`, `platform status`, `version`, `complete`, `debug`, `mcp`.
- **`init` flags, answered with `CLI.V7_FLAG`:** `--db`,
`--datasource-provider`, `--generator-provider`, `--preview-feature`,
`--output`, `--url`, `--with-model`, `--no-skills`.
- Each error names the Prisma 8 equivalent as `run-command` next
actions, points at its `--help` (or at the CLI docs when there is no
equivalent), and says in `why` what the equivalent does not cover.
Prisma 7 is mentioned only in the summary.
- `CLI.V7_COMMAND` and `CLI.V7_FLAG` are added to
`docs/reference/error-reference.md`.
**Conformance**
- Two temporary exceptions allow `@prisma/orm-toolchain` and
`@prisma/composer-cli` to keep peering engine `0.9.0` until they release
against `0.10.0`. These are the same kind of entries #368 removed.
```
$ prisma bootstrap
✘ [CLI.V7_COMMAND] `prisma bootstrap` is a Prisma 7 command and is not available in Prisma 8
why: Setting up a new app takes two commands: `project create` creates a Project, ...
→ Step 1: prisma project create <name>
→ Step 2: prisma postgres create <name>
→ Read its help: prisma project create --help
```
## Scope
**Not in this PR:**
- The ORM's Prisma 7 paths (`generate`, `db *`, `migrate *`, `studio`,
…) belong to orm-toolchain. It already redirects the six `migrate *`
paths, and the engine rejects a second family claiming the same path.
- `dev ls/rm/start` and the Prisma 7 flags on `dev` belong to
composer-cli.
- The test that covers every Prisma 7 path comes in a later PR here,
after those releases.
## Verification
- `pnpm typecheck`, `pnpm lint` and `pnpm --filter @prisma/cli test`
pass. The new `packages/cli/tests/v7-redirects.test.ts` has 57 cases.
- `pnpm --filter @prisma/cli-engine test`: one failure,
`spawn-real-child` ("child runs in the engine's own process group"). It
also fails on main on the machine this was developed on.
- `pnpm check:conformance` fails locally with `tarball/pack-failed` for
`prisma`. The cause is Node's `fs.cpSync` failing with EACCES on the
virtiofs mount the checkout sits on, and it reproduces without this
branch's changes. The CI run of `check:conformance` is the result to
check.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 8285143 commit 2361800
15 files changed
Lines changed: 724 additions & 35 deletions
File tree
- docs/reference
- packages
- cli-engine
- src
- execution
- tests
- cli
- scripts
- src
- tests
- prisma
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
251 | 259 | | |
252 | 260 | | |
253 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 23 | + | |
30 | 24 | | |
31 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
38 | | - | |
| 36 | + | |
39 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
67 | 79 | | |
68 | 80 | | |
69 | 81 | | |
70 | 82 | | |
71 | | - | |
| 83 | + | |
72 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
73 | 89 | | |
74 | 90 | | |
75 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
395 | 401 | | |
396 | 402 | | |
397 | 403 | | |
| |||
402 | 408 | | |
403 | 409 | | |
404 | 410 | | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
405 | 420 | | |
406 | 421 | | |
407 | 422 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
570 | | - | |
571 | | - | |
572 | | - | |
| 570 | + | |
573 | 571 | | |
574 | 572 | | |
575 | 573 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
455 | 456 | | |
456 | 457 | | |
457 | 458 | | |
458 | | - | |
459 | | - | |
460 | | - | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
461 | 489 | | |
462 | 490 | | |
463 | 491 | | |
| |||
469 | 497 | | |
470 | 498 | | |
471 | 499 | | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
| 500 | + | |
477 | 501 | | |
478 | 502 | | |
479 | 503 | | |
480 | 504 | | |
481 | | - | |
| 505 | + | |
482 | 506 | | |
483 | | - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
484 | 511 | | |
485 | | - | |
| 512 | + | |
486 | 513 | | |
487 | 514 | | |
488 | | - | |
| 515 | + | |
489 | 516 | | |
490 | 517 | | |
491 | 518 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
397 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
398 | 406 | | |
399 | 407 | | |
400 | 408 | | |
| |||
0 commit comments