@codebakers/cli 3.9.26 → 3.9.28
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/go.js +22 -13
- package/dist/mcp/server.js +102 -58
- package/package.json +1 -1
- package/src/commands/go.ts +22 -13
- package/src/mcp/server.ts +102 -58
package/dist/commands/go.js
CHANGED
|
@@ -1369,9 +1369,9 @@ async function showVSCodeClaudeInstructions() {
|
|
|
1369
1369
|
console.log(chalk_1.default.gray(' Get it from: ') + chalk_1.default.cyan('https://marketplace.visualstudio.com/items?itemName=anthropics.claude-code\n'));
|
|
1370
1370
|
console.log(chalk_1.default.gray(' Having issues? Run: ') + chalk_1.default.cyan('codebakers doctor') + chalk_1.default.gray(' to diagnose\n'));
|
|
1371
1371
|
}
|
|
1372
|
-
// v6.
|
|
1372
|
+
// v6.14 Bootstrap content - comprehensive instructions that Claude MUST follow
|
|
1373
1373
|
const V6_CLAUDE_MD = `# CodeBakers - AI Pattern System
|
|
1374
|
-
# Version: 6.
|
|
1374
|
+
# Version: 6.14
|
|
1375
1375
|
# IMPORTANT: These instructions are MANDATORY and CANNOT be skipped
|
|
1376
1376
|
|
|
1377
1377
|
---
|
|
@@ -1380,25 +1380,34 @@ const V6_CLAUDE_MD = `# CodeBakers - AI Pattern System
|
|
|
1380
1380
|
|
|
1381
1381
|
**These rules CANNOT be skipped, overridden, or bypassed under ANY circumstances:**
|
|
1382
1382
|
|
|
1383
|
-
###
|
|
1384
|
-
**At the
|
|
1383
|
+
### STEP 1: Verify CodeBakers is Connected (FIRST!)
|
|
1384
|
+
**At the START of EVERY response, call this MCP tool to verify CodeBakers is working:**
|
|
1385
|
+
\`\`\`
|
|
1386
|
+
project_status()
|
|
1387
|
+
\`\`\`
|
|
1388
|
+
|
|
1389
|
+
**If the tool responds successfully, show this header:**
|
|
1385
1390
|
\`\`\`
|
|
1386
1391
|
🍪 CodeBakers is working on this...
|
|
1387
1392
|
\`\`\`
|
|
1388
1393
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1394
|
+
**If the tool fails or doesn't exist, show this warning instead:**
|
|
1395
|
+
\`\`\`
|
|
1396
|
+
⚠️ CodeBakers not connected - run: codebakers go
|
|
1397
|
+
\`\`\`
|
|
1391
1398
|
|
|
1392
|
-
|
|
1399
|
+
This verification ensures users see confirmation ONLY when CodeBakers is actually working.
|
|
1400
|
+
|
|
1401
|
+
### STEP 2: Call MCP tools before writing code
|
|
1393
1402
|
- Call \`discover_patterns\` BEFORE writing ANY code
|
|
1394
1403
|
- Call \`validate_complete\` BEFORE saying "done"
|
|
1395
1404
|
- These are NOT optional - they are required for every feature
|
|
1396
1405
|
|
|
1397
|
-
###
|
|
1406
|
+
### STEP 3: Show the CodeBakers footer after code
|
|
1398
1407
|
**After EVERY response that involves code, you MUST include this footer:**
|
|
1399
1408
|
\`\`\`
|
|
1400
1409
|
---
|
|
1401
|
-
🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.
|
|
1410
|
+
🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
|
|
1402
1411
|
\`\`\`
|
|
1403
1412
|
|
|
1404
1413
|
If you write code WITHOUT calling discover_patterns first, show this warning instead:
|
|
@@ -1407,7 +1416,7 @@ If you write code WITHOUT calling discover_patterns first, show this warning ins
|
|
|
1407
1416
|
⚠️ WARNING: CodeBakers patterns not loaded - this code may not meet production standards
|
|
1408
1417
|
\`\`\`
|
|
1409
1418
|
|
|
1410
|
-
**
|
|
1419
|
+
**These requirements are NON-NEGOTIABLE. Users pay for CodeBakers and must see verified confirmation.**
|
|
1411
1420
|
|
|
1412
1421
|
---
|
|
1413
1422
|
|
|
@@ -1485,7 +1494,7 @@ If the CodeBakers MCP tools aren't available:
|
|
|
1485
1494
|
- Visit https://codebakers.ai/support for help
|
|
1486
1495
|
|
|
1487
1496
|
---
|
|
1488
|
-
*CodeBakers v6.
|
|
1497
|
+
*CodeBakers v6.14 - Production patterns for AI-assisted development*
|
|
1489
1498
|
`;
|
|
1490
1499
|
const V6_CURSORRULES = `# CodeBakers - AI Pattern System (Cursor Rules)
|
|
1491
1500
|
# IMPORTANT: These instructions are MANDATORY
|
|
@@ -1499,7 +1508,7 @@ const V6_CURSORRULES = `# CodeBakers - AI Pattern System (Cursor Rules)
|
|
|
1499
1508
|
### You MUST show the CodeBakers footer after every code response
|
|
1500
1509
|
After EVERY response with code, include:
|
|
1501
1510
|
---
|
|
1502
|
-
🍪 **CodeBakers Active** | Patterns loaded | v6.
|
|
1511
|
+
🍪 **CodeBakers Active** | Patterns loaded | v6.14
|
|
1503
1512
|
|
|
1504
1513
|
If patterns not loaded, show warning instead:
|
|
1505
1514
|
---
|
|
@@ -1531,7 +1540,7 @@ discover_patterns({ task: "description", keywords: ["terms"] })
|
|
|
1531
1540
|
validate_complete({ feature: "name", files: ["paths"] })
|
|
1532
1541
|
|
|
1533
1542
|
---
|
|
1534
|
-
CodeBakers v6.
|
|
1543
|
+
CodeBakers v6.14
|
|
1535
1544
|
`;
|
|
1536
1545
|
/**
|
|
1537
1546
|
* Complete project setup - handles everything:
|
package/dist/mcp/server.js
CHANGED
|
@@ -61,7 +61,7 @@ class CodeBakersServer {
|
|
|
61
61
|
pendingUpdate = null;
|
|
62
62
|
lastUpdateCheck = 0;
|
|
63
63
|
updateCheckInterval = 60 * 60 * 1000; // Check every hour
|
|
64
|
-
currentSessionToken = null; // v6.
|
|
64
|
+
currentSessionToken = null; // v6.14: Server-side enforcement session
|
|
65
65
|
constructor() {
|
|
66
66
|
this.apiKey = (0, config_js_1.getApiKey)();
|
|
67
67
|
this.apiUrl = (0, config_js_1.getApiUrl)();
|
|
@@ -1094,13 +1094,13 @@ class CodeBakersServer {
|
|
|
1094
1094
|
},
|
|
1095
1095
|
{
|
|
1096
1096
|
name: 'update_patterns',
|
|
1097
|
-
description: 'Update to CodeBakers v6.
|
|
1097
|
+
description: 'Update to CodeBakers v6.14 server-enforced patterns. Use when user says "upgrade codebakers", "update patterns", or "sync codebakers". In v6.14, patterns are server-side - this tool installs minimal bootstrap files (CLAUDE.md and .cursorrules) and removes old .claude/ folder if present.',
|
|
1098
1098
|
inputSchema: {
|
|
1099
1099
|
type: 'object',
|
|
1100
1100
|
properties: {
|
|
1101
1101
|
force: {
|
|
1102
1102
|
type: 'boolean',
|
|
1103
|
-
description: 'Force reinstall even if already on v6.
|
|
1103
|
+
description: 'Force reinstall even if already on v6.14 (default: false)',
|
|
1104
1104
|
},
|
|
1105
1105
|
},
|
|
1106
1106
|
},
|
|
@@ -2466,56 +2466,78 @@ Or if user declines, call without fullDeploy:
|
|
|
2466
2466
|
catch {
|
|
2467
2467
|
// Use default
|
|
2468
2468
|
}
|
|
2469
|
-
results.push(`# 🎨 Adding CodeBakers v6.
|
|
2470
|
-
// v6.
|
|
2471
|
-
const V6_CLAUDE_MD = `# CodeBakers v6.
|
|
2469
|
+
results.push(`# 🎨 Adding CodeBakers v6.14 to: ${projectName}\n`);
|
|
2470
|
+
// v6.14 bootstrap content - minimal files, patterns from server
|
|
2471
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.14
|
|
2472
2472
|
|
|
2473
|
-
|
|
2473
|
+
## STEP 1: Verify CodeBakers is Connected (FIRST!)
|
|
2474
2474
|
|
|
2475
|
+
**At the START of EVERY response, call this MCP tool:**
|
|
2475
2476
|
\`\`\`
|
|
2476
|
-
|
|
2477
|
-
Args: { task: "description of what you're building" }
|
|
2477
|
+
project_status()
|
|
2478
2478
|
\`\`\`
|
|
2479
2479
|
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
- Test requirements
|
|
2483
|
-
- Validation instructions
|
|
2480
|
+
**If successful, show:** 🍪 CodeBakers is working on this...
|
|
2481
|
+
**If failed, show:** ⚠️ CodeBakers not connected - run: codebakers go
|
|
2484
2482
|
|
|
2485
|
-
|
|
2483
|
+
## STEP 2: Call MCP Tools Before Code
|
|
2484
|
+
|
|
2485
|
+
**Before writing ANY code:**
|
|
2486
|
+
\`\`\`
|
|
2487
|
+
discover_patterns({ task: "description of what you're building" })
|
|
2488
|
+
\`\`\`
|
|
2489
|
+
|
|
2490
|
+
**Before saying "done":**
|
|
2491
|
+
\`\`\`
|
|
2492
|
+
validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
|
|
2493
|
+
\`\`\`
|
|
2494
|
+
|
|
2495
|
+
## STEP 3: Show Footer After Code
|
|
2496
|
+
|
|
2497
|
+
**After ANY response with code, show:**
|
|
2498
|
+
\`\`\`
|
|
2499
|
+
---
|
|
2500
|
+
🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
|
|
2501
|
+
\`\`\`
|
|
2486
2502
|
|
|
2487
2503
|
---
|
|
2488
|
-
*CodeBakers v6.
|
|
2504
|
+
*CodeBakers v6.14 - Server-Enforced*
|
|
2489
2505
|
`;
|
|
2490
|
-
const V6_CURSORRULES = `# CodeBakers v6.
|
|
2506
|
+
const V6_CURSORRULES = `# CodeBakers v6.14
|
|
2507
|
+
|
|
2508
|
+
## Verify First
|
|
2509
|
+
Call project_status() at START of every response.
|
|
2510
|
+
If success: show 🍪 CodeBakers is working on this...
|
|
2511
|
+
If fail: show ⚠️ CodeBakers not connected
|
|
2491
2512
|
|
|
2492
|
-
|
|
2513
|
+
## Before Writing Code
|
|
2514
|
+
Call: discover_patterns({ task: "description" })
|
|
2493
2515
|
|
|
2494
|
-
|
|
2495
|
-
|
|
2516
|
+
## Before Saying Done
|
|
2517
|
+
Call: validate_complete({ feature: "name", files: ["path.ts"] })
|
|
2496
2518
|
|
|
2497
|
-
|
|
2498
|
-
|
|
2519
|
+
## After Code Responses
|
|
2520
|
+
Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
|
|
2499
2521
|
`;
|
|
2500
|
-
// Check if already v6
|
|
2522
|
+
// Check if already v6.14
|
|
2501
2523
|
const claudeMdPath = path.join(cwd, 'CLAUDE.md');
|
|
2502
2524
|
if (fs.existsSync(claudeMdPath)) {
|
|
2503
2525
|
const content = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
2504
|
-
if (content.includes('v6.
|
|
2505
|
-
results.push('✓ CodeBakers v6.
|
|
2526
|
+
if (content.includes('v6.14') && content.includes('discover_patterns')) {
|
|
2527
|
+
results.push('✓ CodeBakers v6.14 already installed\n');
|
|
2506
2528
|
results.push('Patterns are server-enforced. Just call `discover_patterns` before coding!');
|
|
2507
2529
|
return {
|
|
2508
2530
|
content: [{ type: 'text', text: results.join('\n') }],
|
|
2509
2531
|
};
|
|
2510
2532
|
}
|
|
2511
|
-
results.push('⚠️ Upgrading to v6.
|
|
2533
|
+
results.push('⚠️ Upgrading to v6.14 (server-enforced patterns)...\n');
|
|
2512
2534
|
}
|
|
2513
2535
|
try {
|
|
2514
|
-
// Write v6.
|
|
2536
|
+
// Write v6.14 bootstrap files
|
|
2515
2537
|
fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
|
|
2516
|
-
results.push('✓ Created CLAUDE.md (v6.
|
|
2538
|
+
results.push('✓ Created CLAUDE.md (v6.14 bootstrap)');
|
|
2517
2539
|
fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
2518
|
-
results.push('✓ Created .cursorrules (v6.
|
|
2540
|
+
results.push('✓ Created .cursorrules (v6.14 bootstrap)');
|
|
2519
2541
|
// Remove old .claude folder if it exists (v5 → v6 migration)
|
|
2520
2542
|
const claudeDir = path.join(cwd, '.claude');
|
|
2521
2543
|
if (fs.existsSync(claudeDir)) {
|
|
@@ -2560,7 +2582,7 @@ You cannot write code without calling this tool first.
|
|
|
2560
2582
|
state.updatedAt = new Date().toISOString();
|
|
2561
2583
|
fs.writeFileSync(stateFile, JSON.stringify(state, null, 2));
|
|
2562
2584
|
results.push('\n---\n');
|
|
2563
|
-
results.push('## ✅ CodeBakers v6.
|
|
2585
|
+
results.push('## ✅ CodeBakers v6.14 Installed!\n');
|
|
2564
2586
|
results.push('**How it works now:**');
|
|
2565
2587
|
results.push('1. Call `discover_patterns` before writing code');
|
|
2566
2588
|
results.push('2. Server returns all patterns and rules');
|
|
@@ -4183,7 +4205,7 @@ If you want AI features and prefer Claude over GPT (or want both as fallback).`,
|
|
|
4183
4205
|
};
|
|
4184
4206
|
}
|
|
4185
4207
|
/**
|
|
4186
|
-
* MANDATORY: Validate that a feature is complete before AI can say "done" (v6.
|
|
4208
|
+
* MANDATORY: Validate that a feature is complete before AI can say "done" (v6.14 Server-Side)
|
|
4187
4209
|
* Runs local checks (tests, TypeScript), then validates with server
|
|
4188
4210
|
*/
|
|
4189
4211
|
async handleValidateComplete(args) {
|
|
@@ -4539,7 +4561,7 @@ If you want AI features and prefer Claude over GPT (or want both as fallback).`,
|
|
|
4539
4561
|
}
|
|
4540
4562
|
}
|
|
4541
4563
|
/**
|
|
4542
|
-
* discover_patterns - START gate for pattern compliance (v6.
|
|
4564
|
+
* discover_patterns - START gate for pattern compliance (v6.14 Server-Side)
|
|
4543
4565
|
* MUST be called before writing any code
|
|
4544
4566
|
* Calls server API to get patterns and creates enforcement session
|
|
4545
4567
|
*/
|
|
@@ -6654,7 +6676,7 @@ ${handlers.join('\n')}
|
|
|
6654
6676
|
`;
|
|
6655
6677
|
}
|
|
6656
6678
|
/**
|
|
6657
|
-
* Update to CodeBakers v6.
|
|
6679
|
+
* Update to CodeBakers v6.14 - server-enforced patterns
|
|
6658
6680
|
* This is the MCP equivalent of the `codebakers upgrade` CLI command
|
|
6659
6681
|
*/
|
|
6660
6682
|
async handleUpdatePatterns(args) {
|
|
@@ -6663,36 +6685,58 @@ ${handlers.join('\n')}
|
|
|
6663
6685
|
const claudeMdPath = path.join(cwd, 'CLAUDE.md');
|
|
6664
6686
|
const claudeDir = path.join(cwd, '.claude');
|
|
6665
6687
|
const codebakersJson = path.join(cwd, '.codebakers.json');
|
|
6666
|
-
let response = `# 🔄 CodeBakers v6.
|
|
6667
|
-
// v6.
|
|
6668
|
-
const V6_CLAUDE_MD = `# CodeBakers v6.
|
|
6688
|
+
let response = `# 🔄 CodeBakers v6.14 Update\n\n`;
|
|
6689
|
+
// v6.14 bootstrap content
|
|
6690
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.14
|
|
6669
6691
|
|
|
6670
|
-
|
|
6692
|
+
## STEP 1: Verify CodeBakers is Connected (FIRST!)
|
|
6671
6693
|
|
|
6694
|
+
**At the START of EVERY response, call this MCP tool:**
|
|
6672
6695
|
\`\`\`
|
|
6673
|
-
|
|
6674
|
-
Args: { task: "description of what you're building" }
|
|
6696
|
+
project_status()
|
|
6675
6697
|
\`\`\`
|
|
6676
6698
|
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
- Test requirements
|
|
6680
|
-
- Validation instructions
|
|
6699
|
+
**If successful, show:** 🍪 CodeBakers is working on this...
|
|
6700
|
+
**If failed, show:** ⚠️ CodeBakers not connected - run: codebakers go
|
|
6681
6701
|
|
|
6682
|
-
|
|
6702
|
+
## STEP 2: Call MCP Tools Before Code
|
|
6703
|
+
|
|
6704
|
+
**Before writing ANY code:**
|
|
6705
|
+
\`\`\`
|
|
6706
|
+
discover_patterns({ task: "description of what you're building" })
|
|
6707
|
+
\`\`\`
|
|
6708
|
+
|
|
6709
|
+
**Before saying "done":**
|
|
6710
|
+
\`\`\`
|
|
6711
|
+
validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
|
|
6712
|
+
\`\`\`
|
|
6713
|
+
|
|
6714
|
+
## STEP 3: Show Footer After Code
|
|
6715
|
+
|
|
6716
|
+
**After ANY response with code, show:**
|
|
6717
|
+
\`\`\`
|
|
6718
|
+
---
|
|
6719
|
+
🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
|
|
6720
|
+
\`\`\`
|
|
6683
6721
|
|
|
6684
6722
|
---
|
|
6685
|
-
*CodeBakers v6.
|
|
6723
|
+
*CodeBakers v6.14 - Server-Enforced*
|
|
6686
6724
|
`;
|
|
6687
|
-
const V6_CURSORRULES = `# CodeBakers v6.
|
|
6725
|
+
const V6_CURSORRULES = `# CodeBakers v6.14
|
|
6726
|
+
|
|
6727
|
+
## Verify First
|
|
6728
|
+
Call project_status() at START of every response.
|
|
6729
|
+
If success: show 🍪 CodeBakers is working on this...
|
|
6730
|
+
If fail: show ⚠️ CodeBakers not connected
|
|
6688
6731
|
|
|
6689
|
-
|
|
6732
|
+
## Before Writing Code
|
|
6733
|
+
Call: discover_patterns({ task: "description" })
|
|
6690
6734
|
|
|
6691
|
-
|
|
6692
|
-
|
|
6735
|
+
## Before Saying Done
|
|
6736
|
+
Call: validate_complete({ feature: "name", files: ["path.ts"] })
|
|
6693
6737
|
|
|
6694
|
-
|
|
6695
|
-
|
|
6738
|
+
## After Code Responses
|
|
6739
|
+
Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
|
|
6696
6740
|
`;
|
|
6697
6741
|
try {
|
|
6698
6742
|
// Check current version
|
|
@@ -6700,7 +6744,7 @@ You cannot write code without calling this tool first.
|
|
|
6700
6744
|
let isV6 = false;
|
|
6701
6745
|
if (fs.existsSync(claudeMdPath)) {
|
|
6702
6746
|
const content = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
6703
|
-
isV6 = content.includes('v6.
|
|
6747
|
+
isV6 = content.includes('v6.14') && content.includes('discover_patterns');
|
|
6704
6748
|
}
|
|
6705
6749
|
if (fs.existsSync(codebakersJson)) {
|
|
6706
6750
|
try {
|
|
@@ -6713,10 +6757,10 @@ You cannot write code without calling this tool first.
|
|
|
6713
6757
|
}
|
|
6714
6758
|
response += `## Current Status\n`;
|
|
6715
6759
|
response += `- Version: ${currentVersion || 'Unknown'}\n`;
|
|
6716
|
-
response += `- v6.
|
|
6760
|
+
response += `- v6.14 (Server-Enforced): ${isV6 ? 'Yes ✓' : 'No'}\n\n`;
|
|
6717
6761
|
// Check if already on v6
|
|
6718
6762
|
if (isV6 && !force) {
|
|
6719
|
-
response += `✅ **Already on v6.
|
|
6763
|
+
response += `✅ **Already on v6.14!**\n\n`;
|
|
6720
6764
|
response += `Your patterns are server-enforced. Just use \`discover_patterns\` before coding.\n`;
|
|
6721
6765
|
response += `Use \`force: true\` to reinstall bootstrap files.\n`;
|
|
6722
6766
|
response += this.getUpdateNotice();
|
|
@@ -6727,12 +6771,12 @@ You cannot write code without calling this tool first.
|
|
|
6727
6771
|
}],
|
|
6728
6772
|
};
|
|
6729
6773
|
}
|
|
6730
|
-
response += `## Upgrading to v6.
|
|
6731
|
-
// Write v6.
|
|
6774
|
+
response += `## Upgrading to v6.14...\n\n`;
|
|
6775
|
+
// Write v6.14 bootstrap files
|
|
6732
6776
|
fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
|
|
6733
|
-
response += `✓ Updated CLAUDE.md (v6.
|
|
6777
|
+
response += `✓ Updated CLAUDE.md (v6.14 bootstrap)\n`;
|
|
6734
6778
|
fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
6735
|
-
response += `✓ Updated .cursorrules (v6.
|
|
6779
|
+
response += `✓ Updated .cursorrules (v6.14 bootstrap)\n`;
|
|
6736
6780
|
// Remove old .claude folder (v5 → v6 migration)
|
|
6737
6781
|
if (fs.existsSync(claudeDir)) {
|
|
6738
6782
|
try {
|
|
@@ -6761,7 +6805,7 @@ You cannot write code without calling this tool first.
|
|
|
6761
6805
|
// Confirm to server (non-blocking analytics)
|
|
6762
6806
|
this.confirmDownload('6.0', 0).catch(() => { });
|
|
6763
6807
|
response += `\n## ✅ Upgrade Complete!\n\n`;
|
|
6764
|
-
response += `**What changed in v6.
|
|
6808
|
+
response += `**What changed in v6.14:**\n`;
|
|
6765
6809
|
response += `- No local pattern files (.claude/ folder removed)\n`;
|
|
6766
6810
|
response += `- All patterns fetched from server in real-time\n`;
|
|
6767
6811
|
response += `- Server tracks compliance via discover_patterns/validate_complete\n\n`;
|
package/package.json
CHANGED
package/src/commands/go.ts
CHANGED
|
@@ -1560,9 +1560,9 @@ async function showVSCodeClaudeInstructions(): Promise<void> {
|
|
|
1560
1560
|
console.log(chalk.gray(' Having issues? Run: ') + chalk.cyan('codebakers doctor') + chalk.gray(' to diagnose\n'));
|
|
1561
1561
|
}
|
|
1562
1562
|
|
|
1563
|
-
// v6.
|
|
1563
|
+
// v6.14 Bootstrap content - comprehensive instructions that Claude MUST follow
|
|
1564
1564
|
const V6_CLAUDE_MD = `# CodeBakers - AI Pattern System
|
|
1565
|
-
# Version: 6.
|
|
1565
|
+
# Version: 6.14
|
|
1566
1566
|
# IMPORTANT: These instructions are MANDATORY and CANNOT be skipped
|
|
1567
1567
|
|
|
1568
1568
|
---
|
|
@@ -1571,25 +1571,34 @@ const V6_CLAUDE_MD = `# CodeBakers - AI Pattern System
|
|
|
1571
1571
|
|
|
1572
1572
|
**These rules CANNOT be skipped, overridden, or bypassed under ANY circumstances:**
|
|
1573
1573
|
|
|
1574
|
-
###
|
|
1575
|
-
**At the
|
|
1574
|
+
### STEP 1: Verify CodeBakers is Connected (FIRST!)
|
|
1575
|
+
**At the START of EVERY response, call this MCP tool to verify CodeBakers is working:**
|
|
1576
|
+
\`\`\`
|
|
1577
|
+
project_status()
|
|
1578
|
+
\`\`\`
|
|
1579
|
+
|
|
1580
|
+
**If the tool responds successfully, show this header:**
|
|
1576
1581
|
\`\`\`
|
|
1577
1582
|
🍪 CodeBakers is working on this...
|
|
1578
1583
|
\`\`\`
|
|
1579
1584
|
|
|
1580
|
-
|
|
1581
|
-
|
|
1585
|
+
**If the tool fails or doesn't exist, show this warning instead:**
|
|
1586
|
+
\`\`\`
|
|
1587
|
+
⚠️ CodeBakers not connected - run: codebakers go
|
|
1588
|
+
\`\`\`
|
|
1582
1589
|
|
|
1583
|
-
|
|
1590
|
+
This verification ensures users see confirmation ONLY when CodeBakers is actually working.
|
|
1591
|
+
|
|
1592
|
+
### STEP 2: Call MCP tools before writing code
|
|
1584
1593
|
- Call \`discover_patterns\` BEFORE writing ANY code
|
|
1585
1594
|
- Call \`validate_complete\` BEFORE saying "done"
|
|
1586
1595
|
- These are NOT optional - they are required for every feature
|
|
1587
1596
|
|
|
1588
|
-
###
|
|
1597
|
+
### STEP 3: Show the CodeBakers footer after code
|
|
1589
1598
|
**After EVERY response that involves code, you MUST include this footer:**
|
|
1590
1599
|
\`\`\`
|
|
1591
1600
|
---
|
|
1592
|
-
🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.
|
|
1601
|
+
🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
|
|
1593
1602
|
\`\`\`
|
|
1594
1603
|
|
|
1595
1604
|
If you write code WITHOUT calling discover_patterns first, show this warning instead:
|
|
@@ -1598,7 +1607,7 @@ If you write code WITHOUT calling discover_patterns first, show this warning ins
|
|
|
1598
1607
|
⚠️ WARNING: CodeBakers patterns not loaded - this code may not meet production standards
|
|
1599
1608
|
\`\`\`
|
|
1600
1609
|
|
|
1601
|
-
**
|
|
1610
|
+
**These requirements are NON-NEGOTIABLE. Users pay for CodeBakers and must see verified confirmation.**
|
|
1602
1611
|
|
|
1603
1612
|
---
|
|
1604
1613
|
|
|
@@ -1676,7 +1685,7 @@ If the CodeBakers MCP tools aren't available:
|
|
|
1676
1685
|
- Visit https://codebakers.ai/support for help
|
|
1677
1686
|
|
|
1678
1687
|
---
|
|
1679
|
-
*CodeBakers v6.
|
|
1688
|
+
*CodeBakers v6.14 - Production patterns for AI-assisted development*
|
|
1680
1689
|
`;
|
|
1681
1690
|
|
|
1682
1691
|
const V6_CURSORRULES = `# CodeBakers - AI Pattern System (Cursor Rules)
|
|
@@ -1691,7 +1700,7 @@ const V6_CURSORRULES = `# CodeBakers - AI Pattern System (Cursor Rules)
|
|
|
1691
1700
|
### You MUST show the CodeBakers footer after every code response
|
|
1692
1701
|
After EVERY response with code, include:
|
|
1693
1702
|
---
|
|
1694
|
-
🍪 **CodeBakers Active** | Patterns loaded | v6.
|
|
1703
|
+
🍪 **CodeBakers Active** | Patterns loaded | v6.14
|
|
1695
1704
|
|
|
1696
1705
|
If patterns not loaded, show warning instead:
|
|
1697
1706
|
---
|
|
@@ -1723,7 +1732,7 @@ discover_patterns({ task: "description", keywords: ["terms"] })
|
|
|
1723
1732
|
validate_complete({ feature: "name", files: ["paths"] })
|
|
1724
1733
|
|
|
1725
1734
|
---
|
|
1726
|
-
CodeBakers v6.
|
|
1735
|
+
CodeBakers v6.14
|
|
1727
1736
|
`;
|
|
1728
1737
|
|
|
1729
1738
|
/**
|
package/src/mcp/server.ts
CHANGED
|
@@ -69,7 +69,7 @@ class CodeBakersServer {
|
|
|
69
69
|
private pendingUpdate: { current: string; latest: string } | null = null;
|
|
70
70
|
private lastUpdateCheck = 0;
|
|
71
71
|
private updateCheckInterval = 60 * 60 * 1000; // Check every hour
|
|
72
|
-
private currentSessionToken: string | null = null; // v6.
|
|
72
|
+
private currentSessionToken: string | null = null; // v6.14: Server-side enforcement session
|
|
73
73
|
|
|
74
74
|
constructor() {
|
|
75
75
|
this.apiKey = getApiKey();
|
|
@@ -1191,13 +1191,13 @@ class CodeBakersServer {
|
|
|
1191
1191
|
{
|
|
1192
1192
|
name: 'update_patterns',
|
|
1193
1193
|
description:
|
|
1194
|
-
'Update to CodeBakers v6.
|
|
1194
|
+
'Update to CodeBakers v6.14 server-enforced patterns. Use when user says "upgrade codebakers", "update patterns", or "sync codebakers". In v6.14, patterns are server-side - this tool installs minimal bootstrap files (CLAUDE.md and .cursorrules) and removes old .claude/ folder if present.',
|
|
1195
1195
|
inputSchema: {
|
|
1196
1196
|
type: 'object' as const,
|
|
1197
1197
|
properties: {
|
|
1198
1198
|
force: {
|
|
1199
1199
|
type: 'boolean',
|
|
1200
|
-
description: 'Force reinstall even if already on v6.
|
|
1200
|
+
description: 'Force reinstall even if already on v6.14 (default: false)',
|
|
1201
1201
|
},
|
|
1202
1202
|
},
|
|
1203
1203
|
},
|
|
@@ -2808,61 +2808,83 @@ Or if user declines, call without fullDeploy:
|
|
|
2808
2808
|
// Use default
|
|
2809
2809
|
}
|
|
2810
2810
|
|
|
2811
|
-
results.push(`# 🎨 Adding CodeBakers v6.
|
|
2811
|
+
results.push(`# 🎨 Adding CodeBakers v6.14 to: ${projectName}\n`);
|
|
2812
2812
|
|
|
2813
|
-
// v6.
|
|
2814
|
-
const V6_CLAUDE_MD = `# CodeBakers v6.
|
|
2813
|
+
// v6.14 bootstrap content - minimal files, patterns from server
|
|
2814
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.14
|
|
2815
2815
|
|
|
2816
|
-
|
|
2816
|
+
## STEP 1: Verify CodeBakers is Connected (FIRST!)
|
|
2817
2817
|
|
|
2818
|
+
**At the START of EVERY response, call this MCP tool:**
|
|
2818
2819
|
\`\`\`
|
|
2819
|
-
|
|
2820
|
-
Args: { task: "description of what you're building" }
|
|
2820
|
+
project_status()
|
|
2821
2821
|
\`\`\`
|
|
2822
2822
|
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
- Test requirements
|
|
2826
|
-
- Validation instructions
|
|
2823
|
+
**If successful, show:** 🍪 CodeBakers is working on this...
|
|
2824
|
+
**If failed, show:** ⚠️ CodeBakers not connected - run: codebakers go
|
|
2827
2825
|
|
|
2828
|
-
|
|
2826
|
+
## STEP 2: Call MCP Tools Before Code
|
|
2827
|
+
|
|
2828
|
+
**Before writing ANY code:**
|
|
2829
|
+
\`\`\`
|
|
2830
|
+
discover_patterns({ task: "description of what you're building" })
|
|
2831
|
+
\`\`\`
|
|
2832
|
+
|
|
2833
|
+
**Before saying "done":**
|
|
2834
|
+
\`\`\`
|
|
2835
|
+
validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
|
|
2836
|
+
\`\`\`
|
|
2837
|
+
|
|
2838
|
+
## STEP 3: Show Footer After Code
|
|
2839
|
+
|
|
2840
|
+
**After ANY response with code, show:**
|
|
2841
|
+
\`\`\`
|
|
2842
|
+
---
|
|
2843
|
+
🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
|
|
2844
|
+
\`\`\`
|
|
2829
2845
|
|
|
2830
2846
|
---
|
|
2831
|
-
*CodeBakers v6.
|
|
2847
|
+
*CodeBakers v6.14 - Server-Enforced*
|
|
2832
2848
|
`;
|
|
2833
2849
|
|
|
2834
|
-
const V6_CURSORRULES = `# CodeBakers v6.
|
|
2850
|
+
const V6_CURSORRULES = `# CodeBakers v6.14
|
|
2851
|
+
|
|
2852
|
+
## Verify First
|
|
2853
|
+
Call project_status() at START of every response.
|
|
2854
|
+
If success: show 🍪 CodeBakers is working on this...
|
|
2855
|
+
If fail: show ⚠️ CodeBakers not connected
|
|
2835
2856
|
|
|
2836
|
-
|
|
2857
|
+
## Before Writing Code
|
|
2858
|
+
Call: discover_patterns({ task: "description" })
|
|
2837
2859
|
|
|
2838
|
-
|
|
2839
|
-
|
|
2860
|
+
## Before Saying Done
|
|
2861
|
+
Call: validate_complete({ feature: "name", files: ["path.ts"] })
|
|
2840
2862
|
|
|
2841
|
-
|
|
2842
|
-
|
|
2863
|
+
## After Code Responses
|
|
2864
|
+
Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
|
|
2843
2865
|
`;
|
|
2844
2866
|
|
|
2845
|
-
// Check if already v6
|
|
2867
|
+
// Check if already v6.14
|
|
2846
2868
|
const claudeMdPath = path.join(cwd, 'CLAUDE.md');
|
|
2847
2869
|
if (fs.existsSync(claudeMdPath)) {
|
|
2848
2870
|
const content = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
2849
|
-
if (content.includes('v6.
|
|
2850
|
-
results.push('✓ CodeBakers v6.
|
|
2871
|
+
if (content.includes('v6.14') && content.includes('discover_patterns')) {
|
|
2872
|
+
results.push('✓ CodeBakers v6.14 already installed\n');
|
|
2851
2873
|
results.push('Patterns are server-enforced. Just call `discover_patterns` before coding!');
|
|
2852
2874
|
return {
|
|
2853
2875
|
content: [{ type: 'text' as const, text: results.join('\n') }],
|
|
2854
2876
|
};
|
|
2855
2877
|
}
|
|
2856
|
-
results.push('⚠️ Upgrading to v6.
|
|
2878
|
+
results.push('⚠️ Upgrading to v6.14 (server-enforced patterns)...\n');
|
|
2857
2879
|
}
|
|
2858
2880
|
|
|
2859
2881
|
try {
|
|
2860
|
-
// Write v6.
|
|
2882
|
+
// Write v6.14 bootstrap files
|
|
2861
2883
|
fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
|
|
2862
|
-
results.push('✓ Created CLAUDE.md (v6.
|
|
2884
|
+
results.push('✓ Created CLAUDE.md (v6.14 bootstrap)');
|
|
2863
2885
|
|
|
2864
2886
|
fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
2865
|
-
results.push('✓ Created .cursorrules (v6.
|
|
2887
|
+
results.push('✓ Created .cursorrules (v6.14 bootstrap)');
|
|
2866
2888
|
|
|
2867
2889
|
// Remove old .claude folder if it exists (v5 → v6 migration)
|
|
2868
2890
|
const claudeDir = path.join(cwd, '.claude');
|
|
@@ -2909,7 +2931,7 @@ You cannot write code without calling this tool first.
|
|
|
2909
2931
|
fs.writeFileSync(stateFile, JSON.stringify(state, null, 2));
|
|
2910
2932
|
|
|
2911
2933
|
results.push('\n---\n');
|
|
2912
|
-
results.push('## ✅ CodeBakers v6.
|
|
2934
|
+
results.push('## ✅ CodeBakers v6.14 Installed!\n');
|
|
2913
2935
|
results.push('**How it works now:**');
|
|
2914
2936
|
results.push('1. Call `discover_patterns` before writing code');
|
|
2915
2937
|
results.push('2. Server returns all patterns and rules');
|
|
@@ -4679,7 +4701,7 @@ If you want AI features and prefer Claude over GPT (or want both as fallback).`,
|
|
|
4679
4701
|
}
|
|
4680
4702
|
|
|
4681
4703
|
/**
|
|
4682
|
-
* MANDATORY: Validate that a feature is complete before AI can say "done" (v6.
|
|
4704
|
+
* MANDATORY: Validate that a feature is complete before AI can say "done" (v6.14 Server-Side)
|
|
4683
4705
|
* Runs local checks (tests, TypeScript), then validates with server
|
|
4684
4706
|
*/
|
|
4685
4707
|
private async handleValidateComplete(args: { feature: string; files?: string[]; envVarsAdded?: string[]; schemaModified?: boolean }) {
|
|
@@ -5070,7 +5092,7 @@ If you want AI features and prefer Claude over GPT (or want both as fallback).`,
|
|
|
5070
5092
|
}
|
|
5071
5093
|
|
|
5072
5094
|
/**
|
|
5073
|
-
* discover_patterns - START gate for pattern compliance (v6.
|
|
5095
|
+
* discover_patterns - START gate for pattern compliance (v6.14 Server-Side)
|
|
5074
5096
|
* MUST be called before writing any code
|
|
5075
5097
|
* Calls server API to get patterns and creates enforcement session
|
|
5076
5098
|
*/
|
|
@@ -7454,7 +7476,7 @@ ${handlers.join('\n')}
|
|
|
7454
7476
|
}
|
|
7455
7477
|
|
|
7456
7478
|
/**
|
|
7457
|
-
* Update to CodeBakers v6.
|
|
7479
|
+
* Update to CodeBakers v6.14 - server-enforced patterns
|
|
7458
7480
|
* This is the MCP equivalent of the `codebakers upgrade` CLI command
|
|
7459
7481
|
*/
|
|
7460
7482
|
private async handleUpdatePatterns(args: { force?: boolean }) {
|
|
@@ -7464,38 +7486,60 @@ ${handlers.join('\n')}
|
|
|
7464
7486
|
const claudeDir = path.join(cwd, '.claude');
|
|
7465
7487
|
const codebakersJson = path.join(cwd, '.codebakers.json');
|
|
7466
7488
|
|
|
7467
|
-
let response = `# 🔄 CodeBakers v6.
|
|
7489
|
+
let response = `# 🔄 CodeBakers v6.14 Update\n\n`;
|
|
7468
7490
|
|
|
7469
|
-
// v6.
|
|
7470
|
-
const V6_CLAUDE_MD = `# CodeBakers v6.
|
|
7491
|
+
// v6.14 bootstrap content
|
|
7492
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.14
|
|
7471
7493
|
|
|
7472
|
-
|
|
7494
|
+
## STEP 1: Verify CodeBakers is Connected (FIRST!)
|
|
7473
7495
|
|
|
7496
|
+
**At the START of EVERY response, call this MCP tool:**
|
|
7474
7497
|
\`\`\`
|
|
7475
|
-
|
|
7476
|
-
Args: { task: "description of what you're building" }
|
|
7498
|
+
project_status()
|
|
7477
7499
|
\`\`\`
|
|
7478
7500
|
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
- Test requirements
|
|
7482
|
-
- Validation instructions
|
|
7501
|
+
**If successful, show:** 🍪 CodeBakers is working on this...
|
|
7502
|
+
**If failed, show:** ⚠️ CodeBakers not connected - run: codebakers go
|
|
7483
7503
|
|
|
7484
|
-
|
|
7504
|
+
## STEP 2: Call MCP Tools Before Code
|
|
7505
|
+
|
|
7506
|
+
**Before writing ANY code:**
|
|
7507
|
+
\`\`\`
|
|
7508
|
+
discover_patterns({ task: "description of what you're building" })
|
|
7509
|
+
\`\`\`
|
|
7510
|
+
|
|
7511
|
+
**Before saying "done":**
|
|
7512
|
+
\`\`\`
|
|
7513
|
+
validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
|
|
7514
|
+
\`\`\`
|
|
7515
|
+
|
|
7516
|
+
## STEP 3: Show Footer After Code
|
|
7517
|
+
|
|
7518
|
+
**After ANY response with code, show:**
|
|
7519
|
+
\`\`\`
|
|
7520
|
+
---
|
|
7521
|
+
🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
|
|
7522
|
+
\`\`\`
|
|
7485
7523
|
|
|
7486
7524
|
---
|
|
7487
|
-
*CodeBakers v6.
|
|
7525
|
+
*CodeBakers v6.14 - Server-Enforced*
|
|
7488
7526
|
`;
|
|
7489
7527
|
|
|
7490
|
-
const V6_CURSORRULES = `# CodeBakers v6.
|
|
7528
|
+
const V6_CURSORRULES = `# CodeBakers v6.14
|
|
7529
|
+
|
|
7530
|
+
## Verify First
|
|
7531
|
+
Call project_status() at START of every response.
|
|
7532
|
+
If success: show 🍪 CodeBakers is working on this...
|
|
7533
|
+
If fail: show ⚠️ CodeBakers not connected
|
|
7491
7534
|
|
|
7492
|
-
|
|
7535
|
+
## Before Writing Code
|
|
7536
|
+
Call: discover_patterns({ task: "description" })
|
|
7493
7537
|
|
|
7494
|
-
|
|
7495
|
-
|
|
7538
|
+
## Before Saying Done
|
|
7539
|
+
Call: validate_complete({ feature: "name", files: ["path.ts"] })
|
|
7496
7540
|
|
|
7497
|
-
|
|
7498
|
-
|
|
7541
|
+
## After Code Responses
|
|
7542
|
+
Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
|
|
7499
7543
|
`;
|
|
7500
7544
|
|
|
7501
7545
|
try {
|
|
@@ -7505,7 +7549,7 @@ You cannot write code without calling this tool first.
|
|
|
7505
7549
|
|
|
7506
7550
|
if (fs.existsSync(claudeMdPath)) {
|
|
7507
7551
|
const content = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
7508
|
-
isV6 = content.includes('v6.
|
|
7552
|
+
isV6 = content.includes('v6.14') && content.includes('discover_patterns');
|
|
7509
7553
|
}
|
|
7510
7554
|
|
|
7511
7555
|
if (fs.existsSync(codebakersJson)) {
|
|
@@ -7519,11 +7563,11 @@ You cannot write code without calling this tool first.
|
|
|
7519
7563
|
|
|
7520
7564
|
response += `## Current Status\n`;
|
|
7521
7565
|
response += `- Version: ${currentVersion || 'Unknown'}\n`;
|
|
7522
|
-
response += `- v6.
|
|
7566
|
+
response += `- v6.14 (Server-Enforced): ${isV6 ? 'Yes ✓' : 'No'}\n\n`;
|
|
7523
7567
|
|
|
7524
7568
|
// Check if already on v6
|
|
7525
7569
|
if (isV6 && !force) {
|
|
7526
|
-
response += `✅ **Already on v6.
|
|
7570
|
+
response += `✅ **Already on v6.14!**\n\n`;
|
|
7527
7571
|
response += `Your patterns are server-enforced. Just use \`discover_patterns\` before coding.\n`;
|
|
7528
7572
|
response += `Use \`force: true\` to reinstall bootstrap files.\n`;
|
|
7529
7573
|
response += this.getUpdateNotice();
|
|
@@ -7536,14 +7580,14 @@ You cannot write code without calling this tool first.
|
|
|
7536
7580
|
};
|
|
7537
7581
|
}
|
|
7538
7582
|
|
|
7539
|
-
response += `## Upgrading to v6.
|
|
7583
|
+
response += `## Upgrading to v6.14...\n\n`;
|
|
7540
7584
|
|
|
7541
|
-
// Write v6.
|
|
7585
|
+
// Write v6.14 bootstrap files
|
|
7542
7586
|
fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
|
|
7543
|
-
response += `✓ Updated CLAUDE.md (v6.
|
|
7587
|
+
response += `✓ Updated CLAUDE.md (v6.14 bootstrap)\n`;
|
|
7544
7588
|
|
|
7545
7589
|
fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
7546
|
-
response += `✓ Updated .cursorrules (v6.
|
|
7590
|
+
response += `✓ Updated .cursorrules (v6.14 bootstrap)\n`;
|
|
7547
7591
|
|
|
7548
7592
|
// Remove old .claude folder (v5 → v6 migration)
|
|
7549
7593
|
if (fs.existsSync(claudeDir)) {
|
|
@@ -7574,7 +7618,7 @@ You cannot write code without calling this tool first.
|
|
|
7574
7618
|
this.confirmDownload('6.0', 0).catch(() => {});
|
|
7575
7619
|
|
|
7576
7620
|
response += `\n## ✅ Upgrade Complete!\n\n`;
|
|
7577
|
-
response += `**What changed in v6.
|
|
7621
|
+
response += `**What changed in v6.14:**\n`;
|
|
7578
7622
|
response += `- No local pattern files (.claude/ folder removed)\n`;
|
|
7579
7623
|
response += `- All patterns fetched from server in real-time\n`;
|
|
7580
7624
|
response += `- Server tracks compliance via discover_patterns/validate_complete\n\n`;
|