@prisma/cli 8.0.0-rc.9-dev.74 → 8.0.0-rc.9-dev.79
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/dist/cli.js +207 -65
- package/package.json +8 -8
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import process$1 from "node:process";
|
|
4
|
-
import { SERVICE_TOKEN_ENV_VAR, claimedExpiresAt, claimedIdentity, createCli, credentialWorkspaceId, credentialWorkspaceMismatchError, credentialsRequiredError, defineCommand, defineCommandFamily, defineConfigSection, defineSessionCommand, emptyServiceTokenError, flag, loadConfig, noSessionForWorkspaceError, positional, readActiveAccessToken, telemetryCommandGroup } from "@prisma/cli-engine";
|
|
4
|
+
import { SERVICE_TOKEN_ENV_VAR, claimedExpiresAt, claimedIdentity, createCli, credentialWorkspaceId, credentialWorkspaceMismatchError, credentialsRequiredError, defineCommand, defineCommandFamily, defineConfigSection, defineSessionCommand, detectCI, emptyServiceTokenError, flag, loadConfig, noSessionForWorkspaceError, positional, readActiveAccessToken, telemetryCommandGroup } from "@prisma/cli-engine";
|
|
5
5
|
import { createComposerFamily } from "@prisma/composer-cli/family";
|
|
6
6
|
import { ormCommandFamily } from "@prisma/orm-toolchain/cli";
|
|
7
7
|
import { CliStructuredError, notOk, ok } from "@prisma/cli-engine/protocol";
|
|
@@ -1126,6 +1126,20 @@ function parsePackageManager(value) {
|
|
|
1126
1126
|
if (normalized === "npm" || normalized.startsWith("npm@")) return "npm";
|
|
1127
1127
|
return null;
|
|
1128
1128
|
}
|
|
1129
|
+
/** The command that installs what package.json already declares —
|
|
1130
|
+
* init writes the version into the manifest, so a plain install is
|
|
1131
|
+
* right for every manager. */
|
|
1132
|
+
function resolveInstallCommandSync(cwd) {
|
|
1133
|
+
return installCommandForPackageManager(detectPackageManagerSync(cwd) ?? "npm");
|
|
1134
|
+
}
|
|
1135
|
+
function installCommandForPackageManager(packageManager) {
|
|
1136
|
+
switch (packageManager) {
|
|
1137
|
+
case "bun": return "bun install";
|
|
1138
|
+
case "pnpm": return "pnpm install";
|
|
1139
|
+
case "yarn": return "yarn install";
|
|
1140
|
+
case "npm": return "npm install";
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1129
1143
|
function packageRunnerForPackageManager(packageManager) {
|
|
1130
1144
|
switch (packageManager) {
|
|
1131
1145
|
case "bun": return ["bunx"];
|
|
@@ -5229,6 +5243,7 @@ async function syncSkills(status) {
|
|
|
5229
5243
|
return {
|
|
5230
5244
|
projectRoot: status.projectRoot,
|
|
5231
5245
|
packages: status.packages,
|
|
5246
|
+
skills: status.skills.map((skill) => skill.skill),
|
|
5232
5247
|
synced,
|
|
5233
5248
|
pruned,
|
|
5234
5249
|
refused,
|
|
@@ -5293,10 +5308,15 @@ function unmanagedClause(count) {
|
|
|
5293
5308
|
return count === 1 ? "; 1 directory is not managed by this CLI" : `; ${count} directories are not managed by this CLI`;
|
|
5294
5309
|
}
|
|
5295
5310
|
function syncSummary(result) {
|
|
5296
|
-
if (result.
|
|
5297
|
-
|
|
5311
|
+
if (result.pruned.length === 0) {
|
|
5312
|
+
if (result.agents.length === 0) return "No agents are configured to sync skills for.";
|
|
5313
|
+
if (result.packages.length === 0) return "No Prisma packages with agent skills are installed.";
|
|
5314
|
+
if (result.skills.length === 0) return "No Prisma dependencies in your project ship agent skills to sync.";
|
|
5315
|
+
}
|
|
5298
5316
|
const refusedDirs = result.refused.reduce((count, skill) => count + skill.dirs.length, 0);
|
|
5299
5317
|
if (result.synced.length === 0 && result.pruned.length === 0) return `Agent skills are up to date${unmanagedClause(refusedDirs)}.`;
|
|
5318
|
+
const removed = `${result.pruned.length} skill${result.pruned.length === 1 ? "" : "s"}`;
|
|
5319
|
+
if (result.synced.length === 0 && result.pruned.length > 0) return `Removed ${removed}${unmanagedClause(refusedDirs)}.`;
|
|
5300
5320
|
const synced = `${result.synced.length} skill${result.synced.length === 1 ? "" : "s"}`;
|
|
5301
5321
|
return `${result.pruned.length === 0 ? `Synced ${synced}` : `Synced ${synced} and removed ${result.pruned.length}`}${unmanagedClause(refusedDirs)}.`;
|
|
5302
5322
|
}
|
|
@@ -5344,8 +5364,9 @@ function syncPresentations(result) {
|
|
|
5344
5364
|
};
|
|
5345
5365
|
}
|
|
5346
5366
|
function listSummary(result) {
|
|
5347
|
-
if (result.agents.length === 0) return "No agents are configured
|
|
5348
|
-
if (result.
|
|
5367
|
+
if (result.agents.length === 0) return "No agents are configured to sync skills for.";
|
|
5368
|
+
if (result.packages.length === 0) return "No Prisma packages with agent skills are installed.";
|
|
5369
|
+
if (result.skills.length === 0) return "No Prisma dependencies in your project ship agent skills.";
|
|
5349
5370
|
if (!result.upToDate) return "Agent skills are out of date.";
|
|
5350
5371
|
const unmanaged = result.skills.flatMap((skill) => skill.targets).filter((target) => target.state === "unmanaged").length;
|
|
5351
5372
|
return `Agent skills are up to date${unmanagedClause(unmanaged)}.`;
|
|
@@ -5453,6 +5474,7 @@ const skillsSyncCommand = defineCommand({
|
|
|
5453
5474
|
projectRoot: outcome.projectRoot,
|
|
5454
5475
|
agents: ctx.config.agents,
|
|
5455
5476
|
packages: packageReports(outcome.packages),
|
|
5477
|
+
skills: outcome.skills,
|
|
5456
5478
|
synced: outcome.synced,
|
|
5457
5479
|
pruned: outcome.pruned,
|
|
5458
5480
|
refused: outcome.refused,
|
|
@@ -5478,47 +5500,64 @@ const APPEND_ADVICE = {
|
|
|
5478
5500
|
kind: "user-choice",
|
|
5479
5501
|
label: `Append "${POSTINSTALL_SCRIPT}" to your postinstall script yourself to resync the skills on every install.`
|
|
5480
5502
|
};
|
|
5481
|
-
function
|
|
5503
|
+
function addDependencyAdvice(version) {
|
|
5504
|
+
return {
|
|
5505
|
+
kind: "user-choice",
|
|
5506
|
+
label: `Add "prisma": "${version}" to devDependencies yourself, then run your package manager's install.`
|
|
5507
|
+
};
|
|
5508
|
+
}
|
|
5509
|
+
function noPackageJsonDiagnostic(version) {
|
|
5482
5510
|
return {
|
|
5483
5511
|
code: "INIT.NO_PACKAGE_JSON",
|
|
5484
5512
|
severity: "warn",
|
|
5485
|
-
summary: "There is no package.json in this directory, so the postinstall hook
|
|
5513
|
+
summary: "There is no package.json in this directory, so the postinstall hook and the prisma dev dependency were not added.",
|
|
5486
5514
|
nextActions: [{
|
|
5487
5515
|
kind: "user-choice",
|
|
5488
5516
|
label: `Run ${CLI_NAME} init from the directory that holds your package.json.`
|
|
5489
|
-
}]
|
|
5517
|
+
}, addDependencyAdvice(version)]
|
|
5490
5518
|
};
|
|
5491
5519
|
}
|
|
5492
|
-
function unreadablePackageJsonDiagnostic() {
|
|
5520
|
+
function unreadablePackageJsonDiagnostic(version) {
|
|
5493
5521
|
return {
|
|
5494
5522
|
code: "INIT.PACKAGE_JSON_UNREADABLE",
|
|
5495
5523
|
severity: "warn",
|
|
5496
|
-
summary: "package.json could not be parsed, so the postinstall hook
|
|
5497
|
-
nextActions: [APPEND_ADVICE]
|
|
5524
|
+
summary: "package.json could not be parsed, so the postinstall hook and the prisma dev dependency were not added.",
|
|
5525
|
+
nextActions: [APPEND_ADVICE, addDependencyAdvice(version)]
|
|
5498
5526
|
};
|
|
5499
5527
|
}
|
|
5500
|
-
function unwritablePackageJsonDiagnostic() {
|
|
5528
|
+
function unwritablePackageJsonDiagnostic(hookNeeded, dependencyNeeded, version) {
|
|
5501
5529
|
return {
|
|
5502
5530
|
code: "INIT.PACKAGE_JSON_UNWRITABLE",
|
|
5503
5531
|
severity: "warn",
|
|
5504
|
-
summary: "package.json could not be written, so
|
|
5505
|
-
nextActions: [APPEND_ADVICE]
|
|
5532
|
+
summary: "package.json could not be written, so init left it unchanged.",
|
|
5533
|
+
nextActions: [...hookNeeded ? [APPEND_ADVICE] : [], ...dependencyNeeded ? [addDependencyAdvice(version)] : []]
|
|
5506
5534
|
};
|
|
5507
5535
|
}
|
|
5508
|
-
function scriptsNotAnObjectDiagnostic() {
|
|
5536
|
+
function scriptsNotAnObjectDiagnostic(dependencyNeeded, version) {
|
|
5509
5537
|
return {
|
|
5510
5538
|
code: "INIT.SCRIPTS_NOT_AN_OBJECT",
|
|
5511
5539
|
severity: "warn",
|
|
5512
5540
|
summary: "The scripts field in package.json is not an object, so init left it alone.",
|
|
5513
|
-
nextActions: [APPEND_ADVICE]
|
|
5541
|
+
nextActions: [APPEND_ADVICE, ...dependencyNeeded ? [addDependencyAdvice(version)] : []]
|
|
5514
5542
|
};
|
|
5515
5543
|
}
|
|
5516
|
-
function foreignPostinstallDiagnostic() {
|
|
5544
|
+
function foreignPostinstallDiagnostic(dependencyNeeded, version) {
|
|
5517
5545
|
return {
|
|
5518
5546
|
code: "INIT.POSTINSTALL_KEPT",
|
|
5519
5547
|
severity: "warn",
|
|
5520
5548
|
summary: "package.json already has a postinstall script, so init left it alone.",
|
|
5521
|
-
nextActions: [APPEND_ADVICE]
|
|
5549
|
+
nextActions: [APPEND_ADVICE, ...dependencyNeeded ? [addDependencyAdvice(version)] : []]
|
|
5550
|
+
};
|
|
5551
|
+
}
|
|
5552
|
+
function devDependenciesNotAnObjectDiagnostic(version) {
|
|
5553
|
+
return {
|
|
5554
|
+
code: "INIT.DEV_DEPENDENCIES_NOT_AN_OBJECT",
|
|
5555
|
+
severity: "warn",
|
|
5556
|
+
summary: "The devDependencies field in package.json is not an object, so init did not add the prisma dev dependency.",
|
|
5557
|
+
nextActions: [{
|
|
5558
|
+
kind: "user-choice",
|
|
5559
|
+
label: `Fix the devDependencies field so it is an object, then add "prisma": "${version}" yourself and run your package manager's install.`
|
|
5560
|
+
}]
|
|
5522
5561
|
};
|
|
5523
5562
|
}
|
|
5524
5563
|
function configSnippet(agents) {
|
|
@@ -5584,8 +5623,23 @@ function renderManifest(manifest, source, bom, crlf) {
|
|
|
5584
5623
|
const eol = crlf ? "\r\n" : "\n";
|
|
5585
5624
|
return `${bom}${rewritten}${source.endsWith("\n") ? eol : ""}`;
|
|
5586
5625
|
}
|
|
5626
|
+
const DEPENDENCY_FIELDS = [
|
|
5627
|
+
"dependencies",
|
|
5628
|
+
"devDependencies",
|
|
5629
|
+
"optionalDependencies",
|
|
5630
|
+
"peerDependencies"
|
|
5631
|
+
];
|
|
5632
|
+
/** A declaration in any field, at any version or range, counts — init
|
|
5633
|
+
* never second-guesses a version the user chose. */
|
|
5634
|
+
function declaresPrisma(manifest) {
|
|
5635
|
+
return DEPENDENCY_FIELDS.some((field) => {
|
|
5636
|
+
const value = manifest[field];
|
|
5637
|
+
return isPlainObject(value) && Object.hasOwn(value, "prisma");
|
|
5638
|
+
});
|
|
5639
|
+
}
|
|
5587
5640
|
async function addPostinstallHook(cwd) {
|
|
5588
5641
|
const manifestPath = path.join(cwd, "package.json");
|
|
5642
|
+
const version = getCliVersion();
|
|
5589
5643
|
let raw;
|
|
5590
5644
|
try {
|
|
5591
5645
|
raw = await readFile(manifestPath, "utf8");
|
|
@@ -5593,10 +5647,11 @@ async function addPostinstallHook(cwd) {
|
|
|
5593
5647
|
return {
|
|
5594
5648
|
report: {
|
|
5595
5649
|
outcome: "skipped",
|
|
5596
|
-
script: null
|
|
5650
|
+
script: null,
|
|
5651
|
+
dependency: "skipped"
|
|
5597
5652
|
},
|
|
5598
|
-
|
|
5599
|
-
diagnostics: [noPackageJsonDiagnostic()]
|
|
5653
|
+
lines: [summary("warn", "No package.json here; postinstall hook skipped.")],
|
|
5654
|
+
diagnostics: [noPackageJsonDiagnostic(version)]
|
|
5600
5655
|
};
|
|
5601
5656
|
}
|
|
5602
5657
|
const bom = raw.startsWith(BOM) ? BOM : "";
|
|
@@ -5606,60 +5661,138 @@ async function addPostinstallHook(cwd) {
|
|
|
5606
5661
|
if (manifest === null) return {
|
|
5607
5662
|
report: {
|
|
5608
5663
|
outcome: "skipped",
|
|
5609
|
-
script: null
|
|
5664
|
+
script: null,
|
|
5665
|
+
dependency: "skipped"
|
|
5610
5666
|
},
|
|
5611
|
-
|
|
5612
|
-
diagnostics: [unreadablePackageJsonDiagnostic()]
|
|
5667
|
+
lines: [summary("warn", "package.json could not be parsed; postinstall hook skipped.")],
|
|
5668
|
+
diagnostics: [unreadablePackageJsonDiagnostic(version)]
|
|
5613
5669
|
};
|
|
5670
|
+
const dependencyDeclared = declaresPrisma(manifest);
|
|
5671
|
+
const keptDependency = dependencyDeclared ? "declared" : "skipped";
|
|
5614
5672
|
if (manifest.scripts !== void 0 && !isPlainObject(manifest.scripts)) return {
|
|
5615
5673
|
report: {
|
|
5616
5674
|
outcome: "kept",
|
|
5617
|
-
script: null
|
|
5675
|
+
script: null,
|
|
5676
|
+
dependency: keptDependency
|
|
5618
5677
|
},
|
|
5619
|
-
|
|
5620
|
-
diagnostics: [scriptsNotAnObjectDiagnostic()]
|
|
5678
|
+
lines: [summary("warn", "The scripts field in package.json is not an object; left untouched.")],
|
|
5679
|
+
diagnostics: [scriptsNotAnObjectDiagnostic(!dependencyDeclared, version)]
|
|
5621
5680
|
};
|
|
5622
5681
|
const scripts = manifest.scripts ?? {};
|
|
5623
5682
|
const existing = scripts.postinstall;
|
|
5624
|
-
if (existing
|
|
5683
|
+
if (existing !== void 0 && existing !== "prisma skills sync || exit 0") return {
|
|
5625
5684
|
report: {
|
|
5626
|
-
outcome: "
|
|
5627
|
-
script:
|
|
5685
|
+
outcome: "kept",
|
|
5686
|
+
script: typeof existing === "string" ? existing : null,
|
|
5687
|
+
dependency: keptDependency
|
|
5628
5688
|
},
|
|
5629
|
-
|
|
5630
|
-
diagnostics: []
|
|
5689
|
+
lines: [summary("warn", "package.json has its own postinstall script; left untouched.")],
|
|
5690
|
+
diagnostics: [foreignPostinstallDiagnostic(!dependencyDeclared, version)]
|
|
5631
5691
|
};
|
|
5632
|
-
|
|
5692
|
+
return writeHookAndDependency({
|
|
5693
|
+
cwd,
|
|
5694
|
+
manifestPath,
|
|
5695
|
+
manifest,
|
|
5696
|
+
scripts,
|
|
5697
|
+
source,
|
|
5698
|
+
bom,
|
|
5699
|
+
crlf,
|
|
5700
|
+
hookNeeded: existing === void 0,
|
|
5701
|
+
dependencyNeeded: !dependencyDeclared
|
|
5702
|
+
});
|
|
5703
|
+
}
|
|
5704
|
+
async function writeHookAndDependency(edit) {
|
|
5705
|
+
const { manifest, hookNeeded, dependencyNeeded } = edit;
|
|
5706
|
+
const version = getCliVersion();
|
|
5707
|
+
const dependencyBlocked = dependencyNeeded && manifest.devDependencies !== void 0 && !isPlainObject(manifest.devDependencies);
|
|
5708
|
+
const block = dependencyBlock(dependencyBlocked, version);
|
|
5709
|
+
const dependencyEdit = dependencyNeeded && !dependencyBlocked;
|
|
5710
|
+
if (!hookNeeded && !dependencyEdit) return {
|
|
5633
5711
|
report: {
|
|
5634
|
-
outcome: "
|
|
5635
|
-
script:
|
|
5712
|
+
outcome: "exists",
|
|
5713
|
+
script: POSTINSTALL_SCRIPT,
|
|
5714
|
+
dependency: block.kept
|
|
5636
5715
|
},
|
|
5637
|
-
|
|
5638
|
-
diagnostics:
|
|
5716
|
+
lines: [ALREADY_HOOKED, ...block.lines],
|
|
5717
|
+
diagnostics: block.diagnostics
|
|
5639
5718
|
};
|
|
5640
|
-
manifest.scripts = {
|
|
5641
|
-
...scripts,
|
|
5719
|
+
if (hookNeeded) manifest.scripts = {
|
|
5720
|
+
...edit.scripts,
|
|
5642
5721
|
postinstall: POSTINSTALL_SCRIPT
|
|
5643
5722
|
};
|
|
5723
|
+
if (dependencyEdit) manifest.devDependencies = {
|
|
5724
|
+
...isPlainObject(manifest.devDependencies) ? manifest.devDependencies : {},
|
|
5725
|
+
prisma: version
|
|
5726
|
+
};
|
|
5644
5727
|
try {
|
|
5645
|
-
await writeFile(manifestPath, renderManifest(manifest, source, bom, crlf), "utf8");
|
|
5728
|
+
await writeFile(edit.manifestPath, renderManifest(manifest, edit.source, edit.bom, edit.crlf), "utf8");
|
|
5646
5729
|
} catch {
|
|
5647
5730
|
return {
|
|
5648
5731
|
report: {
|
|
5649
|
-
outcome: "skipped",
|
|
5650
|
-
script: null
|
|
5732
|
+
outcome: hookNeeded ? "skipped" : "exists",
|
|
5733
|
+
script: hookNeeded ? null : POSTINSTALL_SCRIPT,
|
|
5734
|
+
dependency: dependencyEdit ? "skipped" : block.kept
|
|
5651
5735
|
},
|
|
5652
|
-
|
|
5653
|
-
diagnostics: [unwritablePackageJsonDiagnostic()]
|
|
5736
|
+
lines: [summary("warn", "package.json could not be written; left unchanged."), ...block.lines],
|
|
5737
|
+
diagnostics: [unwritablePackageJsonDiagnostic(hookNeeded, dependencyEdit, version), ...block.diagnostics]
|
|
5654
5738
|
};
|
|
5655
5739
|
}
|
|
5740
|
+
return manifestEditedStep(edit, dependencyEdit, block, version);
|
|
5741
|
+
}
|
|
5742
|
+
const ALREADY_HOOKED = {
|
|
5743
|
+
kind: "summary",
|
|
5744
|
+
status: "info",
|
|
5745
|
+
text: "The postinstall hook is already in package.json."
|
|
5746
|
+
};
|
|
5747
|
+
/** What a blocked (non-object) devDependencies field contributes to
|
|
5748
|
+
* every outcome: its warning line, its diagnostic, and the outcome the
|
|
5749
|
+
* untouched dependency reports. */
|
|
5750
|
+
function dependencyBlock(blocked, version) {
|
|
5751
|
+
if (!blocked) return {
|
|
5752
|
+
lines: [],
|
|
5753
|
+
diagnostics: [],
|
|
5754
|
+
kept: "declared"
|
|
5755
|
+
};
|
|
5756
|
+
return {
|
|
5757
|
+
lines: [summary("warn", "The devDependencies field in package.json is not an object; prisma was not added.")],
|
|
5758
|
+
diagnostics: [devDependenciesNotAnObjectDiagnostic(version)],
|
|
5759
|
+
kept: "skipped"
|
|
5760
|
+
};
|
|
5761
|
+
}
|
|
5762
|
+
/** Detection walks ancestor package.json and lockfiles, and runs after
|
|
5763
|
+
* the manifest edit already landed — a directory it cannot read must
|
|
5764
|
+
* not fail the init, and guessing npm would name the wrong manager, so
|
|
5765
|
+
* the fallback advice names none. The same guard the post-login tip
|
|
5766
|
+
* puts around this walk. */
|
|
5767
|
+
function installAddedDependencyAction(cwd) {
|
|
5768
|
+
try {
|
|
5769
|
+
return {
|
|
5770
|
+
kind: "run-command",
|
|
5771
|
+
label: "Install the added prisma dev dependency",
|
|
5772
|
+
command: resolveInstallCommandSync(cwd)
|
|
5773
|
+
};
|
|
5774
|
+
} catch {
|
|
5775
|
+
return {
|
|
5776
|
+
kind: "user-choice",
|
|
5777
|
+
label: "Run your package manager's install to fetch the added prisma dev dependency."
|
|
5778
|
+
};
|
|
5779
|
+
}
|
|
5780
|
+
}
|
|
5781
|
+
function manifestEditedStep(edit, dependencyEdit, block, version) {
|
|
5782
|
+
const { hookNeeded } = edit;
|
|
5656
5783
|
return {
|
|
5657
5784
|
report: {
|
|
5658
|
-
outcome: "added",
|
|
5659
|
-
script: POSTINSTALL_SCRIPT
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5785
|
+
outcome: hookNeeded ? "added" : "exists",
|
|
5786
|
+
script: POSTINSTALL_SCRIPT,
|
|
5787
|
+
dependency: dependencyEdit ? "added" : block.kept
|
|
5788
|
+
},
|
|
5789
|
+
lines: [
|
|
5790
|
+
hookNeeded ? summary("ok", `Added "postinstall": "${POSTINSTALL_SCRIPT}" to package.json.`) : ALREADY_HOOKED,
|
|
5791
|
+
...dependencyEdit ? [summary("ok", `Added "prisma": "${version}" to devDependencies in package.json.`)] : [],
|
|
5792
|
+
...block.lines
|
|
5793
|
+
],
|
|
5794
|
+
next: dependencyEdit ? [installAddedDependencyAction(edit.cwd)] : [],
|
|
5795
|
+
diagnostics: block.diagnostics
|
|
5663
5796
|
};
|
|
5664
5797
|
}
|
|
5665
5798
|
/** What the scaffold contains: the effective agents list, spelled the
|
|
@@ -5689,7 +5822,7 @@ async function scaffoldConfigStep(cwd, agents, agentsConfigured) {
|
|
|
5689
5822
|
outcome: "exists",
|
|
5690
5823
|
agents: null
|
|
5691
5824
|
},
|
|
5692
|
-
|
|
5825
|
+
lines: [agentsConfigured ? summary("info", "prisma.config.ts already configures skills.agents.") : summary("warn", "prisma.config.ts already exists; left untouched.")],
|
|
5693
5826
|
diagnostics: agentsConfigured ? [] : [configKeptDiagnostic(agents)]
|
|
5694
5827
|
};
|
|
5695
5828
|
try {
|
|
@@ -5703,7 +5836,7 @@ async function scaffoldConfigStep(cwd, agents, agentsConfigured) {
|
|
|
5703
5836
|
outcome: "skipped",
|
|
5704
5837
|
agents: null
|
|
5705
5838
|
},
|
|
5706
|
-
|
|
5839
|
+
lines: [summary("warn", "prisma.config.ts could not be written; skipped.")],
|
|
5707
5840
|
diagnostics: [configUnwritableDiagnostic(agents)]
|
|
5708
5841
|
};
|
|
5709
5842
|
}
|
|
@@ -5712,10 +5845,17 @@ async function scaffoldConfigStep(cwd, agents, agentsConfigured) {
|
|
|
5712
5845
|
outcome: "created",
|
|
5713
5846
|
agents
|
|
5714
5847
|
},
|
|
5715
|
-
|
|
5848
|
+
lines: [summary("ok", `Created prisma.config.ts with ${configSnippet(agents)}.`)],
|
|
5716
5849
|
diagnostics: []
|
|
5717
5850
|
};
|
|
5718
5851
|
}
|
|
5852
|
+
function skillsOutcome(result) {
|
|
5853
|
+
if (result.synced.length > 0 || result.pruned.length > 0) return "synced";
|
|
5854
|
+
if (result.agents.length === 0) return "no-agents";
|
|
5855
|
+
if (result.packages.length === 0) return "no-packages";
|
|
5856
|
+
if (result.skills.length === 0) return "no-skills";
|
|
5857
|
+
return "up-to-date";
|
|
5858
|
+
}
|
|
5719
5859
|
async function syncSkillsStep(cwd, agents, checkEnabledByConfig) {
|
|
5720
5860
|
try {
|
|
5721
5861
|
const outcome = await syncSkills(await readSkillsStatus(cwd, { agents }));
|
|
@@ -5723,6 +5863,7 @@ async function syncSkillsStep(cwd, agents, checkEnabledByConfig) {
|
|
|
5723
5863
|
projectRoot: outcome.projectRoot,
|
|
5724
5864
|
agents,
|
|
5725
5865
|
packages: packageReports(outcome.packages),
|
|
5866
|
+
skills: outcome.skills,
|
|
5726
5867
|
synced: outcome.synced,
|
|
5727
5868
|
pruned: outcome.pruned,
|
|
5728
5869
|
refused: outcome.refused,
|
|
@@ -5730,10 +5871,10 @@ async function syncSkillsStep(cwd, agents, checkEnabledByConfig) {
|
|
|
5730
5871
|
};
|
|
5731
5872
|
return {
|
|
5732
5873
|
report: {
|
|
5733
|
-
outcome: result
|
|
5874
|
+
outcome: skillsOutcome(result),
|
|
5734
5875
|
sync: result
|
|
5735
5876
|
},
|
|
5736
|
-
|
|
5877
|
+
lines: null,
|
|
5737
5878
|
diagnostics: [...versionConflictDiagnostics(outcome.packages), ...unmanagedDirectoryDiagnostics(outcome.refused)]
|
|
5738
5879
|
};
|
|
5739
5880
|
} catch (cause) {
|
|
@@ -5742,7 +5883,7 @@ async function syncSkillsStep(cwd, agents, checkEnabledByConfig) {
|
|
|
5742
5883
|
outcome: "failed",
|
|
5743
5884
|
sync: null
|
|
5744
5885
|
},
|
|
5745
|
-
|
|
5886
|
+
lines: [summary("warn", "The agent skills could not be synced.")],
|
|
5746
5887
|
diagnostics: [skillsSyncFailedDiagnostic(cause)]
|
|
5747
5888
|
};
|
|
5748
5889
|
}
|
|
@@ -5750,9 +5891,10 @@ async function syncSkillsStep(cwd, agents, checkEnabledByConfig) {
|
|
|
5750
5891
|
const SKIPPED_POSTINSTALL = {
|
|
5751
5892
|
report: {
|
|
5752
5893
|
outcome: "skipped",
|
|
5753
|
-
script: null
|
|
5894
|
+
script: null,
|
|
5895
|
+
dependency: "skipped"
|
|
5754
5896
|
},
|
|
5755
|
-
|
|
5897
|
+
lines: [summary("info", "Skipped the postinstall hook (--no-postinstall).")],
|
|
5756
5898
|
diagnostics: []
|
|
5757
5899
|
};
|
|
5758
5900
|
const SKIPPED_SKILLS = {
|
|
@@ -5760,7 +5902,7 @@ const SKIPPED_SKILLS = {
|
|
|
5760
5902
|
outcome: "skipped",
|
|
5761
5903
|
sync: null
|
|
5762
5904
|
},
|
|
5763
|
-
|
|
5905
|
+
lines: [summary("info", "Skipped the skills sync (--skills=none).")],
|
|
5764
5906
|
diagnostics: []
|
|
5765
5907
|
};
|
|
5766
5908
|
const SKIP_SENTINEL = "none";
|
|
@@ -5804,14 +5946,14 @@ function parseSkillsFlag(raw, configured) {
|
|
|
5804
5946
|
function initPresentations(result, postinstall, config, skills) {
|
|
5805
5947
|
return {
|
|
5806
5948
|
json: () => result,
|
|
5807
|
-
next: () => [],
|
|
5949
|
+
next: () => postinstall.next ?? [],
|
|
5808
5950
|
stdout: () => [],
|
|
5809
5951
|
human: (ui) => {
|
|
5810
5952
|
const skillsBlocks = result.skills.sync === null ? [] : syncPresentations(result.skills.sync).human(ui);
|
|
5811
5953
|
return [
|
|
5812
|
-
...postinstall.
|
|
5813
|
-
...config.
|
|
5814
|
-
...skills.
|
|
5954
|
+
...postinstall.lines ?? [],
|
|
5955
|
+
...config.lines ?? [],
|
|
5956
|
+
...skills.lines ?? skillsBlocks
|
|
5815
5957
|
];
|
|
5816
5958
|
}
|
|
5817
5959
|
};
|
|
@@ -5819,7 +5961,7 @@ function initPresentations(result, postinstall, config, skills) {
|
|
|
5819
5961
|
const initCommand = defineCommand({
|
|
5820
5962
|
help: {
|
|
5821
5963
|
summary: "Prepare this repository for Prisma development",
|
|
5822
|
-
description: "Runs locally and calls no platform API. Adds a postinstall script to package.json that keeps the Prisma agent skills in sync on every install, scaffolds a prisma.config.ts recording which agents to install skills for, then syncs the skills once now. Everything lands in the current directory; a prisma.config.ts or postinstall script that already exists is never edited. Rerunning is safe: each step reports what is already done.",
|
|
5964
|
+
description: "Runs locally and calls no platform API. Adds a postinstall script to package.json that keeps the Prisma agent skills in sync on every install, adds prisma to devDependencies at this CLI's exact version when no dependency field declares it, scaffolds a prisma.config.ts recording which agents to install skills for, then syncs the skills once now. Everything lands in the current directory; a prisma.config.ts or postinstall script that already exists is never edited. Rerunning is safe: each step reports what is already done.",
|
|
5823
5965
|
examples: [
|
|
5824
5966
|
"init",
|
|
5825
5967
|
"init --skills=claude,cursor",
|
|
@@ -14077,7 +14219,7 @@ async function assembleRuntime(proc) {
|
|
|
14077
14219
|
outputStreamsShareDevice: outputStreamsShareDevice(),
|
|
14078
14220
|
exit: (code) => proc.exit(code),
|
|
14079
14221
|
onSignal: makeOnSignal(proc),
|
|
14080
|
-
loadConfig: (configPath) => loadConfig(proc.cwd(), configPath),
|
|
14222
|
+
loadConfig: (configPath) => loadConfig(proc.cwd(), configPath, getCliVersion()),
|
|
14081
14223
|
credentialManager: new FileCredentialManager({
|
|
14082
14224
|
env: proc.env,
|
|
14083
14225
|
fetchWorkspaceName: fetchWorkspaceName(apiBaseUrl),
|
|
@@ -14164,7 +14306,7 @@ function flagTokens(argv) {
|
|
|
14164
14306
|
function isSuppressedByInvocation(runtime) {
|
|
14165
14307
|
const env = runtime.env;
|
|
14166
14308
|
if (env["PRISMA_SKILLS_CHECK"] === "0") return true;
|
|
14167
|
-
if (env
|
|
14309
|
+
if (detectCI(env)) return true;
|
|
14168
14310
|
const argv = flagTokens(runtime.argv);
|
|
14169
14311
|
const group = invokedGroup(argv);
|
|
14170
14312
|
if (group === "skills" || group === "init") return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli",
|
|
3
|
-
"version": "8.0.0-rc.9-dev.
|
|
3
|
+
"version": "8.0.0-rc.9-dev.79",
|
|
4
4
|
"description": "Command-line interface for the Prisma Developer Platform.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"license": "Apache-2.0",
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@manypkg/tools": "^2.1.2",
|
|
43
|
-
"@prisma/cli-engine": "0.2.
|
|
44
|
-
"@prisma/composer-cli": "0.
|
|
43
|
+
"@prisma/cli-engine": "0.2.3",
|
|
44
|
+
"@prisma/composer-cli": "0.13.0-dev.1",
|
|
45
45
|
"@prisma/compute-sdk": "0.39.0",
|
|
46
46
|
"@prisma/credentials-store": "^7.8.0",
|
|
47
47
|
"@prisma/management-api-sdk": "1.55.0",
|
|
48
|
-
"@prisma/orm-toolchain": "8.0.0-rc.5-dev.
|
|
48
|
+
"@prisma/orm-toolchain": "8.0.0-rc.5-dev.4",
|
|
49
49
|
"@vercel/detect-agent": "^1.2.3",
|
|
50
50
|
"better-result": "^2.9.2",
|
|
51
51
|
"dotenv": "^17.4.2",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"open": "^11.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@prisma/composer": "0.
|
|
57
|
-
"@repo/cli-conformance": "8.0.0-rc.9-dev.
|
|
58
|
-
"@repo/cli-telemetry": "8.0.0-rc.9-dev.
|
|
59
|
-
"@repo/tsconfig": "8.0.0-rc.9-dev.
|
|
56
|
+
"@prisma/composer": "0.13.0-dev.1",
|
|
57
|
+
"@repo/cli-conformance": "8.0.0-rc.9-dev.79",
|
|
58
|
+
"@repo/cli-telemetry": "8.0.0-rc.9-dev.79",
|
|
59
|
+
"@repo/tsconfig": "8.0.0-rc.9-dev.79",
|
|
60
60
|
"@types/node": "^22.19.19",
|
|
61
61
|
"tsdown": "^0.21.10",
|
|
62
62
|
"tsx": "^4.22.4",
|