codebakers 2.2.0 → 2.2.2
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/advisors-GGUCFS4E.js +7 -0
- package/dist/{chunk-RCC7FYEU.js → chunk-ASIJIQYC.js} +21 -20
- package/dist/{chunk-YGVDLNXY.js → chunk-ND6T4UDY.js} +1 -1
- package/dist/{chunk-FWQNLNTI.js → chunk-YUSDTJD6.js} +1 -1
- package/dist/index.js +30 -47
- package/dist/prd-AIEY63YY.js +7 -0
- package/package.json +1 -1
- package/src/index.ts +33 -42
- package/src/utils/config.ts +24 -23
- package/dist/advisors-J3S64IZK.js +0 -7
- package/dist/prd-HBUCYLVG.js +0 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/utils/config.ts
|
|
2
2
|
import Conf from "conf";
|
|
3
|
-
import
|
|
3
|
+
import fsExtra from "fs-extra";
|
|
4
|
+
import { existsSync, readFileSync, appendFileSync } from "fs";
|
|
4
5
|
import * as path from "path";
|
|
5
6
|
import os from "os";
|
|
6
7
|
import { z } from "zod";
|
|
@@ -99,10 +100,10 @@ var Config = class {
|
|
|
99
100
|
configDir;
|
|
100
101
|
constructor() {
|
|
101
102
|
this.configDir = path.join(os.homedir(), ".codebakers");
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
fsExtra.ensureDirSync(this.configDir);
|
|
104
|
+
fsExtra.ensureDirSync(path.join(this.configDir, "patterns"));
|
|
105
|
+
fsExtra.ensureDirSync(path.join(this.configDir, "templates"));
|
|
106
|
+
fsExtra.ensureDirSync(path.join(this.configDir, "learning"));
|
|
106
107
|
this.conf = new Conf({
|
|
107
108
|
projectName: "codebakers",
|
|
108
109
|
cwd: this.configDir,
|
|
@@ -126,7 +127,7 @@ var Config = class {
|
|
|
126
127
|
const cwd = process.cwd();
|
|
127
128
|
const codebakersDir = path.join(cwd, ".codebakers");
|
|
128
129
|
const claudeFile = path.join(cwd, "CLAUDE.md");
|
|
129
|
-
if (
|
|
130
|
+
if (existsSync(codebakersDir) || existsSync(claudeFile)) {
|
|
130
131
|
return true;
|
|
131
132
|
}
|
|
132
133
|
const projectIndicators = [
|
|
@@ -140,7 +141,7 @@ var Config = class {
|
|
|
140
141
|
"astro.config.mjs"
|
|
141
142
|
];
|
|
142
143
|
const hasProjectFile = projectIndicators.some(
|
|
143
|
-
(file) =>
|
|
144
|
+
(file) => existsSync(path.join(cwd, file))
|
|
144
145
|
);
|
|
145
146
|
if (hasProjectFile) {
|
|
146
147
|
this.autoInitExisting(cwd);
|
|
@@ -153,18 +154,18 @@ var Config = class {
|
|
|
153
154
|
try {
|
|
154
155
|
let framework = "unknown";
|
|
155
156
|
let ui = "unknown";
|
|
156
|
-
if (
|
|
157
|
+
if (existsSync(path.join(cwd, "next.config.js")) || existsSync(path.join(cwd, "next.config.mjs")) || existsSync(path.join(cwd, "next.config.ts"))) {
|
|
157
158
|
framework = "nextjs";
|
|
158
|
-
} else if (
|
|
159
|
+
} else if (existsSync(path.join(cwd, "vite.config.ts")) || existsSync(path.join(cwd, "vite.config.js"))) {
|
|
159
160
|
framework = "vite";
|
|
160
|
-
} else if (
|
|
161
|
+
} else if (existsSync(path.join(cwd, "remix.config.js"))) {
|
|
161
162
|
framework = "remix";
|
|
162
|
-
} else if (
|
|
163
|
+
} else if (existsSync(path.join(cwd, "astro.config.mjs"))) {
|
|
163
164
|
framework = "astro";
|
|
164
165
|
}
|
|
165
166
|
const pkgPath = path.join(cwd, "package.json");
|
|
166
|
-
if (
|
|
167
|
-
const pkg =
|
|
167
|
+
if (existsSync(pkgPath)) {
|
|
168
|
+
const pkg = fsExtra.readJsonSync(pkgPath);
|
|
168
169
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
169
170
|
if (deps["@shadcn/ui"] || deps["class-variance-authority"]) {
|
|
170
171
|
ui = "shadcn";
|
|
@@ -177,7 +178,7 @@ var Config = class {
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
const configDir = path.join(cwd, ".codebakers");
|
|
180
|
-
|
|
181
|
+
fsExtra.ensureDirSync(configDir);
|
|
181
182
|
const config = {
|
|
182
183
|
name: path.basename(cwd),
|
|
183
184
|
framework,
|
|
@@ -185,12 +186,12 @@ var Config = class {
|
|
|
185
186
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
186
187
|
autoDetected: true
|
|
187
188
|
};
|
|
188
|
-
|
|
189
|
+
fsExtra.writeJsonSync(path.join(configDir, "config.json"), config, { spaces: 2 });
|
|
189
190
|
const gitignorePath = path.join(cwd, ".gitignore");
|
|
190
|
-
if (
|
|
191
|
-
const gitignore =
|
|
191
|
+
if (existsSync(gitignorePath)) {
|
|
192
|
+
const gitignore = readFileSync(gitignorePath, "utf-8");
|
|
192
193
|
if (!gitignore.includes(".codebakers")) {
|
|
193
|
-
|
|
194
|
+
appendFileSync(gitignorePath, "\n# CodeBakers\n.codebakers/\n");
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
} catch {
|
|
@@ -200,8 +201,8 @@ var Config = class {
|
|
|
200
201
|
getProjectConfig() {
|
|
201
202
|
const cwd = process.cwd();
|
|
202
203
|
const configPath = path.join(cwd, ".codebakers", "config.json");
|
|
203
|
-
if (
|
|
204
|
-
return
|
|
204
|
+
if (existsSync(configPath)) {
|
|
205
|
+
return fsExtra.readJsonSync(configPath);
|
|
205
206
|
}
|
|
206
207
|
return null;
|
|
207
208
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
prdCommand
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ND6T4UDY.js";
|
|
5
5
|
import {
|
|
6
6
|
advisorsCommand
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YUSDTJD6.js";
|
|
8
8
|
import {
|
|
9
9
|
Config
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ASIJIQYC.js";
|
|
11
11
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
import { Command } from "commander";
|
|
@@ -4967,10 +4967,10 @@ async function prdMakerCommand() {
|
|
|
4967
4967
|
return;
|
|
4968
4968
|
}
|
|
4969
4969
|
if (nextStep === "build") {
|
|
4970
|
-
const { prdCommand: prdCommand2 } = await import("./prd-
|
|
4970
|
+
const { prdCommand: prdCommand2 } = await import("./prd-AIEY63YY.js");
|
|
4971
4971
|
await prdCommand2(filepath);
|
|
4972
4972
|
} else if (nextStep === "advisors") {
|
|
4973
|
-
const { advisorsCommand: advisorsCommand2 } = await import("./advisors-
|
|
4973
|
+
const { advisorsCommand: advisorsCommand2 } = await import("./advisors-GGUCFS4E.js");
|
|
4974
4974
|
await advisorsCommand2();
|
|
4975
4975
|
}
|
|
4976
4976
|
}
|
|
@@ -7604,7 +7604,7 @@ async function clarifyDeployTarget() {
|
|
|
7604
7604
|
}
|
|
7605
7605
|
|
|
7606
7606
|
// src/index.ts
|
|
7607
|
-
var VERSION2 = "2.2.
|
|
7607
|
+
var VERSION2 = "2.2.2";
|
|
7608
7608
|
var logo = `
|
|
7609
7609
|
\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
7610
|
\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
|
|
@@ -7628,48 +7628,31 @@ async function showMainMenu() {
|
|
|
7628
7628
|
return;
|
|
7629
7629
|
}
|
|
7630
7630
|
const inProject = config.isInProject();
|
|
7631
|
+
const menuOptions = [];
|
|
7632
|
+
menuOptions.push({ value: "new", label: "\u{1F195} Create new project" });
|
|
7633
|
+
menuOptions.push({ value: "website", label: "\u{1F310} Website Builder", hint: "Describe \u2192 AI builds it" });
|
|
7634
|
+
menuOptions.push({ value: "build", label: "\u{1F3D7}\uFE0F Parallel Build", hint: "3 agents from PRD" });
|
|
7635
|
+
menuOptions.push({ value: "prd", label: "\u{1F4C4} Build from PRD", hint: "sequential build" });
|
|
7636
|
+
menuOptions.push({ value: "prd-maker", label: "\u270F\uFE0F Create PRD", hint: "interview \u2192 generate PRD" });
|
|
7637
|
+
menuOptions.push({ value: "advisors", label: "\u{1F31F} Dream Team Advisors", hint: "consult with experts" });
|
|
7638
|
+
if (inProject) {
|
|
7639
|
+
menuOptions.push({ value: "separator1", label: "\u2500\u2500\u2500\u2500\u2500 Current Project \u2500\u2500\u2500\u2500\u2500" });
|
|
7640
|
+
menuOptions.push({ value: "code", label: "\u{1F4AC} Code with AI", hint: "build features, fix bugs" });
|
|
7641
|
+
menuOptions.push({ value: "check", label: "\u{1F50D} Check code quality", hint: "run pattern enforcement" });
|
|
7642
|
+
menuOptions.push({ value: "deploy", label: "\u{1F680} Deploy", hint: "deploy to Vercel" });
|
|
7643
|
+
menuOptions.push({ value: "fix", label: "\u{1F527} Fix errors", hint: "auto-fix with AI" });
|
|
7644
|
+
menuOptions.push({ value: "generate", label: "\u26A1 Generate", hint: "scaffold components, pages" });
|
|
7645
|
+
menuOptions.push({ value: "migrate", label: "\u{1F5C4}\uFE0F Database migrations", hint: "push, generate, status" });
|
|
7646
|
+
}
|
|
7647
|
+
menuOptions.push({ value: "separator2", label: "\u2500\u2500\u2500\u2500\u2500 Tools & Settings \u2500\u2500\u2500\u2500\u2500" });
|
|
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" });
|
|
7631
7653
|
const action = await p21.select({
|
|
7632
|
-
message: "What do you want to do?
|
|
7633
|
-
options:
|
|
7634
|
-
{ value: "code", label: "\u{1F4AC} Code with AI", hint: "build features, fix bugs" },
|
|
7635
|
-
{ value: "integrate", label: "\u{1F50C} One-Click Integrations", hint: "50+ services, browser auth" },
|
|
7636
|
-
{ value: "check", label: "\u{1F50D} Check code quality", hint: "run pattern enforcement" },
|
|
7637
|
-
{ value: "deploy", label: "\u{1F680} Deploy", hint: "deploy to Vercel" },
|
|
7638
|
-
{ value: "migrate", label: "\u{1F5C4}\uFE0F Database migrations", hint: "push, generate, status" },
|
|
7639
|
-
{ value: "fix", label: "\u{1F527} Fix errors", hint: "auto-fix build/deploy errors" },
|
|
7640
|
-
{ value: "generate", label: "\u26A1 Generate", hint: "scaffold components, pages" },
|
|
7641
|
-
{ value: "status", label: "\u{1F4CA} Project status", hint: "view project health" },
|
|
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" },
|
|
7656
|
-
{ value: "help", label: "\u2753 Help" }
|
|
7657
|
-
] : [
|
|
7658
|
-
{ value: "new", label: "\u{1F195} Create new project" },
|
|
7659
|
-
{ value: "website", label: "\u{1F310} Website Builder", hint: "Describe \u2192 AI builds it" },
|
|
7660
|
-
{ value: "build", label: "\u{1F3D7}\uFE0F Parallel Build", hint: "3 agents from PRD (swarm)" },
|
|
7661
|
-
{ value: "prd", label: "\u{1F4C4} Build from PRD", hint: "sequential build" },
|
|
7662
|
-
{ value: "prd-maker", label: "\u270F\uFE0F Create PRD", hint: "interview \u2192 generate PRD" },
|
|
7663
|
-
{ value: "advisors", label: "\u{1F31F} Dream Team Advisors", hint: "consult with experts" },
|
|
7664
|
-
{ value: "open", label: "\u{1F4C2} Open existing project" },
|
|
7665
|
-
{ value: "status", label: "\u{1F4CA} View all projects" },
|
|
7666
|
-
{ 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" },
|
|
7667
|
-
{ value: "connect", label: "\u{1F517} Connect service" },
|
|
7668
|
-
{ value: "gateway", label: "\u{1F4F1} Channel gateway", hint: "WhatsApp, Telegram, etc." },
|
|
7669
|
-
{ value: "learn", label: "\u{1F9E0} Learning settings" },
|
|
7670
|
-
{ value: "settings", label: "\u2699\uFE0F Settings" },
|
|
7671
|
-
{ value: "help", label: "\u2753 Help" }
|
|
7672
|
-
]
|
|
7654
|
+
message: "What do you want to do?",
|
|
7655
|
+
options: menuOptions
|
|
7673
7656
|
});
|
|
7674
7657
|
if (p21.isCancel(action)) {
|
|
7675
7658
|
p21.cancel("Goodbye!");
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -29,7 +29,7 @@ import { integrateCommand, INTEGRATIONS } from './commands/integrate.js';
|
|
|
29
29
|
import { websiteCommand } from './commands/website.js';
|
|
30
30
|
import { parseNaturalLanguage, clarifyCommand, clarifyDeployTarget } from './utils/nlp.js';
|
|
31
31
|
|
|
32
|
-
const VERSION = '2.2.
|
|
32
|
+
const VERSION = '2.2.2';
|
|
33
33
|
|
|
34
34
|
// ASCII art logo
|
|
35
35
|
const logo = `
|
|
@@ -63,49 +63,40 @@ async function showMainMenu(): Promise<void> {
|
|
|
63
63
|
// Check if in a project directory
|
|
64
64
|
const inProject = config.isInProject();
|
|
65
65
|
|
|
66
|
+
// Build menu options based on context
|
|
67
|
+
const menuOptions = [];
|
|
68
|
+
|
|
69
|
+
// Always show these creation options at top
|
|
70
|
+
menuOptions.push({ value: 'new', label: '🆕 Create new project' });
|
|
71
|
+
menuOptions.push({ value: 'website', label: '🌐 Website Builder', hint: 'Describe → AI builds it' });
|
|
72
|
+
menuOptions.push({ value: 'build', label: '🏗️ Parallel Build', hint: '3 agents from PRD' });
|
|
73
|
+
menuOptions.push({ value: 'prd', label: '📄 Build from PRD', hint: 'sequential build' });
|
|
74
|
+
menuOptions.push({ value: 'prd-maker', label: '✏️ Create PRD', hint: 'interview → generate PRD' });
|
|
75
|
+
menuOptions.push({ value: 'advisors', label: '🌟 Dream Team Advisors', hint: 'consult with experts' });
|
|
76
|
+
|
|
77
|
+
// If in a project, show project-specific options
|
|
78
|
+
if (inProject) {
|
|
79
|
+
menuOptions.push({ value: 'separator1', label: '───── Current Project ─────' });
|
|
80
|
+
menuOptions.push({ value: 'code', label: '💬 Code with AI', hint: 'build features, fix bugs' });
|
|
81
|
+
menuOptions.push({ value: 'check', label: '🔍 Check code quality', hint: 'run pattern enforcement' });
|
|
82
|
+
menuOptions.push({ value: 'deploy', label: '🚀 Deploy', hint: 'deploy to Vercel' });
|
|
83
|
+
menuOptions.push({ value: 'fix', label: '🔧 Fix errors', hint: 'auto-fix with AI' });
|
|
84
|
+
menuOptions.push({ value: 'generate', label: '⚡ Generate', hint: 'scaffold components, pages' });
|
|
85
|
+
menuOptions.push({ value: 'migrate', label: '🗄️ Database migrations', hint: 'push, generate, status' });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Always show these
|
|
89
|
+
menuOptions.push({ value: 'separator2', label: '───── Tools & Settings ─────' });
|
|
90
|
+
menuOptions.push({ value: 'integrate', label: '🔌 One-Click Integrations', hint: '50+ services' });
|
|
91
|
+
menuOptions.push({ value: 'gateway', label: '📱 Channel gateway', hint: 'WhatsApp, Telegram, etc.' });
|
|
92
|
+
menuOptions.push({ value: 'connect', label: '🔗 Connect service', hint: 'API keys' });
|
|
93
|
+
menuOptions.push({ value: 'settings', label: '⚙️ Settings' });
|
|
94
|
+
menuOptions.push({ value: 'help', label: '❓ Help' });
|
|
95
|
+
|
|
66
96
|
// Main menu
|
|
67
97
|
const action = await p.select({
|
|
68
|
-
message: 'What do you want to do?
|
|
69
|
-
options:
|
|
70
|
-
{ value: 'code', label: '💬 Code with AI', hint: 'build features, fix bugs' },
|
|
71
|
-
{ value: 'integrate', label: '🔌 One-Click Integrations', hint: '50+ services, browser auth' },
|
|
72
|
-
{ value: 'check', label: '🔍 Check code quality', hint: 'run pattern enforcement' },
|
|
73
|
-
{ value: 'deploy', label: '🚀 Deploy', hint: 'deploy to Vercel' },
|
|
74
|
-
{ value: 'migrate', label: '🗄️ Database migrations', hint: 'push, generate, status' },
|
|
75
|
-
{ value: 'fix', label: '🔧 Fix errors', hint: 'auto-fix build/deploy errors' },
|
|
76
|
-
{ value: 'generate', label: '⚡ Generate', hint: 'scaffold components, pages' },
|
|
77
|
-
{ value: 'status', label: '📊 Project status', hint: 'view project health' },
|
|
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' },
|
|
92
|
-
{ value: 'help', label: '❓ Help' },
|
|
93
|
-
] : [
|
|
94
|
-
{ value: 'new', label: '🆕 Create new project' },
|
|
95
|
-
{ value: 'website', label: '🌐 Website Builder', hint: 'Describe → AI builds it' },
|
|
96
|
-
{ value: 'build', label: '🏗️ Parallel Build', hint: '3 agents from PRD (swarm)' },
|
|
97
|
-
{ value: 'prd', label: '📄 Build from PRD', hint: 'sequential build' },
|
|
98
|
-
{ value: 'prd-maker', label: '✏️ Create PRD', hint: 'interview → generate PRD' },
|
|
99
|
-
{ value: 'advisors', label: '🌟 Dream Team Advisors', hint: 'consult with experts' },
|
|
100
|
-
{ value: 'open', label: '📂 Open existing project' },
|
|
101
|
-
{ value: 'status', label: '📊 View all projects' },
|
|
102
|
-
{ value: 'separator1', label: '─────────────────────────' },
|
|
103
|
-
{ value: 'connect', label: '🔗 Connect service' },
|
|
104
|
-
{ value: 'gateway', label: '📱 Channel gateway', hint: 'WhatsApp, Telegram, etc.' },
|
|
105
|
-
{ value: 'learn', label: '🧠 Learning settings' },
|
|
106
|
-
{ value: 'settings', label: '⚙️ Settings' },
|
|
107
|
-
{ value: 'help', label: '❓ Help' },
|
|
108
|
-
]
|
|
98
|
+
message: 'What do you want to do?',
|
|
99
|
+
options: menuOptions,
|
|
109
100
|
});
|
|
110
101
|
|
|
111
102
|
if (p.isCancel(action)) {
|
package/src/utils/config.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Conf from 'conf';
|
|
2
|
-
import
|
|
2
|
+
import fsExtra from 'fs-extra';
|
|
3
|
+
import { existsSync, readFileSync, appendFileSync } from 'fs';
|
|
3
4
|
import * as path from 'path';
|
|
4
5
|
import os from 'os';
|
|
5
6
|
import { z } from 'zod';
|
|
@@ -106,10 +107,10 @@ export class Config {
|
|
|
106
107
|
this.configDir = path.join(os.homedir(), '.codebakers');
|
|
107
108
|
|
|
108
109
|
// Ensure config directory exists
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
fsExtra.ensureDirSync(this.configDir);
|
|
111
|
+
fsExtra.ensureDirSync(path.join(this.configDir, 'patterns'));
|
|
112
|
+
fsExtra.ensureDirSync(path.join(this.configDir, 'templates'));
|
|
113
|
+
fsExtra.ensureDirSync(path.join(this.configDir, 'learning'));
|
|
113
114
|
|
|
114
115
|
this.conf = new Conf<ConfigType>({
|
|
115
116
|
projectName: 'codebakers',
|
|
@@ -143,7 +144,7 @@ export class Config {
|
|
|
143
144
|
const claudeFile = path.join(cwd, 'CLAUDE.md');
|
|
144
145
|
|
|
145
146
|
// Already a CodeBakers project
|
|
146
|
-
if (
|
|
147
|
+
if (existsSync(codebakersDir) || existsSync(claudeFile)) {
|
|
147
148
|
return true;
|
|
148
149
|
}
|
|
149
150
|
|
|
@@ -160,7 +161,7 @@ export class Config {
|
|
|
160
161
|
];
|
|
161
162
|
|
|
162
163
|
const hasProjectFile = projectIndicators.some(file =>
|
|
163
|
-
|
|
164
|
+
existsSync(path.join(cwd, file))
|
|
164
165
|
);
|
|
165
166
|
|
|
166
167
|
// If it's a project but no .codebakers, auto-initialize
|
|
@@ -179,23 +180,23 @@ export class Config {
|
|
|
179
180
|
let framework = 'unknown';
|
|
180
181
|
let ui = 'unknown';
|
|
181
182
|
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
if (existsSync(path.join(cwd, 'next.config.js')) ||
|
|
184
|
+
existsSync(path.join(cwd, 'next.config.mjs')) ||
|
|
185
|
+
existsSync(path.join(cwd, 'next.config.ts'))) {
|
|
185
186
|
framework = 'nextjs';
|
|
186
|
-
} else if (
|
|
187
|
-
|
|
187
|
+
} else if (existsSync(path.join(cwd, 'vite.config.ts')) ||
|
|
188
|
+
existsSync(path.join(cwd, 'vite.config.js'))) {
|
|
188
189
|
framework = 'vite';
|
|
189
|
-
} else if (
|
|
190
|
+
} else if (existsSync(path.join(cwd, 'remix.config.js'))) {
|
|
190
191
|
framework = 'remix';
|
|
191
|
-
} else if (
|
|
192
|
+
} else if (existsSync(path.join(cwd, 'astro.config.mjs'))) {
|
|
192
193
|
framework = 'astro';
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
// Check for UI libraries in package.json
|
|
196
197
|
const pkgPath = path.join(cwd, 'package.json');
|
|
197
|
-
if (
|
|
198
|
-
const pkg =
|
|
198
|
+
if (existsSync(pkgPath)) {
|
|
199
|
+
const pkg = fsExtra.readJsonSync(pkgPath);
|
|
199
200
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
200
201
|
|
|
201
202
|
if (deps['@shadcn/ui'] || deps['class-variance-authority']) {
|
|
@@ -211,7 +212,7 @@ export class Config {
|
|
|
211
212
|
|
|
212
213
|
// Create .codebakers config
|
|
213
214
|
const configDir = path.join(cwd, '.codebakers');
|
|
214
|
-
|
|
215
|
+
fsExtra.ensureDirSync(configDir);
|
|
215
216
|
|
|
216
217
|
const config = {
|
|
217
218
|
name: path.basename(cwd),
|
|
@@ -221,14 +222,14 @@ export class Config {
|
|
|
221
222
|
autoDetected: true,
|
|
222
223
|
};
|
|
223
224
|
|
|
224
|
-
|
|
225
|
+
fsExtra.writeJsonSync(path.join(configDir, 'config.json'), config, { spaces: 2 });
|
|
225
226
|
|
|
226
227
|
// Add to .gitignore if exists
|
|
227
228
|
const gitignorePath = path.join(cwd, '.gitignore');
|
|
228
|
-
if (
|
|
229
|
-
const gitignore =
|
|
229
|
+
if (existsSync(gitignorePath)) {
|
|
230
|
+
const gitignore = readFileSync(gitignorePath, 'utf-8');
|
|
230
231
|
if (!gitignore.includes('.codebakers')) {
|
|
231
|
-
|
|
232
|
+
appendFileSync(gitignorePath, '\n# CodeBakers\n.codebakers/\n');
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
235
|
} catch {
|
|
@@ -240,8 +241,8 @@ export class Config {
|
|
|
240
241
|
getProjectConfig(): Record<string, unknown> | null {
|
|
241
242
|
const cwd = process.cwd();
|
|
242
243
|
const configPath = path.join(cwd, '.codebakers', 'config.json');
|
|
243
|
-
if (
|
|
244
|
-
return
|
|
244
|
+
if (existsSync(configPath)) {
|
|
245
|
+
return fsExtra.readJsonSync(configPath);
|
|
245
246
|
}
|
|
246
247
|
return null;
|
|
247
248
|
}
|