GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — feat(engine): a command can also have subcommands, so prisma dev <entry> and prisma dev url can coexist by wmadden-electric · Pull Request #349 · prisma/prisma-cli Conversation
Contributor
At a glanceA CLI can now mount a command at a path that also has subcommands: createCli({ groups: { dev: { brief: "Run a Composer app locally" } }, commands: { dev: devCommand, // prisma dev module.ts "dev url": devUrlCommand, // prisma dev url gateway "dev stop": devStopCommand, }, }); Before this PR, What this PR changes
No command in the WhyComposer's How it worksThe tree. Routing. The engine routes through Stricli, whose route maps take a The rule for words. A child's name wins over a positional spelled the same. That is harmless for Redirects. Redirects are normally checked only when the typed words reach no command. Under a path with its own command, every word reaches one, because an unknown word becomes the positional. So the engine now checks the typed words against redirects before parsing. A redirect that matches a longer path than the command those words reach ends the run with Help. Version. Engine changes ship with Tests
Alternatives considered
Agent: attila-51 🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsStand-in dev, dev url and dev stop commands. These fail until the engine accepts the shape. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> createCli accepted 'dev url' only if nothing was mounted at 'dev'. Now 'dev' can be a command too: 'dev module.ts' runs it, 'dev url' runs the child, and a child's name wins over a positional spelled the same. 'dev --help' shows the command's help and lists the children. The group's own command sits on the group's node in the command tree, and Stricli routes to it as the route map's default command. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> The engine README shows the mount, and the style guide says what the combined help card shows and how a child's name wins over a positional. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> A patch release: a path that is also a group is new behaviour, and nothing that built before changes. The conformance check's two temporary exceptions move from 0.6.3/0.7.0 to 0.7.0/0.7.1. @prisma/composer-cli and @prisma/orm-toolchain now peer 0.7.0, so the old exceptions no longer matched anything, and the new ones last until both release against 0.7.1. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> …cement With a redirect from 'dev up', 'dev up' ran 'dev' with the entry 'up': redirects were consulted only when routing failed, and under a group's own command it never fails. The engine now matches the redirect before parsing, so a retired child's name wins over the positional the way a live child's name does. Also: - the hidden route the own command sits under is dropped from the reported path, so a literally typed '<own command>' never shows up in a commandId - CommandTreeNode.command is now ownCommand, and the help target for a command is kind 'command' with 'subcommands' - a test pins that '--' passes a word spelled like a child as the positional Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> A tree that 0.7.0 refused now builds. That is a new capability, which takes a minor bump, as the statement prompts did for 0.7.0. The conformance exceptions move to 0.7.0/0.8.0 to match. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
|
There was an error while loading. Please reload this page.
commit: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…roup # Conflicts: # packages/cli/package.json # packages/prisma/package.json
There was an error while loading. Please reload this page.
…rints plain data lines unless you pass --json (prisma#30835) ```console $ prisma migration list | cut -f2 20260101T0000_initial 20260201T0000_add_labels $ prisma migration list --json | jq '.envelope.result.spaces[].migrations[].name' "20260101T0000_initial" "20260201T0000_add_labels" ``` The ORM's commands now run on `@prisma/cli-engine` 0.9.0, the engine the `prisma` CLI 8.0.0-rc.25 ships. Under that engine a piped command prints plain data lines on stdout, and JSON needs `--json`. Each ORM command now says what its data lines are, or why it prints none. ## Why The `prisma` CLI moved to engine 0.9.0 in rc.25, but the ORM toolchain still pinned and peered 0.7.0. The CLI's conformance check carries that mismatch as an allowed exception, and Composer cannot move its own CLI to rc.25 at all: its workspace forces engine 0.7.0, and the rc.25 CLI crashes on that engine. Moving the ORM to 0.9.0 lets the next ORM release, then Composer and the CLI, drop their 0.7.0 pins. ## What changes 1. **Pins.** All 28 `@prisma/cli-engine` pins and peers move from 0.7.0 to 0.9.0, including the `@prisma/orm-toolchain` peer. The lockfile resolves one engine copy. 2. **Data lines.** Engine 0.9.0 (prisma/prisma-cli#353) decides the output format from flags only. A piped run gets the human card on stderr and the command's data lines on stdout. Data lines are a stable interface: fields are tab-separated in a documented order, a null or absent value is an empty field, a backslash, tab, newline or carriage return inside a value is escaped as `\\`, `\t`, `\n` or `\r`, paths are relative to the working directory, and new fields are only appended. `src/orm/data-lines.ts` builds them with `dataLine` and `fieldLines` (the name prisma-cli uses for the same helper): - `migration list`, `status`, `log` and `graph` print one tab-separated line per migration (`migration list`: space, name, from-contract, to-contract, operation count; `migration status` adds the status as a sixth field). `graph --dot` still prints DOT. - `migration show` prints `key<TAB>value` lines, then one line per operation. - `migration check` prints one line per failure. - `migration new`, `migration plan` and `orm init` print the paths they wrote, each once. `contract emit`, `contract infer` and `contract format` print the paths they wrote. - `ref list` prints one line per ref. `ref set` prints the hash the ref now names. - `db migrate` prints the migrations it applied, or with `--show` the ones it would apply. A first migration's from field is empty, as in `migration list`. - `db sign` prints one line per space: space, status, contract storage hash. - `ref delete`, `db init`, `db update`, `db verify` and `db schema` print nothing on stdout and say why with `noDataLines`. 3. **A check.** `test/orm/command-stdout.test.ts` fails if an ORM command declares an empty data-line list instead of `noDataLines`, and fails if it reads no command sources. 4. **Tests, journeys and scripts that read JSON from a piped run** now pass `--json`, including `scripts/regen-example-migrations.mjs`. 5. **Docs.** The CLI README gets a "Piped output" table and states the stable-interface rules. The output rules in `docs/CLI Style Guide.md` now describe the engine model. ADRs 227 and 228, the Postgres extension README, the `prisma7-adoption` example README and the migration review skill reference follow. 6. **Upgrade instructions.** `upgrade-instructions/pending/cli-engine-0-9-piped-output/` declares two changes for apps and extension authors: move an engine pin to 0.9.0, and pass `--json` where a script or test reads JSON from a piped ORM command. The pin change detects any engine version or range below 0.9; the `--json` change has no detection, so every project sees it. Command groups with subcommands (prisma/prisma-cli#349) needed no ORM change. ## Breaking A script, CI step or agent that parsed JSON from a piped ORM command must add `--json`. The upgrade instructions show this change to every project, because such readers live in shell scripts, CI steps and code as well as `package.json`. ## Checks run locally - `pnpm build`, `pnpm typecheck`, `pnpm lint:deps`, `pnpm lint:ratchets`, `pnpm fixtures:check` and `pnpm check:upgrade-coverage --mode pr` pass. - CLI package: 2,175 tests pass; coverage passes in `@internal/cli` and config-loader. - Integration files for every command whose output changed, run one by one, pass. - `pnpm test:packages`: 26,645 tests pass; 3 tarball install tests fail locally because pnpm rejects `@vercel/detect-agent` 1.2.7 as a "trust downgrade". This branch does not touch that dependency; CI shows whether it fails there too. ## Alternatives considered - **Keep the ORM on engine 0.7.0.** The CLI and Composer would keep carrying the mismatch, and Composer could not run any CLI after rc.24. - **Declare `noDataLines` for every command.** Smaller, but a piped `migration list` would print nothing, which makes the commands useless in scripts without `--json`. Closes [TML-3716](https://linear.app/prisma-company/issue/TML-3716). Agent: rochester-20 --------- Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.