@codebakers/cli 3.9.21 → 3.9.23

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.
@@ -1276,7 +1276,7 @@ async function handleApiKeyLogin(options = {}) {
1276
1276
  }
1277
1277
  }
1278
1278
  /**
1279
- * Show success message with clear next steps
1279
+ * Show success message with clear next steps based on user's editor
1280
1280
  */
1281
1281
  async function showSuccessAndRestart() {
1282
1282
  console.log(chalk_1.default.green(`
@@ -1286,121 +1286,243 @@ async function showSuccessAndRestart() {
1286
1286
  ║ ║
1287
1287
  ╚═══════════════════════════════════════════════════════════╝
1288
1288
  `));
1289
- console.log(chalk_1.default.yellow(' ⚠️ ONE MORE STEP - Restart Required\n'));
1290
- console.log(chalk_1.default.white(' Claude Code needs to restart to load the CodeBakers MCP server.\n'));
1291
- console.log(chalk_1.default.cyan(' How to restart Claude Code:\n'));
1292
- console.log(chalk_1.default.gray(' Option 1: ') + chalk_1.default.white('Close this window and run ') + chalk_1.default.cyan('claude') + chalk_1.default.white(' again'));
1293
- console.log(chalk_1.default.gray(' Option 2: ') + chalk_1.default.white('Press ') + chalk_1.default.cyan('Ctrl+C') + chalk_1.default.white(' and run ') + chalk_1.default.cyan('claude') + chalk_1.default.white(' again'));
1294
- console.log(chalk_1.default.gray(' Option 3: ') + chalk_1.default.white('In VS Code: ') + chalk_1.default.cyan('Cmd/Ctrl+Shift+P') + chalk_1.default.white(' → "Claude Code: Restart"\n'));
1295
- console.log(chalk_1.default.green(' After restart, try saying:\n'));
1296
- console.log(chalk_1.default.white(' "Build me a todo app with authentication"'));
1297
- console.log(chalk_1.default.white(' "Add a login page to my project"'));
1298
- console.log(chalk_1.default.white(' "Review my code and make it production-ready"\n'));
1289
+ // Check if we're in non-interactive mode
1290
+ const isNonInteractive = !process.stdin.isTTY;
1291
+ if (isNonInteractive) {
1292
+ // Non-interactive mode - show generic instructions
1293
+ console.log(chalk_1.default.yellow(' ⚠️ RELOAD REQUIRED\n'));
1294
+ console.log(chalk_1.default.white(' Your editor needs to reload to activate CodeBakers.\n'));
1295
+ console.log(chalk_1.default.cyan(' For Cursor:'));
1296
+ console.log(chalk_1.default.gray(' Press ') + chalk_1.default.cyan('Cmd/Ctrl+Shift+P') + chalk_1.default.gray(' → type ') + chalk_1.default.cyan('"Reload Window"') + chalk_1.default.gray(' → press Enter\n'));
1297
+ console.log(chalk_1.default.cyan(' For VS Code with Claude Code:'));
1298
+ console.log(chalk_1.default.gray(' Press ') + chalk_1.default.cyan('Cmd/Ctrl+Shift+P') + chalk_1.default.gray(' → type ') + chalk_1.default.cyan('"Reload Window"') + chalk_1.default.gray(' press Enter\n'));
1299
+ console.log(chalk_1.default.gray(' ─────────────────────────────────────────────────────────\n'));
1300
+ console.log(chalk_1.default.gray(' Having issues? Run: ') + chalk_1.default.cyan('codebakers doctor') + chalk_1.default.gray(' to diagnose\n'));
1301
+ return;
1302
+ }
1303
+ // Interactive mode - ask which editor they're using
1304
+ console.log(chalk_1.default.white(' Which editor are you using?\n'));
1305
+ console.log(chalk_1.default.gray(' 1. ') + chalk_1.default.cyan('Cursor') + chalk_1.default.gray(' - AI code editor'));
1306
+ console.log(chalk_1.default.gray(' 2. ') + chalk_1.default.cyan('VS Code + Claude Code') + chalk_1.default.gray(' - VS Code with Claude extension\n'));
1307
+ let editorChoice = '';
1308
+ while (!['1', '2'].includes(editorChoice)) {
1309
+ editorChoice = await prompt(' Enter 1 or 2: ');
1310
+ }
1311
+ console.log('');
1312
+ if (editorChoice === '1') {
1313
+ // Cursor instructions
1314
+ await showCursorInstructions();
1315
+ }
1316
+ else {
1317
+ // VS Code + Claude Code instructions
1318
+ await showVSCodeClaudeInstructions();
1319
+ }
1320
+ }
1321
+ /**
1322
+ * Show Cursor-specific instructions
1323
+ */
1324
+ async function showCursorInstructions() {
1325
+ console.log(chalk_1.default.cyan(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
1326
+ console.log(chalk_1.default.white.bold('\n 🎯 CURSOR SETUP - Follow these steps:\n'));
1327
+ console.log(chalk_1.default.cyan(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
1328
+ console.log(chalk_1.default.yellow(' STEP 1: Reload Cursor to activate CodeBakers\n'));
1329
+ console.log(chalk_1.default.gray(' Press ') + chalk_1.default.cyan('Cmd+Shift+P') + chalk_1.default.gray(' (Mac) or ') + chalk_1.default.cyan('Ctrl+Shift+P') + chalk_1.default.gray(' (Windows)'));
1330
+ console.log(chalk_1.default.gray(' Type ') + chalk_1.default.cyan('"Reload Window"') + chalk_1.default.gray(' and press Enter\n'));
1331
+ console.log(chalk_1.default.yellow(' STEP 2: Open the AI Chat\n'));
1332
+ console.log(chalk_1.default.gray(' Press ') + chalk_1.default.cyan('Cmd+L') + chalk_1.default.gray(' (Mac) or ') + chalk_1.default.cyan('Ctrl+L') + chalk_1.default.gray(' (Windows)'));
1333
+ console.log(chalk_1.default.gray(' This opens the Cursor Chat panel on the right side\n'));
1334
+ console.log(chalk_1.default.yellow(' STEP 3: Start building!\n'));
1335
+ console.log(chalk_1.default.gray(' Type your request in the chat. For example:\n'));
1336
+ console.log(chalk_1.default.white(' "Build me a todo app with authentication"'));
1337
+ console.log(chalk_1.default.white(' "Add a login page to my project"'));
1338
+ console.log(chalk_1.default.white(' "Review my code and make it production-ready"\n'));
1339
+ console.log(chalk_1.default.green(' ✅ You are now done with the terminal!\n'));
1340
+ console.log(chalk_1.default.gray(' From now on, use the ') + chalk_1.default.cyan('Cursor Chat') + chalk_1.default.gray(' to talk to AI.'));
1341
+ console.log(chalk_1.default.gray(' The terminal is only needed for running commands like npm.\n'));
1299
1342
  console.log(chalk_1.default.gray(' ─────────────────────────────────────────────────────────\n'));
1300
1343
  console.log(chalk_1.default.gray(' Having issues? Run: ') + chalk_1.default.cyan('codebakers doctor') + chalk_1.default.gray(' to diagnose\n'));
1301
1344
  }
1302
- // v6.12 Bootstrap content - minimal files that point to MCP tools
1303
- const V6_CLAUDE_MD = `# CodeBakers v6.12 - Server-Enforced Patterns
1345
+ /**
1346
+ * Show VS Code + Claude Code specific instructions
1347
+ */
1348
+ async function showVSCodeClaudeInstructions() {
1349
+ console.log(chalk_1.default.cyan(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
1350
+ console.log(chalk_1.default.white.bold('\n 🎯 VS CODE + CLAUDE CODE SETUP - Follow these steps:\n'));
1351
+ console.log(chalk_1.default.cyan(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
1352
+ console.log(chalk_1.default.yellow(' STEP 1: Reload VS Code to activate CodeBakers\n'));
1353
+ console.log(chalk_1.default.gray(' Press ') + chalk_1.default.cyan('Cmd+Shift+P') + chalk_1.default.gray(' (Mac) or ') + chalk_1.default.cyan('Ctrl+Shift+P') + chalk_1.default.gray(' (Windows)'));
1354
+ console.log(chalk_1.default.gray(' Type ') + chalk_1.default.cyan('"Reload Window"') + chalk_1.default.gray(' and press Enter\n'));
1355
+ console.log(chalk_1.default.yellow(' STEP 2: Open Claude Code Chat\n'));
1356
+ console.log(chalk_1.default.gray(' Look for the ') + chalk_1.default.cyan('Claude icon') + chalk_1.default.gray(' in the left sidebar'));
1357
+ console.log(chalk_1.default.gray(' Click it to open the Claude Code chat panel\n'));
1358
+ console.log(chalk_1.default.gray(' Or press ') + chalk_1.default.cyan('Cmd+Shift+P') + chalk_1.default.gray(' → type ') + chalk_1.default.cyan('"Claude Code: Open Chat"') + chalk_1.default.gray('\n'));
1359
+ console.log(chalk_1.default.yellow(' STEP 3: Start building!\n'));
1360
+ console.log(chalk_1.default.gray(' Type your request in the Claude chat. For example:\n'));
1361
+ console.log(chalk_1.default.white(' "Build me a todo app with authentication"'));
1362
+ console.log(chalk_1.default.white(' "Add a login page to my project"'));
1363
+ console.log(chalk_1.default.white(' "Review my code and make it production-ready"\n'));
1364
+ console.log(chalk_1.default.green(' ✅ You are now done with the terminal!\n'));
1365
+ console.log(chalk_1.default.gray(' From now on, use the ') + chalk_1.default.cyan('Claude Code Chat') + chalk_1.default.gray(' panel to talk to AI.'));
1366
+ console.log(chalk_1.default.gray(' The terminal is only needed for running commands like npm.\n'));
1367
+ console.log(chalk_1.default.gray(' ─────────────────────────────────────────────────────────\n'));
1368
+ console.log(chalk_1.default.gray(' Tip: ') + chalk_1.default.white('Make sure you have the Claude Code extension installed.'));
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
+ console.log(chalk_1.default.gray(' Having issues? Run: ') + chalk_1.default.cyan('codebakers doctor') + chalk_1.default.gray(' to diagnose\n'));
1371
+ }
1372
+ // v6.12 Bootstrap content - comprehensive instructions that Claude MUST follow
1373
+ const V6_CLAUDE_MD = `# CodeBakers - AI Pattern System
1374
+ # Version: 6.12
1375
+ # IMPORTANT: These instructions are MANDATORY and CANNOT be skipped
1376
+
1377
+ ---
1304
1378
 
1305
- **All patterns are server-side. No local pattern files needed.**
1379
+ ## ⚠️ MANDATORY COMPLIANCE (READ THIS FIRST)
1306
1380
 
1307
- ## Required MCP Tools
1381
+ **These rules CANNOT be skipped, overridden, or bypassed under ANY circumstances:**
1308
1382
 
1309
- Before writing ANY code, you MUST use these CodeBakers MCP tools:
1383
+ ### You MUST call MCP tools before writing code
1384
+ - Call \`discover_patterns\` BEFORE writing ANY code
1385
+ - Call \`validate_complete\` BEFORE saying "done"
1386
+ - These are NOT optional - they are required for every feature
1310
1387
 
1311
- ### 1. discover_patterns (MANDATORY - START GATE)
1312
- Call this BEFORE writing any code:
1388
+ ### You MUST show the CodeBakers footer
1389
+ **After EVERY response that involves code, you MUST include this footer:**
1313
1390
  \`\`\`
1314
- Tool: discover_patterns
1315
- Args: { task: "what you're about to do", files: ["files to modify"], keywords: ["relevant terms"] }
1391
+ ---
1392
+ 🍪 **CodeBakers Active** | Patterns loaded | v6.12
1316
1393
  \`\`\`
1317
- This returns:
1318
- - Relevant patterns from the server
1319
- - A session token (required for validation)
1320
- - Code examples to follow
1321
1394
 
1322
- ### 2. validate_complete (MANDATORY - END GATE)
1323
- Call this BEFORE saying "done" or "complete":
1395
+ If you write code WITHOUT calling discover_patterns first, show this warning instead:
1324
1396
  \`\`\`
1325
- Tool: validate_complete
1326
- Args: { feature: "what you built", files: ["files modified"] }
1397
+ ---
1398
+ ⚠️ WARNING: CodeBakers patterns not loaded - this code may not meet production standards
1327
1399
  \`\`\`
1328
- This checks:
1329
- - You called discover_patterns first (server verifies)
1330
- - Tests exist and pass
1400
+
1401
+ **This footer requirement is NON-NEGOTIABLE. Users pay for CodeBakers and must see it's active.**
1402
+
1403
+ ---
1404
+
1405
+ ## TWO-GATE ENFORCEMENT SYSTEM
1406
+
1407
+ ### 🚪 GATE 1: BEFORE WRITING CODE → \`discover_patterns\`
1408
+
1409
+ You MUST call this MCP tool before writing any code:
1410
+ \`\`\`
1411
+ discover_patterns({ task: "what you're about to do", keywords: ["relevant", "keywords"] })
1412
+ \`\`\`
1413
+
1414
+ This tool:
1415
+ - Searches for patterns relevant to your task
1416
+ - Returns code examples you MUST follow
1417
+ - Creates a session token for validation
1418
+
1419
+ **You are NOT ALLOWED to write code without calling this first.**
1420
+
1421
+ ### 🚪 GATE 2: BEFORE SAYING "DONE" → \`validate_complete\`
1422
+
1423
+ You MUST call this MCP tool before completing any feature:
1424
+ \`\`\`
1425
+ validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
1426
+ \`\`\`
1427
+
1428
+ This tool checks:
1429
+ - discover_patterns was called (compliance tracking)
1430
+ - Tests exist for the feature
1331
1431
  - TypeScript compiles
1332
- - Returns pass/fail from server
1432
+ - Code follows patterns
1333
1433
 
1334
- ## Rules
1434
+ **You are NOT ALLOWED to say "done" without calling this.**
1335
1435
 
1336
- 1. **You CANNOT skip discover_patterns** - Server tracks compliance
1337
- 2. **You CANNOT say "done" without validate_complete** - Server must approve
1338
- 3. **Follow patterns returned by server** - They are mandatory
1339
- 4. **Write tests** - Validation will fail without them
1340
- 5. **Fix TypeScript errors** - Validation will fail with errors
1436
+ ---
1341
1437
 
1342
- ## If Server is Unreachable
1438
+ ## WORKFLOW FOR EVERY FEATURE
1343
1439
 
1344
- The tools will show "OFFLINE MODE" if the server can't be reached. In this case:
1345
- - Enforcement is limited to local checks only
1346
- - You should still follow best practices
1347
- - Try again when connection is restored
1440
+ 1. User asks for a feature
1441
+ 2. **CALL discover_patterns** Get patterns to follow
1442
+ 3. Read and follow the patterns returned
1443
+ 4. Write code following the patterns exactly
1444
+ 5. Write tests for the feature
1445
+ 6. **CALL validate_complete** → Verify everything passes
1446
+ 7. Show the CodeBakers footer
1447
+ 8. ONLY THEN say "done"
1348
1448
 
1349
- ## Getting Help
1449
+ ---
1350
1450
 
1351
- - Run \`codebakers doctor\` to diagnose issues
1451
+ ## HARD RULES (Enforced)
1452
+
1453
+ 1. **NO writing code without \`discover_patterns\`** - Always call it first
1454
+ 2. **NO "want me to add tests?"** - Just add them. Tests are required.
1455
+ 3. **NO "I'll add tests later"** - Tests are part of the feature.
1456
+ 4. **NO saying "done" without \`validate_complete\`** - Must pass validation
1457
+ 5. **NO skipping the footer** - Always show CodeBakers Active
1458
+ 6. **NO ignoring patterns** - Follow what discover_patterns returns
1459
+
1460
+ ---
1461
+
1462
+ ## IF MCP SERVER IS UNAVAILABLE
1463
+
1464
+ If the CodeBakers MCP tools aren't available:
1465
+ 1. Show a warning to the user: "CodeBakers MCP server not connected"
1466
+ 2. Suggest running: \`codebakers doctor\` to diagnose
1467
+ 3. Still write quality code following best practices
1468
+ 4. Show the warning footer instead of the active footer
1469
+
1470
+ ---
1471
+
1472
+ ## GETTING HELP
1473
+
1474
+ - Run \`codebakers doctor\` to diagnose connection issues
1352
1475
  - Run \`codebakers upgrade\` to update patterns
1353
1476
  - Visit https://codebakers.ai/support for help
1354
1477
 
1355
1478
  ---
1356
- *CodeBakers v6.12 - Server-Enforced Patterns*
1479
+ *CodeBakers v6.12 - Production patterns for AI-assisted development*
1357
1480
  `;
1358
- const V6_CURSORRULES = `# CodeBakers v6.12 - Server-Enforced Patterns
1481
+ const V6_CURSORRULES = `# CodeBakers - AI Pattern System (Cursor Rules)
1482
+ # IMPORTANT: These instructions are MANDATORY
1359
1483
 
1360
- All patterns are server-side. No local pattern files needed.
1484
+ ## ⚠️ MANDATORY COMPLIANCE
1361
1485
 
1362
- ## Required MCP Tools
1486
+ ### You MUST call MCP tools before writing code
1487
+ - Call discover_patterns BEFORE writing ANY code
1488
+ - Call validate_complete BEFORE saying "done"
1363
1489
 
1364
- Before writing ANY code, you MUST use these CodeBakers MCP tools:
1490
+ ### You MUST show the CodeBakers footer after every code response
1491
+ After EVERY response with code, include:
1492
+ ---
1493
+ 🍪 **CodeBakers Active** | Patterns loaded | v6.12
1365
1494
 
1366
- ### 1. discover_patterns (MANDATORY - START GATE)
1367
- Call this BEFORE writing any code:
1368
- - Tool: discover_patterns
1369
- - Args: { task: "what you're about to do", files: ["files to modify"], keywords: ["relevant terms"] }
1495
+ If patterns not loaded, show warning instead:
1496
+ ---
1497
+ ⚠️ WARNING: CodeBakers patterns not loaded
1370
1498
 
1371
- Returns:
1372
- - Relevant patterns from the server
1373
- - A session token (required for validation)
1374
- - Code examples to follow
1499
+ ## WORKFLOW
1375
1500
 
1376
- ### 2. validate_complete (MANDATORY - END GATE)
1377
- Call this BEFORE saying "done" or "complete":
1378
- - Tool: validate_complete
1379
- - Args: { feature: "what you built", files: ["files modified"] }
1501
+ 1. User asks for feature
1502
+ 2. CALL discover_patterns Get patterns
1503
+ 3. Write code following patterns exactly
1504
+ 4. Write tests
1505
+ 5. CALL validate_complete → Verify
1506
+ 6. Show footer
1507
+ 7. Say "done"
1380
1508
 
1381
- Checks:
1382
- - You called discover_patterns first (server verifies)
1383
- - Tests exist and pass
1384
- - TypeScript compiles
1385
- - Returns pass/fail from server
1509
+ ## HARD RULES
1386
1510
 
1387
- ## Rules
1511
+ 1. NO writing code without discover_patterns
1512
+ 2. NO skipping tests - just add them
1513
+ 3. NO saying "done" without validate_complete
1514
+ 4. NO skipping the footer
1388
1515
 
1389
- 1. You CANNOT skip discover_patterns - Server tracks compliance
1390
- 2. You CANNOT say "done" without validate_complete - Server must approve
1391
- 3. Follow patterns returned by server - They are mandatory
1392
- 4. Write tests - Validation will fail without them
1393
- 5. Fix TypeScript errors - Validation will fail with errors
1516
+ ## MCP TOOLS
1394
1517
 
1395
- ## If Server is Unreachable
1518
+ ### discover_patterns (BEFORE writing code)
1519
+ discover_patterns({ task: "description", keywords: ["terms"] })
1396
1520
 
1397
- The tools will show "OFFLINE MODE" if the server can't be reached. In this case:
1398
- - Enforcement is limited to local checks only
1399
- - You should still follow best practices
1400
- - Try again when connection is restored
1521
+ ### validate_complete (BEFORE saying done)
1522
+ validate_complete({ feature: "name", files: ["paths"] })
1401
1523
 
1402
1524
  ---
1403
- CodeBakers v6.12 - Server-Enforced Patterns
1525
+ CodeBakers v6.12
1404
1526
  `;
1405
1527
  /**
1406
1528
  * Complete project setup - handles everything:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebakers/cli",
3
- "version": "3.9.21",
3
+ "version": "3.9.23",
4
4
  "description": "CodeBakers CLI - Production patterns for AI-assisted development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1449,7 +1449,7 @@ async function handleApiKeyLogin(options: GoOptions = {}): Promise<void> {
1449
1449
  }
1450
1450
 
1451
1451
  /**
1452
- * Show success message with clear next steps
1452
+ * Show success message with clear next steps based on user's editor
1453
1453
  */
1454
1454
  async function showSuccessAndRestart(): Promise<void> {
1455
1455
  console.log(chalk.green(`
@@ -1460,127 +1460,261 @@ async function showSuccessAndRestart(): Promise<void> {
1460
1460
  ╚═══════════════════════════════════════════════════════════╝
1461
1461
  `));
1462
1462
 
1463
- console.log(chalk.yellow(' ⚠️ ONE MORE STEP - Restart Required\n'));
1463
+ // Check if we're in non-interactive mode
1464
+ const isNonInteractive = !process.stdin.isTTY;
1465
+
1466
+ if (isNonInteractive) {
1467
+ // Non-interactive mode - show generic instructions
1468
+ console.log(chalk.yellow(' ⚠️ RELOAD REQUIRED\n'));
1469
+ console.log(chalk.white(' Your editor needs to reload to activate CodeBakers.\n'));
1470
+ console.log(chalk.cyan(' For Cursor:'));
1471
+ console.log(chalk.gray(' Press ') + chalk.cyan('Cmd/Ctrl+Shift+P') + chalk.gray(' → type ') + chalk.cyan('"Reload Window"') + chalk.gray(' → press Enter\n'));
1472
+ console.log(chalk.cyan(' For VS Code with Claude Code:'));
1473
+ console.log(chalk.gray(' Press ') + chalk.cyan('Cmd/Ctrl+Shift+P') + chalk.gray(' → type ') + chalk.cyan('"Reload Window"') + chalk.gray(' → press Enter\n'));
1474
+ console.log(chalk.gray(' ─────────────────────────────────────────────────────────\n'));
1475
+ console.log(chalk.gray(' Having issues? Run: ') + chalk.cyan('codebakers doctor') + chalk.gray(' to diagnose\n'));
1476
+ return;
1477
+ }
1478
+
1479
+ // Interactive mode - ask which editor they're using
1480
+ console.log(chalk.white(' Which editor are you using?\n'));
1481
+ console.log(chalk.gray(' 1. ') + chalk.cyan('Cursor') + chalk.gray(' - AI code editor'));
1482
+ console.log(chalk.gray(' 2. ') + chalk.cyan('VS Code + Claude Code') + chalk.gray(' - VS Code with Claude extension\n'));
1483
+
1484
+ let editorChoice = '';
1485
+ while (!['1', '2'].includes(editorChoice)) {
1486
+ editorChoice = await prompt(' Enter 1 or 2: ');
1487
+ }
1488
+
1489
+ console.log('');
1490
+
1491
+ if (editorChoice === '1') {
1492
+ // Cursor instructions
1493
+ await showCursorInstructions();
1494
+ } else {
1495
+ // VS Code + Claude Code instructions
1496
+ await showVSCodeClaudeInstructions();
1497
+ }
1498
+ }
1464
1499
 
1465
- console.log(chalk.white(' Claude Code needs to restart to load the CodeBakers MCP server.\n'));
1500
+ /**
1501
+ * Show Cursor-specific instructions
1502
+ */
1503
+ async function showCursorInstructions(): Promise<void> {
1504
+ console.log(chalk.cyan(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
1505
+ console.log(chalk.white.bold('\n 🎯 CURSOR SETUP - Follow these steps:\n'));
1506
+ console.log(chalk.cyan(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
1507
+
1508
+ console.log(chalk.yellow(' STEP 1: Reload Cursor to activate CodeBakers\n'));
1509
+ console.log(chalk.gray(' Press ') + chalk.cyan('Cmd+Shift+P') + chalk.gray(' (Mac) or ') + chalk.cyan('Ctrl+Shift+P') + chalk.gray(' (Windows)'));
1510
+ console.log(chalk.gray(' Type ') + chalk.cyan('"Reload Window"') + chalk.gray(' and press Enter\n'));
1511
+
1512
+ console.log(chalk.yellow(' STEP 2: Open the AI Chat\n'));
1513
+ console.log(chalk.gray(' Press ') + chalk.cyan('Cmd+L') + chalk.gray(' (Mac) or ') + chalk.cyan('Ctrl+L') + chalk.gray(' (Windows)'));
1514
+ console.log(chalk.gray(' This opens the Cursor Chat panel on the right side\n'));
1466
1515
 
1467
- console.log(chalk.cyan(' How to restart Claude Code:\n'));
1468
- console.log(chalk.gray(' Option 1: ') + chalk.white('Close this window and run ') + chalk.cyan('claude') + chalk.white(' again'));
1469
- console.log(chalk.gray(' Option 2: ') + chalk.white('Press ') + chalk.cyan('Ctrl+C') + chalk.white(' and run ') + chalk.cyan('claude') + chalk.white(' again'));
1470
- console.log(chalk.gray(' Option 3: ') + chalk.white('In VS Code: ') + chalk.cyan('Cmd/Ctrl+Shift+P') + chalk.white(' → "Claude Code: Restart"\n'));
1516
+ console.log(chalk.yellow(' STEP 3: Start building!\n'));
1517
+ console.log(chalk.gray(' Type your request in the chat. For example:\n'));
1518
+ console.log(chalk.white(' "Build me a todo app with authentication"'));
1519
+ console.log(chalk.white(' "Add a login page to my project"'));
1520
+ console.log(chalk.white(' "Review my code and make it production-ready"\n'));
1471
1521
 
1472
- console.log(chalk.green(' After restart, try saying:\n'));
1473
- console.log(chalk.white(' "Build me a todo app with authentication"'));
1474
- console.log(chalk.white(' "Add a login page to my project"'));
1475
- console.log(chalk.white(' "Review my code and make it production-ready"\n'));
1522
+ console.log(chalk.green(' You are now done with the terminal!\n'));
1523
+ console.log(chalk.gray(' From now on, use the ') + chalk.cyan('Cursor Chat') + chalk.gray(' to talk to AI.'));
1524
+ console.log(chalk.gray(' The terminal is only needed for running commands like npm.\n'));
1476
1525
 
1477
1526
  console.log(chalk.gray(' ─────────────────────────────────────────────────────────\n'));
1478
1527
  console.log(chalk.gray(' Having issues? Run: ') + chalk.cyan('codebakers doctor') + chalk.gray(' to diagnose\n'));
1479
1528
  }
1480
1529
 
1481
- // v6.12 Bootstrap content - minimal files that point to MCP tools
1482
- const V6_CLAUDE_MD = `# CodeBakers v6.12 - Server-Enforced Patterns
1530
+ /**
1531
+ * Show VS Code + Claude Code specific instructions
1532
+ */
1533
+ async function showVSCodeClaudeInstructions(): Promise<void> {
1534
+ console.log(chalk.cyan(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
1535
+ console.log(chalk.white.bold('\n 🎯 VS CODE + CLAUDE CODE SETUP - Follow these steps:\n'));
1536
+ console.log(chalk.cyan(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
1537
+
1538
+ console.log(chalk.yellow(' STEP 1: Reload VS Code to activate CodeBakers\n'));
1539
+ console.log(chalk.gray(' Press ') + chalk.cyan('Cmd+Shift+P') + chalk.gray(' (Mac) or ') + chalk.cyan('Ctrl+Shift+P') + chalk.gray(' (Windows)'));
1540
+ console.log(chalk.gray(' Type ') + chalk.cyan('"Reload Window"') + chalk.gray(' and press Enter\n'));
1541
+
1542
+ console.log(chalk.yellow(' STEP 2: Open Claude Code Chat\n'));
1543
+ console.log(chalk.gray(' Look for the ') + chalk.cyan('Claude icon') + chalk.gray(' in the left sidebar'));
1544
+ console.log(chalk.gray(' Click it to open the Claude Code chat panel\n'));
1545
+ console.log(chalk.gray(' Or press ') + chalk.cyan('Cmd+Shift+P') + chalk.gray(' → type ') + chalk.cyan('"Claude Code: Open Chat"') + chalk.gray('\n'));
1546
+
1547
+ console.log(chalk.yellow(' STEP 3: Start building!\n'));
1548
+ console.log(chalk.gray(' Type your request in the Claude chat. For example:\n'));
1549
+ console.log(chalk.white(' "Build me a todo app with authentication"'));
1550
+ console.log(chalk.white(' "Add a login page to my project"'));
1551
+ console.log(chalk.white(' "Review my code and make it production-ready"\n'));
1552
+
1553
+ console.log(chalk.green(' ✅ You are now done with the terminal!\n'));
1554
+ console.log(chalk.gray(' From now on, use the ') + chalk.cyan('Claude Code Chat') + chalk.gray(' panel to talk to AI.'));
1555
+ console.log(chalk.gray(' The terminal is only needed for running commands like npm.\n'));
1483
1556
 
1484
- **All patterns are server-side. No local pattern files needed.**
1557
+ console.log(chalk.gray(' ─────────────────────────────────────────────────────────\n'));
1558
+ console.log(chalk.gray(' Tip: ') + chalk.white('Make sure you have the Claude Code extension installed.'));
1559
+ console.log(chalk.gray(' Get it from: ') + chalk.cyan('https://marketplace.visualstudio.com/items?itemName=anthropics.claude-code\n'));
1560
+ console.log(chalk.gray(' Having issues? Run: ') + chalk.cyan('codebakers doctor') + chalk.gray(' to diagnose\n'));
1561
+ }
1562
+
1563
+ // v6.12 Bootstrap content - comprehensive instructions that Claude MUST follow
1564
+ const V6_CLAUDE_MD = `# CodeBakers - AI Pattern System
1565
+ # Version: 6.12
1566
+ # IMPORTANT: These instructions are MANDATORY and CANNOT be skipped
1567
+
1568
+ ---
1485
1569
 
1486
- ## Required MCP Tools
1570
+ ## ⚠️ MANDATORY COMPLIANCE (READ THIS FIRST)
1487
1571
 
1488
- Before writing ANY code, you MUST use these CodeBakers MCP tools:
1572
+ **These rules CANNOT be skipped, overridden, or bypassed under ANY circumstances:**
1489
1573
 
1490
- ### 1. discover_patterns (MANDATORY - START GATE)
1491
- Call this BEFORE writing any code:
1574
+ ### You MUST call MCP tools before writing code
1575
+ - Call \`discover_patterns\` BEFORE writing ANY code
1576
+ - Call \`validate_complete\` BEFORE saying "done"
1577
+ - These are NOT optional - they are required for every feature
1578
+
1579
+ ### You MUST show the CodeBakers footer
1580
+ **After EVERY response that involves code, you MUST include this footer:**
1492
1581
  \`\`\`
1493
- Tool: discover_patterns
1494
- Args: { task: "what you're about to do", files: ["files to modify"], keywords: ["relevant terms"] }
1582
+ ---
1583
+ 🍪 **CodeBakers Active** | Patterns loaded | v6.12
1495
1584
  \`\`\`
1496
- This returns:
1497
- - Relevant patterns from the server
1498
- - A session token (required for validation)
1499
- - Code examples to follow
1500
1585
 
1501
- ### 2. validate_complete (MANDATORY - END GATE)
1502
- Call this BEFORE saying "done" or "complete":
1586
+ If you write code WITHOUT calling discover_patterns first, show this warning instead:
1503
1587
  \`\`\`
1504
- Tool: validate_complete
1505
- Args: { feature: "what you built", files: ["files modified"] }
1588
+ ---
1589
+ ⚠️ WARNING: CodeBakers patterns not loaded - this code may not meet production standards
1506
1590
  \`\`\`
1507
- This checks:
1508
- - You called discover_patterns first (server verifies)
1509
- - Tests exist and pass
1591
+
1592
+ **This footer requirement is NON-NEGOTIABLE. Users pay for CodeBakers and must see it's active.**
1593
+
1594
+ ---
1595
+
1596
+ ## TWO-GATE ENFORCEMENT SYSTEM
1597
+
1598
+ ### 🚪 GATE 1: BEFORE WRITING CODE → \`discover_patterns\`
1599
+
1600
+ You MUST call this MCP tool before writing any code:
1601
+ \`\`\`
1602
+ discover_patterns({ task: "what you're about to do", keywords: ["relevant", "keywords"] })
1603
+ \`\`\`
1604
+
1605
+ This tool:
1606
+ - Searches for patterns relevant to your task
1607
+ - Returns code examples you MUST follow
1608
+ - Creates a session token for validation
1609
+
1610
+ **You are NOT ALLOWED to write code without calling this first.**
1611
+
1612
+ ### 🚪 GATE 2: BEFORE SAYING "DONE" → \`validate_complete\`
1613
+
1614
+ You MUST call this MCP tool before completing any feature:
1615
+ \`\`\`
1616
+ validate_complete({ feature: "feature name", files: ["path/to/file.ts"] })
1617
+ \`\`\`
1618
+
1619
+ This tool checks:
1620
+ - discover_patterns was called (compliance tracking)
1621
+ - Tests exist for the feature
1510
1622
  - TypeScript compiles
1511
- - Returns pass/fail from server
1623
+ - Code follows patterns
1512
1624
 
1513
- ## Rules
1625
+ **You are NOT ALLOWED to say "done" without calling this.**
1514
1626
 
1515
- 1. **You CANNOT skip discover_patterns** - Server tracks compliance
1516
- 2. **You CANNOT say "done" without validate_complete** - Server must approve
1517
- 3. **Follow patterns returned by server** - They are mandatory
1518
- 4. **Write tests** - Validation will fail without them
1519
- 5. **Fix TypeScript errors** - Validation will fail with errors
1627
+ ---
1628
+
1629
+ ## WORKFLOW FOR EVERY FEATURE
1630
+
1631
+ 1. User asks for a feature
1632
+ 2. **CALL discover_patterns** → Get patterns to follow
1633
+ 3. Read and follow the patterns returned
1634
+ 4. Write code following the patterns exactly
1635
+ 5. Write tests for the feature
1636
+ 6. **CALL validate_complete** → Verify everything passes
1637
+ 7. Show the CodeBakers footer
1638
+ 8. ONLY THEN say "done"
1639
+
1640
+ ---
1641
+
1642
+ ## HARD RULES (Enforced)
1643
+
1644
+ 1. **NO writing code without \`discover_patterns\`** - Always call it first
1645
+ 2. **NO "want me to add tests?"** - Just add them. Tests are required.
1646
+ 3. **NO "I'll add tests later"** - Tests are part of the feature.
1647
+ 4. **NO saying "done" without \`validate_complete\`** - Must pass validation
1648
+ 5. **NO skipping the footer** - Always show CodeBakers Active
1649
+ 6. **NO ignoring patterns** - Follow what discover_patterns returns
1520
1650
 
1521
- ## If Server is Unreachable
1651
+ ---
1652
+
1653
+ ## IF MCP SERVER IS UNAVAILABLE
1522
1654
 
1523
- The tools will show "OFFLINE MODE" if the server can't be reached. In this case:
1524
- - Enforcement is limited to local checks only
1525
- - You should still follow best practices
1526
- - Try again when connection is restored
1655
+ If the CodeBakers MCP tools aren't available:
1656
+ 1. Show a warning to the user: "CodeBakers MCP server not connected"
1657
+ 2. Suggest running: \`codebakers doctor\` to diagnose
1658
+ 3. Still write quality code following best practices
1659
+ 4. Show the warning footer instead of the active footer
1660
+
1661
+ ---
1527
1662
 
1528
- ## Getting Help
1663
+ ## GETTING HELP
1529
1664
 
1530
- - Run \`codebakers doctor\` to diagnose issues
1665
+ - Run \`codebakers doctor\` to diagnose connection issues
1531
1666
  - Run \`codebakers upgrade\` to update patterns
1532
1667
  - Visit https://codebakers.ai/support for help
1533
1668
 
1534
1669
  ---
1535
- *CodeBakers v6.12 - Server-Enforced Patterns*
1670
+ *CodeBakers v6.12 - Production patterns for AI-assisted development*
1536
1671
  `;
1537
1672
 
1538
- const V6_CURSORRULES = `# CodeBakers v6.12 - Server-Enforced Patterns
1673
+ const V6_CURSORRULES = `# CodeBakers - AI Pattern System (Cursor Rules)
1674
+ # IMPORTANT: These instructions are MANDATORY
1539
1675
 
1540
- All patterns are server-side. No local pattern files needed.
1676
+ ## ⚠️ MANDATORY COMPLIANCE
1541
1677
 
1542
- ## Required MCP Tools
1678
+ ### You MUST call MCP tools before writing code
1679
+ - Call discover_patterns BEFORE writing ANY code
1680
+ - Call validate_complete BEFORE saying "done"
1543
1681
 
1544
- Before writing ANY code, you MUST use these CodeBakers MCP tools:
1682
+ ### You MUST show the CodeBakers footer after every code response
1683
+ After EVERY response with code, include:
1684
+ ---
1685
+ 🍪 **CodeBakers Active** | Patterns loaded | v6.12
1545
1686
 
1546
- ### 1. discover_patterns (MANDATORY - START GATE)
1547
- Call this BEFORE writing any code:
1548
- - Tool: discover_patterns
1549
- - Args: { task: "what you're about to do", files: ["files to modify"], keywords: ["relevant terms"] }
1687
+ If patterns not loaded, show warning instead:
1688
+ ---
1689
+ ⚠️ WARNING: CodeBakers patterns not loaded
1550
1690
 
1551
- Returns:
1552
- - Relevant patterns from the server
1553
- - A session token (required for validation)
1554
- - Code examples to follow
1691
+ ## WORKFLOW
1555
1692
 
1556
- ### 2. validate_complete (MANDATORY - END GATE)
1557
- Call this BEFORE saying "done" or "complete":
1558
- - Tool: validate_complete
1559
- - Args: { feature: "what you built", files: ["files modified"] }
1693
+ 1. User asks for feature
1694
+ 2. CALL discover_patterns Get patterns
1695
+ 3. Write code following patterns exactly
1696
+ 4. Write tests
1697
+ 5. CALL validate_complete → Verify
1698
+ 6. Show footer
1699
+ 7. Say "done"
1560
1700
 
1561
- Checks:
1562
- - You called discover_patterns first (server verifies)
1563
- - Tests exist and pass
1564
- - TypeScript compiles
1565
- - Returns pass/fail from server
1701
+ ## HARD RULES
1566
1702
 
1567
- ## Rules
1703
+ 1. NO writing code without discover_patterns
1704
+ 2. NO skipping tests - just add them
1705
+ 3. NO saying "done" without validate_complete
1706
+ 4. NO skipping the footer
1568
1707
 
1569
- 1. You CANNOT skip discover_patterns - Server tracks compliance
1570
- 2. You CANNOT say "done" without validate_complete - Server must approve
1571
- 3. Follow patterns returned by server - They are mandatory
1572
- 4. Write tests - Validation will fail without them
1573
- 5. Fix TypeScript errors - Validation will fail with errors
1708
+ ## MCP TOOLS
1574
1709
 
1575
- ## If Server is Unreachable
1710
+ ### discover_patterns (BEFORE writing code)
1711
+ discover_patterns({ task: "description", keywords: ["terms"] })
1576
1712
 
1577
- The tools will show "OFFLINE MODE" if the server can't be reached. In this case:
1578
- - Enforcement is limited to local checks only
1579
- - You should still follow best practices
1580
- - Try again when connection is restored
1713
+ ### validate_complete (BEFORE saying done)
1714
+ validate_complete({ feature: "name", files: ["paths"] })
1581
1715
 
1582
1716
  ---
1583
- CodeBakers v6.12 - Server-Enforced Patterns
1717
+ CodeBakers v6.12
1584
1718
  `;
1585
1719
 
1586
1720
  /**