@astralkit/cli 4.6.0 → 4.6.2

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,18 @@ 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.2] — 2026-10-14
9
+
10
+ ### Fixed
11
+ - Install Next.js catch-all and optional catch-all routes used by authentication boosters. Dots within route names no longer trigger the directory-traversal guard.
12
+ - Continue rejecting parent-directory traversal with either slash convention, absolute paths, Windows drive-relative paths and null bytes. Existing route files remain preserved by create-if-missing merges.
13
+
14
+ ## [4.6.1] — 2026-10-11
15
+
16
+ ### Fixed
17
+ - Preserve existing Prisma models when booster schema declarations conflict. Print a manual merge instruction instead of appending duplicate models.
18
+ - 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.
19
+
8
20
  ## [4.6.0] — 2026-08-22
9
21
 
10
22
  ### 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.2",
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');
@@ -97,8 +97,12 @@ export function isSafePath(basedir, filepath) {
97
97
  */
98
98
  export function isSafeInstallDir(cwd, requestedDir) {
99
99
  if (typeof requestedDir !== 'string' || !requestedDir) return false;
100
- if (path.isAbsolute(requestedDir)) return false;
101
- if (requestedDir.includes('..')) return false;
100
+ // Check both separator conventions on every host. Next.js catch-all route
101
+ // names contain dots ([[...slug]]), but only a complete '..' segment is
102
+ // traversal. Reject drive-relative paths too (C:foo on Windows).
103
+ if (path.posix.isAbsolute(requestedDir) || path.win32.isAbsolute(requestedDir)) return false;
104
+ if (/^[a-z]:/i.test(requestedDir) || requestedDir.includes('\0')) return false;
105
+ if (requestedDir.split(/[\\/]/).includes('..')) return false;
102
106
  const resolved = path.resolve(cwd, requestedDir);
103
107
  const relative = path.relative(cwd, resolved);
104
108
  return !relative.startsWith('..') && !path.isAbsolute(relative);