@codebakers/cli 3.4.1 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.js +40 -82
- package/dist/commands/go.js +147 -107
- package/dist/commands/init.js +56 -41
- package/dist/commands/install-hook.js +8 -8
- package/dist/commands/install.js +54 -55
- package/dist/commands/scaffold.js +39 -22
- package/dist/commands/status.js +41 -13
- package/dist/mcp/server.js +165 -146
- package/package.json +1 -1
- package/src/commands/doctor.ts +39 -81
- package/src/commands/go.ts +152 -132
- package/src/commands/init.ts +55 -43
- package/src/commands/install-hook.ts +8 -8
- package/src/commands/install.ts +59 -68
- package/src/commands/scaffold.ts +39 -22
- package/src/commands/status.ts +45 -15
- package/src/mcp/server.ts +167 -160
package/src/commands/go.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import ora from 'ora';
|
|
3
3
|
import { execSync, spawn } from 'child_process';
|
|
4
|
-
import { writeFileSync,
|
|
4
|
+
import { writeFileSync, existsSync, readFileSync } from 'fs';
|
|
5
5
|
import { join } from 'path';
|
|
6
6
|
import { createInterface } from 'readline';
|
|
7
7
|
import {
|
|
@@ -31,12 +31,6 @@ function prompt(question: string): Promise<string> {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
interface ContentResponse {
|
|
35
|
-
version: string;
|
|
36
|
-
router: string;
|
|
37
|
-
modules: Record<string, string>;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
34
|
interface GoOptions {
|
|
41
35
|
verbose?: boolean;
|
|
42
36
|
}
|
|
@@ -249,7 +243,7 @@ export async function go(options: GoOptions = {}): Promise<void> {
|
|
|
249
243
|
spinner.succeed(`Trial started (${data.daysRemaining} days free)`);
|
|
250
244
|
console.log('');
|
|
251
245
|
|
|
252
|
-
// Install
|
|
246
|
+
// Install v6.0 bootstrap files (CLAUDE.md and .cursorrules only)
|
|
253
247
|
await installPatterns(data.trialId, options);
|
|
254
248
|
|
|
255
249
|
// Configure MCP
|
|
@@ -395,149 +389,175 @@ async function showSuccessAndRestart(): Promise<void> {
|
|
|
395
389
|
}
|
|
396
390
|
}
|
|
397
391
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
*/
|
|
401
|
-
async function installPatternsWithApiKey(apiKey: string, options: GoOptions = {}): Promise<void> {
|
|
402
|
-
log('Installing patterns with API key...', options);
|
|
403
|
-
const spinner = ora('Installing CodeBakers patterns...').start();
|
|
404
|
-
const cwd = process.cwd();
|
|
405
|
-
const apiUrl = getApiUrl();
|
|
392
|
+
// v6.0 Bootstrap content - minimal files that point to MCP tools
|
|
393
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.0 - Server-Enforced Patterns
|
|
406
394
|
|
|
407
|
-
|
|
395
|
+
**All patterns are server-side. No local pattern files needed.**
|
|
408
396
|
|
|
409
|
-
|
|
410
|
-
const response = await fetch(`${apiUrl}/api/content`, {
|
|
411
|
-
method: 'GET',
|
|
412
|
-
headers: {
|
|
413
|
-
'Authorization': `Bearer ${apiKey}`,
|
|
414
|
-
},
|
|
415
|
-
});
|
|
397
|
+
## Required MCP Tools
|
|
416
398
|
|
|
417
|
-
|
|
418
|
-
log(`Response not OK: ${response.status} ${response.statusText}`, options);
|
|
419
|
-
spinner.warn('Could not download patterns');
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
399
|
+
Before writing ANY code, you MUST use these CodeBakers MCP tools:
|
|
422
400
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
401
|
+
### 1. discover_patterns (MANDATORY - START GATE)
|
|
402
|
+
Call this BEFORE writing any code:
|
|
403
|
+
\`\`\`
|
|
404
|
+
Tool: discover_patterns
|
|
405
|
+
Args: { task: "what you're about to do", files: ["files to modify"], keywords: ["relevant terms"] }
|
|
406
|
+
\`\`\`
|
|
407
|
+
This returns:
|
|
408
|
+
- Relevant patterns from the server
|
|
409
|
+
- A session token (required for validation)
|
|
410
|
+
- Code examples to follow
|
|
427
411
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
412
|
+
### 2. validate_complete (MANDATORY - END GATE)
|
|
413
|
+
Call this BEFORE saying "done" or "complete":
|
|
414
|
+
\`\`\`
|
|
415
|
+
Tool: validate_complete
|
|
416
|
+
Args: { feature: "what you built", files: ["files modified"] }
|
|
417
|
+
\`\`\`
|
|
418
|
+
This checks:
|
|
419
|
+
- You called discover_patterns first (server verifies)
|
|
420
|
+
- Tests exist and pass
|
|
421
|
+
- TypeScript compiles
|
|
422
|
+
- Returns pass/fail from server
|
|
423
|
+
|
|
424
|
+
## Rules
|
|
425
|
+
|
|
426
|
+
1. **You CANNOT skip discover_patterns** - Server tracks compliance
|
|
427
|
+
2. **You CANNOT say "done" without validate_complete** - Server must approve
|
|
428
|
+
3. **Follow patterns returned by server** - They are mandatory
|
|
429
|
+
4. **Write tests** - Validation will fail without them
|
|
430
|
+
5. **Fix TypeScript errors** - Validation will fail with errors
|
|
431
|
+
|
|
432
|
+
## If Server is Unreachable
|
|
433
|
+
|
|
434
|
+
The tools will show "OFFLINE MODE" if the server can't be reached. In this case:
|
|
435
|
+
- Enforcement is limited to local checks only
|
|
436
|
+
- You should still follow best practices
|
|
437
|
+
- Try again when connection is restored
|
|
438
|
+
|
|
439
|
+
## Getting Help
|
|
440
|
+
|
|
441
|
+
- Run \`codebakers doctor\` to diagnose issues
|
|
442
|
+
- Run \`codebakers upgrade\` to update patterns
|
|
443
|
+
- Visit https://codebakers.ai/support for help
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
*CodeBakers v6.0 - Server-Enforced Patterns*
|
|
447
|
+
`;
|
|
448
|
+
|
|
449
|
+
const V6_CURSORRULES = `# CodeBakers v6.0 - Server-Enforced Patterns
|
|
450
|
+
|
|
451
|
+
All patterns are server-side. No local pattern files needed.
|
|
452
|
+
|
|
453
|
+
## Required MCP Tools
|
|
454
|
+
|
|
455
|
+
Before writing ANY code, you MUST use these CodeBakers MCP tools:
|
|
456
|
+
|
|
457
|
+
### 1. discover_patterns (MANDATORY - START GATE)
|
|
458
|
+
Call this BEFORE writing any code:
|
|
459
|
+
- Tool: discover_patterns
|
|
460
|
+
- Args: { task: "what you're about to do", files: ["files to modify"], keywords: ["relevant terms"] }
|
|
461
|
+
|
|
462
|
+
Returns:
|
|
463
|
+
- Relevant patterns from the server
|
|
464
|
+
- A session token (required for validation)
|
|
465
|
+
- Code examples to follow
|
|
466
|
+
|
|
467
|
+
### 2. validate_complete (MANDATORY - END GATE)
|
|
468
|
+
Call this BEFORE saying "done" or "complete":
|
|
469
|
+
- Tool: validate_complete
|
|
470
|
+
- Args: { feature: "what you built", files: ["files modified"] }
|
|
471
|
+
|
|
472
|
+
Checks:
|
|
473
|
+
- You called discover_patterns first (server verifies)
|
|
474
|
+
- Tests exist and pass
|
|
475
|
+
- TypeScript compiles
|
|
476
|
+
- Returns pass/fail from server
|
|
477
|
+
|
|
478
|
+
## Rules
|
|
479
|
+
|
|
480
|
+
1. You CANNOT skip discover_patterns - Server tracks compliance
|
|
481
|
+
2. You CANNOT say "done" without validate_complete - Server must approve
|
|
482
|
+
3. Follow patterns returned by server - They are mandatory
|
|
483
|
+
4. Write tests - Validation will fail without them
|
|
484
|
+
5. Fix TypeScript errors - Validation will fail with errors
|
|
485
|
+
|
|
486
|
+
## If Server is Unreachable
|
|
487
|
+
|
|
488
|
+
The tools will show "OFFLINE MODE" if the server can't be reached. In this case:
|
|
489
|
+
- Enforcement is limited to local checks only
|
|
490
|
+
- You should still follow best practices
|
|
491
|
+
- Try again when connection is restored
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
CodeBakers v6.0 - Server-Enforced Patterns
|
|
495
|
+
`;
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Install v6.0 bootstrap files for API key users (paid users)
|
|
499
|
+
* Only installs minimal CLAUDE.md and .cursorrules - no .claude/ folder
|
|
500
|
+
*/
|
|
501
|
+
async function installPatternsWithApiKey(apiKey: string, options: GoOptions = {}): Promise<void> {
|
|
502
|
+
log('Installing v6.0 bootstrap files (API key user)...', options);
|
|
503
|
+
await installBootstrapFiles(options, { apiKey });
|
|
433
504
|
}
|
|
434
505
|
|
|
435
506
|
/**
|
|
436
|
-
* Install
|
|
507
|
+
* Install v6.0 bootstrap files for trial users
|
|
508
|
+
* Only installs minimal CLAUDE.md and .cursorrules - no .claude/ folder
|
|
437
509
|
*/
|
|
438
510
|
async function installPatterns(trialId: string, options: GoOptions = {}): Promise<void> {
|
|
439
|
-
log(`Installing
|
|
440
|
-
|
|
511
|
+
log(`Installing v6.0 bootstrap files (trial: ${trialId.substring(0, 8)}...)`, options);
|
|
512
|
+
await installBootstrapFiles(options, { trialId });
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Install v6.0 minimal bootstrap files
|
|
517
|
+
* - CLAUDE.md: Instructions for Claude Code
|
|
518
|
+
* - .cursorrules: Instructions for Cursor
|
|
519
|
+
* - NO .claude/ folder - all patterns are server-side
|
|
520
|
+
*/
|
|
521
|
+
async function installBootstrapFiles(options: GoOptions = {}, auth?: AuthInfo): Promise<void> {
|
|
522
|
+
const spinner = ora('Installing CodeBakers v6.0...').start();
|
|
441
523
|
const cwd = process.cwd();
|
|
442
|
-
const apiUrl = getApiUrl();
|
|
443
524
|
|
|
444
525
|
try {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
if (!response.ok) {
|
|
455
|
-
log(`Primary endpoint failed: ${response.status}, trying trial endpoint...`, options);
|
|
456
|
-
// Try without auth - some patterns may be available for trial
|
|
457
|
-
const publicResponse = await fetch(`${apiUrl}/api/content/trial`, {
|
|
458
|
-
method: 'GET',
|
|
459
|
-
headers: {
|
|
460
|
-
'X-Trial-ID': trialId,
|
|
461
|
-
},
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
if (!publicResponse.ok) {
|
|
465
|
-
log(`Trial endpoint also failed: ${publicResponse.status}`, options);
|
|
466
|
-
spinner.warn('Could not download patterns (will use MCP tools)');
|
|
526
|
+
const claudeMdPath = join(cwd, 'CLAUDE.md');
|
|
527
|
+
const cursorRulesPath = join(cwd, '.cursorrules');
|
|
528
|
+
|
|
529
|
+
// Check if already installed with v6
|
|
530
|
+
if (existsSync(claudeMdPath)) {
|
|
531
|
+
const content = readFileSync(claudeMdPath, 'utf-8');
|
|
532
|
+
if (content.includes('v6.0') && content.includes('discover_patterns')) {
|
|
533
|
+
spinner.succeed('CodeBakers v6.0 already installed');
|
|
467
534
|
return;
|
|
468
535
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
log(`Received version: ${content.version}, modules: ${Object.keys(content.modules || {}).length}`, options);
|
|
472
|
-
await writePatternFiles(cwd, content, spinner, options, { trialId });
|
|
473
|
-
return;
|
|
536
|
+
// Upgrade from v5
|
|
537
|
+
log('Upgrading from v5 to v6...', options);
|
|
474
538
|
}
|
|
475
539
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
540
|
+
// Write v6.0 bootstrap files
|
|
541
|
+
writeFileSync(claudeMdPath, V6_CLAUDE_MD);
|
|
542
|
+
writeFileSync(cursorRulesPath, V6_CURSORRULES);
|
|
543
|
+
|
|
544
|
+
spinner.succeed('CodeBakers v6.0 installed');
|
|
545
|
+
console.log(chalk.gray(' Patterns are server-enforced via MCP tools\n'));
|
|
546
|
+
|
|
547
|
+
// Confirm install to server (non-blocking)
|
|
548
|
+
if (auth) {
|
|
549
|
+
const apiUrl = getApiUrl();
|
|
550
|
+
confirmDownload(apiUrl, auth, {
|
|
551
|
+
version: '6.0',
|
|
552
|
+
moduleCount: 0, // No local modules in v6
|
|
553
|
+
cliVersion: getCliVersion(),
|
|
554
|
+
command: 'go',
|
|
555
|
+
}).catch(() => {}); // Silently ignore
|
|
556
|
+
}
|
|
479
557
|
|
|
480
558
|
} catch (error) {
|
|
481
559
|
log(`Error: ${error instanceof Error ? error.message : String(error)}`, options);
|
|
482
|
-
spinner.warn('Could not install
|
|
483
|
-
console.log(chalk.gray('
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
async function writePatternFiles(
|
|
488
|
-
cwd: string,
|
|
489
|
-
content: ContentResponse,
|
|
490
|
-
spinner: ReturnType<typeof ora>,
|
|
491
|
-
options: GoOptions = {},
|
|
492
|
-
auth?: AuthInfo
|
|
493
|
-
): Promise<void> {
|
|
494
|
-
log(`Writing pattern files to ${cwd}...`, options);
|
|
495
|
-
// Check if patterns already exist
|
|
496
|
-
const claudeMdPath = join(cwd, 'CLAUDE.md');
|
|
497
|
-
if (existsSync(claudeMdPath)) {
|
|
498
|
-
spinner.succeed('CodeBakers patterns already installed');
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// Write CLAUDE.md (router file)
|
|
503
|
-
if (content.router) {
|
|
504
|
-
writeFileSync(claudeMdPath, content.router);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
// Write pattern modules to .claude/
|
|
508
|
-
const moduleCount = Object.keys(content.modules || {}).length;
|
|
509
|
-
if (content.modules && moduleCount > 0) {
|
|
510
|
-
const modulesDir = join(cwd, '.claude');
|
|
511
|
-
if (!existsSync(modulesDir)) {
|
|
512
|
-
mkdirSync(modulesDir, { recursive: true });
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
for (const [name, data] of Object.entries(content.modules)) {
|
|
516
|
-
writeFileSync(join(modulesDir, name), data);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
// Update .gitignore to exclude encoded patterns
|
|
521
|
-
const gitignorePath = join(cwd, '.gitignore');
|
|
522
|
-
if (existsSync(gitignorePath)) {
|
|
523
|
-
const { readFileSync } = await import('fs');
|
|
524
|
-
const gitignore = readFileSync(gitignorePath, 'utf-8');
|
|
525
|
-
if (!gitignore.includes('.claude/')) {
|
|
526
|
-
writeFileSync(gitignorePath, gitignore + '\n# CodeBakers patterns\n.claude/\n');
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
spinner.succeed(`CodeBakers patterns installed (v${content.version})`);
|
|
531
|
-
console.log(chalk.gray(` ${moduleCount} pattern modules ready\n`));
|
|
532
|
-
|
|
533
|
-
// Confirm download to server (non-blocking)
|
|
534
|
-
if (auth) {
|
|
535
|
-
const apiUrl = getApiUrl();
|
|
536
|
-
confirmDownload(apiUrl, auth, {
|
|
537
|
-
version: content.version,
|
|
538
|
-
moduleCount,
|
|
539
|
-
cliVersion: getCliVersion(),
|
|
540
|
-
command: 'go',
|
|
541
|
-
}).catch(() => {}); // Silently ignore
|
|
560
|
+
spinner.warn('Could not install bootstrap files');
|
|
561
|
+
console.log(chalk.gray(' MCP tools will still work without local files.\n'));
|
|
542
562
|
}
|
|
543
563
|
}
|
package/src/commands/init.ts
CHANGED
|
@@ -33,9 +33,9 @@ If PROJECT-CONTEXT.md is empty or stale (>7 days), SCAN THE PROJECT FIRST:
|
|
|
33
33
|
- Update PROJECT-CONTEXT.md
|
|
34
34
|
|
|
35
35
|
### PHASE 3: EXECUTE
|
|
36
|
-
- State: \`📋 CodeBakers | [Type] |
|
|
37
|
-
-
|
|
38
|
-
- Follow patterns EXACTLY
|
|
36
|
+
- State: \`📋 CodeBakers | [Type] | v6.0 Server-Enforced\`
|
|
37
|
+
- Call discover_patterns MCP tool first
|
|
38
|
+
- Follow patterns from server EXACTLY
|
|
39
39
|
|
|
40
40
|
### PHASE 4: SELF-REVIEW (before saying "done")
|
|
41
41
|
- [ ] TypeScript compiles? (npx tsc --noEmit)
|
|
@@ -405,9 +405,9 @@ When you make a decision that affects architecture, add an entry:
|
|
|
405
405
|
---
|
|
406
406
|
|
|
407
407
|
## ${date}: Project Initialized
|
|
408
|
-
**Decision:** Using CodeBakers pattern system
|
|
408
|
+
**Decision:** Using CodeBakers v6.0 pattern system
|
|
409
409
|
**Reason:** Ensure consistent, production-quality code
|
|
410
|
-
**Pattern:**
|
|
410
|
+
**Pattern:** Server-enforced via discover_patterns MCP tool
|
|
411
411
|
|
|
412
412
|
---
|
|
413
413
|
|
|
@@ -597,51 +597,64 @@ export async function init(): Promise<void> {
|
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
-
// Step 4: Install
|
|
601
|
-
console.log(chalk.white('\n Step 2: Installing
|
|
600
|
+
// Step 4: Install v6.0 bootstrap files
|
|
601
|
+
console.log(chalk.white('\n Step 2: Installing CodeBakers v6.0\n'));
|
|
602
602
|
|
|
603
|
-
const spinner = ora('
|
|
603
|
+
const spinner = ora(' Installing v6.0 bootstrap...').start();
|
|
604
604
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
const response = await fetch(`${apiUrl}/api/content`, {
|
|
608
|
-
method: 'GET',
|
|
609
|
-
headers: {
|
|
610
|
-
Authorization: `Bearer ${apiKey}`,
|
|
611
|
-
},
|
|
612
|
-
});
|
|
605
|
+
// v6.0 bootstrap content - minimal files, patterns from server
|
|
606
|
+
const V6_CLAUDE_MD = `# CodeBakers v6.0
|
|
613
607
|
|
|
614
|
-
|
|
615
|
-
const error = await response.json().catch(() => ({}));
|
|
616
|
-
throw new Error(error.error || 'Failed to fetch content');
|
|
617
|
-
}
|
|
608
|
+
**MANDATORY: Before writing ANY code, call the \`discover_patterns\` MCP tool.**
|
|
618
609
|
|
|
619
|
-
|
|
620
|
-
|
|
610
|
+
\`\`\`
|
|
611
|
+
Tool: discover_patterns
|
|
612
|
+
Args: { task: "description of what you're building" }
|
|
613
|
+
\`\`\`
|
|
621
614
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
615
|
+
The server will return:
|
|
616
|
+
- All coding patterns and rules you must follow
|
|
617
|
+
- Test requirements
|
|
618
|
+
- Validation instructions
|
|
626
619
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
620
|
+
**You cannot write code without calling this tool first. The server tracks compliance.**
|
|
621
|
+
|
|
622
|
+
---
|
|
623
|
+
*CodeBakers v6.0 - Server-Enforced*
|
|
624
|
+
`;
|
|
625
|
+
|
|
626
|
+
const V6_CURSORRULES = `# CodeBakers v6.0
|
|
627
|
+
|
|
628
|
+
MANDATORY: Before writing ANY code, call the discover_patterns MCP tool.
|
|
633
629
|
|
|
634
|
-
|
|
635
|
-
|
|
630
|
+
Tool: discover_patterns
|
|
631
|
+
Args: { task: "description of what you're building" }
|
|
632
|
+
|
|
633
|
+
The server returns all patterns, rules, and test requirements.
|
|
634
|
+
You cannot write code without calling this tool first.
|
|
635
|
+
`;
|
|
636
|
+
|
|
637
|
+
try {
|
|
638
|
+
// Write v6.0 bootstrap files
|
|
639
|
+
writeFileSync(join(cwd, 'CLAUDE.md'), V6_CLAUDE_MD);
|
|
640
|
+
writeFileSync(join(cwd, '.cursorrules'), V6_CURSORRULES);
|
|
641
|
+
|
|
642
|
+
// Remove old .claude folder if it exists (v5 → v6 migration)
|
|
643
|
+
const claudeDir = join(cwd, '.claude');
|
|
644
|
+
if (existsSync(claudeDir)) {
|
|
645
|
+
const { rmSync } = await import('fs');
|
|
646
|
+
try {
|
|
647
|
+
rmSync(claudeDir, { recursive: true, force: true });
|
|
648
|
+
} catch {
|
|
649
|
+
// Ignore errors
|
|
636
650
|
}
|
|
637
651
|
}
|
|
638
652
|
|
|
639
|
-
spinner.succeed('
|
|
640
|
-
console.log(chalk.gray(
|
|
641
|
-
console.log(chalk.gray(` Modules: ${Object.keys(content.modules || {}).length} pattern files`));
|
|
653
|
+
spinner.succeed('CodeBakers v6.0 installed!');
|
|
654
|
+
console.log(chalk.gray('\n Patterns are server-enforced via MCP tools'));
|
|
642
655
|
|
|
643
656
|
} catch (error) {
|
|
644
|
-
spinner.fail('
|
|
657
|
+
spinner.fail('Installation failed');
|
|
645
658
|
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
646
659
|
console.log(chalk.red(`\n Error: ${message}\n`));
|
|
647
660
|
process.exit(1);
|
|
@@ -758,7 +771,7 @@ export async function init(): Promise<void> {
|
|
|
758
771
|
if (existsSync(gitignorePath)) {
|
|
759
772
|
const gitignore = readFileSync(gitignorePath, 'utf-8');
|
|
760
773
|
if (!gitignore.includes('.cursorrules')) {
|
|
761
|
-
const additions = '\n# CodeBakers
|
|
774
|
+
const additions = '\n# CodeBakers\n.cursorrules\n';
|
|
762
775
|
writeFileSync(gitignorePath, gitignore + additions);
|
|
763
776
|
}
|
|
764
777
|
}
|
|
@@ -838,16 +851,15 @@ export async function init(): Promise<void> {
|
|
|
838
851
|
`));
|
|
839
852
|
|
|
840
853
|
console.log(chalk.white(' Files created:\n'));
|
|
841
|
-
console.log(chalk.cyan(' CLAUDE.md ') + chalk.gray('→
|
|
854
|
+
console.log(chalk.cyan(' CLAUDE.md ') + chalk.gray('→ v6.0 bootstrap (patterns via MCP)'));
|
|
855
|
+
console.log(chalk.cyan(' .cursorrules ') + chalk.gray('→ v6.0 bootstrap (patterns via MCP)'));
|
|
842
856
|
if (prdCreated) {
|
|
843
857
|
console.log(chalk.cyan(' PRD.md ') + chalk.gray('→ Product requirements (AI reads this!)'));
|
|
844
858
|
}
|
|
845
859
|
console.log(chalk.cyan(' PROJECT-CONTEXT.md ') + chalk.gray('→ Codebase knowledge (auto-updated)'));
|
|
846
860
|
console.log(chalk.cyan(' PROJECT-STATE.md ') + chalk.gray('→ Task tracking (auto-updated)'));
|
|
847
861
|
console.log(chalk.cyan(' DECISIONS.md ') + chalk.gray('→ Architecture log (auto-updated)'));
|
|
848
|
-
console.log(chalk.cyan(' .
|
|
849
|
-
console.log(chalk.cyan(' .cursorignore ') + chalk.gray('→ Context optimization'));
|
|
850
|
-
console.log(chalk.cyan(' .claude/ ') + chalk.gray('→ Pattern modules\n'));
|
|
862
|
+
console.log(chalk.cyan(' .cursorignore ') + chalk.gray('→ Context optimization\n'));
|
|
851
863
|
|
|
852
864
|
console.log(chalk.white(' What happens automatically:\n'));
|
|
853
865
|
console.log(chalk.gray(' ✓ AI loads context before every response'));
|
|
@@ -23,16 +23,16 @@ const HOOK_TEMPLATE = {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
// Instructions that get injected into the system prompt
|
|
26
|
+
// Instructions that get injected into the system prompt (v6.0)
|
|
27
27
|
const CODEBAKERS_INSTRUCTIONS = `
|
|
28
28
|
<user-prompt-submit-hook>
|
|
29
|
-
[CodeBakers] Active - Follow these steps for EVERY request:
|
|
29
|
+
[CodeBakers v6.0] Active - Follow these steps for EVERY request:
|
|
30
30
|
|
|
31
|
-
1. CONTEXT: Read CLAUDE.md
|
|
32
|
-
2.
|
|
33
|
-
3. EXECUTE:
|
|
31
|
+
1. CONTEXT: Read CLAUDE.md
|
|
32
|
+
2. DISCOVER: Call discover_patterns MCP tool before writing any code
|
|
33
|
+
3. EXECUTE: Follow the patterns returned by the server
|
|
34
34
|
4. SELF-REVIEW: Verify TypeScript compiles, imports resolve, error handling exists
|
|
35
|
-
5.
|
|
35
|
+
5. VALIDATE: Call validate_complete MCP tool when done
|
|
36
36
|
|
|
37
37
|
Output format: "[CodeBakers] Building [feature] using [patterns]"
|
|
38
38
|
</user-prompt-submit-hook>
|
|
@@ -102,9 +102,9 @@ export async function installHook(): Promise<void> {
|
|
|
102
102
|
|
|
103
103
|
console.log(chalk.white(' What happens automatically:\n'));
|
|
104
104
|
console.log(chalk.gray(' ✓ Loads project context before every response'));
|
|
105
|
-
console.log(chalk.gray(' ✓
|
|
105
|
+
console.log(chalk.gray(' ✓ Calls discover_patterns MCP tool before coding'));
|
|
106
106
|
console.log(chalk.gray(' ✓ Self-review reminders after code changes'));
|
|
107
|
-
console.log(chalk.gray(' ✓
|
|
107
|
+
console.log(chalk.gray(' ✓ Server-side patterns (always up-to-date)\n'));
|
|
108
108
|
|
|
109
109
|
console.log(chalk.yellow.bold(' ⚠️ RESTART REQUIRED:\n'));
|
|
110
110
|
console.log(chalk.gray(' 1. Type ') + chalk.cyan('exit') + chalk.gray(' to close this terminal'));
|