codebakers 2.2.1 → 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 +151 -216
- package/package.json +1 -1
- package/src/commands/setup.ts +2 -6
- package/src/index.ts +249 -199
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,58 +7550,73 @@ 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();
|
|
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) {
|
|
7631
7584
|
const action = await p21.select({
|
|
7632
|
-
message: "What
|
|
7633
|
-
options:
|
|
7634
|
-
{ value: "
|
|
7635
|
-
{ value: "
|
|
7636
|
-
{ value: "
|
|
7637
|
-
{ value: "
|
|
7638
|
-
{ value: "
|
|
7639
|
-
{ value: "
|
|
7640
|
-
{ value: "
|
|
7641
|
-
{ value: "
|
|
7642
|
-
{ value: "separator1", label: "\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" },
|
|
7643
|
-
{ value: "connect", label: "\u{1F517} Connect service", hint: "add integrations" },
|
|
7644
|
-
{ value: "gateway", label: "\u{1F4F1} Channel gateway", hint: "WhatsApp, Telegram, etc." },
|
|
7645
|
-
{ value: "learn", label: "\u{1F9E0} Learning settings", hint: "view what I've learned" },
|
|
7646
|
-
{ value: "security", label: "\u{1F512} Security audit", hint: "check for vulnerabilities" },
|
|
7647
|
-
{ value: "design", label: "\u{1F3A8} Design system", hint: "set profile, colors" },
|
|
7648
|
-
{ value: "separator2", label: "\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" },
|
|
7649
|
-
{ value: "new", label: "\u{1F195} Create new project" },
|
|
7650
|
-
{ value: "website", label: "\u{1F310} Website Builder", hint: "Describe \u2192 AI builds it" },
|
|
7651
|
-
{ value: "build", label: "\u{1F3D7}\uFE0F Parallel Build", hint: "3 agents from PRD (swarm)" },
|
|
7652
|
-
{ value: "prd", label: "\u{1F4C4} Build from PRD", hint: "sequential build" },
|
|
7653
|
-
{ value: "prd-maker", label: "\u270F\uFE0F Create PRD", hint: "interview \u2192 generate PRD" },
|
|
7654
|
-
{ value: "advisors", label: "\u{1F31F} Dream Team Advisors", hint: "consult with experts" },
|
|
7655
|
-
{ value: "settings", label: "\u2699\uFE0F Settings" },
|
|
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" },
|
|
7656
7595
|
{ value: "help", label: "\u2753 Help" }
|
|
7657
|
-
]
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7596
|
+
]
|
|
7597
|
+
});
|
|
7598
|
+
if (p21.isCancel(action)) {
|
|
7599
|
+
p21.cancel("Goodbye!");
|
|
7600
|
+
process.exit(0);
|
|
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" },
|
|
7670
7620
|
{ value: "settings", label: "\u2699\uFE0F Settings" },
|
|
7671
7621
|
{ value: "help", label: "\u2753 Help" }
|
|
7672
7622
|
]
|
|
@@ -7675,51 +7625,37 @@ async function showMainMenu() {
|
|
|
7675
7625
|
p21.cancel("Goodbye!");
|
|
7676
7626
|
process.exit(0);
|
|
7677
7627
|
}
|
|
7628
|
+
if (action === "divider1") {
|
|
7629
|
+
await showProjectMenu(config);
|
|
7630
|
+
return;
|
|
7631
|
+
}
|
|
7632
|
+
await handleAction(action, config);
|
|
7633
|
+
}
|
|
7634
|
+
async function handleAction(action, config) {
|
|
7678
7635
|
switch (action) {
|
|
7636
|
+
case "website":
|
|
7637
|
+
await websiteCommand();
|
|
7638
|
+
break;
|
|
7639
|
+
case "new":
|
|
7640
|
+
await initCommand();
|
|
7641
|
+
break;
|
|
7679
7642
|
case "code":
|
|
7680
7643
|
await codeCommand();
|
|
7681
7644
|
break;
|
|
7682
|
-
case "integrate":
|
|
7683
|
-
await integrateCommand();
|
|
7684
|
-
break;
|
|
7685
7645
|
case "check":
|
|
7686
7646
|
await checkCommand();
|
|
7687
7647
|
break;
|
|
7688
7648
|
case "deploy":
|
|
7689
7649
|
await deployCommand();
|
|
7690
7650
|
break;
|
|
7691
|
-
case "migrate":
|
|
7692
|
-
await migrateCommand();
|
|
7693
|
-
break;
|
|
7694
7651
|
case "fix":
|
|
7695
7652
|
await fixCommand();
|
|
7696
7653
|
break;
|
|
7697
7654
|
case "generate":
|
|
7698
7655
|
await generateCommand();
|
|
7699
7656
|
break;
|
|
7700
|
-
case "
|
|
7701
|
-
await
|
|
7702
|
-
break;
|
|
7703
|
-
case "connect":
|
|
7704
|
-
await connectCommand();
|
|
7705
|
-
break;
|
|
7706
|
-
case "gateway":
|
|
7707
|
-
await gatewayCommand();
|
|
7708
|
-
break;
|
|
7709
|
-
case "learn":
|
|
7710
|
-
await learnCommand();
|
|
7711
|
-
break;
|
|
7712
|
-
case "security":
|
|
7713
|
-
await securityCommand();
|
|
7714
|
-
break;
|
|
7715
|
-
case "design":
|
|
7716
|
-
await designCommand();
|
|
7717
|
-
break;
|
|
7718
|
-
case "new":
|
|
7719
|
-
await initCommand();
|
|
7720
|
-
break;
|
|
7721
|
-
case "website":
|
|
7722
|
-
await websiteCommand();
|
|
7657
|
+
case "integrate":
|
|
7658
|
+
await integrateCommand();
|
|
7723
7659
|
break;
|
|
7724
7660
|
case "build":
|
|
7725
7661
|
await buildCommand();
|
|
@@ -7733,6 +7669,12 @@ async function showMainMenu() {
|
|
|
7733
7669
|
case "advisors":
|
|
7734
7670
|
await advisorsCommand();
|
|
7735
7671
|
break;
|
|
7672
|
+
case "gateway":
|
|
7673
|
+
await gatewayCommand();
|
|
7674
|
+
break;
|
|
7675
|
+
case "migrate":
|
|
7676
|
+
await migrateCommand();
|
|
7677
|
+
break;
|
|
7736
7678
|
case "settings":
|
|
7737
7679
|
await setupCommand();
|
|
7738
7680
|
break;
|
|
@@ -7740,121 +7682,107 @@ async function showMainMenu() {
|
|
|
7740
7682
|
showHelp2();
|
|
7741
7683
|
break;
|
|
7742
7684
|
default:
|
|
7743
|
-
|
|
7685
|
+
console.log(chalk21.yellow("Coming soon!"));
|
|
7744
7686
|
}
|
|
7745
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
|
+
}
|
|
7746
7705
|
function showHelp2() {
|
|
7747
7706
|
console.log(boxen(`
|
|
7748
7707
|
${chalk21.bold("CodeBakers CLI v" + VERSION2)} \u2014 AI dev team that follows the rules
|
|
7749
7708
|
|
|
7750
7709
|
${chalk21.bold.cyan("Getting Started:")}
|
|
7751
|
-
${chalk21.cyan("codebakers
|
|
7752
|
-
${chalk21.cyan("codebakers
|
|
7753
|
-
${chalk21.cyan("codebakers website")} Build
|
|
7754
|
-
${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
|
|
7755
7714
|
|
|
7756
|
-
${chalk21.bold.cyan("
|
|
7715
|
+
${chalk21.bold.cyan("In a Project:")}
|
|
7757
7716
|
${chalk21.cyan("codebakers code")} Chat with AI to build features
|
|
7758
|
-
${chalk21.cyan("codebakers check")} Check code quality & patterns
|
|
7759
|
-
${chalk21.cyan("codebakers fix")} Auto-fix errors with AI
|
|
7760
7717
|
${chalk21.cyan("codebakers deploy")} Deploy to Vercel
|
|
7761
|
-
|
|
7762
|
-
${chalk21.
|
|
7763
|
-
${chalk21.cyan("codebakers integrate")} 50+ one-click integrations (Stripe, Supabase, etc.)
|
|
7764
|
-
${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
|
|
7765
7720
|
|
|
7766
7721
|
${chalk21.bold.cyan("Planning:")}
|
|
7767
|
-
${chalk21.cyan("codebakers prd-maker")} Create PRD through interview
|
|
7768
|
-
${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
|
|
7769
7725
|
|
|
7770
|
-
${chalk21.bold.cyan("
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
\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
|
|
7774
7729
|
|
|
7775
7730
|
${chalk21.bold("Docs:")} ${chalk21.dim("https://codebakers.dev/docs")}
|
|
7776
7731
|
`, { padding: 1, borderColor: "cyan", borderStyle: "round" }));
|
|
7777
7732
|
}
|
|
7778
7733
|
var program = new Command();
|
|
7779
7734
|
program.name("codebakers").description("AI dev team that follows the rules").version(VERSION2).action(showMainMenu);
|
|
7780
|
-
program.command("setup").description("Configure CodeBakers (
|
|
7781
|
-
program.command("init").description("Create a new project").option("-n, --name <
|
|
7782
|
-
program.command("code [prompt]").description("Start AI coding session").option("-w, --watch", "Watch mode
|
|
7783
|
-
program.command("check").description("Run
|
|
7784
|
-
program.command("deploy").description("Deploy to production").option("-p, --preview", "
|
|
7785
|
-
program.command("fix").description("Auto-fix
|
|
7786
|
-
program.command("generate
|
|
7787
|
-
program.command("
|
|
7788
|
-
program.command("
|
|
7789
|
-
program.command("
|
|
7790
|
-
program.command("security").description("Run security audit").
|
|
7791
|
-
program.command("learn").description("View
|
|
7792
|
-
program.command("design
|
|
7793
|
-
program.command("prd [file]").description("Build
|
|
7794
|
-
program.command("advisors").alias("dream-team").description("Consult
|
|
7795
|
-
program.command("migrate").alias("db").description("Database migrations
|
|
7796
|
-
program.command("prd-maker").alias("create-prd").description("Create
|
|
7797
|
-
program.command("build [prd-file]").alias("swarm").description("Parallel build with
|
|
7798
|
-
program.command("integrate [integration]").alias("add").description("One-click integrations (50+ services
|
|
7799
|
-
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);
|
|
7800
7756
|
async function handleNaturalLanguage(input) {
|
|
7801
7757
|
const config = new Config();
|
|
7802
|
-
console.log(chalk21.dim("\n
|
|
7758
|
+
console.log(chalk21.dim("\n Understanding your request...\n"));
|
|
7803
7759
|
const parsed = await parseNaturalLanguage(input, config);
|
|
7804
7760
|
if (!parsed) {
|
|
7805
7761
|
await codeCommand(input);
|
|
7806
7762
|
return;
|
|
7807
7763
|
}
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
}
|
|
7812
|
-
switch (clarified.command) {
|
|
7813
|
-
case "init":
|
|
7814
|
-
await initCommand();
|
|
7764
|
+
switch (parsed.command) {
|
|
7765
|
+
case "deploy":
|
|
7766
|
+
await deployCommand();
|
|
7815
7767
|
break;
|
|
7816
7768
|
case "build":
|
|
7817
|
-
await buildCommand(
|
|
7769
|
+
await buildCommand();
|
|
7818
7770
|
break;
|
|
7819
7771
|
case "code":
|
|
7820
|
-
await codeCommand(
|
|
7772
|
+
await codeCommand(input);
|
|
7773
|
+
break;
|
|
7774
|
+
case "init":
|
|
7775
|
+
await initCommand();
|
|
7776
|
+
break;
|
|
7777
|
+
case "website":
|
|
7778
|
+
await websiteCommand();
|
|
7821
7779
|
break;
|
|
7822
7780
|
case "check":
|
|
7823
7781
|
await checkCommand();
|
|
7824
7782
|
break;
|
|
7825
|
-
case "deploy":
|
|
7826
|
-
const target = await clarifyDeployTarget();
|
|
7827
|
-
if (target) {
|
|
7828
|
-
await deployCommand({ preview: target === "preview" });
|
|
7829
|
-
}
|
|
7830
|
-
break;
|
|
7831
7783
|
case "fix":
|
|
7832
7784
|
await fixCommand();
|
|
7833
7785
|
break;
|
|
7834
|
-
case "migrate":
|
|
7835
|
-
await migrateCommand();
|
|
7836
|
-
break;
|
|
7837
|
-
case "design":
|
|
7838
|
-
await designCommand();
|
|
7839
|
-
break;
|
|
7840
|
-
case "advisors":
|
|
7841
|
-
await advisorsCommand();
|
|
7842
|
-
break;
|
|
7843
|
-
case "prd-maker":
|
|
7844
|
-
await prdMakerCommand();
|
|
7845
|
-
break;
|
|
7846
|
-
case "security":
|
|
7847
|
-
await securityCommand();
|
|
7848
|
-
break;
|
|
7849
|
-
case "status":
|
|
7850
|
-
await statusCommand();
|
|
7851
|
-
break;
|
|
7852
|
-
case "setup":
|
|
7853
|
-
await setupCommand();
|
|
7854
|
-
break;
|
|
7855
|
-
case "help":
|
|
7856
|
-
showHelp2();
|
|
7857
|
-
break;
|
|
7858
7786
|
default:
|
|
7859
7787
|
await codeCommand(input);
|
|
7860
7788
|
}
|
|
@@ -7873,6 +7801,7 @@ if (args.length === 0) {
|
|
|
7873
7801
|
"deploy",
|
|
7874
7802
|
"fix",
|
|
7875
7803
|
"generate",
|
|
7804
|
+
"gen",
|
|
7876
7805
|
"connect",
|
|
7877
7806
|
"status",
|
|
7878
7807
|
"gateway",
|
|
@@ -7881,8 +7810,11 @@ if (args.length === 0) {
|
|
|
7881
7810
|
"design",
|
|
7882
7811
|
"prd",
|
|
7883
7812
|
"advisors",
|
|
7813
|
+
"dream-team",
|
|
7884
7814
|
"migrate",
|
|
7815
|
+
"db",
|
|
7885
7816
|
"prd-maker",
|
|
7817
|
+
"create-prd",
|
|
7886
7818
|
"build",
|
|
7887
7819
|
"swarm",
|
|
7888
7820
|
"integrate",
|
|
@@ -7903,3 +7835,6 @@ if (args.length === 0) {
|
|
|
7903
7835
|
} else {
|
|
7904
7836
|
program.parse();
|
|
7905
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,71 +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
|
+
}
|
|
97
|
+
|
|
98
|
+
// ============================================================================
|
|
99
|
+
// START MENU (Not in a project)
|
|
100
|
+
// ============================================================================
|
|
65
101
|
|
|
66
|
-
|
|
102
|
+
async function showStartMenu(config: Config): Promise<void> {
|
|
67
103
|
const action = await p.select({
|
|
68
|
-
message: 'What
|
|
69
|
-
options:
|
|
70
|
-
{ value: '
|
|
71
|
-
{ value: '
|
|
72
|
-
{ value: '
|
|
73
|
-
{ value: '
|
|
74
|
-
{ value: '
|
|
75
|
-
{ value: '
|
|
76
|
-
{ value: '
|
|
77
|
-
{ value: '
|
|
78
|
-
{ value: 'separator1', label: '─────────────────────────' },
|
|
79
|
-
{ value: 'connect', label: '🔗 Connect service', hint: 'add integrations' },
|
|
80
|
-
{ value: 'gateway', label: '📱 Channel gateway', hint: 'WhatsApp, Telegram, etc.' },
|
|
81
|
-
{ value: 'learn', label: '🧠 Learning settings', hint: 'view what I\'ve learned' },
|
|
82
|
-
{ value: 'security', label: '🔒 Security audit', hint: 'check for vulnerabilities' },
|
|
83
|
-
{ value: 'design', label: '🎨 Design system', hint: 'set profile, colors' },
|
|
84
|
-
{ value: 'separator2', label: '─────────────────────────' },
|
|
85
|
-
{ value: 'new', label: '🆕 Create new project' },
|
|
86
|
-
{ value: 'website', label: '🌐 Website Builder', hint: 'Describe → AI builds it' },
|
|
87
|
-
{ value: 'build', label: '🏗️ Parallel Build', hint: '3 agents from PRD (swarm)' },
|
|
88
|
-
{ value: 'prd', label: '📄 Build from PRD', hint: 'sequential build' },
|
|
89
|
-
{ value: 'prd-maker', label: '✏️ Create PRD', hint: 'interview → generate PRD' },
|
|
90
|
-
{ value: 'advisors', label: '🌟 Dream Team Advisors', hint: 'consult with experts' },
|
|
91
|
-
{ value: 'settings', label: '⚙️ Settings' },
|
|
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' },
|
|
92
114
|
{ value: 'help', label: '❓ Help' },
|
|
93
|
-
]
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
115
|
+
],
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
if (p.isCancel(action)) {
|
|
119
|
+
p.cancel('Goodbye!');
|
|
120
|
+
process.exit(0);
|
|
121
|
+
}
|
|
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> {
|
|
137
|
+
const action = await p.select({
|
|
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' },
|
|
106
148
|
{ value: 'settings', label: '⚙️ Settings' },
|
|
107
149
|
{ value: 'help', label: '❓ Help' },
|
|
108
|
-
]
|
|
150
|
+
],
|
|
109
151
|
});
|
|
110
152
|
|
|
111
153
|
if (p.isCancel(action)) {
|
|
@@ -113,52 +155,44 @@ async function showMainMenu(): Promise<void> {
|
|
|
113
155
|
process.exit(0);
|
|
114
156
|
}
|
|
115
157
|
|
|
116
|
-
// 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> {
|
|
117
172
|
switch (action) {
|
|
173
|
+
case 'website':
|
|
174
|
+
await websiteCommand();
|
|
175
|
+
break;
|
|
176
|
+
case 'new':
|
|
177
|
+
await initCommand();
|
|
178
|
+
break;
|
|
118
179
|
case 'code':
|
|
119
180
|
await codeCommand();
|
|
120
181
|
break;
|
|
121
|
-
case 'integrate':
|
|
122
|
-
await integrateCommand();
|
|
123
|
-
break;
|
|
124
182
|
case 'check':
|
|
125
183
|
await checkCommand();
|
|
126
184
|
break;
|
|
127
185
|
case 'deploy':
|
|
128
186
|
await deployCommand();
|
|
129
187
|
break;
|
|
130
|
-
case 'migrate':
|
|
131
|
-
await migrateCommand();
|
|
132
|
-
break;
|
|
133
188
|
case 'fix':
|
|
134
189
|
await fixCommand();
|
|
135
190
|
break;
|
|
136
191
|
case 'generate':
|
|
137
192
|
await generateCommand();
|
|
138
193
|
break;
|
|
139
|
-
case '
|
|
140
|
-
await
|
|
141
|
-
break;
|
|
142
|
-
case 'connect':
|
|
143
|
-
await connectCommand();
|
|
144
|
-
break;
|
|
145
|
-
case 'gateway':
|
|
146
|
-
await gatewayCommand();
|
|
147
|
-
break;
|
|
148
|
-
case 'learn':
|
|
149
|
-
await learnCommand();
|
|
150
|
-
break;
|
|
151
|
-
case 'security':
|
|
152
|
-
await securityCommand();
|
|
153
|
-
break;
|
|
154
|
-
case 'design':
|
|
155
|
-
await designCommand();
|
|
156
|
-
break;
|
|
157
|
-
case 'new':
|
|
158
|
-
await initCommand();
|
|
159
|
-
break;
|
|
160
|
-
case 'website':
|
|
161
|
-
await websiteCommand();
|
|
194
|
+
case 'integrate':
|
|
195
|
+
await integrateCommand();
|
|
162
196
|
break;
|
|
163
197
|
case 'build':
|
|
164
198
|
await buildCommand();
|
|
@@ -172,6 +206,12 @@ async function showMainMenu(): Promise<void> {
|
|
|
172
206
|
case 'advisors':
|
|
173
207
|
await advisorsCommand();
|
|
174
208
|
break;
|
|
209
|
+
case 'gateway':
|
|
210
|
+
await gatewayCommand();
|
|
211
|
+
break;
|
|
212
|
+
case 'migrate':
|
|
213
|
+
await migrateCommand();
|
|
214
|
+
break;
|
|
175
215
|
case 'settings':
|
|
176
216
|
await setupCommand();
|
|
177
217
|
break;
|
|
@@ -179,45 +219,89 @@ async function showMainMenu(): Promise<void> {
|
|
|
179
219
|
showHelp();
|
|
180
220
|
break;
|
|
181
221
|
default:
|
|
182
|
-
|
|
183
|
-
await showMainMenu();
|
|
222
|
+
console.log(chalk.yellow('Coming soon!'));
|
|
184
223
|
}
|
|
185
224
|
}
|
|
186
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
|
+
|
|
187
272
|
function showHelp(): void {
|
|
188
273
|
console.log(boxen(`
|
|
189
274
|
${chalk.bold('CodeBakers CLI v' + VERSION)} — AI dev team that follows the rules
|
|
190
275
|
|
|
191
276
|
${chalk.bold.cyan('Getting Started:')}
|
|
192
|
-
${chalk.cyan('codebakers
|
|
193
|
-
${chalk.cyan('codebakers
|
|
194
|
-
${chalk.cyan('codebakers website')} Build
|
|
195
|
-
${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
|
|
196
281
|
|
|
197
|
-
${chalk.bold.cyan('
|
|
282
|
+
${chalk.bold.cyan('In a Project:')}
|
|
198
283
|
${chalk.cyan('codebakers code')} Chat with AI to build features
|
|
199
|
-
${chalk.cyan('codebakers check')} Check code quality & patterns
|
|
200
|
-
${chalk.cyan('codebakers fix')} Auto-fix errors with AI
|
|
201
284
|
${chalk.cyan('codebakers deploy')} Deploy to Vercel
|
|
202
|
-
|
|
203
|
-
${chalk.
|
|
204
|
-
${chalk.cyan('codebakers integrate')} 50+ one-click integrations (Stripe, Supabase, etc.)
|
|
205
|
-
${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
|
|
206
287
|
|
|
207
288
|
${chalk.bold.cyan('Planning:')}
|
|
208
|
-
${chalk.cyan('codebakers prd-maker')} Create PRD through interview
|
|
209
|
-
${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
|
|
210
292
|
|
|
211
|
-
${chalk.bold.cyan('
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
• 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
|
|
215
296
|
|
|
216
297
|
${chalk.bold('Docs:')} ${chalk.dim('https://codebakers.dev/docs')}
|
|
217
298
|
`, { padding: 1, borderColor: 'cyan', borderStyle: 'round' }));
|
|
218
299
|
}
|
|
219
300
|
|
|
220
|
-
//
|
|
301
|
+
// ============================================================================
|
|
302
|
+
// CLI COMMANDS (Commander)
|
|
303
|
+
// ============================================================================
|
|
304
|
+
|
|
221
305
|
const program = new Command();
|
|
222
306
|
|
|
223
307
|
program
|
|
@@ -228,225 +312,191 @@ program
|
|
|
228
312
|
|
|
229
313
|
program
|
|
230
314
|
.command('setup')
|
|
231
|
-
.description('Configure CodeBakers (
|
|
315
|
+
.description('Configure CodeBakers (API keys)')
|
|
232
316
|
.action(setupCommand);
|
|
233
317
|
|
|
234
318
|
program
|
|
235
319
|
.command('init')
|
|
236
320
|
.description('Create a new project')
|
|
237
|
-
.option('-n, --name <
|
|
238
|
-
.option('-t, --template <
|
|
239
|
-
.option('--no-git', 'Skip GitHub repo creation')
|
|
240
|
-
.option('--no-vercel', 'Skip Vercel deployment')
|
|
241
|
-
.option('--no-supabase', 'Skip Supabase setup')
|
|
321
|
+
.option('-n, --name <n>', 'Project name')
|
|
322
|
+
.option('-t, --template <t>', 'Template')
|
|
242
323
|
.action(initCommand);
|
|
243
324
|
|
|
244
325
|
program
|
|
245
326
|
.command('code [prompt]')
|
|
246
327
|
.description('Start AI coding session')
|
|
247
|
-
.option('-w, --watch', 'Watch mode
|
|
328
|
+
.option('-w, --watch', 'Watch mode')
|
|
248
329
|
.action(codeCommand);
|
|
249
330
|
|
|
250
331
|
program
|
|
251
332
|
.command('check')
|
|
252
|
-
.description('Run
|
|
253
|
-
.option('-f, --fix', 'Auto-fix violations')
|
|
254
|
-
.option('--watch', 'Watch mode')
|
|
333
|
+
.description('Run code quality checks')
|
|
255
334
|
.action(checkCommand);
|
|
256
335
|
|
|
257
336
|
program
|
|
258
337
|
.command('deploy')
|
|
259
338
|
.description('Deploy to production')
|
|
260
|
-
.option('-p, --preview', '
|
|
261
|
-
.option('--no-check', 'Skip
|
|
339
|
+
.option('-p, --preview', 'Preview deployment')
|
|
340
|
+
.option('--no-check', 'Skip quality check')
|
|
262
341
|
.action(deployCommand);
|
|
263
342
|
|
|
264
343
|
program
|
|
265
344
|
.command('fix')
|
|
266
|
-
.description('Auto-fix
|
|
267
|
-
.option('--auto', 'Fix without asking')
|
|
345
|
+
.description('Auto-fix errors with AI')
|
|
268
346
|
.action(fixCommand);
|
|
269
347
|
|
|
270
348
|
program
|
|
271
|
-
.command('generate
|
|
272
|
-
.alias('
|
|
273
|
-
.description('Generate components, pages,
|
|
274
|
-
.option('-n, --name <name>', 'Name of the generated item')
|
|
349
|
+
.command('generate')
|
|
350
|
+
.alias('gen')
|
|
351
|
+
.description('Generate components, pages, etc.')
|
|
275
352
|
.action(generateCommand);
|
|
276
353
|
|
|
277
354
|
program
|
|
278
|
-
.command('
|
|
279
|
-
.description('
|
|
355
|
+
.command('status')
|
|
356
|
+
.description('View project status')
|
|
357
|
+
.action(statusCommand);
|
|
358
|
+
|
|
359
|
+
program
|
|
360
|
+
.command('connect')
|
|
361
|
+
.description('Connect external services')
|
|
280
362
|
.action(connectCommand);
|
|
281
363
|
|
|
282
364
|
program
|
|
283
365
|
.command('gateway')
|
|
284
|
-
.description('Manage messaging
|
|
285
|
-
.option('--start', 'Start
|
|
286
|
-
.option('--stop', 'Stop
|
|
287
|
-
.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')
|
|
288
370
|
.action(gatewayCommand);
|
|
289
371
|
|
|
290
|
-
program
|
|
291
|
-
.command('status')
|
|
292
|
-
.description('View project status and health')
|
|
293
|
-
.option('-a, --all', 'Show all projects')
|
|
294
|
-
.action(statusCommand);
|
|
295
|
-
|
|
296
372
|
program
|
|
297
373
|
.command('security')
|
|
298
374
|
.description('Run security audit')
|
|
299
|
-
.option('--fix', 'Auto-fix security issues')
|
|
300
375
|
.action(securityCommand);
|
|
301
376
|
|
|
302
377
|
program
|
|
303
378
|
.command('learn')
|
|
304
|
-
.description('View
|
|
305
|
-
.option('--forget <item>', 'Forget a learned preference')
|
|
306
|
-
.option('--reset', 'Reset all learning')
|
|
307
|
-
.option('--export', 'Export learned patterns')
|
|
379
|
+
.description('View/manage what CodeBakers has learned')
|
|
308
380
|
.action(learnCommand);
|
|
309
381
|
|
|
310
382
|
program
|
|
311
|
-
.command('design
|
|
312
|
-
.description('Manage design system
|
|
383
|
+
.command('design')
|
|
384
|
+
.description('Manage design system')
|
|
313
385
|
.action(designCommand);
|
|
314
386
|
|
|
315
387
|
program
|
|
316
388
|
.command('prd [file]')
|
|
317
|
-
.description('Build
|
|
389
|
+
.description('Build project from PRD')
|
|
318
390
|
.action(prdCommand);
|
|
319
391
|
|
|
320
392
|
program
|
|
321
393
|
.command('advisors')
|
|
322
394
|
.alias('dream-team')
|
|
323
|
-
.description('Consult
|
|
395
|
+
.description('Consult AI expert advisors')
|
|
324
396
|
.action(advisorsCommand);
|
|
325
397
|
|
|
326
398
|
program
|
|
327
399
|
.command('migrate')
|
|
328
400
|
.alias('db')
|
|
329
|
-
.description('Database migrations
|
|
330
|
-
.option('--push', 'Push migrations
|
|
331
|
-
.option('--generate', 'Generate
|
|
332
|
-
.option('--status', 'Check
|
|
401
|
+
.description('Database migrations')
|
|
402
|
+
.option('--push', 'Push migrations')
|
|
403
|
+
.option('--generate', 'Generate migration')
|
|
404
|
+
.option('--status', 'Check status')
|
|
333
405
|
.action(migrateCommand);
|
|
334
406
|
|
|
335
407
|
program
|
|
336
408
|
.command('prd-maker')
|
|
337
409
|
.alias('create-prd')
|
|
338
|
-
.description('Create
|
|
410
|
+
.description('Create PRD through guided interview')
|
|
339
411
|
.action(prdMakerCommand);
|
|
340
412
|
|
|
341
413
|
program
|
|
342
414
|
.command('build [prd-file]')
|
|
343
415
|
.alias('swarm')
|
|
344
|
-
.description('Parallel build with
|
|
345
|
-
.option('--sequential', 'Disable parallel
|
|
416
|
+
.description('Parallel build with AI agents')
|
|
417
|
+
.option('--sequential', 'Disable parallel')
|
|
346
418
|
.action(buildCommand);
|
|
347
419
|
|
|
348
420
|
program
|
|
349
421
|
.command('integrate [integration]')
|
|
350
422
|
.alias('add')
|
|
351
|
-
.description('One-click integrations (50+ services
|
|
423
|
+
.description('One-click integrations (50+ services)')
|
|
352
424
|
.action(integrateCommand);
|
|
353
425
|
|
|
354
426
|
program
|
|
355
427
|
.command('website')
|
|
356
428
|
.alias('site')
|
|
357
|
-
.description('Build
|
|
429
|
+
.description('Build website by describing it')
|
|
358
430
|
.action(websiteCommand);
|
|
359
431
|
|
|
360
|
-
|
|
432
|
+
program
|
|
433
|
+
.command('help')
|
|
434
|
+
.description('Show help')
|
|
435
|
+
.action(showHelp);
|
|
436
|
+
|
|
437
|
+
// ============================================================================
|
|
438
|
+
// NATURAL LANGUAGE HANDLER
|
|
439
|
+
// ============================================================================
|
|
440
|
+
|
|
361
441
|
async function handleNaturalLanguage(input: string): Promise<void> {
|
|
362
442
|
const config = new Config();
|
|
363
443
|
|
|
364
|
-
console.log(chalk.dim('\n
|
|
444
|
+
console.log(chalk.dim('\n Understanding your request...\n'));
|
|
365
445
|
|
|
366
446
|
const parsed = await parseNaturalLanguage(input, config);
|
|
367
447
|
|
|
368
448
|
if (!parsed) {
|
|
369
|
-
// Fall back to code command
|
|
449
|
+
// Fall back to code command with the input as prompt
|
|
370
450
|
await codeCommand(input);
|
|
371
451
|
return;
|
|
372
452
|
}
|
|
373
453
|
|
|
374
|
-
//
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
// Execute the command
|
|
382
|
-
switch (clarified.command) {
|
|
383
|
-
case 'init':
|
|
384
|
-
await initCommand();
|
|
454
|
+
// Handle recognized commands
|
|
455
|
+
switch (parsed.command) {
|
|
456
|
+
case 'deploy':
|
|
457
|
+
await deployCommand();
|
|
385
458
|
break;
|
|
386
459
|
case 'build':
|
|
387
|
-
await buildCommand(
|
|
460
|
+
await buildCommand();
|
|
388
461
|
break;
|
|
389
462
|
case 'code':
|
|
390
|
-
await codeCommand(
|
|
463
|
+
await codeCommand(input);
|
|
464
|
+
break;
|
|
465
|
+
case 'init':
|
|
466
|
+
await initCommand();
|
|
467
|
+
break;
|
|
468
|
+
case 'website':
|
|
469
|
+
await websiteCommand();
|
|
391
470
|
break;
|
|
392
471
|
case 'check':
|
|
393
472
|
await checkCommand();
|
|
394
473
|
break;
|
|
395
|
-
case 'deploy':
|
|
396
|
-
const target = await clarifyDeployTarget();
|
|
397
|
-
if (target) {
|
|
398
|
-
await deployCommand({ preview: target === 'preview' });
|
|
399
|
-
}
|
|
400
|
-
break;
|
|
401
474
|
case 'fix':
|
|
402
475
|
await fixCommand();
|
|
403
476
|
break;
|
|
404
|
-
case 'migrate':
|
|
405
|
-
await migrateCommand();
|
|
406
|
-
break;
|
|
407
|
-
case 'design':
|
|
408
|
-
await designCommand();
|
|
409
|
-
break;
|
|
410
|
-
case 'advisors':
|
|
411
|
-
await advisorsCommand();
|
|
412
|
-
break;
|
|
413
|
-
case 'prd-maker':
|
|
414
|
-
await prdMakerCommand();
|
|
415
|
-
break;
|
|
416
|
-
case 'security':
|
|
417
|
-
await securityCommand();
|
|
418
|
-
break;
|
|
419
|
-
case 'status':
|
|
420
|
-
await statusCommand();
|
|
421
|
-
break;
|
|
422
|
-
case 'setup':
|
|
423
|
-
await setupCommand();
|
|
424
|
-
break;
|
|
425
|
-
case 'help':
|
|
426
|
-
showHelp();
|
|
427
|
-
break;
|
|
428
477
|
default:
|
|
429
|
-
//
|
|
478
|
+
// Fall back to code command
|
|
430
479
|
await codeCommand(input);
|
|
431
480
|
}
|
|
432
481
|
}
|
|
433
482
|
|
|
434
|
-
//
|
|
483
|
+
// ============================================================================
|
|
484
|
+
// ENTRY POINT
|
|
485
|
+
// ============================================================================
|
|
486
|
+
|
|
435
487
|
const args = process.argv.slice(2);
|
|
436
488
|
|
|
437
489
|
if (args.length === 0) {
|
|
438
|
-
//
|
|
490
|
+
// No args - show interactive menu
|
|
439
491
|
checkForUpdates().catch(() => {});
|
|
440
|
-
|
|
441
|
-
// Show interactive menu
|
|
442
492
|
showMainMenu().catch(console.error);
|
|
443
493
|
} else if (args.length > 0 && args[0] && !args[0].startsWith('-')) {
|
|
444
494
|
// Check if it's a known command
|
|
445
495
|
const knownCommands = [
|
|
446
|
-
'setup', 'init', 'code', 'check', 'deploy', 'fix', 'generate',
|
|
496
|
+
'setup', 'init', 'code', 'check', 'deploy', 'fix', 'generate', 'gen',
|
|
447
497
|
'connect', 'status', 'gateway', 'security', 'learn', 'design',
|
|
448
|
-
'prd', 'advisors', 'migrate', '
|
|
449
|
-
'integrate', 'add', 'website', 'site', 'help'
|
|
498
|
+
'prd', 'advisors', 'dream-team', 'migrate', 'db', 'prd-maker', 'create-prd',
|
|
499
|
+
'build', 'swarm', 'integrate', 'add', 'website', 'site', 'help'
|
|
450
500
|
];
|
|
451
501
|
|
|
452
502
|
const firstArg = args[0] as string;
|