codebakers 2.2.2 → 2.3.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/index.d.ts +3 -0
- package/dist/index.js +155 -203
- package/package.json +1 -1
- package/src/commands/setup.ts +2 -6
- package/src/index.ts +251 -192
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import * as p21 from "@clack/prompts";
|
|
|
15
15
|
import chalk21 from "chalk";
|
|
16
16
|
import boxen from "boxen";
|
|
17
17
|
import gradient from "gradient-string";
|
|
18
|
+
import * as path16 from "path";
|
|
18
19
|
|
|
19
20
|
// src/utils/updates.ts
|
|
20
21
|
import chalk from "chalk";
|
|
@@ -276,10 +277,8 @@ async function setupCommand() {
|
|
|
276
277
|
const connectedCount = [...CORE_SERVICES, ...OPTIONAL_SERVICES].filter(
|
|
277
278
|
(key) => config.getCredentials(key)
|
|
278
279
|
).length;
|
|
279
|
-
|
|
280
|
-
\u2713
|
|
281
|
-
|
|
282
|
-
Run ${chalk2.bold("codebakers")} to get started.
|
|
280
|
+
console.log(chalk2.green(`
|
|
281
|
+
\u2713 ${connectedCount} services connected!
|
|
283
282
|
`));
|
|
284
283
|
}
|
|
285
284
|
async function connectService(config, service) {
|
|
@@ -7538,73 +7537,9 @@ If unclear between multiple commands, use the most likely one with lower confide
|
|
|
7538
7537
|
}
|
|
7539
7538
|
return JSON.parse(jsonMatch[0]);
|
|
7540
7539
|
}
|
|
7541
|
-
async function clarifyCommand(parsed) {
|
|
7542
|
-
if (parsed.confidence >= 0.8) {
|
|
7543
|
-
return parsed;
|
|
7544
|
-
}
|
|
7545
|
-
if (parsed.confidence >= 0.5) {
|
|
7546
|
-
const confirm13 = await p20.confirm({
|
|
7547
|
-
message: `Did you mean: ${parsed.interpretation}?`,
|
|
7548
|
-
initialValue: true
|
|
7549
|
-
});
|
|
7550
|
-
if (confirm13 && !p20.isCancel(confirm13)) {
|
|
7551
|
-
return { ...parsed, confidence: 1 };
|
|
7552
|
-
}
|
|
7553
|
-
}
|
|
7554
|
-
const options = [
|
|
7555
|
-
{ value: "init", label: "\u{1F195} Create new project", description: "Start a fresh project" },
|
|
7556
|
-
{ value: "build", label: "\u{1F3D7}\uFE0F Build from PRD", description: "Parallel build from document" },
|
|
7557
|
-
{ value: "code", label: "\u{1F4AC} AI Coding", description: "Get help writing code" },
|
|
7558
|
-
{ value: "check", label: "\u{1F50D} Check code", description: "Lint and validate" },
|
|
7559
|
-
{ value: "deploy", label: "\u{1F680} Deploy", description: "Push to production" },
|
|
7560
|
-
{ value: "fix", label: "\u{1F527} Fix errors", description: "Auto-fix issues" },
|
|
7561
|
-
{ value: "advisors", label: "\u{1F31F} Dream Team", description: "Get expert advice" },
|
|
7562
|
-
{ value: "prd-maker", label: "\u{1F4DD} Create PRD", description: "Document your idea" },
|
|
7563
|
-
{ value: "other", label: "\u2753 Something else", description: "Describe what you need" }
|
|
7564
|
-
];
|
|
7565
|
-
const selection = await p20.select({
|
|
7566
|
-
message: "What would you like to do?",
|
|
7567
|
-
options: options.map((o) => ({ value: o.value, label: o.label, hint: o.description }))
|
|
7568
|
-
});
|
|
7569
|
-
if (p20.isCancel(selection)) {
|
|
7570
|
-
return { ...parsed, command: "cancel", confidence: 1 };
|
|
7571
|
-
}
|
|
7572
|
-
if (selection === "other") {
|
|
7573
|
-
const description = await p20.text({
|
|
7574
|
-
message: "Describe what you want to do:",
|
|
7575
|
-
placeholder: "I want to..."
|
|
7576
|
-
});
|
|
7577
|
-
if (p20.isCancel(description)) {
|
|
7578
|
-
return { ...parsed, command: "cancel", confidence: 1 };
|
|
7579
|
-
}
|
|
7580
|
-
return {
|
|
7581
|
-
command: "code",
|
|
7582
|
-
args: [description],
|
|
7583
|
-
confidence: 1,
|
|
7584
|
-
interpretation: description
|
|
7585
|
-
};
|
|
7586
|
-
}
|
|
7587
|
-
return {
|
|
7588
|
-
command: selection,
|
|
7589
|
-
args: parsed.args,
|
|
7590
|
-
confidence: 1,
|
|
7591
|
-
interpretation: options.find((o) => o.value === selection)?.description || ""
|
|
7592
|
-
};
|
|
7593
|
-
}
|
|
7594
|
-
async function clarifyDeployTarget() {
|
|
7595
|
-
const target = await p20.select({
|
|
7596
|
-
message: "Where do you want to deploy?",
|
|
7597
|
-
options: [
|
|
7598
|
-
{ value: "preview", label: "\u{1F50D} Preview", hint: "Test URL to review changes" },
|
|
7599
|
-
{ value: "production", label: "\u{1F680} Production", hint: "Live site for users" }
|
|
7600
|
-
]
|
|
7601
|
-
});
|
|
7602
|
-
if (p20.isCancel(target)) return null;
|
|
7603
|
-
return target;
|
|
7604
|
-
}
|
|
7605
7540
|
|
|
7606
7541
|
// src/index.ts
|
|
7607
|
-
var VERSION2 = "2.
|
|
7542
|
+
var VERSION2 = "2.3.0";
|
|
7608
7543
|
var logo = `
|
|
7609
7544
|
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
7610
7545
|
\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D
|
|
@@ -7615,94 +7550,112 @@ var logo = `
|
|
|
7615
7550
|
`;
|
|
7616
7551
|
async function showMainMenu() {
|
|
7617
7552
|
const config = new Config();
|
|
7618
|
-
const isSetup = config.isConfigured();
|
|
7619
7553
|
console.log(gradient.pastel.multiline(logo));
|
|
7620
7554
|
console.log(chalk21.dim(` v${VERSION2} \u2014 AI dev team that follows the rules
|
|
7621
7555
|
`));
|
|
7622
|
-
|
|
7556
|
+
const hasAnthropic = !!config.getCredentials("anthropic")?.apiKey;
|
|
7557
|
+
if (!hasAnthropic) {
|
|
7623
7558
|
console.log(boxen(
|
|
7624
|
-
chalk21.yellow("Welcome to CodeBakers
|
|
7559
|
+
chalk21.yellow("Welcome to CodeBakers!\n\n") + chalk21.white("Let's connect your Anthropic API key so the AI can work.\n") + chalk21.dim("(Takes about 1 minute)"),
|
|
7625
7560
|
{ padding: 1, borderColor: "yellow", borderStyle: "round" }
|
|
7626
7561
|
));
|
|
7627
7562
|
await setupCommand();
|
|
7563
|
+
showPostSetupInstructions();
|
|
7628
7564
|
return;
|
|
7629
7565
|
}
|
|
7630
7566
|
const inProject = config.isInProject();
|
|
7631
|
-
const
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
menuOptions.push({ value: "integrate", label: "\u{1F50C} One-Click Integrations", hint: "50+ services" });
|
|
7649
|
-
menuOptions.push({ value: "gateway", label: "\u{1F4F1} Channel gateway", hint: "WhatsApp, Telegram, etc." });
|
|
7650
|
-
menuOptions.push({ value: "connect", label: "\u{1F517} Connect service", hint: "API keys" });
|
|
7651
|
-
menuOptions.push({ value: "settings", label: "\u2699\uFE0F Settings" });
|
|
7652
|
-
menuOptions.push({ value: "help", label: "\u2753 Help" });
|
|
7567
|
+
const projectConfig = config.getProjectConfig();
|
|
7568
|
+
const cwd = process.cwd();
|
|
7569
|
+
const folderName = path16.basename(cwd);
|
|
7570
|
+
if (inProject && projectConfig) {
|
|
7571
|
+
const framework = projectConfig.framework || "detected";
|
|
7572
|
+
console.log(chalk21.cyan(` \u{1F4C1} Working in: ${chalk21.bold(folderName)}`));
|
|
7573
|
+
console.log(chalk21.dim(` ${framework} project
|
|
7574
|
+
`));
|
|
7575
|
+
await showProjectMenu(config);
|
|
7576
|
+
} else {
|
|
7577
|
+
console.log(chalk21.cyan(` \u{1F4C1} Current folder: ${chalk21.bold(cwd)}`));
|
|
7578
|
+
console.log(chalk21.dim(` Not a project folder
|
|
7579
|
+
`));
|
|
7580
|
+
await showStartMenu(config);
|
|
7581
|
+
}
|
|
7582
|
+
}
|
|
7583
|
+
async function showStartMenu(config) {
|
|
7653
7584
|
const action = await p21.select({
|
|
7654
|
-
message: "What
|
|
7655
|
-
options:
|
|
7585
|
+
message: "What would you like to do?",
|
|
7586
|
+
options: [
|
|
7587
|
+
{ value: "website", label: "\u{1F310} Build a website", hint: "Describe it \u2192 AI builds it" },
|
|
7588
|
+
{ value: "new", label: "\u{1F195} Create new project", hint: "From scratch with options" },
|
|
7589
|
+
{ value: "prd-maker", label: "\u270F\uFE0F Create a PRD", hint: "Plan before building" },
|
|
7590
|
+
{ value: "build", label: "\u{1F3D7}\uFE0F Build from PRD", hint: "Have a PRD? Build it now" },
|
|
7591
|
+
{ value: "advisors", label: "\u{1F31F} Consult advisors", hint: "AI experts help you plan" },
|
|
7592
|
+
{ value: "divider1", label: chalk21.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500") },
|
|
7593
|
+
{ value: "integrate", label: "\u{1F50C} Add integration", hint: "Stripe, Supabase, etc." },
|
|
7594
|
+
{ value: "settings", label: "\u2699\uFE0F Settings", hint: "API keys & preferences" },
|
|
7595
|
+
{ value: "help", label: "\u2753 Help" }
|
|
7596
|
+
]
|
|
7656
7597
|
});
|
|
7657
7598
|
if (p21.isCancel(action)) {
|
|
7658
7599
|
p21.cancel("Goodbye!");
|
|
7659
7600
|
process.exit(0);
|
|
7660
7601
|
}
|
|
7602
|
+
if (action === "divider1") {
|
|
7603
|
+
await showStartMenu(config);
|
|
7604
|
+
return;
|
|
7605
|
+
}
|
|
7606
|
+
await handleAction(action, config);
|
|
7607
|
+
}
|
|
7608
|
+
async function showProjectMenu(config) {
|
|
7609
|
+
const action = await p21.select({
|
|
7610
|
+
message: "What would you like to do?",
|
|
7611
|
+
options: [
|
|
7612
|
+
{ value: "code", label: "\u{1F4AC} Code with AI", hint: "Build features, fix bugs" },
|
|
7613
|
+
{ value: "deploy", label: "\u{1F680} Deploy", hint: "Push to production" },
|
|
7614
|
+
{ value: "check", label: "\u{1F50D} Check code", hint: "Quality & patterns" },
|
|
7615
|
+
{ value: "fix", label: "\u{1F527} Fix errors", hint: "Auto-fix with AI" },
|
|
7616
|
+
{ value: "integrate", label: "\u{1F50C} Add integration", hint: "Stripe, Supabase, etc." },
|
|
7617
|
+
{ value: "generate", label: "\u26A1 Generate", hint: "Components, pages" },
|
|
7618
|
+
{ value: "divider1", label: chalk21.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500") },
|
|
7619
|
+
{ value: "new", label: "\u{1F195} Start new project", hint: "Create something else" },
|
|
7620
|
+
{ value: "settings", label: "\u2699\uFE0F Settings" },
|
|
7621
|
+
{ value: "help", label: "\u2753 Help" }
|
|
7622
|
+
]
|
|
7623
|
+
});
|
|
7624
|
+
if (p21.isCancel(action)) {
|
|
7625
|
+
p21.cancel("Goodbye!");
|
|
7626
|
+
process.exit(0);
|
|
7627
|
+
}
|
|
7628
|
+
if (action === "divider1") {
|
|
7629
|
+
await showProjectMenu(config);
|
|
7630
|
+
return;
|
|
7631
|
+
}
|
|
7632
|
+
await handleAction(action, config);
|
|
7633
|
+
}
|
|
7634
|
+
async function handleAction(action, config) {
|
|
7661
7635
|
switch (action) {
|
|
7636
|
+
case "website":
|
|
7637
|
+
await websiteCommand();
|
|
7638
|
+
break;
|
|
7639
|
+
case "new":
|
|
7640
|
+
await initCommand();
|
|
7641
|
+
break;
|
|
7662
7642
|
case "code":
|
|
7663
7643
|
await codeCommand();
|
|
7664
7644
|
break;
|
|
7665
|
-
case "integrate":
|
|
7666
|
-
await integrateCommand();
|
|
7667
|
-
break;
|
|
7668
7645
|
case "check":
|
|
7669
7646
|
await checkCommand();
|
|
7670
7647
|
break;
|
|
7671
7648
|
case "deploy":
|
|
7672
7649
|
await deployCommand();
|
|
7673
7650
|
break;
|
|
7674
|
-
case "migrate":
|
|
7675
|
-
await migrateCommand();
|
|
7676
|
-
break;
|
|
7677
7651
|
case "fix":
|
|
7678
7652
|
await fixCommand();
|
|
7679
7653
|
break;
|
|
7680
7654
|
case "generate":
|
|
7681
7655
|
await generateCommand();
|
|
7682
7656
|
break;
|
|
7683
|
-
case "
|
|
7684
|
-
await
|
|
7685
|
-
break;
|
|
7686
|
-
case "connect":
|
|
7687
|
-
await connectCommand();
|
|
7688
|
-
break;
|
|
7689
|
-
case "gateway":
|
|
7690
|
-
await gatewayCommand();
|
|
7691
|
-
break;
|
|
7692
|
-
case "learn":
|
|
7693
|
-
await learnCommand();
|
|
7694
|
-
break;
|
|
7695
|
-
case "security":
|
|
7696
|
-
await securityCommand();
|
|
7697
|
-
break;
|
|
7698
|
-
case "design":
|
|
7699
|
-
await designCommand();
|
|
7700
|
-
break;
|
|
7701
|
-
case "new":
|
|
7702
|
-
await initCommand();
|
|
7703
|
-
break;
|
|
7704
|
-
case "website":
|
|
7705
|
-
await websiteCommand();
|
|
7657
|
+
case "integrate":
|
|
7658
|
+
await integrateCommand();
|
|
7706
7659
|
break;
|
|
7707
7660
|
case "build":
|
|
7708
7661
|
await buildCommand();
|
|
@@ -7716,6 +7669,12 @@ async function showMainMenu() {
|
|
|
7716
7669
|
case "advisors":
|
|
7717
7670
|
await advisorsCommand();
|
|
7718
7671
|
break;
|
|
7672
|
+
case "gateway":
|
|
7673
|
+
await gatewayCommand();
|
|
7674
|
+
break;
|
|
7675
|
+
case "migrate":
|
|
7676
|
+
await migrateCommand();
|
|
7677
|
+
break;
|
|
7719
7678
|
case "settings":
|
|
7720
7679
|
await setupCommand();
|
|
7721
7680
|
break;
|
|
@@ -7723,121 +7682,107 @@ async function showMainMenu() {
|
|
|
7723
7682
|
showHelp2();
|
|
7724
7683
|
break;
|
|
7725
7684
|
default:
|
|
7726
|
-
|
|
7685
|
+
console.log(chalk21.yellow("Coming soon!"));
|
|
7727
7686
|
}
|
|
7728
7687
|
}
|
|
7688
|
+
function showPostSetupInstructions() {
|
|
7689
|
+
console.log(boxen(
|
|
7690
|
+
chalk21.green.bold("\u2713 Setup complete!\n\n") + chalk21.white("What's next?\n\n") + chalk21.cyan("1. ") + "Navigate to where you want to build:\n" + chalk21.dim(" cd C:\\dev\\my-project\n\n") + chalk21.cyan("2. ") + "Run CodeBakers:\n" + chalk21.dim(" codebakers\n\n") + chalk21.white("Or build a website right now:\n") + chalk21.dim(" codebakers website"),
|
|
7691
|
+
{ padding: 1, borderColor: "green", borderStyle: "round" }
|
|
7692
|
+
));
|
|
7693
|
+
}
|
|
7694
|
+
function showPostBuildInstructions(projectName, projectPath) {
|
|
7695
|
+
const displayPath = projectPath || projectName;
|
|
7696
|
+
console.log(boxen(
|
|
7697
|
+
chalk21.green.bold(`\u2713 ${projectName} created!
|
|
7698
|
+
|
|
7699
|
+
`) + chalk21.white("Next steps:\n\n") + chalk21.cyan("1. ") + "Go to your project:\n" + chalk21.dim(` cd ${displayPath}
|
|
7700
|
+
|
|
7701
|
+
`) + chalk21.cyan("2. ") + "Install dependencies:\n" + chalk21.dim(" npm install\n\n") + chalk21.cyan("3. ") + "Start the dev server:\n" + chalk21.dim(" npm run dev\n\n") + chalk21.cyan("4. ") + "Open in browser:\n" + chalk21.dim(" http://localhost:3000\n\n") + chalk21.white("Ready to deploy?\n") + chalk21.dim(" codebakers deploy"),
|
|
7702
|
+
{ padding: 1, borderColor: "green", borderStyle: "round" }
|
|
7703
|
+
));
|
|
7704
|
+
}
|
|
7729
7705
|
function showHelp2() {
|
|
7730
7706
|
console.log(boxen(`
|
|
7731
7707
|
${chalk21.bold("CodeBakers CLI v" + VERSION2)} \u2014 AI dev team that follows the rules
|
|
7732
7708
|
|
|
7733
7709
|
${chalk21.bold.cyan("Getting Started:")}
|
|
7734
|
-
${chalk21.cyan("codebakers
|
|
7735
|
-
${chalk21.cyan("codebakers
|
|
7736
|
-
${chalk21.cyan("codebakers website")} Build
|
|
7737
|
-
${chalk21.cyan("codebakers
|
|
7710
|
+
${chalk21.cyan("codebakers")} Interactive menu
|
|
7711
|
+
${chalk21.cyan("codebakers setup")} Connect API keys
|
|
7712
|
+
${chalk21.cyan("codebakers website")} Build website by describing it
|
|
7713
|
+
${chalk21.cyan("codebakers init")} Create new project
|
|
7738
7714
|
|
|
7739
|
-
${chalk21.bold.cyan("
|
|
7715
|
+
${chalk21.bold.cyan("In a Project:")}
|
|
7740
7716
|
${chalk21.cyan("codebakers code")} Chat with AI to build features
|
|
7741
|
-
${chalk21.cyan("codebakers check")} Check code quality & patterns
|
|
7742
|
-
${chalk21.cyan("codebakers fix")} Auto-fix errors with AI
|
|
7743
7717
|
${chalk21.cyan("codebakers deploy")} Deploy to Vercel
|
|
7744
|
-
|
|
7745
|
-
${chalk21.
|
|
7746
|
-
${chalk21.cyan("codebakers integrate")} 50+ one-click integrations (Stripe, Supabase, etc.)
|
|
7747
|
-
${chalk21.cyan("codebakers gateway")} Connect WhatsApp, Telegram, Discord, etc.
|
|
7718
|
+
${chalk21.cyan("codebakers check")} Check code quality
|
|
7719
|
+
${chalk21.cyan("codebakers fix")} Auto-fix errors
|
|
7748
7720
|
|
|
7749
7721
|
${chalk21.bold.cyan("Planning:")}
|
|
7750
|
-
${chalk21.cyan("codebakers prd-maker")} Create PRD through interview
|
|
7751
|
-
${chalk21.cyan("codebakers
|
|
7722
|
+
${chalk21.cyan("codebakers prd-maker")} Create PRD through interview
|
|
7723
|
+
${chalk21.cyan("codebakers build")} Build from PRD (parallel agents)
|
|
7724
|
+
${chalk21.cyan("codebakers advisors")} Consult AI experts
|
|
7752
7725
|
|
|
7753
|
-
${chalk21.bold.cyan("
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
\u2022 Clipboard: Type ${chalk21.yellow('"clip"')} to paste from clipboard
|
|
7726
|
+
${chalk21.bold.cyan("Integrations:")}
|
|
7727
|
+
${chalk21.cyan("codebakers integrate")} 50+ one-click integrations
|
|
7728
|
+
${chalk21.cyan("codebakers gateway")} WhatsApp, Telegram, Discord
|
|
7757
7729
|
|
|
7758
7730
|
${chalk21.bold("Docs:")} ${chalk21.dim("https://codebakers.dev/docs")}
|
|
7759
7731
|
`, { padding: 1, borderColor: "cyan", borderStyle: "round" }));
|
|
7760
7732
|
}
|
|
7761
7733
|
var program = new Command();
|
|
7762
7734
|
program.name("codebakers").description("AI dev team that follows the rules").version(VERSION2).action(showMainMenu);
|
|
7763
|
-
program.command("setup").description("Configure CodeBakers (
|
|
7764
|
-
program.command("init").description("Create a new project").option("-n, --name <
|
|
7765
|
-
program.command("code [prompt]").description("Start AI coding session").option("-w, --watch", "Watch mode
|
|
7766
|
-
program.command("check").description("Run
|
|
7767
|
-
program.command("deploy").description("Deploy to production").option("-p, --preview", "
|
|
7768
|
-
program.command("fix").description("Auto-fix
|
|
7769
|
-
program.command("generate
|
|
7770
|
-
program.command("
|
|
7771
|
-
program.command("
|
|
7772
|
-
program.command("
|
|
7773
|
-
program.command("security").description("Run security audit").
|
|
7774
|
-
program.command("learn").description("View
|
|
7775
|
-
program.command("design
|
|
7776
|
-
program.command("prd [file]").description("Build
|
|
7777
|
-
program.command("advisors").alias("dream-team").description("Consult
|
|
7778
|
-
program.command("migrate").alias("db").description("Database migrations
|
|
7779
|
-
program.command("prd-maker").alias("create-prd").description("Create
|
|
7780
|
-
program.command("build [prd-file]").alias("swarm").description("Parallel build with
|
|
7781
|
-
program.command("integrate [integration]").alias("add").description("One-click integrations (50+ services
|
|
7782
|
-
program.command("website").alias("site").description("Build
|
|
7735
|
+
program.command("setup").description("Configure CodeBakers (API keys)").action(setupCommand);
|
|
7736
|
+
program.command("init").description("Create a new project").option("-n, --name <n>", "Project name").option("-t, --template <t>", "Template").action(initCommand);
|
|
7737
|
+
program.command("code [prompt]").description("Start AI coding session").option("-w, --watch", "Watch mode").action(codeCommand);
|
|
7738
|
+
program.command("check").description("Run code quality checks").action(checkCommand);
|
|
7739
|
+
program.command("deploy").description("Deploy to production").option("-p, --preview", "Preview deployment").option("--no-check", "Skip quality check").action(deployCommand);
|
|
7740
|
+
program.command("fix").description("Auto-fix errors with AI").action(fixCommand);
|
|
7741
|
+
program.command("generate").alias("gen").description("Generate components, pages, etc.").action(generateCommand);
|
|
7742
|
+
program.command("status").description("View project status").action(statusCommand);
|
|
7743
|
+
program.command("connect").description("Connect external services").action(connectCommand);
|
|
7744
|
+
program.command("gateway").description("Manage messaging channels (WhatsApp, Telegram, etc.)").option("--start", "Start gateway").option("--stop", "Stop gateway").option("--status", "Show status").action(gatewayCommand);
|
|
7745
|
+
program.command("security").description("Run security audit").action(securityCommand);
|
|
7746
|
+
program.command("learn").description("View/manage what CodeBakers has learned").action(learnCommand);
|
|
7747
|
+
program.command("design").description("Manage design system").action(designCommand);
|
|
7748
|
+
program.command("prd [file]").description("Build project from PRD").action(prdCommand);
|
|
7749
|
+
program.command("advisors").alias("dream-team").description("Consult AI expert advisors").action(advisorsCommand);
|
|
7750
|
+
program.command("migrate").alias("db").description("Database migrations").option("--push", "Push migrations").option("--generate", "Generate migration").option("--status", "Check status").action(migrateCommand);
|
|
7751
|
+
program.command("prd-maker").alias("create-prd").description("Create PRD through guided interview").action(prdMakerCommand);
|
|
7752
|
+
program.command("build [prd-file]").alias("swarm").description("Parallel build with AI agents").option("--sequential", "Disable parallel").action(buildCommand);
|
|
7753
|
+
program.command("integrate [integration]").alias("add").description("One-click integrations (50+ services)").action(integrateCommand);
|
|
7754
|
+
program.command("website").alias("site").description("Build website by describing it").action(websiteCommand);
|
|
7755
|
+
program.command("help").description("Show help").action(showHelp2);
|
|
7783
7756
|
async function handleNaturalLanguage(input) {
|
|
7784
7757
|
const config = new Config();
|
|
7785
|
-
console.log(chalk21.dim("\n
|
|
7758
|
+
console.log(chalk21.dim("\n Understanding your request...\n"));
|
|
7786
7759
|
const parsed = await parseNaturalLanguage(input, config);
|
|
7787
7760
|
if (!parsed) {
|
|
7788
7761
|
await codeCommand(input);
|
|
7789
7762
|
return;
|
|
7790
7763
|
}
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
}
|
|
7795
|
-
switch (clarified.command) {
|
|
7796
|
-
case "init":
|
|
7797
|
-
await initCommand();
|
|
7764
|
+
switch (parsed.command) {
|
|
7765
|
+
case "deploy":
|
|
7766
|
+
await deployCommand();
|
|
7798
7767
|
break;
|
|
7799
7768
|
case "build":
|
|
7800
|
-
await buildCommand(
|
|
7769
|
+
await buildCommand();
|
|
7801
7770
|
break;
|
|
7802
7771
|
case "code":
|
|
7803
|
-
await codeCommand(
|
|
7772
|
+
await codeCommand(input);
|
|
7773
|
+
break;
|
|
7774
|
+
case "init":
|
|
7775
|
+
await initCommand();
|
|
7776
|
+
break;
|
|
7777
|
+
case "website":
|
|
7778
|
+
await websiteCommand();
|
|
7804
7779
|
break;
|
|
7805
7780
|
case "check":
|
|
7806
7781
|
await checkCommand();
|
|
7807
7782
|
break;
|
|
7808
|
-
case "deploy":
|
|
7809
|
-
const target = await clarifyDeployTarget();
|
|
7810
|
-
if (target) {
|
|
7811
|
-
await deployCommand({ preview: target === "preview" });
|
|
7812
|
-
}
|
|
7813
|
-
break;
|
|
7814
7783
|
case "fix":
|
|
7815
7784
|
await fixCommand();
|
|
7816
7785
|
break;
|
|
7817
|
-
case "migrate":
|
|
7818
|
-
await migrateCommand();
|
|
7819
|
-
break;
|
|
7820
|
-
case "design":
|
|
7821
|
-
await designCommand();
|
|
7822
|
-
break;
|
|
7823
|
-
case "advisors":
|
|
7824
|
-
await advisorsCommand();
|
|
7825
|
-
break;
|
|
7826
|
-
case "prd-maker":
|
|
7827
|
-
await prdMakerCommand();
|
|
7828
|
-
break;
|
|
7829
|
-
case "security":
|
|
7830
|
-
await securityCommand();
|
|
7831
|
-
break;
|
|
7832
|
-
case "status":
|
|
7833
|
-
await statusCommand();
|
|
7834
|
-
break;
|
|
7835
|
-
case "setup":
|
|
7836
|
-
await setupCommand();
|
|
7837
|
-
break;
|
|
7838
|
-
case "help":
|
|
7839
|
-
showHelp2();
|
|
7840
|
-
break;
|
|
7841
7786
|
default:
|
|
7842
7787
|
await codeCommand(input);
|
|
7843
7788
|
}
|
|
@@ -7856,6 +7801,7 @@ if (args.length === 0) {
|
|
|
7856
7801
|
"deploy",
|
|
7857
7802
|
"fix",
|
|
7858
7803
|
"generate",
|
|
7804
|
+
"gen",
|
|
7859
7805
|
"connect",
|
|
7860
7806
|
"status",
|
|
7861
7807
|
"gateway",
|
|
@@ -7864,8 +7810,11 @@ if (args.length === 0) {
|
|
|
7864
7810
|
"design",
|
|
7865
7811
|
"prd",
|
|
7866
7812
|
"advisors",
|
|
7813
|
+
"dream-team",
|
|
7867
7814
|
"migrate",
|
|
7815
|
+
"db",
|
|
7868
7816
|
"prd-maker",
|
|
7817
|
+
"create-prd",
|
|
7869
7818
|
"build",
|
|
7870
7819
|
"swarm",
|
|
7871
7820
|
"integrate",
|
|
@@ -7886,3 +7835,6 @@ if (args.length === 0) {
|
|
|
7886
7835
|
} else {
|
|
7887
7836
|
program.parse();
|
|
7888
7837
|
}
|
|
7838
|
+
export {
|
|
7839
|
+
showPostBuildInstructions
|
|
7840
|
+
};
|
package/package.json
CHANGED
package/src/commands/setup.ts
CHANGED
|
@@ -276,16 +276,12 @@ export async function setupCommand(): Promise<void> {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
// Done
|
|
279
|
+
// Done - just show count, index.ts will show detailed next steps
|
|
280
280
|
const connectedCount = [...CORE_SERVICES, ...OPTIONAL_SERVICES].filter(
|
|
281
281
|
key => config.getCredentials(key)
|
|
282
282
|
).length;
|
|
283
283
|
|
|
284
|
-
|
|
285
|
-
✓ Setup complete! ${connectedCount} services connected.
|
|
286
|
-
|
|
287
|
-
Run ${chalk.bold('codebakers')} to get started.
|
|
288
|
-
`));
|
|
284
|
+
console.log(chalk.green(`\n ✓ ${connectedCount} services connected!\n`));
|
|
289
285
|
}
|
|
290
286
|
|
|
291
287
|
// ============================================================================
|
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.0';
|
|
33
34
|
|
|
34
35
|
// ASCII art logo
|
|
35
36
|
const logo = `
|
|
@@ -41,62 +42,112 @@ 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
|
+
const action = await p.select({
|
|
104
|
+
message: 'What would you like to do?',
|
|
105
|
+
options: [
|
|
106
|
+
{ value: 'website', label: '🌐 Build a website', hint: 'Describe it → AI builds it' },
|
|
107
|
+
{ value: 'new', label: '🆕 Create new project', hint: 'From scratch with options' },
|
|
108
|
+
{ value: 'prd-maker', label: '✏️ Create a PRD', hint: 'Plan before building' },
|
|
109
|
+
{ value: 'build', label: '🏗️ Build from PRD', hint: 'Have a PRD? Build it now' },
|
|
110
|
+
{ value: 'advisors', label: '🌟 Consult advisors', hint: 'AI experts help you plan' },
|
|
111
|
+
{ value: 'divider1', label: chalk.dim('─────────────────────────────') },
|
|
112
|
+
{ value: 'integrate', label: '🔌 Add integration', hint: 'Stripe, Supabase, etc.' },
|
|
113
|
+
{ value: 'settings', label: '⚙️ Settings', hint: 'API keys & preferences' },
|
|
114
|
+
{ value: 'help', label: '❓ Help' },
|
|
115
|
+
],
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
if (p.isCancel(action)) {
|
|
119
|
+
p.cancel('Goodbye!');
|
|
120
|
+
process.exit(0);
|
|
86
121
|
}
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
122
|
+
|
|
123
|
+
// Handle divider - show menu again
|
|
124
|
+
if (action === 'divider1') {
|
|
125
|
+
await showStartMenu(config);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
await handleAction(action as string, config);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ============================================================================
|
|
133
|
+
// PROJECT MENU (In a project)
|
|
134
|
+
// ============================================================================
|
|
135
|
+
|
|
136
|
+
async function showProjectMenu(config: Config): Promise<void> {
|
|
97
137
|
const action = await p.select({
|
|
98
|
-
message: 'What
|
|
99
|
-
options:
|
|
138
|
+
message: 'What would you like to do?',
|
|
139
|
+
options: [
|
|
140
|
+
{ value: 'code', label: '💬 Code with AI', hint: 'Build features, fix bugs' },
|
|
141
|
+
{ value: 'deploy', label: '🚀 Deploy', hint: 'Push to production' },
|
|
142
|
+
{ value: 'check', label: '🔍 Check code', hint: 'Quality & patterns' },
|
|
143
|
+
{ value: 'fix', label: '🔧 Fix errors', hint: 'Auto-fix with AI' },
|
|
144
|
+
{ value: 'integrate', label: '🔌 Add integration', hint: 'Stripe, Supabase, etc.' },
|
|
145
|
+
{ value: 'generate', label: '⚡ Generate', hint: 'Components, pages' },
|
|
146
|
+
{ value: 'divider1', label: chalk.dim('─────────────────────────────') },
|
|
147
|
+
{ value: 'new', label: '🆕 Start new project', hint: 'Create something else' },
|
|
148
|
+
{ value: 'settings', label: '⚙️ Settings' },
|
|
149
|
+
{ value: 'help', label: '❓ Help' },
|
|
150
|
+
],
|
|
100
151
|
});
|
|
101
152
|
|
|
102
153
|
if (p.isCancel(action)) {
|
|
@@ -104,52 +155,44 @@ async function showMainMenu(): Promise<void> {
|
|
|
104
155
|
process.exit(0);
|
|
105
156
|
}
|
|
106
157
|
|
|
107
|
-
// Handle
|
|
158
|
+
// Handle divider - show menu again
|
|
159
|
+
if (action === 'divider1') {
|
|
160
|
+
await showProjectMenu(config);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
await handleAction(action as string, config);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ============================================================================
|
|
168
|
+
// ACTION HANDLER
|
|
169
|
+
// ============================================================================
|
|
170
|
+
|
|
171
|
+
async function handleAction(action: string, config: Config): Promise<void> {
|
|
108
172
|
switch (action) {
|
|
173
|
+
case 'website':
|
|
174
|
+
await websiteCommand();
|
|
175
|
+
break;
|
|
176
|
+
case 'new':
|
|
177
|
+
await initCommand();
|
|
178
|
+
break;
|
|
109
179
|
case 'code':
|
|
110
180
|
await codeCommand();
|
|
111
181
|
break;
|
|
112
|
-
case 'integrate':
|
|
113
|
-
await integrateCommand();
|
|
114
|
-
break;
|
|
115
182
|
case 'check':
|
|
116
183
|
await checkCommand();
|
|
117
184
|
break;
|
|
118
185
|
case 'deploy':
|
|
119
186
|
await deployCommand();
|
|
120
187
|
break;
|
|
121
|
-
case 'migrate':
|
|
122
|
-
await migrateCommand();
|
|
123
|
-
break;
|
|
124
188
|
case 'fix':
|
|
125
189
|
await fixCommand();
|
|
126
190
|
break;
|
|
127
191
|
case 'generate':
|
|
128
192
|
await generateCommand();
|
|
129
193
|
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();
|
|
194
|
+
case 'integrate':
|
|
195
|
+
await integrateCommand();
|
|
153
196
|
break;
|
|
154
197
|
case 'build':
|
|
155
198
|
await buildCommand();
|
|
@@ -163,6 +206,12 @@ async function showMainMenu(): Promise<void> {
|
|
|
163
206
|
case 'advisors':
|
|
164
207
|
await advisorsCommand();
|
|
165
208
|
break;
|
|
209
|
+
case 'gateway':
|
|
210
|
+
await gatewayCommand();
|
|
211
|
+
break;
|
|
212
|
+
case 'migrate':
|
|
213
|
+
await migrateCommand();
|
|
214
|
+
break;
|
|
166
215
|
case 'settings':
|
|
167
216
|
await setupCommand();
|
|
168
217
|
break;
|
|
@@ -170,45 +219,89 @@ async function showMainMenu(): Promise<void> {
|
|
|
170
219
|
showHelp();
|
|
171
220
|
break;
|
|
172
221
|
default:
|
|
173
|
-
|
|
174
|
-
await showMainMenu();
|
|
222
|
+
console.log(chalk.yellow('Coming soon!'));
|
|
175
223
|
}
|
|
176
224
|
}
|
|
177
225
|
|
|
226
|
+
// ============================================================================
|
|
227
|
+
// POST-SETUP INSTRUCTIONS
|
|
228
|
+
// ============================================================================
|
|
229
|
+
|
|
230
|
+
function showPostSetupInstructions(): void {
|
|
231
|
+
console.log(boxen(
|
|
232
|
+
chalk.green.bold('✓ Setup complete!\n\n') +
|
|
233
|
+
chalk.white('What\'s next?\n\n') +
|
|
234
|
+
chalk.cyan('1. ') + 'Navigate to where you want to build:\n' +
|
|
235
|
+
chalk.dim(' cd C:\\dev\\my-project\n\n') +
|
|
236
|
+
chalk.cyan('2. ') + 'Run CodeBakers:\n' +
|
|
237
|
+
chalk.dim(' codebakers\n\n') +
|
|
238
|
+
chalk.white('Or build a website right now:\n') +
|
|
239
|
+
chalk.dim(' codebakers website'),
|
|
240
|
+
{ padding: 1, borderColor: 'green', borderStyle: 'round' }
|
|
241
|
+
));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ============================================================================
|
|
245
|
+
// POST-BUILD INSTRUCTIONS (exported for other commands to use)
|
|
246
|
+
// ============================================================================
|
|
247
|
+
|
|
248
|
+
export function showPostBuildInstructions(projectName: string, projectPath?: string): void {
|
|
249
|
+
const displayPath = projectPath || projectName;
|
|
250
|
+
|
|
251
|
+
console.log(boxen(
|
|
252
|
+
chalk.green.bold(`✓ ${projectName} created!\n\n`) +
|
|
253
|
+
chalk.white('Next steps:\n\n') +
|
|
254
|
+
chalk.cyan('1. ') + 'Go to your project:\n' +
|
|
255
|
+
chalk.dim(` cd ${displayPath}\n\n`) +
|
|
256
|
+
chalk.cyan('2. ') + 'Install dependencies:\n' +
|
|
257
|
+
chalk.dim(' npm install\n\n') +
|
|
258
|
+
chalk.cyan('3. ') + 'Start the dev server:\n' +
|
|
259
|
+
chalk.dim(' npm run dev\n\n') +
|
|
260
|
+
chalk.cyan('4. ') + 'Open in browser:\n' +
|
|
261
|
+
chalk.dim(' http://localhost:3000\n\n') +
|
|
262
|
+
chalk.white('Ready to deploy?\n') +
|
|
263
|
+
chalk.dim(' codebakers deploy'),
|
|
264
|
+
{ padding: 1, borderColor: 'green', borderStyle: 'round' }
|
|
265
|
+
));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// ============================================================================
|
|
269
|
+
// HELP
|
|
270
|
+
// ============================================================================
|
|
271
|
+
|
|
178
272
|
function showHelp(): void {
|
|
179
273
|
console.log(boxen(`
|
|
180
274
|
${chalk.bold('CodeBakers CLI v' + VERSION)} — AI dev team that follows the rules
|
|
181
275
|
|
|
182
276
|
${chalk.bold.cyan('Getting Started:')}
|
|
183
|
-
${chalk.cyan('codebakers
|
|
184
|
-
${chalk.cyan('codebakers
|
|
185
|
-
${chalk.cyan('codebakers website')} Build
|
|
186
|
-
${chalk.cyan('codebakers
|
|
277
|
+
${chalk.cyan('codebakers')} Interactive menu
|
|
278
|
+
${chalk.cyan('codebakers setup')} Connect API keys
|
|
279
|
+
${chalk.cyan('codebakers website')} Build website by describing it
|
|
280
|
+
${chalk.cyan('codebakers init')} Create new project
|
|
187
281
|
|
|
188
|
-
${chalk.bold.cyan('
|
|
282
|
+
${chalk.bold.cyan('In a Project:')}
|
|
189
283
|
${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
284
|
${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.
|
|
285
|
+
${chalk.cyan('codebakers check')} Check code quality
|
|
286
|
+
${chalk.cyan('codebakers fix')} Auto-fix errors
|
|
197
287
|
|
|
198
288
|
${chalk.bold.cyan('Planning:')}
|
|
199
|
-
${chalk.cyan('codebakers prd-maker')} Create PRD through interview
|
|
200
|
-
${chalk.cyan('codebakers
|
|
289
|
+
${chalk.cyan('codebakers prd-maker')} Create PRD through interview
|
|
290
|
+
${chalk.cyan('codebakers build')} Build from PRD (parallel agents)
|
|
291
|
+
${chalk.cyan('codebakers advisors')} Consult AI experts
|
|
201
292
|
|
|
202
|
-
${chalk.bold.cyan('
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
• Clipboard: Type ${chalk.yellow('"clip"')} to paste from clipboard
|
|
293
|
+
${chalk.bold.cyan('Integrations:')}
|
|
294
|
+
${chalk.cyan('codebakers integrate')} 50+ one-click integrations
|
|
295
|
+
${chalk.cyan('codebakers gateway')} WhatsApp, Telegram, Discord
|
|
206
296
|
|
|
207
297
|
${chalk.bold('Docs:')} ${chalk.dim('https://codebakers.dev/docs')}
|
|
208
298
|
`, { padding: 1, borderColor: 'cyan', borderStyle: 'round' }));
|
|
209
299
|
}
|
|
210
300
|
|
|
211
|
-
//
|
|
301
|
+
// ============================================================================
|
|
302
|
+
// CLI COMMANDS (Commander)
|
|
303
|
+
// ============================================================================
|
|
304
|
+
|
|
212
305
|
const program = new Command();
|
|
213
306
|
|
|
214
307
|
program
|
|
@@ -219,225 +312,191 @@ program
|
|
|
219
312
|
|
|
220
313
|
program
|
|
221
314
|
.command('setup')
|
|
222
|
-
.description('Configure CodeBakers (
|
|
315
|
+
.description('Configure CodeBakers (API keys)')
|
|
223
316
|
.action(setupCommand);
|
|
224
317
|
|
|
225
318
|
program
|
|
226
319
|
.command('init')
|
|
227
320
|
.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')
|
|
321
|
+
.option('-n, --name <n>', 'Project name')
|
|
322
|
+
.option('-t, --template <t>', 'Template')
|
|
233
323
|
.action(initCommand);
|
|
234
324
|
|
|
235
325
|
program
|
|
236
326
|
.command('code [prompt]')
|
|
237
327
|
.description('Start AI coding session')
|
|
238
|
-
.option('-w, --watch', 'Watch mode
|
|
328
|
+
.option('-w, --watch', 'Watch mode')
|
|
239
329
|
.action(codeCommand);
|
|
240
330
|
|
|
241
331
|
program
|
|
242
332
|
.command('check')
|
|
243
|
-
.description('Run
|
|
244
|
-
.option('-f, --fix', 'Auto-fix violations')
|
|
245
|
-
.option('--watch', 'Watch mode')
|
|
333
|
+
.description('Run code quality checks')
|
|
246
334
|
.action(checkCommand);
|
|
247
335
|
|
|
248
336
|
program
|
|
249
337
|
.command('deploy')
|
|
250
338
|
.description('Deploy to production')
|
|
251
|
-
.option('-p, --preview', '
|
|
252
|
-
.option('--no-check', 'Skip
|
|
339
|
+
.option('-p, --preview', 'Preview deployment')
|
|
340
|
+
.option('--no-check', 'Skip quality check')
|
|
253
341
|
.action(deployCommand);
|
|
254
342
|
|
|
255
343
|
program
|
|
256
344
|
.command('fix')
|
|
257
|
-
.description('Auto-fix
|
|
258
|
-
.option('--auto', 'Fix without asking')
|
|
345
|
+
.description('Auto-fix errors with AI')
|
|
259
346
|
.action(fixCommand);
|
|
260
347
|
|
|
261
348
|
program
|
|
262
|
-
.command('generate
|
|
263
|
-
.alias('
|
|
264
|
-
.description('Generate components, pages,
|
|
265
|
-
.option('-n, --name <name>', 'Name of the generated item')
|
|
349
|
+
.command('generate')
|
|
350
|
+
.alias('gen')
|
|
351
|
+
.description('Generate components, pages, etc.')
|
|
266
352
|
.action(generateCommand);
|
|
267
353
|
|
|
268
354
|
program
|
|
269
|
-
.command('
|
|
270
|
-
.description('
|
|
355
|
+
.command('status')
|
|
356
|
+
.description('View project status')
|
|
357
|
+
.action(statusCommand);
|
|
358
|
+
|
|
359
|
+
program
|
|
360
|
+
.command('connect')
|
|
361
|
+
.description('Connect external services')
|
|
271
362
|
.action(connectCommand);
|
|
272
363
|
|
|
273
364
|
program
|
|
274
365
|
.command('gateway')
|
|
275
|
-
.description('Manage messaging
|
|
276
|
-
.option('--start', 'Start
|
|
277
|
-
.option('--stop', 'Stop
|
|
278
|
-
.option('--status', 'Show
|
|
366
|
+
.description('Manage messaging channels (WhatsApp, Telegram, etc.)')
|
|
367
|
+
.option('--start', 'Start gateway')
|
|
368
|
+
.option('--stop', 'Stop gateway')
|
|
369
|
+
.option('--status', 'Show status')
|
|
279
370
|
.action(gatewayCommand);
|
|
280
371
|
|
|
281
|
-
program
|
|
282
|
-
.command('status')
|
|
283
|
-
.description('View project status and health')
|
|
284
|
-
.option('-a, --all', 'Show all projects')
|
|
285
|
-
.action(statusCommand);
|
|
286
|
-
|
|
287
372
|
program
|
|
288
373
|
.command('security')
|
|
289
374
|
.description('Run security audit')
|
|
290
|
-
.option('--fix', 'Auto-fix security issues')
|
|
291
375
|
.action(securityCommand);
|
|
292
376
|
|
|
293
377
|
program
|
|
294
378
|
.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')
|
|
379
|
+
.description('View/manage what CodeBakers has learned')
|
|
299
380
|
.action(learnCommand);
|
|
300
381
|
|
|
301
382
|
program
|
|
302
|
-
.command('design
|
|
303
|
-
.description('Manage design system
|
|
383
|
+
.command('design')
|
|
384
|
+
.description('Manage design system')
|
|
304
385
|
.action(designCommand);
|
|
305
386
|
|
|
306
387
|
program
|
|
307
388
|
.command('prd [file]')
|
|
308
|
-
.description('Build
|
|
389
|
+
.description('Build project from PRD')
|
|
309
390
|
.action(prdCommand);
|
|
310
391
|
|
|
311
392
|
program
|
|
312
393
|
.command('advisors')
|
|
313
394
|
.alias('dream-team')
|
|
314
|
-
.description('Consult
|
|
395
|
+
.description('Consult AI expert advisors')
|
|
315
396
|
.action(advisorsCommand);
|
|
316
397
|
|
|
317
398
|
program
|
|
318
399
|
.command('migrate')
|
|
319
400
|
.alias('db')
|
|
320
|
-
.description('Database migrations
|
|
321
|
-
.option('--push', 'Push migrations
|
|
322
|
-
.option('--generate', 'Generate
|
|
323
|
-
.option('--status', 'Check
|
|
401
|
+
.description('Database migrations')
|
|
402
|
+
.option('--push', 'Push migrations')
|
|
403
|
+
.option('--generate', 'Generate migration')
|
|
404
|
+
.option('--status', 'Check status')
|
|
324
405
|
.action(migrateCommand);
|
|
325
406
|
|
|
326
407
|
program
|
|
327
408
|
.command('prd-maker')
|
|
328
409
|
.alias('create-prd')
|
|
329
|
-
.description('Create
|
|
410
|
+
.description('Create PRD through guided interview')
|
|
330
411
|
.action(prdMakerCommand);
|
|
331
412
|
|
|
332
413
|
program
|
|
333
414
|
.command('build [prd-file]')
|
|
334
415
|
.alias('swarm')
|
|
335
|
-
.description('Parallel build with
|
|
336
|
-
.option('--sequential', 'Disable parallel
|
|
416
|
+
.description('Parallel build with AI agents')
|
|
417
|
+
.option('--sequential', 'Disable parallel')
|
|
337
418
|
.action(buildCommand);
|
|
338
419
|
|
|
339
420
|
program
|
|
340
421
|
.command('integrate [integration]')
|
|
341
422
|
.alias('add')
|
|
342
|
-
.description('One-click integrations (50+ services
|
|
423
|
+
.description('One-click integrations (50+ services)')
|
|
343
424
|
.action(integrateCommand);
|
|
344
425
|
|
|
345
426
|
program
|
|
346
427
|
.command('website')
|
|
347
428
|
.alias('site')
|
|
348
|
-
.description('Build
|
|
429
|
+
.description('Build website by describing it')
|
|
349
430
|
.action(websiteCommand);
|
|
350
431
|
|
|
351
|
-
|
|
432
|
+
program
|
|
433
|
+
.command('help')
|
|
434
|
+
.description('Show help')
|
|
435
|
+
.action(showHelp);
|
|
436
|
+
|
|
437
|
+
// ============================================================================
|
|
438
|
+
// NATURAL LANGUAGE HANDLER
|
|
439
|
+
// ============================================================================
|
|
440
|
+
|
|
352
441
|
async function handleNaturalLanguage(input: string): Promise<void> {
|
|
353
442
|
const config = new Config();
|
|
354
443
|
|
|
355
|
-
console.log(chalk.dim('\n
|
|
444
|
+
console.log(chalk.dim('\n Understanding your request...\n'));
|
|
356
445
|
|
|
357
446
|
const parsed = await parseNaturalLanguage(input, config);
|
|
358
447
|
|
|
359
448
|
if (!parsed) {
|
|
360
|
-
// Fall back to code command
|
|
449
|
+
// Fall back to code command with the input as prompt
|
|
361
450
|
await codeCommand(input);
|
|
362
451
|
return;
|
|
363
452
|
}
|
|
364
453
|
|
|
365
|
-
//
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// Execute the command
|
|
373
|
-
switch (clarified.command) {
|
|
374
|
-
case 'init':
|
|
375
|
-
await initCommand();
|
|
454
|
+
// Handle recognized commands
|
|
455
|
+
switch (parsed.command) {
|
|
456
|
+
case 'deploy':
|
|
457
|
+
await deployCommand();
|
|
376
458
|
break;
|
|
377
459
|
case 'build':
|
|
378
|
-
await buildCommand(
|
|
460
|
+
await buildCommand();
|
|
379
461
|
break;
|
|
380
462
|
case 'code':
|
|
381
|
-
await codeCommand(
|
|
463
|
+
await codeCommand(input);
|
|
464
|
+
break;
|
|
465
|
+
case 'init':
|
|
466
|
+
await initCommand();
|
|
467
|
+
break;
|
|
468
|
+
case 'website':
|
|
469
|
+
await websiteCommand();
|
|
382
470
|
break;
|
|
383
471
|
case 'check':
|
|
384
472
|
await checkCommand();
|
|
385
473
|
break;
|
|
386
|
-
case 'deploy':
|
|
387
|
-
const target = await clarifyDeployTarget();
|
|
388
|
-
if (target) {
|
|
389
|
-
await deployCommand({ preview: target === 'preview' });
|
|
390
|
-
}
|
|
391
|
-
break;
|
|
392
474
|
case 'fix':
|
|
393
475
|
await fixCommand();
|
|
394
476
|
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
477
|
default:
|
|
420
|
-
//
|
|
478
|
+
// Fall back to code command
|
|
421
479
|
await codeCommand(input);
|
|
422
480
|
}
|
|
423
481
|
}
|
|
424
482
|
|
|
425
|
-
//
|
|
483
|
+
// ============================================================================
|
|
484
|
+
// ENTRY POINT
|
|
485
|
+
// ============================================================================
|
|
486
|
+
|
|
426
487
|
const args = process.argv.slice(2);
|
|
427
488
|
|
|
428
489
|
if (args.length === 0) {
|
|
429
|
-
//
|
|
490
|
+
// No args - show interactive menu
|
|
430
491
|
checkForUpdates().catch(() => {});
|
|
431
|
-
|
|
432
|
-
// Show interactive menu
|
|
433
492
|
showMainMenu().catch(console.error);
|
|
434
493
|
} else if (args.length > 0 && args[0] && !args[0].startsWith('-')) {
|
|
435
494
|
// Check if it's a known command
|
|
436
495
|
const knownCommands = [
|
|
437
|
-
'setup', 'init', 'code', 'check', 'deploy', 'fix', 'generate',
|
|
496
|
+
'setup', 'init', 'code', 'check', 'deploy', 'fix', 'generate', 'gen',
|
|
438
497
|
'connect', 'status', 'gateway', 'security', 'learn', 'design',
|
|
439
|
-
'prd', 'advisors', 'migrate', '
|
|
440
|
-
'integrate', 'add', 'website', 'site', 'help'
|
|
498
|
+
'prd', 'advisors', 'dream-team', 'migrate', 'db', 'prd-maker', 'create-prd',
|
|
499
|
+
'build', 'swarm', 'integrate', 'add', 'website', 'site', 'help'
|
|
441
500
|
];
|
|
442
501
|
|
|
443
502
|
const firstArg = args[0] as string;
|