@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/mcp/server.js
CHANGED
|
@@ -1062,13 +1062,13 @@ class CodeBakersServer {
|
|
|
1062
1062
|
},
|
|
1063
1063
|
{
|
|
1064
1064
|
name: 'update_patterns',
|
|
1065
|
-
description: '
|
|
1065
|
+
description: 'Update to CodeBakers v6.0 server-enforced patterns. Use when user says "upgrade codebakers", "update patterns", or "sync codebakers". In v6.0, patterns are server-side - this tool installs minimal bootstrap files (CLAUDE.md and .cursorrules) and removes old .claude/ folder if present.',
|
|
1066
1066
|
inputSchema: {
|
|
1067
1067
|
type: 'object',
|
|
1068
1068
|
properties: {
|
|
1069
1069
|
force: {
|
|
1070
1070
|
type: 'boolean',
|
|
1071
|
-
description: 'Force
|
|
1071
|
+
description: 'Force reinstall even if already on v6.0 (default: false)',
|
|
1072
1072
|
},
|
|
1073
1073
|
},
|
|
1074
1074
|
},
|
|
@@ -2372,35 +2372,66 @@ Or if user declines, call without fullDeploy:
|
|
|
2372
2372
|
catch {
|
|
2373
2373
|
// Use default
|
|
2374
2374
|
}
|
|
2375
|
-
results.push(`# 🎨 Adding CodeBakers to: ${projectName}\n`);
|
|
2376
|
-
//
|
|
2377
|
-
|
|
2378
|
-
|
|
2375
|
+
results.push(`# 🎨 Adding CodeBakers v6.0 to: ${projectName}\n`);
|
|
2376
|
+
// v6.0 bootstrap content - minimal files, patterns from server
|
|
2377
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.0
|
|
2378
|
+
|
|
2379
|
+
**MANDATORY: Before writing ANY code, call the \`discover_patterns\` MCP tool.**
|
|
2380
|
+
|
|
2381
|
+
\`\`\`
|
|
2382
|
+
Tool: discover_patterns
|
|
2383
|
+
Args: { task: "description of what you're building" }
|
|
2384
|
+
\`\`\`
|
|
2385
|
+
|
|
2386
|
+
The server will return:
|
|
2387
|
+
- All coding patterns and rules you must follow
|
|
2388
|
+
- Test requirements
|
|
2389
|
+
- Validation instructions
|
|
2390
|
+
|
|
2391
|
+
**You cannot write code without calling this tool first. The server tracks compliance.**
|
|
2392
|
+
|
|
2393
|
+
---
|
|
2394
|
+
*CodeBakers v6.0 - Server-Enforced*
|
|
2395
|
+
`;
|
|
2396
|
+
const V6_CURSORRULES = `# CodeBakers v6.0
|
|
2397
|
+
|
|
2398
|
+
MANDATORY: Before writing ANY code, call the discover_patterns MCP tool.
|
|
2399
|
+
|
|
2400
|
+
Tool: discover_patterns
|
|
2401
|
+
Args: { task: "description of what you're building" }
|
|
2402
|
+
|
|
2403
|
+
The server returns all patterns, rules, and test requirements.
|
|
2404
|
+
You cannot write code without calling this tool first.
|
|
2405
|
+
`;
|
|
2406
|
+
// Check if already v6
|
|
2407
|
+
const claudeMdPath = path.join(cwd, 'CLAUDE.md');
|
|
2408
|
+
if (fs.existsSync(claudeMdPath)) {
|
|
2409
|
+
const content = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
2410
|
+
if (content.includes('v6.0') && content.includes('discover_patterns')) {
|
|
2411
|
+
results.push('✓ CodeBakers v6.0 already installed\n');
|
|
2412
|
+
results.push('Patterns are server-enforced. Just call `discover_patterns` before coding!');
|
|
2413
|
+
return {
|
|
2414
|
+
content: [{ type: 'text', text: results.join('\n') }],
|
|
2415
|
+
};
|
|
2416
|
+
}
|
|
2417
|
+
results.push('⚠️ Upgrading to v6.0 (server-enforced patterns)...\n');
|
|
2379
2418
|
}
|
|
2380
2419
|
try {
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
results.push('✓ Created/Updated CLAUDE.md');
|
|
2393
|
-
}
|
|
2394
|
-
// Write pattern modules
|
|
2395
|
-
if (content.modules && Object.keys(content.modules).length > 0) {
|
|
2396
|
-
const modulesDir = path.join(cwd, '.claude');
|
|
2397
|
-
if (!fs.existsSync(modulesDir)) {
|
|
2398
|
-
fs.mkdirSync(modulesDir, { recursive: true });
|
|
2420
|
+
// Write v6.0 bootstrap files
|
|
2421
|
+
fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
|
|
2422
|
+
results.push('✓ Created CLAUDE.md (v6.0 bootstrap)');
|
|
2423
|
+
fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
2424
|
+
results.push('✓ Created .cursorrules (v6.0 bootstrap)');
|
|
2425
|
+
// Remove old .claude folder if it exists (v5 → v6 migration)
|
|
2426
|
+
const claudeDir = path.join(cwd, '.claude');
|
|
2427
|
+
if (fs.existsSync(claudeDir)) {
|
|
2428
|
+
try {
|
|
2429
|
+
fs.rmSync(claudeDir, { recursive: true, force: true });
|
|
2430
|
+
results.push('✓ Removed .claude/ folder (patterns now server-side)');
|
|
2399
2431
|
}
|
|
2400
|
-
|
|
2401
|
-
|
|
2432
|
+
catch {
|
|
2433
|
+
results.push('⚠️ Could not remove .claude/ folder - please delete manually');
|
|
2402
2434
|
}
|
|
2403
|
-
results.push(`✓ Installed ${Object.keys(content.modules).length} pattern modules (v${content.version})`);
|
|
2404
2435
|
}
|
|
2405
2436
|
// Create PRD if doesn't exist
|
|
2406
2437
|
const date = new Date().toISOString().split('T')[0];
|
|
@@ -2419,39 +2450,29 @@ Or if user declines, call without fullDeploy:
|
|
|
2419
2450
|
`);
|
|
2420
2451
|
results.push('✓ Created PRD.md template');
|
|
2421
2452
|
}
|
|
2422
|
-
//
|
|
2423
|
-
const
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
## In Progress
|
|
2433
|
-
## Completed
|
|
2434
|
-
## Next Up
|
|
2435
|
-
`);
|
|
2436
|
-
results.push('✓ Created PROJECT-STATE.md');
|
|
2437
|
-
}
|
|
2438
|
-
// Update .gitignore
|
|
2439
|
-
const gitignorePath = path.join(cwd, '.gitignore');
|
|
2440
|
-
if (fs.existsSync(gitignorePath)) {
|
|
2441
|
-
const gitignore = fs.readFileSync(gitignorePath, 'utf-8');
|
|
2442
|
-
if (!gitignore.includes('.claude/')) {
|
|
2443
|
-
fs.writeFileSync(gitignorePath, gitignore + '\n# CodeBakers\n.claude/\n');
|
|
2444
|
-
results.push('✓ Updated .gitignore');
|
|
2453
|
+
// Update .codebakers.json
|
|
2454
|
+
const stateFile = path.join(cwd, '.codebakers.json');
|
|
2455
|
+
let state = {};
|
|
2456
|
+
if (fs.existsSync(stateFile)) {
|
|
2457
|
+
try {
|
|
2458
|
+
state = JSON.parse(fs.readFileSync(stateFile, 'utf-8'));
|
|
2459
|
+
}
|
|
2460
|
+
catch {
|
|
2461
|
+
// Ignore errors
|
|
2445
2462
|
}
|
|
2446
2463
|
}
|
|
2464
|
+
state.version = '6.0';
|
|
2465
|
+
state.serverEnforced = true;
|
|
2466
|
+
state.updatedAt = new Date().toISOString();
|
|
2467
|
+
fs.writeFileSync(stateFile, JSON.stringify(state, null, 2));
|
|
2447
2468
|
results.push('\n---\n');
|
|
2448
|
-
results.push('## ✅ CodeBakers
|
|
2449
|
-
results.push('
|
|
2450
|
-
results.push('
|
|
2451
|
-
results.push('
|
|
2452
|
-
results.push('
|
|
2453
|
-
results.push('
|
|
2454
|
-
results.push('
|
|
2469
|
+
results.push('## ✅ CodeBakers v6.0 Installed!\n');
|
|
2470
|
+
results.push('**How it works now:**');
|
|
2471
|
+
results.push('1. Call `discover_patterns` before writing code');
|
|
2472
|
+
results.push('2. Server returns all patterns and rules');
|
|
2473
|
+
results.push('3. Call `validate_complete` before marking done');
|
|
2474
|
+
results.push('4. Server verifies compliance\n');
|
|
2475
|
+
results.push('No local pattern files needed - everything is server-side!');
|
|
2455
2476
|
}
|
|
2456
2477
|
catch (error) {
|
|
2457
2478
|
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
@@ -5517,7 +5538,7 @@ ${handlers.join('\n')}
|
|
|
5517
5538
|
`;
|
|
5518
5539
|
}
|
|
5519
5540
|
/**
|
|
5520
|
-
*
|
|
5541
|
+
* Update to CodeBakers v6.0 - server-enforced patterns
|
|
5521
5542
|
* This is the MCP equivalent of the `codebakers upgrade` CLI command
|
|
5522
5543
|
*/
|
|
5523
5544
|
async handleUpdatePatterns(args) {
|
|
@@ -5525,54 +5546,63 @@ ${handlers.join('\n')}
|
|
|
5525
5546
|
const cwd = process.cwd();
|
|
5526
5547
|
const claudeMdPath = path.join(cwd, 'CLAUDE.md');
|
|
5527
5548
|
const claudeDir = path.join(cwd, '.claude');
|
|
5528
|
-
const
|
|
5529
|
-
let response = `# 🔄 CodeBakers
|
|
5549
|
+
const codebakersJson = path.join(cwd, '.codebakers.json');
|
|
5550
|
+
let response = `# 🔄 CodeBakers v6.0 Update\n\n`;
|
|
5551
|
+
// v6.0 bootstrap content
|
|
5552
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.0
|
|
5553
|
+
|
|
5554
|
+
**MANDATORY: Before writing ANY code, call the \`discover_patterns\` MCP tool.**
|
|
5555
|
+
|
|
5556
|
+
\`\`\`
|
|
5557
|
+
Tool: discover_patterns
|
|
5558
|
+
Args: { task: "description of what you're building" }
|
|
5559
|
+
\`\`\`
|
|
5560
|
+
|
|
5561
|
+
The server will return:
|
|
5562
|
+
- All coding patterns and rules you must follow
|
|
5563
|
+
- Test requirements
|
|
5564
|
+
- Validation instructions
|
|
5565
|
+
|
|
5566
|
+
**You cannot write code without calling this tool first. The server tracks compliance.**
|
|
5567
|
+
|
|
5568
|
+
---
|
|
5569
|
+
*CodeBakers v6.0 - Server-Enforced*
|
|
5570
|
+
`;
|
|
5571
|
+
const V6_CURSORRULES = `# CodeBakers v6.0
|
|
5572
|
+
|
|
5573
|
+
MANDATORY: Before writing ANY code, call the discover_patterns MCP tool.
|
|
5574
|
+
|
|
5575
|
+
Tool: discover_patterns
|
|
5576
|
+
Args: { task: "description of what you're building" }
|
|
5577
|
+
|
|
5578
|
+
The server returns all patterns, rules, and test requirements.
|
|
5579
|
+
You cannot write code without calling this tool first.
|
|
5580
|
+
`;
|
|
5530
5581
|
try {
|
|
5531
5582
|
// Check current version
|
|
5532
5583
|
let currentVersion = null;
|
|
5533
|
-
let
|
|
5534
|
-
if (fs.existsSync(
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
currentVersion = versionInfo.version;
|
|
5538
|
-
currentModuleCount = versionInfo.moduleCount || 0;
|
|
5539
|
-
}
|
|
5540
|
-
catch {
|
|
5541
|
-
// Ignore parse errors
|
|
5542
|
-
}
|
|
5584
|
+
let isV6 = false;
|
|
5585
|
+
if (fs.existsSync(claudeMdPath)) {
|
|
5586
|
+
const content = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
5587
|
+
isV6 = content.includes('v6.0') && content.includes('discover_patterns');
|
|
5543
5588
|
}
|
|
5544
|
-
|
|
5545
|
-
if (fs.existsSync(claudeDir)) {
|
|
5589
|
+
if (fs.existsSync(codebakersJson)) {
|
|
5546
5590
|
try {
|
|
5547
|
-
const
|
|
5548
|
-
|
|
5591
|
+
const state = JSON.parse(fs.readFileSync(codebakersJson, 'utf-8'));
|
|
5592
|
+
currentVersion = state.version || null;
|
|
5549
5593
|
}
|
|
5550
5594
|
catch {
|
|
5551
|
-
// Ignore
|
|
5595
|
+
// Ignore parse errors
|
|
5552
5596
|
}
|
|
5553
5597
|
}
|
|
5554
5598
|
response += `## Current Status\n`;
|
|
5555
5599
|
response += `- Version: ${currentVersion || 'Unknown'}\n`;
|
|
5556
|
-
response += `-
|
|
5557
|
-
//
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
throw new Error('Failed to check version from server');
|
|
5563
|
-
}
|
|
5564
|
-
const latestInfo = await versionResponse.json();
|
|
5565
|
-
const latestVersion = latestInfo.version;
|
|
5566
|
-
const latestModuleCount = latestInfo.moduleCount || 0;
|
|
5567
|
-
response += `## Server Status\n`;
|
|
5568
|
-
response += `- Latest Version: ${latestVersion}\n`;
|
|
5569
|
-
response += `- Available Modules: ${latestModuleCount}\n\n`;
|
|
5570
|
-
// Check if update needed
|
|
5571
|
-
const needsUpdate = force || !currentVersion || currentVersion !== latestVersion || currentModuleCount < latestModuleCount;
|
|
5572
|
-
if (!needsUpdate) {
|
|
5573
|
-
response += `✅ **Already up to date!**\n\n`;
|
|
5574
|
-
response += `Your patterns are current (v${latestVersion} with ${latestModuleCount} modules).\n`;
|
|
5575
|
-
response += `Use \`force: true\` to re-download anyway.\n`;
|
|
5600
|
+
response += `- v6.0 (Server-Enforced): ${isV6 ? 'Yes ✓' : 'No'}\n\n`;
|
|
5601
|
+
// Check if already on v6
|
|
5602
|
+
if (isV6 && !force) {
|
|
5603
|
+
response += `✅ **Already on v6.0!**\n\n`;
|
|
5604
|
+
response += `Your patterns are server-enforced. Just use \`discover_patterns\` before coding.\n`;
|
|
5605
|
+
response += `Use \`force: true\` to reinstall bootstrap files.\n`;
|
|
5576
5606
|
response += this.getUpdateNotice();
|
|
5577
5607
|
return {
|
|
5578
5608
|
content: [{
|
|
@@ -5581,65 +5611,54 @@ ${handlers.join('\n')}
|
|
|
5581
5611
|
}],
|
|
5582
5612
|
};
|
|
5583
5613
|
}
|
|
5584
|
-
response += `##
|
|
5585
|
-
//
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
}
|
|
5600
|
-
// Update CLAUDE.md router
|
|
5601
|
-
if (content.router) {
|
|
5602
|
-
fs.writeFileSync(claudeMdPath, content.router);
|
|
5603
|
-
response += `✓ Updated CLAUDE.md (router)\n`;
|
|
5614
|
+
response += `## Upgrading to v6.0...\n\n`;
|
|
5615
|
+
// Write v6.0 bootstrap files
|
|
5616
|
+
fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
|
|
5617
|
+
response += `✓ Updated CLAUDE.md (v6.0 bootstrap)\n`;
|
|
5618
|
+
fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
5619
|
+
response += `✓ Updated .cursorrules (v6.0 bootstrap)\n`;
|
|
5620
|
+
// Remove old .claude folder (v5 → v6 migration)
|
|
5621
|
+
if (fs.existsSync(claudeDir)) {
|
|
5622
|
+
try {
|
|
5623
|
+
fs.rmSync(claudeDir, { recursive: true, force: true });
|
|
5624
|
+
response += `✓ Removed .claude/ folder (patterns now server-side)\n`;
|
|
5625
|
+
}
|
|
5626
|
+
catch {
|
|
5627
|
+
response += `⚠️ Could not remove .claude/ folder - please delete manually\n`;
|
|
5628
|
+
}
|
|
5604
5629
|
}
|
|
5605
|
-
// Update
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5630
|
+
// Update .codebakers.json
|
|
5631
|
+
let state = {};
|
|
5632
|
+
if (fs.existsSync(codebakersJson)) {
|
|
5633
|
+
try {
|
|
5634
|
+
state = JSON.parse(fs.readFileSync(codebakersJson, 'utf-8'));
|
|
5635
|
+
}
|
|
5636
|
+
catch {
|
|
5637
|
+
// Ignore errors
|
|
5609
5638
|
}
|
|
5610
|
-
response += `✓ Updated ${moduleCount} modules in .claude/\n`;
|
|
5611
5639
|
}
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
response +=
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
response +=
|
|
5625
|
-
response +=
|
|
5626
|
-
response +=
|
|
5627
|
-
|
|
5628
|
-
response += `🆕 **${moduleCount - currentModuleCount} new modules added!**\n\n`;
|
|
5629
|
-
}
|
|
5630
|
-
response += `Your patterns are now up to date. The new patterns will be used in your next response.\n`;
|
|
5640
|
+
state.version = '6.0';
|
|
5641
|
+
state.serverEnforced = true;
|
|
5642
|
+
state.updatedAt = new Date().toISOString();
|
|
5643
|
+
fs.writeFileSync(codebakersJson, JSON.stringify(state, null, 2));
|
|
5644
|
+
response += `✓ Updated .codebakers.json\n`;
|
|
5645
|
+
// Confirm to server (non-blocking analytics)
|
|
5646
|
+
this.confirmDownload('6.0', 0).catch(() => { });
|
|
5647
|
+
response += `\n## ✅ Upgrade Complete!\n\n`;
|
|
5648
|
+
response += `**What changed in v6.0:**\n`;
|
|
5649
|
+
response += `- No local pattern files (.claude/ folder removed)\n`;
|
|
5650
|
+
response += `- All patterns fetched from server in real-time\n`;
|
|
5651
|
+
response += `- Server tracks compliance via discover_patterns/validate_complete\n\n`;
|
|
5652
|
+
response += `**How to use:**\n`;
|
|
5653
|
+
response += `1. Call \`discover_patterns\` before writing any code\n`;
|
|
5654
|
+
response += `2. Follow the patterns returned by server\n`;
|
|
5655
|
+
response += `3. Call \`validate_complete\` before marking done\n`;
|
|
5631
5656
|
}
|
|
5632
5657
|
catch (error) {
|
|
5633
5658
|
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
5634
5659
|
response += `\n## ❌ Update Failed\n\n`;
|
|
5635
5660
|
response += `Error: ${message}\n\n`;
|
|
5636
|
-
|
|
5637
|
-
response += `Your API key may be invalid or expired.\n`;
|
|
5638
|
-
response += `Run \`codebakers setup\` in terminal to reconfigure.\n`;
|
|
5639
|
-
}
|
|
5640
|
-
else {
|
|
5641
|
-
response += `Please try again or run \`codebakers upgrade\` in terminal.\n`;
|
|
5642
|
-
}
|
|
5661
|
+
response += `Please try again or run \`codebakers upgrade\` in terminal.\n`;
|
|
5643
5662
|
}
|
|
5644
5663
|
// Add CLI update notice if available
|
|
5645
5664
|
response += this.getUpdateNotice();
|
package/package.json
CHANGED
package/src/commands/doctor.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { existsSync,
|
|
2
|
+
import { existsSync, readFileSync } from 'fs';
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import { homedir } from 'os';
|
|
5
5
|
import { isHookInstalled } from './install-hook.js';
|
|
6
6
|
import { getApiKey } from '../config.js';
|
|
7
7
|
import { checkApiKeyValidity, checkForUpdates, getCliVersion } from '../lib/api.js';
|
|
8
|
-
import { CODEBAKERS_STATS } from '../lib/stats.js';
|
|
9
8
|
|
|
10
9
|
interface CheckResult {
|
|
11
10
|
ok: boolean;
|
|
@@ -17,7 +16,7 @@ interface CheckResult {
|
|
|
17
16
|
* Run all health checks for CodeBakers setup
|
|
18
17
|
*/
|
|
19
18
|
export async function doctor(): Promise<void> {
|
|
20
|
-
console.log(chalk.blue('\n CodeBakers Doctor\n'));
|
|
19
|
+
console.log(chalk.blue('\n CodeBakers Doctor (v6.0)\n'));
|
|
21
20
|
|
|
22
21
|
// Show version
|
|
23
22
|
const version = getCliVersion();
|
|
@@ -73,7 +72,7 @@ export async function doctor(): Promise<void> {
|
|
|
73
72
|
|
|
74
73
|
const claudeMdCheck = projectChecks.find(c => c.message.includes('CLAUDE.md'));
|
|
75
74
|
if (claudeMdCheck && !claudeMdCheck.ok) {
|
|
76
|
-
console.log(chalk.gray(' • Run: codebakers
|
|
75
|
+
console.log(chalk.gray(' • Run: codebakers go'));
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
const hookCheck = systemChecks.find(c => c.message.includes('Hook'));
|
|
@@ -98,112 +97,70 @@ export async function doctor(): Promise<void> {
|
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
/**
|
|
101
|
-
* Check project-level setup
|
|
100
|
+
* Check project-level setup (v6.0 bootstrap files)
|
|
102
101
|
*/
|
|
103
102
|
function checkProject(): CheckResult[] {
|
|
104
103
|
const results: CheckResult[] = [];
|
|
105
104
|
const cwd = process.cwd();
|
|
106
105
|
|
|
107
|
-
// Check CLAUDE.md
|
|
106
|
+
// Check CLAUDE.md with v6 content
|
|
108
107
|
const claudeMdPath = join(cwd, 'CLAUDE.md');
|
|
109
108
|
if (existsSync(claudeMdPath)) {
|
|
110
109
|
const content = readFileSync(claudeMdPath, 'utf-8');
|
|
111
|
-
if (content.includes('
|
|
112
|
-
results.push({ ok: true, message: 'CLAUDE.md exists (
|
|
110
|
+
if (content.includes('discover_patterns') || content.includes('v6.0')) {
|
|
111
|
+
results.push({ ok: true, message: 'CLAUDE.md exists (v6.0 gateway)' });
|
|
112
|
+
} else if (content.includes('CodeBakers') || content.includes('.claude')) {
|
|
113
|
+
results.push({
|
|
114
|
+
ok: false,
|
|
115
|
+
message: 'CLAUDE.md exists but is v5 format',
|
|
116
|
+
details: 'Run: codebakers go --upgrade'
|
|
117
|
+
});
|
|
113
118
|
} else {
|
|
114
119
|
results.push({
|
|
115
120
|
ok: false,
|
|
116
|
-
message: 'CLAUDE.md exists but
|
|
117
|
-
details: 'Run: codebakers
|
|
121
|
+
message: 'CLAUDE.md exists but not CodeBakers',
|
|
122
|
+
details: 'Run: codebakers go'
|
|
118
123
|
});
|
|
119
124
|
}
|
|
120
125
|
} else {
|
|
121
126
|
results.push({
|
|
122
127
|
ok: false,
|
|
123
128
|
message: 'CLAUDE.md not found',
|
|
124
|
-
details: 'Run: codebakers
|
|
129
|
+
details: 'Run: codebakers go'
|
|
125
130
|
});
|
|
126
131
|
}
|
|
127
132
|
|
|
128
|
-
// Check .
|
|
129
|
-
const
|
|
130
|
-
if (existsSync(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const files = readdirSync(claudeDir).filter(f => f.endsWith('.md'));
|
|
136
|
-
const moduleCount = files.length;
|
|
137
|
-
|
|
138
|
-
if (moduleCount >= 50) {
|
|
139
|
-
results.push({ ok: true, message: `${moduleCount} modules present (full set)` });
|
|
140
|
-
} else if (moduleCount >= 10) {
|
|
141
|
-
results.push({
|
|
142
|
-
ok: true,
|
|
143
|
-
message: `${moduleCount} modules present (partial set)`,
|
|
144
|
-
details: `Run: codebakers upgrade to get all ${CODEBAKERS_STATS.moduleCount} modules`
|
|
145
|
-
});
|
|
146
|
-
} else if (moduleCount > 0) {
|
|
147
|
-
results.push({
|
|
148
|
-
ok: false,
|
|
149
|
-
message: `Only ${moduleCount} modules found (expected ${CODEBAKERS_STATS.moduleCount})`,
|
|
150
|
-
details: 'Run: codebakers upgrade to get all modules'
|
|
151
|
-
});
|
|
152
|
-
} else {
|
|
153
|
-
results.push({
|
|
154
|
-
ok: false,
|
|
155
|
-
message: 'No modules found in .claude/',
|
|
156
|
-
details: 'Run: codebakers install'
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Check for 00-core.md
|
|
161
|
-
const corePath = join(claudeDir, '00-core.md');
|
|
162
|
-
if (existsSync(corePath)) {
|
|
163
|
-
results.push({ ok: true, message: '00-core.md exists (base patterns)' });
|
|
164
|
-
} else {
|
|
165
|
-
results.push({
|
|
166
|
-
ok: false,
|
|
167
|
-
message: '00-core.md not found',
|
|
168
|
-
details: 'This module is loaded on every task'
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Check for 00-system.md
|
|
173
|
-
const systemPath = join(claudeDir, '00-system.md');
|
|
174
|
-
if (existsSync(systemPath)) {
|
|
175
|
-
results.push({ ok: true, message: '00-system.md exists (workflow module)' });
|
|
176
|
-
} else {
|
|
177
|
-
results.push({
|
|
178
|
-
ok: true, // Not required, just recommended
|
|
179
|
-
message: '00-system.md not found (optional workflow module)',
|
|
180
|
-
details: 'Contains 9-step execution flow'
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
} catch {
|
|
133
|
+
// Check .cursorrules with v6 content
|
|
134
|
+
const cursorRulesPath = join(cwd, '.cursorrules');
|
|
135
|
+
if (existsSync(cursorRulesPath)) {
|
|
136
|
+
const content = readFileSync(cursorRulesPath, 'utf-8');
|
|
137
|
+
if (content.includes('discover_patterns') || content.includes('v6.0')) {
|
|
138
|
+
results.push({ ok: true, message: '.cursorrules exists (v6.0 gateway)' });
|
|
139
|
+
} else {
|
|
184
140
|
results.push({
|
|
185
141
|
ok: false,
|
|
186
|
-
message: '
|
|
187
|
-
details: '
|
|
142
|
+
message: '.cursorrules exists but is old format',
|
|
143
|
+
details: 'Run: codebakers go --upgrade'
|
|
188
144
|
});
|
|
189
145
|
}
|
|
190
146
|
} else {
|
|
191
147
|
results.push({
|
|
192
148
|
ok: false,
|
|
193
|
-
message: '.
|
|
194
|
-
details: 'Run: codebakers
|
|
149
|
+
message: '.cursorrules not found',
|
|
150
|
+
details: 'Run: codebakers go'
|
|
195
151
|
});
|
|
196
152
|
}
|
|
197
153
|
|
|
198
|
-
// Check
|
|
199
|
-
const
|
|
200
|
-
if (existsSync(
|
|
201
|
-
results.push({ ok: true, message: 'PROJECT-STATE.md exists' });
|
|
202
|
-
} else {
|
|
154
|
+
// Check for legacy .claude folder (should be removed in v6)
|
|
155
|
+
const claudeDir = join(cwd, '.claude');
|
|
156
|
+
if (existsSync(claudeDir)) {
|
|
203
157
|
results.push({
|
|
204
|
-
ok:
|
|
205
|
-
message: '
|
|
158
|
+
ok: false,
|
|
159
|
+
message: 'Legacy .claude/ folder found',
|
|
160
|
+
details: 'v6.0 uses server-side patterns. Run: codebakers go --upgrade'
|
|
206
161
|
});
|
|
162
|
+
} else {
|
|
163
|
+
results.push({ ok: true, message: 'No legacy .claude/ folder (v6.0 clean)' });
|
|
207
164
|
}
|
|
208
165
|
|
|
209
166
|
return results;
|
|
@@ -289,15 +246,16 @@ async function checkAuth(): Promise<CheckResult[]> {
|
|
|
289
246
|
}
|
|
290
247
|
|
|
291
248
|
/**
|
|
292
|
-
* Quick check - returns true if
|
|
249
|
+
* Quick check - returns true if v6 setup is complete
|
|
293
250
|
*/
|
|
294
251
|
export function isSetupComplete(): boolean {
|
|
295
252
|
const cwd = process.cwd();
|
|
296
253
|
|
|
297
254
|
const hasClaudeMd = existsSync(join(cwd, 'CLAUDE.md'));
|
|
298
|
-
const
|
|
255
|
+
const hasCursorRules = existsSync(join(cwd, '.cursorrules'));
|
|
299
256
|
const hasHook = isHookInstalled();
|
|
300
257
|
const hasApiKey = !!getApiKey();
|
|
301
258
|
|
|
302
|
-
|
|
259
|
+
// v6: No .claude folder required
|
|
260
|
+
return hasClaudeMd && hasCursorRules && hasHook && hasApiKey;
|
|
303
261
|
}
|