codebakers 2.2.2 → 2.3.4
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/dist/index.d.ts +3 -0
- package/dist/index.js +441 -366
- package/installers/CodeBakers-Install.bat +207 -0
- package/installers/CodeBakers-Install.command +232 -0
- package/installers/README.md +157 -0
- package/installers/mac/assets/README.txt +31 -0
- package/installers/mac/build-mac-installer.sh +240 -0
- package/installers/windows/CodeBakers.iss +256 -0
- package/installers/windows/assets/README.txt +16 -0
- package/installers/windows/scripts/post-install.bat +15 -0
- package/package.json +1 -1
- package/src/commands/setup.ts +306 -172
- package/src/index.ts +295 -198
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import * as p from '@clack/prompts';
|
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import boxen from 'boxen';
|
|
7
7
|
import gradient from 'gradient-string';
|
|
8
|
+
import * as path from 'path';
|
|
8
9
|
import { Config } from './utils/config.js';
|
|
9
10
|
import { checkForUpdates } from './utils/updates.js';
|
|
10
11
|
import { setupCommand } from './commands/setup.js';
|
|
@@ -27,9 +28,9 @@ import { prdMakerCommand } from './commands/prd-maker.js';
|
|
|
27
28
|
import { buildCommand } from './commands/build.js';
|
|
28
29
|
import { integrateCommand, INTEGRATIONS } from './commands/integrate.js';
|
|
29
30
|
import { websiteCommand } from './commands/website.js';
|
|
30
|
-
import { parseNaturalLanguage
|
|
31
|
+
import { parseNaturalLanguage } from './utils/nlp.js';
|
|
31
32
|
|
|
32
|
-
const VERSION = '2.
|
|
33
|
+
const VERSION = '2.3.4';
|
|
33
34
|
|
|
34
35
|
// ASCII art logo
|
|
35
36
|
const logo = `
|
|
@@ -41,115 +42,195 @@ const logo = `
|
|
|
41
42
|
╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚══════╝
|
|
42
43
|
`;
|
|
43
44
|
|
|
44
|
-
//
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// MAIN MENU
|
|
47
|
+
// ============================================================================
|
|
48
|
+
|
|
45
49
|
async function showMainMenu(): Promise<void> {
|
|
46
50
|
const config = new Config();
|
|
47
|
-
const isSetup = config.isConfigured();
|
|
48
51
|
|
|
49
52
|
// Show logo
|
|
50
53
|
console.log(gradient.pastel.multiline(logo));
|
|
51
54
|
console.log(chalk.dim(` v${VERSION} — AI dev team that follows the rules\n`));
|
|
52
55
|
|
|
53
|
-
//
|
|
54
|
-
|
|
56
|
+
// Check setup status
|
|
57
|
+
const hasAnthropic = !!config.getCredentials('anthropic')?.apiKey;
|
|
58
|
+
|
|
59
|
+
// STEP 1: First time? Run setup
|
|
60
|
+
if (!hasAnthropic) {
|
|
55
61
|
console.log(boxen(
|
|
56
|
-
chalk.yellow('Welcome to CodeBakers
|
|
62
|
+
chalk.yellow('Welcome to CodeBakers!\n\n') +
|
|
63
|
+
chalk.white('Let\'s connect your Anthropic API key so the AI can work.\n') +
|
|
64
|
+
chalk.dim('(Takes about 1 minute)'),
|
|
57
65
|
{ padding: 1, borderColor: 'yellow', borderStyle: 'round' }
|
|
58
66
|
));
|
|
67
|
+
|
|
59
68
|
await setupCommand();
|
|
69
|
+
|
|
70
|
+
// After setup, show next steps
|
|
71
|
+
showPostSetupInstructions();
|
|
60
72
|
return;
|
|
61
73
|
}
|
|
62
74
|
|
|
63
|
-
//
|
|
75
|
+
// STEP 2: Detect context
|
|
64
76
|
const inProject = config.isInProject();
|
|
77
|
+
const projectConfig = config.getProjectConfig();
|
|
78
|
+
const cwd = process.cwd();
|
|
79
|
+
const folderName = path.basename(cwd);
|
|
80
|
+
|
|
81
|
+
// Show context
|
|
82
|
+
if (inProject && projectConfig) {
|
|
83
|
+
const framework = projectConfig.framework || 'detected';
|
|
84
|
+
console.log(chalk.cyan(` 📁 Working in: ${chalk.bold(folderName)}`));
|
|
85
|
+
console.log(chalk.dim(` ${framework} project\n`));
|
|
86
|
+
|
|
87
|
+
// SHOW PROJECT MENU
|
|
88
|
+
await showProjectMenu(config);
|
|
89
|
+
} else {
|
|
90
|
+
console.log(chalk.cyan(` 📁 Current folder: ${chalk.bold(cwd)}`));
|
|
91
|
+
console.log(chalk.dim(` Not a project folder\n`));
|
|
92
|
+
|
|
93
|
+
// SHOW START MENU
|
|
94
|
+
await showStartMenu(config);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
65
97
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
98
|
+
// ============================================================================
|
|
99
|
+
// START MENU (Not in a project)
|
|
100
|
+
// ============================================================================
|
|
101
|
+
|
|
102
|
+
async function showStartMenu(config: Config): Promise<void> {
|
|
103
|
+
while (true) {
|
|
104
|
+
const action = await p.select({
|
|
105
|
+
message: 'What would you like to do?',
|
|
106
|
+
options: [
|
|
107
|
+
{ value: 'website', label: '🌐 Build a website', hint: 'Describe it → AI builds it' },
|
|
108
|
+
{ value: 'new', label: '🆕 Create new project', hint: 'Start fresh with Next.js, React, etc.' },
|
|
109
|
+
{ value: 'prd-maker', label: '✏️ Create a PRD', hint: 'Plan your project first' },
|
|
110
|
+
{ value: 'build', label: '🏗️ Build from PRD', hint: 'Have a PRD file? Build it now' },
|
|
111
|
+
{ value: 'advisors', label: '🌟 Consult advisors', hint: 'Get advice from AI experts' },
|
|
112
|
+
{ value: 'divider1', label: chalk.dim('─────────────────────────────') },
|
|
113
|
+
{ value: 'integrate', label: '🔌 Add integration', hint: 'Stripe, Supabase, Twilio, etc.' },
|
|
114
|
+
{ value: 'settings', label: '⚙️ Settings', hint: 'API keys & preferences' },
|
|
115
|
+
{ value: 'help', label: '❓ Help', hint: 'Learn how to use CodeBakers' },
|
|
116
|
+
{ value: 'divider2', label: chalk.dim('─────────────────────────────') },
|
|
117
|
+
{ value: 'exit', label: '🚪 Return to terminal', hint: 'Exit CodeBakers' },
|
|
118
|
+
],
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// User pressed Ctrl+C or selected exit
|
|
122
|
+
if (p.isCancel(action) || action === 'exit') {
|
|
123
|
+
console.log('');
|
|
124
|
+
console.log(chalk.cyan(' ─────────────────────────────────────────────────'));
|
|
125
|
+
console.log(chalk.white(' You\'re back in the terminal.'));
|
|
126
|
+
console.log('');
|
|
127
|
+
console.log(chalk.dim(' To start CodeBakers again, type:'));
|
|
128
|
+
console.log(chalk.green(' codebakers'));
|
|
129
|
+
console.log('');
|
|
130
|
+
console.log(chalk.dim(' Quick commands you can run directly:'));
|
|
131
|
+
console.log(chalk.dim(' codebakers website') + chalk.gray(' - Build a website'));
|
|
132
|
+
console.log(chalk.dim(' codebakers code') + chalk.gray(' - Code with AI'));
|
|
133
|
+
console.log(chalk.dim(' codebakers help') + chalk.gray(' - See all commands'));
|
|
134
|
+
console.log(chalk.cyan(' ─────────────────────────────────────────────────'));
|
|
135
|
+
console.log('');
|
|
136
|
+
process.exit(0);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Handle dividers - just continue the loop
|
|
140
|
+
if (action === 'divider1' || action === 'divider2') {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Handle the selected action
|
|
145
|
+
await handleAction(action as string, config);
|
|
146
|
+
|
|
147
|
+
// After action completes, loop back to show menu again
|
|
86
148
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// ============================================================================
|
|
152
|
+
// PROJECT MENU (In a project)
|
|
153
|
+
// ============================================================================
|
|
154
|
+
|
|
155
|
+
async function showProjectMenu(config: Config): Promise<void> {
|
|
156
|
+
while (true) {
|
|
157
|
+
const action = await p.select({
|
|
158
|
+
message: 'What would you like to do?',
|
|
159
|
+
options: [
|
|
160
|
+
{ value: 'code', label: '💬 Code with AI', hint: 'Ask AI to build features or fix bugs' },
|
|
161
|
+
{ value: 'deploy', label: '🚀 Deploy', hint: 'Push your project live' },
|
|
162
|
+
{ value: 'check', label: '🔍 Check code', hint: 'Review quality & patterns' },
|
|
163
|
+
{ value: 'fix', label: '🔧 Fix errors', hint: 'AI automatically fixes issues' },
|
|
164
|
+
{ value: 'integrate', label: '🔌 Add integration', hint: 'Stripe, Supabase, Twilio, etc.' },
|
|
165
|
+
{ value: 'generate', label: '⚡ Generate', hint: 'Create components, pages, APIs' },
|
|
166
|
+
{ value: 'divider1', label: chalk.dim('─────────────────────────────') },
|
|
167
|
+
{ value: 'new', label: '🆕 Start new project', hint: 'Create a different project' },
|
|
168
|
+
{ value: 'settings', label: '⚙️ Settings', hint: 'API keys & preferences' },
|
|
169
|
+
{ value: 'help', label: '❓ Help', hint: 'Learn how to use CodeBakers' },
|
|
170
|
+
{ value: 'divider2', label: chalk.dim('─────────────────────────────') },
|
|
171
|
+
{ value: 'exit', label: '🚪 Return to terminal', hint: 'Exit CodeBakers' },
|
|
172
|
+
],
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// User pressed Ctrl+C or selected exit
|
|
176
|
+
if (p.isCancel(action) || action === 'exit') {
|
|
177
|
+
console.log('');
|
|
178
|
+
console.log(chalk.cyan(' ─────────────────────────────────────────────────'));
|
|
179
|
+
console.log(chalk.white(' You\'re back in the terminal.'));
|
|
180
|
+
console.log('');
|
|
181
|
+
console.log(chalk.dim(' To start CodeBakers again, type:'));
|
|
182
|
+
console.log(chalk.green(' codebakers'));
|
|
183
|
+
console.log('');
|
|
184
|
+
console.log(chalk.dim(' Quick commands you can run directly:'));
|
|
185
|
+
console.log(chalk.dim(' codebakers code') + chalk.gray(' - Code with AI'));
|
|
186
|
+
console.log(chalk.dim(' codebakers deploy') + chalk.gray(' - Deploy your project'));
|
|
187
|
+
console.log(chalk.dim(' codebakers help') + chalk.gray(' - See all commands'));
|
|
188
|
+
console.log(chalk.cyan(' ─────────────────────────────────────────────────'));
|
|
189
|
+
console.log('');
|
|
190
|
+
process.exit(0);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Handle dividers - just continue the loop
|
|
194
|
+
if (action === 'divider1' || action === 'divider2') {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Handle the selected action
|
|
199
|
+
await handleAction(action as string, config);
|
|
200
|
+
|
|
201
|
+
// After action completes, loop back to show menu again
|
|
105
202
|
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// ============================================================================
|
|
206
|
+
// ACTION HANDLER
|
|
207
|
+
// ============================================================================
|
|
106
208
|
|
|
107
|
-
|
|
209
|
+
async function handleAction(action: string, config: Config): Promise<void> {
|
|
108
210
|
switch (action) {
|
|
211
|
+
case 'website':
|
|
212
|
+
await websiteCommand();
|
|
213
|
+
break;
|
|
214
|
+
case 'new':
|
|
215
|
+
await initCommand();
|
|
216
|
+
break;
|
|
109
217
|
case 'code':
|
|
110
218
|
await codeCommand();
|
|
111
219
|
break;
|
|
112
|
-
case 'integrate':
|
|
113
|
-
await integrateCommand();
|
|
114
|
-
break;
|
|
115
220
|
case 'check':
|
|
116
221
|
await checkCommand();
|
|
117
222
|
break;
|
|
118
223
|
case 'deploy':
|
|
119
224
|
await deployCommand();
|
|
120
225
|
break;
|
|
121
|
-
case 'migrate':
|
|
122
|
-
await migrateCommand();
|
|
123
|
-
break;
|
|
124
226
|
case 'fix':
|
|
125
227
|
await fixCommand();
|
|
126
228
|
break;
|
|
127
229
|
case 'generate':
|
|
128
230
|
await generateCommand();
|
|
129
231
|
break;
|
|
130
|
-
case '
|
|
131
|
-
await
|
|
132
|
-
break;
|
|
133
|
-
case 'connect':
|
|
134
|
-
await connectCommand();
|
|
135
|
-
break;
|
|
136
|
-
case 'gateway':
|
|
137
|
-
await gatewayCommand();
|
|
138
|
-
break;
|
|
139
|
-
case 'learn':
|
|
140
|
-
await learnCommand();
|
|
141
|
-
break;
|
|
142
|
-
case 'security':
|
|
143
|
-
await securityCommand();
|
|
144
|
-
break;
|
|
145
|
-
case 'design':
|
|
146
|
-
await designCommand();
|
|
147
|
-
break;
|
|
148
|
-
case 'new':
|
|
149
|
-
await initCommand();
|
|
150
|
-
break;
|
|
151
|
-
case 'website':
|
|
152
|
-
await websiteCommand();
|
|
232
|
+
case 'integrate':
|
|
233
|
+
await integrateCommand();
|
|
153
234
|
break;
|
|
154
235
|
case 'build':
|
|
155
236
|
await buildCommand();
|
|
@@ -163,6 +244,12 @@ async function showMainMenu(): Promise<void> {
|
|
|
163
244
|
case 'advisors':
|
|
164
245
|
await advisorsCommand();
|
|
165
246
|
break;
|
|
247
|
+
case 'gateway':
|
|
248
|
+
await gatewayCommand();
|
|
249
|
+
break;
|
|
250
|
+
case 'migrate':
|
|
251
|
+
await migrateCommand();
|
|
252
|
+
break;
|
|
166
253
|
case 'settings':
|
|
167
254
|
await setupCommand();
|
|
168
255
|
break;
|
|
@@ -170,45 +257,89 @@ async function showMainMenu(): Promise<void> {
|
|
|
170
257
|
showHelp();
|
|
171
258
|
break;
|
|
172
259
|
default:
|
|
173
|
-
|
|
174
|
-
await showMainMenu();
|
|
260
|
+
console.log(chalk.yellow('Coming soon!'));
|
|
175
261
|
}
|
|
176
262
|
}
|
|
177
263
|
|
|
264
|
+
// ============================================================================
|
|
265
|
+
// POST-SETUP INSTRUCTIONS
|
|
266
|
+
// ============================================================================
|
|
267
|
+
|
|
268
|
+
function showPostSetupInstructions(): void {
|
|
269
|
+
console.log(boxen(
|
|
270
|
+
chalk.green.bold('✓ Setup complete!\n\n') +
|
|
271
|
+
chalk.white('What\'s next?\n\n') +
|
|
272
|
+
chalk.cyan('1. ') + 'Navigate to where you want to build:\n' +
|
|
273
|
+
chalk.dim(' cd C:\\dev\\my-project\n\n') +
|
|
274
|
+
chalk.cyan('2. ') + 'Run CodeBakers:\n' +
|
|
275
|
+
chalk.dim(' codebakers\n\n') +
|
|
276
|
+
chalk.white('Or build a website right now:\n') +
|
|
277
|
+
chalk.dim(' codebakers website'),
|
|
278
|
+
{ padding: 1, borderColor: 'green', borderStyle: 'round' }
|
|
279
|
+
));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// ============================================================================
|
|
283
|
+
// POST-BUILD INSTRUCTIONS (exported for other commands to use)
|
|
284
|
+
// ============================================================================
|
|
285
|
+
|
|
286
|
+
export function showPostBuildInstructions(projectName: string, projectPath?: string): void {
|
|
287
|
+
const displayPath = projectPath || projectName;
|
|
288
|
+
|
|
289
|
+
console.log(boxen(
|
|
290
|
+
chalk.green.bold(`✓ ${projectName} created!\n\n`) +
|
|
291
|
+
chalk.white('Next steps:\n\n') +
|
|
292
|
+
chalk.cyan('1. ') + 'Go to your project:\n' +
|
|
293
|
+
chalk.dim(` cd ${displayPath}\n\n`) +
|
|
294
|
+
chalk.cyan('2. ') + 'Install dependencies:\n' +
|
|
295
|
+
chalk.dim(' npm install\n\n') +
|
|
296
|
+
chalk.cyan('3. ') + 'Start the dev server:\n' +
|
|
297
|
+
chalk.dim(' npm run dev\n\n') +
|
|
298
|
+
chalk.cyan('4. ') + 'Open in browser:\n' +
|
|
299
|
+
chalk.dim(' http://localhost:3000\n\n') +
|
|
300
|
+
chalk.white('Ready to deploy?\n') +
|
|
301
|
+
chalk.dim(' codebakers deploy'),
|
|
302
|
+
{ padding: 1, borderColor: 'green', borderStyle: 'round' }
|
|
303
|
+
));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// ============================================================================
|
|
307
|
+
// HELP
|
|
308
|
+
// ============================================================================
|
|
309
|
+
|
|
178
310
|
function showHelp(): void {
|
|
179
311
|
console.log(boxen(`
|
|
180
312
|
${chalk.bold('CodeBakers CLI v' + VERSION)} — AI dev team that follows the rules
|
|
181
313
|
|
|
182
314
|
${chalk.bold.cyan('Getting Started:')}
|
|
183
|
-
${chalk.cyan('codebakers
|
|
184
|
-
${chalk.cyan('codebakers
|
|
185
|
-
${chalk.cyan('codebakers website')} Build
|
|
186
|
-
${chalk.cyan('codebakers
|
|
315
|
+
${chalk.cyan('codebakers')} Interactive menu
|
|
316
|
+
${chalk.cyan('codebakers setup')} Connect API keys
|
|
317
|
+
${chalk.cyan('codebakers website')} Build website by describing it
|
|
318
|
+
${chalk.cyan('codebakers init')} Create new project
|
|
187
319
|
|
|
188
|
-
${chalk.bold.cyan('
|
|
320
|
+
${chalk.bold.cyan('In a Project:')}
|
|
189
321
|
${chalk.cyan('codebakers code')} Chat with AI to build features
|
|
190
|
-
${chalk.cyan('codebakers check')} Check code quality & patterns
|
|
191
|
-
${chalk.cyan('codebakers fix')} Auto-fix errors with AI
|
|
192
322
|
${chalk.cyan('codebakers deploy')} Deploy to Vercel
|
|
193
|
-
|
|
194
|
-
${chalk.
|
|
195
|
-
${chalk.cyan('codebakers integrate')} 50+ one-click integrations (Stripe, Supabase, etc.)
|
|
196
|
-
${chalk.cyan('codebakers gateway')} Connect WhatsApp, Telegram, Discord, etc.
|
|
323
|
+
${chalk.cyan('codebakers check')} Check code quality
|
|
324
|
+
${chalk.cyan('codebakers fix')} Auto-fix errors
|
|
197
325
|
|
|
198
326
|
${chalk.bold.cyan('Planning:')}
|
|
199
|
-
${chalk.cyan('codebakers prd-maker')} Create PRD through interview
|
|
200
|
-
${chalk.cyan('codebakers
|
|
327
|
+
${chalk.cyan('codebakers prd-maker')} Create PRD through interview
|
|
328
|
+
${chalk.cyan('codebakers build')} Build from PRD (parallel agents)
|
|
329
|
+
${chalk.cyan('codebakers advisors')} Consult AI experts
|
|
201
330
|
|
|
202
|
-
${chalk.bold.cyan('
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
• Clipboard: Type ${chalk.yellow('"clip"')} to paste from clipboard
|
|
331
|
+
${chalk.bold.cyan('Integrations:')}
|
|
332
|
+
${chalk.cyan('codebakers integrate')} 50+ one-click integrations
|
|
333
|
+
${chalk.cyan('codebakers gateway')} WhatsApp, Telegram, Discord
|
|
206
334
|
|
|
207
335
|
${chalk.bold('Docs:')} ${chalk.dim('https://codebakers.dev/docs')}
|
|
208
336
|
`, { padding: 1, borderColor: 'cyan', borderStyle: 'round' }));
|
|
209
337
|
}
|
|
210
338
|
|
|
211
|
-
//
|
|
339
|
+
// ============================================================================
|
|
340
|
+
// CLI COMMANDS (Commander)
|
|
341
|
+
// ============================================================================
|
|
342
|
+
|
|
212
343
|
const program = new Command();
|
|
213
344
|
|
|
214
345
|
program
|
|
@@ -219,225 +350,191 @@ program
|
|
|
219
350
|
|
|
220
351
|
program
|
|
221
352
|
.command('setup')
|
|
222
|
-
.description('Configure CodeBakers (
|
|
353
|
+
.description('Configure CodeBakers (API keys)')
|
|
223
354
|
.action(setupCommand);
|
|
224
355
|
|
|
225
356
|
program
|
|
226
357
|
.command('init')
|
|
227
358
|
.description('Create a new project')
|
|
228
|
-
.option('-n, --name <
|
|
229
|
-
.option('-t, --template <
|
|
230
|
-
.option('--no-git', 'Skip GitHub repo creation')
|
|
231
|
-
.option('--no-vercel', 'Skip Vercel deployment')
|
|
232
|
-
.option('--no-supabase', 'Skip Supabase setup')
|
|
359
|
+
.option('-n, --name <n>', 'Project name')
|
|
360
|
+
.option('-t, --template <t>', 'Template')
|
|
233
361
|
.action(initCommand);
|
|
234
362
|
|
|
235
363
|
program
|
|
236
364
|
.command('code [prompt]')
|
|
237
365
|
.description('Start AI coding session')
|
|
238
|
-
.option('-w, --watch', 'Watch mode
|
|
366
|
+
.option('-w, --watch', 'Watch mode')
|
|
239
367
|
.action(codeCommand);
|
|
240
368
|
|
|
241
369
|
program
|
|
242
370
|
.command('check')
|
|
243
|
-
.description('Run
|
|
244
|
-
.option('-f, --fix', 'Auto-fix violations')
|
|
245
|
-
.option('--watch', 'Watch mode')
|
|
371
|
+
.description('Run code quality checks')
|
|
246
372
|
.action(checkCommand);
|
|
247
373
|
|
|
248
374
|
program
|
|
249
375
|
.command('deploy')
|
|
250
376
|
.description('Deploy to production')
|
|
251
|
-
.option('-p, --preview', '
|
|
252
|
-
.option('--no-check', 'Skip
|
|
377
|
+
.option('-p, --preview', 'Preview deployment')
|
|
378
|
+
.option('--no-check', 'Skip quality check')
|
|
253
379
|
.action(deployCommand);
|
|
254
380
|
|
|
255
381
|
program
|
|
256
382
|
.command('fix')
|
|
257
|
-
.description('Auto-fix
|
|
258
|
-
.option('--auto', 'Fix without asking')
|
|
383
|
+
.description('Auto-fix errors with AI')
|
|
259
384
|
.action(fixCommand);
|
|
260
385
|
|
|
261
386
|
program
|
|
262
|
-
.command('generate
|
|
263
|
-
.alias('
|
|
264
|
-
.description('Generate components, pages,
|
|
265
|
-
.option('-n, --name <name>', 'Name of the generated item')
|
|
387
|
+
.command('generate')
|
|
388
|
+
.alias('gen')
|
|
389
|
+
.description('Generate components, pages, etc.')
|
|
266
390
|
.action(generateCommand);
|
|
267
391
|
|
|
268
392
|
program
|
|
269
|
-
.command('
|
|
270
|
-
.description('
|
|
393
|
+
.command('status')
|
|
394
|
+
.description('View project status')
|
|
395
|
+
.action(statusCommand);
|
|
396
|
+
|
|
397
|
+
program
|
|
398
|
+
.command('connect')
|
|
399
|
+
.description('Connect external services')
|
|
271
400
|
.action(connectCommand);
|
|
272
401
|
|
|
273
402
|
program
|
|
274
403
|
.command('gateway')
|
|
275
|
-
.description('Manage messaging
|
|
276
|
-
.option('--start', 'Start
|
|
277
|
-
.option('--stop', 'Stop
|
|
278
|
-
.option('--status', 'Show
|
|
404
|
+
.description('Manage messaging channels (WhatsApp, Telegram, etc.)')
|
|
405
|
+
.option('--start', 'Start gateway')
|
|
406
|
+
.option('--stop', 'Stop gateway')
|
|
407
|
+
.option('--status', 'Show status')
|
|
279
408
|
.action(gatewayCommand);
|
|
280
409
|
|
|
281
|
-
program
|
|
282
|
-
.command('status')
|
|
283
|
-
.description('View project status and health')
|
|
284
|
-
.option('-a, --all', 'Show all projects')
|
|
285
|
-
.action(statusCommand);
|
|
286
|
-
|
|
287
410
|
program
|
|
288
411
|
.command('security')
|
|
289
412
|
.description('Run security audit')
|
|
290
|
-
.option('--fix', 'Auto-fix security issues')
|
|
291
413
|
.action(securityCommand);
|
|
292
414
|
|
|
293
415
|
program
|
|
294
416
|
.command('learn')
|
|
295
|
-
.description('View
|
|
296
|
-
.option('--forget <item>', 'Forget a learned preference')
|
|
297
|
-
.option('--reset', 'Reset all learning')
|
|
298
|
-
.option('--export', 'Export learned patterns')
|
|
417
|
+
.description('View/manage what CodeBakers has learned')
|
|
299
418
|
.action(learnCommand);
|
|
300
419
|
|
|
301
420
|
program
|
|
302
|
-
.command('design
|
|
303
|
-
.description('Manage design system
|
|
421
|
+
.command('design')
|
|
422
|
+
.description('Manage design system')
|
|
304
423
|
.action(designCommand);
|
|
305
424
|
|
|
306
425
|
program
|
|
307
426
|
.command('prd [file]')
|
|
308
|
-
.description('Build
|
|
427
|
+
.description('Build project from PRD')
|
|
309
428
|
.action(prdCommand);
|
|
310
429
|
|
|
311
430
|
program
|
|
312
431
|
.command('advisors')
|
|
313
432
|
.alias('dream-team')
|
|
314
|
-
.description('Consult
|
|
433
|
+
.description('Consult AI expert advisors')
|
|
315
434
|
.action(advisorsCommand);
|
|
316
435
|
|
|
317
436
|
program
|
|
318
437
|
.command('migrate')
|
|
319
438
|
.alias('db')
|
|
320
|
-
.description('Database migrations
|
|
321
|
-
.option('--push', 'Push migrations
|
|
322
|
-
.option('--generate', 'Generate
|
|
323
|
-
.option('--status', 'Check
|
|
439
|
+
.description('Database migrations')
|
|
440
|
+
.option('--push', 'Push migrations')
|
|
441
|
+
.option('--generate', 'Generate migration')
|
|
442
|
+
.option('--status', 'Check status')
|
|
324
443
|
.action(migrateCommand);
|
|
325
444
|
|
|
326
445
|
program
|
|
327
446
|
.command('prd-maker')
|
|
328
447
|
.alias('create-prd')
|
|
329
|
-
.description('Create
|
|
448
|
+
.description('Create PRD through guided interview')
|
|
330
449
|
.action(prdMakerCommand);
|
|
331
450
|
|
|
332
451
|
program
|
|
333
452
|
.command('build [prd-file]')
|
|
334
453
|
.alias('swarm')
|
|
335
|
-
.description('Parallel build with
|
|
336
|
-
.option('--sequential', 'Disable parallel
|
|
454
|
+
.description('Parallel build with AI agents')
|
|
455
|
+
.option('--sequential', 'Disable parallel')
|
|
337
456
|
.action(buildCommand);
|
|
338
457
|
|
|
339
458
|
program
|
|
340
459
|
.command('integrate [integration]')
|
|
341
460
|
.alias('add')
|
|
342
|
-
.description('One-click integrations (50+ services
|
|
461
|
+
.description('One-click integrations (50+ services)')
|
|
343
462
|
.action(integrateCommand);
|
|
344
463
|
|
|
345
464
|
program
|
|
346
465
|
.command('website')
|
|
347
466
|
.alias('site')
|
|
348
|
-
.description('Build
|
|
467
|
+
.description('Build website by describing it')
|
|
349
468
|
.action(websiteCommand);
|
|
350
469
|
|
|
351
|
-
|
|
470
|
+
program
|
|
471
|
+
.command('help')
|
|
472
|
+
.description('Show help')
|
|
473
|
+
.action(showHelp);
|
|
474
|
+
|
|
475
|
+
// ============================================================================
|
|
476
|
+
// NATURAL LANGUAGE HANDLER
|
|
477
|
+
// ============================================================================
|
|
478
|
+
|
|
352
479
|
async function handleNaturalLanguage(input: string): Promise<void> {
|
|
353
480
|
const config = new Config();
|
|
354
481
|
|
|
355
|
-
console.log(chalk.dim('\n
|
|
482
|
+
console.log(chalk.dim('\n Understanding your request...\n'));
|
|
356
483
|
|
|
357
484
|
const parsed = await parseNaturalLanguage(input, config);
|
|
358
485
|
|
|
359
486
|
if (!parsed) {
|
|
360
|
-
// Fall back to code command
|
|
487
|
+
// Fall back to code command with the input as prompt
|
|
361
488
|
await codeCommand(input);
|
|
362
489
|
return;
|
|
363
490
|
}
|
|
364
491
|
|
|
365
|
-
//
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// Execute the command
|
|
373
|
-
switch (clarified.command) {
|
|
374
|
-
case 'init':
|
|
375
|
-
await initCommand();
|
|
492
|
+
// Handle recognized commands
|
|
493
|
+
switch (parsed.command) {
|
|
494
|
+
case 'deploy':
|
|
495
|
+
await deployCommand();
|
|
376
496
|
break;
|
|
377
497
|
case 'build':
|
|
378
|
-
await buildCommand(
|
|
498
|
+
await buildCommand();
|
|
379
499
|
break;
|
|
380
500
|
case 'code':
|
|
381
|
-
await codeCommand(
|
|
501
|
+
await codeCommand(input);
|
|
502
|
+
break;
|
|
503
|
+
case 'init':
|
|
504
|
+
await initCommand();
|
|
505
|
+
break;
|
|
506
|
+
case 'website':
|
|
507
|
+
await websiteCommand();
|
|
382
508
|
break;
|
|
383
509
|
case 'check':
|
|
384
510
|
await checkCommand();
|
|
385
511
|
break;
|
|
386
|
-
case 'deploy':
|
|
387
|
-
const target = await clarifyDeployTarget();
|
|
388
|
-
if (target) {
|
|
389
|
-
await deployCommand({ preview: target === 'preview' });
|
|
390
|
-
}
|
|
391
|
-
break;
|
|
392
512
|
case 'fix':
|
|
393
513
|
await fixCommand();
|
|
394
514
|
break;
|
|
395
|
-
case 'migrate':
|
|
396
|
-
await migrateCommand();
|
|
397
|
-
break;
|
|
398
|
-
case 'design':
|
|
399
|
-
await designCommand();
|
|
400
|
-
break;
|
|
401
|
-
case 'advisors':
|
|
402
|
-
await advisorsCommand();
|
|
403
|
-
break;
|
|
404
|
-
case 'prd-maker':
|
|
405
|
-
await prdMakerCommand();
|
|
406
|
-
break;
|
|
407
|
-
case 'security':
|
|
408
|
-
await securityCommand();
|
|
409
|
-
break;
|
|
410
|
-
case 'status':
|
|
411
|
-
await statusCommand();
|
|
412
|
-
break;
|
|
413
|
-
case 'setup':
|
|
414
|
-
await setupCommand();
|
|
415
|
-
break;
|
|
416
|
-
case 'help':
|
|
417
|
-
showHelp();
|
|
418
|
-
break;
|
|
419
515
|
default:
|
|
420
|
-
//
|
|
516
|
+
// Fall back to code command
|
|
421
517
|
await codeCommand(input);
|
|
422
518
|
}
|
|
423
519
|
}
|
|
424
520
|
|
|
425
|
-
//
|
|
521
|
+
// ============================================================================
|
|
522
|
+
// ENTRY POINT
|
|
523
|
+
// ============================================================================
|
|
524
|
+
|
|
426
525
|
const args = process.argv.slice(2);
|
|
427
526
|
|
|
428
527
|
if (args.length === 0) {
|
|
429
|
-
//
|
|
528
|
+
// No args - show interactive menu
|
|
430
529
|
checkForUpdates().catch(() => {});
|
|
431
|
-
|
|
432
|
-
// Show interactive menu
|
|
433
530
|
showMainMenu().catch(console.error);
|
|
434
531
|
} else if (args.length > 0 && args[0] && !args[0].startsWith('-')) {
|
|
435
532
|
// Check if it's a known command
|
|
436
533
|
const knownCommands = [
|
|
437
|
-
'setup', 'init', 'code', 'check', 'deploy', 'fix', 'generate',
|
|
534
|
+
'setup', 'init', 'code', 'check', 'deploy', 'fix', 'generate', 'gen',
|
|
438
535
|
'connect', 'status', 'gateway', 'security', 'learn', 'design',
|
|
439
|
-
'prd', 'advisors', 'migrate', '
|
|
440
|
-
'integrate', 'add', 'website', 'site', 'help'
|
|
536
|
+
'prd', 'advisors', 'dream-team', 'migrate', 'db', 'prd-maker', 'create-prd',
|
|
537
|
+
'build', 'swarm', 'integrate', 'add', 'website', 'site', 'help'
|
|
441
538
|
];
|
|
442
539
|
|
|
443
540
|
const firstArg = args[0] as string;
|