@codebakers/cli 3.9.12 → 3.9.14

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.
@@ -608,25 +608,11 @@ function setupCursorIDE(cwd) {
608
608
  spinner.warn('Could not configure Cursor IDE (continuing anyway)');
609
609
  }
610
610
  }
611
- function setupClaudeCodeMCP() {
611
+ function setupClaudeCodeMCP(cwd) {
612
612
  const spinner = (0, ora_1.default)(' Setting up Claude Code MCP...').start();
613
613
  try {
614
- const homeDir = process.env.USERPROFILE || process.env.HOME || '';
615
- let configPath;
616
614
  const isWindows = process.platform === 'win32';
617
- if (isWindows) {
618
- configPath = (0, path_1.join)(homeDir, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
619
- }
620
- else if (process.platform === 'darwin') {
621
- configPath = (0, path_1.join)(homeDir, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
622
- }
623
- else {
624
- configPath = (0, path_1.join)(homeDir, '.config', 'claude', 'claude_desktop_config.json');
625
- }
626
- const configDir = (0, path_1.join)(configPath, '..');
627
- if (!(0, fs_1.existsSync)(configDir)) {
628
- (0, fs_1.mkdirSync)(configDir, { recursive: true });
629
- }
615
+ // Create project-level .mcp.json (Claude Code reads this automatically)
630
616
  const mcpConfig = {
631
617
  mcpServers: {
632
618
  codebakers: isWindows
@@ -634,23 +620,24 @@ function setupClaudeCodeMCP() {
634
620
  : { command: 'npx', args: ['-y', '@codebakers/cli', 'serve'] }
635
621
  }
636
622
  };
637
- if ((0, fs_1.existsSync)(configPath)) {
623
+ const mcpJsonPath = (0, path_1.join)(cwd, '.mcp.json');
624
+ if ((0, fs_1.existsSync)(mcpJsonPath)) {
638
625
  try {
639
- const existing = JSON.parse((0, fs_1.readFileSync)(configPath, 'utf-8'));
626
+ const existing = JSON.parse((0, fs_1.readFileSync)(mcpJsonPath, 'utf-8'));
640
627
  if (!existing.mcpServers) {
641
628
  existing.mcpServers = {};
642
629
  }
643
630
  existing.mcpServers.codebakers = mcpConfig.mcpServers.codebakers;
644
- (0, fs_1.writeFileSync)(configPath, JSON.stringify(existing, null, 2));
631
+ (0, fs_1.writeFileSync)(mcpJsonPath, JSON.stringify(existing, null, 2));
645
632
  }
646
633
  catch {
647
- (0, fs_1.writeFileSync)(configPath, JSON.stringify(mcpConfig, null, 2));
634
+ (0, fs_1.writeFileSync)(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
648
635
  }
649
636
  }
650
637
  else {
651
- (0, fs_1.writeFileSync)(configPath, JSON.stringify(mcpConfig, null, 2));
638
+ (0, fs_1.writeFileSync)(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
652
639
  }
653
- spinner.succeed('Claude Code MCP configured!');
640
+ spinner.succeed('Claude Code MCP configured (.mcp.json created)');
654
641
  }
655
642
  catch {
656
643
  spinner.warn('Could not configure Claude Code MCP (continuing anyway)');
@@ -1031,6 +1018,19 @@ async function go(options = {}) {
1031
1018
  if (projectState.isSetUp) {
1032
1019
  // Project already has CodeBakers - show context and resume
1033
1020
  showResumeContext(projectState);
1021
+ // CRITICAL: Ensure .mcp.json exists for Claude Code MCP tools
1022
+ // This fixes the issue where existing projects set up before v3.9.14
1023
+ // never got .mcp.json created (it was only created in first-time setup)
1024
+ const mcpJsonPath = (0, path_1.join)(cwd, '.mcp.json');
1025
+ if (!(0, fs_1.existsSync)(mcpJsonPath)) {
1026
+ console.log(chalk_1.default.yellow(' ⚠️ MCP config missing - creating .mcp.json...\n'));
1027
+ setupClaudeCodeMCP(cwd);
1028
+ console.log(chalk_1.default.yellow(' ⚠️ RELOAD REQUIRED to load MCP tools\n'));
1029
+ console.log(chalk_1.default.white(' Claude Code needs to reload to detect the new .mcp.json file.\n'));
1030
+ console.log(chalk_1.default.cyan(' To reload:\n'));
1031
+ console.log(chalk_1.default.gray(' VS Code: ') + chalk_1.default.white('Press ') + chalk_1.default.cyan('Cmd/Ctrl+Shift+P') + chalk_1.default.white(' → type ') + chalk_1.default.cyan('"Reload Window"'));
1032
+ console.log(chalk_1.default.gray(' CLI: ') + 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\n'));
1033
+ }
1034
1034
  // Verify auth is still valid
1035
1035
  const existingApiKey = (0, config_js_1.getApiKey)();
1036
1036
  const existingTrial = (0, config_js_1.getTrialState)();
@@ -1074,15 +1074,14 @@ async function go(options = {}) {
1074
1074
  console.log(chalk_1.default.white(' What was set up:'));
1075
1075
  console.log(chalk_1.default.gray(' • CLAUDE.md - AI instructions for this project'));
1076
1076
  console.log(chalk_1.default.gray(' • .codebakers.json - Project configuration'));
1077
- console.log(chalk_1.default.gray(' • MCP server - Registered in Claude Code config\n'));
1078
- console.log(chalk_1.default.yellow(' ⚠️ RESTART REQUIRED to load MCP tools\n'));
1079
- console.log(chalk_1.default.white(' The CodeBakers MCP server was registered, but Claude Code'));
1080
- console.log(chalk_1.default.white(' needs to restart to load it.\n'));
1081
- console.log(chalk_1.default.cyan(' To restart Claude Code:\n'));
1082
- console.log(chalk_1.default.gray(' Option 1: ') + 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'));
1083
- console.log(chalk_1.default.gray(' Option 2: ') + chalk_1.default.white('In VS Code: ') + chalk_1.default.cyan('Cmd/Ctrl+Shift+P') + chalk_1.default.white(' → "Reload Window"\n'));
1084
- console.log(chalk_1.default.white(' After restart, MCP tools (discover_patterns, validate_complete)'));
1085
- console.log(chalk_1.default.white(' will be available.\n'));
1077
+ console.log(chalk_1.default.gray(' • .mcp.json - MCP server configuration for Claude Code\n'));
1078
+ console.log(chalk_1.default.yellow(' ⚠️ RELOAD REQUIRED to load MCP tools\n'));
1079
+ console.log(chalk_1.default.white(' Claude Code needs to reload to detect the new .mcp.json file.\n'));
1080
+ console.log(chalk_1.default.cyan(' To reload:\n'));
1081
+ console.log(chalk_1.default.gray(' VS Code: ') + chalk_1.default.white('Press ') + chalk_1.default.cyan('Cmd/Ctrl+Shift+P') + chalk_1.default.white(' → type ') + chalk_1.default.cyan('"Reload Window"'));
1082
+ console.log(chalk_1.default.gray(' CLI: ') + 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\n'));
1083
+ console.log(chalk_1.default.white(' After reload, MCP tools (discover_patterns, validate_complete)'));
1084
+ console.log(chalk_1.default.white(' will be available automatically.\n'));
1086
1085
  console.log(chalk_1.default.gray(' ─────────────────────────────────────────────────────────\n'));
1087
1086
  console.log(chalk_1.default.gray(' Optional: To activate trial, run ') + chalk_1.default.cyan('codebakers go') + chalk_1.default.gray(' in a terminal.\n'));
1088
1087
  return;
@@ -1467,7 +1466,7 @@ async function setupNewProject(cwd, options = {}, auth) {
1467
1466
  // Setup IDEs and MCP
1468
1467
  console.log('');
1469
1468
  setupCursorIDE(cwd);
1470
- setupClaudeCodeMCP();
1469
+ setupClaudeCodeMCP(cwd);
1471
1470
  // Update .gitignore
1472
1471
  updateGitignore(cwd);
1473
1472
  // How to describe project
@@ -1659,7 +1658,7 @@ async function setupExistingProject(cwd, projectInfo, options = {}, auth) {
1659
1658
  // Setup IDEs and MCP
1660
1659
  console.log('');
1661
1660
  setupCursorIDE(cwd);
1662
- setupClaudeCodeMCP();
1661
+ setupClaudeCodeMCP(cwd);
1663
1662
  // Update .gitignore
1664
1663
  updateGitignore(cwd);
1665
1664
  // Confirm to server
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ const api_js_1 = require("./lib/api.js");
34
34
  // ============================================
35
35
  // Automatic Update Notification
36
36
  // ============================================
37
- const CURRENT_VERSION = '3.9.12';
37
+ const CURRENT_VERSION = '3.9.14';
38
38
  // Simple semver comparison: returns true if v1 > v2
39
39
  function isNewerVersion(v1, v2) {
40
40
  const parts1 = v1.split('.').map(Number);
@@ -210,7 +210,7 @@ const program = new commander_1.Command();
210
210
  program
211
211
  .name('codebakers')
212
212
  .description('CodeBakers CLI - Production patterns for AI-assisted development')
213
- .version('3.9.12');
213
+ .version('3.9.14');
214
214
  // Zero-friction trial entry (no signup required)
215
215
  program
216
216
  .command('go')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebakers/cli",
3
- "version": "3.9.12",
3
+ "version": "3.9.14",
4
4
  "description": "CodeBakers CLI - Production patterns for AI-assisted development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -659,27 +659,13 @@ function setupCursorIDE(cwd: string): void {
659
659
  }
660
660
  }
661
661
 
662
- function setupClaudeCodeMCP(): void {
662
+ function setupClaudeCodeMCP(cwd: string): void {
663
663
  const spinner = ora(' Setting up Claude Code MCP...').start();
664
664
 
665
665
  try {
666
- const homeDir = process.env.USERPROFILE || process.env.HOME || '';
667
- let configPath: string;
668
666
  const isWindows = process.platform === 'win32';
669
667
 
670
- if (isWindows) {
671
- configPath = join(homeDir, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
672
- } else if (process.platform === 'darwin') {
673
- configPath = join(homeDir, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
674
- } else {
675
- configPath = join(homeDir, '.config', 'claude', 'claude_desktop_config.json');
676
- }
677
-
678
- const configDir = join(configPath, '..');
679
- if (!existsSync(configDir)) {
680
- mkdirSync(configDir, { recursive: true });
681
- }
682
-
668
+ // Create project-level .mcp.json (Claude Code reads this automatically)
683
669
  const mcpConfig = {
684
670
  mcpServers: {
685
671
  codebakers: isWindows
@@ -688,22 +674,24 @@ function setupClaudeCodeMCP(): void {
688
674
  }
689
675
  };
690
676
 
691
- if (existsSync(configPath)) {
677
+ const mcpJsonPath = join(cwd, '.mcp.json');
678
+
679
+ if (existsSync(mcpJsonPath)) {
692
680
  try {
693
- const existing = JSON.parse(readFileSync(configPath, 'utf-8'));
681
+ const existing = JSON.parse(readFileSync(mcpJsonPath, 'utf-8'));
694
682
  if (!existing.mcpServers) {
695
683
  existing.mcpServers = {};
696
684
  }
697
685
  existing.mcpServers.codebakers = mcpConfig.mcpServers.codebakers;
698
- writeFileSync(configPath, JSON.stringify(existing, null, 2));
686
+ writeFileSync(mcpJsonPath, JSON.stringify(existing, null, 2));
699
687
  } catch {
700
- writeFileSync(configPath, JSON.stringify(mcpConfig, null, 2));
688
+ writeFileSync(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
701
689
  }
702
690
  } else {
703
- writeFileSync(configPath, JSON.stringify(mcpConfig, null, 2));
691
+ writeFileSync(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
704
692
  }
705
693
 
706
- spinner.succeed('Claude Code MCP configured!');
694
+ spinner.succeed('Claude Code MCP configured (.mcp.json created)');
707
695
  } catch {
708
696
  spinner.warn('Could not configure Claude Code MCP (continuing anyway)');
709
697
  }
@@ -1163,6 +1151,20 @@ export async function go(options: GoOptions = {}): Promise<void> {
1163
1151
  // Project already has CodeBakers - show context and resume
1164
1152
  showResumeContext(projectState);
1165
1153
 
1154
+ // CRITICAL: Ensure .mcp.json exists for Claude Code MCP tools
1155
+ // This fixes the issue where existing projects set up before v3.9.14
1156
+ // never got .mcp.json created (it was only created in first-time setup)
1157
+ const mcpJsonPath = join(cwd, '.mcp.json');
1158
+ if (!existsSync(mcpJsonPath)) {
1159
+ console.log(chalk.yellow(' ⚠️ MCP config missing - creating .mcp.json...\n'));
1160
+ setupClaudeCodeMCP(cwd);
1161
+ console.log(chalk.yellow(' ⚠️ RELOAD REQUIRED to load MCP tools\n'));
1162
+ console.log(chalk.white(' Claude Code needs to reload to detect the new .mcp.json file.\n'));
1163
+ console.log(chalk.cyan(' To reload:\n'));
1164
+ console.log(chalk.gray(' VS Code: ') + chalk.white('Press ') + chalk.cyan('Cmd/Ctrl+Shift+P') + chalk.white(' → type ') + chalk.cyan('"Reload Window"'));
1165
+ console.log(chalk.gray(' CLI: ') + chalk.white('Press ') + chalk.cyan('Ctrl+C') + chalk.white(' and run ') + chalk.cyan('claude') + chalk.white(' again\n'));
1166
+ }
1167
+
1166
1168
  // Verify auth is still valid
1167
1169
  const existingApiKey = getApiKey();
1168
1170
  const existingTrial = getTrialState();
@@ -1210,16 +1212,15 @@ export async function go(options: GoOptions = {}): Promise<void> {
1210
1212
  console.log(chalk.white(' What was set up:'));
1211
1213
  console.log(chalk.gray(' • CLAUDE.md - AI instructions for this project'));
1212
1214
  console.log(chalk.gray(' • .codebakers.json - Project configuration'));
1213
- console.log(chalk.gray(' • MCP server - Registered in Claude Code config\n'));
1214
-
1215
- console.log(chalk.yellow(' ⚠️ RESTART REQUIRED to load MCP tools\n'));
1216
- console.log(chalk.white(' The CodeBakers MCP server was registered, but Claude Code'));
1217
- console.log(chalk.white(' needs to restart to load it.\n'));
1218
- console.log(chalk.cyan(' To restart Claude Code:\n'));
1219
- console.log(chalk.gray(' Option 1: ') + chalk.white('Press ') + chalk.cyan('Ctrl+C') + chalk.white(' and run ') + chalk.cyan('claude') + chalk.white(' again'));
1220
- console.log(chalk.gray(' Option 2: ') + chalk.white('In VS Code: ') + chalk.cyan('Cmd/Ctrl+Shift+P') + chalk.white(' → "Reload Window"\n'));
1221
- console.log(chalk.white(' After restart, MCP tools (discover_patterns, validate_complete)'));
1222
- console.log(chalk.white(' will be available.\n'));
1215
+ console.log(chalk.gray(' • .mcp.json - MCP server configuration for Claude Code\n'));
1216
+
1217
+ console.log(chalk.yellow(' ⚠️ RELOAD REQUIRED to load MCP tools\n'));
1218
+ console.log(chalk.white(' Claude Code needs to reload to detect the new .mcp.json file.\n'));
1219
+ console.log(chalk.cyan(' To reload:\n'));
1220
+ console.log(chalk.gray(' VS Code: ') + chalk.white('Press ') + chalk.cyan('Cmd/Ctrl+Shift+P') + chalk.white(' → type ') + chalk.cyan('"Reload Window"'));
1221
+ console.log(chalk.gray(' CLI: ') + chalk.white('Press ') + chalk.cyan('Ctrl+C') + chalk.white(' and run ') + chalk.cyan('claude') + chalk.white(' again\n'));
1222
+ console.log(chalk.white(' After reload, MCP tools (discover_patterns, validate_complete)'));
1223
+ console.log(chalk.white(' will be available automatically.\n'));
1223
1224
  console.log(chalk.gray(' ─────────────────────────────────────────────────────────\n'));
1224
1225
  console.log(chalk.gray(' Optional: To activate trial, run ') + chalk.cyan('codebakers go') + chalk.gray(' in a terminal.\n'));
1225
1226
  return;
@@ -1656,7 +1657,7 @@ async function setupNewProject(cwd: string, options: GoOptions = {}, auth?: Auth
1656
1657
  // Setup IDEs and MCP
1657
1658
  console.log('');
1658
1659
  setupCursorIDE(cwd);
1659
- setupClaudeCodeMCP();
1660
+ setupClaudeCodeMCP(cwd);
1660
1661
 
1661
1662
  // Update .gitignore
1662
1663
  updateGitignore(cwd);
@@ -1860,7 +1861,7 @@ async function setupExistingProject(cwd: string, projectInfo: ProjectInfo, optio
1860
1861
  // Setup IDEs and MCP
1861
1862
  console.log('');
1862
1863
  setupCursorIDE(cwd);
1863
- setupClaudeCodeMCP();
1864
+ setupClaudeCodeMCP(cwd);
1864
1865
 
1865
1866
  // Update .gitignore
1866
1867
  updateGitignore(cwd);
package/src/index.ts CHANGED
@@ -34,7 +34,7 @@ import { join } from 'path';
34
34
  // Automatic Update Notification
35
35
  // ============================================
36
36
 
37
- const CURRENT_VERSION = '3.9.12';
37
+ const CURRENT_VERSION = '3.9.14';
38
38
 
39
39
  // Simple semver comparison: returns true if v1 > v2
40
40
  function isNewerVersion(v1: string, v2: string): boolean {
@@ -230,7 +230,7 @@ const program = new Command();
230
230
  program
231
231
  .name('codebakers')
232
232
  .description('CodeBakers CLI - Production patterns for AI-assisted development')
233
- .version('3.9.12');
233
+ .version('3.9.14');
234
234
 
235
235
  // Zero-friction trial entry (no signup required)
236
236
  program