@prisma-next/cli 0.14.0-dev.4 → 0.14.0-dev.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.mjs +27 -13
- package/dist/cli.mjs.map +1 -1
- package/dist/{client-CJzuo5wX.mjs → client-CWTNqJdj.mjs} +76 -72
- package/dist/client-CWTNqJdj.mjs.map +1 -0
- package/dist/{command-helpers-DGMvGBeX.mjs → command-helpers-6cNJZ863.mjs} +3 -3
- package/dist/{command-helpers-DGMvGBeX.mjs.map → command-helpers-6cNJZ863.mjs.map} +1 -1
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.mjs +3 -3
- package/dist/commands/db-schema.mjs +3 -3
- package/dist/commands/db-sign.mjs +5 -5
- package/dist/commands/db-sign.mjs.map +1 -1
- package/dist/commands/db-update.mjs +4 -4
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +1 -1
- package/dist/commands/migrate.d.mts.map +1 -1
- package/dist/commands/migrate.mjs +35 -35
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.d.mts +1 -1
- package/dist/commands/migration-check.mjs +1 -1
- package/dist/commands/migration-graph.d.mts +1 -1
- package/dist/commands/migration-graph.mjs +8 -8
- package/dist/commands/migration-graph.mjs.map +1 -1
- package/dist/commands/migration-list.d.mts +6 -6
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +1 -1
- package/dist/commands/migration-log.d.mts +1 -1
- package/dist/commands/migration-log.mjs +1 -1
- package/dist/commands/migration-new.mjs +4 -4
- package/dist/commands/migration-new.mjs.map +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.mjs +4 -4
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts +1 -1
- package/dist/commands/migration-status.mjs +1 -1
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.mjs +3 -3
- package/dist/commands/ref.mjs.map +1 -1
- package/dist/commands/telemetry/index.mjs +1 -1
- package/dist/{contract-at-errors-CFXsstzm.mjs → contract-at-errors-DdxWRjMc.mjs} +2 -2
- package/dist/{contract-at-errors-CFXsstzm.mjs.map → contract-at-errors-DdxWRjMc.mjs.map} +1 -1
- package/dist/{contract-emit-C8HmtboH.mjs → contract-emit-CMwCj7_m.mjs} +8 -6
- package/dist/contract-emit-CMwCj7_m.mjs.map +1 -0
- package/dist/{contract-emit-B_qriF8B.mjs → contract-emit-klH7zzaV.mjs} +6 -6
- package/dist/contract-emit-klH7zzaV.mjs.map +1 -0
- package/dist/{contract-infer-BYT_ra_U.mjs → contract-infer-B__56PGb.mjs} +3 -3
- package/dist/{contract-infer-BYT_ra_U.mjs.map → contract-infer-B__56PGb.mjs.map} +1 -1
- package/dist/{contract-space-aggregate-loader-ClI1KN6d.mjs → contract-space-aggregate-loader-Bu2fjSWV.mjs} +2 -2
- package/dist/{contract-space-aggregate-loader-ClI1KN6d.mjs.map → contract-space-aggregate-loader-Bu2fjSWV.mjs.map} +1 -1
- package/dist/{db-verify-C24FKhb7.mjs → db-verify-DlqHvkkA.mjs} +69 -49
- package/dist/db-verify-DlqHvkkA.mjs.map +1 -0
- package/dist/exports/control-api.d.mts +3 -3
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.mjs +2 -2
- package/dist/extension-pack-inputs-1ySHqxKG.mjs.map +1 -1
- package/dist/{format-C8yv6mXH.mjs → format-C3XdaDuA.mjs} +3 -3
- package/dist/format-C3XdaDuA.mjs.map +1 -0
- package/dist/{framework-components-YVQHhPH7.mjs → framework-components-5RljWT7Q.mjs} +2 -2
- package/dist/{framework-components-YVQHhPH7.mjs.map → framework-components-5RljWT7Q.mjs.map} +1 -1
- package/dist/{init-a3-ljrL3.mjs → init-BF3s9NcB.mjs} +3 -3
- package/dist/{init-a3-ljrL3.mjs.map → init-BF3s9NcB.mjs.map} +1 -1
- package/dist/{inspect-live-schema-DF6IwcDl.mjs → inspect-live-schema-Dd1Ft0dw.mjs} +4 -4
- package/dist/inspect-live-schema-Dd1Ft0dw.mjs.map +1 -0
- package/dist/{migration-check-VwM8xCZV.mjs → migration-check-UoHMvsP3.mjs} +10 -11
- package/dist/migration-check-UoHMvsP3.mjs.map +1 -0
- package/dist/migration-cli.mjs +1 -1
- package/dist/migration-cli.mjs.map +1 -1
- package/dist/{migration-command-scaffold-DA-Lhx6o.mjs → migration-command-scaffold-DW2BpjZW.mjs} +4 -4
- package/dist/migration-command-scaffold-DW2BpjZW.mjs.map +1 -0
- package/dist/{migration-list-DlJJ_38Z.mjs → migration-list-BOzQzJK4.mjs} +15 -15
- package/dist/migration-list-BOzQzJK4.mjs.map +1 -0
- package/dist/{migration-log-CG0qQAFm.mjs → migration-log-q50rqMiU.mjs} +4 -4
- package/dist/migration-log-q50rqMiU.mjs.map +1 -0
- package/dist/{migration-path-target-Ce6OZImp.mjs → migration-path-target-zK6RG6JY.mjs} +2 -2
- package/dist/{migration-path-target-Ce6OZImp.mjs.map → migration-path-target-zK6RG6JY.mjs.map} +1 -1
- package/dist/{migration-plan-W_E8FQOk.mjs → migration-plan-BwJLPkwV.mjs} +24 -24
- package/dist/migration-plan-BwJLPkwV.mjs.map +1 -0
- package/dist/{migration-status-CD-LC2Ip.mjs → migration-status-27NzO2SC.mjs} +13 -14
- package/dist/migration-status-27NzO2SC.mjs.map +1 -0
- package/dist/{telemetry-BIM4beEO.mjs → telemetry-BckOSUWG.mjs} +2 -2
- package/dist/{telemetry-BIM4beEO.mjs.map → telemetry-BckOSUWG.mjs.map} +1 -1
- package/dist/{types-C_tYiJYx.d.mts → types-CKgJmH02.d.mts} +26 -20
- package/dist/types-CKgJmH02.d.mts.map +1 -0
- package/dist/{verify-DcOYZ1tH.mjs → verify-DC14_nPu.mjs} +29 -6
- package/dist/verify-DC14_nPu.mjs.map +1 -0
- package/package.json +21 -24
- package/src/cli.ts +3 -0
- package/src/commands/contract-emit.ts +1 -1
- package/src/commands/db-sign.ts +1 -1
- package/src/commands/db-verify.ts +32 -20
- package/src/commands/inspect-live-schema.ts +1 -1
- package/src/commands/lsp.ts +32 -0
- package/src/commands/migrate.ts +45 -42
- package/src/commands/migration-check.ts +6 -6
- package/src/commands/migration-graph.ts +5 -5
- package/src/commands/migration-list.ts +13 -13
- package/src/commands/migration-log.ts +1 -1
- package/src/commands/migration-new.ts +1 -1
- package/src/commands/migration-plan.ts +4 -4
- package/src/commands/migration-show.ts +1 -1
- package/src/commands/migration-status.ts +10 -10
- package/src/commands/ref.ts +1 -1
- package/src/control-api/client.ts +5 -3
- package/src/control-api/operations/contract-emit.ts +8 -7
- package/src/control-api/operations/db-init.ts +2 -2
- package/src/control-api/operations/db-run.ts +7 -7
- package/src/control-api/operations/db-verify.ts +38 -33
- package/src/control-api/operations/format.ts +1 -2
- package/src/control-api/operations/migrate.ts +66 -66
- package/src/control-api/operations/run-migration.ts +2 -2
- package/src/control-api/types.ts +7 -7
- package/src/migration-cli.ts +1 -1
- package/src/utils/combine-verify-results.ts +113 -0
- package/src/utils/extension-pack-inputs.ts +1 -1
- package/src/utils/formatters/verify.ts +44 -3
- package/src/utils/migration-command-scaffold.ts +1 -1
- package/src/utils/plan-resolution.ts +18 -18
- package/dist/client-CJzuo5wX.mjs.map +0 -1
- package/dist/config-loader-p9JMrekQ.mjs +0 -88
- package/dist/config-loader-p9JMrekQ.mjs.map +0 -1
- package/dist/config-loader.d.mts +0 -16
- package/dist/config-loader.d.mts.map +0 -1
- package/dist/config-loader.mjs +0 -2
- package/dist/contract-emit-B_qriF8B.mjs.map +0 -1
- package/dist/contract-emit-C8HmtboH.mjs.map +0 -1
- package/dist/db-verify-C24FKhb7.mjs.map +0 -1
- package/dist/format-C8yv6mXH.mjs.map +0 -1
- package/dist/inspect-live-schema-DF6IwcDl.mjs.map +0 -1
- package/dist/migration-check-VwM8xCZV.mjs.map +0 -1
- package/dist/migration-command-scaffold-DA-Lhx6o.mjs.map +0 -1
- package/dist/migration-list-DlJJ_38Z.mjs.map +0 -1
- package/dist/migration-log-CG0qQAFm.mjs.map +0 -1
- package/dist/migration-plan-W_E8FQOk.mjs.map +0 -1
- package/dist/migration-status-CD-LC2Ip.mjs.map +0 -1
- package/dist/types-C_tYiJYx.d.mts.map +0 -1
- package/dist/verify-DcOYZ1tH.mjs.map +0 -1
- package/src/config-loader.ts +0 -92
- package/src/config-path-validation.ts +0 -74
- package/src/utils/combine-schema-results.ts +0 -84
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CliStructuredError as CliStructuredError$1 } from "@prisma-next/errors/control";
|
|
2
2
|
import { Result } from "@prisma-next/utils/result";
|
|
3
|
-
import { ContractSourceDiagnostics, ContractSourceProvider } from "@prisma-next/config/config-types";
|
|
4
3
|
import { ControlAdapterDescriptor, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlTargetDescriptor, CoreSchemaView, MigrationPlanOperation, MigrationPlannerConflict, OperationPreview, SignDatabaseResult, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma-next/framework-components/control";
|
|
5
4
|
import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
|
|
6
|
-
import {
|
|
5
|
+
import { AggregateContractSpace } from "@prisma-next/migration-tools/aggregate";
|
|
7
6
|
import { MigrationToolsError } from "@prisma-next/migration-tools/errors";
|
|
7
|
+
import { ContractSourceDiagnostics, ContractSourceProvider } from "@prisma-next/config/config-types";
|
|
8
8
|
import { Contract, ContractMarkerRecord, LedgerEntryRecord } from "@prisma-next/contract/types";
|
|
9
9
|
import { AuthoringPslBlockDescriptorNamespace } from "@prisma-next/framework-components/authoring";
|
|
10
10
|
import { PslDocumentAst } from "@prisma-next/framework-components/psl-ast";
|
|
@@ -15,9 +15,9 @@ import { PslDocumentAst } from "@prisma-next/framework-components/psl-ast";
|
|
|
15
15
|
*
|
|
16
16
|
* Loader → verifier pipeline. The loader (sole descriptor-import
|
|
17
17
|
* boundary) builds a {@link import('@prisma-next/migration-tools/aggregate').ContractSpaceAggregate};
|
|
18
|
-
* the aggregate verifier bundles `markerCheck` + per-space
|
|
19
|
-
*
|
|
20
|
-
* facing `--strict` flag.
|
|
18
|
+
* the aggregate verifier bundles `markerCheck` + per-space `schemaCheck`
|
|
19
|
+
* (each contract space verified against the full schema; extras stripped to its own view).
|
|
20
|
+
* `mode: 'strict' | 'lenient'` maps directly to the user facing `--strict` flag.
|
|
21
21
|
*/
|
|
22
22
|
interface ExecuteDbVerifyOptions<TFamilyId extends string, TTargetId extends string> {
|
|
23
23
|
readonly driver: ControlDriverInstance<TFamilyId, TTargetId>;
|
|
@@ -40,13 +40,19 @@ interface ExecuteDbVerifyOptions<TFamilyId extends string, TTargetId extends str
|
|
|
40
40
|
* emitted, so downstream tooling and integration tests assert on the
|
|
41
41
|
* same shape).
|
|
42
42
|
*
|
|
43
|
-
* On success, the per-space
|
|
43
|
+
* On success, the per-space verify results are returned for the CLI to
|
|
44
44
|
* render. When `skipSchema` is true (`--marker-only`), the schema map
|
|
45
45
|
* is empty.
|
|
46
46
|
*/
|
|
47
47
|
interface ExecuteDbVerifySuccess {
|
|
48
48
|
readonly schemaResults: ReadonlyMap<string, VerifyDatabaseSchemaResult>;
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Live element names no contract space declares, deduplicated and reported
|
|
51
|
+
* once for the whole database (never per space). Strict mode fails on a
|
|
52
|
+
* non-empty list; lenient mode surfaces it informationally.
|
|
53
|
+
*/
|
|
54
|
+
readonly unclaimed: readonly string[];
|
|
55
|
+
readonly spaceOrder: readonly string[];
|
|
50
56
|
readonly appSpaceId: string;
|
|
51
57
|
}
|
|
52
58
|
type ExecuteDbVerifyResult = Result<ExecuteDbVerifySuccess, CliStructuredError$1>;
|
|
@@ -60,11 +66,11 @@ type ExecuteDbVerifyResult = Result<ExecuteDbVerifySuccess, CliStructuredError$1
|
|
|
60
66
|
* structured CLI error.
|
|
61
67
|
* 2. **Read DB state**: marker rows + (when `skipSchema` is `false`)
|
|
62
68
|
* schema introspection.
|
|
63
|
-
* 3. **Verify**: {@link verifyMigration} returns per-space
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* callers (CLI command) can render
|
|
67
|
-
* returned to the caller verbatim.
|
|
69
|
+
* 3. **Verify**: {@link verifyMigration} returns per-space `markerCheck` +
|
|
70
|
+
* per-space `schemaCheck` (each contract space verified against the full schema,
|
|
71
|
+
* then scoped to its own contract space). Marker mismatches map to
|
|
72
|
+
* `CliStructuredError` (code `5002`) so callers (CLI command) can render
|
|
73
|
+
* and exit. Verify results are returned to the caller verbatim.
|
|
68
74
|
*/
|
|
69
75
|
declare function executeDbVerify<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbVerifyOptions<TFamilyId, TTargetId>): Promise<ExecuteDbVerifyResult>;
|
|
70
76
|
//#endregion
|
|
@@ -535,9 +541,9 @@ interface MigrateOptions {
|
|
|
535
541
|
/** Migrations root directory (`migrations/` under the project). */
|
|
536
542
|
readonly migrationsDir: string;
|
|
537
543
|
/**
|
|
538
|
-
* Optional app-space ref override. When provided, the app
|
|
544
|
+
* Optional app-space ref override. When provided, the app space's
|
|
539
545
|
* graph-walk targets this hash instead of `contract.storage.storageHash`.
|
|
540
|
-
* Extension
|
|
546
|
+
* Extension spaces always walk to their own `headRef.hash`.
|
|
541
547
|
*/
|
|
542
548
|
readonly refHash?: string;
|
|
543
549
|
/**
|
|
@@ -584,17 +590,17 @@ interface MigrateRanEntry {
|
|
|
584
590
|
}
|
|
585
591
|
/**
|
|
586
592
|
* Successful migrate result. Carries both the top-level fields
|
|
587
|
-
* (`markerHash` is the **app
|
|
593
|
+
* (`markerHash` is the **app space's** post-migrate marker) and the
|
|
588
594
|
* per-space breakdown (`perSpace` — markers / operations in canonical
|
|
589
595
|
* schedule order).
|
|
590
596
|
*/
|
|
591
597
|
/**
|
|
592
|
-
* Path-decision summary for the **app
|
|
598
|
+
* Path-decision summary for the **app space** post-migrate. Surfaced
|
|
593
599
|
* at the top level (and consumed by the cli-journeys suite, which
|
|
594
600
|
* inspects `requiredInvariants`/`satisfiedInvariants`/
|
|
595
601
|
* `selectedPath` to validate invariant routing).
|
|
596
602
|
*
|
|
597
|
-
* Per-space path decisions for extension
|
|
603
|
+
* Per-space path decisions for extension spaces are not surfaced —
|
|
598
604
|
* extensions own their own ref/invariant control.
|
|
599
605
|
*/
|
|
600
606
|
interface MigratePathDecision {
|
|
@@ -625,7 +631,7 @@ interface MigrateSuccess {
|
|
|
625
631
|
*/
|
|
626
632
|
readonly perSpace: ReadonlyArray<PerSpaceExecutionEntry>;
|
|
627
633
|
/**
|
|
628
|
-
* Path-decision data for the app
|
|
634
|
+
* Path-decision data for the app space. Present whenever the
|
|
629
635
|
* graph-walk strategy ran for the app (i.e. always for the
|
|
630
636
|
* aggregate-walking migrate path). Absent only for the no-op
|
|
631
637
|
* "Already up to date" early return when the app has no plan.
|
|
@@ -792,7 +798,7 @@ interface ControlClient {
|
|
|
792
798
|
* markers, and (unless `skipSchema` is true) per-space schema
|
|
793
799
|
* verification with pre-projection (closes F23).
|
|
794
800
|
*
|
|
795
|
-
* @returns Result pattern: per-space
|
|
801
|
+
* @returns Result pattern: per-space verify results on success;
|
|
796
802
|
* structured CLI error on marker / loader failure.
|
|
797
803
|
* @throws If not connected or infrastructure failure
|
|
798
804
|
*/
|
|
@@ -881,4 +887,4 @@ interface ControlClient {
|
|
|
881
887
|
}
|
|
882
888
|
//#endregion
|
|
883
889
|
export { ExecuteDbVerifyOptions as A, IntrospectOptions as C, SchemaVerifyOptions as D, PerSpaceExecutionEntry as E, executeDbVerify as M, CliStructuredError$1 as N, SignOptions as O, EmitSuccess as S, OnControlProgress as T, EmitContractConfig as _, ControlClientOptions as a, EmitOptions as b, DbInitFailureCode as c, DbInitSuccess as d, DbUpdateFailure as f, DbUpdateSuccess as g, DbUpdateResult as h, ControlClient as i, ExecuteDbVerifyResult as j, VerifyOptions as k, DbInitOptions as l, DbUpdateOptions as m, ContractEmitResult as n, ControlProgressEvent as o, DbUpdateFailureCode as p, ControlActionName as r, DbInitFailure as s, ContractEmitOptions as t, DbInitResult as u, EmitFailure as v, MigratePathDecision as w, EmitResult as x, EmitFailureCode as y };
|
|
884
|
-
//# sourceMappingURL=types-
|
|
890
|
+
//# sourceMappingURL=types-CKgJmH02.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CKgJmH02.d.mts","names":[],"sources":["../src/control-api/operations/db-verify.ts","../src/control-api/types.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2CA;UAAiB,sBAAA;EAAA,SACN,MAAA,EAAQ,qBAAA,CAAsB,SAAA,EAAW,SAAA;EAAA,SACzC,cAAA,EAAgB,qBAAA,CAAsB,SAAA;EAAA,SACtC,QAAA,EAAU,QAAA;EAAA,SACV,aAAA;EAAA,SACA,QAAA,EAAU,SAAA;EAAA,SACV,cAAA,EAAgB,aAAA,CAAc,0BAAA,CAA2B,SAAA,EAAW,SAAA;EAAA,SACpE,mBAAA,EAAqB,aAAA,CAAc,8BAAA,CAA+B,SAAA,EAAW,SAAA;EAAA,SAC7E,IAAA;EAAA,SACA,UAAA;EAAA,SACA,UAAA;EAAA,SACA,UAAA,GAAa,iBAAA;AAAA;;;;;;;;;;;;;UAeP,sBAAA;EAAA,SACN,aAAA,EAAe,WAAW,SAAS,0BAAA;EAzBnB;;;;;EAAA,SA+BhB,SAAA;EAAA,SACA,UAAA;EAAA,SACA,UAAA;AAAA;AAAA,KAGC,qBAAA,GAAwB,MAAA,CAAO,sBAAA,EAAwB,oBAAA;;;;;;;;;;;;;;AA3B1B;AAezC;;iBA8BsB,eAAA,qDACpB,OAAA,EAAS,sBAAA,CAAuB,SAAA,EAAW,SAAA,IAC1C,OAAA,CAAQ,qBAAA;;;;;;;;;;;AA1DX;;;UCAiB,oBAAA;EAAA,SAEN,MAAA,EAAQ,u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,kBAAA;EAmGC;;;;;;;;EAzFrC,MAAA,CAAO,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,YAAA;EAqHnC;;;;AAAyC;;;;;EA1G9C,QAAA,CAAS,OAAA,EAAS,eAAA,GAAkB,OAAA,CAAQ,cAAA;;;;;;;;;;;;;;EAe5C,QAAA,CAAS,OAAA,EAAS,eAAA,GAAkB,OAAA,CAAQ,qBAAA;;;;;;;EAQ5C,UAAA,IAAc,OAAA,CAAQ,oBAAA;;;;;;EAOtB,cAAA,IAAkB,OAAA,CAAQ,WAAA,SAAoB,oBAAA;;;;;;EAO9C,UAAA,CAAW,KAAA,YAAiB,OAAA,UAAiB,iBAAA;;;;;;;;;;;;;;EAe7C,OAAA,CAAQ,OAAA,EAAS,cAAA,GAAiB,OAAA,CAAQ,aAAA;;;;;;;EAQ1C,UAAA,CAAW,OAAA,GAAU,iBAAA,GAAoB,OAAA;;;;;;;;EASzC,YAAA,CAAa,QAAA,YAAoB,cAAA;;;;;;;;EASjC,gBAAA,CAAiB,QAAA,YAAoB,cAAA;;;;;;;;EASrC,sBAAA,IAA0B,oCAAA;;;;;;;;;EAU1B,kBAAA,CAAmB,UAAA,WAAqB,sBAAA,KAA2B,gBAAA;;;;;;;;EASnE,IAAA,CAAK,OAAA,EAAS,WAAA,GAAc,OAAA,CAAQ,UAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as createColorFormatter, N as formatDim, P as isVerbose } from "./command-helpers-
|
|
1
|
+
import { M as createColorFormatter, N as formatDim, P as isVerbose } from "./command-helpers-6cNJZ863.mjs";
|
|
2
2
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
3
3
|
import { bold, cyan, dim, green, magenta, red, yellow } from "colorette";
|
|
4
4
|
//#region src/utils/formatters/verify.ts
|
|
@@ -18,6 +18,11 @@ function formatVerifyOutput(result, flags) {
|
|
|
18
18
|
lines.push(`${formatDimText(` storageHash: ${result.contract.storageHash}`)}`);
|
|
19
19
|
if (result.contract.profileHash) lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);
|
|
20
20
|
if (result.mode === "full" && result.schema && isVerbose(flags, 1)) lines.push(`${formatDimText(` schema: pass=${result.schema.counts.pass} warn=${result.schema.counts.warn} fail=${result.schema.counts.fail}`)}`);
|
|
21
|
+
if (result.unclaimed && result.unclaimed.length > 0) {
|
|
22
|
+
lines.push("");
|
|
23
|
+
lines.push(formatYellow("Unclaimed elements (declared by no contract):"));
|
|
24
|
+
for (const name of result.unclaimed) lines.push(` ${formatYellow("⚠")} ${name}`);
|
|
25
|
+
}
|
|
21
26
|
if (result.warning) {
|
|
22
27
|
lines.push("");
|
|
23
28
|
lines.push(`${formatYellow("⚠")} ${result.warning}`);
|
|
@@ -42,6 +47,7 @@ function formatVerifyJson(result) {
|
|
|
42
47
|
...ifDefined("missingCodecs", result.missingCodecs),
|
|
43
48
|
...ifDefined("codecCoverageSkipped", result.codecCoverageSkipped),
|
|
44
49
|
...ifDefined("schema", result.schema),
|
|
50
|
+
unclaimed: result.unclaimed ?? [],
|
|
45
51
|
...ifDefined("warning", result.warning),
|
|
46
52
|
...ifDefined("meta", result.meta),
|
|
47
53
|
timings: result.timings
|
|
@@ -316,12 +322,13 @@ function renderSchemaVerificationTree(node, flags, options) {
|
|
|
316
322
|
/**
|
|
317
323
|
* Formats human-readable output for database schema verification.
|
|
318
324
|
*/
|
|
319
|
-
function formatSchemaVerifyOutput(result, flags) {
|
|
325
|
+
function formatSchemaVerifyOutput(result, flags, unclaimed = []) {
|
|
320
326
|
if (flags.quiet) return "";
|
|
321
327
|
const lines = [];
|
|
322
328
|
const useColor = flags.color !== false;
|
|
323
329
|
const formatGreen = createColorFormatter(useColor, green);
|
|
324
330
|
const formatRed = createColorFormatter(useColor, red);
|
|
331
|
+
const formatYellow = createColorFormatter(useColor, yellow);
|
|
325
332
|
const formatDimText = (text) => formatDim(useColor, text);
|
|
326
333
|
const treeLines = renderSchemaVerificationTree(result.schema.root, flags, {
|
|
327
334
|
isLast: true,
|
|
@@ -331,6 +338,17 @@ function formatSchemaVerifyOutput(result, flags) {
|
|
|
331
338
|
isRoot: true
|
|
332
339
|
});
|
|
333
340
|
lines.push(...treeLines);
|
|
341
|
+
if (result.schema.schemaDiffIssues.length > 0) {
|
|
342
|
+
lines.push("");
|
|
343
|
+
lines.push(formatRed("Schema drift:"));
|
|
344
|
+
for (const issue of result.schema.schemaDiffIssues) lines.push(` ${formatRed("✖")} ${issue.message}`);
|
|
345
|
+
}
|
|
346
|
+
if (unclaimed.length > 0) {
|
|
347
|
+
const strict = result.meta?.strict ?? false;
|
|
348
|
+
lines.push("");
|
|
349
|
+
lines.push((strict ? formatRed : formatYellow)("Unclaimed elements (declared by no contract):"));
|
|
350
|
+
for (const name of unclaimed) lines.push(` ${(strict ? formatRed : formatYellow)(strict ? "✖" : "⚠")} ${name}`);
|
|
351
|
+
}
|
|
334
352
|
if (isVerbose(flags, 1)) {
|
|
335
353
|
lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);
|
|
336
354
|
lines.push(`${formatDimText(` pass=${result.schema.counts.pass} warn=${result.schema.counts.warn} fail=${result.schema.counts.fail}`)}`);
|
|
@@ -344,10 +362,15 @@ function formatSchemaVerifyOutput(result, flags) {
|
|
|
344
362
|
return lines.join("\n");
|
|
345
363
|
}
|
|
346
364
|
/**
|
|
347
|
-
* Formats JSON output for database schema verification.
|
|
365
|
+
* Formats JSON output for database schema verification. The unclaimed-elements
|
|
366
|
+
* list is a top-level field alongside the combined result, reported once for
|
|
367
|
+
* the whole database.
|
|
348
368
|
*/
|
|
349
|
-
function formatSchemaVerifyJson(result) {
|
|
350
|
-
return JSON.stringify(
|
|
369
|
+
function formatSchemaVerifyJson(result, unclaimed = []) {
|
|
370
|
+
return JSON.stringify({
|
|
371
|
+
...result,
|
|
372
|
+
unclaimed
|
|
373
|
+
}, null, 2);
|
|
351
374
|
}
|
|
352
375
|
/**
|
|
353
376
|
* Formats human-readable output for database sign.
|
|
@@ -381,4 +404,4 @@ function formatSignJson(result) {
|
|
|
381
404
|
//#endregion
|
|
382
405
|
export { formatSignJson as a, formatVerifyOutput as c, formatSchemaVerifyOutput as i, formatIntrospectOutput as n, formatSignOutput as o, formatSchemaVerifyJson as r, formatVerifyJson as s, formatIntrospectJson as t };
|
|
383
406
|
|
|
384
|
-
//# sourceMappingURL=verify-
|
|
407
|
+
//# sourceMappingURL=verify-DC14_nPu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-DC14_nPu.mjs","names":[],"sources":["../src/utils/formatters/verify.ts"],"sourcesContent":["import type {\n CoreSchemaView,\n IntrospectSchemaResult,\n SchemaTreeNode,\n SchemaVerificationNode,\n SignDatabaseResult,\n VerifyDatabaseResult,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/framework-components/control';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { bold, cyan, dim, green, magenta, red, yellow } from 'colorette';\nimport type { GlobalFlags } from '../global-flags';\nimport { createColorFormatter, formatDim, isVerbose } from './helpers';\n\n// ============================================================================\n// Verify Output Formatters\n// ============================================================================\n\nexport interface DbVerifyCommandSuccessResult {\n readonly ok: true;\n readonly mode: 'full' | 'marker-only';\n readonly summary: string;\n readonly contract: VerifyDatabaseResult['contract'];\n readonly marker?: VerifyDatabaseResult['marker'];\n readonly target: VerifyDatabaseResult['target'];\n readonly missingCodecs?: VerifyDatabaseResult['missingCodecs'];\n readonly codecCoverageSkipped?: VerifyDatabaseResult['codecCoverageSkipped'];\n readonly schema?: {\n readonly summary: string;\n readonly counts: VerifyDatabaseSchemaResult['schema']['counts'];\n readonly strict: boolean;\n };\n /**\n * Live element names no contract space declares. In full success this is\n * only ever non-empty in lenient mode — strict mode fails on it — and is\n * rendered informationally.\n */\n readonly unclaimed?: readonly string[];\n readonly warning?: string;\n readonly meta?:\n | (NonNullable<VerifyDatabaseResult['meta']> & {\n readonly schemaVerification: 'performed' | 'skipped';\n })\n | {\n readonly schemaVerification: 'performed' | 'skipped';\n };\n readonly timings: {\n readonly total: number;\n };\n}\n\n/**\n * Formats human-readable output for database verify.\n */\nexport function formatVerifyOutput(\n result: DbVerifyCommandSuccessResult,\n flags: GlobalFlags,\n): string {\n if (flags.quiet) {\n return '';\n }\n\n const lines: string[] = [];\n\n const useColor = flags.color !== false;\n const formatGreen = createColorFormatter(useColor, green);\n const formatYellow = createColorFormatter(useColor, yellow);\n const formatDimText = (text: string) => formatDim(useColor, text);\n const verificationMode =\n result.mode === 'full'\n ? `marker + schema${result.schema?.strict ? ' (strict)' : ' (tolerant)'}`\n : 'marker only (--marker-only)';\n\n lines.push(`${formatGreen('✔')} ${result.summary}`);\n lines.push(`${formatDimText(` verification: ${verificationMode}`)}`);\n lines.push(`${formatDimText(` storageHash: ${result.contract.storageHash}`)}`);\n if (result.contract.profileHash) {\n lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);\n }\n if (result.mode === 'full' && result.schema && isVerbose(flags, 1)) {\n lines.push(\n `${formatDimText(` schema: pass=${result.schema.counts.pass} warn=${result.schema.counts.warn} fail=${result.schema.counts.fail}`)}`,\n );\n }\n if (result.unclaimed && result.unclaimed.length > 0) {\n lines.push('');\n lines.push(formatYellow('Unclaimed elements (declared by no contract):'));\n for (const name of result.unclaimed) {\n lines.push(` ${formatYellow('⚠')} ${name}`);\n }\n }\n\n if (result.warning) {\n lines.push('');\n lines.push(`${formatYellow('⚠')} ${result.warning}`);\n }\n\n if (isVerbose(flags, 1)) {\n if (result.codecCoverageSkipped) {\n lines.push(\n `${formatDimText(' Codec coverage check skipped (helper returned no supported types)')}`,\n );\n }\n lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Formats JSON output for database verify.\n */\nexport function formatVerifyJson(result: DbVerifyCommandSuccessResult): string {\n const output = {\n ok: result.ok,\n summary: result.summary,\n mode: result.mode,\n contract: result.contract,\n ...ifDefined('marker', result.marker),\n target: result.target,\n ...ifDefined('missingCodecs', result.missingCodecs),\n ...ifDefined('codecCoverageSkipped', result.codecCoverageSkipped),\n ...ifDefined('schema', result.schema),\n unclaimed: result.unclaimed ?? [],\n ...ifDefined('warning', result.warning),\n ...ifDefined('meta', result.meta),\n timings: result.timings,\n };\n\n return JSON.stringify(output, null, 2);\n}\n\n/**\n * Formats JSON output for database introspection.\n */\nexport function formatIntrospectJson(result: IntrospectSchemaResult<unknown>): string {\n return JSON.stringify(result, null, 2);\n}\n\n/**\n * Renders a schema tree structure from CoreSchemaView.\n * Matches the style of renderSchemaVerificationTree for consistency.\n */\nfunction renderSchemaTree(\n node: SchemaTreeNode,\n flags: GlobalFlags,\n options: {\n readonly isLast: boolean;\n readonly prefix: string;\n readonly useColor: boolean;\n readonly formatDimText: (text: string) => string;\n readonly isRoot?: boolean;\n },\n): string[] {\n const { isLast, prefix, useColor, formatDimText, isRoot = false } = options;\n const lines: string[] = [];\n\n // Format node label with color based on kind (matching schema-verify style)\n let formattedLabel: string = node.label;\n\n if (useColor) {\n switch (node.kind) {\n case 'root':\n formattedLabel = bold(node.label);\n break;\n case 'entity': {\n // Parse \"table tableName\" format - color \"table\" dim, tableName cyan\n const tableMatch = node.label.match(/^table\\s+(.+)$/);\n if (tableMatch?.[1]) {\n const tableName = tableMatch[1];\n formattedLabel = `${dim('table')} ${cyan(tableName)}`;\n } else {\n // Fallback: color entire label with cyan\n formattedLabel = cyan(node.label);\n }\n break;\n }\n case 'collection': {\n // \"columns\" grouping node - dim the label\n formattedLabel = dim(node.label);\n break;\n }\n case 'field': {\n // Parse column name format: \"columnName: typeDisplay (nullability)\"\n // Color code: column name (cyan), type (default), nullability (dim)\n const columnMatch = node.label.match(/^([^:]+):\\s*(.+)$/);\n if (columnMatch?.[1] && columnMatch[2]) {\n const columnName = columnMatch[1];\n const rest = columnMatch[2];\n // Parse rest: \"typeDisplay (nullability)\"\n const typeMatch = rest.match(/^([^\\s(]+)\\s*(\\([^)]+\\))$/);\n if (typeMatch?.[1] && typeMatch[2]) {\n const typeDisplay = typeMatch[1];\n const nullability = typeMatch[2];\n formattedLabel = `${cyan(columnName)}: ${typeDisplay} ${dim(nullability)}`;\n } else {\n // Fallback if format doesn't match\n formattedLabel = `${cyan(columnName)}: ${rest}`;\n }\n } else {\n formattedLabel = node.label;\n }\n break;\n }\n case 'index': {\n // Parse index/unique constraint/primary key formats\n // \"primary key: columnName\" -> dim \"primary key\", cyan columnName\n const pkMatch = node.label.match(/^primary key:\\s*(.+)$/);\n if (pkMatch?.[1]) {\n const columnNames = pkMatch[1];\n formattedLabel = `${dim('primary key')}: ${cyan(columnNames)}`;\n } else {\n // \"unique name\" -> dim \"unique\", cyan \"name\"\n const uniqueMatch = node.label.match(/^unique\\s+(.+)$/);\n if (uniqueMatch?.[1]) {\n const name = uniqueMatch[1];\n formattedLabel = `${dim('unique')} ${cyan(name)}`;\n } else {\n // \"index name\" or \"unique index name\" -> dim label prefix, cyan name\n const indexMatch = node.label.match(/^(unique\\s+)?index\\s+(.+)$/);\n if (indexMatch?.[2]) {\n const indexPrefix = indexMatch[1] ? `${dim('unique')} ` : '';\n const name = indexMatch[2];\n formattedLabel = `${indexPrefix}${dim('index')} ${cyan(name)}`;\n } else {\n formattedLabel = dim(node.label);\n }\n }\n }\n break;\n }\n case 'dependency': {\n // Parse extension message formats similar to schema-verify\n // \"extensionName extension is enabled\" -> cyan extensionName, dim rest\n const extMatch = node.label.match(/^([^\\s]+)\\s+(extension is enabled)$/);\n if (extMatch?.[1] && extMatch[2]) {\n const extName = extMatch[1];\n const rest = extMatch[2];\n formattedLabel = `${cyan(extName)} ${dim(rest)}`;\n } else {\n // Fallback: color entire label with magenta\n formattedLabel = magenta(node.label);\n }\n break;\n }\n default:\n formattedLabel = node.label;\n break;\n }\n }\n\n // Root node renders without tree characters or prefix\n if (isRoot) {\n lines.push(formattedLabel);\n } else {\n const treeChar = isLast ? '└' : '├';\n const treePrefix = `${formatDimText(treeChar)}─ `;\n lines.push(`${prefix}${treePrefix}${formattedLabel}`);\n }\n\n // Render children if present\n if (node.children && node.children.length > 0) {\n const childPrefix = isRoot ? '' : `${prefix}${isLast ? ' ' : `${formatDimText('│')} `}`;\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n if (!child) continue;\n const isLastChild = i === node.children.length - 1;\n const childLines = renderSchemaTree(child, flags, {\n isLast: isLastChild,\n prefix: childPrefix,\n useColor,\n formatDimText,\n isRoot: false,\n });\n lines.push(...childLines);\n }\n }\n\n return lines;\n}\n\n/**\n * Formats human-readable output for database introspection.\n */\nexport function formatIntrospectOutput(\n result: IntrospectSchemaResult<unknown>,\n schemaView: CoreSchemaView | undefined,\n flags: GlobalFlags,\n): string {\n if (flags.quiet) {\n return '';\n }\n\n const lines: string[] = [];\n\n const useColor = flags.color !== false;\n const formatDimText = (text: string) => formatDim(useColor, text);\n\n if (schemaView) {\n // Render tree structure - root node is special (no tree characters)\n const treeLines = renderSchemaTree(schemaView.root, flags, {\n isLast: true,\n prefix: '',\n useColor,\n formatDimText,\n isRoot: true,\n });\n lines.push(...treeLines);\n } else {\n // Fallback: print summary when toSchemaView is not available\n lines.push(`✔ ${result.summary}`);\n if (isVerbose(flags, 1)) {\n lines.push(` Target: ${result.target.familyId}/${result.target.id}`);\n if (result.meta?.dbUrl) {\n lines.push(` Database: ${result.meta.dbUrl}`);\n }\n }\n }\n\n // Add timings in verbose mode\n if (isVerbose(flags, 1)) {\n lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Renders a schema verification tree structure from SchemaVerificationNode.\n * Similar to renderSchemaTree but for verification nodes with status-based colors and glyphs.\n */\nfunction renderSchemaVerificationTree(\n node: SchemaVerificationNode,\n flags: GlobalFlags,\n options: {\n readonly isLast: boolean;\n readonly prefix: string;\n readonly useColor: boolean;\n readonly formatDimText: (text: string) => string;\n readonly isRoot?: boolean;\n },\n): string[] {\n const { isLast, prefix, useColor, formatDimText, isRoot = false } = options;\n const lines: string[] = [];\n\n // Format status glyph and color based on status\n let statusGlyph = '';\n let statusColor: (text: string) => string = (text) => text;\n if (useColor) {\n switch (node.status) {\n case 'pass':\n statusGlyph = '✔';\n statusColor = green;\n break;\n case 'warn':\n statusGlyph = '⚠';\n statusColor = (text) => (useColor ? yellow(text) : text);\n break;\n case 'fail':\n statusGlyph = '✖';\n statusColor = red;\n break;\n }\n } else {\n switch (node.status) {\n case 'pass':\n statusGlyph = '✔';\n break;\n case 'warn':\n statusGlyph = '⚠';\n break;\n case 'fail':\n statusGlyph = '✖';\n break;\n }\n }\n\n // Format node label with color based on kind\n // For column nodes, we need to parse the name to color code different parts\n let labelColor: (text: string) => string = (text) => text;\n let formattedLabel: string = node.name;\n\n if (useColor) {\n switch (node.kind) {\n case 'contract':\n case 'schema':\n labelColor = bold;\n formattedLabel = labelColor(node.name);\n break;\n case 'table': {\n // Parse \"table tableName\" format - color \"table\" dim, tableName cyan\n const tableMatch = node.name.match(/^table\\s+(.+)$/);\n if (tableMatch?.[1]) {\n const tableName = tableMatch[1];\n formattedLabel = `${dim('table')} ${cyan(tableName)}`;\n } else {\n formattedLabel = dim(node.name);\n }\n break;\n }\n case 'columns':\n labelColor = dim;\n formattedLabel = labelColor(node.name);\n break;\n case 'column': {\n // Parse column name format: \"columnName: contractType -> nativeType (nullability)\"\n // Color code: column name (cyan), contract type (default), native type (dim), nullability (dim)\n const columnMatch = node.name.match(/^([^:]+):\\s*(.+)$/);\n if (columnMatch?.[1] && columnMatch[2]) {\n const columnName = columnMatch[1];\n const rest = columnMatch[2];\n // Parse rest: \"contractType -> nativeType (nullability)\"\n // Match contract type (can contain /, @, etc.), arrow, native type, then nullability in parentheses\n const typeMatch = rest.match(/^([^\\s→]+)\\s*→\\s*([^\\s(]+)\\s*(\\([^)]+\\))$/);\n if (typeMatch?.[1] && typeMatch[2] && typeMatch[3]) {\n const contractType = typeMatch[1];\n const nativeType = typeMatch[2];\n const nullability = typeMatch[3];\n formattedLabel = `${cyan(columnName)}: ${contractType} → ${dim(nativeType)} ${dim(nullability)}`;\n } else {\n // Fallback if format doesn't match (e.g., no native type or no nullability)\n formattedLabel = `${cyan(columnName)}: ${rest}`;\n }\n } else {\n formattedLabel = node.name;\n }\n break;\n }\n case 'type':\n case 'nullability':\n labelColor = (text) => text; // Default color\n formattedLabel = labelColor(node.name);\n break;\n case 'primaryKey': {\n // Parse \"primary key: columnName\" format - color \"primary key\" dim, columnName cyan\n const pkMatch = node.name.match(/^primary key:\\s*(.+)$/);\n if (pkMatch?.[1]) {\n const columnNames = pkMatch[1];\n formattedLabel = `${dim('primary key')}: ${cyan(columnNames)}`;\n } else {\n formattedLabel = dim(node.name);\n }\n break;\n }\n case 'foreignKey':\n case 'unique':\n case 'index':\n labelColor = dim;\n formattedLabel = labelColor(node.name);\n break;\n case 'dependency': {\n // Parse specific extension message formats\n // \"database is postgres\" -> dim \"database is\", cyan \"postgres\"\n const dbMatch = node.name.match(/^database is\\s+(.+)$/);\n if (dbMatch?.[1]) {\n const dbName = dbMatch[1];\n formattedLabel = `${dim('database is')} ${cyan(dbName)}`;\n } else {\n // \"vector extension is enabled\" -> dim everything except extension name\n // Match pattern: \"extensionName extension is enabled\"\n const extMatch = node.name.match(/^([^\\s]+)\\s+(extension is enabled)$/);\n if (extMatch?.[1] && extMatch[2]) {\n const extName = extMatch[1];\n const rest = extMatch[2];\n formattedLabel = `${cyan(extName)} ${dim(rest)}`;\n } else {\n // Fallback: color entire name with magenta\n labelColor = magenta;\n formattedLabel = labelColor(node.name);\n }\n }\n break;\n }\n default:\n formattedLabel = node.name;\n break;\n }\n } else {\n formattedLabel = node.name;\n }\n\n const statusGlyphColored = statusColor(statusGlyph);\n\n // Build the label with optional message for failure/warn nodes\n let nodeLabel = formattedLabel;\n if (\n (node.status === 'fail' || node.status === 'warn') &&\n node.message &&\n node.message.length > 0\n ) {\n // Always show message for failure/warn nodes - it provides crucial context\n // For parent nodes, the message summarizes child failures\n // For leaf nodes, the message explains the specific issue\n const messageText = formatDimText(`(${node.message})`);\n nodeLabel = `${formattedLabel} ${messageText}`;\n }\n\n // Root node renders without tree characters or | prefix\n // Root node renders without tree characters or prefix\n if (isRoot) {\n lines.push(`${statusGlyphColored} ${nodeLabel}`);\n } else {\n const treeChar = isLast ? '└' : '├';\n const treePrefix = `${formatDimText(treeChar)}─ `;\n lines.push(`${prefix}${treePrefix}${statusGlyphColored} ${nodeLabel}`);\n }\n\n // Render children if present\n if (node.children && node.children.length > 0) {\n const childPrefix = isRoot ? '' : `${prefix}${isLast ? ' ' : `${formatDimText('│')} `}`;\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n if (!child) continue;\n const isLastChild = i === node.children.length - 1;\n const childLines = renderSchemaVerificationTree(child, flags, {\n isLast: isLastChild,\n prefix: childPrefix,\n useColor,\n formatDimText,\n isRoot: false,\n });\n lines.push(...childLines);\n }\n }\n\n return lines;\n}\n\n/**\n * Formats human-readable output for database schema verification.\n */\nexport function formatSchemaVerifyOutput(\n result: VerifyDatabaseSchemaResult,\n flags: GlobalFlags,\n unclaimed: readonly string[] = [],\n): string {\n if (flags.quiet) {\n return '';\n }\n\n const lines: string[] = [];\n\n const useColor = flags.color !== false;\n const formatGreen = createColorFormatter(useColor, green);\n const formatRed = createColorFormatter(useColor, red);\n const formatYellow = createColorFormatter(useColor, yellow);\n const formatDimText = (text: string) => formatDim(useColor, text);\n\n // Render verification tree first\n const treeLines = renderSchemaVerificationTree(result.schema.root, flags, {\n isLast: true,\n prefix: '',\n useColor,\n formatDimText,\n isRoot: true,\n });\n lines.push(...treeLines);\n\n if (result.schema.schemaDiffIssues.length > 0) {\n lines.push('');\n lines.push(formatRed('Schema drift:'));\n for (const issue of result.schema.schemaDiffIssues) {\n lines.push(` ${formatRed('✖')} ${issue.message}`);\n }\n }\n\n if (unclaimed.length > 0) {\n const strict = result.meta?.strict ?? false;\n lines.push('');\n lines.push(\n (strict ? formatRed : formatYellow)('Unclaimed elements (declared by no contract):'),\n );\n for (const name of unclaimed) {\n lines.push(` ${(strict ? formatRed : formatYellow)(strict ? '✖' : '⚠')} ${name}`);\n }\n }\n\n // Add counts and timings in verbose mode\n if (isVerbose(flags, 1)) {\n lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n lines.push(\n `${formatDimText(` pass=${result.schema.counts.pass} warn=${result.schema.counts.warn} fail=${result.schema.counts.fail}`)}`,\n );\n }\n\n // Blank line before summary\n lines.push('');\n\n // Summary line at the end: summary with status glyph\n if (result.ok) {\n lines.push(`${formatGreen('✔')} ${result.summary}`);\n } else {\n const codeText = result.code ? ` (${result.code})` : '';\n lines.push(`${formatRed('✖')} ${result.summary}${codeText}`);\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Formats JSON output for database schema verification. The unclaimed-elements\n * list is a top-level field alongside the combined result, reported once for\n * the whole database.\n */\nexport function formatSchemaVerifyJson(\n result: VerifyDatabaseSchemaResult,\n unclaimed: readonly string[] = [],\n): string {\n return JSON.stringify({ ...result, unclaimed }, null, 2);\n}\n\n// ============================================================================\n// Sign Output Formatters\n// ============================================================================\n\n/**\n * Formats human-readable output for database sign.\n */\nexport function formatSignOutput(result: SignDatabaseResult, flags: GlobalFlags): string {\n if (flags.quiet) {\n return '';\n }\n\n const lines: string[] = [];\n\n const useColor = flags.color !== false;\n const formatGreen = createColorFormatter(useColor, green);\n const formatDimText = (text: string) => formatDim(useColor, text);\n\n if (result.ok) {\n // Main success message in white (not dimmed)\n lines.push(`${formatGreen('✔')} Database signed`);\n\n // Show from -> to hashes with clear labels\n const previousHash = result.marker.previous?.storageHash ?? 'none';\n const currentHash = result.contract.storageHash;\n\n lines.push(`${formatDimText(` from: ${previousHash}`)}`);\n lines.push(`${formatDimText(` to: ${currentHash}`)}`);\n\n if (isVerbose(flags, 1)) {\n if (result.contract.profileHash) {\n lines.push(`${formatDimText(` profileHash: ${result.contract.profileHash}`)}`);\n }\n if (result.marker.previous?.profileHash) {\n lines.push(\n `${formatDimText(` previous profileHash: ${result.marker.previous.profileHash}`)}`,\n );\n }\n lines.push(`${formatDimText(` Total time: ${result.timings.total}ms`)}`);\n }\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Formats JSON output for database sign.\n */\nexport function formatSignJson(result: SignDatabaseResult): string {\n return JSON.stringify(result, null, 2);\n}\n"],"mappings":";;;;;;;AAsDA,SAAgB,mBACd,QACA,OACQ;CACR,IAAI,MAAM,OACR,OAAO;CAGT,MAAM,QAAkB,CAAC;CAEzB,MAAM,WAAW,MAAM,UAAU;CACjC,MAAM,cAAc,qBAAqB,UAAU,KAAK;CACxD,MAAM,eAAe,qBAAqB,UAAU,MAAM;CAC1D,MAAM,iBAAiB,SAAiB,UAAU,UAAU,IAAI;CAChE,MAAM,mBACJ,OAAO,SAAS,SACZ,kBAAkB,OAAO,QAAQ,SAAS,cAAc,kBACxD;CAEN,MAAM,KAAK,GAAG,YAAY,GAAG,EAAE,GAAG,OAAO,SAAS;CAClD,MAAM,KAAK,GAAG,cAAc,mBAAmB,kBAAkB,GAAG;CACpE,MAAM,KAAK,GAAG,cAAc,kBAAkB,OAAO,SAAS,aAAa,GAAG;CAC9E,IAAI,OAAO,SAAS,aAClB,MAAM,KAAK,GAAG,cAAc,kBAAkB,OAAO,SAAS,aAAa,GAAG;CAEhF,IAAI,OAAO,SAAS,UAAU,OAAO,UAAU,UAAU,OAAO,CAAC,GAC/D,MAAM,KACJ,GAAG,cAAc,kBAAkB,OAAO,OAAO,OAAO,KAAK,QAAQ,OAAO,OAAO,OAAO,KAAK,QAAQ,OAAO,OAAO,OAAO,MAAM,GACpI;CAEF,IAAI,OAAO,aAAa,OAAO,UAAU,SAAS,GAAG;EACnD,MAAM,KAAK,EAAE;EACb,MAAM,KAAK,aAAa,+CAA+C,CAAC;EACxE,KAAK,MAAM,QAAQ,OAAO,WACxB,MAAM,KAAK,KAAK,aAAa,GAAG,EAAE,GAAG,MAAM;CAE/C;CAEA,IAAI,OAAO,SAAS;EAClB,MAAM,KA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,OACR,OAAO;CAGT,MAAM,QAAkB,CAAC;CAEzB,MAAM,WAAW,MAAM,UAAU;CACjC,MAAM,cAAc,qBAAqB,UAAU,KAAK;CACxD,MAAM,iBAAiB,SAAiB,UAAU,UAAU,IAAI;CAEhE,IAAI,OAAO,IAAI;EAEb,MAAM,KAAK,GAAG,YAAY,GAAG,EAAE,iBAAiB;EAGhD,MAAM,eAAe,OAAO,OAAO,UAAU,eAAe;EAC5D,MAAM,cAAc,OAAO,SAAS;EAEpC,MAAM,KAAK,GAAG,cAAc,WAAW,cAAc,GAAG;EACxD,MAAM,KAAK,GAAG,cAAc,WAAW,aAAa,GAAG;EAEvD,IAAI,UAAU,OAAO,CAAC,GAAG;GACvB,IAAI,OAAO,SAAS,aAClB,MAAM,KAAK,GAAG,cAAc,kBAAkB,OAAO,SAAS,aAAa,GAAG;GAEhF,IAAI,OAAO,OAAO,UAAU,aAC1B,MAAM,KACJ,GAAG,cAAc,2BAA2B,OAAO,OAAO,SAAS,aAAa,GAClF;GAEF,MAAM,KAAK,GAAG,cAAc,iBAAiB,OAAO,QAAQ,MAAM,GAAG,GAAG;EAC1E;CACF;CAEA,OAAO,MAAM,KAAK,IAAI;AACxB;;;;AAKA,SAAgB,eAAe,QAAoC;CACjE,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC;AACvC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/cli",
|
|
3
|
-
"version": "0.14.0-dev.
|
|
3
|
+
"version": "0.14.0-dev.40",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -9,18 +9,19 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@clack/prompts": "^1.4.0",
|
|
12
|
-
"@prisma-next/config": "0.14.0-dev.
|
|
13
|
-
"@prisma-next/
|
|
14
|
-
"@prisma-next/
|
|
15
|
-
"@prisma-next/
|
|
16
|
-
"@prisma-next/
|
|
17
|
-
"@prisma-next/
|
|
18
|
-
"@prisma-next/
|
|
19
|
-
"@prisma-next/
|
|
20
|
-
"@prisma-next/
|
|
21
|
-
"@prisma-next/
|
|
12
|
+
"@prisma-next/config": "0.14.0-dev.40",
|
|
13
|
+
"@prisma-next/config-loader": "0.14.0-dev.40",
|
|
14
|
+
"@prisma-next/contract": "0.14.0-dev.40",
|
|
15
|
+
"@prisma-next/emitter": "0.14.0-dev.40",
|
|
16
|
+
"@prisma-next/errors": "0.14.0-dev.40",
|
|
17
|
+
"@prisma-next/framework-components": "0.14.0-dev.40",
|
|
18
|
+
"@prisma-next/language-server": "0.14.0-dev.40",
|
|
19
|
+
"@prisma-next/migration-tools": "0.14.0-dev.40",
|
|
20
|
+
"@prisma-next/psl-parser": "0.14.0-dev.40",
|
|
21
|
+
"@prisma-next/psl-printer": "0.14.0-dev.40",
|
|
22
|
+
"@prisma-next/cli-telemetry": "0.14.0-dev.40",
|
|
23
|
+
"@prisma-next/utils": "0.14.0-dev.40",
|
|
22
24
|
"arktype": "^2.2.0",
|
|
23
|
-
"c12": "^3.3.4",
|
|
24
25
|
"ci-info": "^4.3.1",
|
|
25
26
|
"clipanion": "4.0.0-rc.4",
|
|
26
27
|
"closest-match": "^1.3.3",
|
|
@@ -35,14 +36,14 @@
|
|
|
35
36
|
"wrap-ansi": "^10.0.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
|
-
"@prisma-next/sql-contract": "0.14.0-dev.
|
|
39
|
-
"@prisma-next/sql-contract-emitter": "0.14.0-dev.
|
|
40
|
-
"@prisma-next/sql-contract-ts": "0.14.0-dev.
|
|
41
|
-
"@prisma-next/sql-operations": "0.14.0-dev.
|
|
42
|
-
"@prisma-next/sql-runtime": "0.14.0-dev.
|
|
43
|
-
"@prisma-next/test-utils": "0.14.0-dev.
|
|
44
|
-
"@prisma-next/tsconfig": "0.14.0-dev.
|
|
45
|
-
"@prisma-next/tsdown": "0.14.0-dev.
|
|
39
|
+
"@prisma-next/sql-contract": "0.14.0-dev.40",
|
|
40
|
+
"@prisma-next/sql-contract-emitter": "0.14.0-dev.40",
|
|
41
|
+
"@prisma-next/sql-contract-ts": "0.14.0-dev.40",
|
|
42
|
+
"@prisma-next/sql-operations": "0.14.0-dev.40",
|
|
43
|
+
"@prisma-next/sql-runtime": "0.14.0-dev.40",
|
|
44
|
+
"@prisma-next/test-utils": "0.14.0-dev.40",
|
|
45
|
+
"@prisma-next/tsconfig": "0.14.0-dev.40",
|
|
46
|
+
"@prisma-next/tsdown": "0.14.0-dev.40",
|
|
46
47
|
"@types/node": "25.9.1",
|
|
47
48
|
"tsdown": "0.22.1",
|
|
48
49
|
"typescript": "5.9.3",
|
|
@@ -145,10 +146,6 @@
|
|
|
145
146
|
"types": "./dist/commands/telemetry/index.d.mts",
|
|
146
147
|
"import": "./dist/commands/telemetry/index.mjs"
|
|
147
148
|
},
|
|
148
|
-
"./config-loader": {
|
|
149
|
-
"types": "./dist/config-loader.d.mts",
|
|
150
|
-
"import": "./dist/config-loader.mjs"
|
|
151
|
-
},
|
|
152
149
|
"./migration-cli": {
|
|
153
150
|
"types": "./dist/migration-cli.d.mts",
|
|
154
151
|
"import": "./dist/migration-cli.mjs"
|
package/src/cli.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { createDbSignCommand } from './commands/db-sign';
|
|
|
14
14
|
import { createDbUpdateCommand } from './commands/db-update';
|
|
15
15
|
import { createDbVerifyCommand } from './commands/db-verify';
|
|
16
16
|
import { createFormatCommand } from './commands/format';
|
|
17
|
+
import { createLspCommand } from './commands/lsp';
|
|
17
18
|
import { createMigrateCommand } from './commands/migrate';
|
|
18
19
|
import { createMigrationCheckCommand } from './commands/migration-check';
|
|
19
20
|
import { createMigrationGraphCommand } from './commands/migration-graph';
|
|
@@ -312,6 +313,7 @@ const telemetryCommand = createTelemetryCommand();
|
|
|
312
313
|
const initCommand = createInitCommand();
|
|
313
314
|
|
|
314
315
|
const formatCommand = createFormatCommand();
|
|
316
|
+
const lspCommand = createLspCommand();
|
|
315
317
|
|
|
316
318
|
// Register top-level commands in the order the spec's intended-surface
|
|
317
319
|
// diagram lists them: verbs (init, migrate) first, then subject
|
|
@@ -321,6 +323,7 @@ const formatCommand = createFormatCommand();
|
|
|
321
323
|
program.addCommand(initCommand);
|
|
322
324
|
program.addCommand(migrateCommand);
|
|
323
325
|
program.addCommand(formatCommand);
|
|
326
|
+
program.addCommand(lspCommand);
|
|
324
327
|
program.addCommand(contractCommand);
|
|
325
328
|
program.addCommand(dbCommand);
|
|
326
329
|
program.addCommand(migrationCommand);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
1
2
|
import { getEmittedArtifactPaths } from '@prisma-next/emitter';
|
|
2
3
|
import { errorContractConfigMissing } from '@prisma-next/errors/control';
|
|
3
4
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
4
5
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
5
6
|
import { Command } from 'commander';
|
|
6
7
|
import { dirname, join, relative, resolve } from 'pathe';
|
|
7
|
-
import { loadConfig } from '../config-loader';
|
|
8
8
|
import { executeContractEmit } from '../control-api/operations/contract-emit';
|
|
9
9
|
import type { ContractEmitResult } from '../control-api/types';
|
|
10
10
|
import { CliStructuredError, errorUnexpected } from '../utils/cli-errors';
|
package/src/commands/db-sign.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
2
3
|
import type {
|
|
3
4
|
SignDatabaseResult,
|
|
4
5
|
VerifyDatabaseSchemaResult,
|
|
@@ -8,7 +9,6 @@ import { parseContractRef } from '@prisma-next/migration-tools/ref-resolution';
|
|
|
8
9
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
9
10
|
import { Command } from 'commander';
|
|
10
11
|
import { join, relative, resolve } from 'pathe';
|
|
11
|
-
import { loadConfig } from '../config-loader';
|
|
12
12
|
import { createControlClient } from '../control-api/client';
|
|
13
13
|
import { ContractValidationError } from '../control-api/errors';
|
|
14
14
|
import {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
2
3
|
import type { Contract } from '@prisma-next/contract/types';
|
|
3
|
-
import type {
|
|
4
|
-
VerifyDatabaseResult,
|
|
5
|
-
VerifyDatabaseSchemaResult,
|
|
6
|
-
} from '@prisma-next/framework-components/control';
|
|
4
|
+
import type { VerifyDatabaseResult } from '@prisma-next/framework-components/control';
|
|
7
5
|
import {
|
|
8
6
|
createControlStack,
|
|
9
7
|
VERIFY_CODE_HASH_MISMATCH,
|
|
@@ -14,7 +12,6 @@ import { ifDefined } from '@prisma-next/utils/defined';
|
|
|
14
12
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
15
13
|
import { Command } from 'commander';
|
|
16
14
|
import { relative, resolve } from 'pathe';
|
|
17
|
-
import { loadConfig } from '../config-loader';
|
|
18
15
|
import { createControlClient } from '../control-api/client';
|
|
19
16
|
import { ContractValidationError } from '../control-api/errors';
|
|
20
17
|
import {
|
|
@@ -29,7 +26,7 @@ import {
|
|
|
29
26
|
errorTargetMismatch,
|
|
30
27
|
errorUnexpected,
|
|
31
28
|
} from '../utils/cli-errors';
|
|
32
|
-
import {
|
|
29
|
+
import { type CombinedVerifyResult, combineVerifyResults } from '../utils/combine-verify-results';
|
|
33
30
|
import {
|
|
34
31
|
addGlobalOptions,
|
|
35
32
|
maskConnectionUrl,
|
|
@@ -103,7 +100,7 @@ function mapVerifyFailure(verifyResult: VerifyDatabaseResult): CliStructuredErro
|
|
|
103
100
|
return errorRuntime(verifyResult.summary);
|
|
104
101
|
}
|
|
105
102
|
|
|
106
|
-
type DbVerifyFailure = CliStructuredError |
|
|
103
|
+
type DbVerifyFailure = CliStructuredError | CombinedVerifyResult;
|
|
107
104
|
|
|
108
105
|
function errorInvalidVerifyMode(options: {
|
|
109
106
|
readonly why: string;
|
|
@@ -419,12 +416,13 @@ async function executeDbVerifyCommand(
|
|
|
419
416
|
});
|
|
420
417
|
}
|
|
421
418
|
|
|
422
|
-
const combined =
|
|
419
|
+
const combined = combineVerifyResults(
|
|
423
420
|
aggregateResult.value.schemaResults,
|
|
424
421
|
aggregateResult.value.appSpaceId,
|
|
425
422
|
options.strict ?? false,
|
|
423
|
+
aggregateResult.value.unclaimed,
|
|
426
424
|
);
|
|
427
|
-
if (!combined.ok) {
|
|
425
|
+
if (!combined.result.ok) {
|
|
428
426
|
return notOk(combined);
|
|
429
427
|
}
|
|
430
428
|
|
|
@@ -438,10 +436,11 @@ async function executeDbVerifyCommand(
|
|
|
438
436
|
...ifDefined('missingCodecs', verifyResult.missingCodecs),
|
|
439
437
|
...ifDefined('codecCoverageSkipped', verifyResult.codecCoverageSkipped),
|
|
440
438
|
schema: {
|
|
441
|
-
summary: combined.summary,
|
|
442
|
-
counts: combined.schema.counts,
|
|
443
|
-
strict: combined.meta?.strict ?? false,
|
|
439
|
+
summary: combined.result.summary,
|
|
440
|
+
counts: combined.result.schema.counts,
|
|
441
|
+
strict: combined.result.meta?.strict ?? false,
|
|
444
442
|
},
|
|
443
|
+
unclaimed: combined.unclaimed,
|
|
445
444
|
meta: {
|
|
446
445
|
...(verifyResult.meta ?? {}),
|
|
447
446
|
schemaVerification: 'performed',
|
|
@@ -459,7 +458,7 @@ async function executeDbSchemaOnlyVerifyCommand(
|
|
|
459
458
|
options: DbVerifyOptions,
|
|
460
459
|
flags: GlobalFlags,
|
|
461
460
|
ui: TerminalUI,
|
|
462
|
-
): Promise<Result<
|
|
461
|
+
): Promise<Result<CombinedVerifyResult, CliStructuredError>> {
|
|
463
462
|
const paths = await resolveVerifyPaths(options);
|
|
464
463
|
renderVerifyHeader(paths, options, 'schema-only', flags, ui);
|
|
465
464
|
|
|
@@ -484,10 +483,11 @@ async function executeDbSchemaOnlyVerifyCommand(
|
|
|
484
483
|
if (!aggregateResult.ok) return notOk(aggregateResult.failure);
|
|
485
484
|
|
|
486
485
|
return ok(
|
|
487
|
-
|
|
486
|
+
combineVerifyResults(
|
|
488
487
|
aggregateResult.value.schemaResults,
|
|
489
488
|
aggregateResult.value.appSpaceId,
|
|
490
489
|
options.strict ?? false,
|
|
490
|
+
aggregateResult.value.unclaimed,
|
|
491
491
|
),
|
|
492
492
|
);
|
|
493
493
|
} catch (error) {
|
|
@@ -542,18 +542,26 @@ export function createDbVerifyCommand(): Command {
|
|
|
542
542
|
|
|
543
543
|
if (mode === 'schema-only') {
|
|
544
544
|
const result = await executeDbSchemaOnlyVerifyCommand(options, flags, ui);
|
|
545
|
-
const exitCode = handleResult(result, flags, ui, (
|
|
545
|
+
const exitCode = handleResult(result, flags, ui, (combined) => {
|
|
546
546
|
if (flags.json) {
|
|
547
|
-
ui.output(formatSchemaVerifyJson(
|
|
547
|
+
ui.output(formatSchemaVerifyJson(combined.result, combined.unclaimed));
|
|
548
548
|
} else {
|
|
549
|
-
|
|
549
|
+
// Always show schema-drift failures, even in quiet mode — exiting 1
|
|
550
|
+
// without diagnostics is unhelpful (same policy as the full-mode
|
|
551
|
+
// failure branch below).
|
|
552
|
+
const renderFlags = combined.result.ok ? flags : { ...flags, quiet: false };
|
|
553
|
+
const output = formatSchemaVerifyOutput(
|
|
554
|
+
combined.result,
|
|
555
|
+
renderFlags,
|
|
556
|
+
combined.unclaimed,
|
|
557
|
+
);
|
|
550
558
|
if (output) {
|
|
551
559
|
ui.log(output);
|
|
552
560
|
}
|
|
553
561
|
}
|
|
554
562
|
});
|
|
555
563
|
|
|
556
|
-
if (result.ok && !result.value.ok) {
|
|
564
|
+
if (result.ok && !result.value.result.ok) {
|
|
557
565
|
process.exit(1);
|
|
558
566
|
}
|
|
559
567
|
|
|
@@ -580,11 +588,15 @@ export function createDbVerifyCommand(): Command {
|
|
|
580
588
|
}
|
|
581
589
|
|
|
582
590
|
if (flags.json) {
|
|
583
|
-
ui.output(formatSchemaVerifyJson(result.failure));
|
|
591
|
+
ui.output(formatSchemaVerifyJson(result.failure.result, result.failure.unclaimed));
|
|
584
592
|
} else {
|
|
585
593
|
// Always show schema-drift failures, even in quiet mode — exiting 1 without
|
|
586
594
|
// diagnostics is unhelpful.
|
|
587
|
-
const output = formatSchemaVerifyOutput(
|
|
595
|
+
const output = formatSchemaVerifyOutput(
|
|
596
|
+
result.failure.result,
|
|
597
|
+
{ ...flags, quiet: false },
|
|
598
|
+
result.failure.unclaimed,
|
|
599
|
+
);
|
|
588
600
|
if (output) {
|
|
589
601
|
ui.log(output);
|
|
590
602
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { loadConfig } from '@prisma-next/config-loader';
|
|
1
2
|
import type { AuthoringPslBlockDescriptorNamespace } from '@prisma-next/framework-components/authoring';
|
|
2
3
|
import type { CoreSchemaView } from '@prisma-next/framework-components/control';
|
|
3
4
|
import type { PslDocumentAst } from '@prisma-next/framework-components/psl-ast';
|
|
4
5
|
import { notOk, ok, type Result } from '@prisma-next/utils/result';
|
|
5
6
|
import { relative, resolve } from 'pathe';
|
|
6
|
-
import { loadConfig } from '../config-loader';
|
|
7
7
|
import { createControlClient } from '../control-api/client';
|
|
8
8
|
import {
|
|
9
9
|
CliStructuredError,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import {
|
|
3
|
+
addGlobalOptions,
|
|
4
|
+
setCommandDescriptions,
|
|
5
|
+
setCommandExamples,
|
|
6
|
+
} from '../utils/command-helpers';
|
|
7
|
+
|
|
8
|
+
export function createLspCommand(): Command {
|
|
9
|
+
const command = new Command('lsp');
|
|
10
|
+
setCommandDescriptions(
|
|
11
|
+
command,
|
|
12
|
+
'Start the Prisma Next language server',
|
|
13
|
+
'Launches a Language Server Protocol server that publishes PSL parse diagnostics\n' +
|
|
14
|
+
'and handles whole-document PSL formatting for the schema inputs declared in\n' +
|
|
15
|
+
'your config (contract.source.inputs). Formatting uses the Prisma Next PSL\n' +
|
|
16
|
+
'formatter and the formatter block from the project config.\n' +
|
|
17
|
+
'Communicates over stdio; intended to be spawned by an\n' +
|
|
18
|
+
'editor, not run interactively. The server keeps running until the editor client\n' +
|
|
19
|
+
'disconnects.',
|
|
20
|
+
);
|
|
21
|
+
setCommandExamples(command, ['prisma-next lsp --stdio']);
|
|
22
|
+
addGlobalOptions(command)
|
|
23
|
+
.option('--stdio', 'Communicate with the editor over stdio (the default and only transport)')
|
|
24
|
+
.action(async () => {
|
|
25
|
+
// Lazy import so `vscode-languageserver` stays off every other command's
|
|
26
|
+
// startup path — only `prisma-next lsp` pays its load cost.
|
|
27
|
+
const { startServer } = await import('@prisma-next/language-server');
|
|
28
|
+
startServer();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return command;
|
|
32
|
+
}
|