@codebakers/cli 3.4.1 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.js +40 -82
- package/dist/commands/go.js +147 -107
- package/dist/commands/init.js +56 -41
- package/dist/commands/install-hook.js +8 -8
- package/dist/commands/install.js +54 -55
- package/dist/commands/scaffold.js +39 -22
- package/dist/commands/status.js +41 -13
- package/dist/mcp/server.js +165 -146
- package/package.json +1 -1
- package/src/commands/doctor.ts +39 -81
- package/src/commands/go.ts +152 -132
- package/src/commands/init.ts +55 -43
- package/src/commands/install-hook.ts +8 -8
- package/src/commands/install.ts +59 -68
- package/src/commands/scaffold.ts +39 -22
- package/src/commands/status.ts +45 -15
- package/src/mcp/server.ts +167 -160
package/dist/commands/install.js
CHANGED
|
@@ -10,77 +10,76 @@ const fs_1 = require("fs");
|
|
|
10
10
|
const path_1 = require("path");
|
|
11
11
|
const config_js_1 = require("../config.js");
|
|
12
12
|
const api_js_1 = require("../lib/api.js");
|
|
13
|
-
|
|
13
|
+
// v6.0 Bootstrap files - patterns come from server via MCP
|
|
14
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.0
|
|
15
|
+
|
|
16
|
+
**MANDATORY: Before writing ANY code, call the \`discover_patterns\` MCP tool.**
|
|
17
|
+
|
|
18
|
+
Tool: discover_patterns
|
|
19
|
+
Args: { task: "description of what you're building" }
|
|
20
|
+
|
|
21
|
+
The server will return:
|
|
22
|
+
- All coding patterns and rules you must follow
|
|
23
|
+
- Test requirements
|
|
24
|
+
- Validation instructions
|
|
25
|
+
|
|
26
|
+
**You cannot write code without calling this tool first. The server tracks compliance.**
|
|
27
|
+
`;
|
|
28
|
+
const V6_CURSORRULES = `# CodeBakers v6.0
|
|
29
|
+
|
|
30
|
+
**MANDATORY: Before writing ANY code, call the \`discover_patterns\` MCP tool.**
|
|
31
|
+
|
|
32
|
+
Tool: discover_patterns
|
|
33
|
+
Args: { task: "description of what you're building" }
|
|
34
|
+
|
|
35
|
+
The server will return:
|
|
36
|
+
- All coding patterns and rules you must follow
|
|
37
|
+
- Test requirements
|
|
38
|
+
- Validation instructions
|
|
39
|
+
|
|
40
|
+
**You cannot write code without calling this tool first. The server tracks compliance.**
|
|
41
|
+
`;
|
|
14
42
|
async function install() {
|
|
15
|
-
console.log(chalk_1.default.blue('\n CodeBakers Install\n'));
|
|
43
|
+
console.log(chalk_1.default.blue('\n CodeBakers Install (v6.0)\n'));
|
|
16
44
|
const apiKey = (0, config_js_1.getApiKey)();
|
|
17
45
|
if (!apiKey) {
|
|
18
46
|
console.log(chalk_1.default.red(' Not logged in. Run `codebakers login` first.\n'));
|
|
19
47
|
process.exit(1);
|
|
20
48
|
}
|
|
21
|
-
const spinner = (0, ora_1.default)('
|
|
49
|
+
const spinner = (0, ora_1.default)('Installing CodeBakers v6.0...').start();
|
|
22
50
|
try {
|
|
23
|
-
const apiUrl = (0, config_js_1.getApiUrl)();
|
|
24
|
-
const response = await fetch(`${apiUrl}/api/content`, {
|
|
25
|
-
method: 'GET',
|
|
26
|
-
headers: {
|
|
27
|
-
Authorization: `Bearer ${apiKey}`,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
if (!response.ok) {
|
|
31
|
-
const error = await response.json().catch(() => ({}));
|
|
32
|
-
throw new Error(error.error || 'Failed to fetch content');
|
|
33
|
-
}
|
|
34
|
-
const content = await response.json();
|
|
35
|
-
spinner.text = 'Installing patterns...';
|
|
36
51
|
const cwd = process.cwd();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(0, fs_1.
|
|
44
|
-
}
|
|
45
|
-
// Write modules
|
|
46
|
-
const modulesDir = (0, path_1.join)(cwd, '.claude');
|
|
47
|
-
if (content.modules && Object.keys(content.modules).length > 0) {
|
|
48
|
-
if (!(0, fs_1.existsSync)(modulesDir)) {
|
|
49
|
-
(0, fs_1.mkdirSync)(modulesDir, { recursive: true });
|
|
50
|
-
}
|
|
51
|
-
for (const [name, data] of Object.entries(content.modules)) {
|
|
52
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(modulesDir, name), data);
|
|
53
|
-
}
|
|
54
|
-
// Write version file for tracking
|
|
55
|
-
const versionInfo = {
|
|
56
|
-
version: content.version,
|
|
57
|
-
moduleCount: Object.keys(content.modules).length,
|
|
58
|
-
installedAt: new Date().toISOString(),
|
|
59
|
-
cliVersion: (0, api_js_1.getCliVersion)(),
|
|
60
|
-
};
|
|
61
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(modulesDir, '.version.json'), JSON.stringify(versionInfo, null, 2));
|
|
52
|
+
const claudeMdPath = (0, path_1.join)(cwd, 'CLAUDE.md');
|
|
53
|
+
const cursorRulesPath = (0, path_1.join)(cwd, '.cursorrules');
|
|
54
|
+
const claudeDir = (0, path_1.join)(cwd, '.claude');
|
|
55
|
+
// Check for existing v5 installation and migrate
|
|
56
|
+
if ((0, fs_1.existsSync)(claudeDir)) {
|
|
57
|
+
spinner.text = 'Migrating from v5 to v6...';
|
|
58
|
+
(0, fs_1.rmSync)(claudeDir, { recursive: true, force: true });
|
|
62
59
|
}
|
|
63
|
-
//
|
|
60
|
+
// Write v6 bootstrap files
|
|
61
|
+
(0, fs_1.writeFileSync)(claudeMdPath, V6_CLAUDE_MD);
|
|
62
|
+
(0, fs_1.writeFileSync)(cursorRulesPath, V6_CURSORRULES);
|
|
63
|
+
// Add .cursorrules to .gitignore if not present
|
|
64
64
|
const gitignorePath = (0, path_1.join)(cwd, '.gitignore');
|
|
65
65
|
if ((0, fs_1.existsSync)(gitignorePath)) {
|
|
66
|
-
const
|
|
67
|
-
const gitignore = readFileSync(gitignorePath, 'utf-8');
|
|
66
|
+
const gitignore = (0, fs_1.readFileSync)(gitignorePath, 'utf-8');
|
|
68
67
|
if (!gitignore.includes('.cursorrules')) {
|
|
69
|
-
const additions = '\n# CodeBakers
|
|
68
|
+
const additions = '\n# CodeBakers\n.cursorrules\n';
|
|
70
69
|
(0, fs_1.writeFileSync)(gitignorePath, gitignore + additions);
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
|
-
|
|
74
|
-
spinner.succeed('Patterns installed successfully!');
|
|
75
|
-
console.log(chalk_1.default.green(`\n Version: ${content.version}`));
|
|
76
|
-
console.log(chalk_1.default.green(` Modules: ${moduleCount}`));
|
|
72
|
+
spinner.succeed('CodeBakers v6.0 installed!');
|
|
77
73
|
console.log(chalk_1.default.gray('\n Files created:'));
|
|
78
|
-
console.log(chalk_1.default.gray(' - .
|
|
79
|
-
console.log(chalk_1.default.gray(' -
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
console.log(chalk_1.default.
|
|
74
|
+
console.log(chalk_1.default.gray(' - CLAUDE.md (Claude Code gateway)'));
|
|
75
|
+
console.log(chalk_1.default.gray(' - .cursorrules (Cursor IDE gateway)'));
|
|
76
|
+
console.log(chalk_1.default.cyan('\n What\'s new in v6.0:'));
|
|
77
|
+
console.log(chalk_1.default.gray(' - Patterns are now server-side'));
|
|
78
|
+
console.log(chalk_1.default.gray(' - AI calls discover_patterns before coding'));
|
|
79
|
+
console.log(chalk_1.default.gray(' - Real-time pattern updates'));
|
|
80
|
+
console.log(chalk_1.default.gray(' - Usage tracking & compliance'));
|
|
81
|
+
console.log(chalk_1.default.gray(`\n CLI version: ${(0, api_js_1.getCliVersion)()}`));
|
|
82
|
+
console.log(chalk_1.default.blue('\n Start building! AI will fetch patterns via MCP.\n'));
|
|
84
83
|
}
|
|
85
84
|
catch (error) {
|
|
86
85
|
spinner.fail('Installation failed');
|
|
@@ -94,7 +94,7 @@ Ask yourself silently:
|
|
|
94
94
|
|
|
95
95
|
### PHASE 3: EXECUTE
|
|
96
96
|
- State: \`📋 CodeBakers | [Type] | Modules: [list]\`
|
|
97
|
-
-
|
|
97
|
+
- Call discover_patterns MCP tool first
|
|
98
98
|
- Follow patterns EXACTLY
|
|
99
99
|
|
|
100
100
|
### PHASE 4: SELF-REVIEW (before saying "done")
|
|
@@ -521,28 +521,45 @@ async function scaffold() {
|
|
|
521
521
|
},
|
|
522
522
|
});
|
|
523
523
|
if (response.ok) {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
524
|
+
// v6.0: Write minimal bootstrap files (patterns come from server)
|
|
525
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.0
|
|
526
|
+
|
|
527
|
+
**MANDATORY: Before writing ANY code, call the \`discover_patterns\` MCP tool.**
|
|
528
|
+
|
|
529
|
+
\`\`\`
|
|
530
|
+
Tool: discover_patterns
|
|
531
|
+
Args: { task: "description of what you're building" }
|
|
532
|
+
\`\`\`
|
|
533
|
+
|
|
534
|
+
The server will return:
|
|
535
|
+
- All coding patterns and rules you must follow
|
|
536
|
+
- Test requirements
|
|
537
|
+
- Validation instructions
|
|
538
|
+
|
|
539
|
+
**You cannot write code without calling this tool first. The server tracks compliance.**
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
*CodeBakers v6.0 - Server-Enforced*
|
|
543
|
+
`;
|
|
544
|
+
const V6_CURSORRULES = `# CodeBakers v6.0
|
|
545
|
+
|
|
546
|
+
MANDATORY: Before writing ANY code, call the discover_patterns MCP tool.
|
|
547
|
+
|
|
548
|
+
Tool: discover_patterns
|
|
549
|
+
Args: { task: "description of what you're building" }
|
|
550
|
+
|
|
551
|
+
The server returns all patterns, rules, and test requirements.
|
|
552
|
+
You cannot write code without calling this tool first.
|
|
553
|
+
`;
|
|
554
|
+
// Write v6.0 bootstrap files
|
|
555
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(cwd, 'CLAUDE.md'), V6_CLAUDE_MD);
|
|
556
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
539
557
|
// Write project management files
|
|
540
558
|
(0, fs_1.writeFileSync)((0, path_1.join)(cwd, 'PRD.md'), createPrdTemplate(projectName));
|
|
541
559
|
(0, fs_1.writeFileSync)((0, path_1.join)(cwd, 'PROJECT-STATE.md'), createProjectState(projectName));
|
|
542
560
|
(0, fs_1.writeFileSync)((0, path_1.join)(cwd, 'PROJECT-CONTEXT.md'), createProjectContext(projectName));
|
|
543
561
|
(0, fs_1.writeFileSync)((0, path_1.join)(cwd, 'DECISIONS.md'), createDecisionsLog(projectName));
|
|
544
562
|
// Write Cursor IDE files
|
|
545
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(cwd, '.cursorrules'), CURSORRULES_TEMPLATE);
|
|
546
563
|
(0, fs_1.writeFileSync)((0, path_1.join)(cwd, '.cursorignore'), CURSORIGNORE_TEMPLATE);
|
|
547
564
|
// Create .vscode settings
|
|
548
565
|
const vscodeDir = (0, path_1.join)(cwd, '.vscode');
|
|
@@ -553,15 +570,15 @@ async function scaffold() {
|
|
|
553
570
|
"cursor.chat.defaultContext": ["CLAUDE.md", "PRD.md", "PROJECT-CONTEXT.md"],
|
|
554
571
|
"cursor.chat.alwaysIncludeRules": true
|
|
555
572
|
}, null, 2));
|
|
556
|
-
// Update .gitignore
|
|
573
|
+
// Update .gitignore (no .claude/ needed in v6)
|
|
557
574
|
const gitignorePath = (0, path_1.join)(cwd, '.gitignore');
|
|
558
575
|
if ((0, fs_1.existsSync)(gitignorePath)) {
|
|
559
576
|
const gitignore = (0, fs_1.readFileSync)(gitignorePath, 'utf-8');
|
|
560
577
|
if (!gitignore.includes('.cursorrules')) {
|
|
561
|
-
(0, fs_1.writeFileSync)(gitignorePath, gitignore + '\n# CodeBakers\n.cursorrules\n
|
|
578
|
+
(0, fs_1.writeFileSync)(gitignorePath, gitignore + '\n# CodeBakers\n.cursorrules\n');
|
|
562
579
|
}
|
|
563
580
|
}
|
|
564
|
-
patternSpinner.succeed(
|
|
581
|
+
patternSpinner.succeed('CodeBakers v6.0 installed!');
|
|
565
582
|
patternsInstalled = true;
|
|
566
583
|
}
|
|
567
584
|
else {
|
|
@@ -722,9 +739,9 @@ async function scaffold() {
|
|
|
722
739
|
}
|
|
723
740
|
if (patternsInstalled) {
|
|
724
741
|
console.log('');
|
|
725
|
-
console.log(chalk_1.default.gray(' CLAUDE.md ') + chalk_1.default.cyan('← AI
|
|
742
|
+
console.log(chalk_1.default.gray(' CLAUDE.md ') + chalk_1.default.cyan('← AI gateway (calls MCP for patterns)'));
|
|
743
|
+
console.log(chalk_1.default.gray(' .cursorrules ') + chalk_1.default.cyan('← Cursor IDE gateway'));
|
|
726
744
|
console.log(chalk_1.default.gray(' PRD.md ') + chalk_1.default.cyan('← Your product requirements'));
|
|
727
|
-
console.log(chalk_1.default.gray(' .claude/ ') + chalk_1.default.cyan('← 34 production patterns'));
|
|
728
745
|
}
|
|
729
746
|
console.log('');
|
|
730
747
|
console.log(chalk_1.default.white(' Next steps:\n'));
|
package/dist/commands/status.js
CHANGED
|
@@ -8,8 +8,12 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const path_1 = require("path");
|
|
10
10
|
const config_js_1 = require("../config.js");
|
|
11
|
+
const api_js_1 = require("../lib/api.js");
|
|
11
12
|
async function status() {
|
|
12
|
-
console.log(chalk_1.default.blue('\n CodeBakers Status\n'));
|
|
13
|
+
console.log(chalk_1.default.blue('\n CodeBakers Status (v6.0)\n'));
|
|
14
|
+
// Show version
|
|
15
|
+
const version = (0, api_js_1.getCliVersion)();
|
|
16
|
+
console.log(chalk_1.default.gray(` CLI Version: ${version}\n`));
|
|
13
17
|
// Check login status
|
|
14
18
|
const apiKey = (0, config_js_1.getApiKey)();
|
|
15
19
|
if (apiKey) {
|
|
@@ -18,7 +22,7 @@ async function status() {
|
|
|
18
22
|
}
|
|
19
23
|
else {
|
|
20
24
|
console.log(chalk_1.default.red(' ✗ Not logged in'));
|
|
21
|
-
console.log(chalk_1.default.gray(' Run `codebakers
|
|
25
|
+
console.log(chalk_1.default.gray(' Run `codebakers setup` to authenticate'));
|
|
22
26
|
}
|
|
23
27
|
console.log('');
|
|
24
28
|
// Check installation status in current directory
|
|
@@ -29,21 +33,45 @@ async function status() {
|
|
|
29
33
|
const hasCursorRules = (0, fs_1.existsSync)(cursorrules);
|
|
30
34
|
const hasClaudeMd = (0, fs_1.existsSync)(claudemd);
|
|
31
35
|
const hasClaudeDir = (0, fs_1.existsSync)(claudeDir);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
// Check version of installed files
|
|
37
|
+
let isV6 = false;
|
|
38
|
+
if (hasClaudeMd) {
|
|
39
|
+
const content = (0, fs_1.readFileSync)(claudemd, 'utf-8');
|
|
40
|
+
isV6 = content.includes('discover_patterns') || content.includes('v6.0');
|
|
41
|
+
}
|
|
42
|
+
if (hasCursorRules || hasClaudeMd) {
|
|
43
|
+
if (isV6) {
|
|
44
|
+
console.log(chalk_1.default.green(' ✓ CodeBakers v6.0 installed'));
|
|
45
|
+
console.log(chalk_1.default.gray(' - CLAUDE.md (Claude Code gateway)'));
|
|
46
|
+
console.log(chalk_1.default.gray(' - .cursorrules (Cursor IDE gateway)'));
|
|
47
|
+
console.log(chalk_1.default.cyan('\n v6.0 Features:'));
|
|
48
|
+
console.log(chalk_1.default.gray(' - Server-side patterns (always up-to-date)'));
|
|
49
|
+
console.log(chalk_1.default.gray(' - AI calls discover_patterns before coding'));
|
|
50
|
+
console.log(chalk_1.default.gray(' - Usage tracking & compliance'));
|
|
39
51
|
}
|
|
40
|
-
|
|
41
|
-
console.log(chalk_1.default.
|
|
52
|
+
else {
|
|
53
|
+
console.log(chalk_1.default.yellow(' ⚠ CodeBakers v5 installed (legacy)'));
|
|
54
|
+
if (hasCursorRules) {
|
|
55
|
+
console.log(chalk_1.default.gray(' - .cursorrules'));
|
|
56
|
+
}
|
|
57
|
+
if (hasClaudeMd) {
|
|
58
|
+
console.log(chalk_1.default.gray(' - CLAUDE.md'));
|
|
59
|
+
}
|
|
60
|
+
if (hasClaudeDir) {
|
|
61
|
+
console.log(chalk_1.default.gray(' - .claude/ (local modules)'));
|
|
62
|
+
}
|
|
63
|
+
console.log(chalk_1.default.yellow('\n Upgrade to v6.0:'));
|
|
64
|
+
console.log(chalk_1.default.gray(' Run `codebakers go` to upgrade'));
|
|
42
65
|
}
|
|
43
66
|
}
|
|
44
67
|
else {
|
|
45
|
-
console.log(chalk_1.default.yellow(' ○
|
|
46
|
-
console.log(chalk_1.default.gray(' Run `codebakers
|
|
68
|
+
console.log(chalk_1.default.yellow(' ○ CodeBakers not installed in this directory'));
|
|
69
|
+
console.log(chalk_1.default.gray(' Run `codebakers go` to install'));
|
|
70
|
+
}
|
|
71
|
+
// Warn about legacy folder
|
|
72
|
+
if (hasClaudeDir && isV6) {
|
|
73
|
+
console.log(chalk_1.default.yellow('\n ⚠ Legacy .claude/ folder found'));
|
|
74
|
+
console.log(chalk_1.default.gray(' This can be removed - v6.0 uses server-side patterns'));
|
|
47
75
|
}
|
|
48
76
|
console.log('');
|
|
49
77
|
}
|