@codebakers/cli 1.3.0 → 1.4.0
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/commands/generate.d.ts +9 -0
- package/dist/commands/generate.js +653 -0
- package/dist/commands/scaffold.js +94 -22
- package/dist/index.js +6 -0
- package/package.json +1 -1
- package/src/commands/generate.ts +702 -0
- package/src/commands/scaffold.ts +97 -23
- package/src/index.ts +7 -0
|
@@ -84,11 +84,37 @@ async function scaffold() {
|
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
//
|
|
87
|
+
// Ask about experience level
|
|
88
|
+
console.log(chalk_1.default.white('\n What\'s your experience level?\n'));
|
|
89
|
+
console.log(chalk_1.default.gray(' 1. ') + chalk_1.default.cyan('Beginner') + chalk_1.default.gray(' - New to coding, explain everything'));
|
|
90
|
+
console.log(chalk_1.default.gray(' 2. ') + chalk_1.default.cyan('Intermediate') + chalk_1.default.gray(' - Know some coding, brief explanations'));
|
|
91
|
+
console.log(chalk_1.default.gray(' 3. ') + chalk_1.default.cyan('Advanced') + chalk_1.default.gray(' - Skip explanations, just build\n'));
|
|
92
|
+
let experienceLevel = '';
|
|
93
|
+
while (!['1', '2', '3'].includes(experienceLevel)) {
|
|
94
|
+
experienceLevel = await prompt(' Enter 1, 2, or 3: ');
|
|
95
|
+
}
|
|
96
|
+
const isBeginnerMode = experienceLevel === '1';
|
|
97
|
+
const showBriefExplanations = experienceLevel === '2';
|
|
98
|
+
// Select stack with explanations for beginners
|
|
88
99
|
console.log(chalk_1.default.white('\n Select your stack:\n'));
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
100
|
+
if (isBeginnerMode) {
|
|
101
|
+
console.log(chalk_1.default.gray(' 1. ') + chalk_1.default.cyan('Next.js + Supabase + Drizzle') + chalk_1.default.green(' (Recommended)'));
|
|
102
|
+
console.log(chalk_1.default.gray(' ') + chalk_1.default.dim('Next.js = Framework for building websites with React'));
|
|
103
|
+
console.log(chalk_1.default.gray(' ') + chalk_1.default.dim('Supabase = Database + user login (like Firebase, but open source)'));
|
|
104
|
+
console.log(chalk_1.default.gray(' ') + chalk_1.default.dim('Drizzle = Tool to talk to your database safely'));
|
|
105
|
+
console.log('');
|
|
106
|
+
console.log(chalk_1.default.gray(' 2. ') + chalk_1.default.cyan('Next.js + Prisma') + chalk_1.default.gray(' (Coming soon)'));
|
|
107
|
+
console.log(chalk_1.default.gray(' ') + chalk_1.default.dim('Prisma = Another database tool, more popular but heavier'));
|
|
108
|
+
console.log('');
|
|
109
|
+
console.log(chalk_1.default.gray(' 3. ') + chalk_1.default.cyan('Express API') + chalk_1.default.gray(' (Coming soon)'));
|
|
110
|
+
console.log(chalk_1.default.gray(' ') + chalk_1.default.dim('Express = Lightweight server, good for APIs without a frontend'));
|
|
111
|
+
console.log('');
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
console.log(chalk_1.default.gray(' 1. ') + chalk_1.default.cyan('Next.js + Supabase + Drizzle') + chalk_1.default.gray(' (Recommended)'));
|
|
115
|
+
console.log(chalk_1.default.gray(' 2. ') + chalk_1.default.cyan('Next.js + Prisma') + chalk_1.default.gray(' (Coming soon)'));
|
|
116
|
+
console.log(chalk_1.default.gray(' 3. ') + chalk_1.default.cyan('Express API') + chalk_1.default.gray(' (Coming soon)\n'));
|
|
117
|
+
}
|
|
92
118
|
let stackChoice = '';
|
|
93
119
|
while (!['1', '2', '3'].includes(stackChoice)) {
|
|
94
120
|
stackChoice = await prompt(' Enter 1, 2, or 3: ');
|
|
@@ -97,6 +123,22 @@ async function scaffold() {
|
|
|
97
123
|
console.log(chalk_1.default.yellow('\n That stack is coming soon! Using Next.js + Supabase + Drizzle.\n'));
|
|
98
124
|
stackChoice = '1';
|
|
99
125
|
}
|
|
126
|
+
// Explain what we're about to create for beginners
|
|
127
|
+
if (isBeginnerMode) {
|
|
128
|
+
console.log(chalk_1.default.blue('\n ═══════════════════════════════════════════════════════════'));
|
|
129
|
+
console.log(chalk_1.default.white.bold(' 📚 What we\'re creating:'));
|
|
130
|
+
console.log(chalk_1.default.blue(' ═══════════════════════════════════════════════════════════\n'));
|
|
131
|
+
console.log(chalk_1.default.gray(' This will create a complete web application with:'));
|
|
132
|
+
console.log(chalk_1.default.gray(' • A website users can visit (Next.js)'));
|
|
133
|
+
console.log(chalk_1.default.gray(' • User signup/login system (Supabase Auth)'));
|
|
134
|
+
console.log(chalk_1.default.gray(' • A database to store data (PostgreSQL via Supabase)'));
|
|
135
|
+
console.log(chalk_1.default.gray(' • Beautiful styling system (Tailwind CSS)'));
|
|
136
|
+
console.log(chalk_1.default.gray(' • Type safety to prevent bugs (TypeScript)\n'));
|
|
137
|
+
console.log(chalk_1.default.gray(' Think of it like a house:'));
|
|
138
|
+
console.log(chalk_1.default.gray(' • Next.js is the structure (walls, roof)'));
|
|
139
|
+
console.log(chalk_1.default.gray(' • Supabase is the utilities (electricity, plumbing)'));
|
|
140
|
+
console.log(chalk_1.default.gray(' • Tailwind is the interior design (paint, furniture)\n'));
|
|
141
|
+
}
|
|
100
142
|
// Get project name
|
|
101
143
|
const defaultName = cwd.split(/[\\/]/).pop() || 'my-project';
|
|
102
144
|
const projectName = await prompt(` Project name (${defaultName}): `) || defaultName;
|
|
@@ -175,26 +217,56 @@ async function scaffold() {
|
|
|
175
217
|
╚═══════════════════════════════════════════════════════════╝
|
|
176
218
|
`));
|
|
177
219
|
console.log(chalk_1.default.white(' Project structure:\n'));
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
220
|
+
if (isBeginnerMode) {
|
|
221
|
+
console.log(chalk_1.default.gray(' src/'));
|
|
222
|
+
console.log(chalk_1.default.gray(' ├── app/ ') + chalk_1.default.cyan('← Your pages (what users see)'));
|
|
223
|
+
console.log(chalk_1.default.gray(' ├── components/ ') + chalk_1.default.cyan('← Reusable UI pieces (buttons, forms)'));
|
|
224
|
+
console.log(chalk_1.default.gray(' ├── lib/ ') + chalk_1.default.cyan('← Helper code & connections'));
|
|
225
|
+
console.log(chalk_1.default.gray(' │ └── supabase/ ') + chalk_1.default.cyan('← Login & database connection'));
|
|
226
|
+
console.log(chalk_1.default.gray(' ├── db/ ') + chalk_1.default.cyan('← Database structure (tables)'));
|
|
227
|
+
console.log(chalk_1.default.gray(' ├── services/ ') + chalk_1.default.cyan('← Core app logic (what your app does)'));
|
|
228
|
+
console.log(chalk_1.default.gray(' └── types/ ') + chalk_1.default.cyan('← Data shape definitions'));
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
console.log(chalk_1.default.gray(' src/'));
|
|
232
|
+
console.log(chalk_1.default.gray(' ├── app/ ') + chalk_1.default.cyan('← Pages & layouts'));
|
|
233
|
+
console.log(chalk_1.default.gray(' ├── components/ ') + chalk_1.default.cyan('← React components'));
|
|
234
|
+
console.log(chalk_1.default.gray(' ├── lib/ ') + chalk_1.default.cyan('← Utilities & clients'));
|
|
235
|
+
console.log(chalk_1.default.gray(' │ └── supabase/ ') + chalk_1.default.cyan('← Supabase clients (ready!)'));
|
|
236
|
+
console.log(chalk_1.default.gray(' ├── db/ ') + chalk_1.default.cyan('← Database schema & queries'));
|
|
237
|
+
console.log(chalk_1.default.gray(' ├── services/ ') + chalk_1.default.cyan('← Business logic'));
|
|
238
|
+
console.log(chalk_1.default.gray(' └── types/ ') + chalk_1.default.cyan('← TypeScript types'));
|
|
239
|
+
}
|
|
186
240
|
console.log('');
|
|
187
241
|
console.log(chalk_1.default.white(' Next steps:\n'));
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
242
|
+
if (isBeginnerMode) {
|
|
243
|
+
console.log(chalk_1.default.cyan(' 1. ') + chalk_1.default.white('Set up Supabase (free database + login):'));
|
|
244
|
+
console.log(chalk_1.default.gray(' Go to https://supabase.com → Create free account → New Project'));
|
|
245
|
+
console.log('');
|
|
246
|
+
console.log(chalk_1.default.cyan(' 2. ') + chalk_1.default.white('Connect your project:'));
|
|
247
|
+
console.log(chalk_1.default.gray(' Open .env.local file and paste your Supabase credentials'));
|
|
248
|
+
console.log(chalk_1.default.gray(' (Found in Supabase: Settings → API)'));
|
|
249
|
+
console.log('');
|
|
250
|
+
console.log(chalk_1.default.cyan(' 3. ') + chalk_1.default.white('Start your app:'));
|
|
251
|
+
console.log(chalk_1.default.gray(' Run: npm run dev'));
|
|
252
|
+
console.log(chalk_1.default.gray(' Open: http://localhost:3000 in your browser'));
|
|
253
|
+
console.log('');
|
|
254
|
+
console.log(chalk_1.default.cyan(' 4. ') + chalk_1.default.white('Add AI superpowers:'));
|
|
255
|
+
console.log(chalk_1.default.gray(' Run: codebakers init'));
|
|
256
|
+
console.log(chalk_1.default.gray(' Now AI will follow professional coding patterns!\n'));
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
console.log(chalk_1.default.cyan(' 1. ') + chalk_1.default.gray('Update .env.local with your Supabase credentials'));
|
|
260
|
+
console.log(chalk_1.default.cyan(' 2. ') + chalk_1.default.gray('Run `npm run dev` to start development'));
|
|
261
|
+
console.log(chalk_1.default.cyan(' 3. ') + chalk_1.default.gray('Run `codebakers init` to add CodeBakers patterns'));
|
|
262
|
+
console.log(chalk_1.default.cyan(' 4. ') + chalk_1.default.gray('Start building with AI assistance!\n'));
|
|
263
|
+
console.log(chalk_1.default.white(' Supabase setup:\n'));
|
|
264
|
+
console.log(chalk_1.default.gray(' 1. Create a project at https://supabase.com'));
|
|
265
|
+
console.log(chalk_1.default.gray(' 2. Go to Settings → API'));
|
|
266
|
+
console.log(chalk_1.default.gray(' 3. Copy URL and anon key to .env.local'));
|
|
267
|
+
console.log(chalk_1.default.gray(' 4. Go to Settings → Database → Connection string'));
|
|
268
|
+
console.log(chalk_1.default.gray(' 5. Copy DATABASE_URL to .env.local\n'));
|
|
269
|
+
}
|
|
198
270
|
}
|
|
199
271
|
catch (error) {
|
|
200
272
|
spinner.fail('Project scaffolding failed');
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ const serve_js_1 = require("./commands/serve.js");
|
|
|
13
13
|
const mcp_config_js_1 = require("./commands/mcp-config.js");
|
|
14
14
|
const setup_js_1 = require("./commands/setup.js");
|
|
15
15
|
const scaffold_js_1 = require("./commands/scaffold.js");
|
|
16
|
+
const generate_js_1 = require("./commands/generate.js");
|
|
16
17
|
const program = new commander_1.Command();
|
|
17
18
|
program
|
|
18
19
|
.name('codebakers')
|
|
@@ -32,6 +33,11 @@ program
|
|
|
32
33
|
.alias('new')
|
|
33
34
|
.description('Create a new project with full stack scaffolding (Next.js + Supabase + Drizzle)')
|
|
34
35
|
.action(scaffold_js_1.scaffold);
|
|
36
|
+
program
|
|
37
|
+
.command('generate [type] [name]')
|
|
38
|
+
.alias('g')
|
|
39
|
+
.description('Generate code from templates (component, api, service, hook, page, schema, form)')
|
|
40
|
+
.action((type, name) => (0, generate_js_1.generate)({ type, name }));
|
|
35
41
|
program
|
|
36
42
|
.command('login')
|
|
37
43
|
.description('Login with your API key')
|