@codebakers/cli 3.4.1 → 3.5.0

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.
@@ -194,7 +194,7 @@ async function go(options = {}) {
194
194
  (0, config_js_1.setTrialState)(trialState);
195
195
  spinner.succeed(`Trial started (${data.daysRemaining} days free)`);
196
196
  console.log('');
197
- // Install patterns (CLAUDE.md and .claude/)
197
+ // Install v6.0 bootstrap files (CLAUDE.md and .cursorrules only)
198
198
  await installPatterns(data.trialId, options);
199
199
  // Configure MCP
200
200
  await configureMCP(options);
@@ -319,126 +319,166 @@ async function showSuccessAndRestart() {
319
319
  console.log(chalk_1.default.yellow(' Could not auto-restart. Please restart Claude Code manually.\n'));
320
320
  }
321
321
  }
322
+ // v6.0 Bootstrap content - minimal files that point to MCP tools
323
+ const V6_CLAUDE_MD = `# CodeBakers v6.0 - Server-Enforced Patterns
324
+
325
+ **All patterns are server-side. No local pattern files needed.**
326
+
327
+ ## Required MCP Tools
328
+
329
+ Before writing ANY code, you MUST use these CodeBakers MCP tools:
330
+
331
+ ### 1. discover_patterns (MANDATORY - START GATE)
332
+ Call this BEFORE writing any code:
333
+ \`\`\`
334
+ Tool: discover_patterns
335
+ Args: { task: "what you're about to do", files: ["files to modify"], keywords: ["relevant terms"] }
336
+ \`\`\`
337
+ This returns:
338
+ - Relevant patterns from the server
339
+ - A session token (required for validation)
340
+ - Code examples to follow
341
+
342
+ ### 2. validate_complete (MANDATORY - END GATE)
343
+ Call this BEFORE saying "done" or "complete":
344
+ \`\`\`
345
+ Tool: validate_complete
346
+ Args: { feature: "what you built", files: ["files modified"] }
347
+ \`\`\`
348
+ This checks:
349
+ - You called discover_patterns first (server verifies)
350
+ - Tests exist and pass
351
+ - TypeScript compiles
352
+ - Returns pass/fail from server
353
+
354
+ ## Rules
355
+
356
+ 1. **You CANNOT skip discover_patterns** - Server tracks compliance
357
+ 2. **You CANNOT say "done" without validate_complete** - Server must approve
358
+ 3. **Follow patterns returned by server** - They are mandatory
359
+ 4. **Write tests** - Validation will fail without them
360
+ 5. **Fix TypeScript errors** - Validation will fail with errors
361
+
362
+ ## If Server is Unreachable
363
+
364
+ The tools will show "OFFLINE MODE" if the server can't be reached. In this case:
365
+ - Enforcement is limited to local checks only
366
+ - You should still follow best practices
367
+ - Try again when connection is restored
368
+
369
+ ## Getting Help
370
+
371
+ - Run \`codebakers doctor\` to diagnose issues
372
+ - Run \`codebakers upgrade\` to update patterns
373
+ - Visit https://codebakers.ai/support for help
374
+
375
+ ---
376
+ *CodeBakers v6.0 - Server-Enforced Patterns*
377
+ `;
378
+ const V6_CURSORRULES = `# CodeBakers v6.0 - Server-Enforced Patterns
379
+
380
+ All patterns are server-side. No local pattern files needed.
381
+
382
+ ## Required MCP Tools
383
+
384
+ Before writing ANY code, you MUST use these CodeBakers MCP tools:
385
+
386
+ ### 1. discover_patterns (MANDATORY - START GATE)
387
+ Call this BEFORE writing any code:
388
+ - Tool: discover_patterns
389
+ - Args: { task: "what you're about to do", files: ["files to modify"], keywords: ["relevant terms"] }
390
+
391
+ Returns:
392
+ - Relevant patterns from the server
393
+ - A session token (required for validation)
394
+ - Code examples to follow
395
+
396
+ ### 2. validate_complete (MANDATORY - END GATE)
397
+ Call this BEFORE saying "done" or "complete":
398
+ - Tool: validate_complete
399
+ - Args: { feature: "what you built", files: ["files modified"] }
400
+
401
+ Checks:
402
+ - You called discover_patterns first (server verifies)
403
+ - Tests exist and pass
404
+ - TypeScript compiles
405
+ - Returns pass/fail from server
406
+
407
+ ## Rules
408
+
409
+ 1. You CANNOT skip discover_patterns - Server tracks compliance
410
+ 2. You CANNOT say "done" without validate_complete - Server must approve
411
+ 3. Follow patterns returned by server - They are mandatory
412
+ 4. Write tests - Validation will fail without them
413
+ 5. Fix TypeScript errors - Validation will fail with errors
414
+
415
+ ## If Server is Unreachable
416
+
417
+ The tools will show "OFFLINE MODE" if the server can't be reached. In this case:
418
+ - Enforcement is limited to local checks only
419
+ - You should still follow best practices
420
+ - Try again when connection is restored
421
+
422
+ ---
423
+ CodeBakers v6.0 - Server-Enforced Patterns
424
+ `;
322
425
  /**
323
- * Install pattern files for API key users (paid users)
426
+ * Install v6.0 bootstrap files for API key users (paid users)
427
+ * Only installs minimal CLAUDE.md and .cursorrules - no .claude/ folder
324
428
  */
325
429
  async function installPatternsWithApiKey(apiKey, options = {}) {
326
- log('Installing patterns with API key...', options);
327
- const spinner = (0, ora_1.default)('Installing CodeBakers patterns...').start();
328
- const cwd = process.cwd();
329
- const apiUrl = (0, config_js_1.getApiUrl)();
330
- log(`Fetching from: ${apiUrl}/api/content`, options);
331
- try {
332
- const response = await fetch(`${apiUrl}/api/content`, {
333
- method: 'GET',
334
- headers: {
335
- 'Authorization': `Bearer ${apiKey}`,
336
- },
337
- });
338
- if (!response.ok) {
339
- log(`Response not OK: ${response.status} ${response.statusText}`, options);
340
- spinner.warn('Could not download patterns');
341
- return;
342
- }
343
- log('Response OK, parsing JSON...', options);
344
- const content = await response.json();
345
- log(`Received version: ${content.version}, modules: ${Object.keys(content.modules || {}).length}`, options);
346
- await writePatternFiles(cwd, content, spinner, options, { apiKey });
347
- }
348
- catch (error) {
349
- log(`Error: ${error instanceof Error ? error.message : String(error)}`, options);
350
- spinner.warn('Could not install patterns');
351
- console.log(chalk_1.default.gray(' Check your internet connection.\n'));
352
- }
430
+ log('Installing v6.0 bootstrap files (API key user)...', options);
431
+ await installBootstrapFiles(options, { apiKey });
353
432
  }
354
433
  /**
355
- * Install pattern files (CLAUDE.md and .claude/) for trial users
434
+ * Install v6.0 bootstrap files for trial users
435
+ * Only installs minimal CLAUDE.md and .cursorrules - no .claude/ folder
356
436
  */
357
437
  async function installPatterns(trialId, options = {}) {
358
- log(`Installing patterns with trial ID: ${trialId.substring(0, 8)}...`, options);
359
- const spinner = (0, ora_1.default)('Installing CodeBakers patterns...').start();
438
+ log(`Installing v6.0 bootstrap files (trial: ${trialId.substring(0, 8)}...)`, options);
439
+ await installBootstrapFiles(options, { trialId });
440
+ }
441
+ /**
442
+ * Install v6.0 minimal bootstrap files
443
+ * - CLAUDE.md: Instructions for Claude Code
444
+ * - .cursorrules: Instructions for Cursor
445
+ * - NO .claude/ folder - all patterns are server-side
446
+ */
447
+ async function installBootstrapFiles(options = {}, auth) {
448
+ const spinner = (0, ora_1.default)('Installing CodeBakers v6.0...').start();
360
449
  const cwd = process.cwd();
361
- const apiUrl = (0, config_js_1.getApiUrl)();
362
450
  try {
363
- // Fetch patterns using trial ID
364
- log(`Fetching from: ${apiUrl}/api/content`, options);
365
- const response = await fetch(`${apiUrl}/api/content`, {
366
- method: 'GET',
367
- headers: {
368
- 'X-Trial-ID': trialId,
369
- },
370
- });
371
- if (!response.ok) {
372
- log(`Primary endpoint failed: ${response.status}, trying trial endpoint...`, options);
373
- // Try without auth - some patterns may be available for trial
374
- const publicResponse = await fetch(`${apiUrl}/api/content/trial`, {
375
- method: 'GET',
376
- headers: {
377
- 'X-Trial-ID': trialId,
378
- },
379
- });
380
- if (!publicResponse.ok) {
381
- log(`Trial endpoint also failed: ${publicResponse.status}`, options);
382
- spinner.warn('Could not download patterns (will use MCP tools)');
451
+ const claudeMdPath = (0, path_1.join)(cwd, 'CLAUDE.md');
452
+ const cursorRulesPath = (0, path_1.join)(cwd, '.cursorrules');
453
+ // Check if already installed with v6
454
+ if ((0, fs_1.existsSync)(claudeMdPath)) {
455
+ const content = (0, fs_1.readFileSync)(claudeMdPath, 'utf-8');
456
+ if (content.includes('v6.0') && content.includes('discover_patterns')) {
457
+ spinner.succeed('CodeBakers v6.0 already installed');
383
458
  return;
384
459
  }
385
- const content = await publicResponse.json();
386
- log(`Received version: ${content.version}, modules: ${Object.keys(content.modules || {}).length}`, options);
387
- await writePatternFiles(cwd, content, spinner, options, { trialId });
388
- return;
460
+ // Upgrade from v5
461
+ log('Upgrading from v5 to v6...', options);
462
+ }
463
+ // Write v6.0 bootstrap files
464
+ (0, fs_1.writeFileSync)(claudeMdPath, V6_CLAUDE_MD);
465
+ (0, fs_1.writeFileSync)(cursorRulesPath, V6_CURSORRULES);
466
+ spinner.succeed('CodeBakers v6.0 installed');
467
+ console.log(chalk_1.default.gray(' Patterns are server-enforced via MCP tools\n'));
468
+ // Confirm install to server (non-blocking)
469
+ if (auth) {
470
+ const apiUrl = (0, config_js_1.getApiUrl)();
471
+ confirmDownload(apiUrl, auth, {
472
+ version: '6.0',
473
+ moduleCount: 0, // No local modules in v6
474
+ cliVersion: getCliVersion(),
475
+ command: 'go',
476
+ }).catch(() => { }); // Silently ignore
389
477
  }
390
- const content = await response.json();
391
- log(`Received version: ${content.version}, modules: ${Object.keys(content.modules || {}).length}`, options);
392
- await writePatternFiles(cwd, content, spinner, options, { trialId });
393
478
  }
394
479
  catch (error) {
395
480
  log(`Error: ${error instanceof Error ? error.message : String(error)}`, options);
396
- spinner.warn('Could not install patterns (will use MCP tools)');
397
- console.log(chalk_1.default.gray(' Patterns will be available via MCP tools.\n'));
398
- }
399
- }
400
- async function writePatternFiles(cwd, content, spinner, options = {}, auth) {
401
- log(`Writing pattern files to ${cwd}...`, options);
402
- // Check if patterns already exist
403
- const claudeMdPath = (0, path_1.join)(cwd, 'CLAUDE.md');
404
- if ((0, fs_1.existsSync)(claudeMdPath)) {
405
- spinner.succeed('CodeBakers patterns already installed');
406
- return;
407
- }
408
- // Write CLAUDE.md (router file)
409
- if (content.router) {
410
- (0, fs_1.writeFileSync)(claudeMdPath, content.router);
411
- }
412
- // Write pattern modules to .claude/
413
- const moduleCount = Object.keys(content.modules || {}).length;
414
- if (content.modules && moduleCount > 0) {
415
- const modulesDir = (0, path_1.join)(cwd, '.claude');
416
- if (!(0, fs_1.existsSync)(modulesDir)) {
417
- (0, fs_1.mkdirSync)(modulesDir, { recursive: true });
418
- }
419
- for (const [name, data] of Object.entries(content.modules)) {
420
- (0, fs_1.writeFileSync)((0, path_1.join)(modulesDir, name), data);
421
- }
422
- }
423
- // Update .gitignore to exclude encoded patterns
424
- const gitignorePath = (0, path_1.join)(cwd, '.gitignore');
425
- if ((0, fs_1.existsSync)(gitignorePath)) {
426
- const { readFileSync } = await import('fs');
427
- const gitignore = readFileSync(gitignorePath, 'utf-8');
428
- if (!gitignore.includes('.claude/')) {
429
- (0, fs_1.writeFileSync)(gitignorePath, gitignore + '\n# CodeBakers patterns\n.claude/\n');
430
- }
431
- }
432
- spinner.succeed(`CodeBakers patterns installed (v${content.version})`);
433
- console.log(chalk_1.default.gray(` ${moduleCount} pattern modules ready\n`));
434
- // Confirm download to server (non-blocking)
435
- if (auth) {
436
- const apiUrl = (0, config_js_1.getApiUrl)();
437
- confirmDownload(apiUrl, auth, {
438
- version: content.version,
439
- moduleCount,
440
- cliVersion: getCliVersion(),
441
- command: 'go',
442
- }).catch(() => { }); // Silently ignore
481
+ spinner.warn('Could not install bootstrap files');
482
+ console.log(chalk_1.default.gray(' MCP tools will still work without local files.\n'));
443
483
  }
444
484
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebakers/cli",
3
- "version": "3.4.1",
3
+ "version": "3.5.0",
4
4
  "description": "CodeBakers CLI - Production patterns for AI-assisted development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -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, mkdirSync, existsSync } from 'fs';
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 patterns (CLAUDE.md and .claude/)
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
- * Install pattern files for API key users (paid users)
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
- log(`Fetching from: ${apiUrl}/api/content`, options);
395
+ **All patterns are server-side. No local pattern files needed.**
408
396
 
409
- try {
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
- if (!response.ok) {
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
- log('Response OK, parsing JSON...', options);
424
- const content: ContentResponse = await response.json();
425
- log(`Received version: ${content.version}, modules: ${Object.keys(content.modules || {}).length}`, options);
426
- await writePatternFiles(cwd, content, spinner, options, { apiKey });
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
- } catch (error) {
429
- log(`Error: ${error instanceof Error ? error.message : String(error)}`, options);
430
- spinner.warn('Could not install patterns');
431
- console.log(chalk.gray(' Check your internet connection.\n'));
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 pattern files (CLAUDE.md and .claude/) for trial users
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 patterns with trial ID: ${trialId.substring(0, 8)}...`, options);
440
- const spinner = ora('Installing CodeBakers patterns...').start();
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
- // Fetch patterns using trial ID
446
- log(`Fetching from: ${apiUrl}/api/content`, options);
447
- const response = await fetch(`${apiUrl}/api/content`, {
448
- method: 'GET',
449
- headers: {
450
- 'X-Trial-ID': trialId,
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
- const content: ContentResponse = await publicResponse.json();
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
- const content: ContentResponse = await response.json();
477
- log(`Received version: ${content.version}, modules: ${Object.keys(content.modules || {}).length}`, options);
478
- await writePatternFiles(cwd, content, spinner, options, { trialId });
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 patterns (will use MCP tools)');
483
- console.log(chalk.gray(' Patterns will be available via MCP tools.\n'));
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
  }