@codebakers/cli 3.8.5 → 3.8.7

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.
@@ -739,6 +739,60 @@ function setupCursorIDE(cwd: string): void {
739
739
  }
740
740
  }
741
741
 
742
+ function setupClaudeCode(): void {
743
+ const spinner = ora(' Setting up Claude Code MCP...').start();
744
+
745
+ try {
746
+ const homeDir = process.env.USERPROFILE || process.env.HOME || '';
747
+ let configPath: string;
748
+ const isWindows = process.platform === 'win32';
749
+
750
+ // Determine config path based on platform
751
+ if (isWindows) {
752
+ configPath = join(homeDir, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
753
+ } else if (process.platform === 'darwin') {
754
+ configPath = join(homeDir, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
755
+ } else {
756
+ configPath = join(homeDir, '.config', 'claude', 'claude_desktop_config.json');
757
+ }
758
+
759
+ // Ensure directory exists
760
+ const configDir = join(configPath, '..');
761
+ if (!existsSync(configDir)) {
762
+ mkdirSync(configDir, { recursive: true });
763
+ }
764
+
765
+ // MCP config for Claude Code
766
+ const mcpConfig = {
767
+ mcpServers: {
768
+ codebakers: isWindows
769
+ ? { command: 'cmd', args: ['/c', 'npx', '-y', '@codebakers/cli', 'serve'] }
770
+ : { command: 'npx', args: ['-y', '@codebakers/cli', 'serve'] }
771
+ }
772
+ };
773
+
774
+ // Read existing or create new
775
+ if (existsSync(configPath)) {
776
+ try {
777
+ const existing = JSON.parse(readFileSync(configPath, 'utf-8'));
778
+ if (!existing.mcpServers) {
779
+ existing.mcpServers = {};
780
+ }
781
+ existing.mcpServers.codebakers = mcpConfig.mcpServers.codebakers;
782
+ writeFileSync(configPath, JSON.stringify(existing, null, 2));
783
+ } catch {
784
+ writeFileSync(configPath, JSON.stringify(mcpConfig, null, 2));
785
+ }
786
+ } else {
787
+ writeFileSync(configPath, JSON.stringify(mcpConfig, null, 2));
788
+ }
789
+
790
+ spinner.succeed('Claude Code MCP configured!');
791
+ } catch {
792
+ spinner.warn('Could not configure Claude Code MCP (continuing anyway)');
793
+ }
794
+ }
795
+
742
796
  function updateGitignore(cwd: string): void {
743
797
  const gitignorePath = join(cwd, '.gitignore');
744
798
  if (existsSync(gitignorePath)) {
@@ -827,9 +881,10 @@ async function initNewProject(cwd: string): Promise<void> {
827
881
  const structure = buildStructureString(cwd);
828
882
  createTrackingFiles(cwd, projectName, {}, structure, false);
829
883
 
830
- // Setup Cursor
884
+ // Setup IDEs and MCP
831
885
  console.log('');
832
886
  setupCursorIDE(cwd);
887
+ setupClaudeCode();
833
888
 
834
889
  // Update .gitignore
835
890
  updateGitignore(cwd);
@@ -990,9 +1045,10 @@ async function initExistingProject(cwd: string, projectInfo: ReturnType<typeof d
990
1045
  const structure = buildStructureString(cwd);
991
1046
  createTrackingFiles(cwd, projectName, projectInfo.stack, structure, true, auditScore);
992
1047
 
993
- // Setup Cursor
1048
+ // Setup IDEs and MCP
994
1049
  console.log('');
995
1050
  setupCursorIDE(cwd);
1051
+ setupClaudeCode();
996
1052
 
997
1053
  // Update .gitignore
998
1054
  updateGitignore(cwd);