@chimerai/cli 0.2.96 → 0.2.97

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.
@@ -995,6 +995,9 @@ async function copyFeatureFiles(targetDir, features) {
995
995
  const useAppNameHook = templates.generateUseAppNameHook();
996
996
  await fs_extra_1.default.ensureDir(path_1.default.join(targetDir, 'lib'));
997
997
  await fs_extra_1.default.writeFile(path_1.default.join(targetDir, 'lib/use-app-name.ts'), useAppNameHook);
998
+ // app-settings route — always generated (called by useAppName hook)
999
+ await fs_extra_1.default.ensureDir(path_1.default.join(targetDir, 'app/api/app-settings'));
1000
+ await fs_extra_1.default.writeFile(path_1.default.join(targetDir, 'app/api/app-settings/route.ts'), templates.generateAppSettingsRoute());
998
1001
  // ── Widget Infrastructure (embeddable chat for external apps) ──────
999
1002
  // Rate limiter (supports both session and API-key tiers)
1000
1003
  const rateLimiter = templates.generateRateLimiter();
@@ -1107,10 +1110,6 @@ async function copyFeatureFiles(targetDir, features) {
1107
1110
  const adminSettingsRoute = templates.generateAdminSettingsRoute();
1108
1111
  await fs_extra_1.default.ensureDir(path_1.default.join(targetDir, 'app/api/admin/settings'));
1109
1112
  await fs_extra_1.default.writeFile(path_1.default.join(targetDir, 'app/api/admin/settings/route.ts'), adminSettingsRoute);
1110
- // Public app-settings API route (used by useAppName hook)
1111
- const appSettingsRoute = templates.generateAppSettingsRoute();
1112
- await fs_extra_1.default.ensureDir(path_1.default.join(targetDir, 'app/api/app-settings'));
1113
- await fs_extra_1.default.writeFile(path_1.default.join(targetDir, 'app/api/app-settings/route.ts'), appSettingsRoute);
1114
1113
  // ── RBAC Permission utilities (required by admin API routes) ───
1115
1114
  const permissionsLib = `/**
1116
1115
  * Permission utility functions
@@ -1287,6 +1286,17 @@ async function getServerSessionWithPermissions() {
1287
1286
  await fs_extra_1.default.writeFile(path_1.default.join(targetDir, 'app/api/v1/models/route.ts'), templates.generateV1ModelsRoute());
1288
1287
  }
1289
1288
  // ── Billing / Stripe (when selected) ────────────────────────────
1289
+ // Always generate /api/billing/credits — chat hook calls it unconditionally.
1290
+ // Without billing: return a stub so the client gets a clean 200 instead of 404.
1291
+ await fs_extra_1.default.ensureDir(path_1.default.join(targetDir, 'app/api/billing/credits'));
1292
+ if (!features.includes('billing')) {
1293
+ await fs_extra_1.default.writeFile(path_1.default.join(targetDir, 'app/api/billing/credits/route.ts'), `import { NextResponse } from 'next/server';
1294
+ // Billing feature not enabled — return stub so the client doesn't get a 404
1295
+ export async function GET() {
1296
+ return NextResponse.json({ balance: null, enabled: false });
1297
+ }
1298
+ `);
1299
+ }
1290
1300
  if (features.includes('billing')) {
1291
1301
  const stripeLib = templates.generateStripeLib();
1292
1302
  await fs_extra_1.default.ensureDir(path_1.default.join(targetDir, 'lib'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chimerai/cli",
3
- "version": "0.2.96",
3
+ "version": "0.2.97",
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": {