@chimerai/cli 0.2.73
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/LICENSE +21 -0
- package/README.md +293 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +317 -0
- package/dist/commands/add.d.ts +11 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +2126 -0
- package/dist/commands/create.d.ts +12 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +1703 -0
- package/dist/commands/deploy.d.ts +11 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +219 -0
- package/dist/commands/dev.d.ts +17 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +206 -0
- package/dist/commands/doctor.d.ts +11 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +728 -0
- package/dist/commands/generate.d.ts +19 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +429 -0
- package/dist/commands/init.d.ts +11 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +269 -0
- package/dist/commands/list.d.ts +12 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +328 -0
- package/dist/commands/migrate.d.ts +14 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +197 -0
- package/dist/commands/plugin.d.ts +10 -0
- package/dist/commands/plugin.d.ts.map +1 -0
- package/dist/commands/plugin.js +239 -0
- package/dist/commands/remove.d.ts +11 -0
- package/dist/commands/remove.d.ts.map +1 -0
- package/dist/commands/remove.js +472 -0
- package/dist/commands/secret.d.ts +12 -0
- package/dist/commands/secret.d.ts.map +1 -0
- package/dist/commands/secret.js +102 -0
- package/dist/commands/setup.d.ts +9 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +788 -0
- package/dist/commands/update.d.ts +14 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +211 -0
- package/dist/commands/use.d.ts +9 -0
- package/dist/commands/use.d.ts.map +1 -0
- package/dist/commands/use.js +51 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/license.d.ts +55 -0
- package/dist/license.d.ts.map +1 -0
- package/dist/license.js +258 -0
- package/dist/scanner.d.ts +31 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +113 -0
- package/dist/schema-manager.d.ts +26 -0
- package/dist/schema-manager.d.ts.map +1 -0
- package/dist/schema-manager.js +132 -0
- package/dist/templates/admin.d.ts +49 -0
- package/dist/templates/admin.d.ts.map +1 -0
- package/dist/templates/admin.js +1358 -0
- package/dist/templates/ai-routes.d.ts +17 -0
- package/dist/templates/ai-routes.d.ts.map +1 -0
- package/dist/templates/ai-routes.js +1130 -0
- package/dist/templates/ai-service-tools.d.ts +22 -0
- package/dist/templates/ai-service-tools.d.ts.map +1 -0
- package/dist/templates/ai-service-tools.js +1424 -0
- package/dist/templates/ai-service.d.ts +66 -0
- package/dist/templates/ai-service.d.ts.map +1 -0
- package/dist/templates/ai-service.js +2202 -0
- package/dist/templates/api-routes.d.ts +108 -0
- package/dist/templates/api-routes.d.ts.map +1 -0
- package/dist/templates/api-routes.js +1219 -0
- package/dist/templates/auth.d.ts +48 -0
- package/dist/templates/auth.d.ts.map +1 -0
- package/dist/templates/auth.js +381 -0
- package/dist/templates/billing.d.ts +44 -0
- package/dist/templates/billing.d.ts.map +1 -0
- package/dist/templates/billing.js +551 -0
- package/dist/templates/chat.d.ts +63 -0
- package/dist/templates/chat.d.ts.map +1 -0
- package/dist/templates/chat.js +1979 -0
- package/dist/templates/components.d.ts +22 -0
- package/dist/templates/components.d.ts.map +1 -0
- package/dist/templates/components.js +672 -0
- package/dist/templates/config.d.ts +6 -0
- package/dist/templates/config.d.ts.map +1 -0
- package/dist/templates/config.js +86 -0
- package/dist/templates/docker.d.ts +25 -0
- package/dist/templates/docker.d.ts.map +1 -0
- package/dist/templates/docker.js +165 -0
- package/dist/templates/gdpr.d.ts +16 -0
- package/dist/templates/gdpr.d.ts.map +1 -0
- package/dist/templates/gdpr.js +259 -0
- package/dist/templates/index.d.ts +77 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +339 -0
- package/dist/templates/layout.d.ts +67 -0
- package/dist/templates/layout.d.ts.map +1 -0
- package/dist/templates/layout.js +670 -0
- package/dist/templates/mfa.d.ts +23 -0
- package/dist/templates/mfa.d.ts.map +1 -0
- package/dist/templates/mfa.js +353 -0
- package/dist/templates/middleware.d.ts +12 -0
- package/dist/templates/middleware.d.ts.map +1 -0
- package/dist/templates/middleware.js +116 -0
- package/dist/templates/prisma.d.ts +35 -0
- package/dist/templates/prisma.d.ts.map +1 -0
- package/dist/templates/prisma.js +724 -0
- package/dist/templates/provider-routes.d.ts +21 -0
- package/dist/templates/provider-routes.d.ts.map +1 -0
- package/dist/templates/provider-routes.js +1203 -0
- package/dist/templates/rag.d.ts +48 -0
- package/dist/templates/rag.d.ts.map +1 -0
- package/dist/templates/rag.js +532 -0
- package/dist/templates/widget.d.ts +64 -0
- package/dist/templates/widget.d.ts.map +1 -0
- package/dist/templates/widget.js +1360 -0
- package/dist/utils/provider-db.d.ts +63 -0
- package/dist/utils/provider-db.d.ts.map +1 -0
- package/dist/utils/provider-db.js +300 -0
- package/dist/utils.d.ts +78 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +330 -0
- package/package.json +60 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update Command - Check and update installed components against inline templates
|
|
3
|
+
* REFACTORED PHASE 4: Uses inline generators instead of reading from templates/ folder
|
|
4
|
+
* Compares project files against generated template output, supports --apply for updates
|
|
5
|
+
*/
|
|
6
|
+
interface UpdateOptions {
|
|
7
|
+
dir: string;
|
|
8
|
+
dryRun: boolean;
|
|
9
|
+
diff: boolean;
|
|
10
|
+
apply?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function updateCommand(component: string | undefined, options: UpdateOptions): Promise<void>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAsDD,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,aAAa,iBAmIxF"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Update Command - Check and update installed components against inline templates
|
|
4
|
+
* REFACTORED PHASE 4: Uses inline generators instead of reading from templates/ folder
|
|
5
|
+
* Compares project files against generated template output, supports --apply for updates
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.updateCommand = updateCommand;
|
|
45
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
46
|
+
const ora_1 = __importDefault(require("ora"));
|
|
47
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
48
|
+
const path_1 = __importDefault(require("path"));
|
|
49
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
50
|
+
const templates = __importStar(require("../templates/index.js"));
|
|
51
|
+
const utils_js_1 = require("../utils.js");
|
|
52
|
+
/**
|
|
53
|
+
* Component template definitions — maps target file paths to inline generator functions.
|
|
54
|
+
* No dependency on external templates/ folder.
|
|
55
|
+
*/
|
|
56
|
+
const COMPONENT_TEMPLATES = {
|
|
57
|
+
auth: {
|
|
58
|
+
'app/api/auth/[...nextauth]/route.ts': () => templates.generateNextAuthRoute(),
|
|
59
|
+
'components/SessionProvider.tsx': () => templates.generateSessionProvider(),
|
|
60
|
+
'components/LogoutButton.tsx': () => templates.generateLogoutButton(),
|
|
61
|
+
'app/login/page.tsx': () => templates.generateLoginPage(),
|
|
62
|
+
'lib/auth.ts': () => templates.generateAuthLib(),
|
|
63
|
+
'types/next-auth.d.ts': () => templates.generateNextAuthTypes(),
|
|
64
|
+
},
|
|
65
|
+
'chat-ui': {
|
|
66
|
+
'app/(app)/chat/page.tsx': () => templates.generateChatPage(),
|
|
67
|
+
'app/api/v1/chat/stream/route.ts': () => templates.generateChatStreamRouteWithPersistence(),
|
|
68
|
+
},
|
|
69
|
+
'chat-widget': {
|
|
70
|
+
'public/widget/chat.js': () => templates.generateWidgetBundle(),
|
|
71
|
+
'public/widget/loader.js': () => templates.generateWidgetLoader(),
|
|
72
|
+
'lib/rate-limit.ts': () => templates.generateRateLimiter(),
|
|
73
|
+
'app/api/v1/api-keys/route.ts': () => templates.generateApiKeysRoute(),
|
|
74
|
+
},
|
|
75
|
+
'model-providers': {
|
|
76
|
+
'app/dashboard/providers/page.tsx': () => templates.generateModelProvidersPage(),
|
|
77
|
+
'app/api/providers/route.ts': () => templates.generateProviderCrudRoute(),
|
|
78
|
+
},
|
|
79
|
+
'users-table': {
|
|
80
|
+
'app/admin/users/page.tsx': () => templates.generateAdminUsersPage(),
|
|
81
|
+
'app/api/admin/users/route.ts': () => templates.generateAdminUsersRoute(),
|
|
82
|
+
},
|
|
83
|
+
'roles-table': {
|
|
84
|
+
'app/admin/roles/page.tsx': () => templates.generateAdminRolesPage(),
|
|
85
|
+
'app/api/admin/roles/route.ts': () => templates.generateAdminRolesRoute(),
|
|
86
|
+
},
|
|
87
|
+
config: {
|
|
88
|
+
'next.config.js': () => templates.generateNextConfig(),
|
|
89
|
+
'tsconfig.json': () => templates.generateTsConfig(),
|
|
90
|
+
'tailwind.config.js': () => templates.generateTailwindConfig(),
|
|
91
|
+
'postcss.config.js': () => templates.generatePostcssConfig(),
|
|
92
|
+
},
|
|
93
|
+
prisma: {
|
|
94
|
+
'lib/prisma.ts': () => templates.generatePrismaLib(),
|
|
95
|
+
'lib/encryption.ts': () => templates.generateEncryptionLib(),
|
|
96
|
+
'lib/api-key-auth.ts': () => templates.generateApiKeyAuthLib(),
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
function md5(content) {
|
|
100
|
+
return crypto_1.default.createHash('md5').update(content.replace(/\r\n/g, '\n').trim()).digest('hex');
|
|
101
|
+
}
|
|
102
|
+
async function updateCommand(component, options) {
|
|
103
|
+
console.log(chalk_1.default.bold.cyan('\n🔄 ChimerAI Component Update Check\n'));
|
|
104
|
+
const targetDir = (0, utils_js_1.resolveTargetDir)(options.dir);
|
|
105
|
+
const spinner = (0, ora_1.default)('Comparing components against current templates...').start();
|
|
106
|
+
try {
|
|
107
|
+
const toCheck = component
|
|
108
|
+
? { [component]: COMPONENT_TEMPLATES[component] }
|
|
109
|
+
: COMPONENT_TEMPLATES;
|
|
110
|
+
if (component && !COMPONENT_TEMPLATES[component]) {
|
|
111
|
+
spinner.fail(`Unknown component: ${component}`);
|
|
112
|
+
console.log(chalk_1.default.yellow('Updatable: ' + Object.keys(COMPONENT_TEMPLATES).join(', ')));
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
let identical = 0;
|
|
116
|
+
let modified = 0;
|
|
117
|
+
let missing = 0;
|
|
118
|
+
let updated = 0;
|
|
119
|
+
spinner.stop();
|
|
120
|
+
for (const [compName, files] of Object.entries(toCheck)) {
|
|
121
|
+
if (!files)
|
|
122
|
+
continue;
|
|
123
|
+
const results = [];
|
|
124
|
+
for (const [pFile, generator] of Object.entries(files)) {
|
|
125
|
+
const pPath = path_1.default.join(targetDir, pFile);
|
|
126
|
+
const templateContent = generator();
|
|
127
|
+
if (!fs_extra_1.default.existsSync(pPath)) {
|
|
128
|
+
results.push({ file: pFile, status: 'missing', templateContent });
|
|
129
|
+
missing++;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const projectContent = await fs_extra_1.default.readFile(pPath, 'utf-8');
|
|
133
|
+
const pH = md5(projectContent);
|
|
134
|
+
const tH = md5(templateContent);
|
|
135
|
+
if (pH === tH) {
|
|
136
|
+
results.push({ file: pFile, status: 'identical', projectContent, templateContent });
|
|
137
|
+
identical++;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
results.push({ file: pFile, status: 'modified', projectContent, templateContent });
|
|
141
|
+
modified++;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const hasInstalled = results.some((r) => r.status !== 'missing');
|
|
145
|
+
if (!hasInstalled && !component)
|
|
146
|
+
continue;
|
|
147
|
+
console.log(chalk_1.default.bold.yellow(` ${compName}:`));
|
|
148
|
+
for (const r of results) {
|
|
149
|
+
const icon = r.status === 'identical'
|
|
150
|
+
? chalk_1.default.green('✓')
|
|
151
|
+
: r.status === 'modified'
|
|
152
|
+
? chalk_1.default.yellow('⚡')
|
|
153
|
+
: chalk_1.default.gray('○');
|
|
154
|
+
const label = r.status === 'identical'
|
|
155
|
+
? 'up to date'
|
|
156
|
+
: r.status === 'modified'
|
|
157
|
+
? 'modified locally'
|
|
158
|
+
: 'not installed';
|
|
159
|
+
console.log(` ${icon} ${r.file} ${chalk_1.default.gray(`(${label})`)}`);
|
|
160
|
+
// Show diff if requested
|
|
161
|
+
if (options.diff && r.status === 'modified' && r.projectContent) {
|
|
162
|
+
const pLines = r.projectContent.split('\n');
|
|
163
|
+
const tLines = r.templateContent.split('\n');
|
|
164
|
+
let shown = 0;
|
|
165
|
+
for (let i = 0; i < Math.max(pLines.length, tLines.length) && shown < 8; i++) {
|
|
166
|
+
if (pLines[i] !== tLines[i]) {
|
|
167
|
+
shown++;
|
|
168
|
+
if (pLines[i] !== undefined)
|
|
169
|
+
console.log(chalk_1.default.red(` - L${i + 1}: ${pLines[i].substring(0, 80)}`));
|
|
170
|
+
if (tLines[i] !== undefined)
|
|
171
|
+
console.log(chalk_1.default.green(` + L${i + 1}: ${tLines[i].substring(0, 80)}`));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (shown >= 8)
|
|
175
|
+
console.log(chalk_1.default.gray(' ... and more'));
|
|
176
|
+
}
|
|
177
|
+
// Apply update if --apply flag is set
|
|
178
|
+
if (options.apply && r.status === 'modified') {
|
|
179
|
+
const filePath = path_1.default.join(targetDir, r.file);
|
|
180
|
+
// Create backup
|
|
181
|
+
const backupDir = path_1.default.join(targetDir, '.chimerai', 'backup');
|
|
182
|
+
await fs_extra_1.default.ensureDir(backupDir);
|
|
183
|
+
const backupPath = path_1.default.join(backupDir, `${r.file.replace(/\//g, '_')}.${Date.now()}.bak`);
|
|
184
|
+
await fs_extra_1.default.copy(filePath, backupPath);
|
|
185
|
+
// Write updated content
|
|
186
|
+
await fs_extra_1.default.writeFile(filePath, r.templateContent);
|
|
187
|
+
console.log(chalk_1.default.green(` ↳ Updated (backup: ${path_1.default.relative(targetDir, backupPath)})`));
|
|
188
|
+
updated++;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
console.log('');
|
|
192
|
+
}
|
|
193
|
+
console.log(chalk_1.default.bold('📊 Summary:'));
|
|
194
|
+
console.log(chalk_1.default.green(` ✓ ${identical} up to date`));
|
|
195
|
+
if (modified > 0)
|
|
196
|
+
console.log(chalk_1.default.yellow(` ⚡ ${modified} modified locally`));
|
|
197
|
+
if (missing > 0)
|
|
198
|
+
console.log(chalk_1.default.gray(` ○ ${missing} not installed`));
|
|
199
|
+
if (updated > 0)
|
|
200
|
+
console.log(chalk_1.default.green(` ↑ ${updated} updated`));
|
|
201
|
+
if (modified > 0 && !options.diff && !options.apply) {
|
|
202
|
+
console.log(chalk_1.default.cyan('\n 💡 Run with --diff to see differences.'));
|
|
203
|
+
console.log(chalk_1.default.cyan(' 💡 Run with --apply to update modified files (creates backups).\n'));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
spinner.fail('Update check failed');
|
|
208
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
209
|
+
console.error(chalk_1.default.red(message));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use Command - Switch between registered projects or view registry
|
|
3
|
+
*/
|
|
4
|
+
interface UseOptions {
|
|
5
|
+
list?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function useCommand(projectName: string | undefined, options: UseOptions): Promise<void>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=use.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../src/commands/use.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,UAAU,UAAU;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,UAAU,iBA+CpF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Use Command - Switch between registered projects or view registry
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.useCommand = useCommand;
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const utils_js_1 = require("../utils.js");
|
|
12
|
+
async function useCommand(projectName, options) {
|
|
13
|
+
const registry = (0, utils_js_1.listRegisteredProjects)();
|
|
14
|
+
// --list: Show all projects
|
|
15
|
+
if (options.list) {
|
|
16
|
+
if (Object.keys(registry.projects).length === 0) {
|
|
17
|
+
console.log(chalk_1.default.yellow('\nNo projects registered.'));
|
|
18
|
+
console.log(chalk_1.default.gray('Create one with: chimerai create <name>\n'));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
console.log(chalk_1.default.bold('\nRegistered Projects:\n'));
|
|
22
|
+
for (const [name, projectPath] of Object.entries(registry.projects)) {
|
|
23
|
+
const isDefault = name === registry.default;
|
|
24
|
+
const marker = isDefault ? chalk_1.default.green('●') : chalk_1.default.gray('○');
|
|
25
|
+
const suffix = isDefault ? chalk_1.default.green(' (default)') : '';
|
|
26
|
+
console.log(` ${marker} ${chalk_1.default.bold(name)} ${chalk_1.default.gray(projectPath)}${suffix}`);
|
|
27
|
+
}
|
|
28
|
+
console.log();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// No argument: show current default
|
|
32
|
+
if (!projectName) {
|
|
33
|
+
if (registry.default && registry.projects[registry.default]) {
|
|
34
|
+
console.log(chalk_1.default.cyan(`\nCurrent Default Project: ${chalk_1.default.bold(registry.default)} (${registry.projects[registry.default]})\n`));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.log(chalk_1.default.yellow('\nNo default project set.'));
|
|
38
|
+
console.log(chalk_1.default.gray('Set one with: chimerai use <name>\n'));
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Set project
|
|
43
|
+
if ((0, utils_js_1.setDefaultProject)(projectName)) {
|
|
44
|
+
const projectPath = registry.projects[projectName];
|
|
45
|
+
console.log(chalk_1.default.green(`\n✅ Default project changed to: ${chalk_1.default.bold(projectName)} (${projectPath})\n`));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
console.log(chalk_1.default.red(`\n❌ Project "${projectName}" not found.`));
|
|
49
|
+
console.log(chalk_1.default.gray('View available projects with: chimerai use --list\n'));
|
|
50
|
+
}
|
|
51
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @chimerai/cli
|
|
3
|
+
* CLI wizard for ChimerAI starter kit
|
|
4
|
+
*/
|
|
5
|
+
export * from './commands/init.js';
|
|
6
|
+
export * from './commands/add.js';
|
|
7
|
+
export * from './commands/setup.js';
|
|
8
|
+
export * from './commands/create.js';
|
|
9
|
+
export * from './commands/doctor.js';
|
|
10
|
+
export * from './commands/list.js';
|
|
11
|
+
export * from './commands/remove.js';
|
|
12
|
+
export * from './commands/update.js';
|
|
13
|
+
export * from './commands/plugin.js';
|
|
14
|
+
export * from './commands/migrate.js';
|
|
15
|
+
export * from './commands/deploy.js';
|
|
16
|
+
export * from './commands/dev.js';
|
|
17
|
+
export * from './commands/generate.js';
|
|
18
|
+
export * from './commands/secret.js';
|
|
19
|
+
export { validateName, validateWorkspace, handleCliError } from './utils.js';
|
|
20
|
+
export { scanProject, type ProjectInfo } from './scanner.js';
|
|
21
|
+
export { extendPrismaSchema, getPrismaModels, modelExists } from './schema-manager.js';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @chimerai/cli
|
|
4
|
+
* CLI wizard for ChimerAI starter kit
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.modelExists = exports.getPrismaModels = exports.extendPrismaSchema = exports.scanProject = exports.handleCliError = exports.validateWorkspace = exports.validateName = void 0;
|
|
22
|
+
__exportStar(require("./commands/init.js"), exports);
|
|
23
|
+
__exportStar(require("./commands/add.js"), exports);
|
|
24
|
+
__exportStar(require("./commands/setup.js"), exports);
|
|
25
|
+
__exportStar(require("./commands/create.js"), exports);
|
|
26
|
+
__exportStar(require("./commands/doctor.js"), exports);
|
|
27
|
+
__exportStar(require("./commands/list.js"), exports);
|
|
28
|
+
__exportStar(require("./commands/remove.js"), exports);
|
|
29
|
+
__exportStar(require("./commands/update.js"), exports);
|
|
30
|
+
__exportStar(require("./commands/plugin.js"), exports);
|
|
31
|
+
__exportStar(require("./commands/migrate.js"), exports);
|
|
32
|
+
__exportStar(require("./commands/deploy.js"), exports);
|
|
33
|
+
__exportStar(require("./commands/dev.js"), exports);
|
|
34
|
+
__exportStar(require("./commands/generate.js"), exports);
|
|
35
|
+
__exportStar(require("./commands/secret.js"), exports);
|
|
36
|
+
var utils_js_1 = require("./utils.js");
|
|
37
|
+
Object.defineProperty(exports, "validateName", { enumerable: true, get: function () { return utils_js_1.validateName; } });
|
|
38
|
+
Object.defineProperty(exports, "validateWorkspace", { enumerable: true, get: function () { return utils_js_1.validateWorkspace; } });
|
|
39
|
+
Object.defineProperty(exports, "handleCliError", { enumerable: true, get: function () { return utils_js_1.handleCliError; } });
|
|
40
|
+
var scanner_js_1 = require("./scanner.js");
|
|
41
|
+
Object.defineProperty(exports, "scanProject", { enumerable: true, get: function () { return scanner_js_1.scanProject; } });
|
|
42
|
+
var schema_manager_js_1 = require("./schema-manager.js");
|
|
43
|
+
Object.defineProperty(exports, "extendPrismaSchema", { enumerable: true, get: function () { return schema_manager_js_1.extendPrismaSchema; } });
|
|
44
|
+
Object.defineProperty(exports, "getPrismaModels", { enumerable: true, get: function () { return schema_manager_js_1.getPrismaModels; } });
|
|
45
|
+
Object.defineProperty(exports, "modelExists", { enumerable: true, get: function () { return schema_manager_js_1.modelExists; } });
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChimerAI License & Edition Management
|
|
3
|
+
*
|
|
4
|
+
* Drei Tiers: free < enterprise < enterprise-pro
|
|
5
|
+
* License keys werden via Lemon Squeezy ausgegeben und lokal gespeichert.
|
|
6
|
+
*
|
|
7
|
+
* Key-Präfixe (Konvention):
|
|
8
|
+
* ls_live_ent_... → Enterprise
|
|
9
|
+
* ls_live_entpro_... → Enterprise Pro
|
|
10
|
+
* chi_ent_... → Enterprise (interner Test-Key)
|
|
11
|
+
* chi_entpro_... → Enterprise Pro (interner Test-Key)
|
|
12
|
+
*/
|
|
13
|
+
export type Edition = 'free' | 'enterprise' | 'enterprise-pro';
|
|
14
|
+
export interface LicenseFile {
|
|
15
|
+
key: string;
|
|
16
|
+
token?: string;
|
|
17
|
+
edition: Edition;
|
|
18
|
+
email?: string;
|
|
19
|
+
validUntil?: string;
|
|
20
|
+
activatedAt: string;
|
|
21
|
+
lastChecked?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Free-Komponenten — immer verfügbar, kein Gate */
|
|
24
|
+
export declare const FREE_COMPONENTS: Set<string>;
|
|
25
|
+
/** Enterprise-Komponenten (Enterprise + Enterprise Pro) */
|
|
26
|
+
export declare const ENTERPRISE_COMPONENTS: Record<string, string>;
|
|
27
|
+
/** Enterprise Pro-Komponenten (nur Enterprise Pro) */
|
|
28
|
+
export declare const ENTERPRISE_PRO_COMPONENTS: Record<string, string>;
|
|
29
|
+
export declare function getRequiredEdition(component: string): Edition | null;
|
|
30
|
+
export declare function readLicense(): LicenseFile | null;
|
|
31
|
+
export declare function writeLicense(license: LicenseFile): void;
|
|
32
|
+
export declare function clearLicense(): void;
|
|
33
|
+
export declare function getEdition(): Edition;
|
|
34
|
+
/** Verifies the JWT signature of a stored license token (async). */
|
|
35
|
+
export declare function verifyLicenseToken(token: string): Promise<{
|
|
36
|
+
edition: Edition;
|
|
37
|
+
email: string;
|
|
38
|
+
} | null>;
|
|
39
|
+
/** Activates a license key by calling the chimerai.dev API. Returns error string or null on success. */
|
|
40
|
+
export declare function activateLicenseOnline(key: string): Promise<{
|
|
41
|
+
edition: Edition;
|
|
42
|
+
email: string;
|
|
43
|
+
token: string;
|
|
44
|
+
} | {
|
|
45
|
+
error: string;
|
|
46
|
+
}>;
|
|
47
|
+
export declare function isEnterpriseOrHigher(): boolean;
|
|
48
|
+
export declare function isEnterpriseProEdition(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Prüft ob eine Komponente in der aktuellen Edition zugänglich ist.
|
|
51
|
+
* Gibt kontextuelle Upsell-Meldung aus und beendet den Prozess wenn nicht.
|
|
52
|
+
*/
|
|
53
|
+
export declare function assertComponentAccess(component: string): void;
|
|
54
|
+
export declare function printLicenseStatus(): void;
|
|
55
|
+
//# sourceMappingURL=license.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../src/license.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAE/D,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA8BD,oDAAoD;AACpD,eAAO,MAAM,eAAe,aAO1B,CAAC;AAEH,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAWxD,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK5D,CAAC;AAIF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAKpE;AAID,wBAAgB,WAAW,IAAI,WAAW,GAAG,IAAI,CAQhD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAGvD;AAED,wBAAgB,YAAY,IAAI,IAAI,CAInC;AAID,wBAAgB,UAAU,IAAI,OAAO,CAcpC;AAED,oEAAoE;AACpE,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAWrD;AAED,wGAAwG;AACxG,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA8BjF;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CA6D7D;AAUD,wBAAgB,kBAAkB,IAAI,IAAI,CAuBzC"}
|