@chimerai/cli 0.2.83 → 0.2.85

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.
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,UAAU,aAAa;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA+CD,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,iBAuH9E"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,UAAU,aAAa;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA+CD,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,iBAyH9E"}
@@ -156,9 +156,11 @@ async function createCommand(projectName, options) {
156
156
  console.log(chalk_1.default.white(` cd ${projectName}`));
157
157
  console.log(chalk_1.default.white(' npm run dev'));
158
158
  console.log(chalk_1.default.gray('\n Server will run on http://localhost:3001\n'));
159
- console.log(chalk_1.default.yellow('Login with:'));
160
- console.log(chalk_1.default.white(' Email: admin@example.com'));
161
- console.log(chalk_1.default.white(' Password: admin123\n'));
159
+ if (selectedFeatures.includes('auth')) {
160
+ console.log(chalk_1.default.yellow('Login with:'));
161
+ console.log(chalk_1.default.white(' Email: admin@example.com'));
162
+ console.log(chalk_1.default.white(' Password: admin123\n'));
163
+ }
162
164
  }
163
165
  catch (error) {
164
166
  console.log(chalk_1.default.red('\nāŒ Installation failed'));
@@ -220,7 +222,7 @@ async function createProject(targetDir, projectName, features, sqlite) {
220
222
  }
221
223
  // 9. Create install scripts
222
224
  spinner.text = 'Creating install scripts...';
223
- await createInstallScripts(targetDir, sqlite);
225
+ await createInstallScripts(targetDir, features, sqlite);
224
226
  // 10. Create README
225
227
  spinner.text = 'Creating documentation...';
226
228
  await createReadme(targetDir, projectName, features);
@@ -1216,9 +1218,10 @@ async function getServerSessionWithPermissions() {
1216
1218
  }
1217
1219
  }
1218
1220
  async function createSeedScript(targetDir, features, sqlite) {
1221
+ const hasAuth = features.includes('auth');
1219
1222
  // Generate seed script with feature-specific configuration
1220
1223
  const seedScript = `import { PrismaClient } from '@prisma/client';
1221
- import * as bcrypt from 'bcryptjs';
1224
+ ${hasAuth ? `import * as bcrypt from 'bcryptjs';` : ``}
1222
1225
  import crypto from 'crypto';
1223
1226
 
1224
1227
  const prisma = new PrismaClient();
@@ -1248,7 +1251,7 @@ function encrypt(text: string): string {
1248
1251
  async function main() {
1249
1252
  console.log('🌱 Seeding database...');
1250
1253
 
1251
- // Create default admin user
1254
+ ${hasAuth ? ` // Create default admin user
1252
1255
  const hashedPassword = await bcrypt.hash('admin123', 10);
1253
1256
  const admin = await prisma.user.upsert({
1254
1257
  where: { email: 'admin@example.com' },
@@ -1260,7 +1263,8 @@ async function main() {
1260
1263
  },
1261
1264
  });
1262
1265
 
1263
- console.log('āœ… Admin user created: admin@example.com / admin123');
1266
+ console.log('āœ… Admin user created: admin@example.com / admin123');` : ` // No auth feature selected — skipping admin user creation
1267
+ const admin: { id: string } | null = null;`}
1264
1268
  ${features.includes('rbac')
1265
1269
  ? `
1266
1270
  ${sqlite
@@ -1304,9 +1308,9 @@ ${sqlite
1304
1308
  const adminRole = await prisma.role.findUnique({ where: { name: 'admin' } });
1305
1309
  if (adminRole) {
1306
1310
  await prisma.userRole.upsert({
1307
- where: { userId_roleId: { userId: admin.id, roleId: adminRole.id } },
1311
+ where: { userId_roleId: { userId: admin!.id, roleId: adminRole.id } },
1308
1312
  update: {},
1309
- create: { userId: admin.id, roleId: adminRole.id },
1313
+ create: { userId: admin!.id, roleId: adminRole.id },
1310
1314
  });
1311
1315
  console.log('āœ… Admin user assigned admin role');
1312
1316
  }
@@ -1331,7 +1335,7 @@ ${sqlite
1331
1335
  status: 'active',
1332
1336
  isDefault: true,
1333
1337
  priority: 0,
1334
- createdBy: admin.id,
1338
+ createdBy: admin?.id ?? null,
1335
1339
  },
1336
1340
  });
1337
1341
 
@@ -1375,7 +1379,7 @@ ${sqlite
1375
1379
  status: 'active',
1376
1380
  isDefault: false,
1377
1381
  priority: 1,
1378
- createdBy: admin.id,
1382
+ createdBy: admin?.id ?? null,
1379
1383
  },
1380
1384
  });
1381
1385
 
@@ -1423,7 +1427,14 @@ main()
1423
1427
  async function createDockerCompose(targetDir) {
1424
1428
  await fs_extra_1.default.writeFile(path_1.default.join(targetDir, 'docker-compose.yml'), (0, index_js_1.generateDockerComposeDev)());
1425
1429
  }
1426
- async function createInstallScripts(targetDir, sqlite) {
1430
+ async function createInstallScripts(targetDir, features, sqlite) {
1431
+ const hasAuth = features.includes('auth');
1432
+ const loginBlockBat = hasAuth
1433
+ ? 'echo Login with:\r\necho Email: admin@example.com\r\necho Password: admin123'
1434
+ : 'echo Note: No auth selected - no default login credentials.';
1435
+ const loginBlockSh = hasAuth
1436
+ ? 'echo "Login with:"\necho " Email: admin@example.com"\necho " Password: admin123"'
1437
+ : 'echo "Note: No auth selected - no default login credentials."';
1427
1438
  // Windows install.bat
1428
1439
  const installBat = sqlite
1429
1440
  ? `@echo off
@@ -1473,9 +1484,7 @@ echo Next steps:
1473
1484
  echo npm run dev
1474
1485
  echo Open: http://localhost:3001
1475
1486
  echo.
1476
- echo Login with:
1477
- echo Email: admin@example.com
1478
- echo Password: admin123
1487
+ ${loginBlockBat}
1479
1488
  echo.
1480
1489
  pause
1481
1490
  `
@@ -1545,9 +1554,7 @@ echo Next steps:
1545
1554
  echo npm run dev
1546
1555
  echo Open: http://localhost:3001
1547
1556
  echo.
1548
- echo Login with:
1549
- echo Email: admin@example.com
1550
- echo Password: admin123
1557
+ ${loginBlockBat}
1551
1558
  echo.
1552
1559
  pause
1553
1560
  `;
@@ -1586,9 +1593,7 @@ echo "Next steps:"
1586
1593
  echo " npm run dev"
1587
1594
  echo " Open: http://localhost:3001"
1588
1595
  echo ""
1589
- echo "Login with:"
1590
- echo " Email: admin@example.com"
1591
- echo " Password: admin123"
1596
+ ${loginBlockSh}
1592
1597
  echo ""
1593
1598
  `
1594
1599
  : `#!/bin/bash
@@ -1636,9 +1641,7 @@ echo "Next steps:"
1636
1641
  echo " npm run dev"
1637
1642
  echo " Open: http://localhost:3001"
1638
1643
  echo ""
1639
- echo "Login with:"
1640
- echo " Email: admin@example.com"
1641
- echo " Password: admin123"
1644
+ ${loginBlockSh}
1642
1645
  echo ""
1643
1646
  `;
1644
1647
  await fs_extra_1.default.writeFile(path_1.default.join(targetDir, 'install.bat'), installBat);
@@ -1724,13 +1727,13 @@ npm run dev
1724
1727
 
1725
1728
  Open [http://localhost:3001](http://localhost:3001) in your browser.
1726
1729
 
1727
- ### Default Admin Credentials
1730
+ ${features.includes('auth') ? `### Default Admin Credentials
1728
1731
 
1729
1732
  - Email: admin@example.com
1730
1733
  - Password: admin123
1731
1734
 
1732
1735
  āš ļø Change these in production!
1733
-
1736
+ ` : ``}
1734
1737
  ## Available Scripts
1735
1738
 
1736
1739
  - \`pnpm dev\` - Start development server
@@ -1791,8 +1794,7 @@ Commercial License - See LICENSE file
1791
1794
  5. \`pnpm dev\`
1792
1795
 
1793
1796
  ## Default Login
1794
- - Email: admin@example.com
1795
- - Password: admin123
1797
+ ${features.includes('auth') ? `- Email: admin@example.com\n- Password: admin123` : `- No auth feature selected`}
1796
1798
 
1797
1799
  ## CLI Commands
1798
1800
  - \`chimerai add <component>\` — Add features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chimerai/cli",
3
- "version": "0.2.83",
3
+ "version": "0.2.85",
4
4
  "description": "CLI wizard for ChimerAI starter kit — scaffold auth, RBAC, AI chat, billing and more into any Next.js project",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {