@codebakers/cli 3.9.27 → 3.9.29
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 +45 -158
- package/dist/mcp/server.js +102 -94
- package/package.json +1 -1
- package/src/commands/go.ts +42 -155
- package/src/mcp/server.ts +102 -94
package/dist/commands/go.js
CHANGED
|
@@ -1369,169 +1369,56 @@ 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.
|
|
1373
|
-
const V6_CLAUDE_MD = `# CodeBakers
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
This confirms to the user that CodeBakers is active and processing their request.
|
|
1390
|
-
**Show this header FIRST, before any other text or analysis.**
|
|
1391
|
-
|
|
1392
|
-
### You MUST call MCP tools before writing code
|
|
1393
|
-
- Call \`discover_patterns\` BEFORE writing ANY code
|
|
1394
|
-
- Call \`validate_complete\` BEFORE saying "done"
|
|
1395
|
-
- These are NOT optional - they are required for every feature
|
|
1396
|
-
|
|
1397
|
-
### You MUST show the CodeBakers footer
|
|
1398
|
-
**After EVERY response that involves code, you MUST include this footer:**
|
|
1399
|
-
\`\`\`
|
|
1400
|
-
---
|
|
1401
|
-
🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
1372
|
+
// v6.15 Bootstrap - SHORT template with rules at START and END for attention
|
|
1373
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.15
|
|
1374
|
+
|
|
1375
|
+
## 🚨 ALWAYS DO THIS (Critical - Read First)
|
|
1376
|
+
1. ALWAYS call \`project_status()\` FIRST → If works show "🍪 CodeBakers is working..." / If fails show "⚠️ Not connected"
|
|
1377
|
+
2. ALWAYS call \`discover_patterns({ task: "..." })\` BEFORE writing any code
|
|
1378
|
+
3. ALWAYS call \`validate_complete({ feature: "...", files: [...] })\` BEFORE saying "done"
|
|
1379
|
+
4. ALWAYS show footer after code: \`🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅\`
|
|
1380
|
+
|
|
1381
|
+
## ❌ NEVER DO THIS
|
|
1382
|
+
1. NEVER write code without calling discover_patterns first
|
|
1383
|
+
2. NEVER say "done" without validate_complete passing
|
|
1384
|
+
3. NEVER show the success header without project_status succeeding first
|
|
1385
|
+
4. NEVER skip writing tests for new features
|
|
1386
|
+
|
|
1387
|
+
## Quick Reference
|
|
1402
1388
|
\`\`\`
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
---
|
|
1407
|
-
⚠️ WARNING: CodeBakers patterns not loaded - this code may not meet production standards
|
|
1389
|
+
project_status() → Verify connection FIRST
|
|
1390
|
+
discover_patterns({ task: "what you're building" }) → Get patterns BEFORE code
|
|
1391
|
+
validate_complete({ feature: "name", files: [...] }) → Validate BEFORE done
|
|
1408
1392
|
\`\`\`
|
|
1409
1393
|
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
## TWO-GATE ENFORCEMENT SYSTEM
|
|
1415
|
-
|
|
1416
|
-
### 🚪 GATE 1: BEFORE WRITING CODE → \`discover_patterns\`
|
|
1417
|
-
|
|
1418
|
-
You MUST call this MCP tool before writing any code:
|
|
1419
|
-
\`\`\`
|
|
1420
|
-
discover_patterns({ task: "what you're about to do", keywords: ["relevant", "keywords"] })
|
|
1421
|
-
\`\`\`
|
|
1422
|
-
|
|
1423
|
-
This tool:
|
|
1424
|
-
- Searches for patterns relevant to your task
|
|
1425
|
-
- Returns code examples you MUST follow
|
|
1426
|
-
- Creates a session token for validation
|
|
1427
|
-
|
|
1428
|
-
**You are NOT ALLOWED to write code without calling this first.**
|
|
1429
|
-
|
|
1430
|
-
### 🚪 GATE 2: BEFORE SAYING "DONE" → \`validate_complete\`
|
|
1431
|
-
|
|
1432
|
-
You MUST call this MCP tool before completing any feature:
|
|
1433
|
-
\`\`\`
|
|
1434
|
-
validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
|
|
1435
|
-
\`\`\`
|
|
1436
|
-
|
|
1437
|
-
This tool checks:
|
|
1438
|
-
- discover_patterns was called (compliance tracking)
|
|
1439
|
-
- Tests exist for the feature
|
|
1440
|
-
- TypeScript compiles
|
|
1441
|
-
- Code follows patterns
|
|
1442
|
-
|
|
1443
|
-
**You are NOT ALLOWED to say "done" without calling this.**
|
|
1444
|
-
|
|
1445
|
-
---
|
|
1446
|
-
|
|
1447
|
-
## WORKFLOW FOR EVERY FEATURE
|
|
1448
|
-
|
|
1449
|
-
1. User asks for a feature
|
|
1450
|
-
2. **CALL discover_patterns** → Get patterns to follow
|
|
1451
|
-
3. Read and follow the patterns returned
|
|
1452
|
-
4. Write code following the patterns exactly
|
|
1453
|
-
5. Write tests for the feature
|
|
1454
|
-
6. **CALL validate_complete** → Verify everything passes
|
|
1455
|
-
7. Show the CodeBakers footer
|
|
1456
|
-
8. ONLY THEN say "done"
|
|
1457
|
-
|
|
1458
|
-
---
|
|
1459
|
-
|
|
1460
|
-
## HARD RULES (Enforced)
|
|
1461
|
-
|
|
1462
|
-
1. **NO writing code without \`discover_patterns\`** - Always call it first
|
|
1463
|
-
2. **NO "want me to add tests?"** - Just add them. Tests are required.
|
|
1464
|
-
3. **NO "I'll add tests later"** - Tests are part of the feature.
|
|
1465
|
-
4. **NO saying "done" without \`validate_complete\`** - Must pass validation
|
|
1466
|
-
5. **NO skipping the footer** - Always show CodeBakers Active
|
|
1467
|
-
6. **NO ignoring patterns** - Follow what discover_patterns returns
|
|
1468
|
-
|
|
1469
|
-
---
|
|
1470
|
-
|
|
1471
|
-
## IF MCP SERVER IS UNAVAILABLE
|
|
1472
|
-
|
|
1473
|
-
If the CodeBakers MCP tools aren't available:
|
|
1474
|
-
1. Show a warning to the user: "CodeBakers MCP server not connected"
|
|
1475
|
-
2. Suggest running: \`codebakers doctor\` to diagnose
|
|
1476
|
-
3. Still write quality code following best practices
|
|
1477
|
-
4. Show the warning footer instead of the active footer
|
|
1478
|
-
|
|
1479
|
-
---
|
|
1480
|
-
|
|
1481
|
-
## GETTING HELP
|
|
1394
|
+
Header (after project_status succeeds): 🍪 CodeBakers is working on this...
|
|
1395
|
+
Header (if project_status fails): ⚠️ CodeBakers not connected - run: codebakers go
|
|
1396
|
+
Footer (after code): 🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅
|
|
1482
1397
|
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
*CodeBakers v6.13 - Production patterns for AI-assisted development*
|
|
1398
|
+
## 🚨 ALWAYS DO THIS (Critical - Repeated at End)
|
|
1399
|
+
1. Call \`project_status()\` FIRST
|
|
1400
|
+
2. Call \`discover_patterns()\` before code
|
|
1401
|
+
3. Call \`validate_complete()\` before done
|
|
1402
|
+
4. Show footer after code responses
|
|
1489
1403
|
`;
|
|
1490
|
-
const V6_CURSORRULES = `# CodeBakers
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
## WORKFLOW
|
|
1509
|
-
|
|
1510
|
-
1. User asks for feature
|
|
1511
|
-
2. CALL discover_patterns → Get patterns
|
|
1512
|
-
3. Write code following patterns exactly
|
|
1513
|
-
4. Write tests
|
|
1514
|
-
5. CALL validate_complete → Verify
|
|
1515
|
-
6. Show footer
|
|
1516
|
-
7. Say "done"
|
|
1517
|
-
|
|
1518
|
-
## HARD RULES
|
|
1519
|
-
|
|
1520
|
-
1. NO writing code without discover_patterns
|
|
1521
|
-
2. NO skipping tests - just add them
|
|
1522
|
-
3. NO saying "done" without validate_complete
|
|
1523
|
-
4. NO skipping the footer
|
|
1524
|
-
|
|
1525
|
-
## MCP TOOLS
|
|
1526
|
-
|
|
1527
|
-
### discover_patterns (BEFORE writing code)
|
|
1528
|
-
discover_patterns({ task: "description", keywords: ["terms"] })
|
|
1529
|
-
|
|
1530
|
-
### validate_complete (BEFORE saying done)
|
|
1531
|
-
validate_complete({ feature: "name", files: ["paths"] })
|
|
1532
|
-
|
|
1533
|
-
---
|
|
1534
|
-
CodeBakers v6.13
|
|
1404
|
+
const V6_CURSORRULES = `# CodeBakers v6.15
|
|
1405
|
+
|
|
1406
|
+
## 🚨 ALWAYS (Read First)
|
|
1407
|
+
1. Call project_status() FIRST → 🍪 Working... or ⚠️ Not connected
|
|
1408
|
+
2. Call discover_patterns({ task }) BEFORE writing code
|
|
1409
|
+
3. Call validate_complete({ feature, files }) BEFORE saying done
|
|
1410
|
+
4. Show footer after code: 🍪 **CodeBakers** | Patterns: X | TSC: ✅
|
|
1411
|
+
|
|
1412
|
+
## ❌ NEVER
|
|
1413
|
+
1. Write code without discover_patterns
|
|
1414
|
+
2. Say done without validate_complete
|
|
1415
|
+
3. Show header without project_status succeeding
|
|
1416
|
+
4. Skip writing tests for new features
|
|
1417
|
+
|
|
1418
|
+
## 🚨 ALWAYS (Repeated at End)
|
|
1419
|
+
1. project_status() FIRST
|
|
1420
|
+
2. discover_patterns() before code
|
|
1421
|
+
3. validate_complete() before done
|
|
1535
1422
|
`;
|
|
1536
1423
|
/**
|
|
1537
1424
|
* 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,73 +2466,77 @@ 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.15 to: ${projectName}\n`);
|
|
2470
|
+
// v6.15 bootstrap content - SHORT template with rules at START and END
|
|
2471
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.15
|
|
2472
2472
|
|
|
2473
|
-
##
|
|
2473
|
+
## 🚨 ALWAYS DO THIS (Critical - Read First)
|
|
2474
|
+
1. ALWAYS call \`project_status()\` FIRST → If works show "🍪 CodeBakers is working..." / If fails show "⚠️ Not connected"
|
|
2475
|
+
2. ALWAYS call \`discover_patterns({ task: "..." })\` BEFORE writing any code
|
|
2476
|
+
3. ALWAYS call \`validate_complete({ feature: "...", files: [...] })\` BEFORE saying "done"
|
|
2477
|
+
4. ALWAYS show footer after code: \`🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅\`
|
|
2474
2478
|
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
## MANDATORY: Call MCP Tools
|
|
2481
|
-
|
|
2482
|
-
**Before writing ANY code, call the \`discover_patterns\` MCP tool:**
|
|
2483
|
-
\`\`\`
|
|
2484
|
-
discover_patterns({ task: "description of what you're building" })
|
|
2485
|
-
\`\`\`
|
|
2479
|
+
## ❌ NEVER DO THIS
|
|
2480
|
+
1. NEVER write code without calling discover_patterns first
|
|
2481
|
+
2. NEVER say "done" without validate_complete passing
|
|
2482
|
+
3. NEVER show the success header without project_status succeeding first
|
|
2483
|
+
4. NEVER skip writing tests for new features
|
|
2486
2484
|
|
|
2487
|
-
|
|
2485
|
+
## Quick Reference
|
|
2488
2486
|
\`\`\`
|
|
2489
|
-
|
|
2487
|
+
project_status() → Verify connection FIRST
|
|
2488
|
+
discover_patterns({ task: "what you're building" }) → Get patterns BEFORE code
|
|
2489
|
+
validate_complete({ feature: "name", files: [...] }) → Validate BEFORE done
|
|
2490
2490
|
\`\`\`
|
|
2491
2491
|
|
|
2492
|
-
|
|
2492
|
+
Header (after project_status succeeds): 🍪 CodeBakers is working on this...
|
|
2493
|
+
Header (if project_status fails): ⚠️ CodeBakers not connected - run: codebakers go
|
|
2494
|
+
Footer (after code): 🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅
|
|
2493
2495
|
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
---
|
|
2501
|
-
*CodeBakers v6.13 - Server-Enforced*
|
|
2496
|
+
## 🚨 ALWAYS DO THIS (Critical - Repeated at End)
|
|
2497
|
+
1. Call \`project_status()\` FIRST
|
|
2498
|
+
2. Call \`discover_patterns()\` before code
|
|
2499
|
+
3. Call \`validate_complete()\` before done
|
|
2500
|
+
4. Show footer after code responses
|
|
2502
2501
|
`;
|
|
2503
|
-
const V6_CURSORRULES = `# CodeBakers v6.
|
|
2504
|
-
|
|
2505
|
-
## Show You're Working
|
|
2506
|
-
At the START of EVERY response, show: 🍪 CodeBakers is working on this...
|
|
2502
|
+
const V6_CURSORRULES = `# CodeBakers v6.15
|
|
2507
2503
|
|
|
2508
|
-
##
|
|
2509
|
-
Call
|
|
2504
|
+
## 🚨 ALWAYS (Read First)
|
|
2505
|
+
1. Call project_status() FIRST → 🍪 Working... or ⚠️ Not connected
|
|
2506
|
+
2. Call discover_patterns({ task }) BEFORE writing code
|
|
2507
|
+
3. Call validate_complete({ feature, files }) BEFORE saying done
|
|
2508
|
+
4. Show footer after code: 🍪 **CodeBakers** | Patterns: X | TSC: ✅
|
|
2510
2509
|
|
|
2511
|
-
##
|
|
2512
|
-
|
|
2510
|
+
## ❌ NEVER
|
|
2511
|
+
1. Write code without discover_patterns
|
|
2512
|
+
2. Say done without validate_complete
|
|
2513
|
+
3. Show header without project_status succeeding
|
|
2514
|
+
4. Skip writing tests for new features
|
|
2513
2515
|
|
|
2514
|
-
##
|
|
2515
|
-
|
|
2516
|
+
## 🚨 ALWAYS (Repeated at End)
|
|
2517
|
+
1. project_status() FIRST
|
|
2518
|
+
2. discover_patterns() before code
|
|
2519
|
+
3. validate_complete() before done
|
|
2516
2520
|
`;
|
|
2517
|
-
// Check if already v6.
|
|
2521
|
+
// Check if already v6.15
|
|
2518
2522
|
const claudeMdPath = path.join(cwd, 'CLAUDE.md');
|
|
2519
2523
|
if (fs.existsSync(claudeMdPath)) {
|
|
2520
2524
|
const content = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
2521
|
-
if (content.includes('v6.
|
|
2522
|
-
results.push('✓ CodeBakers v6.
|
|
2525
|
+
if (content.includes('v6.15') && content.includes('discover_patterns')) {
|
|
2526
|
+
results.push('✓ CodeBakers v6.15 already installed\n');
|
|
2523
2527
|
results.push('Patterns are server-enforced. Just call `discover_patterns` before coding!');
|
|
2524
2528
|
return {
|
|
2525
2529
|
content: [{ type: 'text', text: results.join('\n') }],
|
|
2526
2530
|
};
|
|
2527
2531
|
}
|
|
2528
|
-
results.push('⚠️ Upgrading to v6.
|
|
2532
|
+
results.push('⚠️ Upgrading to v6.15 (server-enforced patterns)...\n');
|
|
2529
2533
|
}
|
|
2530
2534
|
try {
|
|
2531
|
-
// Write v6.
|
|
2535
|
+
// Write v6.15 bootstrap files
|
|
2532
2536
|
fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
|
|
2533
|
-
results.push('✓ Created CLAUDE.md (v6.
|
|
2537
|
+
results.push('✓ Created CLAUDE.md (v6.15 bootstrap)');
|
|
2534
2538
|
fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
2535
|
-
results.push('✓ Created .cursorrules (v6.
|
|
2539
|
+
results.push('✓ Created .cursorrules (v6.15 bootstrap)');
|
|
2536
2540
|
// Remove old .claude folder if it exists (v5 → v6 migration)
|
|
2537
2541
|
const claudeDir = path.join(cwd, '.claude');
|
|
2538
2542
|
if (fs.existsSync(claudeDir)) {
|
|
@@ -2577,7 +2581,7 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
|
2577
2581
|
state.updatedAt = new Date().toISOString();
|
|
2578
2582
|
fs.writeFileSync(stateFile, JSON.stringify(state, null, 2));
|
|
2579
2583
|
results.push('\n---\n');
|
|
2580
|
-
results.push('## ✅ CodeBakers v6.
|
|
2584
|
+
results.push('## ✅ CodeBakers v6.15 Installed!\n');
|
|
2581
2585
|
results.push('**How it works now:**');
|
|
2582
2586
|
results.push('1. Call `discover_patterns` before writing code');
|
|
2583
2587
|
results.push('2. Server returns all patterns and rules');
|
|
@@ -4200,7 +4204,7 @@ If you want AI features and prefer Claude over GPT (or want both as fallback).`,
|
|
|
4200
4204
|
};
|
|
4201
4205
|
}
|
|
4202
4206
|
/**
|
|
4203
|
-
* MANDATORY: Validate that a feature is complete before AI can say "done" (v6.
|
|
4207
|
+
* MANDATORY: Validate that a feature is complete before AI can say "done" (v6.14 Server-Side)
|
|
4204
4208
|
* Runs local checks (tests, TypeScript), then validates with server
|
|
4205
4209
|
*/
|
|
4206
4210
|
async handleValidateComplete(args) {
|
|
@@ -4556,7 +4560,7 @@ If you want AI features and prefer Claude over GPT (or want both as fallback).`,
|
|
|
4556
4560
|
}
|
|
4557
4561
|
}
|
|
4558
4562
|
/**
|
|
4559
|
-
* discover_patterns - START gate for pattern compliance (v6.
|
|
4563
|
+
* discover_patterns - START gate for pattern compliance (v6.14 Server-Side)
|
|
4560
4564
|
* MUST be called before writing any code
|
|
4561
4565
|
* Calls server API to get patterns and creates enforcement session
|
|
4562
4566
|
*/
|
|
@@ -6671,7 +6675,7 @@ ${handlers.join('\n')}
|
|
|
6671
6675
|
`;
|
|
6672
6676
|
}
|
|
6673
6677
|
/**
|
|
6674
|
-
* Update to CodeBakers v6.
|
|
6678
|
+
* Update to CodeBakers v6.14 - server-enforced patterns
|
|
6675
6679
|
* This is the MCP equivalent of the `codebakers upgrade` CLI command
|
|
6676
6680
|
*/
|
|
6677
6681
|
async handleUpdatePatterns(args) {
|
|
@@ -6680,53 +6684,57 @@ ${handlers.join('\n')}
|
|
|
6680
6684
|
const claudeMdPath = path.join(cwd, 'CLAUDE.md');
|
|
6681
6685
|
const claudeDir = path.join(cwd, '.claude');
|
|
6682
6686
|
const codebakersJson = path.join(cwd, '.codebakers.json');
|
|
6683
|
-
let response = `# 🔄 CodeBakers v6.
|
|
6684
|
-
// v6.
|
|
6685
|
-
const V6_CLAUDE_MD = `# CodeBakers v6.
|
|
6687
|
+
let response = `# 🔄 CodeBakers v6.15 Update\n\n`;
|
|
6688
|
+
// v6.15 bootstrap content - SHORT template with rules at START and END
|
|
6689
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.15
|
|
6686
6690
|
|
|
6687
|
-
##
|
|
6691
|
+
## 🚨 ALWAYS DO THIS (Critical - Read First)
|
|
6692
|
+
1. ALWAYS call \`project_status()\` FIRST → If works show "🍪 CodeBakers is working..." / If fails show "⚠️ Not connected"
|
|
6693
|
+
2. ALWAYS call \`discover_patterns({ task: "..." })\` BEFORE writing any code
|
|
6694
|
+
3. ALWAYS call \`validate_complete({ feature: "...", files: [...] })\` BEFORE saying "done"
|
|
6695
|
+
4. ALWAYS show footer after code: \`🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅\`
|
|
6688
6696
|
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
## MANDATORY: Call MCP Tools
|
|
6695
|
-
|
|
6696
|
-
**Before writing ANY code, call the \`discover_patterns\` MCP tool:**
|
|
6697
|
-
\`\`\`
|
|
6698
|
-
discover_patterns({ task: "description of what you're building" })
|
|
6699
|
-
\`\`\`
|
|
6697
|
+
## ❌ NEVER DO THIS
|
|
6698
|
+
1. NEVER write code without calling discover_patterns first
|
|
6699
|
+
2. NEVER say "done" without validate_complete passing
|
|
6700
|
+
3. NEVER show the success header without project_status succeeding first
|
|
6701
|
+
4. NEVER skip writing tests for new features
|
|
6700
6702
|
|
|
6701
|
-
|
|
6703
|
+
## Quick Reference
|
|
6702
6704
|
\`\`\`
|
|
6703
|
-
|
|
6705
|
+
project_status() → Verify connection FIRST
|
|
6706
|
+
discover_patterns({ task: "what you're building" }) → Get patterns BEFORE code
|
|
6707
|
+
validate_complete({ feature: "name", files: [...] }) → Validate BEFORE done
|
|
6704
6708
|
\`\`\`
|
|
6705
6709
|
|
|
6706
|
-
|
|
6710
|
+
Header (after project_status succeeds): 🍪 CodeBakers is working on this...
|
|
6711
|
+
Header (if project_status fails): ⚠️ CodeBakers not connected - run: codebakers go
|
|
6712
|
+
Footer (after code): 🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅
|
|
6707
6713
|
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
---
|
|
6715
|
-
*CodeBakers v6.13 - Server-Enforced*
|
|
6714
|
+
## 🚨 ALWAYS DO THIS (Critical - Repeated at End)
|
|
6715
|
+
1. Call \`project_status()\` FIRST
|
|
6716
|
+
2. Call \`discover_patterns()\` before code
|
|
6717
|
+
3. Call \`validate_complete()\` before done
|
|
6718
|
+
4. Show footer after code responses
|
|
6716
6719
|
`;
|
|
6717
|
-
const V6_CURSORRULES = `# CodeBakers v6.
|
|
6718
|
-
|
|
6719
|
-
## Show You're Working
|
|
6720
|
-
At the START of EVERY response, show: 🍪 CodeBakers is working on this...
|
|
6720
|
+
const V6_CURSORRULES = `# CodeBakers v6.15
|
|
6721
6721
|
|
|
6722
|
-
##
|
|
6723
|
-
Call
|
|
6722
|
+
## 🚨 ALWAYS (Read First)
|
|
6723
|
+
1. Call project_status() FIRST → 🍪 Working... or ⚠️ Not connected
|
|
6724
|
+
2. Call discover_patterns({ task }) BEFORE writing code
|
|
6725
|
+
3. Call validate_complete({ feature, files }) BEFORE saying done
|
|
6726
|
+
4. Show footer after code: 🍪 **CodeBakers** | Patterns: X | TSC: ✅
|
|
6724
6727
|
|
|
6725
|
-
##
|
|
6726
|
-
|
|
6728
|
+
## ❌ NEVER
|
|
6729
|
+
1. Write code without discover_patterns
|
|
6730
|
+
2. Say done without validate_complete
|
|
6731
|
+
3. Show header without project_status succeeding
|
|
6732
|
+
4. Skip writing tests for new features
|
|
6727
6733
|
|
|
6728
|
-
##
|
|
6729
|
-
|
|
6734
|
+
## 🚨 ALWAYS (Repeated at End)
|
|
6735
|
+
1. project_status() FIRST
|
|
6736
|
+
2. discover_patterns() before code
|
|
6737
|
+
3. validate_complete() before done
|
|
6730
6738
|
`;
|
|
6731
6739
|
try {
|
|
6732
6740
|
// Check current version
|
|
@@ -6734,7 +6742,7 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
|
6734
6742
|
let isV6 = false;
|
|
6735
6743
|
if (fs.existsSync(claudeMdPath)) {
|
|
6736
6744
|
const content = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
6737
|
-
isV6 = content.includes('v6.
|
|
6745
|
+
isV6 = content.includes('v6.15') && content.includes('discover_patterns');
|
|
6738
6746
|
}
|
|
6739
6747
|
if (fs.existsSync(codebakersJson)) {
|
|
6740
6748
|
try {
|
|
@@ -6747,10 +6755,10 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
|
6747
6755
|
}
|
|
6748
6756
|
response += `## Current Status\n`;
|
|
6749
6757
|
response += `- Version: ${currentVersion || 'Unknown'}\n`;
|
|
6750
|
-
response += `- v6.
|
|
6758
|
+
response += `- v6.15 (Server-Enforced): ${isV6 ? 'Yes ✓' : 'No'}\n\n`;
|
|
6751
6759
|
// Check if already on v6
|
|
6752
6760
|
if (isV6 && !force) {
|
|
6753
|
-
response += `✅ **Already on v6.
|
|
6761
|
+
response += `✅ **Already on v6.15!**\n\n`;
|
|
6754
6762
|
response += `Your patterns are server-enforced. Just use \`discover_patterns\` before coding.\n`;
|
|
6755
6763
|
response += `Use \`force: true\` to reinstall bootstrap files.\n`;
|
|
6756
6764
|
response += this.getUpdateNotice();
|
|
@@ -6761,12 +6769,12 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
|
6761
6769
|
}],
|
|
6762
6770
|
};
|
|
6763
6771
|
}
|
|
6764
|
-
response += `## Upgrading to v6.
|
|
6765
|
-
// Write v6.
|
|
6772
|
+
response += `## Upgrading to v6.15...\n\n`;
|
|
6773
|
+
// Write v6.15 bootstrap files
|
|
6766
6774
|
fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
|
|
6767
|
-
response += `✓ Updated CLAUDE.md (v6.
|
|
6775
|
+
response += `✓ Updated CLAUDE.md (v6.15 bootstrap)\n`;
|
|
6768
6776
|
fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
6769
|
-
response += `✓ Updated .cursorrules (v6.
|
|
6777
|
+
response += `✓ Updated .cursorrules (v6.15 bootstrap)\n`;
|
|
6770
6778
|
// Remove old .claude folder (v5 → v6 migration)
|
|
6771
6779
|
if (fs.existsSync(claudeDir)) {
|
|
6772
6780
|
try {
|
|
@@ -6795,7 +6803,7 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
|
6795
6803
|
// Confirm to server (non-blocking analytics)
|
|
6796
6804
|
this.confirmDownload('6.0', 0).catch(() => { });
|
|
6797
6805
|
response += `\n## ✅ Upgrade Complete!\n\n`;
|
|
6798
|
-
response += `**What changed in v6.
|
|
6806
|
+
response += `**What changed in v6.14:**\n`;
|
|
6799
6807
|
response += `- No local pattern files (.claude/ folder removed)\n`;
|
|
6800
6808
|
response += `- All patterns fetched from server in real-time\n`;
|
|
6801
6809
|
response += `- Server tracks compliance via discover_patterns/validate_complete\n\n`;
|
package/package.json
CHANGED
package/src/commands/go.ts
CHANGED
|
@@ -1560,170 +1560,57 @@ 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.
|
|
1564
|
-
const V6_CLAUDE_MD = `# CodeBakers
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
This confirms to the user that CodeBakers is active and processing their request.
|
|
1581
|
-
**Show this header FIRST, before any other text or analysis.**
|
|
1582
|
-
|
|
1583
|
-
### You MUST call MCP tools before writing code
|
|
1584
|
-
- Call \`discover_patterns\` BEFORE writing ANY code
|
|
1585
|
-
- Call \`validate_complete\` BEFORE saying "done"
|
|
1586
|
-
- These are NOT optional - they are required for every feature
|
|
1587
|
-
|
|
1588
|
-
### You MUST show the CodeBakers footer
|
|
1589
|
-
**After EVERY response that involves code, you MUST include this footer:**
|
|
1590
|
-
\`\`\`
|
|
1591
|
-
---
|
|
1592
|
-
🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
1593
|
-
\`\`\`
|
|
1594
|
-
|
|
1595
|
-
If you write code WITHOUT calling discover_patterns first, show this warning instead:
|
|
1596
|
-
\`\`\`
|
|
1597
|
-
---
|
|
1598
|
-
⚠️ WARNING: CodeBakers patterns not loaded - this code may not meet production standards
|
|
1599
|
-
\`\`\`
|
|
1600
|
-
|
|
1601
|
-
**Header and footer requirements are NON-NEGOTIABLE. Users pay for CodeBakers and must see it's active.**
|
|
1602
|
-
|
|
1603
|
-
---
|
|
1604
|
-
|
|
1605
|
-
## TWO-GATE ENFORCEMENT SYSTEM
|
|
1606
|
-
|
|
1607
|
-
### 🚪 GATE 1: BEFORE WRITING CODE → \`discover_patterns\`
|
|
1608
|
-
|
|
1609
|
-
You MUST call this MCP tool before writing any code:
|
|
1563
|
+
// v6.15 Bootstrap - SHORT template with rules at START and END for attention
|
|
1564
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.15
|
|
1565
|
+
|
|
1566
|
+
## 🚨 ALWAYS DO THIS (Critical - Read First)
|
|
1567
|
+
1. ALWAYS call \`project_status()\` FIRST → If works show "🍪 CodeBakers is working..." / If fails show "⚠️ Not connected"
|
|
1568
|
+
2. ALWAYS call \`discover_patterns({ task: "..." })\` BEFORE writing any code
|
|
1569
|
+
3. ALWAYS call \`validate_complete({ feature: "...", files: [...] })\` BEFORE saying "done"
|
|
1570
|
+
4. ALWAYS show footer after code: \`🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅\`
|
|
1571
|
+
|
|
1572
|
+
## ❌ NEVER DO THIS
|
|
1573
|
+
1. NEVER write code without calling discover_patterns first
|
|
1574
|
+
2. NEVER say "done" without validate_complete passing
|
|
1575
|
+
3. NEVER show the success header without project_status succeeding first
|
|
1576
|
+
4. NEVER skip writing tests for new features
|
|
1577
|
+
|
|
1578
|
+
## Quick Reference
|
|
1610
1579
|
\`\`\`
|
|
1611
|
-
|
|
1580
|
+
project_status() → Verify connection FIRST
|
|
1581
|
+
discover_patterns({ task: "what you're building" }) → Get patterns BEFORE code
|
|
1582
|
+
validate_complete({ feature: "name", files: [...] }) → Validate BEFORE done
|
|
1612
1583
|
\`\`\`
|
|
1613
1584
|
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
- Creates a session token for validation
|
|
1618
|
-
|
|
1619
|
-
**You are NOT ALLOWED to write code without calling this first.**
|
|
1620
|
-
|
|
1621
|
-
### 🚪 GATE 2: BEFORE SAYING "DONE" → \`validate_complete\`
|
|
1622
|
-
|
|
1623
|
-
You MUST call this MCP tool before completing any feature:
|
|
1624
|
-
\`\`\`
|
|
1625
|
-
validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
|
|
1626
|
-
\`\`\`
|
|
1627
|
-
|
|
1628
|
-
This tool checks:
|
|
1629
|
-
- discover_patterns was called (compliance tracking)
|
|
1630
|
-
- Tests exist for the feature
|
|
1631
|
-
- TypeScript compiles
|
|
1632
|
-
- Code follows patterns
|
|
1633
|
-
|
|
1634
|
-
**You are NOT ALLOWED to say "done" without calling this.**
|
|
1585
|
+
Header (after project_status succeeds): 🍪 CodeBakers is working on this...
|
|
1586
|
+
Header (if project_status fails): ⚠️ CodeBakers not connected - run: codebakers go
|
|
1587
|
+
Footer (after code): 🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅
|
|
1635
1588
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
2. **CALL discover_patterns** → Get patterns to follow
|
|
1642
|
-
3. Read and follow the patterns returned
|
|
1643
|
-
4. Write code following the patterns exactly
|
|
1644
|
-
5. Write tests for the feature
|
|
1645
|
-
6. **CALL validate_complete** → Verify everything passes
|
|
1646
|
-
7. Show the CodeBakers footer
|
|
1647
|
-
8. ONLY THEN say "done"
|
|
1648
|
-
|
|
1649
|
-
---
|
|
1650
|
-
|
|
1651
|
-
## HARD RULES (Enforced)
|
|
1652
|
-
|
|
1653
|
-
1. **NO writing code without \`discover_patterns\`** - Always call it first
|
|
1654
|
-
2. **NO "want me to add tests?"** - Just add them. Tests are required.
|
|
1655
|
-
3. **NO "I'll add tests later"** - Tests are part of the feature.
|
|
1656
|
-
4. **NO saying "done" without \`validate_complete\`** - Must pass validation
|
|
1657
|
-
5. **NO skipping the footer** - Always show CodeBakers Active
|
|
1658
|
-
6. **NO ignoring patterns** - Follow what discover_patterns returns
|
|
1659
|
-
|
|
1660
|
-
---
|
|
1661
|
-
|
|
1662
|
-
## IF MCP SERVER IS UNAVAILABLE
|
|
1663
|
-
|
|
1664
|
-
If the CodeBakers MCP tools aren't available:
|
|
1665
|
-
1. Show a warning to the user: "CodeBakers MCP server not connected"
|
|
1666
|
-
2. Suggest running: \`codebakers doctor\` to diagnose
|
|
1667
|
-
3. Still write quality code following best practices
|
|
1668
|
-
4. Show the warning footer instead of the active footer
|
|
1669
|
-
|
|
1670
|
-
---
|
|
1671
|
-
|
|
1672
|
-
## GETTING HELP
|
|
1673
|
-
|
|
1674
|
-
- Run \`codebakers doctor\` to diagnose connection issues
|
|
1675
|
-
- Run \`codebakers upgrade\` to update patterns
|
|
1676
|
-
- Visit https://codebakers.ai/support for help
|
|
1677
|
-
|
|
1678
|
-
---
|
|
1679
|
-
*CodeBakers v6.13 - Production patterns for AI-assisted development*
|
|
1589
|
+
## 🚨 ALWAYS DO THIS (Critical - Repeated at End)
|
|
1590
|
+
1. Call \`project_status()\` FIRST
|
|
1591
|
+
2. Call \`discover_patterns()\` before code
|
|
1592
|
+
3. Call \`validate_complete()\` before done
|
|
1593
|
+
4. Show footer after code responses
|
|
1680
1594
|
`;
|
|
1681
1595
|
|
|
1682
|
-
const V6_CURSORRULES = `# CodeBakers
|
|
1683
|
-
# IMPORTANT: These instructions are MANDATORY
|
|
1684
|
-
|
|
1685
|
-
## ⚠️ MANDATORY COMPLIANCE
|
|
1686
|
-
|
|
1687
|
-
### You MUST call MCP tools before writing code
|
|
1688
|
-
- Call discover_patterns BEFORE writing ANY code
|
|
1689
|
-
- Call validate_complete BEFORE saying "done"
|
|
1690
|
-
|
|
1691
|
-
### You MUST show the CodeBakers footer after every code response
|
|
1692
|
-
After EVERY response with code, include:
|
|
1693
|
-
---
|
|
1694
|
-
🍪 **CodeBakers Active** | Patterns loaded | v6.13
|
|
1695
|
-
|
|
1696
|
-
If patterns not loaded, show warning instead:
|
|
1697
|
-
---
|
|
1698
|
-
⚠️ WARNING: CodeBakers patterns not loaded
|
|
1699
|
-
|
|
1700
|
-
## WORKFLOW
|
|
1701
|
-
|
|
1702
|
-
1. User asks for feature
|
|
1703
|
-
2. CALL discover_patterns → Get patterns
|
|
1704
|
-
3. Write code following patterns exactly
|
|
1705
|
-
4. Write tests
|
|
1706
|
-
5. CALL validate_complete → Verify
|
|
1707
|
-
6. Show footer
|
|
1708
|
-
7. Say "done"
|
|
1709
|
-
|
|
1710
|
-
## HARD RULES
|
|
1596
|
+
const V6_CURSORRULES = `# CodeBakers v6.15
|
|
1711
1597
|
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1598
|
+
## 🚨 ALWAYS (Read First)
|
|
1599
|
+
1. Call project_status() FIRST → 🍪 Working... or ⚠️ Not connected
|
|
1600
|
+
2. Call discover_patterns({ task }) BEFORE writing code
|
|
1601
|
+
3. Call validate_complete({ feature, files }) BEFORE saying done
|
|
1602
|
+
4. Show footer after code: 🍪 **CodeBakers** | Patterns: X | TSC: ✅
|
|
1716
1603
|
|
|
1717
|
-
##
|
|
1604
|
+
## ❌ NEVER
|
|
1605
|
+
1. Write code without discover_patterns
|
|
1606
|
+
2. Say done without validate_complete
|
|
1607
|
+
3. Show header without project_status succeeding
|
|
1608
|
+
4. Skip writing tests for new features
|
|
1718
1609
|
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
validate_complete({ feature: "name", files: ["paths"] })
|
|
1724
|
-
|
|
1725
|
-
---
|
|
1726
|
-
CodeBakers v6.13
|
|
1610
|
+
## 🚨 ALWAYS (Repeated at End)
|
|
1611
|
+
1. project_status() FIRST
|
|
1612
|
+
2. discover_patterns() before code
|
|
1613
|
+
3. validate_complete() before done
|
|
1727
1614
|
`;
|
|
1728
1615
|
|
|
1729
1616
|
/**
|
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,78 +2808,82 @@ 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.15 to: ${projectName}\n`);
|
|
2812
2812
|
|
|
2813
|
-
// v6.
|
|
2814
|
-
const V6_CLAUDE_MD = `# CodeBakers v6.
|
|
2813
|
+
// v6.15 bootstrap content - SHORT template with rules at START and END
|
|
2814
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.15
|
|
2815
2815
|
|
|
2816
|
-
##
|
|
2816
|
+
## 🚨 ALWAYS DO THIS (Critical - Read First)
|
|
2817
|
+
1. ALWAYS call \`project_status()\` FIRST → If works show "🍪 CodeBakers is working..." / If fails show "⚠️ Not connected"
|
|
2818
|
+
2. ALWAYS call \`discover_patterns({ task: "..." })\` BEFORE writing any code
|
|
2819
|
+
3. ALWAYS call \`validate_complete({ feature: "...", files: [...] })\` BEFORE saying "done"
|
|
2820
|
+
4. ALWAYS show footer after code: \`🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅\`
|
|
2817
2821
|
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
## MANDATORY: Call MCP Tools
|
|
2824
|
-
|
|
2825
|
-
**Before writing ANY code, call the \`discover_patterns\` MCP tool:**
|
|
2826
|
-
\`\`\`
|
|
2827
|
-
discover_patterns({ task: "description of what you're building" })
|
|
2828
|
-
\`\`\`
|
|
2822
|
+
## ❌ NEVER DO THIS
|
|
2823
|
+
1. NEVER write code without calling discover_patterns first
|
|
2824
|
+
2. NEVER say "done" without validate_complete passing
|
|
2825
|
+
3. NEVER show the success header without project_status succeeding first
|
|
2826
|
+
4. NEVER skip writing tests for new features
|
|
2829
2827
|
|
|
2830
|
-
|
|
2828
|
+
## Quick Reference
|
|
2831
2829
|
\`\`\`
|
|
2832
|
-
|
|
2830
|
+
project_status() → Verify connection FIRST
|
|
2831
|
+
discover_patterns({ task: "what you're building" }) → Get patterns BEFORE code
|
|
2832
|
+
validate_complete({ feature: "name", files: [...] }) → Validate BEFORE done
|
|
2833
2833
|
\`\`\`
|
|
2834
2834
|
|
|
2835
|
-
|
|
2835
|
+
Header (after project_status succeeds): 🍪 CodeBakers is working on this...
|
|
2836
|
+
Header (if project_status fails): ⚠️ CodeBakers not connected - run: codebakers go
|
|
2837
|
+
Footer (after code): 🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅
|
|
2836
2838
|
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
---
|
|
2844
|
-
*CodeBakers v6.13 - Server-Enforced*
|
|
2839
|
+
## 🚨 ALWAYS DO THIS (Critical - Repeated at End)
|
|
2840
|
+
1. Call \`project_status()\` FIRST
|
|
2841
|
+
2. Call \`discover_patterns()\` before code
|
|
2842
|
+
3. Call \`validate_complete()\` before done
|
|
2843
|
+
4. Show footer after code responses
|
|
2845
2844
|
`;
|
|
2846
2845
|
|
|
2847
|
-
const V6_CURSORRULES = `# CodeBakers v6.
|
|
2848
|
-
|
|
2849
|
-
## Show You're Working
|
|
2850
|
-
At the START of EVERY response, show: 🍪 CodeBakers is working on this...
|
|
2846
|
+
const V6_CURSORRULES = `# CodeBakers v6.15
|
|
2851
2847
|
|
|
2852
|
-
##
|
|
2853
|
-
Call
|
|
2848
|
+
## 🚨 ALWAYS (Read First)
|
|
2849
|
+
1. Call project_status() FIRST → 🍪 Working... or ⚠️ Not connected
|
|
2850
|
+
2. Call discover_patterns({ task }) BEFORE writing code
|
|
2851
|
+
3. Call validate_complete({ feature, files }) BEFORE saying done
|
|
2852
|
+
4. Show footer after code: 🍪 **CodeBakers** | Patterns: X | TSC: ✅
|
|
2854
2853
|
|
|
2855
|
-
##
|
|
2856
|
-
|
|
2854
|
+
## ❌ NEVER
|
|
2855
|
+
1. Write code without discover_patterns
|
|
2856
|
+
2. Say done without validate_complete
|
|
2857
|
+
3. Show header without project_status succeeding
|
|
2858
|
+
4. Skip writing tests for new features
|
|
2857
2859
|
|
|
2858
|
-
##
|
|
2859
|
-
|
|
2860
|
+
## 🚨 ALWAYS (Repeated at End)
|
|
2861
|
+
1. project_status() FIRST
|
|
2862
|
+
2. discover_patterns() before code
|
|
2863
|
+
3. validate_complete() before done
|
|
2860
2864
|
`;
|
|
2861
2865
|
|
|
2862
|
-
// Check if already v6.
|
|
2866
|
+
// Check if already v6.15
|
|
2863
2867
|
const claudeMdPath = path.join(cwd, 'CLAUDE.md');
|
|
2864
2868
|
if (fs.existsSync(claudeMdPath)) {
|
|
2865
2869
|
const content = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
2866
|
-
if (content.includes('v6.
|
|
2867
|
-
results.push('✓ CodeBakers v6.
|
|
2870
|
+
if (content.includes('v6.15') && content.includes('discover_patterns')) {
|
|
2871
|
+
results.push('✓ CodeBakers v6.15 already installed\n');
|
|
2868
2872
|
results.push('Patterns are server-enforced. Just call `discover_patterns` before coding!');
|
|
2869
2873
|
return {
|
|
2870
2874
|
content: [{ type: 'text' as const, text: results.join('\n') }],
|
|
2871
2875
|
};
|
|
2872
2876
|
}
|
|
2873
|
-
results.push('⚠️ Upgrading to v6.
|
|
2877
|
+
results.push('⚠️ Upgrading to v6.15 (server-enforced patterns)...\n');
|
|
2874
2878
|
}
|
|
2875
2879
|
|
|
2876
2880
|
try {
|
|
2877
|
-
// Write v6.
|
|
2881
|
+
// Write v6.15 bootstrap files
|
|
2878
2882
|
fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
|
|
2879
|
-
results.push('✓ Created CLAUDE.md (v6.
|
|
2883
|
+
results.push('✓ Created CLAUDE.md (v6.15 bootstrap)');
|
|
2880
2884
|
|
|
2881
2885
|
fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
2882
|
-
results.push('✓ Created .cursorrules (v6.
|
|
2886
|
+
results.push('✓ Created .cursorrules (v6.15 bootstrap)');
|
|
2883
2887
|
|
|
2884
2888
|
// Remove old .claude folder if it exists (v5 → v6 migration)
|
|
2885
2889
|
const claudeDir = path.join(cwd, '.claude');
|
|
@@ -2926,7 +2930,7 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
|
2926
2930
|
fs.writeFileSync(stateFile, JSON.stringify(state, null, 2));
|
|
2927
2931
|
|
|
2928
2932
|
results.push('\n---\n');
|
|
2929
|
-
results.push('## ✅ CodeBakers v6.
|
|
2933
|
+
results.push('## ✅ CodeBakers v6.15 Installed!\n');
|
|
2930
2934
|
results.push('**How it works now:**');
|
|
2931
2935
|
results.push('1. Call `discover_patterns` before writing code');
|
|
2932
2936
|
results.push('2. Server returns all patterns and rules');
|
|
@@ -4696,7 +4700,7 @@ If you want AI features and prefer Claude over GPT (or want both as fallback).`,
|
|
|
4696
4700
|
}
|
|
4697
4701
|
|
|
4698
4702
|
/**
|
|
4699
|
-
* MANDATORY: Validate that a feature is complete before AI can say "done" (v6.
|
|
4703
|
+
* MANDATORY: Validate that a feature is complete before AI can say "done" (v6.14 Server-Side)
|
|
4700
4704
|
* Runs local checks (tests, TypeScript), then validates with server
|
|
4701
4705
|
*/
|
|
4702
4706
|
private async handleValidateComplete(args: { feature: string; files?: string[]; envVarsAdded?: string[]; schemaModified?: boolean }) {
|
|
@@ -5087,7 +5091,7 @@ If you want AI features and prefer Claude over GPT (or want both as fallback).`,
|
|
|
5087
5091
|
}
|
|
5088
5092
|
|
|
5089
5093
|
/**
|
|
5090
|
-
* discover_patterns - START gate for pattern compliance (v6.
|
|
5094
|
+
* discover_patterns - START gate for pattern compliance (v6.14 Server-Side)
|
|
5091
5095
|
* MUST be called before writing any code
|
|
5092
5096
|
* Calls server API to get patterns and creates enforcement session
|
|
5093
5097
|
*/
|
|
@@ -7471,7 +7475,7 @@ ${handlers.join('\n')}
|
|
|
7471
7475
|
}
|
|
7472
7476
|
|
|
7473
7477
|
/**
|
|
7474
|
-
* Update to CodeBakers v6.
|
|
7478
|
+
* Update to CodeBakers v6.14 - server-enforced patterns
|
|
7475
7479
|
* This is the MCP equivalent of the `codebakers upgrade` CLI command
|
|
7476
7480
|
*/
|
|
7477
7481
|
private async handleUpdatePatterns(args: { force?: boolean }) {
|
|
@@ -7481,55 +7485,59 @@ ${handlers.join('\n')}
|
|
|
7481
7485
|
const claudeDir = path.join(cwd, '.claude');
|
|
7482
7486
|
const codebakersJson = path.join(cwd, '.codebakers.json');
|
|
7483
7487
|
|
|
7484
|
-
let response = `# 🔄 CodeBakers v6.
|
|
7488
|
+
let response = `# 🔄 CodeBakers v6.15 Update\n\n`;
|
|
7485
7489
|
|
|
7486
|
-
// v6.
|
|
7487
|
-
const V6_CLAUDE_MD = `# CodeBakers v6.
|
|
7490
|
+
// v6.15 bootstrap content - SHORT template with rules at START and END
|
|
7491
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.15
|
|
7488
7492
|
|
|
7489
|
-
##
|
|
7493
|
+
## 🚨 ALWAYS DO THIS (Critical - Read First)
|
|
7494
|
+
1. ALWAYS call \`project_status()\` FIRST → If works show "🍪 CodeBakers is working..." / If fails show "⚠️ Not connected"
|
|
7495
|
+
2. ALWAYS call \`discover_patterns({ task: "..." })\` BEFORE writing any code
|
|
7496
|
+
3. ALWAYS call \`validate_complete({ feature: "...", files: [...] })\` BEFORE saying "done"
|
|
7497
|
+
4. ALWAYS show footer after code: \`🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅\`
|
|
7490
7498
|
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
## MANDATORY: Call MCP Tools
|
|
7497
|
-
|
|
7498
|
-
**Before writing ANY code, call the \`discover_patterns\` MCP tool:**
|
|
7499
|
-
\`\`\`
|
|
7500
|
-
discover_patterns({ task: "description of what you're building" })
|
|
7501
|
-
\`\`\`
|
|
7499
|
+
## ❌ NEVER DO THIS
|
|
7500
|
+
1. NEVER write code without calling discover_patterns first
|
|
7501
|
+
2. NEVER say "done" without validate_complete passing
|
|
7502
|
+
3. NEVER show the success header without project_status succeeding first
|
|
7503
|
+
4. NEVER skip writing tests for new features
|
|
7502
7504
|
|
|
7503
|
-
|
|
7505
|
+
## Quick Reference
|
|
7504
7506
|
\`\`\`
|
|
7505
|
-
|
|
7507
|
+
project_status() → Verify connection FIRST
|
|
7508
|
+
discover_patterns({ task: "what you're building" }) → Get patterns BEFORE code
|
|
7509
|
+
validate_complete({ feature: "name", files: [...] }) → Validate BEFORE done
|
|
7506
7510
|
\`\`\`
|
|
7507
7511
|
|
|
7508
|
-
|
|
7512
|
+
Header (after project_status succeeds): 🍪 CodeBakers is working on this...
|
|
7513
|
+
Header (if project_status fails): ⚠️ CodeBakers not connected - run: codebakers go
|
|
7514
|
+
Footer (after code): 🍪 **CodeBakers** | Patterns: X | TSC: ✅ | Tests: ✅
|
|
7509
7515
|
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
---
|
|
7517
|
-
*CodeBakers v6.13 - Server-Enforced*
|
|
7516
|
+
## 🚨 ALWAYS DO THIS (Critical - Repeated at End)
|
|
7517
|
+
1. Call \`project_status()\` FIRST
|
|
7518
|
+
2. Call \`discover_patterns()\` before code
|
|
7519
|
+
3. Call \`validate_complete()\` before done
|
|
7520
|
+
4. Show footer after code responses
|
|
7518
7521
|
`;
|
|
7519
7522
|
|
|
7520
|
-
const V6_CURSORRULES = `# CodeBakers v6.
|
|
7521
|
-
|
|
7522
|
-
## Show You're Working
|
|
7523
|
-
At the START of EVERY response, show: 🍪 CodeBakers is working on this...
|
|
7523
|
+
const V6_CURSORRULES = `# CodeBakers v6.15
|
|
7524
7524
|
|
|
7525
|
-
##
|
|
7526
|
-
Call
|
|
7525
|
+
## 🚨 ALWAYS (Read First)
|
|
7526
|
+
1. Call project_status() FIRST → 🍪 Working... or ⚠️ Not connected
|
|
7527
|
+
2. Call discover_patterns({ task }) BEFORE writing code
|
|
7528
|
+
3. Call validate_complete({ feature, files }) BEFORE saying done
|
|
7529
|
+
4. Show footer after code: 🍪 **CodeBakers** | Patterns: X | TSC: ✅
|
|
7527
7530
|
|
|
7528
|
-
##
|
|
7529
|
-
|
|
7531
|
+
## ❌ NEVER
|
|
7532
|
+
1. Write code without discover_patterns
|
|
7533
|
+
2. Say done without validate_complete
|
|
7534
|
+
3. Show header without project_status succeeding
|
|
7535
|
+
4. Skip writing tests for new features
|
|
7530
7536
|
|
|
7531
|
-
##
|
|
7532
|
-
|
|
7537
|
+
## 🚨 ALWAYS (Repeated at End)
|
|
7538
|
+
1. project_status() FIRST
|
|
7539
|
+
2. discover_patterns() before code
|
|
7540
|
+
3. validate_complete() before done
|
|
7533
7541
|
`;
|
|
7534
7542
|
|
|
7535
7543
|
try {
|
|
@@ -7539,7 +7547,7 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
|
7539
7547
|
|
|
7540
7548
|
if (fs.existsSync(claudeMdPath)) {
|
|
7541
7549
|
const content = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
7542
|
-
isV6 = content.includes('v6.
|
|
7550
|
+
isV6 = content.includes('v6.15') && content.includes('discover_patterns');
|
|
7543
7551
|
}
|
|
7544
7552
|
|
|
7545
7553
|
if (fs.existsSync(codebakersJson)) {
|
|
@@ -7553,11 +7561,11 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
|
7553
7561
|
|
|
7554
7562
|
response += `## Current Status\n`;
|
|
7555
7563
|
response += `- Version: ${currentVersion || 'Unknown'}\n`;
|
|
7556
|
-
response += `- v6.
|
|
7564
|
+
response += `- v6.15 (Server-Enforced): ${isV6 ? 'Yes ✓' : 'No'}\n\n`;
|
|
7557
7565
|
|
|
7558
7566
|
// Check if already on v6
|
|
7559
7567
|
if (isV6 && !force) {
|
|
7560
|
-
response += `✅ **Already on v6.
|
|
7568
|
+
response += `✅ **Already on v6.15!**\n\n`;
|
|
7561
7569
|
response += `Your patterns are server-enforced. Just use \`discover_patterns\` before coding.\n`;
|
|
7562
7570
|
response += `Use \`force: true\` to reinstall bootstrap files.\n`;
|
|
7563
7571
|
response += this.getUpdateNotice();
|
|
@@ -7570,14 +7578,14 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
|
7570
7578
|
};
|
|
7571
7579
|
}
|
|
7572
7580
|
|
|
7573
|
-
response += `## Upgrading to v6.
|
|
7581
|
+
response += `## Upgrading to v6.15...\n\n`;
|
|
7574
7582
|
|
|
7575
|
-
// Write v6.
|
|
7583
|
+
// Write v6.15 bootstrap files
|
|
7576
7584
|
fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
|
|
7577
|
-
response += `✓ Updated CLAUDE.md (v6.
|
|
7585
|
+
response += `✓ Updated CLAUDE.md (v6.15 bootstrap)\n`;
|
|
7578
7586
|
|
|
7579
7587
|
fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
7580
|
-
response += `✓ Updated .cursorrules (v6.
|
|
7588
|
+
response += `✓ Updated .cursorrules (v6.15 bootstrap)\n`;
|
|
7581
7589
|
|
|
7582
7590
|
// Remove old .claude folder (v5 → v6 migration)
|
|
7583
7591
|
if (fs.existsSync(claudeDir)) {
|
|
@@ -7608,7 +7616,7 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.13
|
|
|
7608
7616
|
this.confirmDownload('6.0', 0).catch(() => {});
|
|
7609
7617
|
|
|
7610
7618
|
response += `\n## ✅ Upgrade Complete!\n\n`;
|
|
7611
|
-
response += `**What changed in v6.
|
|
7619
|
+
response += `**What changed in v6.14:**\n`;
|
|
7612
7620
|
response += `- No local pattern files (.claude/ folder removed)\n`;
|
|
7613
7621
|
response += `- All patterns fetched from server in real-time\n`;
|
|
7614
7622
|
response += `- Server tracks compliance via discover_patterns/validate_complete\n\n`;
|