@astralkit/cli 4.6.0 → 4.6.1

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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to the `@astralkit/cli` package.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [4.6.1] — 2026-10-11
9
+
10
+ ### Fixed
11
+ - Preserve existing Prisma models when booster schema declarations conflict. Print a manual merge instruction instead of appending duplicate models.
12
+ - Require an initialized Prisma schema before appending a model-only fragment. Existing identity and database adapters continue to be preserved by create-if-missing merges.
13
+
8
14
  ## [4.6.0] — 2026-08-22
9
15
 
10
16
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astralkit/cli",
3
- "version": "4.6.0",
3
+ "version": "4.6.1",
4
4
  "description": "AstralKit CLI — Install and manage UI components in your project",
5
5
  "type": "module",
6
6
  "bin": {
package/src/lib/merges.js CHANGED
@@ -215,7 +215,10 @@ async function applyAppendUniqueBlock(merge, projectRoot, installSummary) {
215
215
  const filePath = path.resolve(projectRoot, target);
216
216
 
217
217
  if (!fs.existsSync(filePath)) {
218
- // Clean install — create the file with just the block.
218
+ if (target.endsWith('.prisma') && !/\bdatasource\s+\w+\s*\{/.test(block)) {
219
+ throw new Error('Initialize Prisma with your database provider first, then rerun this merge. Model fragments alone are not a complete Prisma schema.');
220
+ }
221
+ // Clean install — create the file with a complete block.
219
222
  fs.mkdirSync(path.dirname(filePath), { recursive: true });
220
223
  fs.writeFileSync(filePath, block.endsWith('\n') ? block : `${block}\n`, 'utf8');
221
224
  installSummary.created.push(target);
@@ -229,6 +232,14 @@ async function applyAppendUniqueBlock(merge, projectRoot, installSummary) {
229
232
  return;
230
233
  }
231
234
 
235
+ if (target.endsWith('.prisma')) {
236
+ const declarations = [...block.matchAll(/^\s*(?:model|enum|type)\s+(\w+)\s*\{/gm)].map(match => match[1]);
237
+ const conflicts = declarations.filter(name => new RegExp(`^\\s*(?:model|enum|type)\\s+${name}\\s*\\{`, 'm').test(existing));
238
+ if (conflicts.length) {
239
+ throw new Error(`Prisma declarations already exist: ${conflicts.join(', ')}. Review and merge these models manually; existing models were preserved.`);
240
+ }
241
+ }
242
+
232
243
  // Preview before applying — these files (prisma/schema.prisma, .env.example)
233
244
  // are user-owned, so consent is required like the other patch strategies.
234
245
  const blockLines = block.replace(/\n$/, '').split('\n');