codebakers 2.5.0 → 2.5.3
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/AUDIT_REPORT.md +138 -0
- package/dist/{advisors-3PWAN6UL.js → advisors-RWRTSJRR.js} +1 -1
- package/dist/{chunk-URNRSXPU.js → chunk-D44U3IEA.js} +1 -1
- package/dist/{chunk-WZQNFV7Q.js → chunk-LANM5XQW.js} +1 -1
- package/dist/index.js +438 -282
- package/dist/{prd-YAUSAL5V.js → prd-RYITSL6Q.js} +1 -1
- package/package.json +1 -1
- package/src/commands/advisors.ts +1 -1
- package/src/commands/build.ts +1 -1
- package/src/commands/check.ts +1 -1
- package/src/commands/code.ts +1 -1
- package/src/commands/deploy.ts +2 -2
- package/src/commands/design.ts +1 -1
- package/src/commands/generate.ts +1 -1
- package/src/commands/init.ts +9 -2
- package/src/commands/integrate.ts +1 -1
- package/src/commands/migrate.ts +1 -1
- package/src/commands/prd-maker.ts +3 -2
- package/src/commands/prd.ts +1 -1
- package/src/commands/security.ts +1 -1
- package/src/commands/status.ts +1 -1
- package/src/commands/website.ts +41 -33
- package/src/index.ts +54 -42
- package/src/utils/display.ts +13 -0
- package/src/utils/files.ts +1 -1
- package/src/utils/ui.ts +441 -0
- package/src/utils/voice.ts +1 -1
package/package.json
CHANGED
package/src/commands/advisors.ts
CHANGED
package/src/commands/build.ts
CHANGED
package/src/commands/check.ts
CHANGED
package/src/commands/code.ts
CHANGED
package/src/commands/deploy.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as p from '@clack/prompts';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { execa } from 'execa';
|
|
4
|
-
import
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
5
|
import * as path from 'path';
|
|
6
6
|
import Anthropic from '@anthropic-ai/sdk';
|
|
7
7
|
import { Config } from '../utils/config.js';
|
|
@@ -230,7 +230,7 @@ ${chalk.bold('Type:')} ${deployType}
|
|
|
230
230
|
${chalk.bold('Time:')} ${new Date().toLocaleTimeString()}
|
|
231
231
|
|
|
232
232
|
${chalk.dim('View in Vercel Dashboard:')}
|
|
233
|
-
${chalk.dim(
|
|
233
|
+
${chalk.dim('https://vercel.com/dashboard')}
|
|
234
234
|
`));
|
|
235
235
|
|
|
236
236
|
} catch (error) {
|
package/src/commands/design.ts
CHANGED
package/src/commands/generate.ts
CHANGED
package/src/commands/init.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as p from '@clack/prompts';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import { execa } from 'execa';
|
|
6
6
|
import { Config } from '../utils/config.js';
|
|
@@ -364,7 +364,14 @@ async function createLocalProject(
|
|
|
364
364
|
await fs.ensureDir(path.join(projectPath, 'src', 'services'));
|
|
365
365
|
|
|
366
366
|
// Create package.json
|
|
367
|
-
const packageJson
|
|
367
|
+
const packageJson: {
|
|
368
|
+
name: string;
|
|
369
|
+
version: string;
|
|
370
|
+
private: boolean;
|
|
371
|
+
scripts: Record<string, string>;
|
|
372
|
+
dependencies: Record<string, string>;
|
|
373
|
+
devDependencies: Record<string, string>;
|
|
374
|
+
} = {
|
|
368
375
|
name: path.basename(projectPath),
|
|
369
376
|
version: '0.1.0',
|
|
370
377
|
private: true,
|
package/src/commands/migrate.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as p from '@clack/prompts';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import Anthropic from '@anthropic-ai/sdk';
|
|
6
|
+
import { execa } from 'execa';
|
|
6
7
|
import { Config } from '../utils/config.js';
|
|
7
|
-
import { textWithVoice
|
|
8
|
+
import { textWithVoice } from '../utils/voice.js';
|
|
8
9
|
|
|
9
10
|
interface PRDInput {
|
|
10
11
|
projectName: string;
|
package/src/commands/prd.ts
CHANGED
package/src/commands/security.ts
CHANGED
package/src/commands/status.ts
CHANGED
package/src/commands/website.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import * as p from '@clack/prompts';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import Anthropic from '@anthropic-ai/sdk';
|
|
6
6
|
import { execa } from 'execa';
|
|
7
7
|
import { Config } from '../utils/config.js';
|
|
8
8
|
import { textWithVoice } from '../utils/voice.js';
|
|
9
9
|
import { StepTracker, showError, showSuccess, showFileList, ERRORS } from '../utils/display.js';
|
|
10
|
+
import {
|
|
11
|
+
showMiniLogo,
|
|
12
|
+
box,
|
|
13
|
+
doubleBox,
|
|
14
|
+
sectionHeader,
|
|
15
|
+
showSuccessScreen,
|
|
16
|
+
showErrorScreen,
|
|
17
|
+
showFileTree,
|
|
18
|
+
colors
|
|
19
|
+
} from '../utils/ui.js';
|
|
10
20
|
|
|
11
21
|
// ============================================================================
|
|
12
22
|
// WEBSITE TEMPLATES
|
|
@@ -136,39 +146,37 @@ export async function websiteCommand(): Promise<void> {
|
|
|
136
146
|
const config = new Config();
|
|
137
147
|
|
|
138
148
|
if (!config.isConfigured()) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
`));
|
|
149
|
+
showErrorScreen({
|
|
150
|
+
title: 'CodeBakers not configured',
|
|
151
|
+
message: 'Run setup first to connect your API keys.',
|
|
152
|
+
command: 'codebakers setup',
|
|
153
|
+
});
|
|
145
154
|
return;
|
|
146
155
|
}
|
|
147
156
|
|
|
148
157
|
const anthropicCreds = config.getCredentials('anthropic');
|
|
149
158
|
if (!anthropicCreds?.apiKey) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
${chalk.dim('https://console.anthropic.com/settings/keys')}
|
|
160
|
-
`));
|
|
159
|
+
showErrorScreen({
|
|
160
|
+
title: 'Anthropic API key not configured',
|
|
161
|
+
message: 'The website builder needs Claude AI to generate code.',
|
|
162
|
+
fixes: [
|
|
163
|
+
'Run: codebakers setup',
|
|
164
|
+
'Get an API key at: console.anthropic.com',
|
|
165
|
+
],
|
|
166
|
+
command: 'codebakers setup',
|
|
167
|
+
});
|
|
161
168
|
return;
|
|
162
169
|
}
|
|
163
170
|
|
|
164
|
-
console.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
console.clear();
|
|
172
|
+
showMiniLogo();
|
|
173
|
+
|
|
174
|
+
doubleBox([
|
|
175
|
+
colors.primary('🌐 WEBSITE BUILDER'),
|
|
176
|
+
'',
|
|
177
|
+
colors.white('Describe your website in plain English.'),
|
|
178
|
+
colors.muted('AI builds it in minutes.'),
|
|
179
|
+
]);
|
|
172
180
|
|
|
173
181
|
// Step 1: Choose approach
|
|
174
182
|
const approach = await p.select({
|
|
@@ -689,21 +697,21 @@ Make it production-quality and visually impressive.`
|
|
|
689
697
|
|
|
690
698
|
// Show created files
|
|
691
699
|
if (createdFiles.length > 0) {
|
|
692
|
-
|
|
700
|
+
showFileTree('Files created', createdFiles.slice(0, 10));
|
|
693
701
|
if (createdFiles.length > 10) {
|
|
694
|
-
console.log(
|
|
702
|
+
console.log(colors.muted(` ... and ${createdFiles.length - 10} more files`));
|
|
695
703
|
}
|
|
696
704
|
}
|
|
697
705
|
|
|
698
|
-
// Success message
|
|
699
|
-
|
|
706
|
+
// Success message with beautiful screen
|
|
707
|
+
showSuccessScreen({
|
|
700
708
|
title: 'Website built successfully!',
|
|
701
709
|
message: spec.description,
|
|
702
710
|
stats: [
|
|
703
711
|
{ label: 'Project', value: spec.name },
|
|
704
|
-
{ label: 'Files
|
|
712
|
+
{ label: 'Files', value: createdFiles.length.toString() + ' created' },
|
|
705
713
|
{ label: 'Sections', value: spec.sections.length.toString() },
|
|
706
|
-
{ label: '
|
|
714
|
+
{ label: 'Time', value: steps.getElapsedTime() },
|
|
707
715
|
],
|
|
708
716
|
nextSteps: [
|
|
709
717
|
`cd ${spec.name}`,
|
|
@@ -719,7 +727,7 @@ Make it production-quality and visually impressive.`
|
|
|
719
727
|
});
|
|
720
728
|
|
|
721
729
|
if (openDev && !p.isCancel(openDev)) {
|
|
722
|
-
console.log(
|
|
730
|
+
console.log(colors.muted('\n Starting dev server...\n'));
|
|
723
731
|
|
|
724
732
|
// Change to project directory and run dev
|
|
725
733
|
process.chdir(projectPath);
|
package/src/index.ts
CHANGED
|
@@ -29,18 +29,21 @@ import { buildCommand } from './commands/build.js';
|
|
|
29
29
|
import { integrateCommand, INTEGRATIONS } from './commands/integrate.js';
|
|
30
30
|
import { websiteCommand } from './commands/website.js';
|
|
31
31
|
import { parseNaturalLanguage } from './utils/nlp.js';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
import {
|
|
33
|
+
showLogo,
|
|
34
|
+
showMiniLogo,
|
|
35
|
+
showMenuCards,
|
|
36
|
+
showSuccessScreen,
|
|
37
|
+
showErrorScreen,
|
|
38
|
+
box,
|
|
39
|
+
doubleBox,
|
|
40
|
+
divider,
|
|
41
|
+
sectionHeader,
|
|
42
|
+
colors,
|
|
43
|
+
headerGradient
|
|
44
|
+
} from './utils/ui.js';
|
|
45
|
+
|
|
46
|
+
const VERSION = '2.5.3';
|
|
44
47
|
|
|
45
48
|
// ============================================================================
|
|
46
49
|
// MAIN MENU
|
|
@@ -49,21 +52,23 @@ const logo = `
|
|
|
49
52
|
async function showMainMenu(): Promise<void> {
|
|
50
53
|
const config = new Config();
|
|
51
54
|
|
|
52
|
-
//
|
|
53
|
-
console.
|
|
54
|
-
|
|
55
|
+
// Clear screen and show beautiful logo
|
|
56
|
+
console.clear();
|
|
57
|
+
showLogo();
|
|
58
|
+
console.log(colors.muted(` v${VERSION}`));
|
|
59
|
+
console.log('');
|
|
55
60
|
|
|
56
61
|
// Check setup status
|
|
57
62
|
const hasAnthropic = !!config.getCredentials('anthropic')?.apiKey;
|
|
58
63
|
|
|
59
64
|
// STEP 1: First time? Run setup
|
|
60
65
|
if (!hasAnthropic) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
)
|
|
66
|
+
doubleBox([
|
|
67
|
+
colors.warning('👋 Welcome to CodeBakers!'),
|
|
68
|
+
'',
|
|
69
|
+
colors.white("Let's connect your Anthropic API key so the AI can work."),
|
|
70
|
+
colors.muted('(Takes about 1 minute)'),
|
|
71
|
+
], 'default');
|
|
67
72
|
|
|
68
73
|
await setupCommand();
|
|
69
74
|
|
|
@@ -81,14 +86,18 @@ async function showMainMenu(): Promise<void> {
|
|
|
81
86
|
// Show context
|
|
82
87
|
if (inProject && projectConfig) {
|
|
83
88
|
const framework = projectConfig.framework || 'detected';
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
box([
|
|
90
|
+
colors.secondary('📁 ') + colors.white(folderName),
|
|
91
|
+
colors.muted(` ${framework} project`),
|
|
92
|
+
]);
|
|
86
93
|
|
|
87
94
|
// SHOW PROJECT MENU
|
|
88
95
|
await showProjectMenu(config);
|
|
89
96
|
} else {
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
box([
|
|
98
|
+
colors.secondary('📁 ') + colors.white(cwd),
|
|
99
|
+
colors.muted(' Not a project folder'),
|
|
100
|
+
]);
|
|
92
101
|
|
|
93
102
|
// SHOW START MENU
|
|
94
103
|
await showStartMenu(config);
|
|
@@ -100,25 +109,28 @@ async function showMainMenu(): Promise<void> {
|
|
|
100
109
|
// ============================================================================
|
|
101
110
|
|
|
102
111
|
async function showStartMenu(config: Config): Promise<void> {
|
|
103
|
-
console.log(
|
|
112
|
+
console.log(colors.muted(' This folder doesn\'t have a project yet.'));
|
|
113
|
+
console.log('');
|
|
104
114
|
|
|
105
115
|
let keepRunning = true;
|
|
106
116
|
|
|
107
117
|
while (keepRunning) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
sectionHeader('What would you like to do?');
|
|
119
|
+
|
|
120
|
+
showMenuCards([
|
|
121
|
+
{ key: '1', icon: '🌐', label: 'Build a Website', description: 'Describe it, AI builds it' },
|
|
122
|
+
{ key: '2', icon: '🆕', label: 'Create New Project', description: 'Start with Next.js, React' },
|
|
123
|
+
{ key: '3', icon: '✏️', label: 'Plan My Project', description: 'Create a detailed plan' },
|
|
124
|
+
{ key: '4', icon: '🏗️', label: 'Build from Plan', description: 'I have a PRD file' },
|
|
125
|
+
{ key: '5', icon: '🌟', label: 'Get Expert Advice', description: 'AI consultants help' },
|
|
126
|
+
{ key: '6', icon: '🔌', label: 'Add a Service', description: 'Stripe, Supabase, Auth' },
|
|
127
|
+
{ key: '7', icon: '⚙️', label: 'Settings', description: 'API keys & preferences' },
|
|
128
|
+
{ key: '8', icon: '❓', label: 'Help', description: 'Learn how it works' },
|
|
129
|
+
{ key: '0', icon: '🚪', label: 'Exit', description: 'Return to terminal' },
|
|
130
|
+
]);
|
|
119
131
|
|
|
120
132
|
const choice = await p.text({
|
|
121
|
-
message: 'Enter a number (0-8):',
|
|
133
|
+
message: colors.primary('Enter a number (0-8):'),
|
|
122
134
|
placeholder: '1',
|
|
123
135
|
validate: (value) => {
|
|
124
136
|
if (!/^[0-8]$/.test(value) && value !== '') return 'Please enter a number 0-8';
|
|
@@ -172,11 +184,11 @@ async function showStartMenu(config: Config): Promise<void> {
|
|
|
172
184
|
|
|
173
185
|
function showExitMessage(): void {
|
|
174
186
|
console.log('');
|
|
175
|
-
|
|
176
|
-
console.log(
|
|
187
|
+
divider();
|
|
188
|
+
console.log(colors.white(' You\'re back in the terminal.'));
|
|
177
189
|
console.log('');
|
|
178
|
-
console.log(
|
|
179
|
-
console.log(
|
|
190
|
+
console.log(colors.muted(' To start CodeBakers again, type:'));
|
|
191
|
+
console.log(colors.success(' codebakers'));
|
|
180
192
|
console.log('');
|
|
181
193
|
console.log(chalk.dim(' Quick commands you can run directly:'));
|
|
182
194
|
console.log(chalk.dim(' codebakers website') + chalk.gray(' - Build a website'));
|
package/src/utils/display.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// ANTHROPIC RESPONSE HELPER
|
|
5
|
+
// ============================================================================
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Safely extract text from Anthropic API response
|
|
9
|
+
*/
|
|
10
|
+
export function getResponseText(response: { content: Array<{ type: string; text?: string }> }): string {
|
|
11
|
+
const firstContent = response.content?.[0];
|
|
12
|
+
if (!firstContent) return '';
|
|
13
|
+
return firstContent.type === 'text' && firstContent.text ? firstContent.text : '';
|
|
14
|
+
}
|
|
15
|
+
|
|
3
16
|
// ============================================================================
|
|
4
17
|
// STEP TRACKER - Shows progress through multiple steps
|
|
5
18
|
// ============================================================================
|