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

TML-2930: add prisma-next lsp subcommand + PSL diagnostics language server - #852

Merged
SevInf merged 15 commits into
mainfrom
lsp-scaffold
Jun 19, 2026
Merged

SevInf merged 15 commits into
mainfrom
lsp-scaffold

Conversation

@SevInf

@SevInf SevInf commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Linked issue

Refs TML-2930 — foundation work for the Language Tools Support Prisma Next PSL project. The spec + plan live under projects/lsp-scaffold/ for review and are removed at project close-out.

At a glance

The editor launches the project-local CLI as a language server over stdio:

node_modules/.bin/prisma-next lsp --stdio

It completes the initialize handshake, advertising incremental document sync and diagnostics:

// → initialize response (real handshake, verified)
{ "capabilities": { "textDocumentSync": 2 } }

and then publishes PSL parse diagnostics for the schema files declared in prisma-next.config.ts, at the exact source ranges the parser reports — the same diagnostics format / contract emit would surface, now live at the cursor instead of only at build time.

The decision

This PR ships the first piece of Prisma Next LSP support. It carries three things:

  1. A new prisma-next lsp subcommand and a new @prisma-next/language-server package. The subcommand is a thin entry point (createLspCommand) that delegates to the package, which owns the LSP connection, lifecycle, document sync, and diagnostics. lsp is a CLI subcommand — version-matched to the project's own @prisma-next by construction, like deno lsp — not a separate binary.
  2. A new @prisma-next/config-loader package that owns loading prisma-next.config.ts. This is where config loading now lives for both the CLI and the language server, replacing the loader that previously lived inside @prisma-next/cli.
  3. Diagnostics sourced from the CST parse, not the legacy parsePslDocument (which is slated for removal independently).

One server runs per project. Schema documents are identified from config (a document is a schema input when its path is one of the resolved contract.source.inputs). The server watches prisma-next.config.ts and re-resolves on change, so the input set stays live without a restart.

How config loading is organised now

Before this PR, loading prisma-next.config.ts lived inside @prisma-next/cli (config-loader.ts + config-path-validation.ts), so a language-server package could not reuse it without importing from the CLI — which the dependency rules forbid. This PR moves that loading into its own package and removes the CLI's private copy:

  1. @prisma-next/config-loader exposes a single loadConfig(configPath?). It runs c12 to execute the config file, validates it, resolves contract.source.inputs / contract.output to absolute paths, and applies the emitter output/input collision check (it imports getEmittedArtifactPaths from @prisma-next/emitter itself). On failure it throws the CLI's structured @prisma-next/errors/control errors — the same errors, with the same codes, the CLI produced before. See config-loader/src/load.ts.
  2. The CLI's config-loader.ts wrapper is deleted. Its ~17 source consumers (contract-emit, db-sign, db-verify, inspect-live-schema, migrate, the migration-* commands, …) now import loadConfig from @prisma-next/config-loader directly — same function name, same behaviour, same error codes. cli/src/config-path-validation.ts is deleted; its path-resolution logic moved alongside the loader.
  3. @prisma-next/config goes back to types + validation + path-finalising helpers (finalize-config.ts, errors.ts, config-types.ts, config-validation.ts); it no longer loads config and no longer depends on c12.

How the language server works

  1. initialize — resolves the project root from the client's rootUri/rootPath, loads prisma-next.config.ts via @prisma-next/config-loader's loadConfig, and records which absolute paths are schema inputs. A missing or invalid config degrades gracefully: the server still initializes with an empty input set and logs a warning. Config is resolved once here.
  2. Reading config errors — loadConfig throws structured CliStructuredErrors, so the server's config-resolution.ts branches on the stable error code (4001 = config file not found, 4009 = config validation) to decide whether to degrade; any other code is re-thrown as a genuine failure. The CLI error codes are unchanged by this PR.
  3. Document sync — incremental (TextDocumentSyncKind.Incremental); the TextDocuments manager applies the client's deltas and the server re-parses the full current buffer on each change.
  4. Diagnostics — on didOpen / didChange of a document whose URI is a configured input, the server runs @prisma-next/psl-parser's parse() and publishes the mapped diagnostics. A clean parse publishes an empty array (clearing markers); a non-input document publishes nothing.
  5. Live config — on a workspace/didChangeWatchedFiles event for the config path, the server re-resolves the input set and re-publishes across open documents, so adding/removing an input takes effect without a restart. Works whether or not the config file is open in the editor.

The ParseDiagnostic → LSP diagnostic mapping in diagnostic-mapping.ts is a pure transform with no vscode-languageserver import: the parser already emits zero-based, LSP-shaped ranges, so ranges pass through unchanged and the connection layer adapts severity at the boundary.

Behavior changes & evidence

Notes for the reviewer

  • @prisma-next/config-loader is the one substantive new package besides the language server. It sits at the tooling layer (peer of the CLI and emitter), which is why it may import @prisma-next/emitter, @prisma-next/errors, and @prisma-next/config directly. loadConfig keeps the CLI's existing error codes (PN-CLI-4001/4009/…), so nothing user-facing changes for CLI consumers.
  • The language server reads those error codes (4001/4009) to decide graceful degradation rather than catching typed error classes. The codes are stable, documented constants (asserted in @prisma-next/errors tests), so this coupling is to a public contract, not an internal detail.
  • @prisma-next/config lost its c12 dependency and its config-loading exports; it is back to types + validation + path-finalising. The path-finalising still takes the emitter collision check as a hook so @prisma-next/config keeps no edge to the emitter.
  • psl-parser barrel gains a parse export. The CST parse wasn't exported from any public barrel (only parsePslDocument was); psl-parser/src/exports/parser.ts now exports it plus its ParseDiagnostic/Range types. parsePslDocument is untouched.
  • Pre-existing CLI test flakes, NOT from this PR. cli/test/version.test.ts, removed-verb-redirects.test.ts, and migration-list-json-golden fail on a hard-coded 500ms CLI-spawn timeout (a cold spawn measures ~1.2s on a dev machine); they fail identically on clean main with this branch's changes stashed. There is also a committed bare-as lint item in cli/src/commands/init/hygiene-package-scripts.ts that predates and is untouched here. If CI's runner is slow, those spawn tests may need a longer timeout — flagging so the red isn't mis-attributed.
  • Project artefacts on disk. projects/lsp-scaffold/{spec,plan}.md are included for review and removed at project close-out (the ADR recording the "version-matched CLI subcommand, one server per project" decision lands in docs/ then).

Compatibility / migration / risk

  • No public API or behaviour change for existing CLI commands. Config loading moved packages and the CLI wrapper was deleted, but loadConfig's signature, behaviour, and thrown error codes are preserved. The additive public surface is the new lsp command, the @prisma-next/config-loader package, and the new @prisma-next/psl-parser/parser parse export.

Testing performed

Run on final HEAD:

  • pnpm install --frozen-lockfile — clean (lockfile and manifests agree).
  • pnpm lint:deps — clean (no dependency violations; the new package's imports are legal).
  • pnpm --filter @prisma-next/config-loader test — passes.
  • pnpm --filter @prisma-next/language-server test — passes (incl. config-watching + graceful-degradation cases).
  • pnpm --filter @prisma-next/config test — passes.
  • pnpm --filter @prisma-next/psl-parser test — passes.
  • pnpm --filter @prisma-next/integration-tests test cli.db-verify — passes (CLI structured-error behaviour preserved end-to-end).
  • pnpm --filter @prisma-next/cli typecheck && build — clean; pnpm --filter prisma-next lint (facade dependency sync) — clean.
  • Manual: scripted LSP initialize handshake against the built CLI (prisma-next lsp --stdio) returns textDocumentSync: 2.
  • Ruled pre-existing (reproduced on clean main): the CLI 500ms spawn-timeout flakes noted above.

Skill update

n/a — internal foundation work. No user-facing skill surface changes here; the prisma-next lsp command is documented in the package README and the project spec. A user-facing skill / docs update for the LSP will follow with the editor-extension work.

Checklist

  • All commits are signed off (git commit -s).
  • I read CONTRIBUTING.md and the change is scoped to one logical concern.
  • Tests are updated.
  • The PR title is in TML-NNNN: <sentence-case title> form.
  • The Skill update section is filled in.

Alternatives considered

  • Separate prisma-next-lsp binary instead of a subcommand — rejected: a subcommand is version-matched to the project's own @prisma-next by construction and avoids a second package to keep pinned together. (deno lsp is the precedent.)
  • Server inline in @prisma-next/cli instead of its own package — rejected: a dedicated package keeps vscode-languageserver's footprint off the core CLI surface and gives later LSP features a clean home.
  • Keeping config loading in @prisma-next/cli (or moving it into @prisma-next/config) — rejected: the CLI can't be imported by the language server (dependency rules), and @prisma-next/config sits below the tooling layer, so it can't reach the emitter or the CLI error factories the loader needs. A dedicated tooling-layer @prisma-next/config-loader package is the home that lets both the CLI and the language server share one loadConfig.
  • Two load functions (structured errors for the CLI, typed errors for the language server) — rejected: one loadConfig throwing structured errors, with the language server reading the stable error codes, keeps a single public entry point and avoids duplicating the loader's surface.
  • Diagnose every configured input eagerly / watch schema files — out of scope: diagnostics are parse-only, so a closed input's content has no bearing on any open document; only the config file is watched. Eager whole-schema diagnosis is a nameable later capability.
  • Source diagnostics from parsePslDocument — rejected: it's legacy and slated for removal; the CST parse is what format already consumes, so the language server and the formatter agree on what a diagnostic is.

@SevInf
SevInf requested a review from a team as a code owner June 18, 2026 11:59
@coderabbitai

coderabbitai Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

A shared loadResolvedConfig/finalizeConfig API is extracted into @prisma-next/config with c12-based TypeScript config discovery and optional emitted-artifact collision detection. A new @prisma-next/language-server package implements a diagnostics-only LSP server over stdio that publishes PSL parse diagnostics for configured schema inputs with graceful degradation on missing or invalid project configuration. The CLI adds a prisma-next lsp command backed by the new server and refactors its config-loading pipeline to use the shared loader.

Changes

Config loading, language server, and CLI lsp command

Layer / File(s) Summary
Config error types
packages/1-framework/1-core/config/src/errors.ts, packages/1-framework/1-core/config/test/errors.test.ts
ConfigFileNotFoundError error class with optional configPath and why fields; message priority: explicit why, then formatted configPath, then default. Tests verify constructor behavior and field assignment for all combinations.
Config finalization with path resolution and collision validation
packages/1-framework/1-core/config/src/finalize-config.ts, packages/1-framework/1-core/config/test/finalize-config.test.ts
finalizeConfig normalizes contract, resolves relative paths to absolute against config directory, validates input paths do not collide with emitted-artifact paths (JSON/DTS) via optional resolver hook (throws ConfigValidationError on collision or hook failure), returns updated config. Tests verify no-contract pass-through, path resolution, undefined input handling, collision detection, resolver error wrapping, and field identity preservation.
Config discovery and loading
packages/1-framework/1-core/config/package.json, packages/1-framework/1-core/config/src/load.ts, packages/1-framework/1-core/config/test/load.test.ts
loadResolvedConfig uses c12 for TypeScript config discovery, validates shape, enforces that explicitly requested paths are loaded, rejects missing/empty results with ConfigFileNotFoundError, delegates to finalizeConfig with optional collision checking. Package.json adds c12/pathe runtime dependencies. Tests verify absolute path resolution, missing configs, explicit path failures, invalid shapes, and collision detection.
Config package public API and build
packages/1-framework/1-core/config/src/exports/load.ts, packages/1-framework/1-core/config/tsdown.config.ts
New ./load export entry in package.json points to built loader/finalization APIs. Tsdown build config includes src/exports/load.ts entry for bundled distribution of error types, finalization, and loader functions.
PSL parser public API expansion
packages/1-framework/2-authoring/psl-parser/src/exports/parser.ts
Parser export barrel now re-exports parse, diagnostic result types, and source position types for external LSP consumers alongside existing parsePslDocument.
Language server package infrastructure
architecture.config.json, pnpm-workspace.yaml, packages/1-framework/3-tooling/language-server/package.json, packages/1-framework/3-tooling/language-server/README.md, packages/1-framework/3-tooling/language-server/biome.jsonc, packages/1-framework/3-tooling/language-server/tsconfig.json, packages/1-framework/3-tooling/language-server/tsconfig.prod.json, packages/1-framework/3-tooling/language-server/tsdown.config.ts, packages/1-framework/3-tooling/language-server/vitest.config.ts
New workspace package registered in architecture and workspace configs. ESM package.json with build/test/lint/check npm scripts. TypeScript/bundler/linter/test configuration files. Workspace catalog pins vscode-languageserver dependency versions. Comprehensive README describes LSP-over-stdio, initialization, graceful config degradation, incremental document sync, and module responsibilities.
Schema input resolution
packages/1-framework/3-tooling/language-server/src/schema-inputs.ts, packages/1-framework/3-tooling/language-server/test/schema-inputs.test.ts
SchemaInputSet provides URI membership testing. resolveSchemaInputs converts configured contract.source.inputs paths to canonical file: URIs, returns set backing includes(uri). Empty/missing inputs produce set that always returns false. Tests validate URI inclusion for configured inputs and non-inclusion for missing/empty/unconfigured cases.
Diagnostic mapping and document computation
packages/1-framework/3-tooling/language-server/src/diagnostic-mapping.ts, packages/1-framework/3-tooling/language-server/src/document-diagnostics.ts, packages/1-framework/3-tooling/language-server/test/diagnostic-mapping.test.ts, packages/1-framework/3-tooling/language-server/test/document-diagnostics.test.ts
ParseDiagnosticSeverity inlines LSP severity constants. LspDiagnostic defines LSP-shaped fields. mapParseDiagnostics preserves parser range/message/code, forces severity to Error. computeDocumentDiagnostics returns null for non-configured URIs, mapped diagnostics for configured PSL inputs. Tests validate severity forcing, diagnostic count preservation, and per-URI null vs array semantics.
Config resolution with graceful degradation
packages/1-framework/3-tooling/language-server/src/config-resolution.ts, packages/1-framework/3-tooling/language-server/test/config-resolution.test.ts
CONFIG_FILENAME constant. ConfigResolution pairs resolved schema inputs with optional degradation reason. resolveConfigInputs loads config, converts to schema inputs, degrades to empty input set with formatted reason on config missing or validation errors; other errors propagate. Tests verify degradation reason formatting for missing and invalid configs.
LSP server creation and wiring
packages/1-framework/3-tooling/language-server/src/server.ts, packages/1-framework/3-tooling/language-server/src/start-server.ts, packages/1-framework/3-tooling/language-server/src/exports/index.ts
createServer binds to LSP Connection, manages TextDocuments, wires initialize/initialized/watched-file handlers and document lifecycle. Publishes diagnostics on open/change, clears on close. Helper utilities map severities, detect dynamic file-watch support, derive root path. startServer creates stdio JSON-RPC connection. Public exports barrel re-exports all runtime APIs.
Language server tests
packages/1-framework/3-tooling/language-server/test/server.test.ts
Comprehensive in-memory JSON-RPC test harness capturing diagnostics per URI and registration requests. Tests cover initialize capability advertising, diagnostics publication for configured/non-configured inputs, error and clean cases, diagnostics clearing on edits, degraded config handling, and full config-watch lifecycle (registration request scoping, input add/remove/degrade transitions).
CLI lsp command
packages/1-framework/3-tooling/cli/src/commands/lsp.ts, packages/1-framework/3-tooling/cli/src/cli.ts, packages/1-framework/3-tooling/cli/test/commands/lsp.test.ts
createLspCommand registers prisma-next lsp with --stdio and --config <path> options, lazily imports language server, calls startServer with derived configPath. Command registered after migrate in CLI program. Test verifies command name and option flags.
CLI config-loader refactor and dependencies
packages/1-framework/3-tooling/cli/package.json, packages/1-framework/3-tooling/cli/src/config-loader.ts, packages/1-framework/3-tooling/cli/vitest.config.ts, packages/1-framework/3-tooling/prisma-next/package.json, test/integration/test/cli.db-verify.e2e.test.ts
config-loader reimplemented as wrapper over shared loadResolvedConfig, removing inline c12/validation/finalization and config-path-validation.ts module. Error mapping maps ConfigValidationError and ConfigFileNotFoundError to CLI control errors. Package dependencies: CLI and prisma-next add @prisma-next/language-server, remove c12. Coverage config removes validation module. Integration test mock adds deserializeContract function.

Sequence Diagram(s)

sequenceDiagram
  participant Editor
  participant CLI as prisma-next lsp
  participant startServer
  participant createServer
  participant resolveConfigInputs
  participant loadResolvedConfig
  participant computeDocumentDiagnostics

  Editor->>CLI: launch process --stdio
  CLI->>startServer: startServer({ transport: 'stdio' })
  startServer->>createServer: createConnection + options
  Editor->>createServer: initialize(rootUri)
  createServer->>resolveConfigInputs: rootPath, configPath?
  resolveConfigInputs->>loadResolvedConfig: load prisma-next.config.ts
  loadResolvedConfig-->>resolveConfigInputs: PrismaNextConfig or degraded
  resolveConfigInputs-->>createServer: ConfigResolution
  createServer-->>Editor: InitializeResult
  Editor->>createServer: textDocument/didOpen(uri, text)
  createServer->>computeDocumentDiagnostics: uri, text, inputs
  computeDocumentDiagnostics-->>createServer: LspDiagnostic[] or null
  createServer-->>Editor: textDocument/publishDiagnostics
  Editor->>createServer: workspace/didChangeWatchedFiles
  createServer->>resolveConfigInputs: re-resolve inputs
  createServer-->>Editor: republish diagnostics for all open docs
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • prisma/prisma-next#197: Both PRs modify the CLI's loadConfig implementation to integrate with shared @prisma-next/config package—main PR switches to loadResolvedConfig, while the retrieved PR refactors imports/error handling.
  • prisma/prisma-next#746: Both PRs update CLI database introspection (db-verify.ts) to pass explicit contract derived from collectAggregateNamespaces(aggregate) into familyInstance.introspect.

Suggested reviewers

  • wmadden

Poem

🐰 A server hops onto stdio's stream,
Parsing schemas with a diagnostic gleam,
Config paths resolved, collisions caught true,
The LSP rabbit has something new!
From root to editor, the messages flow—
The bunny's language server steals the show! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main objective of the pull request: adding Prisma Next LSP support and PSL diagnostics language server functionality.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lsp-scaffold

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 Jun 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/extension-author-tools

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-author-tools@852

@prisma-next/mongo-runtime

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-runtime@852

@prisma-next/family-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/family-mongo@852

@prisma-next/sql-runtime

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

@prisma-next/family-sql

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

@prisma-next/extension-arktype-json

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-arktype-json@852

@prisma-next/middleware-cache

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/middleware-cache@852

@prisma-next/mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo@852

@prisma-next/extension-paradedb

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

@prisma-next/extension-pgvector

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

@prisma-next/extension-postgis

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-postgis@852

@prisma-next/postgres

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

@prisma-next/sql-orm-client

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

@prisma-next/sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sqlite@852

@prisma-next/extension-supabase

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-supabase@852

@prisma-next/target-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-mongo@852

@prisma-next/adapter-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-mongo@852

@prisma-next/driver-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-mongo@852

@prisma-next/contract

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

@prisma-next/utils

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

@prisma-next/config

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

@prisma-next/errors

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

@prisma-next/framework-components

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/framework-components@852

@prisma-next/operations

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

@prisma-next/ts-render

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/ts-render@852

@prisma-next/contract-authoring

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

@prisma-next/ids

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

@prisma-next/psl-parser

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

@prisma-next/psl-printer

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/psl-printer@852

@prisma-next/cli

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

@prisma-next/cli-telemetry

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

@prisma-next/config-loader

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

@prisma-next/emitter

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

@prisma-next/language-server

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/language-server@852

@prisma-next/migration-tools

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

prisma-next

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

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

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

@prisma-next/mongo-codec

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-codec@852

@prisma-next/mongo-contract

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

@prisma-next/mongo-value

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-value@852

@prisma-next/mongo-contract-psl

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-contract-psl@852

@prisma-next/mongo-contract-ts

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

@prisma-next/mongo-emitter

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

@prisma-next/mongo-schema-ir

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-schema-ir@852

@prisma-next/mongo-query-ast

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-query-ast@852

@prisma-next/mongo-orm

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-orm@852

@prisma-next/mongo-query-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-query-builder@852

@prisma-next/mongo-lowering

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-lowering@852

@prisma-next/mongo-wire

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-wire@852

@prisma-next/sql-contract

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

@prisma-next/sql-errors

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

@prisma-next/sql-operations

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

@prisma-next/sql-schema-ir

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

@prisma-next/sql-contract-psl

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

@prisma-next/sql-contract-ts

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

@prisma-next/sql-contract-emitter

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

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

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

@prisma-next/sql-relational-core

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

@prisma-next/sql-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-builder@852

@prisma-next/target-postgres

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

@prisma-next/target-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-sqlite@852

@prisma-next/adapter-postgres

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

@prisma-next/adapter-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-sqlite@852

@prisma-next/driver-postgres

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

@prisma-next/driver-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-sqlite@852

commit: 59efc06

@github-actions

github-actions Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

size-limit report 📦

Path Size
postgres / no-emit 154.55 KB (0%)
postgres / emit 142.13 KB (0%)
mongo / no-emit 78 KB (0%)
mongo / emit 72.09 KB (0%)
cf-worker / no-emit 181.82 KB (0%)
cf-worker / emit 167.78 KB (0%)

@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: 2

🧹 Nitpick comments (4)
packages/1-framework/1-core/config/test/load.test.ts (1)

57-95: Reconsider reliance on process.chdir() without explicit test isolation—the config package uses default parallel threading.

packages/1-framework/1-core/config/vitest.config.ts has no explicit isolation settings (unlike packages/1-framework/3-tooling/cli which sets maxWorkers: 1, fileParallelism: false, isolate: false). By default, tests run across multiple worker threads. While thread isolation does separate process state across workers, if multiple tests run sequentially within the same worker and one fails before afterEach completes, the next test may inherit a mutated process.cwd().

Consider either:

  • Adding an explicit afterEach guard to ensure cwd is restored even on failure (e.g., using try…finally)
  • Declaring fileParallelism: false in the config's vitest.config.ts if sequential execution is required
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/1-framework/1-core/config/test/load.test.ts` around lines 57 - 95,
The test suite in the load.test.ts file uses process.chdir() to change
directories but without explicit protection against test isolation failures. If
a test fails before the afterEach hook completes, the next test in the same
worker thread could inherit a mutated process.cwd() state. Wrap the restoration
of the original working directory in the afterEach hook using a try-finally
block to ensure process.chdir(originalCwd) is always executed regardless of test
outcome, or alternatively add explicit parallel execution settings
(fileParallelism: false) to the vitest.config.ts file in the config package to
force sequential test execution.
packages/1-framework/3-tooling/cli/src/commands/lsp.ts (1)

44-48: 💤 Low value

The --stdio flag value is never checked.

Line 44 declares --stdio as an option, but Line 48 always passes transport: 'stdio' to startServer regardless of whether the user provided the flag. Since StartServerOptions (from context snippet 1) only supports 'stdio' transport and defaults to it, the flag appears to be purely informational.

If --stdio is meant to document the transport rather than control it, consider removing it as a user-facing option (the comment on line 18 already documents this). Alternatively, if you want to keep it for clarity, validate that options.stdio !== false before calling startServer, or add a comment explaining that the flag is documentation-only.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/1-framework/3-tooling/cli/src/commands/lsp.ts` around lines 44 - 48,
The --stdio option is declared but its value from the options parameter is never
actually checked or used when calling startServer. Either remove the
.option('--stdio', ...) declaration if the flag is meant to be
documentation-only (since StartServerOptions only supports stdio transport
anyway), or validate that options.stdio is not false before calling startServer
with the transport parameter. If keeping the flag, ensure the parsed value from
options.stdio is properly incorporated into the startServer call logic.
packages/1-framework/3-tooling/cli/test/control-api/format.test.ts (1)

3-3: 💤 Low value

Prefer pathe over node:path for consistency.

Based on learnings, pathe should be used for path operations across the codebase, including package unit tests. The node:path exception applies specifically to integration tests under test/integration/test/. Consider replacing node:path with pathe here for consistency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/1-framework/3-tooling/cli/test/control-api/format.test.ts` at line
3, The import statement is using node:path instead of pathe, which is
inconsistent with the codebase standards. Replace the import statement where
join is imported from node:path by changing it to import join from pathe
instead. This aligns with the preferred path handling library used throughout
the codebase, with the exception being reserved only for integration tests under
test/integration/test/.

Source: Learnings

packages/1-framework/3-tooling/cli/src/config-loader.ts (1)

51-63: Remove unreachable file-not-found fallback.

Lines 38–40 catch ConfigFileNotFoundError from loadResolvedConfig, which is documented to throw only ConfigFileNotFoundError (or ConfigValidationError) when the config file is missing. The fallback at lines 51–63 that catches generic Error with message patterns like 'ENOENT' cannot be reached because loadResolvedConfig handles all file-not-found scenarios by throwing ConfigFileNotFoundError (see lines 56–57 and 62–63 in load.ts). Remove the redundant pattern-matching block.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/1-framework/3-tooling/cli/src/config-loader.ts` around lines 51 -
63, Remove the unreachable fallback error handling block in the config-loader.ts
file. The if statement that checks for error instanceof Error and
pattern-matches against error.message strings like 'ENOENT', 'not found', and
'Cannot find' cannot be reached because the upstream loadResolvedConfig function
already handles all file-not-found scenarios by throwing
ConfigFileNotFoundError. Delete the entire conditional block (lines 51-63) that
includes the error message pattern checking and the errorConfigFileNotFound
call, as this logic is redundant and unreachable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/1-framework/1-core/config/src/config-types.ts`:
- Around line 149-152: The FormatterConfigSchema currently accepts any number
for the indent property but should enforce that indent values are positive
(greater than 0) according to the documented constraint. Update the 'indent?'
field definition in FormatterConfigSchema to use arktype validation that
explicitly constrains the value to be greater than zero, and add test cases that
verify the schema correctly rejects negative and zero indent values.

In `@packages/1-framework/2-authoring/psl-parser/test/format/options.test.ts`:
- Around line 40-41: Remove the `@ts-expect-error` comment from lines 40 and 57 in
the format function test calls. Instead of suppressing the TypeScript error, use
an explicit type cast (such as "as any") to pass the invalid indent value to the
format function. This allows the runtime validation test to remain functional
while adhering to the coding guideline that prohibits `@ts-expect-error` outside
of negative type tests. Apply this change to both instances: the format call
with indent set to 'spaces' and the similar call at line 57-58.

---

Nitpick comments:
In `@packages/1-framework/1-core/config/test/load.test.ts`:
- Around line 57-95: The test suite in the load.test.ts file uses
process.chdir() to change directories but without explicit protection against
test isolation failures. If a test fails before the afterEach hook completes,
the next test in the same worker thread could inherit a mutated process.cwd()
state. Wrap the restoration of the original working directory in the afterEach
hook using a try-finally block to ensure process.chdir(originalCwd) is always
executed regardless of test outcome, or alternatively add explicit parallel
execution settings (fileParallelism: false) to the vitest.config.ts file in the
config package to force sequential test execution.

In `@packages/1-framework/3-tooling/cli/src/commands/lsp.ts`:
- Around line 44-48: The --stdio option is declared but its value from the
options parameter is never actually checked or used when calling startServer.
Either remove the .option('--stdio', ...) declaration if the flag is meant to be
documentation-only (since StartServerOptions only supports stdio transport
anyway), or validate that options.stdio is not false before calling startServer
with the transport parameter. If keeping the flag, ensure the parsed value from
options.stdio is properly incorporated into the startServer call logic.

In `@packages/1-framework/3-tooling/cli/src/config-loader.ts`:
- Around line 51-63: Remove the unreachable fallback error handling block in the
config-loader.ts file. The if statement that checks for error instanceof Error
and pattern-matches against error.message strings like 'ENOENT', 'not found',
and 'Cannot find' cannot be reached because the upstream loadResolvedConfig
function already handles all file-not-found scenarios by throwing
ConfigFileNotFoundError. Delete the entire conditional block (lines 51-63) that
includes the error message pattern checking and the errorConfigFileNotFound
call, as this logic is redundant and unreachable.

In `@packages/1-framework/3-tooling/cli/test/control-api/format.test.ts`:
- Line 3: The import statement is using node:path instead of pathe, which is
inconsistent with the codebase standards. Replace the import statement where
join is imported from node:path by changing it to import join from pathe
instead. This aligns with the preferred path handling library used throughout
the codebase, with the exception being reserved only for integration tests under
test/integration/test/.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 447f79ca-609a-4187-bc5f-844c5e84c000

📥 Commits

Reviewing files that changed from the base of the PR and between 88c5e7c and c2c60f1.

⛔ Files ignored due to path filters (3)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • projects/lsp-scaffold/plan.md is excluded by !projects/**
  • projects/lsp-scaffold/spec.md is excluded by !projects/**
📒 Files selected for processing (110)
  • architecture.config.json
  • packages/1-framework/1-core/config/package.json
  • packages/1-framework/1-core/config/src/config-types.ts
  • packages/1-framework/1-core/config/src/contract-source-types.ts
  • packages/1-framework/1-core/config/src/errors.ts
  • packages/1-framework/1-core/config/src/exports/config-types.ts
  • packages/1-framework/1-core/config/src/exports/load.ts
  • packages/1-framework/1-core/config/src/finalize-config.ts
  • packages/1-framework/1-core/config/src/load.ts
  • packages/1-framework/1-core/config/test/config-types.test-d.ts
  • packages/1-framework/1-core/config/test/config-validation.test.ts
  • packages/1-framework/1-core/config/test/finalize-config.test.ts
  • packages/1-framework/1-core/config/test/load.test.ts
  • packages/1-framework/1-core/config/tsdown.config.ts
  • packages/1-framework/2-authoring/psl-parser/package.json
  • packages/1-framework/2-authoring/psl-parser/src/exports/format.ts
  • packages/1-framework/2-authoring/psl-parser/src/exports/parser.ts
  • packages/1-framework/2-authoring/psl-parser/src/format/emit.ts
  • packages/1-framework/2-authoring/psl-parser/src/format/error.ts
  • packages/1-framework/2-authoring/psl-parser/src/format/format.ts
  • packages/1-framework/2-authoring/psl-parser/src/format/options.ts
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures.test.ts
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/alignment-model/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/alignment-model/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/alignment-trivia/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/alignment-trivia/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/alignment-widths/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/alignment-widths/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/blank-lines/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/blank-lines/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/block-attribute-spacing/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/block-attribute-spacing/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/block-attributes/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/block-attributes/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/block-separation/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/block-separation/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/comments-preserved/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/comments-preserved/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/dangling-comments/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/dangling-comments/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/datasource-generic-blocks/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/datasource-generic-blocks/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/enum-and-generator-block/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/enum-and-generator-block/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/inline-comment-after-equals/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/inline-comment-after-equals/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/inline-comment-arg-list/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/inline-comment-arg-list/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/inline-comment-hard-break/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/inline-comment-hard-break/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/kitchen-sink/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/kitchen-sink/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/leading-comments/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/leading-comments/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/named-type-inline-break/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/named-type-inline-break/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/structural-emit/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/structural-emit/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/top-level-blank-collapse/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/top-level-blank-collapse/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/trailing-comments/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/trailing-comments/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/type-annotations/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/type-annotations/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/types-namespaced-constructor/expected.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/fixtures/types-namespaced-constructor/input.prisma
  • packages/1-framework/2-authoring/psl-parser/test/format/options.test.ts
  • packages/1-framework/2-authoring/psl-parser/tsdown.config.ts
  • packages/1-framework/3-tooling/cli/package.json
  • packages/1-framework/3-tooling/cli/recordings/fixtures/prisma-next.config.ts
  • packages/1-framework/3-tooling/cli/src/cli.ts
  • packages/1-framework/3-tooling/cli/src/commands/format.ts
  • packages/1-framework/3-tooling/cli/src/commands/lsp.ts
  • packages/1-framework/3-tooling/cli/src/config-loader.ts
  • packages/1-framework/3-tooling/cli/src/config-path-validation.ts
  • packages/1-framework/3-tooling/cli/src/control-api/operations/format.ts
  • packages/1-framework/3-tooling/cli/src/exports/index.ts
  • packages/1-framework/3-tooling/cli/test/commands/lsp.test.ts
  • packages/1-framework/3-tooling/cli/test/control-api/format.test.ts
  • packages/1-framework/3-tooling/cli/vitest.config.ts
  • packages/1-framework/3-tooling/language-server/README.md
  • packages/1-framework/3-tooling/language-server/biome.jsonc
  • packages/1-framework/3-tooling/language-server/package.json
  • packages/1-framework/3-tooling/language-server/src/config-resolution.ts
  • packages/1-framework/3-tooling/language-server/src/diagnostic-mapping.ts
  • packages/1-framework/3-tooling/language-server/src/document-diagnostics.ts
  • packages/1-framework/3-tooling/language-server/src/exports/index.ts
  • packages/1-framework/3-tooling/language-server/src/schema-inputs.ts
  • packages/1-framework/3-tooling/language-server/src/server.ts
  • packages/1-framework/3-tooling/language-server/src/start-server.ts
  • packages/1-framework/3-tooling/language-server/test/config-resolution.test.ts
  • packages/1-framework/3-tooling/language-server/test/diagnostic-mapping.test.ts
  • packages/1-framework/3-tooling/language-server/test/document-diagnostics.test.ts
  • packages/1-framework/3-tooling/language-server/test/schema-inputs.test.ts
  • packages/1-framework/3-tooling/language-server/test/server.test.ts
  • packages/1-framework/3-tooling/language-server/tsconfig.json
  • packages/1-framework/3-tooling/language-server/tsconfig.prod.json
  • packages/1-framework/3-tooling/language-server/tsdown.config.ts
  • packages/1-framework/3-tooling/language-server/vitest.config.ts
  • packages/2-mongo-family/2-authoring/contract-psl/src/provider.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/provider.test.ts
  • packages/2-mongo-family/2-authoring/contract-ts/src/config-types.ts
  • packages/2-mongo-family/2-authoring/contract-ts/test/config-types.test.ts
  • packages/2-sql/2-authoring/contract-psl/src/provider.ts
  • packages/2-sql/2-authoring/contract-psl/test/provider.test.ts
  • packages/2-sql/2-authoring/contract-ts/src/config-types.ts
  • packages/2-sql/2-authoring/contract-ts/test/config-types.test.ts
  • pnpm-workspace.yaml
  • test/integration/test/cli-journeys/format.e2e.test.ts
  • test/integration/test/utils/journey-test-helpers.ts
💤 Files with no reviewable changes (2)
  • packages/1-framework/3-tooling/cli/src/config-path-validation.ts
  • packages/1-framework/3-tooling/cli/vitest.config.ts

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/1-framework/3-tooling/language-server/test/server.test.ts`:
- Around line 278-285: Replace the fixed 50ms setTimeout call with event-based
or condition-based waiting that checks for the actual registration state.
Instead of pausing for an arbitrary delay, implement a helper function or use a
waitFor pattern that repeatedly checks if a workspace/didChangeWatchedFiles
registration exists in harness.registrations, with a reasonable bounded timeout.
This same pattern should be applied to all occurrences of setTimeout delays used
to gate registration assertions in this test file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: f4b4210e-da04-43df-84fb-14d186e60a32

📥 Commits

Reviewing files that changed from the base of the PR and between c2c60f1 and 988ac0a.

⛔ Files ignored due to path filters (3)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • projects/lsp-scaffold/plan.md is excluded by !projects/**
  • projects/lsp-scaffold/spec.md is excluded by !projects/**
📒 Files selected for processing (37)
  • architecture.config.json
  • packages/1-framework/1-core/config/package.json
  • packages/1-framework/1-core/config/src/errors.ts
  • packages/1-framework/1-core/config/src/exports/load.ts
  • packages/1-framework/1-core/config/src/finalize-config.ts
  • packages/1-framework/1-core/config/src/load.ts
  • packages/1-framework/1-core/config/test/finalize-config.test.ts
  • packages/1-framework/1-core/config/test/load.test.ts
  • packages/1-framework/1-core/config/tsdown.config.ts
  • packages/1-framework/2-authoring/psl-parser/src/exports/parser.ts
  • packages/1-framework/3-tooling/cli/package.json
  • packages/1-framework/3-tooling/cli/src/cli.ts
  • packages/1-framework/3-tooling/cli/src/commands/lsp.ts
  • packages/1-framework/3-tooling/cli/src/config-loader.ts
  • packages/1-framework/3-tooling/cli/src/config-path-validation.ts
  • packages/1-framework/3-tooling/cli/test/commands/lsp.test.ts
  • packages/1-framework/3-tooling/cli/vitest.config.ts
  • packages/1-framework/3-tooling/language-server/README.md
  • packages/1-framework/3-tooling/language-server/biome.jsonc
  • packages/1-framework/3-tooling/language-server/package.json
  • packages/1-framework/3-tooling/language-server/src/config-resolution.ts
  • packages/1-framework/3-tooling/language-server/src/diagnostic-mapping.ts
  • packages/1-framework/3-tooling/language-server/src/document-diagnostics.ts
  • packages/1-framework/3-tooling/language-server/src/exports/index.ts
  • packages/1-framework/3-tooling/language-server/src/schema-inputs.ts
  • packages/1-framework/3-tooling/language-server/src/server.ts
  • packages/1-framework/3-tooling/language-server/src/start-server.ts
  • packages/1-framework/3-tooling/language-server/test/config-resolution.test.ts
  • packages/1-framework/3-tooling/language-server/test/diagnostic-mapping.test.ts
  • packages/1-framework/3-tooling/language-server/test/document-diagnostics.test.ts
  • packages/1-framework/3-tooling/language-server/test/schema-inputs.test.ts
  • packages/1-framework/3-tooling/language-server/test/server.test.ts
  • packages/1-framework/3-tooling/language-server/tsconfig.json
  • packages/1-framework/3-tooling/language-server/tsconfig.prod.json
  • packages/1-framework/3-tooling/language-server/tsdown.config.ts
  • packages/1-framework/3-tooling/language-server/vitest.config.ts
  • pnpm-workspace.yaml
💤 Files with no reviewable changes (2)
  • packages/1-framework/3-tooling/cli/vitest.config.ts
  • packages/1-framework/3-tooling/cli/src/config-path-validation.ts
✅ Files skipped from review due to trivial changes (6)
  • packages/1-framework/3-tooling/language-server/tsconfig.prod.json
  • packages/1-framework/3-tooling/language-server/biome.jsonc
  • packages/1-framework/3-tooling/language-server/tsconfig.json
  • pnpm-workspace.yaml
  • architecture.config.json
  • packages/1-framework/3-tooling/language-server/vitest.config.ts
🚧 Files skipped from review as they are similar to previous changes (24)
  • packages/1-framework/3-tooling/language-server/src/document-diagnostics.ts
  • packages/1-framework/3-tooling/cli/test/commands/lsp.test.ts
  • packages/1-framework/1-core/config/tsdown.config.ts
  • packages/1-framework/3-tooling/language-server/tsdown.config.ts
  • packages/1-framework/3-tooling/language-server/src/exports/index.ts
  • packages/1-framework/2-authoring/psl-parser/src/exports/parser.ts
  • packages/1-framework/1-core/config/src/exports/load.ts
  • packages/1-framework/3-tooling/language-server/test/document-diagnostics.test.ts
  • packages/1-framework/1-core/config/package.json
  • packages/1-framework/3-tooling/language-server/test/diagnostic-mapping.test.ts
  • packages/1-framework/3-tooling/language-server/src/start-server.ts
  • packages/1-framework/3-tooling/language-server/src/diagnostic-mapping.ts
  • packages/1-framework/1-core/config/src/load.ts
  • packages/1-framework/3-tooling/language-server/README.md
  • packages/1-framework/3-tooling/language-server/test/config-resolution.test.ts
  • packages/1-framework/3-tooling/language-server/package.json
  • packages/1-framework/1-core/config/src/finalize-config.ts
  • packages/1-framework/1-core/config/test/finalize-config.test.ts
  • packages/1-framework/1-core/config/test/load.test.ts
  • packages/1-framework/1-core/config/src/errors.ts
  • packages/1-framework/3-tooling/language-server/src/config-resolution.ts
  • packages/1-framework/3-tooling/cli/src/config-loader.ts
  • packages/1-framework/3-tooling/cli/src/commands/lsp.ts
  • packages/1-framework/3-tooling/language-server/src/server.ts

@SevInf
SevInf force-pushed the lsp-scaffold branch 7 times, most recently from a7f52e9 to 7b2aaa9 Compare June 18, 2026 15:55
SevInf added 14 commits June 19, 2026 12:44
…erver

Stand up the foundation of Prisma Next LSP support: a language server,
reachable via the version-matched CLI, that reports PSL parse diagnostics
in-editor.

Delivered as three layers of one reviewable change:

1. Shared config resolution. Lift config load (c12) + PSL-input resolution
   out of @prisma-next/cli into @prisma-next/config (new ./load export,
   loadResolvedConfig). The CLI's loadConfig becomes a thin behaviour-
   preserving wrapper mapping plain typed errors to its structured errors;
   the output/input collision guard stays hook-injected so config keeps no
   @prisma-next/emitter edge.

2. Server package + diagnostics. New @prisma-next/language-server package
   (vscode-languageserver over stdio) and a thin `prisma-next lsp`
   subcommand. Schema documents are identified from config
   (sourceFormat === 'psl' + all resolved inputs); open documents are
   diagnosed via @prisma-next/psl-parser's CST parse, ranges passed through
   unchanged. The ParseDiagnostic -> LSP Diagnostic mapping stays free of
   vscode-languageserver imports.

3. Live config watching. A workspace/didChangeWatchedFiles watcher on the
   config path re-resolves inputs without a restart, fanning out add/clear
   diagnostics; graceful degradation on config-load failure.

Refs: TML-2930
Signed-off-by: Serhii Tatarintsev <[email protected]>
Signed-off-by: Serhii Tatarintsev <[email protected]>
@SevInf
SevInf merged commit a049b56 into main Jun 19, 2026
20 checks passed
@SevInf
SevInf deleted the lsp-scaffold branch June 19, 2026 13:40
SevInf added a commit that referenced this pull request Jun 19, 2026
…856)

## Linked issue

n/a — small, self-contained dev tool. Builds on the language server from
#852 (`prisma-next lsp`).

## Summary

A private `apps/lsp-playground` package providing the `psl-playground`
binary: it opens a PSL file in a browser CodeMirror 6 editor wired to
`prisma-next lsp` over a single-port WebSocket bridge, giving you live
PSL parse diagnostics without setting up an editor extension.

## At a glance

```bash
# Open a blank scratch schema (no file, no config needed):
psl-playground

# Or open an existing PSL file:
psl-playground path/to/schema.psl
```

Then open `http://localhost:5273/` and edit; diagnostics from
`@prisma-next/psl-parser` update live. With no project config, the
playground assumes a default-postgres setup.

```
CodeMirror 6 --LSP/WebSocket--> shared http server (port 5273) --spawn+stdio--> prisma-next lsp --stdio
(codemirror-languageserver)     (Vite middleware + vscode-ws-jsonrpc)           (@prisma-next/language-server)
```

## Decision

This ships one thing: a browser playground for the PSL language server,
as a private `apps/` package so it stays out of the framework build
graph and `lint:deps` layering. Three design decisions shape it:

1. **CodeMirror 6 + `codemirror-languageserver`** for the editor
(lighter than Monaco; grows into hover/completion as the server gains
them).
2. **One port for everything.** Vite runs in middleware mode on a single
`http.Server`; the LSP WebSocket bridge attaches an `upgrade` listener
that only claims `/psl`, so the editor, Vite HMR, and the language
server all share port 5273.
3. **PSL file optional; config optional.** With no argument the
playground stages a scratch schema and generates a default-postgres
config; an existing file already inside a project opens in place under
its own config.

## How it fits together

1. **Resolve what to open.** `src/cli.ts` resolves the schema and the
config above it: an explicit `--config` + file opens in place; an
existing file inside a project opens in place under its discovered
config; otherwise (no file / missing path / file with no project config)
the schema is staged into `.playground/` and a default-postgres config
is generated beside it.
2. **Stage for resolvability.** Staging into `.playground/`
(`src/default-config.ts`, `stageSchema` in `src/cli.ts`) is required
because the language server discovers a document's config by walking up
from the document's own path, and the generated config's
`@prisma-next/*` imports must resolve through the workspace
`node_modules`.
3. **Bridge stdio over WebSocket.** `src/bridge.ts` attaches to the
shared server, and on each `/psl` connection spawns `prisma-next lsp
--stdio` and forwards JSON-RPC via `vscode-ws-jsonrpc`
(`createServerProcess` + `forward`).
4. **Serve the editor.** Vite serves the page; a generated
`src/client/runtime.ts` hands the client the document URI, root, schema
text, and WS path; `src/client/main.ts` mounts CodeMirror with the
`languageServer` extension pointed at the same origin.

## Behavior changes & evidence

- `psl-playground` with **no argument** opens a scratch schema under
default-postgres and publishes live diagnostics —
`apps/lsp-playground/src/cli.ts`,
`apps/lsp-playground/src/default-config.ts`. Validated manually
end-to-end (no-arg launch → `PSL_UNTERMINATED_BLOCK`).
- `psl-playground <file>` opens an existing schema; if it has no project
config it is staged as a sandbox copy under default-postgres, otherwise
opened in place — `apps/lsp-playground/src/cli.ts`. Validated manually
(staged-copy launch → diagnostics).
- Editor and LSP share a single port via Vite middleware mode + an
`/psl`-scoped upgrade handler — `apps/lsp-playground/src/cli.ts`,
`apps/lsp-playground/src/bridge.ts`.

## Reviewer notes

- **Largest file is `src/cli.ts`** — the arg parsing + schema/config
resolution + single-port wiring live there. The branching in
schema/config resolution is the part to spot-check.
- **Staging edits a copy, not your file.** For files outside a project,
the playground deliberately opens a copy under `.playground/` rather
than your original — both because the server needs the config's
`@prisma-next/*` imports to resolve and because walk-up config discovery
requires the schema to sit beside the generated config. This is
intentional sandbox behaviour.
- **Generated artefacts are gitignored.** `.playground/` and
`src/client/runtime.ts` are written at launch and excluded from git;
only sources are tracked.
- **Build prerequisite.** The bridge spawns the built CLI
(`@prisma-next/cli`'s `dist/cli.js`) and the generated config loads
built postgres-stack packages, so a fresh checkout needs `pnpm install`
+ a build of those packages before first run. Noted in the README.
- **No automated tests.** This is a dev tool validated by manual
end-to-end runs (documented in Verification); it ships no unit tests.

## Compatibility / migration / risk

No framework surface changes. `apps/` is exempt from `lint:deps`; the
package is `private` and unpublished. Zero risk to shipped code.

## Testing performed

- `pnpm --filter @prisma-next/lsp-playground typecheck` — clean
- `pnpm --filter @prisma-next/lsp-playground lint` — clean (exit 0)
- Manual end-to-end against rebased `origin/main`: no-arg launch and
existing-file launch both serve the editor on port 5273 and publish
`PSL_UNTERMINATED_BLOCK` for a broken schema over the shared-port
WebSocket bridge.

## Skill update

n/a — internal dev tool; no user-facing CLI/API/config surface of the
framework changes (the `psl-playground` binary lives only in this
private package).

## Alternatives considered

- **Monaco + `monaco-languageclient`** — heavier (pulls the vscode-api
shims); CodeMirror 6 is lighter and sufficient for diagnostics, and
grows into later language features.
- **Two ports (separate Vite + bridge servers)** — the original shape;
collapsed to one shared `http.Server` to avoid hogging two ports.
- **A Zed/VS Code dev extension** — more setup and editor-specific; a
browser playground is editor-agnostic and instantly shareable.
- **`lsp-ws-proxy` (Rust) or the 8-year-old `jsonrpc-ws-proxy`** —
`vscode-ws-jsonrpc` is maintained, all-JS, and `pnpm`-installable.

## Checklist

- [x] All commits are signed off (`git commit -s`) per the DCO.
- [x] I read CONTRIBUTING.md and the change is scoped to one logical
concern.
- [x] Tests are updated (n/a — dev tool validated by manual end-to-end
runs; no behavioural delta to framework code).
- [ ] The PR title is in `TML-NNNN: <sentence-case title>` form (n/a —
no Linear ticket; self-contained dev tool).
- [x] The **Skill update** section above is filled in.


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

## Release Notes

**New Features**
- Added an LSP playground web application for live PSL schema editing
and diagnostics.
- Supports opening an existing schema or using a scratch schema.
- Provides real-time LSP updates in the browser via a WebSocket-to-LSP
bridge.
- Automatically locates the nearest project configuration or generates a
default PostgreSQL configuration when needed.

**Documentation**
- Updated the playground README with local usage and workflow details.

**Chores**
- Updated ignore rules to exclude generated/staged playground output.

**Tests**
- Added a sample “broken” PSL fixture for validation scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Serhii Tatarintsev <[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.

1 participant