@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ChimerAI Kickstart Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# @chimerai/cli
|
|
2
|
+
|
|
3
|
+
Interactive CLI wizard for ChimerAI starter kit. Quickly scaffold RBAC, authentication, chat interfaces, and more.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Global Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add -g @chimerai/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### One-time Usage (npx)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @chimerai/cli init
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
### `chimerai init [feature]`
|
|
22
|
+
|
|
23
|
+
Initialize a new ChimerAI project or add features to an existing one.
|
|
24
|
+
|
|
25
|
+
**Usage:**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Interactive mode - choose features
|
|
29
|
+
npx @chimerai/cli init
|
|
30
|
+
|
|
31
|
+
# Initialize all features (non-interactive)
|
|
32
|
+
npx @chimerai/cli init --yes
|
|
33
|
+
|
|
34
|
+
# Initialize specific feature
|
|
35
|
+
npx @chimerai/cli init rbac
|
|
36
|
+
npx @chimerai/cli init auth
|
|
37
|
+
npx @chimerai/cli init chat
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Available Features:**
|
|
41
|
+
|
|
42
|
+
- `rbac` - Role-Based Access Control
|
|
43
|
+
- `auth` - NextAuth authentication
|
|
44
|
+
- `chat` - AI Chat interface
|
|
45
|
+
- `billing` - Subscription & billing
|
|
46
|
+
- `rag` - RAG (Retrieval Augmented Generation)
|
|
47
|
+
- `all` - All features (default)
|
|
48
|
+
|
|
49
|
+
**Options:**
|
|
50
|
+
|
|
51
|
+
- `-d, --dir <directory>` - Target directory (default: current)
|
|
52
|
+
- `-y, --yes` - Skip prompts, use defaults
|
|
53
|
+
|
|
54
|
+
### `chimerai add <component>`
|
|
55
|
+
|
|
56
|
+
Add a specific component to your project.
|
|
57
|
+
|
|
58
|
+
**Usage:**
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Add users management table
|
|
62
|
+
npx @chimerai/cli add users-table
|
|
63
|
+
|
|
64
|
+
# Add roles management table
|
|
65
|
+
npx @chimerai/cli add roles-table
|
|
66
|
+
|
|
67
|
+
# Add groups management
|
|
68
|
+
npx @chimerai/cli add groups-table
|
|
69
|
+
|
|
70
|
+
# Add permissions management
|
|
71
|
+
npx @chimerai/cli add permissions-table
|
|
72
|
+
|
|
73
|
+
# Add chat UI
|
|
74
|
+
npx @chimerai/cli add chat-ui
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Available Components:**
|
|
78
|
+
|
|
79
|
+
- `users-table` - User management interface
|
|
80
|
+
- `roles-table` - Role management interface
|
|
81
|
+
- `groups-table` - Group management interface
|
|
82
|
+
- `permissions-table` - Permission management interface
|
|
83
|
+
- `chat-ui` - AI chat interface
|
|
84
|
+
|
|
85
|
+
### `chimerai setup <service>`
|
|
86
|
+
|
|
87
|
+
Configure integrations and services.
|
|
88
|
+
|
|
89
|
+
**Usage:**
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Setup database
|
|
93
|
+
npx @chimerai/cli setup database
|
|
94
|
+
|
|
95
|
+
# Setup authentication
|
|
96
|
+
npx @chimerai/cli setup auth
|
|
97
|
+
|
|
98
|
+
# Setup OpenAI
|
|
99
|
+
npx @chimerai/cli setup openai
|
|
100
|
+
|
|
101
|
+
# Setup Anthropic (Claude)
|
|
102
|
+
npx @chimerai/cli setup anthropic
|
|
103
|
+
|
|
104
|
+
# Setup Ollama (local LLMs)
|
|
105
|
+
npx @chimerai/cli setup ollama
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Available Services:**
|
|
109
|
+
|
|
110
|
+
- `database` - Database connection (PostgreSQL, MySQL, SQLite)
|
|
111
|
+
- `auth` - NextAuth configuration
|
|
112
|
+
- `openai` - OpenAI API integration
|
|
113
|
+
- `anthropic` - Anthropic (Claude) API integration
|
|
114
|
+
- `ollama` - Ollama local LLM integration
|
|
115
|
+
|
|
116
|
+
### `chimerai examples`
|
|
117
|
+
|
|
118
|
+
Show usage examples.
|
|
119
|
+
|
|
120
|
+
## Examples
|
|
121
|
+
|
|
122
|
+
### Complete New Project Setup
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# 1. Create new Next.js project
|
|
126
|
+
npx create-next-app@latest my-app --typescript --tailwind --app
|
|
127
|
+
|
|
128
|
+
# 2. Navigate to project
|
|
129
|
+
cd my-app
|
|
130
|
+
|
|
131
|
+
# 3. Initialize ChimerAI features
|
|
132
|
+
npx @chimerai/cli init
|
|
133
|
+
|
|
134
|
+
# 4. Configure database
|
|
135
|
+
npx @chimerai/cli setup database
|
|
136
|
+
|
|
137
|
+
# 5. Configure authentication
|
|
138
|
+
npx @chimerai/cli setup auth
|
|
139
|
+
|
|
140
|
+
# 6. Install dependencies
|
|
141
|
+
pnpm install
|
|
142
|
+
|
|
143
|
+
# 7. Push database schema
|
|
144
|
+
pnpm db:push
|
|
145
|
+
|
|
146
|
+
# 8. Start development server
|
|
147
|
+
pnpm dev
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Add Features to Existing Project
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Add RBAC to existing project
|
|
154
|
+
npx @chimerai/cli init rbac
|
|
155
|
+
|
|
156
|
+
# Add specific components
|
|
157
|
+
npx @chimerai/cli add users-table
|
|
158
|
+
npx @chimerai/cli add roles-table
|
|
159
|
+
|
|
160
|
+
# Configure AI providers
|
|
161
|
+
npx @chimerai/cli setup openai
|
|
162
|
+
npx @chimerai/cli setup anthropic
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## What Gets Installed
|
|
166
|
+
|
|
167
|
+
### RBAC (`init rbac`)
|
|
168
|
+
|
|
169
|
+
- ā
`@chimerai/admin-ui` package
|
|
170
|
+
- ā
Prisma schema with User, Role, Permission, Group models
|
|
171
|
+
- ā
API routes for CRUD operations
|
|
172
|
+
- ā
Admin pages for management
|
|
173
|
+
|
|
174
|
+
### Authentication (`init auth`)
|
|
175
|
+
|
|
176
|
+
- ā
NextAuth configuration
|
|
177
|
+
- ā
Session management
|
|
178
|
+
- ā
Role & permission integration
|
|
179
|
+
- ā
Protected routes middleware
|
|
180
|
+
|
|
181
|
+
### Chat (`init chat`)
|
|
182
|
+
|
|
183
|
+
- ā
Chat UI components
|
|
184
|
+
- ā
AI provider integration
|
|
185
|
+
- ā
Streaming support
|
|
186
|
+
- ā
Conversation history
|
|
187
|
+
|
|
188
|
+
### Billing (`init billing`)
|
|
189
|
+
|
|
190
|
+
- ā
Subscription management
|
|
191
|
+
- ā
Credit system
|
|
192
|
+
- ā
Payment integration (Stripe)
|
|
193
|
+
- ā
Usage tracking
|
|
194
|
+
|
|
195
|
+
## Project Structure After Init
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
your-project/
|
|
199
|
+
āāā app/
|
|
200
|
+
ā āāā admin/ # Admin pages
|
|
201
|
+
ā ā āāā users/
|
|
202
|
+
ā ā āāā roles/
|
|
203
|
+
ā ā āāā groups/
|
|
204
|
+
ā ā āāā permissions/
|
|
205
|
+
ā āāā api/
|
|
206
|
+
ā āāā admin/ # Admin API routes
|
|
207
|
+
ā āāā users/
|
|
208
|
+
ā āāā roles/
|
|
209
|
+
ā āāā groups/
|
|
210
|
+
āāā lib/
|
|
211
|
+
ā āāā auth.ts # NextAuth config
|
|
212
|
+
ā āāā prisma.ts # Prisma client
|
|
213
|
+
āāā prisma/
|
|
214
|
+
ā āāā schema.prisma # Database schema
|
|
215
|
+
āāā package.json # Updated with @chimerai packages
|
|
216
|
+
āāā .env # Environment variables
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Configuration Files
|
|
220
|
+
|
|
221
|
+
### .env
|
|
222
|
+
|
|
223
|
+
After running setup commands, your `.env` will contain:
|
|
224
|
+
|
|
225
|
+
```env
|
|
226
|
+
# Database
|
|
227
|
+
DATABASE_URL="postgresql://user:password@localhost:5432/db"
|
|
228
|
+
|
|
229
|
+
# Authentication
|
|
230
|
+
NEXTAUTH_SECRET="generated-secret"
|
|
231
|
+
NEXTAUTH_URL="http://localhost:3000"
|
|
232
|
+
|
|
233
|
+
# AI Providers
|
|
234
|
+
OPENAI_API_KEY="sk-..."
|
|
235
|
+
ANTHROPIC_API_KEY="sk-ant-..."
|
|
236
|
+
OLLAMA_API_URL="http://localhost:11434"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Development
|
|
240
|
+
|
|
241
|
+
### Build CLI
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
cd packages/cli
|
|
245
|
+
pnpm build
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Test Locally
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Link globally
|
|
252
|
+
pnpm link --global
|
|
253
|
+
|
|
254
|
+
# Test commands
|
|
255
|
+
chimerai init --help
|
|
256
|
+
chimerai add users-table
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Watch Mode
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
pnpm dev
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Troubleshooting
|
|
266
|
+
|
|
267
|
+
### Command not found
|
|
268
|
+
|
|
269
|
+
If `chimerai` command is not found after global install:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# Reinstall globally
|
|
273
|
+
pnpm add -g @chimerai/cli
|
|
274
|
+
|
|
275
|
+
# Or use npx
|
|
276
|
+
npx @chimerai/cli
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Permission errors
|
|
280
|
+
|
|
281
|
+
On Unix systems, you might need to make the CLI executable:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
chmod +x ./dist/cli.js
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Contributing
|
|
288
|
+
|
|
289
|
+
The CLI is extensible! Add new commands in `src/commands/` and register them in `src/cli.ts`.
|
|
290
|
+
|
|
291
|
+
## License
|
|
292
|
+
|
|
293
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* ChimerAI CLI
|
|
5
|
+
* Wizard tool for setting up RBAC, AI features, and more
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
const commander_1 = require("commander");
|
|
12
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
+
const init_js_1 = require("./commands/init.js");
|
|
14
|
+
const add_js_1 = require("./commands/add.js");
|
|
15
|
+
const setup_js_1 = require("./commands/setup.js");
|
|
16
|
+
const create_js_1 = require("./commands/create.js");
|
|
17
|
+
const doctor_js_1 = require("./commands/doctor.js");
|
|
18
|
+
const list_js_1 = require("./commands/list.js");
|
|
19
|
+
const remove_js_1 = require("./commands/remove.js");
|
|
20
|
+
const update_js_1 = require("./commands/update.js");
|
|
21
|
+
const plugin_js_1 = require("./commands/plugin.js");
|
|
22
|
+
const migrate_js_1 = require("./commands/migrate.js");
|
|
23
|
+
const deploy_js_1 = require("./commands/deploy.js");
|
|
24
|
+
const dev_js_1 = require("./commands/dev.js");
|
|
25
|
+
const generate_js_1 = require("./commands/generate.js");
|
|
26
|
+
const use_js_1 = require("./commands/use.js");
|
|
27
|
+
const secret_js_1 = require("./commands/secret.js");
|
|
28
|
+
const utils_js_1 = require("./utils.js");
|
|
29
|
+
const license_js_1 = require("./license.js");
|
|
30
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
31
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
32
|
+
const pkgPath = node_path_1.default.resolve(__dirname, '..', 'package.json');
|
|
33
|
+
const { version } = JSON.parse(node_fs_1.default.readFileSync(pkgPath, 'utf-8'));
|
|
34
|
+
const program = new commander_1.Command();
|
|
35
|
+
program.name('chimerai').description('CLI wizard for ChimerAI starter kit').version(version);
|
|
36
|
+
// Create command - Generate new project with selected features
|
|
37
|
+
program
|
|
38
|
+
.command('create')
|
|
39
|
+
.description('Create a new ChimerAI project with selected features')
|
|
40
|
+
.argument('<project-name>', 'Name of the project to create')
|
|
41
|
+
.option('-y, --yes', 'Skip prompts and use default features', false)
|
|
42
|
+
.option('-i, --install', 'Automatically install dependencies after creation', false)
|
|
43
|
+
.option('--sqlite', 'Use SQLite instead of PostgreSQL (no Docker needed)', false)
|
|
44
|
+
.action((projectName, opts) => {
|
|
45
|
+
(0, utils_js_1.assertValidName)(projectName, 'Project name');
|
|
46
|
+
return (0, create_js_1.createCommand)(projectName, opts);
|
|
47
|
+
});
|
|
48
|
+
// Init command - Initialize new project or feature
|
|
49
|
+
program
|
|
50
|
+
.command('init')
|
|
51
|
+
.description('Initialize a new ChimerAI project or feature')
|
|
52
|
+
.argument('[feature]', 'Feature to initialize (rbac, auth, chat, billing)', 'all')
|
|
53
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
54
|
+
.option('-y, --yes', 'Skip prompts and use defaults', false)
|
|
55
|
+
.action(init_js_1.initCommand);
|
|
56
|
+
// Add command - Add components or features to existing project
|
|
57
|
+
program
|
|
58
|
+
.command('add')
|
|
59
|
+
.description('Add a component or feature to your project')
|
|
60
|
+
.argument('<component>', 'Component to add (auth, users-table, chat-ui, billing, etc.)')
|
|
61
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
62
|
+
.action(add_js_1.addCommand);
|
|
63
|
+
// Remove command - Remove components from project
|
|
64
|
+
program
|
|
65
|
+
.command('remove')
|
|
66
|
+
.description('Remove a component from your project')
|
|
67
|
+
.argument('<component>', 'Component to remove')
|
|
68
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
69
|
+
.option('--keep-data', 'Keep database tables when removing', false)
|
|
70
|
+
.option('-y, --yes', 'Skip confirmation prompt', false)
|
|
71
|
+
.action(remove_js_1.removeCommand);
|
|
72
|
+
// List command - Show installed and available components
|
|
73
|
+
program
|
|
74
|
+
.command('list')
|
|
75
|
+
.description('Show installed and available components')
|
|
76
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
77
|
+
.option('--json', 'Output as JSON', false)
|
|
78
|
+
.option('--installed', 'Show only installed components', false)
|
|
79
|
+
.option('--available', 'Show only available (not installed) components', false)
|
|
80
|
+
.action(list_js_1.listCommand);
|
|
81
|
+
// Setup command - Configure integrations and services
|
|
82
|
+
program
|
|
83
|
+
.command('setup')
|
|
84
|
+
.description('Configure integrations (database, auth, models, stripe, etc.)')
|
|
85
|
+
.argument('<service>', 'Service to setup (database, auth, openai, anthropic, ollama, providers, stripe, permissions)')
|
|
86
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
87
|
+
.action((service, options) => (0, setup_js_1.setupCommand)(service, options));
|
|
88
|
+
// Use command - Switch between registered projects
|
|
89
|
+
program
|
|
90
|
+
.command('use')
|
|
91
|
+
.description('Set default project or view registered projects')
|
|
92
|
+
.argument('[project-name]', 'Project name to set as default')
|
|
93
|
+
.option('--list', 'Show all registered projects', false)
|
|
94
|
+
.action((projectName, options) => (0, use_js_1.useCommand)(projectName, options));
|
|
95
|
+
// Doctor command - Health check
|
|
96
|
+
program
|
|
97
|
+
.command('doctor')
|
|
98
|
+
.description('Run health checks on your ChimerAI project')
|
|
99
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
100
|
+
.option('--fix', 'Attempt to auto-fix issues', false)
|
|
101
|
+
.action(doctor_js_1.doctorCommand);
|
|
102
|
+
// Update command - Check for component updates
|
|
103
|
+
program
|
|
104
|
+
.command('update')
|
|
105
|
+
.description('Check installed components against latest templates')
|
|
106
|
+
.argument('[component]', 'Specific component to check (or all)')
|
|
107
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
108
|
+
.option('--dry-run', 'Preview changes without applying', false)
|
|
109
|
+
.option('--diff', 'Show file differences', false)
|
|
110
|
+
.option('--apply', 'Apply updates to modified files (creates backups)', false)
|
|
111
|
+
.action(update_js_1.updateCommand);
|
|
112
|
+
// Plugin command - Plugin management
|
|
113
|
+
program
|
|
114
|
+
.command('plugin')
|
|
115
|
+
.description('Manage plugins (create, list, scaffold)')
|
|
116
|
+
.argument('<action>', 'Action: create, list, scaffold')
|
|
117
|
+
.argument('[name]', 'Plugin name (for create)')
|
|
118
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
119
|
+
.option('-t, --template <template>', 'Plugin template: basic, api, ui', 'basic')
|
|
120
|
+
.action((action, name, opts) => {
|
|
121
|
+
if (action === 'create' && name) {
|
|
122
|
+
(0, utils_js_1.assertValidName)(name, 'Plugin name');
|
|
123
|
+
}
|
|
124
|
+
return (0, plugin_js_1.pluginCommand)(action, name, opts);
|
|
125
|
+
});
|
|
126
|
+
// Migrate command - Database migrations
|
|
127
|
+
program
|
|
128
|
+
.command('migrate')
|
|
129
|
+
.description('Run database migrations (wraps Prisma)')
|
|
130
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
131
|
+
.option('-n, --name <name>', 'Migration name', '')
|
|
132
|
+
.option('--seed', 'Run seed after migration', false)
|
|
133
|
+
.option('--reset', 'Reset database (destructive!)', false)
|
|
134
|
+
.option('--rollback', 'Roll back the last migration', false)
|
|
135
|
+
.option('--status', 'Show migration status', false)
|
|
136
|
+
.action(migrate_js_1.migrateCommand);
|
|
137
|
+
// Deploy command - Deployment preparation
|
|
138
|
+
program
|
|
139
|
+
.command('deploy')
|
|
140
|
+
.description('Generate deployment configuration')
|
|
141
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
142
|
+
.option('-t, --target <target>', 'Deploy target: vercel, docker, railway', 'docker')
|
|
143
|
+
.option('--check-only', 'Only run deployment checks, no config generation', false)
|
|
144
|
+
.action(deploy_js_1.deployCommand);
|
|
145
|
+
// Dev command - Start development environment
|
|
146
|
+
program
|
|
147
|
+
.command('dev')
|
|
148
|
+
.description('Start development environment with Docker, migrations, and dev server')
|
|
149
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
150
|
+
.option('--skip-docker', 'Skip Docker Compose startup', false)
|
|
151
|
+
.option('--skip-migrate', 'Skip database migrations', false)
|
|
152
|
+
.option('-p, --port <port>', 'Development server port', '3000')
|
|
153
|
+
.action((opts) => (0, dev_js_1.devCommand)(opts));
|
|
154
|
+
// Generate command - Code scaffolding
|
|
155
|
+
program
|
|
156
|
+
.command('generate <type> <name>')
|
|
157
|
+
.description('Generate code scaffolding (model, api, page, component, hook)')
|
|
158
|
+
.option('-d, --dir <directory>', 'Target directory', '.')
|
|
159
|
+
.option('--force', 'Overwrite existing files', false)
|
|
160
|
+
.action((type, name, opts) => {
|
|
161
|
+
const validTypes = ['model', 'api', 'page', 'component', 'hook'];
|
|
162
|
+
if (!validTypes.includes(type)) {
|
|
163
|
+
(0, utils_js_1.handleCliError)(`Invalid generator type: ${type}. Valid types: ${validTypes.join(', ')}`);
|
|
164
|
+
}
|
|
165
|
+
return (0, generate_js_1.generateCommand)(type, name, opts);
|
|
166
|
+
});
|
|
167
|
+
// Secret command - Generate cryptographic secrets
|
|
168
|
+
program
|
|
169
|
+
.command('secret')
|
|
170
|
+
.description('Generate cryptographic secrets (nextauth, encryption, token)')
|
|
171
|
+
.argument('[type]', 'Secret type: nextauth, encryption, token, all', 'all')
|
|
172
|
+
.option('-l, --length <bytes>', 'Key length in bytes (default: 32)')
|
|
173
|
+
.option('-u, --update', 'Write secret directly into .env file', false)
|
|
174
|
+
.option('-d, --dir <directory>', 'Project directory for --update', '.')
|
|
175
|
+
.action((type, opts) => (0, secret_js_1.secretCommand)(type, opts));
|
|
176
|
+
// Example commands for reference
|
|
177
|
+
program
|
|
178
|
+
.command('examples')
|
|
179
|
+
.description('Show usage examples')
|
|
180
|
+
.action(() => {
|
|
181
|
+
console.log(chalk_1.default.bold('\nš ChimerAI CLI Examples:\n'));
|
|
182
|
+
console.log(chalk_1.default.bold.yellow('Project Creation:'));
|
|
183
|
+
console.log(chalk_1.default.cyan(' # Create new project (interactive)'));
|
|
184
|
+
console.log(' chimerai create my-ai-app');
|
|
185
|
+
console.log(chalk_1.default.cyan(' # Create with defaults'));
|
|
186
|
+
console.log(' chimerai create my-ai-app --yes --install\n');
|
|
187
|
+
console.log(chalk_1.default.bold.yellow('Component Management:'));
|
|
188
|
+
console.log(chalk_1.default.cyan(' # List all components'));
|
|
189
|
+
console.log(' chimerai list');
|
|
190
|
+
console.log(chalk_1.default.cyan(' # Add components'));
|
|
191
|
+
console.log(' chimerai add auth');
|
|
192
|
+
console.log(' chimerai add chat-ui');
|
|
193
|
+
console.log(' chimerai add billing');
|
|
194
|
+
console.log(chalk_1.default.cyan(' # Remove a component'));
|
|
195
|
+
console.log(' chimerai remove billing');
|
|
196
|
+
console.log(chalk_1.default.cyan(' # Check for updates'));
|
|
197
|
+
console.log(' chimerai update --diff\n');
|
|
198
|
+
console.log(chalk_1.default.bold.yellow('Configuration:'));
|
|
199
|
+
console.log(chalk_1.default.cyan(' # Configure services'));
|
|
200
|
+
console.log(' chimerai setup database');
|
|
201
|
+
console.log(' chimerai setup providers');
|
|
202
|
+
console.log(' chimerai setup stripe\n');
|
|
203
|
+
console.log(chalk_1.default.bold.yellow('Database:'));
|
|
204
|
+
console.log(chalk_1.default.cyan(' # Run migrations'));
|
|
205
|
+
console.log(' chimerai migrate --name add-users');
|
|
206
|
+
console.log(chalk_1.default.cyan(' # Migration status'));
|
|
207
|
+
console.log(' chimerai migrate --status');
|
|
208
|
+
console.log(chalk_1.default.cyan(' # Reset database'));
|
|
209
|
+
console.log(' chimerai migrate --reset --seed\n');
|
|
210
|
+
console.log(chalk_1.default.bold.yellow('Plugins:'));
|
|
211
|
+
console.log(chalk_1.default.cyan(' # Create a plugin'));
|
|
212
|
+
console.log(' chimerai plugin create my-filter --template api');
|
|
213
|
+
console.log(chalk_1.default.cyan(' # List plugins'));
|
|
214
|
+
console.log(' chimerai plugin list');
|
|
215
|
+
console.log(chalk_1.default.cyan(' # Setup plugin system'));
|
|
216
|
+
console.log(' chimerai plugin scaffold\n');
|
|
217
|
+
console.log(chalk_1.default.bold.yellow('Deployment:'));
|
|
218
|
+
console.log(chalk_1.default.cyan(' # Check deployment readiness'));
|
|
219
|
+
console.log(' chimerai deploy --check-only');
|
|
220
|
+
console.log(chalk_1.default.cyan(' # Generate Docker config'));
|
|
221
|
+
console.log(' chimerai deploy --target docker');
|
|
222
|
+
console.log(chalk_1.default.cyan(' # Generate Vercel config'));
|
|
223
|
+
console.log(' chimerai deploy --target vercel\n');
|
|
224
|
+
console.log(chalk_1.default.bold.yellow('Health Check:'));
|
|
225
|
+
console.log(chalk_1.default.cyan(' # Run diagnostics'));
|
|
226
|
+
console.log(' chimerai doctor');
|
|
227
|
+
console.log(chalk_1.default.cyan(' # Auto-fix issues'));
|
|
228
|
+
console.log(' chimerai doctor --fix\n');
|
|
229
|
+
console.log(chalk_1.default.bold.yellow('Development:'));
|
|
230
|
+
console.log(chalk_1.default.cyan(' # Start dev environment (Docker + migrations + dev server)'));
|
|
231
|
+
console.log(' chimerai dev');
|
|
232
|
+
console.log(chalk_1.default.cyan(' # Skip Docker startup'));
|
|
233
|
+
console.log(' chimerai dev --skip-docker');
|
|
234
|
+
console.log(chalk_1.default.cyan(' # Custom port'));
|
|
235
|
+
console.log(' chimerai dev --port 3001\n');
|
|
236
|
+
console.log(chalk_1.default.bold.yellow('Code Generation:'));
|
|
237
|
+
console.log(chalk_1.default.cyan(' # Generate Prisma model'));
|
|
238
|
+
console.log(' chimerai generate model user');
|
|
239
|
+
console.log(chalk_1.default.cyan(' # Generate API route with CRUD'));
|
|
240
|
+
console.log(' chimerai generate api posts');
|
|
241
|
+
console.log(chalk_1.default.cyan(' # Generate Next.js page'));
|
|
242
|
+
console.log(' chimerai generate page dashboard');
|
|
243
|
+
console.log(chalk_1.default.cyan(' # Generate React component'));
|
|
244
|
+
console.log(' chimerai generate component user-card');
|
|
245
|
+
console.log(chalk_1.default.cyan(' # Generate custom hook'));
|
|
246
|
+
console.log(' chimerai generate hook use-auth\n');
|
|
247
|
+
console.log(chalk_1.default.bold.yellow('License:'));
|
|
248
|
+
console.log(chalk_1.default.cyan(' # Activate Enterprise license key'));
|
|
249
|
+
console.log(' chimerai activate <LICENSE-KEY>');
|
|
250
|
+
console.log(chalk_1.default.cyan(' # Show current license status'));
|
|
251
|
+
console.log(' chimerai license\n');
|
|
252
|
+
console.log(chalk_1.default.bold.yellow('Project Management:'));
|
|
253
|
+
console.log(chalk_1.default.cyan(' # List registered projects'));
|
|
254
|
+
console.log(' chimerai use --list');
|
|
255
|
+
console.log(chalk_1.default.cyan(' # Set default project'));
|
|
256
|
+
console.log(' chimerai use my-saas-app');
|
|
257
|
+
console.log(chalk_1.default.cyan(' # Run command on a specific project'));
|
|
258
|
+
console.log(' chimerai doctor --dir /path/to/project\n');
|
|
259
|
+
});
|
|
260
|
+
// Activate command - activate a Pro license key
|
|
261
|
+
program
|
|
262
|
+
.command('activate')
|
|
263
|
+
.description('Activate a ChimerAI Pro license key')
|
|
264
|
+
.argument('<key>', 'License key from chimerai.dev/pro')
|
|
265
|
+
.action(async (key) => {
|
|
266
|
+
const chalk2 = (await import('chalk')).default;
|
|
267
|
+
console.log(chalk2.bold.cyan('\nš ChimerAI License Activation\n'));
|
|
268
|
+
if (!key || key.length < 8) {
|
|
269
|
+
console.log(chalk2.red(' ā Invalid license key.'));
|
|
270
|
+
console.log(chalk2.gray(' Enterprise: https://chimerai.dev/enterprise'));
|
|
271
|
+
console.log(chalk2.gray(' Enterprise Pro: https://chimerai.dev/enterprise-pro\n'));
|
|
272
|
+
process.exit(1);
|
|
273
|
+
}
|
|
274
|
+
console.log(chalk2.gray(' Validating license key...\n'));
|
|
275
|
+
const result = await (0, license_js_1.activateLicenseOnline)(key);
|
|
276
|
+
if ('error' in result) {
|
|
277
|
+
console.log(chalk2.red(` ā Activation failed: ${result.error}\n`));
|
|
278
|
+
process.exit(1);
|
|
279
|
+
}
|
|
280
|
+
const { edition, email, token } = result;
|
|
281
|
+
const license = {
|
|
282
|
+
key,
|
|
283
|
+
token,
|
|
284
|
+
edition,
|
|
285
|
+
email,
|
|
286
|
+
activatedAt: new Date().toISOString(),
|
|
287
|
+
lastChecked: new Date().toISOString(),
|
|
288
|
+
};
|
|
289
|
+
(0, license_js_1.writeLicense)(license);
|
|
290
|
+
const label = edition === 'enterprise-pro' ? 'Enterprise Pro' : 'Enterprise';
|
|
291
|
+
console.log(chalk2.bold.green(` ā
${label} license activated successfully!\n`));
|
|
292
|
+
if (email)
|
|
293
|
+
console.log(chalk2.gray(` Licensed to: ${email}`));
|
|
294
|
+
if (edition === 'enterprise-pro') {
|
|
295
|
+
console.log(chalk2.gray(' All Enterprise + Enterprise Pro components are now available.'));
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
console.log(chalk2.gray(' All Enterprise components are now available.'));
|
|
299
|
+
console.log(chalk2.gray(' Enterprise Pro: https://chimerai.dev/enterprise-pro'));
|
|
300
|
+
}
|
|
301
|
+
console.log(chalk2.white('\n chimerai list ā show unlocked components'));
|
|
302
|
+
console.log(chalk2.white(' chimerai add auth ā install a component\n'));
|
|
303
|
+
});
|
|
304
|
+
// License status command
|
|
305
|
+
program
|
|
306
|
+
.command('license')
|
|
307
|
+
.description('Show current license status')
|
|
308
|
+
.option('--deactivate', 'Remove the current license')
|
|
309
|
+
.action((opts) => {
|
|
310
|
+
if (opts.deactivate) {
|
|
311
|
+
(0, license_js_1.clearLicense)();
|
|
312
|
+
console.log(chalk_1.default.yellow('\n License removed. Edition: Free\n'));
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
(0, license_js_1.printLicenseStatus)();
|
|
316
|
+
});
|
|
317
|
+
program.parse();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add Command - Add components to existing project
|
|
3
|
+
* REFACTORED: Uses inline template generators instead of fs.copy() (PHASE 4)
|
|
4
|
+
* Extended with modular AI-Service support (ai-chat, rag, guardrails, ai-tools)
|
|
5
|
+
*/
|
|
6
|
+
interface AddOptions {
|
|
7
|
+
dir: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function addCommand(component: string, options: AddOptions): Promise<void>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AAmzED,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,iBAyHtE"}
|