Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

feat(cli): add on-demand recording of CLI scenarios - #236

Merged
jkomyno merged 25 commits into
mainfrom
feat/cli-recording
Mar 17, 2026
Merged

jkomyno merged 25 commits into
mainfrom
feat/cli-recording

Conversation

@jkomyno

@jkomyno jkomyno commented Mar 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Closes TML-2071
  • Add automated CLI recording system using VHS
  • Recording script (scripts/record.ts) with per-command and multi-step journey modes
  • Two-layer caching: turbo (task-level) + per-recording output probes to skip unchanged recordings
  • CI workflow (workflow_dispatch) to regenerate all recordings and open a PR
  • docker-compose.yaml for local PostgreSQL on port 5433
  • CLI_RECORDING.md documenting prerequisites, usage, caching, and file layout

Recording modes

  • Per-command: isolated recordings of individual CLI commands (db init --help, db init --dry-run, etc.)
  • Journey: multi-step scenarios where database state accumulates (greenfield setup, direct update, drift detection + recovery)

Caching

  • Layer 1 (turbo): if recording script, config, fixtures, and CLI dist haven't changed, turbo replays cached outputs instantly
  • Layer 2 (per-recording probe): when turbo misses, each per-command recording is probed by running the CLI directly (~1s). Only recordings whose output changed are re-recorded via VHS

Usage

docker compose up -d
pnpm record                                  # per-command recordings
pnpm record -- --journey greenfield-setup    # single journey
pnpm record -- --all-journeys               # all journeys in parallel

Test plan

  • pnpm record produces SVGs and ASCII files locally
  • Second pnpm record run shows (unchanged) for all recordings (cache hit)
  • CI workflow (record-cli.yml) runs successfully via workflow_dispatch

Summary by CodeRabbit

  • Documentation

    • Added comprehensive guide for the CLI recording workflow, including prerequisites, setup, and execution steps for per-command and journey-based recordings.
  • Chores

    • Established automated recording infrastructure with GitHub Actions workflow, Docker Compose support, and configuration system.
    • Added fixture files and scripts to support CLI demonstration and testing scenarios.

jkomyno added 22 commits March 12, 2026 14:28
Both commands previously returned raw `VerifyDatabaseSchemaResult` on
schema verification failure instead of the standard `CliErrorEnvelope`.
This made agents parsing `--json` output handle two different shapes.

Now both commands map schema verification failures through a new
`errorSchemaVerificationFailed` factory (PN-RTM-3004), which wraps
the full verification tree in `meta.verificationResult`. Human TTY
output still renders the tree before the error summary.
Add 13 journey-based e2e test files covering 30 CLI scenarios (A-Z + P2-P5)
across greenfield setup, schema evolution, brownfield adoption, drift detection,
migration edge cases, and error scenarios. Each journey is a single it() block
with descriptive assertion labels for step-level failure identification.

Infrastructure:
- journey-test-helpers.ts: CommandResult-based runners for all CLI commands,
  contract swap helper, JSON parsing, SQL helper
- 5 contract fixtures (base, additive, destructive, add-table, v3)
- Config templates with {{DB_URL}} placeholder replacement

Known limitations (marked as TODO in tests):
- db schema-verify and db update hit Vite SSR module resolution error
  after DDL changes (PN-CLI-4999) — affects drift-schema journeys M/N
- Migration chain breakage recovery (P3) requires manual intervention
- Target mismatch (U) needs better simulation approach
The "Vite SSR error" was actually a stale build of @prisma-next/core-control-plane
missing the errorSchemaVerificationFailed export in dist. After rebuild, db
schema-verify and db sign properly return exit code 1 for verification failures.

Journey M: Phantom drift now fully tests verify false-positive → schema-verify
catches drift. db update recovery fails as expected (planner can't re-add
dropped NOT NULL columns — documented as known limitation).

Journey N: Extra column drift now tests verify → tolerant/strict schema-verify →
expand contract → db update (with --no-interactive fallback to -y for
confirmation handling) → tolerant verify passes.

Also restores exact exit code 1 assertions for schema-verify and db sign
failures in brownfield-adoption and drift-marker journeys.
…rrel

The function was defined in errors.ts but missing from the exports barrel,
causing runtime undefined when imported via the package's public API.
This was the root cause of the PN-CLI-4999 "Vite SSR error" in e2e tests —
the function was available in source but not in built dist.
…name)

The test was deleting the wrong migration directory — 'initial' sorted last
alphabetically (i > a) but was the chain root (∅→base), not the intended
target 'add-posts' (additive→v3). After deleting the root, the planner
correctly couldn't reconstruct the graph.

Fix: find the migration dir by name suffix ('_add_posts') instead of
relying on alphabetical sort. Now P3.03–P3.04 fully test the recovery
flow: re-plan the missing edge → apply succeeds.
Instead of tampering with the marker row (which only affects stored JSON,
not the hash comparison), edit contract.json on disk to change the target
field from "postgres" to "mysql". db verify compares contractIR.target
against config.target.targetId, so this triggers PN-RTM-3003.
Remove unused parseJsonOutput import and add commander as devDependency
so the Command type import in journey-test-helpers resolves.
Tolerant vs strict schema-verify is already tested in Journey N
(drift-schema.e2e.test.ts) with extra columns. Journey H tested
the same code path with extra tables, adding no unique coverage.
…test.ts

P4 (partial apply/resume) and P5 (no migration path) were explicitly
noted in the plan as already covered by the command-specific test.
P5's recovery pattern is also identical to P3 (chain breakage).
Q (apply noop), R (plan noop), and X (show variants) are now tail
steps of Journey B. They reuse B's already-applied migration chain
instead of spinning up 3 separate PGlite instances for 4 assertions.
Journey I's JSON assertions are already covered per-command in A.09,
A.10, B.10, and isolated command tests. Journey J (help output)
has near-zero regression prevention value. Journey Y (global flags)
is retained as a lightweight no-DB test.
- 30 → 22 journeys, 13 → 10 test files
- Removed: H (redundant with N), I (JSON covered inline), J (help),
  P4 and P5 (covered by command-specific tests)
- Merged: Q, R, X as tail steps of Journey B
- Updated cross-reference matrix, file structure, acceptance criteria,
  implementation phases, and parallelism estimates
- `pnpm test:journeys` from root runs only journey e2e tests
- Dedicated vitest config with forks pool (4 workers) and
  spinUpPpgDev timeouts for PGlite-backed tests
- Wired through turbo.json for proper build dependency resolution
Add a self-contained README to cli-journeys/ summarizing all 11 test
files by what they cover. Rewrite top-level JSDoc comments in each test
file to describe scenarios in plain words instead of opaque codes.
Also gitignore the vite-plugin output/ fixture directory.
Reverts the errorSchemaVerificationFailed wrapping introduced in 0f57e7f.
The db sign e2e test expects the raw VerifyDatabaseSchemaResult shape
(with `schema` at top level) in JSON failure output, not a CliErrorEnvelope.
- Initialize all closeDb declarations with no-op default to prevent
  TypeError if createDevDatabase() fails in beforeAll
- Use callback form for DB_URL replacement to prevent special character
  corruption in connection strings (e.g., $& in passwords)
- Re-throw unexpected errors in runCommand/runCommandRaw when no CLI
  exit code was captured, preventing silent masking of real regressions
- Run V.02 (dry-run) before V.01 (mutating db init) so the dry-run
  validates the pre-mutation state
- Merge redundant B.05/B.06 steps — both called runMigrationStatus
  with the same DB-connected context; consolidated into one step
- Fix misleading comments in Journey N (age drift stays unresolved;
  test intentionally validates tolerant mode)
- Clarify README: "each journey (describe block)" not just "describe"
Add automated CLI recording system using VHS (agentstation fork) to
produce animated SVG and plain-text ASCII captures of CLI commands.

- Recording script with per-command and journey modes
- Two-layer caching: turbo (task-level) + per-recording output probes
- CI workflow (workflow_dispatch) to regenerate and open a PR
- docker-compose.yaml for local PostgreSQL on port 5433
- CLI_RECORDING.md documenting the full setup
@coderabbitai

coderabbitai Bot commented Mar 12, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This pull request introduces a comprehensive VHS-based CLI recording framework for automated generation and management of interactive CLI demonstrations. It includes infrastructure (GitHub Actions workflow, Docker Compose), TypeScript orchestration scripts, SQL contract fixtures, and pre-recorded ASCII demonstrations covering greenfield setup, schema updates, and drift recovery scenarios.

Changes

Cohort / File(s) Summary
Infrastructure & Automation
.gitattributes, docker-compose.yaml, .github/workflows/record-cli.yml
Adds GitHub Actions workflow for automated CLI recording regeneration with Postgres 15 service, VHS tooling setup, and PR creation. Docker Compose configuration provides local Postgres 16 service with ephemeral data storage. .gitattributes marks recordings as linguist-generated to exclude from diff stats.
NPM Scripts & Documentation
package.json, packages/1-framework/3-tooling/cli/package.json, packages/1-framework/3-tooling/cli/CLI_RECORDING.md
Adds test:journeys and record npm scripts. Comprehensive documentation describing VHS-based recording workflow, prerequisites, caching layers, parallel execution, and fixture management.
Recording Configuration
packages/1-framework/3-tooling/cli/recordings/config.ts
Central configuration module defining VHS settings (shell, dimensions, font, theme, typing speed), per-command Recording metadata, and multi-step Journey workflows. Covers recording scenarios across db-init, db-update, greenfield-setup, direct-update, and drift recovery journeys.
Recording Orchestration Script
packages/1-framework/3-tooling/cli/scripts/record.ts
Primary automation engine (914 lines) orchestrating VHS tape generation, per-command and journey-based recording execution, dynamic height probing, workspace management, contract/state transitions, and parallel journey database handling. Implements CLI wrapper creation, tape assembly, and cleanup logic.
SQL Contract Fixtures
packages/1-framework/3-tooling/cli/recordings/fixtures/...
Fluent builder contracts defining schema evolution: base contract with user table (id, email), additive contract adding nullable name column, and Prisma Next configuration file for test environments.
Recording Assets (.gitignore)
packages/1-framework/3-tooling/cli/recordings/.gitignore
Ignore rules for generated artifacts (mp4, tapes, .bin, .cache.json) to prevent committing ephemeral recording outputs.
ASCII Recording Demonstrations
packages/1-framework/3-tooling/cli/recordings/ascii/...
40+ pre-recorded ASCII terminal sessions (224 lines each) demonstrating CLI workflows across scenarios: db-init help/apply/dry-run, db-update operations, direct schema updates, drift detection/recovery (missing-marker, stale-marker, phantom), and greenfield setup with verification and introspection commands. Each recording includes command invocations, config references, and expected outputs.

Sequence Diagram

sequenceDiagram
    actor User
    participant GitHub as GitHub Actions
    participant Workflow as Record Workflow
    participant VHS as VHS
    participant Database as Postgres
    participant CLI as Prisma CLI
    participant FileSystem as Output Files

    User->>GitHub: Trigger workflow_dispatch
    GitHub->>Workflow: Start recording job
    
    Workflow->>Database: Start Postgres service
    Workflow->>CLI: Install/build CLI
    Workflow->>Workflow: Load recording config
    
    alt Per-Command Mode
        loop For each recording
            Workflow->>Workflow: Check cache
            Workflow->>Database: Setup DB state
            Workflow->>Workflow: Emit/swap contract
            Workflow->>CLI: Run CLI command
            Workflow->>VHS: Generate tape
            VHS->>FileSystem: Create SVG/ASCII/MP4
        end
    else Journey Mode
        loop For each journey (parallel)
            Workflow->>Database: Create isolated DB
            loop For each step
                Workflow->>Workflow: Apply step precondition
                Workflow->>Database: Execute SQL actions
                Workflow->>CLI: Run step command
                Workflow->>VHS: Generate step tape
                VHS->>FileSystem: Create step output
            end
            Workflow->>Database: Cleanup journey DB
        end
    end
    
    Workflow->>FileSystem: Collect all outputs
    Workflow->>GitHub: Create PR with recordings
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 Hops and records with VHS delight,
ASCII tapes dancing, terminal bright!
Docker and workflows, contracts all set,
Journeys through schemas we won't soon forget!
Drifts found and fixed with a flick of the tape, ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 43.24% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(cli): add on-demand recording of CLI scenarios' clearly and concisely describes the main change: adding a new on-demand recording system for CLI scenarios. It is specific, directly related to the primary feature addition, and follows conventional commit formatting.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-recording
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@pkg-pr-new

pkg-pr-new Bot commented Mar 12, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/runtime-executor

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/runtime-executor@236

@prisma-next/sql-runtime

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-runtime@236

@prisma-next/extension-paradedb

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-paradedb@236

@prisma-next/extension-pgvector

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-pgvector@236

@prisma-next/postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/postgres@236

@prisma-next/sql-orm-client

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-orm-client@236

@prisma-next/contract-authoring

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract-authoring@236

@prisma-next/contract-ts

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract-ts@236

@prisma-next/ids

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/ids@236

@prisma-next/psl-parser

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/psl-parser@236

@prisma-next/cli

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/cli@236

@prisma-next/emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/emitter@236

@prisma-next/eslint-plugin

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/eslint-plugin@236

@prisma-next/migration-tools

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/migration-tools@236

@prisma-next/vite-plugin-contract-emit

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/vite-plugin-contract-emit@236

@prisma-next/sql-contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract@236

@prisma-next/sql-errors

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-errors@236

@prisma-next/sql-operations

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-operations@236

@prisma-next/sql-schema-ir

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-schema-ir@236

@prisma-next/sql-contract-psl

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-psl@236

@prisma-next/sql-contract-ts

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-ts@236

@prisma-next/sql-contract-emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-emitter@236

@prisma-next/family-sql

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/family-sql@236

@prisma-next/sql-kysely-lane

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-kysely-lane@236

@prisma-next/sql-lane-query-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-lane-query-builder@236

@prisma-next/sql-relational-core

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-relational-core@236

@prisma-next/sql-lane

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-lane@236

@prisma-next/target-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-postgres@236

@prisma-next/adapter-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-postgres@236

@prisma-next/driver-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-postgres@236

@prisma-next/core-control-plane

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/core-control-plane@236

@prisma-next/core-execution-plane

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/core-execution-plane@236

@prisma-next/config

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/config@236

@prisma-next/contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract@236

@prisma-next/operations

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/operations@236

@prisma-next/plan

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/plan@236

@prisma-next/utils

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/utils@236

commit: eda3a38

@jkomyno
jkomyno changed the base branch from main to feat/cli-scenarios March 12, 2026 16:18
@jkomyno jkomyno changed the title feat(cli): add recording infrastructure with VHS feat(cli): add on-demand recording of CLI scenarios Mar 12, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Note

Due to the large number of review comments, Critical severity comments were prioritized as inline comments.

♻️ Duplicate comments (8)
packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/02-db-schema-verify-fail.tape (1)

3-3: ⚠️ Potential issue | 🔴 Critical

Same hardcoded PATH issue as other tape files.

The absolute PATH containing /Users/jkomyno/... paths needs to be dynamically generated for portability across environments.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/02-db-schema-verify-fail.tape`
at line 3, The Env PATH line in the tape
(packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/02-db-schema-verify-fail.tape)
contains hardcoded absolute user paths (/Users/jkomyno/...), break portability;
update the recorded Env PATH to use a dynamic placeholder or the runtime PATH
(e.g., reference $PATH or a token like {{PATH}}) instead of the absolute paths
so recordings are environment-agnostic, and ensure any other tape files with the
same pattern (same "Env PATH" entry) are changed consistently.
packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/01-db-verify-false-positive.tape (1)

3-3: ⚠️ Potential issue | 🔴 Critical

Same hardcoded PATH issue as other tape files.

The absolute PATH containing /Users/jkomyno/... paths needs to be dynamically generated for portability across environments.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/01-db-verify-false-positive.tape`
at line 3, The recorded tape contains a hardcoded Env PATH line with
user-specific /Users/jkomyno/... entries; replace that static PATH entry in the
tape (the line starting with "Env PATH") with a dynamically generated or
sanitized value: build the PATH from environment variables (e.g.,
process.env.PATH and process.env.HOME) or use relative placeholders for project
.bin directories so recordings are portable across machines, and ensure any test
tooling that writes tapes normalizes or strips user-home absolute paths before
saving.
packages/1-framework/3-tooling/cli/recordings/tapes/drift-missing-marker/02-db-schema-verify-fail.tape (1)

3-3: ⚠️ Potential issue | 🔴 Critical

Same hardcoded PATH issue as other tape files.

The absolute PATH containing /Users/jkomyno/... paths needs to be dynamically generated for portability across environments.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/drift-missing-marker/02-db-schema-verify-fail.tape`
at line 3, The tape contains a hardcoded absolute PATH string (the line
beginning with "Env PATH") which embeds /Users/jkomyno/... and must be replaced
with a portable/dynamic value; open the tape file (look for the "Env PATH" entry
in drift-missing-marker/02-db-schema-verify-fail.tape) and replace the long
absolute PATH with a sanitized placeholder or the runtime PATH value (e.g., use
a token like "${PATH}" or "<PATH>" or inject process.env.PATH when generating
the recording) so recordings no longer contain user-specific absolute paths and
are reproducible across environments.
packages/1-framework/3-tooling/cli/recordings/tapes/drift-missing-marker/04-db-init-recovery.tape (1)

3-3: ⚠️ Potential issue | 🔴 Critical

Same hardcoded PATH issue as other tape files.

The absolute PATH containing /Users/jkomyno/... paths needs to be dynamically generated for portability across environments.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/drift-missing-marker/04-db-init-recovery.tape`
at line 3, The tape file contains a hardcoded absolute PATH string (the "Env
PATH" line in drift-missing-marker/04-db-init-recovery.tape) with
/Users/jkomyno/... entries; update this to generate the PATH dynamically instead
of embedding user-specific paths — e.g., compose the PATH from process.env.PATH
plus the repository's .bin and node_modules/.bin locations or use
placeholders/relative paths used by other tapes, ensuring no absolute /Users/...
entries remain so the recording is portable across environments.
packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/05-db-schema-verify-pass.tape (1)

3-3: ⚠️ Potential issue | 🔴 Critical

Same hardcoded PATH issue as other tape files.

The absolute PATH containing /Users/jkomyno/... paths needs to be dynamically generated for portability across environments.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/05-db-schema-verify-pass.tape`
at line 3, The tape contains a hardcoded absolute PATH string starting with
"/Users/jkomyno/..." on the "Env PATH" line which breaks portability; replace
that hardcoded value with a dynamically constructed PATH that uses the runtime
environment PATH (e.g. prepend project-local bin entries to process.env.PATH or
use a placeholder like $PATH) or sanitize and interpolate only relative/local
bin entries instead of user-specific absolute paths so the tape no longer embeds
/Users/jkomyno paths.
packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/06-db-schema-verify.tape (1)

3-3: ⚠️ Potential issue | 🟠 Major

Same recorder-specific PATH leak here.

Line 3 still bakes the full local PATH into the checked-in tape, so this file inherits the same privacy leak and regeneration churn as the other new recordings. Please regenerate after scrubbing it at the source.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/06-db-schema-verify.tape`
at line 3, The tape contains a recorder-specific leak: the recorded Env PATH
line ("Env PATH ...") embeds a full local PATH; remove or replace that
sensitive, machine-specific value in the recording (the "Env PATH" entry in
packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/06-db-schema-verify.tape)
with a scrubbed placeholder (e.g., PATH_PLACEHOLDER) or remove the Env line
entirely, then regenerate the tape from the recorder so the cleaned value is
committed and future regenerations no longer reintroduce the local PATH.
packages/1-framework/3-tooling/cli/recordings/tapes/direct-update/05-db-verify.tape (1)

3-3: ⚠️ Potential issue | 🟠 Major

Same recorder-specific PATH leak here.

Line 3 still captures the full local PATH, so this tape has the same privacy and reproducibility problem as the other new tapes. Please fix the generator once and regenerate all affected recordings.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/direct-update/05-db-verify.tape`
at line 3, The tape contains a recorder-specific full Env PATH leak (the long
"Env PATH ..." line in direct-update/05-db-verify.tape) — update the recording
generator to scrub or normalize PATH values (e.g., replace with a fixed
sanitized placeholder like "<SANITIZED_PATH>" or omit PATH env entries) when
producing tapes, then regenerate this and all affected recordings so no local
PATH is captured; locate the code that emits environment lines for tapes (the
recorder/tape generator responsible for writing the "Env PATH" entry) and apply
the sanitization there.
packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/10-db-schema-verify-json.tape (1)

3-3: ⚠️ Potential issue | 🟠 Major

Same recorder-specific PATH leak here.

Line 3 still serializes the recorder's local environment into the tape, which will create machine-specific diffs and expose local path details. Please fix the generator and regenerate these artifacts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/10-db-schema-verify-json.tape`
at line 3, The tape contains a leaked local PATH value; update the
tape-generation logic (the function that emits environment lines—look for
serializeEnv, serializeEnvironment, generateTape or recordTape in the recorder)
to exclude or sanitize PATH (and other machine-specific envs) before writing
(either omit PATH entirely or replace it with a stable placeholder like
"<SANITIZED_PATH>"), then regenerate the tape artifacts (including
packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/10-db-schema-verify-json.tape)
so the machine-specific PATH is no longer serialized.
🟠 Major comments (18)
docker-compose.yaml-3-3 (1)

3-3: ⚠️ Potential issue | 🟠 Major

Align the local and CI Postgres major versions.

The docker-compose.yaml pins postgres:16-alpine, but the .github/workflows/record-cli.yml workflow uses postgres:15. Since this PR regenerates CLI recordings, the version skew will cause introspection and migration outputs to diverge between local and CI, breaking reproducibility.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docker-compose.yaml` at line 3, Update the Postgres image in
docker-compose.yaml to match CI's major version: change the image reference
"image: postgres:16-alpine" to "image: postgres:15-alpine" so local runs use the
same Postgres major version as .github/workflows/record-cli.yml and prevent
introspection/migration divergences.
packages/1-framework/3-tooling/cli/recordings/tapes/direct-update/03-db-update-apply.tape-3-3 (1)

3-3: ⚠️ Potential issue | 🟠 Major

Hardcoded absolute PATH breaks portability across all VHS tape recordings.

The Env PATH on line 3 contains user-specific absolute paths (e.g., /Users/jkomyno/work/prisma/...) that won't work on other machines or in CI environments. This pattern affects multiple tape files across different test scenarios. These paths should be generated dynamically in the recording script (scripts/record.ts) using relative paths or environment variables rather than baking in machine-specific directories.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/direct-update/03-db-update-apply.tape`
at line 3, The tape contains a hardcoded absolute PATH entry (the "Env PATH"
line) which embeds user-specific directories; update the recording generator
(scripts/record.ts) to build PATH entries dynamically instead of serializing
process.cwd()/user home paths: when composing the PATH for tapes, prefer
project-relative bin entries (e.g., .bin in the repo and node_modules/.bin) and
append process.env.PATH, or replace user-specific prefixes with portable
placeholders, ensuring scripts/record.ts (the tape-creation logic) normalizes
paths via path.resolve/path.relative and strips or replaces home-directory
segments before writing the tape.
packages/1-framework/3-tooling/cli/recordings/ascii/drift-phantom/04-db-update-recovery.ascii-193-209 (1)

193-209: ⚠️ Potential issue | 🟠 Major

This “recovery” recording still ends in an error.

The filename/header say this step recovers the missing column, but the captured output is a failed db update (PN-RTM-3020). Either regenerate this artifact after the actual recovery step or rename/reorder it so the journey remains coherent for readers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/ascii/drift-phantom/04-db-update-recovery.ascii`
around lines 193 - 209, The recording file header claims recovery of the missing
"user"."email" column but the captured output shows a failed `prisma-next db
update` (PN-RTM-3020) indicating the column is still missing; either reproduce
and re-record the scenario after you actually run the recovery step so the
`prisma-next db update` completes successfully, or update the recording's
filename/header and sequence so it accurately reflects that this step shows a
failing `db update` (reference the failing command `prisma-next db update`, the
error PN-RTM-3020, and the missing column "user"."email" when making the
change).
.github/workflows/record-cli.yml-74-75 (1)

74-75: ⚠️ Potential issue | 🟠 Major

Pin create-pull-request to a commit SHA.

This job has contents: write and pull-requests: write, so consuming a mutable @v7 tag makes the PR automation step a supply-chain trust point. Pin this action the same way the earlier actions are pinned.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/record-cli.yml around lines 74 - 75, Replace the mutable
tag for the Create pull request step by pinning
peter-evans/create-pull-request@v7 to a specific commit SHA: locate the step
with name "Create pull request" and the uses string
"peter-evans/create-pull-request@v7" and change it to the corresponding full
commit SHA form (e.g., "peter-evans/create-pull-request@<commit-sha>") matching
the same pinning approach used by earlier actions in this workflow.
.github/workflows/record-cli.yml-45-66 (1)

45-66: ⚠️ Potential issue | 🟠 Major

Pin exact versions and verify checksums before installing untrusted artifacts.

ttyd is pulled from releases/latest (mutable and unpredictable). While vhs (0.11.1) and JetBrains Mono (v2.304) have pinned versions, none of the three tools verify checksums or signatures before installation. Downloads from GitHub without integrity checks risk execution of modified or malicious binaries on this write-capable runner, making the workflow non-reproducible and insecure.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/record-cli.yml around lines 45 - 66, The workflow installs
unpinned/mutable artifacts and lacks integrity checks: update the "Install ttyd"
step to pin an explicit ttyd release version instead of using releases/latest
and fetch the corresponding checksum/signature from the release assets (or a
trusted source) and verify it before chmod/moving; do the same for the "Install
VHS (agentstation fork)" step (use the VHS_VERSION variable but ensure exact
pinned value and verify its downloaded tarball against a checksum/signature) and
for the "Install JetBrains Mono font" step (pin the JetBrainsMono version and
verify the zip with a checksum/signature) so each run validates integrity before
installing. Ensure verification failures cause the job to fail and only
move/execute binaries after verification succeeds.
packages/1-framework/3-tooling/cli/recordings/tapes/drift-missing-marker/03-db-introspect-empty.tape-3-3 (1)

3-3: ⚠️ Potential issue | 🟠 Major

Hardcoded local PATH breaks portability and leaks developer environment details.

The Env PATH directive contains absolute paths specific to the original developer's machine (e.g., /Users/jkomyno/...). This will:

  1. Fail on CI and other developers' machines
  2. Expose private directory structure and tool installations

Consider dynamically generating the PATH in the recording script, or using a minimal PATH that only includes the required .bin directory relative to the recording workspace.

Suggested approach

The recording script should construct the PATH programmatically using relative paths or environment variables:

-Env PATH "/Users/jkomyno/work/prisma/prisma-next/packages/1-framework/3-tooling/cli/recordings/.bin/drift-missing-marker-03-db-introspect-empty:/Users/jkomyno/work/prisma/prisma-next/packages/1-framework/3-tooling/cli/node_modules/.bin:..."
+Env PATH "${RECORDINGS_BIN_DIR}:${CLI_NODE_MODULES_BIN}:${MINIMAL_SYSTEM_PATH}"

Or if VHS doesn't support variable expansion, the tape generation logic should inject the appropriate paths at generation time based on the current environment.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/drift-missing-marker/03-db-introspect-empty.tape`
at line 3, The Env PATH line in the tape contains hardcoded absolute user paths
(the "Env PATH" directive); remove these machine-specific entries and replace
them with a portable PATH composed only of the required relative bin locations
(e.g., ./node_modules/.bin and any other minimal tools) or have the
tape-generation script inject a computed PATH at recording time using
environment variables; update the tape-generation logic that emits the "Env
PATH" line so it builds the PATH programmatically (or uses a minimal fixed PATH)
instead of embedding /Users/jkomyno/... absolute paths.
packages/1-framework/3-tooling/cli/recordings/tapes/direct-update/01-contract-emit-v2.tape-3-3 (1)

3-3: ⚠️ Potential issue | 🟠 Major

Don't commit the recorder's full PATH.

Line 3 hard-codes /Users/jkomyno/... plus the full local toolchain inventory. That leaks host-specific details into the repo and guarantees noisy diffs when another machine regenerates these tapes. Please scrub this in the recorder and regenerate the artifacts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/direct-update/01-contract-emit-v2.tape`
at line 3, The recorded tape contains a hard-coded, host-specific Env PATH (the
long "Env PATH" line in the tape file direct-update/01-contract-emit-v2.tape)
that must be scrubbed; update the recorder logic that emits the Env PATH so it
strips user- and machine-specific entries (or replaces PATH with a stable
placeholder like "<REDACTED_PATH>" or a minimal deterministic PATH), regenerate
the tape artifact (direct-update/01-contract-emit-v2.tape) and commit the
regenerated file; look for the code that writes the "Env PATH" line in the
recorder module responsible for tape serialization and change it to redact or
normalize PATH before writing.
packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/09-db-verify-json.tape-3-3 (1)

3-3: ⚠️ Potential issue | 🟠 Major

Hardcoded absolute PATH breaks portability across 36 tape files.

All VHS tape recordings (36 files across packages/1-framework/3-tooling/cli/recordings/tapes/**) contain hardcoded machine-specific absolute paths (/Users/jkomyno/...) including personal directories (.nvm, .cargo, .composio, .codeium, etc.). These committed tape files will fail to execute on other machines and in CI.

The root cause is in packages/1-framework/3-tooling/cli/scripts/record.ts: the vhsPath construction captures the full process.env.PATH without sanitization before writing to the generated tape file. The PATH should be limited to essential directories (the wrapper bin directory and standard system paths) rather than capturing the developer's entire environment.

Sanitize the PATH in the recording script before embedding it into tape files, then regenerate all affected tapes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/09-db-verify-json.tape`
at line 3, The VHS tape recordings include a full developer-specific
process.env.PATH (introduced when constructing vhsPath in
packages/1-framework/3-tooling/cli/scripts/record.ts), which breaks portability;
update the vhsPath construction in record.ts to sanitize PATH by whitelisting
only the wrapper bin directory plus a small set of standard system directories
(e.g. node_modules/.bin in the repo, /usr/bin, /bin, /usr/local/bin,
/opt/homebrew/bin) and filtering out any entries under user home dirs (like
~/.nvm, ~/.cargo, ~/.composio, ~/.codeium, etc.), then regenerate all affected
tape files under packages/1-framework/3-tooling/cli/recordings/tapes so they no
longer contain hardcoded absolute user paths.
packages/1-framework/3-tooling/cli/recordings/ascii/drift-phantom/05-db-schema-verify-pass.ascii-193-211 (1)

193-211: ⚠️ Potential issue | 🟠 Major

This pass artifact still captures a failed verification.

The filename says this is the post-recovery success step, but Lines 204-211 still show email: missing and PN-SCHEMA-0001. Either the recovery step did not actually restore the schema before recording this step, or the wrong ASCII artifact was checked in.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/ascii/drift-phantom/05-db-schema-verify-pass.ascii`
around lines 193 - 211, The recorded ASCII shows a failing schema verify
(missing email column and PN-SCHEMA-0001) even though this artifact should be
the post-recovery success; re-generate or replace the artifact so that running
"prisma-next db schema-verify" against the recovered database reports the "user"
table with email present and all checks passing (no "email: missing" or
PN-SCHEMA-0001), then commit the corrected ASCII output that shows the contract
verification as successful (all ✓ entries for table user and columns).
packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/03-db-introspect-diverged.tape-3-3 (1)

3-3: ⚠️ Potential issue | 🟠 Major

Fix the tape generator to exclude workstation-specific PATH entries.

The tape recorder directly serializes process.env.PATH into committed tape files at lines 523 and 660 of packages/1-framework/3-tooling/cli/scripts/record.ts. This captures author-specific environment paths like /Users/jkomyno/.cache, /Users/jkomyno/.opencode, etc., making tapes non-portable and leaking local environment details into the repository.

Instead of using the full process.env.PATH, use only system paths and the wrapper directory. Replace both occurrences with a minimal, stable PATH like:

const vhsPath = `${wrapperDir}:/usr/local/bin:/usr/bin:/bin`;

Once fixed, regenerate and commit the tapes so they no longer contain author-specific paths.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/03-db-introspect-diverged.tape`
at line 3, The tape generator in
packages/1-framework/3-tooling/cli/scripts/record.ts is serializing
process.env.PATH (author-specific entries) into tapes; change the two places
that currently use process.env.PATH to instead build a minimal stable PATH using
the existing wrapperDir (e.g. set vhsPath to
`${wrapperDir}:/usr/local/bin:/usr/bin:/bin`) so only the wrapper directory and
system paths are recorded; update the references that construct the env for the
recorder to use this vhsPath variable (replacing process.env.PATH) and then
regenerate the tapes.
test/integration/test/cli-journeys/drift-migration-dag.e2e.test.ts-80-86 (1)

80-86: ⚠️ Potential issue | 🟠 Major

Assert the broken-chain message here.

Line 82 accepts either 0 or 1, and Lines 85-86 only prove that migration apply failed somehow. That means this checkpoint can still pass even if migration status never reports the DAG breakage described by the test. Please assert the broken-chain or no-path diagnostic on stdout for at least one of these steps.

Based on learnings, CLI journey tests in this directory treat stdout as the machine-readable channel for failure diagnostics.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/integration/test/cli-journeys/drift-migration-dag.e2e.test.ts` around
lines 80 - 86, The test currently only checks exit codes but doesn't assert the
expected DAG breakage message; update the assertions to verify the CLI
diagnostic appears in stdout: after calling runMigrationStatus(ctx)
(statusBroken) assert statusBroken.stdout contains the broken-chain diagnostic
(e.g., "broken chain" or "contract has no matching leaf"), and/or after
runMigrationApply(ctx) (applyFail) assert applyFail.stdout contains the "no path
from marker to destination contract" message so the test fails if the specific
machine-readable diagnostic is not emitted; use the existing variables
statusBroken and applyFail and add toContain assertions against their stdout
fields.
test/integration/test/cli-journeys/config-errors.e2e.test.ts-30-30 (1)

30-30: ⚠️ Potential issue | 🟠 Major

These cases need scenario-specific diagnostics, not only exitCode !== 0.

With only non-zero exit assertions here, a generic loader crash or the wrong validation branch would still satisfy every test. Please assert a stable substring per case on result.stdout as well so the suite proves the CLI failed for the intended reason.

Based on learnings, CLI journey tests in this directory treat stdout as the machine-readable channel for failure diagnostics.

Also applies to: 42-42, 58-58, 90-90

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/integration/test/cli-journeys/config-errors.e2e.test.ts` at line 30, The
test currently only checks that result.exitCode is non-zero
(expect(result.exitCode, 'T.01: missing config').not.toBe(0)), which is too
generic; update each failing-case assertion to also assert a stable,
scenario-specific substring appears in result.stdout (e.g., for the "missing
config" case assert result.stdout contains a clear diagnostic like "missing
configuration" or the CLI's canonical error token) so the test proves the CLI
failed for the intended reason; apply the same change to the other similar
assertions referenced (the checks at the other occurrences) and keep assertions
using the same result variable to ensure both exitCode !== 0 and the specific
stdout substring are validated.
packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/08-db-introspect.tape-3-3 (1)

3-3: ⚠️ Potential issue | 🟠 Major

Normalize PATH before generating these tapes.

Line 3 checks in the recorder host's full /Users/jkomyno/... PATH. That's a portability/privacy problem, and the same generator output shows up in the sibling tapes in this PR. Please emit only the minimal repo-local bins needed for replay, or inject them from shared-config.tape, instead of serializing the full machine PATH.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/08-db-introspect.tape`
at line 3, The tape records the full machine PATH (the line starting with "Env
PATH" in
packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/08-db-introspect.tape),
which leaks local environment; update the tape-generation code that emits
environment variables (the logic that writes the "Env PATH" entry) to
normalize/sanitize PATH by keeping only repo-local bin entries (e.g.,
node_modules/.bin, package-specific .bin) or replace the rest with a
deterministic placeholder, or inject required bins from shared-config.tape
instead of serializing the full host PATH; ensure the generator filters PATH
entries by repo-root or known whitelist and writes the cleaned PATH into the
tape.
test/integration/test/cli-journeys/config-errors.e2e.test.ts-19-29 (1)

19-29: ⚠️ Potential issue | 🟠 Major

T.01 isn't testing missing default-config discovery.

Line 25 says to remove the config file, but Lines 26-29 still pass an explicit nonexistent path. That exercises the same --config failure shape as T.02 instead of "no config file", so the default lookup branch stays untested.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/integration/test/cli-journeys/config-errors.e2e.test.ts` around lines 19
- 29, The test T.01 currently passes an explicit nonexistent path to
runContractEmitWithConfig which exercises the --config failure path; to test
missing default-config discovery remove the explicit config argument so the CLI
uses its default lookup. Update the test that calls
runContractEmitWithConfig(ctx.testDir, join(...)) to call
runContractEmitWithConfig(ctx.testDir) (ensure the
setupJourneyNoDb/createTempDir still deletes any config file so the default
discovery finds nothing). This targets the runContractEmitWithConfig invocation
and the 'T.01: fails when config file does not exist' test case.
packages/1-framework/3-tooling/cli/recordings/config.ts-425-438 (1)

425-438: ⚠️ Potential issue | 🟠 Major

drift-phantom is scripted as recoverable, but the tested flow is not.

The matching integration journey in test/integration/test/cli-journeys/drift-schema.e2e.test.ts expects db update -y to fail after email is manually dropped. Here Line 427 records plain db update as a recovery step and Lines 434-437 assume db schema-verify then passes, so this tape will either block on confirmation or document a success path the CLI does not have. Please align Step 04/05 with the failure flow instead of a recovery path.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/1-framework/3-tooling/cli/recordings/config.ts` around lines 425 -
438, The tape currently lists ordinal '04' (slug 'db-update-recovery') as
running "prisma-next db update" and then a passing schema-verify, but the
integration test expects db update -y to fail after the email column is dropped.
Update the step with ordinal '04' (slug 'db-update-recovery') to use the exact
failing command "prisma-next db update -y", change its description/dbState to
indicate an expected failure (e.g., "update fails due to missing email column"),
and either remove or modify the subsequent ordinal '05' step (the
"db-schema-verify" entry) so it no longer asserts a successful verification—make
it reflect the failing/unchanged schema state consistent with the test flow.
packages/1-framework/3-tooling/cli/scripts/record.ts-427-439 (1)

427-439: ⚠️ Potential issue | 🟠 Major

--all-journeys is still effectively serial.

runParallel() only helps when the task body yields, but each journey spends its expensive work inside synchronous child-process calls (execSync). One worker blocks the entire Node process while it records, so the concurrency counter does not buy actual parallelism. Use async child processes or worker processes instead.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/1-framework/3-tooling/cli/scripts/record.ts` around lines 427 - 439,
runParallel currently can't parallelize journeys because each task uses
synchronous child-process calls (execSync), so a single worker() blocks the
entire Node event loop; replace those blocking calls with non-blocking async
child-process APIs (child_process.exec or child_process.spawn with Promise
wrappers) or move heavy work into real workers (worker_threads or child
processes) so runParallel's concurrency actually yields; search for usages that
call execSync inside the journey tasks and update them to return Promises (or
dispatch to worker thread functions) so the runParallel worker() can await
without blocking.
packages/1-framework/3-tooling/cli/scripts/record.ts-115-123 (1)

115-123: ⚠️ Potential issue | 🟠 Major

Use execFileSync instead of execSync to avoid shell interpolation issues with paths containing spaces.

When paths contain spaces or special characters (e.g., ~/Code/Prisma Next), the string interpolation into execSync commands breaks because the shell interprets the string. This affects:

  • Line 118: execSync(node ${CLI_BIN} ${args}`) – CLI_BIN and args need array passing
  • Lines 202-213: cd ${cwd} in generated wrapper script – must be quoted as cd "${cwd}" or similar
  • Line 330-336: execSync(node ${CLI_BIN} ${args.join(' ')}`) – same issue as line 118
  • Lines 469-470: execSync(vhs ${tapePath}`) – tapePath needs quoting

Prefer execFileSync('node', [CLI_BIN, ...argsArray], { cwd, ... }) to pass arguments as an array without shell interpretation. For the wrapper script generation, wrap paths in quotes when interpolating into shell strings.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/1-framework/3-tooling/cli/scripts/record.ts` around lines 115 - 123,
The probeCliOutput function uses execSync with a interpolated command string
which breaks on paths with spaces; replace execSync(`node ${CLI_BIN} ${args}`)
with execFileSync('node', [CLI_BIN, ...argsArray], { cwd, encoding: 'utf-8',
env: { ...process.env, NO_COLOR: '1', CI: 'true' }, stdio:
['pipe','pipe','pipe'] }) and convert args into an array before calling;
likewise update other places that build shell strings (the wrapper script
generation that does cd ${cwd}, the execSync usage at the later CLI invocation
that uses args.join(' '), and the vhs invocation using execSync(`vhs
${tapePath}`)) to either use execFileSync with argument arrays or quote
interpolated paths (e.g., wrap cwd/tapePath in double quotes) so no unescaped
spaces or special chars are interpreted by a shell.
packages/1-framework/3-tooling/cli/scripts/record.ts-54-55 (1)

54-55: ⚠️ Potential issue | 🟠 Major

Replace node:path with pathe and fix the Windows-incompatible root check.

Line 54 imports from node:path instead of the codebase standard pathe. Additionally, line 131–132 has a POSIX-only root sentinel (dir !== '/') that hangs on Windows: dirname('C:\\') === 'C:\\' causes an infinite loop. Replace the import and fix the root detection to use parent === dir instead.

🛠️ Safer root walk
-import { dirname, join, relative, resolve } from 'node:path';
+import { dirname, join, relative, resolve } from 'pathe';
@@
 function findMonorepoRoot(startDir: string): string {
   let dir = startDir;
-  while (dir !== '/') {
+  while (true) {
     if (existsSync(join(dir, 'pnpm-workspace.yaml'))) return dir;
-    dir = dirname(dir);
+    const parent = dirname(dir);
+    if (parent === dir) break;
+    dir = parent;
   }
   throw new Error('Could not find monorepo root (pnpm-workspace.yaml)');
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/1-framework/3-tooling/cli/scripts/record.ts` around lines 54 - 55,
Replace the node:path import with the project's pathe module by changing the
import line to import { dirname, join, relative, resolve } from 'pathe' (keep
fileURLToPath/pathToFileURL from 'node:url' as-is); then fix the root-walking
loop that currently uses a POSIX-only sentinel (dir !== '/') by computing parent
= dirname(dir) each iteration and breaking when parent === dir (i.e., when
parent equals dir) to correctly detect filesystem roots on Windows and POSIX
systems (update the loop that references dirname and dir accordingly).
🟡 Minor comments (4)
packages/1-framework/3-tooling/cli/package.json-18-19 (1)

18-19: ⚠️ Potential issue | 🟡 Minor

Clean the recording cache and temp artifacts too.

record now writes recordings/.bin/, recordings/mp4/, and recordings/.cache.json, but clean leaves them behind. That makes pnpm clean non-deterministic for the new workflow and can leak stale probe state into later runs.

♻️ Proposed fix
-    "clean": "rm -rf dist dist-tsc dist-tsc-prod coverage .tmp-output"
+    "clean": "rm -rf dist dist-tsc dist-tsc-prod coverage .tmp-output recordings/.bin recordings/mp4 recordings/.cache.json"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/1-framework/3-tooling/cli/package.json` around lines 18 - 19, The
clean script in package.json doesn't remove recording artifacts created by the
record script; update the "clean" npm script (next to the "record" entry) to
also remove recordings/.bin, recordings/mp4, recordings/.cache.json (or the
entire recordings/ directory if preferred) so that running pnpm clean removes
recording cache and temp artifacts and prevents stale probe state from leaking
into subsequent runs.
test/integration/test/cli-journeys/README.md-44-46 (1)

44-46: ⚠️ Potential issue | 🟡 Minor

Don't document PGlite as the universal journey backend.

Line 45 says every journey gets a PGlite instance, but this PR already adds a no-DB journey and a dev-Postgres journey. That will mislead the next author about how isolation actually works. Please describe the abstraction generically: isolated temp workspace, plus a fresh database only when the journey needs one.

📝 Suggested wording
-- **Database isolation**: Each journey (`describe` block) gets its own PGlite instance via `beforeAll`/`afterAll`. Journeys within a file share no database state.
+- **State isolation**: Each journey (`describe` block) gets its own isolated environment. Database-backed flows provision a fresh database in lifecycle hooks, while no-DB flows use an isolated temp workspace. Journeys within a file share no state.
As per coding guidelines, `**/{README.md,*.md,.cursor/rules/*.mdc,docs/**/*.md}`: Keep docs current (READMEs, rules, links) - see `.cursor/rules/doc-maintenance.mdc`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/integration/test/cli-journeys/README.md` around lines 44 - 46, Update
the README wording that currently states "Every journey gets a PGlite instance"
to describe the isolation abstraction generically: explain that each journey
(each describe block) runs in an isolated temporary workspace and that a fresh
database is provisioned only for journeys that require one (managed via
beforeAll/afterAll), rather than asserting PGlite as the universal backend;
adjust the section containing "Single `it()` per journey" and the bullet
mentioning "Database isolation" to reflect this generic phrasing and remove the
explicit PGlite claim so future authors understand that some journeys may be
no-DB or use dev-Postgres.
test/integration/test/cli-journeys/connection-and-contract-errors.e2e.test.ts-171-178 (1)

171-178: ⚠️ Potential issue | 🟡 Minor

Journey V accepts both pass and fail paths.

Lines 173 and 178 allow either 0 or 1, so this test never pins the unmanaged-database behavior it is describing. Assert the concrete branch you expect, or pair each allowed exit code with a required stdout message so planner regressions stay visible.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@test/integration/test/cli-journeys/connection-and-contract-errors.e2e.test.ts`
around lines 171 - 178, The test currently allows both success and failure for
runDbInit (variables dryRun and init) by asserting exitCode is in [0,1]; change
this to assert the specific expected branch: either require a single exitCode
(e.g., expect(dryRun.exitCode).toBe(0)) or, if you must allow both, pair each
allowed exit code with an assertion on stdout/stderr content from
dryRun.stdout/init.stdout to disambiguate behavior (e.g., when exitCode===0
expect a "no changes" message, when exitCode===1 expect a "conflict" message) so
regressions in runDbInit are detected; update the assertions around dryRun and
init accordingly and use the runDbInit variable names to locate the checks.
test/integration/test/cli-journeys/brownfield-adoption.e2e.test.ts-89-97 (1)

89-97: ⚠️ Potential issue | 🟡 Minor

Verify the marker after db update.

db sign --json at Line 94 rewrites the marker, so this journey still passes if Line 90 updates the schema but forgets to update the marker. Add a runDbVerify(ctx) between Lines 91 and 94 so stale-marker regressions stay visible.

🔧 Suggested assertion
         const update = await runDbUpdate(ctx);
         expect(update.exitCode, 'F.07: db update').toBe(0);
 
+        const verifyUpdated = await runDbVerify(ctx);
+        expect(verifyUpdated.exitCode, 'F.08: db verify after update').toBe(0);
+
         // F.09: db sign --json
         const signJson = await runDbSign(ctx, ['--json']);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/integration/test/cli-journeys/brownfield-adoption.e2e.test.ts` around
lines 89 - 97, After running runDbUpdate(ctx) you must verify the marker hasn't
been left stale: insert a call to runDbVerify(ctx) between the update
(runDbUpdate) and the subsequent runDbSign(ctx, ['--json']) and assert its
exitCode is 0 (e.g., expect(verify.exitCode, 'F.08: db verify').toBe(0)); keep
existing parseJsonOutput(signJson) and follow-up assertions unchanged. This
ensures runDbUpdate actually updated the marker before runDbSign rewrites it.
🧹 Nitpick comments (3)
test/integration/test/cli-journeys/drift-migration-dag.e2e.test.ts (1)

10-11: Prefer pathe over node:path here too.

This journey test is in TypeScript and should use the same pathe convention as the rest of the repo for path handling.

♻️ Suggested change
-import { join } from 'node:path';
+import { join } from 'pathe';
As per coding guidelines, `**/*.{ts,tsx,mts,cts}`: Use `pathe` instead of `node:path` for path manipulation in TypeScript files.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/integration/test/cli-journeys/drift-migration-dag.e2e.test.ts` around
lines 10 - 11, The test imports path utilities from 'node:path' (using
join)—replace that with the repo-preferred 'pathe' module: import join from
'pathe' (or the appropriate named export) and keep readdirSync/rmSync from
'node:fs' as-is; update any usages of join in this file (e.g., where join(...)
is called) to use the pathe join so TypeScript tests follow the pathe convention
(refer to the import symbol join and usages in this file).
test/integration/test/cli-journeys/config-errors.e2e.test.ts (1)

10-11: Use pathe in this TypeScript test.

The new journey tests should follow the repo-wide pathe convention instead of importing join from node:path.

♻️ Suggested change
-import { join } from 'node:path';
+import { join } from 'pathe';
As per coding guidelines, `**/*.{ts,tsx,mts,cts}`: Use `pathe` instead of `node:path` for path manipulation in TypeScript files.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/integration/test/cli-journeys/config-errors.e2e.test.ts` around lines 10
- 11, Replace the Node built-in path import with the repo-standard pathe import:
remove "join" from "node:path" and import join from "pathe" instead; update any
usage of join in this test (e.g., places using writeFileSync combined with join)
to use the pathe join. Keep writeFileSync from 'node:fs' as-is and ensure the
import line reads like: import { join } from 'pathe' so the test follows the
TypeScript pathe convention.
test/integration/test/cli-journeys/connection-and-contract-errors.e2e.test.ts (1)

16-18: Use pathe for join() here.

This repo standardizes on pathe in TypeScript files, and the journey suite already leans on cross-platform path handling elsewhere. Swapping this import keeps the test aligned with the CLI/tooling conventions.

♻️ Minimal change
-import { join } from 'node:path';
+import { join } from 'pathe';
Based on learnings: In the Prisma-next repository, prefer importing and using 'pathe' over the built-in 'node:path' module for path operations across the codebase (including CLI commands and tooling files).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@test/integration/test/cli-journeys/connection-and-contract-errors.e2e.test.ts`
around lines 16 - 18, Replace the usage of the Node built-in path join with the
repository-standard pathe join: update the import line that currently imports
join from 'node:path' to import join from 'pathe' so the test file uses pathe's
cross-platform path handling (locate the import statement which currently reads
"import { join } from 'node:path'" and change the module to 'pathe' while
keeping the symbol name join).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 6ac67982-374d-4b34-ae64-c9881429a2ae

📥 Commits

Reviewing files that changed from the base of the PR and between 97be17c and 0b6cb16.

⛔ Files ignored due to path filters (36)
  • packages/1-framework/3-tooling/cli/recordings/svgs/db-init/apply.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/db-init/dry-run.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/db-init/help.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/db-update/additive-dry-run.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/db-update/help.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/db-update/no-changes.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/direct-update/01-contract-emit-v2.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/direct-update/02-db-update-dry-run.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/direct-update/03-db-update-apply.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/direct-update/04-db-update-noop.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/direct-update/05-db-verify.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-missing-marker/01-db-verify-fail.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-missing-marker/02-db-schema-verify-fail.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-missing-marker/03-db-introspect-empty.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-missing-marker/04-db-init-recovery.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-missing-marker/05-db-verify-pass.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-phantom/01-db-verify-false-positive.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-phantom/02-db-schema-verify-fail.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-phantom/03-db-introspect-diverged.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-phantom/04-db-update-recovery.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-phantom/05-db-schema-verify-pass.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-stale-marker/01-db-verify-fail.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-stale-marker/02-db-schema-verify-fail.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-stale-marker/03-db-update-recovery.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-stale-marker/04-db-verify-pass.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/01-contract-emit.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/02-db-init-dry-run.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/03-db-init.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/04-db-init-idempotent.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/05-db-verify.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/06-db-schema-verify.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/07-db-schema-verify-strict.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/08-db-introspect.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/09-db-verify-json.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/10-db-schema-verify-json.svg is excluded by !**/*.svg
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (111)
  • .gitattributes
  • .github/workflows/record-cli.yml
  • docker-compose.yaml
  • package.json
  • packages/1-framework/1-core/migration/control-plane/src/errors.ts
  • packages/1-framework/1-core/migration/control-plane/src/exports/errors.ts
  • packages/1-framework/3-tooling/cli/CLI_RECORDING.md
  • packages/1-framework/3-tooling/cli/package.json
  • packages/1-framework/3-tooling/cli/recordings/.gitignore
  • packages/1-framework/3-tooling/cli/recordings/ascii/db-init/apply.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/db-init/dry-run.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/db-init/help.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/db-update/additive-dry-run.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/db-update/help.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/db-update/no-changes.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/direct-update/01-contract-emit-v2.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/direct-update/02-db-update-dry-run.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/direct-update/03-db-update-apply.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/direct-update/04-db-update-noop.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/direct-update/05-db-verify.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-missing-marker/01-db-verify-fail.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-missing-marker/02-db-schema-verify-fail.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-missing-marker/03-db-introspect-empty.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-missing-marker/04-db-init-recovery.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-missing-marker/05-db-verify-pass.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-phantom/01-db-verify-false-positive.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-phantom/02-db-schema-verify-fail.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-phantom/03-db-introspect-diverged.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-phantom/04-db-update-recovery.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-phantom/05-db-schema-verify-pass.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-stale-marker/01-db-verify-fail.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-stale-marker/02-db-schema-verify-fail.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-stale-marker/03-db-update-recovery.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-stale-marker/04-db-verify-pass.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/01-contract-emit.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/02-db-init-dry-run.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/03-db-init.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/04-db-init-idempotent.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/05-db-verify.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/06-db-schema-verify.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/07-db-schema-verify-strict.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/08-db-introspect.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/09-db-verify-json.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/10-db-schema-verify-json.ascii
  • packages/1-framework/3-tooling/cli/recordings/config.ts
  • packages/1-framework/3-tooling/cli/recordings/fixtures/contract-additive.ts
  • packages/1-framework/3-tooling/cli/recordings/fixtures/contract-base.ts
  • packages/1-framework/3-tooling/cli/recordings/fixtures/prisma-next.config.ts
  • packages/1-framework/3-tooling/cli/recordings/tapes/db-init/apply.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/db-init/dry-run.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/db-init/help.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/db-update/additive-dry-run.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/db-update/help.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/db-update/no-changes.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/direct-update/01-contract-emit-v2.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/direct-update/02-db-update-dry-run.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/direct-update/03-db-update-apply.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/direct-update/04-db-update-noop.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/direct-update/05-db-verify.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-missing-marker/01-db-verify-fail.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-missing-marker/02-db-schema-verify-fail.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-missing-marker/03-db-introspect-empty.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-missing-marker/04-db-init-recovery.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-missing-marker/05-db-verify-pass.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/01-db-verify-false-positive.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/02-db-schema-verify-fail.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/03-db-introspect-diverged.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/04-db-update-recovery.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-phantom/05-db-schema-verify-pass.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-stale-marker/01-db-verify-fail.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-stale-marker/02-db-schema-verify-fail.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-stale-marker/03-db-update-recovery.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/drift-stale-marker/04-db-verify-pass.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/01-contract-emit.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/02-db-init-dry-run.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/03-db-init.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/04-db-init-idempotent.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/05-db-verify.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/06-db-schema-verify.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/07-db-schema-verify-strict.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/08-db-introspect.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/09-db-verify-json.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/greenfield-setup/10-db-schema-verify-json.tape
  • packages/1-framework/3-tooling/cli/recordings/tapes/shared-config.tape
  • packages/1-framework/3-tooling/cli/scripts/record.ts
  • packages/1-framework/3-tooling/cli/src/utils/cli-errors.ts
  • test/integration/.gitignore
  • test/integration/package.json
  • test/integration/test/cli-journeys/README.md
  • test/integration/test/cli-journeys/brownfield-adoption.e2e.test.ts
  • test/integration/test/cli-journeys/config-errors.e2e.test.ts
  • test/integration/test/cli-journeys/connection-and-contract-errors.e2e.test.ts
  • test/integration/test/cli-journeys/db-update-workflows.e2e.test.ts
  • test/integration/test/cli-journeys/drift-marker.e2e.test.ts
  • test/integration/test/cli-journeys/drift-migration-dag.e2e.test.ts
  • test/integration/test/cli-journeys/drift-schema.e2e.test.ts
  • test/integration/test/cli-journeys/greenfield-setup.e2e.test.ts
  • test/integration/test/cli-journeys/help-and-flags.e2e.test.ts
  • test/integration/test/cli-journeys/multi-step-migration.e2e.test.ts
  • test/integration/test/cli-journeys/schema-evolution-migrations.e2e.test.ts
  • test/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/cli-journeys/contract-add-table.ts
  • test/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/cli-journeys/contract-additive.ts
  • test/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/cli-journeys/contract-base.ts
  • test/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/cli-journeys/contract-destructive.ts
  • test/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/cli-journeys/contract-v3.ts
  • test/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/cli-journeys/contract.ts
  • test/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/cli-journeys/prisma-next.config.ts
  • test/integration/test/fixtures/cli/cli-e2e-test-app/fixtures/cli-journeys/prisma-next.config.with-db.ts
  • test/integration/test/utils/journey-test-helpers.ts
  • test/integration/vitest.journeys.config.ts
  • turbo.json

Build a minimal PATH (wrapper dir, node, vhs/ttyd, system paths)
instead of dumping the developer's full $PATH into committed tapes.
Eliminates machine-specific personal tool directories from recordings.

@saevarb saevarb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me (minus the path issue) - I did not review every single scenario file, but I like the general approach and that it's easily extended with new examples. I think this is going to be 🔥 for docs.

Base automatically changed from feat/cli-scenarios to main March 17, 2026 10:57

@wmadden wmadden left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except for the hardcoded paths @saevarb mentioned 👍🏻

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/09-db-verify-json.ascii`:
- Around line 195-224: The recorded JSON payload is truncated—complete the
object by finishing the "meta" object and closing the root JSON object so the
file is valid JSON (ensure matching closing braces for "meta" and the top-level
object and include any missing trailing fields expected for this recording), and
if truncation is intermittent, increase the final sleep/delay in the tape step
that captures the command output so the full command stdout (including the
closing braces) is written before the capture ends; look around the "meta",
"contract", "marker", and "schema" keys in this recording to place the missing
closures.

In `@packages/1-framework/3-tooling/cli/scripts/record.ts`:
- Line 906: The call to destroyDatabasePool(baseConnStr, slugs.length) is
currently swallowing errors via .catch(() => {}); remove the silent catch so
failures propagate (or replace it with explicit logging and rethrow) so the
script fails loudly on unrecoverable cleanup errors; locate the invocation of
destroyDatabasePool in record.ts and either await it without .catch or handle
the error by logging the full error and rethrowing to ensure stale databases
aren’t left behind.
- Line 54: Replace the node:path import with pathe to ensure cross-runtime path
handling: change the import statement that currently reads import { dirname,
join, relative, resolve } from 'node:path' to import those same symbols from
'pathe' instead so functions used in this file (dirname, join, relative,
resolve) use the pathe implementations for consistent behavior across
Windows/macOS/Linux and non-Node runtimes.
- Around line 116-123: The execSync calls build shell strings and are vulnerable
to shell injection; update probeCliOutput (where `args` is interpolated), the
Bash wrapper (where `cwd` is injected into a `cd`), runCliIn (where an args
array is joined into a space-separated string), and runVhs (where `tapePath` is
interpolated) to use execFileSync or spawnSync with an explicit argv array (pass
CLI_BIN and args as separate elements) and avoid passing commands through the
shell, and ensure any wrapper script that must embed paths quotes them safely
(e.g. use JSON.stringify-style quoting when constructing wrapper content) so
paths/arguments with spaces or metacharacters are not executed by the shell.
- Line 738: The check currently uses the `in` operator (`if (!(slug in
config.journeys))`) which inspects the prototype chain; update the existence
check to use `Object.hasOwn(config.journeys, slug)` so only own properties are
considered. Locate the condition in the `record.ts` logic where `slug` and
`config.journeys` are referenced and replace the predicate accordingly, ensuring
the surrounding control flow (error handling or creation logic) remains
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 3216c6bc-3c9a-4674-88a2-f77a943f47ad

📥 Commits

Reviewing files that changed from the base of the PR and between 0b6cb16 and eda3a38.

⛔ Files ignored due to path filters (29)
  • packages/1-framework/3-tooling/cli/recordings/svgs/direct-update/01-contract-emit-v2.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/direct-update/02-db-update-dry-run.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/direct-update/03-db-update-apply.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/direct-update/04-db-update-noop.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/direct-update/05-db-verify.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-missing-marker/01-db-verify-fail.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-missing-marker/02-db-schema-verify-fail.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-missing-marker/03-db-introspect-empty.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-missing-marker/04-db-init-recovery.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-missing-marker/05-db-verify-pass.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-phantom/01-db-verify-false-positive.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-phantom/02-db-schema-verify-fail.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-phantom/03-db-introspect-diverged.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-phantom/04-db-update-recovery.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-phantom/05-db-schema-verify-pass.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-stale-marker/01-db-verify-fail.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-stale-marker/02-db-schema-verify-fail.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-stale-marker/03-db-update-recovery.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/drift-stale-marker/04-db-verify-pass.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/01-contract-emit.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/02-db-init-dry-run.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/03-db-init.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/04-db-init-idempotent.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/05-db-verify.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/06-db-schema-verify.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/07-db-schema-verify-strict.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/08-db-introspect.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/09-db-verify-json.svg is excluded by !**/*.svg
  • packages/1-framework/3-tooling/cli/recordings/svgs/greenfield-setup/10-db-schema-verify-json.svg is excluded by !**/*.svg
📒 Files selected for processing (10)
  • packages/1-framework/3-tooling/cli/recordings/.gitignore
  • packages/1-framework/3-tooling/cli/recordings/ascii/direct-update/05-db-verify.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-missing-marker/01-db-verify-fail.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-missing-marker/05-db-verify-pass.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-phantom/01-db-verify-false-positive.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-stale-marker/01-db-verify-fail.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-stale-marker/04-db-verify-pass.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/05-db-verify.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/greenfield-setup/09-db-verify-json.ascii
  • packages/1-framework/3-tooling/cli/scripts/record.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-phantom/01-db-verify-false-positive.ascii
  • packages/1-framework/3-tooling/cli/recordings/.gitignore
  • packages/1-framework/3-tooling/cli/recordings/ascii/direct-update/05-db-verify.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-stale-marker/01-db-verify-fail.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-missing-marker/05-db-verify-pass.ascii
  • packages/1-framework/3-tooling/cli/recordings/ascii/drift-stale-marker/04-db-verify-pass.ascii

@jkomyno
jkomyno merged commit 64fc032 into main Mar 17, 2026
11 checks passed
@jkomyno
jkomyno deleted the feat/cli-recording branch March 17, 2026 16:01
wmadden pushed a commit that referenced this pull request Mar 20, 2026
## Summary

- Closes
[TML-2071](https://linear.app/prisma-company/issue/TML-2071/pn-record-cli-scenarios-on-demand)
- Add automated CLI recording system using
[VHS](https://github.com/agentstation/vhs)
- Recording script (`scripts/record.ts`) with per-command and multi-step
journey modes
- Two-layer caching: turbo (task-level) + per-recording output probes to
skip unchanged recordings
- CI workflow (`workflow_dispatch`) to regenerate all recordings and
open a PR
- `docker-compose.yaml` for local PostgreSQL on port 5433
- `CLI_RECORDING.md` documenting prerequisites, usage, caching, and file
layout

### Recording modes

- **Per-command**: isolated recordings of individual CLI commands (`db
init --help`, `db init --dry-run`, etc.)
- **Journey**: multi-step scenarios where database state accumulates
(greenfield setup, direct update, drift detection + recovery)

### Caching

- **Layer 1 (turbo)**: if recording script, config, fixtures, and CLI
dist haven't changed, turbo replays cached outputs instantly
- **Layer 2 (per-recording probe)**: when turbo misses, each per-command
recording is probed by running the CLI directly (~1s). Only recordings
whose output changed are re-recorded via VHS

### Usage

```bash
docker compose up -d
pnpm record                                  # per-command recordings
pnpm record -- --journey greenfield-setup    # single journey
pnpm record -- --all-journeys               # all journeys in parallel
```

## Test plan

- [x] `pnpm record` produces SVGs and ASCII files locally
- [x] Second `pnpm record` run shows `(unchanged)` for all recordings
(cache hit)
- [ ] CI workflow (`record-cli.yml`) runs successfully via
`workflow_dispatch`

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

* **Documentation**
* Added comprehensive guide for the CLI recording workflow, including
prerequisites, setup, and execution steps for per-command and
journey-based recordings.

* **Chores**
* Established automated recording infrastructure with GitHub Actions
workflow, Docker Compose support, and configuration system.
* Added fixture files and scripts to support CLI demonstration and
testing scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: jkomyno <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants