Skip to content

docs(drive): shape the consolidate-clis project (TML-3172) - #29909

Merged
wmadden merged 2 commits into
mainfrom
tml-3172-consolidate-clis-shaping
Aug 6, 2026
Merged

wmadden merged 2 commits into
mainfrom
tml-3172-consolidate-clis-shaping

Conversation

@wmadden-electric

Copy link
Copy Markdown
Contributor

Shaping PR for the CLI-consolidation project: one prisma CLI and one prisma.config.ts across Prisma 8, Composer, and the platform, before launch. Direction agreed Will/Luan 2026-08-05; this PR lands the artifacts for validation.

What this adds

Four documents under projects/consolidate-clis/:

  • spec.md — goals, scope, and settled design: host package prisma in prisma/prisma-cli; ORM and Composer as ordinary pinned dependencies with @prisma/dev as the only optional package; the CLI never builds the user's app and never does package management; config evaluation never errors (per-section diagnostics, versioned defineConfig marker); launch scope = port existing surfaces, stub Composer's control client until its programmatic API lands.
  • plan.md — three-phase execution across the three repos, with Composer's programmatic API as the long pole started first.
  • cli-consolidation-plan.md — the accepted consolidated command-tree design (Luan's target-experience doc with the agreed corrections applied: db/postgres split, migrate under db, retained Prisma Next verb conventions).
  • current-state.md — evidence base: inventory of the five existing CLIs, their config files, seams, and dependency graphs.

Review focus

  • Will: implementation ownership — plan phases and launch scope.
  • Luan: the applied grammar corrections in cli-consolidation-plan.md match what we agreed.

Refs: TML-3172

🤖 Generated with Claude Code

Land the shaping artifacts for the CLI-consolidation project: spec,
plan, the accepted consolidated command-tree design, and the
current-state inventory of the five existing CLIs.

Refs: TML-3172

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric requested a review from a team as a code owner August 6, 2026 14:53
@CLAassistant

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.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (6)
  • projects/consolidate-clis/cli-consolidation-plan.md is excluded by !projects/**
  • projects/consolidate-clis/current-state.md is excluded by !projects/**
  • projects/consolidate-clis/plan.md is excluded by !projects/**
  • projects/consolidate-clis/slices/1b-control-client-seam/spec.md is excluded by !projects/**
  • projects/consolidate-clis/slices/1c-composer-programmatic-api/spec.md is excluded by !projects/**
  • projects/consolidate-clis/spec.md is excluded by !projects/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro Plus

Run ID: 67da15eb-710d-4094-b1f2-30fb2d670f31

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

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

Slice contracts for the first two Phase 1 slices: routing all Prisma 8
migration/db commands through the control client, and building
Composer's programmatic deploy API over @internal/assemble.

Refs: TML-3172

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden
wmadden added this pull request to the merge queue Aug 6, 2026
Merged via the queue into main with commit eae1375 Aug 6, 2026
16 checks passed
@wmadden
wmadden deleted the tml-3172-consolidate-clis-shaping branch August 6, 2026 14:59
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
postgres / no-emit 166.75 KB (0%)
postgres / emit 145.52 KB (0%)
mongo / no-emit 100.4 KB (0%)
mongo / emit 90.24 KB (0%)
cf-worker / no-emit 191.31 KB (0%)
cf-worker / emit 167.79 KB (0%)

Thegreatsura pushed a commit to Thegreatsura/prisma that referenced this pull request Aug 8, 2026
…risma#29911)

After this PR, no CLI command module reaches `@internal/migration-tools`
at runtime — every operation goes through the control-api seam. At the
top of a command module, the change looks like this:

```ts
// before — commands/migrate.ts reaches business logic directly
import { findLatestMigration, isGraphNode, parseContractRef } from '@internal/migration-tools/...';

// after — the same operations, through the seam; only published types remain importable
import type { RefEntry, Refs } from '@internal/migration-tools/refs';
import { refuseMarkerOutsideGraph, resolveContractRef } from '../control-api/operations/...';
```

Why this matters: the CLI implementation is destined to move to the
consolidated `prisma` CLI repo while the control client stays here as
the product's programmatic API. That move is only possible if commands
hold no business logic — this PR makes the seam airtight. (Stacked on
the project's shaping PR prisma#29909; the reviewable diff is the four
TML-3173 commits.)

## How it's built up

- **Fourteen command modules re-routed** (db-init, db-sign, db-update,
migrate, the migration interrogatives, ref), plus the shared
status-overlay helper. Command modules keep argv parsing and rendering;
policy moves down.
- **New control-api operations** wrap each migration-tools touchpoint
together with its existing CLI error mapping, returning `Result<T,
CliStructuredError>` (the established db-verify pattern): ref/contract
resolution, graph queries, invariant refusals, caught-error mapping,
snapshot resolution, safe refs read, ref advancement.
- **Whole policy cores moved verbatim** where the command was mostly
business logic (`ref`, `migration-new`, `migration-plan`,
`migration-check`, `migration-list`, `migrate --show`), with render
callbacks (`onContextResolved`, `onSeeded`, `onPreflightComplete`) so
the commands still print at exactly the same points.
- **Behavior is pinned, not asserted**: zero changes under
`test/integration/` (~50 journey suites green), goldens untouched except
one forced import repath, and the cast ratchet improves (841 → 837).

## Verification

`@internal/cli` build + 1,423 package tests green; full integration
suite 314/317 files green (the 3 failures are environmental: a
host-timezone artifact that passes under `TZ=UTC`, and two hook timeouts
that pass in isolation); `lint:deps`, `lint:casts` green.

## Caveat worth knowing

The dependency-cruiser rule added here
(`cli-commands-no-runtime-migration-tools`) is currently **dormant**:
the repo's cruise excludes `node_modules`/`dist`, so no cross-package
edges exist for any boundary rule to fire on — a pre-existing repo-wide
blind spot (TML-3178). The operative enforcement is the runtime-import
grep, which returns clean. Coverage of the moved cores is a known
pre-existing gap tracked in TML-3179.

## Alternatives considered

- *Route only enough to satisfy a lint* — rejected: the point is the
host-repo port, so whole cores moved where commands were mostly policy.
- *A bespoke import-scanner script instead of the dep-cruiser rule* —
deferred: one declarative rule in the established tool beats another
ad-hoc scanner; the blind spot that currently mutes it is filed to be
fixed repo-wide (TML-3178).
- *Renaming the moved `execute*Command` functions now* — deliberately
not: keeping names makes the diff mechanically reviewable; renames come
with the command→result→renderer reshape in the next slice.

Refs: TML-3173

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added shared capabilities for migration planning, checking, graph
visualization, references, and contract resolution.
  * Added offline `migrate --show` planning with preflight results.
* Improved migration creation, planning, status, listing, and reference
workflows.
* Expanded the public control API with migration and contract
operations.
* **Bug Fixes**
* Standardized structured CLI error handling and validation for invalid
paths, markers, invariants, and contract snapshots.
* **Documentation**
  * Clarified error guidance for `db update` and invalid contract files.
* **Tests**
* Added comprehensive coverage for planning, references, graph
validation, snapshot resolution, and error handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants