@codebakers/cli 3.9.28 → 3.9.30

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.
@@ -1369,178 +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.14 Bootstrap content - comprehensive instructions that Claude MUST follow
1373
- const V6_CLAUDE_MD = `# CodeBakers - AI Pattern System
1374
- # Version: 6.14
1375
- # IMPORTANT: These instructions are MANDATORY and CANNOT be skipped
1376
-
1377
- ---
1378
-
1379
- ## ⚠️ MANDATORY COMPLIANCE (READ THIS FIRST)
1380
-
1381
- **These rules CANNOT be skipped, overridden, or bypassed under ANY circumstances:**
1382
-
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:**
1390
- \`\`\`
1391
- 🍪 CodeBakers is working on this...
1392
- \`\`\`
1393
-
1394
- **If the tool fails or doesn't exist, show this warning instead:**
1395
- \`\`\`
1396
- ⚠️ CodeBakers not connected - run: codebakers go
1397
- \`\`\`
1398
-
1399
- This verification ensures users see confirmation ONLY when CodeBakers is actually working.
1400
-
1401
- ### STEP 2: Call MCP tools before writing code
1402
- - Call \`discover_patterns\` BEFORE writing ANY code
1403
- - Call \`validate_complete\` BEFORE saying "done"
1404
- - These are NOT optional - they are required for every feature
1405
-
1406
- ### STEP 3: Show the CodeBakers footer after code
1407
- **After EVERY response that involves code, you MUST include this footer:**
1408
- \`\`\`
1409
- ---
1410
- 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
1411
- \`\`\`
1412
-
1413
- If you write code WITHOUT calling discover_patterns first, show this warning instead:
1414
- \`\`\`
1415
- ---
1416
- ⚠️ WARNING: CodeBakers patterns not loaded - this code may not meet production standards
1417
- \`\`\`
1418
-
1419
- **These requirements are NON-NEGOTIABLE. Users pay for CodeBakers and must see verified confirmation.**
1420
-
1421
- ---
1422
-
1423
- ## TWO-GATE ENFORCEMENT SYSTEM
1424
-
1425
- ### 🚪 GATE 1: BEFORE WRITING CODE → \`discover_patterns\`
1426
-
1427
- You MUST call this MCP tool before writing any code:
1428
- \`\`\`
1429
- discover_patterns({ task: "what you're about to do", keywords: ["relevant", "keywords"] })
1430
- \`\`\`
1431
-
1432
- This tool:
1433
- - Searches for patterns relevant to your task
1434
- - Returns code examples you MUST follow
1435
- - Creates a session token for validation
1436
-
1437
- **You are NOT ALLOWED to write code without calling this first.**
1438
-
1439
- ### 🚪 GATE 2: BEFORE SAYING "DONE" → \`validate_complete\`
1440
-
1441
- You MUST call this MCP tool before completing any feature:
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
1442
1388
  \`\`\`
1443
- validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
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
1444
1392
  \`\`\`
1445
1393
 
1446
- This tool checks:
1447
- - discover_patterns was called (compliance tracking)
1448
- - Tests exist for the feature
1449
- - TypeScript compiles
1450
- - Code follows patterns
1451
-
1452
- **You are NOT ALLOWED to say "done" without calling this.**
1453
-
1454
- ---
1455
-
1456
- ## WORKFLOW FOR EVERY FEATURE
1457
-
1458
- 1. User asks for a feature
1459
- 2. **CALL discover_patterns** → Get patterns to follow
1460
- 3. Read and follow the patterns returned
1461
- 4. Write code following the patterns exactly
1462
- 5. Write tests for the feature
1463
- 6. **CALL validate_complete** → Verify everything passes
1464
- 7. Show the CodeBakers footer
1465
- 8. ONLY THEN say "done"
1466
-
1467
- ---
1468
-
1469
- ## HARD RULES (Enforced)
1470
-
1471
- 1. **NO writing code without \`discover_patterns\`** - Always call it first
1472
- 2. **NO "want me to add tests?"** - Just add them. Tests are required.
1473
- 3. **NO "I'll add tests later"** - Tests are part of the feature.
1474
- 4. **NO saying "done" without \`validate_complete\`** - Must pass validation
1475
- 5. **NO skipping the footer** - Always show CodeBakers Active
1476
- 6. **NO ignoring patterns** - Follow what discover_patterns returns
1477
-
1478
- ---
1479
-
1480
- ## IF MCP SERVER IS UNAVAILABLE
1481
-
1482
- If the CodeBakers MCP tools aren't available:
1483
- 1. Show a warning to the user: "CodeBakers MCP server not connected"
1484
- 2. Suggest running: \`codebakers doctor\` to diagnose
1485
- 3. Still write quality code following best practices
1486
- 4. Show the warning footer instead of the active footer
1487
-
1488
- ---
1489
-
1490
- ## 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: ✅
1491
1397
 
1492
- - Run \`codebakers doctor\` to diagnose connection issues
1493
- - Run \`codebakers upgrade\` to update patterns
1494
- - Visit https://codebakers.ai/support for help
1495
-
1496
- ---
1497
- *CodeBakers v6.14 - 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
1498
1403
  `;
1499
- const V6_CURSORRULES = `# CodeBakers - AI Pattern System (Cursor Rules)
1500
- # IMPORTANT: These instructions are MANDATORY
1501
-
1502
- ## ⚠️ MANDATORY COMPLIANCE
1503
-
1504
- ### You MUST call MCP tools before writing code
1505
- - Call discover_patterns BEFORE writing ANY code
1506
- - Call validate_complete BEFORE saying "done"
1507
-
1508
- ### You MUST show the CodeBakers footer after every code response
1509
- After EVERY response with code, include:
1510
- ---
1511
- 🍪 **CodeBakers Active** | Patterns loaded | v6.14
1512
-
1513
- If patterns not loaded, show warning instead:
1514
- ---
1515
- ⚠️ WARNING: CodeBakers patterns not loaded
1516
-
1517
- ## WORKFLOW
1518
-
1519
- 1. User asks for feature
1520
- 2. CALL discover_patterns → Get patterns
1521
- 3. Write code following patterns exactly
1522
- 4. Write tests
1523
- 5. CALL validate_complete → Verify
1524
- 6. Show footer
1525
- 7. Say "done"
1526
-
1527
- ## HARD RULES
1528
-
1529
- 1. NO writing code without discover_patterns
1530
- 2. NO skipping tests - just add them
1531
- 3. NO saying "done" without validate_complete
1532
- 4. NO skipping the footer
1533
-
1534
- ## MCP TOOLS
1535
-
1536
- ### discover_patterns (BEFORE writing code)
1537
- discover_patterns({ task: "description", keywords: ["terms"] })
1538
-
1539
- ### validate_complete (BEFORE saying done)
1540
- validate_complete({ feature: "name", files: ["paths"] })
1541
-
1542
- ---
1543
- CodeBakers v6.14
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
1544
1422
  `;
1545
1423
  /**
1546
1424
  * Complete project setup - handles everything:
@@ -2466,78 +2466,77 @@ Or if user declines, call without fullDeploy:
2466
2466
  catch {
2467
2467
  // Use default
2468
2468
  }
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
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
- ## STEP 1: Verify CodeBakers is Connected (FIRST!)
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
- **At the START of EVERY response, call this MCP tool:**
2476
- \`\`\`
2477
- project_status()
2478
- \`\`\`
2479
-
2480
- **If successful, show:** 🍪 CodeBakers is working on this...
2481
- **If failed, show:** ⚠️ CodeBakers not connected - run: codebakers go
2482
-
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
- \`\`\`
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
2489
2484
 
2490
- **Before saying "done":**
2485
+ ## Quick Reference
2491
2486
  \`\`\`
2492
- validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
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
2493
2490
  \`\`\`
2494
2491
 
2495
- ## STEP 3: Show Footer After Code
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: ✅
2496
2495
 
2497
- **After ANY response with code, show:**
2498
- \`\`\`
2499
- ---
2500
- 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
2501
- \`\`\`
2502
-
2503
- ---
2504
- *CodeBakers v6.14 - 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
2505
2501
  `;
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
2502
+ const V6_CURSORRULES = `# CodeBakers v6.15
2512
2503
 
2513
- ## Before Writing Code
2514
- Call: discover_patterns({ task: "description" })
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: ✅
2515
2509
 
2516
- ## Before Saying Done
2517
- Call: validate_complete({ feature: "name", files: ["path.ts"] })
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
2518
2515
 
2519
- ## After Code Responses
2520
- Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
2516
+ ## 🚨 ALWAYS (Repeated at End)
2517
+ 1. project_status() FIRST
2518
+ 2. discover_patterns() before code
2519
+ 3. validate_complete() before done
2521
2520
  `;
2522
- // Check if already v6.14
2521
+ // Check if already v6.15
2523
2522
  const claudeMdPath = path.join(cwd, 'CLAUDE.md');
2524
2523
  if (fs.existsSync(claudeMdPath)) {
2525
2524
  const content = fs.readFileSync(claudeMdPath, 'utf-8');
2526
- if (content.includes('v6.14') && content.includes('discover_patterns')) {
2527
- results.push('✓ CodeBakers v6.14 already installed\n');
2525
+ if (content.includes('v6.15') && content.includes('discover_patterns')) {
2526
+ results.push('✓ CodeBakers v6.15 already installed\n');
2528
2527
  results.push('Patterns are server-enforced. Just call `discover_patterns` before coding!');
2529
2528
  return {
2530
2529
  content: [{ type: 'text', text: results.join('\n') }],
2531
2530
  };
2532
2531
  }
2533
- results.push('⚠️ Upgrading to v6.14 (server-enforced patterns)...\n');
2532
+ results.push('⚠️ Upgrading to v6.15 (server-enforced patterns)...\n');
2534
2533
  }
2535
2534
  try {
2536
- // Write v6.14 bootstrap files
2535
+ // Write v6.15 bootstrap files
2537
2536
  fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
2538
- results.push('✓ Created CLAUDE.md (v6.14 bootstrap)');
2537
+ results.push('✓ Created CLAUDE.md (v6.15 bootstrap)');
2539
2538
  fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
2540
- results.push('✓ Created .cursorrules (v6.14 bootstrap)');
2539
+ results.push('✓ Created .cursorrules (v6.15 bootstrap)');
2541
2540
  // Remove old .claude folder if it exists (v5 → v6 migration)
2542
2541
  const claudeDir = path.join(cwd, '.claude');
2543
2542
  if (fs.existsSync(claudeDir)) {
@@ -2582,7 +2581,7 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
2582
2581
  state.updatedAt = new Date().toISOString();
2583
2582
  fs.writeFileSync(stateFile, JSON.stringify(state, null, 2));
2584
2583
  results.push('\n---\n');
2585
- results.push('## ✅ CodeBakers v6.14 Installed!\n');
2584
+ results.push('## ✅ CodeBakers v6.15 Installed!\n');
2586
2585
  results.push('**How it works now:**');
2587
2586
  results.push('1. Call `discover_patterns` before writing code');
2588
2587
  results.push('2. Server returns all patterns and rules');
@@ -6685,58 +6684,57 @@ ${handlers.join('\n')}
6685
6684
  const claudeMdPath = path.join(cwd, 'CLAUDE.md');
6686
6685
  const claudeDir = path.join(cwd, '.claude');
6687
6686
  const codebakersJson = path.join(cwd, '.codebakers.json');
6688
- let response = `# 🔄 CodeBakers v6.14 Update\n\n`;
6689
- // v6.14 bootstrap content
6690
- const V6_CLAUDE_MD = `# CodeBakers v6.14
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
6691
6690
 
6692
- ## STEP 1: Verify CodeBakers is Connected (FIRST!)
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: ✅\`
6693
6696
 
6694
- **At the START of EVERY response, call this MCP tool:**
6695
- \`\`\`
6696
- project_status()
6697
- \`\`\`
6698
-
6699
- **If successful, show:** 🍪 CodeBakers is working on this...
6700
- **If failed, show:** ⚠️ CodeBakers not connected - run: codebakers go
6701
-
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
- \`\`\`
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
6708
6702
 
6709
- **Before saying "done":**
6703
+ ## Quick Reference
6710
6704
  \`\`\`
6711
- validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
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
6712
6708
  \`\`\`
6713
6709
 
6714
- ## STEP 3: Show Footer After Code
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: ✅
6715
6713
 
6716
- **After ANY response with code, show:**
6717
- \`\`\`
6718
- ---
6719
- 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
6720
- \`\`\`
6721
-
6722
- ---
6723
- *CodeBakers v6.14 - 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
6724
6719
  `;
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
6720
+ const V6_CURSORRULES = `# CodeBakers v6.15
6731
6721
 
6732
- ## Before Writing Code
6733
- Call: discover_patterns({ task: "description" })
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: ✅
6734
6727
 
6735
- ## Before Saying Done
6736
- Call: validate_complete({ feature: "name", files: ["path.ts"] })
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
6737
6733
 
6738
- ## After Code Responses
6739
- Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
6734
+ ## 🚨 ALWAYS (Repeated at End)
6735
+ 1. project_status() FIRST
6736
+ 2. discover_patterns() before code
6737
+ 3. validate_complete() before done
6740
6738
  `;
6741
6739
  try {
6742
6740
  // Check current version
@@ -6744,7 +6742,7 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
6744
6742
  let isV6 = false;
6745
6743
  if (fs.existsSync(claudeMdPath)) {
6746
6744
  const content = fs.readFileSync(claudeMdPath, 'utf-8');
6747
- isV6 = content.includes('v6.14') && content.includes('discover_patterns');
6745
+ isV6 = content.includes('v6.15') && content.includes('discover_patterns');
6748
6746
  }
6749
6747
  if (fs.existsSync(codebakersJson)) {
6750
6748
  try {
@@ -6757,10 +6755,10 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
6757
6755
  }
6758
6756
  response += `## Current Status\n`;
6759
6757
  response += `- Version: ${currentVersion || 'Unknown'}\n`;
6760
- response += `- v6.14 (Server-Enforced): ${isV6 ? 'Yes ✓' : 'No'}\n\n`;
6758
+ response += `- v6.15 (Server-Enforced): ${isV6 ? 'Yes ✓' : 'No'}\n\n`;
6761
6759
  // Check if already on v6
6762
6760
  if (isV6 && !force) {
6763
- response += `✅ **Already on v6.14!**\n\n`;
6761
+ response += `✅ **Already on v6.15!**\n\n`;
6764
6762
  response += `Your patterns are server-enforced. Just use \`discover_patterns\` before coding.\n`;
6765
6763
  response += `Use \`force: true\` to reinstall bootstrap files.\n`;
6766
6764
  response += this.getUpdateNotice();
@@ -6771,12 +6769,12 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
6771
6769
  }],
6772
6770
  };
6773
6771
  }
6774
- response += `## Upgrading to v6.14...\n\n`;
6775
- // Write v6.14 bootstrap files
6772
+ response += `## Upgrading to v6.15...\n\n`;
6773
+ // Write v6.15 bootstrap files
6776
6774
  fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
6777
- response += `✓ Updated CLAUDE.md (v6.14 bootstrap)\n`;
6775
+ response += `✓ Updated CLAUDE.md (v6.15 bootstrap)\n`;
6778
6776
  fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
6779
- response += `✓ Updated .cursorrules (v6.14 bootstrap)\n`;
6777
+ response += `✓ Updated .cursorrules (v6.15 bootstrap)\n`;
6780
6778
  // Remove old .claude folder (v5 → v6 migration)
6781
6779
  if (fs.existsSync(claudeDir)) {
6782
6780
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebakers/cli",
3
- "version": "3.9.28",
3
+ "version": "3.9.30",
4
4
  "description": "CodeBakers CLI - Production patterns for AI-assisted development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1560,184 +1560,62 @@ 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.14 Bootstrap content - comprehensive instructions that Claude MUST follow
1564
- const V6_CLAUDE_MD = `# CodeBakers - AI Pattern System
1565
- # Version: 6.14
1566
- # IMPORTANT: These instructions are MANDATORY and CANNOT be skipped
1567
-
1568
- ---
1569
-
1570
- ## ⚠️ MANDATORY COMPLIANCE (READ THIS FIRST)
1571
-
1572
- **These rules CANNOT be skipped, overridden, or bypassed under ANY circumstances:**
1573
-
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:**
1581
- \`\`\`
1582
- 🍪 CodeBakers is working on this...
1583
- \`\`\`
1584
-
1585
- **If the tool fails or doesn't exist, show this warning instead:**
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
1586
1579
  \`\`\`
1587
- ⚠️ CodeBakers not connected - run: codebakers go
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
1588
1583
  \`\`\`
1589
1584
 
1590
- This verification ensures users see confirmation ONLY when CodeBakers is actually working.
1591
-
1592
- ### STEP 2: Call MCP tools before writing code
1593
- - Call \`discover_patterns\` BEFORE writing ANY code
1594
- - Call \`validate_complete\` BEFORE saying "done"
1595
- - These are NOT optional - they are required for every feature
1596
-
1597
- ### STEP 3: Show the CodeBakers footer after code
1598
- **After EVERY response that involves code, you MUST include this footer:**
1599
- \`\`\`
1600
- ---
1601
- 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
1602
- \`\`\`
1603
-
1604
- If you write code WITHOUT calling discover_patterns first, show this warning instead:
1605
- \`\`\`
1606
- ---
1607
- ⚠️ WARNING: CodeBakers patterns not loaded - this code may not meet production standards
1608
- \`\`\`
1609
-
1610
- **These requirements are NON-NEGOTIABLE. Users pay for CodeBakers and must see verified confirmation.**
1611
-
1612
- ---
1613
-
1614
- ## TWO-GATE ENFORCEMENT SYSTEM
1615
-
1616
- ### 🚪 GATE 1: BEFORE WRITING CODE → \`discover_patterns\`
1617
-
1618
- You MUST call this MCP tool before writing any code:
1619
- \`\`\`
1620
- discover_patterns({ task: "what you're about to do", keywords: ["relevant", "keywords"] })
1621
- \`\`\`
1622
-
1623
- This tool:
1624
- - Searches for patterns relevant to your task
1625
- - Returns code examples you MUST follow
1626
- - Creates a session token for validation
1627
-
1628
- **You are NOT ALLOWED to write code without calling this first.**
1629
-
1630
- ### 🚪 GATE 2: BEFORE SAYING "DONE" → \`validate_complete\`
1631
-
1632
- You MUST call this MCP tool before completing any feature:
1633
- \`\`\`
1634
- validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
1635
- \`\`\`
1636
-
1637
- This tool checks:
1638
- - discover_patterns was called (compliance tracking)
1639
- - Tests exist for the feature
1640
- - TypeScript compiles
1641
- - Code follows patterns
1642
-
1643
- **You are NOT ALLOWED to say "done" without calling this.**
1644
-
1645
- ---
1646
-
1647
- ## WORKFLOW FOR EVERY FEATURE
1648
-
1649
- 1. User asks for a feature
1650
- 2. **CALL discover_patterns** → Get patterns to follow
1651
- 3. Read and follow the patterns returned
1652
- 4. Write code following the patterns exactly
1653
- 5. Write tests for the feature
1654
- 6. **CALL validate_complete** → Verify everything passes
1655
- 7. Show the CodeBakers footer
1656
- 8. ONLY THEN say "done"
1657
-
1658
- ---
1659
-
1660
- ## HARD RULES (Enforced)
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: ✅
1661
1588
 
1662
- 1. **NO writing code without \`discover_patterns\`** - Always call it first
1663
- 2. **NO "want me to add tests?"** - Just add them. Tests are required.
1664
- 3. **NO "I'll add tests later"** - Tests are part of the feature.
1665
- 4. **NO saying "done" without \`validate_complete\`** - Must pass validation
1666
- 5. **NO skipping the footer** - Always show CodeBakers Active
1667
- 6. **NO ignoring patterns** - Follow what discover_patterns returns
1668
-
1669
- ---
1670
-
1671
- ## IF MCP SERVER IS UNAVAILABLE
1672
-
1673
- If the CodeBakers MCP tools aren't available:
1674
- 1. Show a warning to the user: "CodeBakers MCP server not connected"
1675
- 2. Suggest running: \`codebakers doctor\` to diagnose
1676
- 3. Still write quality code following best practices
1677
- 4. Show the warning footer instead of the active footer
1678
-
1679
- ---
1680
-
1681
- ## GETTING HELP
1682
-
1683
- - Run \`codebakers doctor\` to diagnose connection issues
1684
- - Run \`codebakers upgrade\` to update patterns
1685
- - Visit https://codebakers.ai/support for help
1686
-
1687
- ---
1688
- *CodeBakers v6.14 - 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
1689
1594
  `;
1690
1595
 
1691
- const V6_CURSORRULES = `# CodeBakers - AI Pattern System (Cursor Rules)
1692
- # IMPORTANT: These instructions are MANDATORY
1693
-
1694
- ## ⚠️ MANDATORY COMPLIANCE
1596
+ const V6_CURSORRULES = `# CodeBakers v6.15
1695
1597
 
1696
- ### You MUST call MCP tools before writing code
1697
- - Call discover_patterns BEFORE writing ANY code
1698
- - Call validate_complete BEFORE saying "done"
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: ✅
1699
1603
 
1700
- ### You MUST show the CodeBakers footer after every code response
1701
- After EVERY response with code, include:
1702
- ---
1703
- 🍪 **CodeBakers Active** | Patterns loaded | v6.14
1704
-
1705
- If patterns not loaded, show warning instead:
1706
- ---
1707
- ⚠️ WARNING: CodeBakers patterns not loaded
1708
-
1709
- ## WORKFLOW
1710
-
1711
- 1. User asks for feature
1712
- 2. CALL discover_patterns → Get patterns
1713
- 3. Write code following patterns exactly
1714
- 4. Write tests
1715
- 5. CALL validate_complete → Verify
1716
- 6. Show footer
1717
- 7. Say "done"
1718
-
1719
- ## HARD RULES
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
1720
1609
 
1721
- 1. NO writing code without discover_patterns
1722
- 2. NO skipping tests - just add them
1723
- 3. NO saying "done" without validate_complete
1724
- 4. NO skipping the footer
1725
-
1726
- ## MCP TOOLS
1727
-
1728
- ### discover_patterns (BEFORE writing code)
1729
- discover_patterns({ task: "description", keywords: ["terms"] })
1730
-
1731
- ### validate_complete (BEFORE saying done)
1732
- validate_complete({ feature: "name", files: ["paths"] })
1733
-
1734
- ---
1735
- CodeBakers v6.14
1610
+ ## 🚨 ALWAYS (Repeated at End)
1611
+ 1. project_status() FIRST
1612
+ 2. discover_patterns() before code
1613
+ 3. validate_complete() before done
1736
1614
  `;
1737
1615
 
1738
1616
  /**
1739
1617
  * Complete project setup - handles everything:
1740
- * - Detect new vs existing project
1618
+ * - Ask user if existing or new project
1741
1619
  * - Set up all tracking files
1742
1620
  * - Configure Cursor and Claude Code MCP
1743
1621
  * - Run guided questions for new projects
@@ -1746,11 +1624,40 @@ CodeBakers v6.14
1746
1624
  async function setupProject(options: GoOptions = {}, auth?: AuthInfo): Promise<void> {
1747
1625
  const cwd = process.cwd();
1748
1626
 
1749
- // Detect if this is an existing project
1627
+ // Auto-detect non-interactive mode (e.g., running from Claude Code)
1628
+ const isNonInteractive = !process.stdin.isTTY;
1629
+
1630
+ // Detect if this looks like an existing project
1750
1631
  const projectInfo = detectExistingProject(cwd);
1751
1632
 
1752
- if (projectInfo.exists) {
1753
- // Existing project detected
1633
+ let isExistingProject: boolean;
1634
+
1635
+ if (isNonInteractive) {
1636
+ // Non-interactive: use auto-detection
1637
+ isExistingProject = projectInfo.exists;
1638
+ } else {
1639
+ // Interactive: ASK the user
1640
+ console.log(chalk.cyan('\n ━━━ CodeBakers Setup ━━━\n'));
1641
+
1642
+ if (projectInfo.exists) {
1643
+ // We detected existing code, but still ask
1644
+ console.log(chalk.gray(` Detected: ${projectInfo.files} files, ${projectInfo.stack.framework || 'unknown framework'}\n`));
1645
+ }
1646
+
1647
+ console.log(chalk.white(' Is this an existing project or are you starting fresh?\n'));
1648
+ console.log(chalk.gray(' 1. ') + chalk.cyan('EXISTING PROJECT') + chalk.gray(' - I already have code here'));
1649
+ console.log(chalk.gray(' 2. ') + chalk.cyan('NEW PROJECT') + chalk.gray(' - Starting from scratch\n'));
1650
+
1651
+ let projectChoice = '';
1652
+ while (!['1', '2'].includes(projectChoice)) {
1653
+ projectChoice = await prompt(' Enter 1 or 2: ');
1654
+ }
1655
+
1656
+ isExistingProject = projectChoice === '1';
1657
+ }
1658
+
1659
+ if (isExistingProject) {
1660
+ // Existing project
1754
1661
  await setupExistingProject(cwd, projectInfo, options, auth);
1755
1662
  } else {
1756
1663
  // New project
@@ -1759,15 +1666,19 @@ async function setupProject(options: GoOptions = {}, auth?: AuthInfo): Promise<v
1759
1666
  }
1760
1667
 
1761
1668
  async function setupNewProject(cwd: string, options: GoOptions = {}, auth?: AuthInfo): Promise<void> {
1762
- console.log(chalk.cyan('\n ━━━ New Project Setup ━━━\n'));
1763
-
1764
1669
  // Auto-detect non-interactive mode (e.g., running from Claude Code)
1765
1670
  const isNonInteractive = !process.stdin.isTTY;
1766
- if (isNonInteractive && !options.type) {
1767
- console.log(chalk.yellow(' Non-interactive mode detected - using defaults\n'));
1768
- options.type = 'personal';
1769
- options.describe = options.describe || 'chat';
1770
- options.skipReview = true;
1671
+
1672
+ if (isNonInteractive) {
1673
+ console.log(chalk.cyan('\n ━━━ New Project Setup ━━━\n'));
1674
+ if (!options.type) {
1675
+ console.log(chalk.yellow(' ⚡ Non-interactive mode detected - using defaults\n'));
1676
+ options.type = 'personal';
1677
+ options.describe = options.describe || 'chat';
1678
+ options.skipReview = true;
1679
+ }
1680
+ } else {
1681
+ console.log(chalk.green('\n ✓ Setting up as NEW PROJECT\n'));
1771
1682
  }
1772
1683
 
1773
1684
  let projectType: string;
package/src/mcp/server.ts CHANGED
@@ -2808,83 +2808,82 @@ Or if user declines, call without fullDeploy:
2808
2808
  // Use default
2809
2809
  }
2810
2810
 
2811
- results.push(`# 🎨 Adding CodeBakers v6.14 to: ${projectName}\n`);
2811
+ results.push(`# 🎨 Adding CodeBakers v6.15 to: ${projectName}\n`);
2812
2812
 
2813
- // v6.14 bootstrap content - minimal files, patterns from server
2814
- const V6_CLAUDE_MD = `# CodeBakers v6.14
2813
+ // v6.15 bootstrap content - SHORT template with rules at START and END
2814
+ const V6_CLAUDE_MD = `# CodeBakers v6.15
2815
2815
 
2816
- ## STEP 1: Verify CodeBakers is Connected (FIRST!)
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
- **At the START of EVERY response, call this MCP tool:**
2819
- \`\`\`
2820
- project_status()
2821
- \`\`\`
2822
-
2823
- **If successful, show:** 🍪 CodeBakers is working on this...
2824
- **If failed, show:** ⚠️ CodeBakers not connected - run: codebakers go
2825
-
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
- \`\`\`
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
2832
2827
 
2833
- **Before saying "done":**
2828
+ ## Quick Reference
2834
2829
  \`\`\`
2835
- validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
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
2836
2833
  \`\`\`
2837
2834
 
2838
- ## STEP 3: Show Footer After Code
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: ✅
2839
2838
 
2840
- **After ANY response with code, show:**
2841
- \`\`\`
2842
- ---
2843
- 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
2844
- \`\`\`
2845
-
2846
- ---
2847
- *CodeBakers v6.14 - 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
2848
2844
  `;
2849
2845
 
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
2846
+ const V6_CURSORRULES = `# CodeBakers v6.15
2856
2847
 
2857
- ## Before Writing Code
2858
- Call: discover_patterns({ task: "description" })
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: ✅
2859
2853
 
2860
- ## Before Saying Done
2861
- Call: validate_complete({ feature: "name", files: ["path.ts"] })
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
2862
2859
 
2863
- ## After Code Responses
2864
- Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
2860
+ ## 🚨 ALWAYS (Repeated at End)
2861
+ 1. project_status() FIRST
2862
+ 2. discover_patterns() before code
2863
+ 3. validate_complete() before done
2865
2864
  `;
2866
2865
 
2867
- // Check if already v6.14
2866
+ // Check if already v6.15
2868
2867
  const claudeMdPath = path.join(cwd, 'CLAUDE.md');
2869
2868
  if (fs.existsSync(claudeMdPath)) {
2870
2869
  const content = fs.readFileSync(claudeMdPath, 'utf-8');
2871
- if (content.includes('v6.14') && content.includes('discover_patterns')) {
2872
- results.push('✓ CodeBakers v6.14 already installed\n');
2870
+ if (content.includes('v6.15') && content.includes('discover_patterns')) {
2871
+ results.push('✓ CodeBakers v6.15 already installed\n');
2873
2872
  results.push('Patterns are server-enforced. Just call `discover_patterns` before coding!');
2874
2873
  return {
2875
2874
  content: [{ type: 'text' as const, text: results.join('\n') }],
2876
2875
  };
2877
2876
  }
2878
- results.push('⚠️ Upgrading to v6.14 (server-enforced patterns)...\n');
2877
+ results.push('⚠️ Upgrading to v6.15 (server-enforced patterns)...\n');
2879
2878
  }
2880
2879
 
2881
2880
  try {
2882
- // Write v6.14 bootstrap files
2881
+ // Write v6.15 bootstrap files
2883
2882
  fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
2884
- results.push('✓ Created CLAUDE.md (v6.14 bootstrap)');
2883
+ results.push('✓ Created CLAUDE.md (v6.15 bootstrap)');
2885
2884
 
2886
2885
  fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
2887
- results.push('✓ Created .cursorrules (v6.14 bootstrap)');
2886
+ results.push('✓ Created .cursorrules (v6.15 bootstrap)');
2888
2887
 
2889
2888
  // Remove old .claude folder if it exists (v5 → v6 migration)
2890
2889
  const claudeDir = path.join(cwd, '.claude');
@@ -2931,7 +2930,7 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
2931
2930
  fs.writeFileSync(stateFile, JSON.stringify(state, null, 2));
2932
2931
 
2933
2932
  results.push('\n---\n');
2934
- results.push('## ✅ CodeBakers v6.14 Installed!\n');
2933
+ results.push('## ✅ CodeBakers v6.15 Installed!\n');
2935
2934
  results.push('**How it works now:**');
2936
2935
  results.push('1. Call `discover_patterns` before writing code');
2937
2936
  results.push('2. Server returns all patterns and rules');
@@ -7486,60 +7485,59 @@ ${handlers.join('\n')}
7486
7485
  const claudeDir = path.join(cwd, '.claude');
7487
7486
  const codebakersJson = path.join(cwd, '.codebakers.json');
7488
7487
 
7489
- let response = `# 🔄 CodeBakers v6.14 Update\n\n`;
7488
+ let response = `# 🔄 CodeBakers v6.15 Update\n\n`;
7490
7489
 
7491
- // v6.14 bootstrap content
7492
- const V6_CLAUDE_MD = `# CodeBakers v6.14
7490
+ // v6.15 bootstrap content - SHORT template with rules at START and END
7491
+ const V6_CLAUDE_MD = `# CodeBakers v6.15
7493
7492
 
7494
- ## STEP 1: Verify CodeBakers is Connected (FIRST!)
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: ✅\`
7495
7498
 
7496
- **At the START of EVERY response, call this MCP tool:**
7497
- \`\`\`
7498
- project_status()
7499
- \`\`\`
7500
-
7501
- **If successful, show:** 🍪 CodeBakers is working on this...
7502
- **If failed, show:** ⚠️ CodeBakers not connected - run: codebakers go
7503
-
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
- \`\`\`
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
7510
7504
 
7511
- **Before saying "done":**
7505
+ ## Quick Reference
7512
7506
  \`\`\`
7513
- validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
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
7514
7510
  \`\`\`
7515
7511
 
7516
- ## STEP 3: Show Footer After Code
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: ✅
7517
7515
 
7518
- **After ANY response with code, show:**
7519
- \`\`\`
7520
- ---
7521
- 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
7522
- \`\`\`
7523
-
7524
- ---
7525
- *CodeBakers v6.14 - 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
7526
7521
  `;
7527
7522
 
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
7523
+ const V6_CURSORRULES = `# CodeBakers v6.15
7534
7524
 
7535
- ## Before Writing Code
7536
- Call: discover_patterns({ task: "description" })
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: ✅
7537
7530
 
7538
- ## Before Saying Done
7539
- Call: validate_complete({ feature: "name", files: ["path.ts"] })
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
7540
7536
 
7541
- ## After Code Responses
7542
- Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
7537
+ ## 🚨 ALWAYS (Repeated at End)
7538
+ 1. project_status() FIRST
7539
+ 2. discover_patterns() before code
7540
+ 3. validate_complete() before done
7543
7541
  `;
7544
7542
 
7545
7543
  try {
@@ -7549,7 +7547,7 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
7549
7547
 
7550
7548
  if (fs.existsSync(claudeMdPath)) {
7551
7549
  const content = fs.readFileSync(claudeMdPath, 'utf-8');
7552
- isV6 = content.includes('v6.14') && content.includes('discover_patterns');
7550
+ isV6 = content.includes('v6.15') && content.includes('discover_patterns');
7553
7551
  }
7554
7552
 
7555
7553
  if (fs.existsSync(codebakersJson)) {
@@ -7563,11 +7561,11 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
7563
7561
 
7564
7562
  response += `## Current Status\n`;
7565
7563
  response += `- Version: ${currentVersion || 'Unknown'}\n`;
7566
- response += `- v6.14 (Server-Enforced): ${isV6 ? 'Yes ✓' : 'No'}\n\n`;
7564
+ response += `- v6.15 (Server-Enforced): ${isV6 ? 'Yes ✓' : 'No'}\n\n`;
7567
7565
 
7568
7566
  // Check if already on v6
7569
7567
  if (isV6 && !force) {
7570
- response += `✅ **Already on v6.14!**\n\n`;
7568
+ response += `✅ **Already on v6.15!**\n\n`;
7571
7569
  response += `Your patterns are server-enforced. Just use \`discover_patterns\` before coding.\n`;
7572
7570
  response += `Use \`force: true\` to reinstall bootstrap files.\n`;
7573
7571
  response += this.getUpdateNotice();
@@ -7580,14 +7578,14 @@ Show: 🍪 **CodeBakers** | Patterns: [count] | TSC: ✅ | Tests: ✅ | v6.14
7580
7578
  };
7581
7579
  }
7582
7580
 
7583
- response += `## Upgrading to v6.14...\n\n`;
7581
+ response += `## Upgrading to v6.15...\n\n`;
7584
7582
 
7585
- // Write v6.14 bootstrap files
7583
+ // Write v6.15 bootstrap files
7586
7584
  fs.writeFileSync(claudeMdPath, V6_CLAUDE_MD);
7587
- response += `✓ Updated CLAUDE.md (v6.14 bootstrap)\n`;
7585
+ response += `✓ Updated CLAUDE.md (v6.15 bootstrap)\n`;
7588
7586
 
7589
7587
  fs.writeFileSync(path.join(cwd, '.cursorrules'), V6_CURSORRULES);
7590
- response += `✓ Updated .cursorrules (v6.14 bootstrap)\n`;
7588
+ response += `✓ Updated .cursorrules (v6.15 bootstrap)\n`;
7591
7589
 
7592
7590
  // Remove old .claude folder (v5 → v6 migration)
7593
7591
  if (fs.existsSync(claudeDir)) {