@codebakers/cli 3.3.5 → 3.3.6

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.
@@ -656,6 +656,34 @@ async function init() {
656
656
  (0, fs_1.writeFileSync)((0, path_1.join)(cwd, '.cursorrules'), CURSORRULES_TEMPLATE);
657
657
  // Write .cursorignore
658
658
  (0, fs_1.writeFileSync)((0, path_1.join)(cwd, '.cursorignore'), CURSORIGNORE_TEMPLATE);
659
+ // Create .cursor/mcp.json for MCP server configuration
660
+ const cursorDir = (0, path_1.join)(cwd, '.cursor');
661
+ if (!(0, fs_1.existsSync)(cursorDir)) {
662
+ (0, fs_1.mkdirSync)(cursorDir, { recursive: true });
663
+ }
664
+ const mcpConfigPath = (0, path_1.join)(cursorDir, 'mcp.json');
665
+ const isWindows = process.platform === 'win32';
666
+ const mcpConfig = {
667
+ mcpServers: {
668
+ codebakers: isWindows
669
+ ? { command: 'cmd', args: ['/c', 'npx', '-y', '@codebakers/cli', 'serve'] }
670
+ : { command: 'npx', args: ['-y', '@codebakers/cli', 'serve'] }
671
+ }
672
+ };
673
+ // Merge with existing MCP config if present
674
+ if ((0, fs_1.existsSync)(mcpConfigPath)) {
675
+ try {
676
+ const existing = JSON.parse((0, fs_1.readFileSync)(mcpConfigPath, 'utf-8'));
677
+ existing.mcpServers = { ...existing.mcpServers, ...mcpConfig.mcpServers };
678
+ (0, fs_1.writeFileSync)(mcpConfigPath, JSON.stringify(existing, null, 2));
679
+ }
680
+ catch {
681
+ (0, fs_1.writeFileSync)(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
682
+ }
683
+ }
684
+ else {
685
+ (0, fs_1.writeFileSync)(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
686
+ }
659
687
  // Create/merge .vscode/settings.json
660
688
  const vscodeDir = (0, path_1.join)(cwd, '.vscode');
661
689
  if (!(0, fs_1.existsSync)(vscodeDir)) {
@@ -671,6 +699,7 @@ async function init() {
671
699
  (0, fs_1.writeFileSync)(existingSettingsPath, JSON.stringify(VSCODE_SETTINGS_TEMPLATE, null, 2));
672
700
  }
673
701
  cursorSpinner.succeed('Cursor configuration installed!');
702
+ console.log(chalk_1.default.green(' ✓ MCP server configured (.cursor/mcp.json)'));
674
703
  }
675
704
  catch (error) {
676
705
  cursorSpinner.warn('Could not install Cursor files (continuing anyway)');
@@ -8,6 +8,8 @@ const chalk_1 = __importDefault(require("chalk"));
8
8
  const ora_1 = __importDefault(require("ora"));
9
9
  const readline_1 = require("readline");
10
10
  const child_process_1 = require("child_process");
11
+ const fs_1 = require("fs");
12
+ const path_1 = require("path");
11
13
  const config_js_1 = require("../config.js");
12
14
  const api_js_1 = require("../lib/api.js");
13
15
  const progress_js_1 = require("../lib/progress.js");
@@ -127,47 +129,78 @@ async function setup() {
127
129
  }
128
130
  function showFinalInstructions() {
129
131
  const isWindows = process.platform === 'win32';
132
+ const cwd = process.cwd();
130
133
  console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════'));
131
- console.log(chalk_1.default.white.bold('\n STEP 3: Connecting CodeBakers to Claude...\n'));
134
+ console.log(chalk_1.default.white.bold('\n STEP 3: Connecting CodeBakers to your IDE...\n'));
132
135
  console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════\n'));
133
- // Auto-install MCP server
136
+ // Install MCP for Claude Code CLI
134
137
  const mcpCmd = isWindows
135
138
  ? 'claude mcp add --transport stdio codebakers -- cmd /c npx -y @codebakers/cli serve'
136
139
  : 'claude mcp add --transport stdio codebakers -- npx -y @codebakers/cli serve';
140
+ let claudeCodeInstalled = false;
137
141
  try {
138
142
  (0, child_process_1.execSync)(mcpCmd, { stdio: 'pipe' });
139
- console.log(chalk_1.default.green(' ✅ CodeBakers MCP server installed!\n'));
143
+ console.log(chalk_1.default.green(' ✅ Claude Code MCP server installed!\n'));
144
+ claudeCodeInstalled = true;
140
145
  }
141
146
  catch (error) {
142
- // Check if it's already installed (command might fail if already exists)
143
147
  const errorMessage = error instanceof Error ? error.message : String(error);
144
148
  if (errorMessage.includes('already exists') || errorMessage.includes('already registered')) {
145
- console.log(chalk_1.default.green(' ✅ CodeBakers MCP server already installed!\n'));
149
+ console.log(chalk_1.default.green(' ✅ Claude Code MCP server already installed!\n'));
150
+ claudeCodeInstalled = true;
146
151
  }
147
152
  else {
148
- console.log(chalk_1.default.yellow(' ⚠️ Could not auto-install MCP server.\n'));
149
- console.log(chalk_1.default.white(' Run this command manually in your terminal:\n'));
150
- console.log(chalk_1.default.bgBlue.white('\n ' + mcpCmd + ' \n'));
151
- console.log(chalk_1.default.yellow('\n ⚠️ Then close this terminal and open a new one in your project.\n'));
152
- return;
153
+ console.log(chalk_1.default.yellow(' ⚠️ Claude Code not detected (that\'s OK if using Cursor)\n'));
153
154
  }
154
155
  }
156
+ // Install MCP for Cursor IDE (create .cursor/mcp.json)
157
+ const cursorDir = (0, path_1.join)(cwd, '.cursor');
158
+ const mcpConfigPath = (0, path_1.join)(cursorDir, 'mcp.json');
159
+ const mcpConfig = {
160
+ mcpServers: {
161
+ codebakers: isWindows
162
+ ? { command: 'cmd', args: ['/c', 'npx', '-y', '@codebakers/cli', 'serve'] }
163
+ : { command: 'npx', args: ['-y', '@codebakers/cli', 'serve'] }
164
+ }
165
+ };
166
+ try {
167
+ if (!(0, fs_1.existsSync)(cursorDir)) {
168
+ (0, fs_1.mkdirSync)(cursorDir, { recursive: true });
169
+ }
170
+ // Merge with existing MCP config if present
171
+ if ((0, fs_1.existsSync)(mcpConfigPath)) {
172
+ const existing = JSON.parse((0, fs_1.readFileSync)(mcpConfigPath, 'utf-8'));
173
+ existing.mcpServers = { ...existing.mcpServers, ...mcpConfig.mcpServers };
174
+ (0, fs_1.writeFileSync)(mcpConfigPath, JSON.stringify(existing, null, 2));
175
+ }
176
+ else {
177
+ (0, fs_1.writeFileSync)(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
178
+ }
179
+ console.log(chalk_1.default.green(' ✅ Cursor MCP server configured! (.cursor/mcp.json)\n'));
180
+ }
181
+ catch (error) {
182
+ console.log(chalk_1.default.yellow(' ⚠️ Could not create Cursor MCP config\n'));
183
+ }
155
184
  console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════'));
156
185
  console.log(chalk_1.default.white.bold('\n 🎉 Setup Complete!\n'));
157
186
  console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════\n'));
158
- console.log(chalk_1.default.yellow.bold(' ⚠️ RESTART REQUIRED - Follow these steps:\n'));
159
- console.log(chalk_1.default.white(' For Claude Code:\n'));
160
- console.log(chalk_1.default.gray(' 1. Close this terminal completely (type ') + chalk_1.default.cyan('exit') + chalk_1.default.gray(')'));
161
- console.log(chalk_1.default.gray(' 2. Open a NEW terminal window'));
162
- console.log(chalk_1.default.gray(' 3. Navigate to your project folder'));
163
- console.log(chalk_1.default.gray(' 4. Run ') + chalk_1.default.cyan('claude') + chalk_1.default.gray(' to start Claude Code\n'));
187
+ console.log(chalk_1.default.yellow.bold(' ⚠️ RESTART REQUIRED:\n'));
164
188
  console.log(chalk_1.default.white(' For Cursor:\n'));
165
189
  console.log(chalk_1.default.gray(' 1. Close Cursor completely (Cmd+Q / Alt+F4)'));
166
190
  console.log(chalk_1.default.gray(' 2. Reopen Cursor'));
167
191
  console.log(chalk_1.default.gray(' 3. Open Composer (Cmd+I / Ctrl+I)\n'));
192
+ if (claudeCodeInstalled) {
193
+ console.log(chalk_1.default.white(' For Claude Code:\n'));
194
+ console.log(chalk_1.default.gray(' 1. Close this terminal completely (type ') + chalk_1.default.cyan('exit') + chalk_1.default.gray(')'));
195
+ console.log(chalk_1.default.gray(' 2. Open a NEW terminal window'));
196
+ console.log(chalk_1.default.gray(' 3. Navigate to your project folder'));
197
+ console.log(chalk_1.default.gray(' 4. Run ') + chalk_1.default.cyan('claude') + chalk_1.default.gray(' to start Claude Code\n'));
198
+ }
168
199
  console.log(chalk_1.default.blue(' ──────────────────────────────────────────────────────────\n'));
169
- console.log(chalk_1.default.white(' To verify CodeBakers is working, ask the AI:\n'));
170
- console.log(chalk_1.default.green(' "Are you using CodeBakers?"\n'));
171
- console.log(chalk_1.default.gray(' The AI should respond with its CodeBakers status.'));
200
+ console.log(chalk_1.default.white(' Next step: Initialize patterns in your project:\n'));
201
+ console.log(chalk_1.default.cyan(' codebakers init\n'));
202
+ console.log(chalk_1.default.white(' To verify CodeBakers is working, ask the AI:\n'));
203
+ console.log(chalk_1.default.green(' "update codebakers patterns"\n'));
204
+ console.log(chalk_1.default.gray(' The AI should call the update_patterns MCP tool.'));
172
205
  console.log(chalk_1.default.gray(' Need help? https://codebakers.ai/docs\n'));
173
206
  }
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ const path_1 = require("path");
34
34
  // ============================================
35
35
  // Automatic Update Notification
36
36
  // ============================================
37
- const CURRENT_VERSION = '3.3.5';
37
+ const CURRENT_VERSION = '3.3.6';
38
38
  async function checkForUpdatesInBackground() {
39
39
  // Check if we have a valid cached result first (fast path)
40
40
  const cached = (0, config_js_2.getCachedUpdateInfo)();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebakers/cli",
3
- "version": "3.3.5",
3
+ "version": "3.3.6",
4
4
  "description": "CodeBakers CLI - Production patterns for AI-assisted development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -700,6 +700,35 @@ export async function init(): Promise<void> {
700
700
  // Write .cursorignore
701
701
  writeFileSync(join(cwd, '.cursorignore'), CURSORIGNORE_TEMPLATE);
702
702
 
703
+ // Create .cursor/mcp.json for MCP server configuration
704
+ const cursorDir = join(cwd, '.cursor');
705
+ if (!existsSync(cursorDir)) {
706
+ mkdirSync(cursorDir, { recursive: true });
707
+ }
708
+
709
+ const mcpConfigPath = join(cursorDir, 'mcp.json');
710
+ const isWindows = process.platform === 'win32';
711
+ const mcpConfig = {
712
+ mcpServers: {
713
+ codebakers: isWindows
714
+ ? { command: 'cmd', args: ['/c', 'npx', '-y', '@codebakers/cli', 'serve'] }
715
+ : { command: 'npx', args: ['-y', '@codebakers/cli', 'serve'] }
716
+ }
717
+ };
718
+
719
+ // Merge with existing MCP config if present
720
+ if (existsSync(mcpConfigPath)) {
721
+ try {
722
+ const existing = JSON.parse(readFileSync(mcpConfigPath, 'utf-8'));
723
+ existing.mcpServers = { ...existing.mcpServers, ...mcpConfig.mcpServers };
724
+ writeFileSync(mcpConfigPath, JSON.stringify(existing, null, 2));
725
+ } catch {
726
+ writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
727
+ }
728
+ } else {
729
+ writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
730
+ }
731
+
703
732
  // Create/merge .vscode/settings.json
704
733
  const vscodeDir = join(cwd, '.vscode');
705
734
  if (!existsSync(vscodeDir)) {
@@ -717,6 +746,7 @@ export async function init(): Promise<void> {
717
746
  }
718
747
 
719
748
  cursorSpinner.succeed('Cursor configuration installed!');
749
+ console.log(chalk.green(' ✓ MCP server configured (.cursor/mcp.json)'));
720
750
  } catch (error) {
721
751
  cursorSpinner.warn('Could not install Cursor files (continuing anyway)');
722
752
  }
@@ -2,6 +2,8 @@ import chalk from 'chalk';
2
2
  import ora from 'ora';
3
3
  import { createInterface } from 'readline';
4
4
  import { execSync } from 'child_process';
5
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
6
+ import { join } from 'path';
5
7
  import { setApiKey, getApiKey, getApiUrl, syncServiceKeys, SERVICE_KEY_LABELS, type ServiceName } from '../config.js';
6
8
  import { validateApiKey, formatApiError, checkForUpdates, getCliVersion, type ApiError } from '../lib/api.js';
7
9
  import { showQuickStartGuide, formatFriendlyError, getNetworkError, getAuthError } from '../lib/progress.js';
@@ -136,55 +138,88 @@ export async function setup(): Promise<void> {
136
138
 
137
139
  function showFinalInstructions(): void {
138
140
  const isWindows = process.platform === 'win32';
141
+ const cwd = process.cwd();
139
142
 
140
143
  console.log(chalk.blue(' ══════════════════════════════════════════════════════════'));
141
- console.log(chalk.white.bold('\n STEP 3: Connecting CodeBakers to Claude...\n'));
144
+ console.log(chalk.white.bold('\n STEP 3: Connecting CodeBakers to your IDE...\n'));
142
145
  console.log(chalk.blue(' ══════════════════════════════════════════════════════════\n'));
143
146
 
144
- // Auto-install MCP server
147
+ // Install MCP for Claude Code CLI
145
148
  const mcpCmd = isWindows
146
149
  ? 'claude mcp add --transport stdio codebakers -- cmd /c npx -y @codebakers/cli serve'
147
150
  : 'claude mcp add --transport stdio codebakers -- npx -y @codebakers/cli serve';
148
151
 
152
+ let claudeCodeInstalled = false;
149
153
  try {
150
154
  execSync(mcpCmd, { stdio: 'pipe' });
151
- console.log(chalk.green(' ✅ CodeBakers MCP server installed!\n'));
155
+ console.log(chalk.green(' ✅ Claude Code MCP server installed!\n'));
156
+ claudeCodeInstalled = true;
152
157
  } catch (error) {
153
- // Check if it's already installed (command might fail if already exists)
154
158
  const errorMessage = error instanceof Error ? error.message : String(error);
155
159
  if (errorMessage.includes('already exists') || errorMessage.includes('already registered')) {
156
- console.log(chalk.green(' ✅ CodeBakers MCP server already installed!\n'));
160
+ console.log(chalk.green(' ✅ Claude Code MCP server already installed!\n'));
161
+ claudeCodeInstalled = true;
157
162
  } else {
158
- console.log(chalk.yellow(' ⚠️ Could not auto-install MCP server.\n'));
159
- console.log(chalk.white(' Run this command manually in your terminal:\n'));
160
- console.log(chalk.bgBlue.white('\n ' + mcpCmd + ' \n'));
161
- console.log(chalk.yellow('\n ⚠️ Then close this terminal and open a new one in your project.\n'));
162
- return;
163
+ console.log(chalk.yellow(' ⚠️ Claude Code not detected (that\'s OK if using Cursor)\n'));
163
164
  }
164
165
  }
165
166
 
167
+ // Install MCP for Cursor IDE (create .cursor/mcp.json)
168
+ const cursorDir = join(cwd, '.cursor');
169
+ const mcpConfigPath = join(cursorDir, 'mcp.json');
170
+ const mcpConfig = {
171
+ mcpServers: {
172
+ codebakers: isWindows
173
+ ? { command: 'cmd', args: ['/c', 'npx', '-y', '@codebakers/cli', 'serve'] }
174
+ : { command: 'npx', args: ['-y', '@codebakers/cli', 'serve'] }
175
+ }
176
+ };
177
+
178
+ try {
179
+ if (!existsSync(cursorDir)) {
180
+ mkdirSync(cursorDir, { recursive: true });
181
+ }
182
+
183
+ // Merge with existing MCP config if present
184
+ if (existsSync(mcpConfigPath)) {
185
+ const existing = JSON.parse(readFileSync(mcpConfigPath, 'utf-8'));
186
+ existing.mcpServers = { ...existing.mcpServers, ...mcpConfig.mcpServers };
187
+ writeFileSync(mcpConfigPath, JSON.stringify(existing, null, 2));
188
+ } else {
189
+ writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
190
+ }
191
+ console.log(chalk.green(' ✅ Cursor MCP server configured! (.cursor/mcp.json)\n'));
192
+ } catch (error) {
193
+ console.log(chalk.yellow(' ⚠️ Could not create Cursor MCP config\n'));
194
+ }
195
+
166
196
  console.log(chalk.blue(' ══════════════════════════════════════════════════════════'));
167
197
  console.log(chalk.white.bold('\n 🎉 Setup Complete!\n'));
168
198
  console.log(chalk.blue(' ══════════════════════════════════════════════════════════\n'));
169
199
 
170
- console.log(chalk.yellow.bold(' ⚠️ RESTART REQUIRED - Follow these steps:\n'));
171
-
172
- console.log(chalk.white(' For Claude Code:\n'));
173
- console.log(chalk.gray(' 1. Close this terminal completely (type ') + chalk.cyan('exit') + chalk.gray(')'));
174
- console.log(chalk.gray(' 2. Open a NEW terminal window'));
175
- console.log(chalk.gray(' 3. Navigate to your project folder'));
176
- console.log(chalk.gray(' 4. Run ') + chalk.cyan('claude') + chalk.gray(' to start Claude Code\n'));
200
+ console.log(chalk.yellow.bold(' ⚠️ RESTART REQUIRED:\n'));
177
201
 
178
202
  console.log(chalk.white(' For Cursor:\n'));
179
203
  console.log(chalk.gray(' 1. Close Cursor completely (Cmd+Q / Alt+F4)'));
180
204
  console.log(chalk.gray(' 2. Reopen Cursor'));
181
205
  console.log(chalk.gray(' 3. Open Composer (Cmd+I / Ctrl+I)\n'));
182
206
 
207
+ if (claudeCodeInstalled) {
208
+ console.log(chalk.white(' For Claude Code:\n'));
209
+ console.log(chalk.gray(' 1. Close this terminal completely (type ') + chalk.cyan('exit') + chalk.gray(')'));
210
+ console.log(chalk.gray(' 2. Open a NEW terminal window'));
211
+ console.log(chalk.gray(' 3. Navigate to your project folder'));
212
+ console.log(chalk.gray(' 4. Run ') + chalk.cyan('claude') + chalk.gray(' to start Claude Code\n'));
213
+ }
214
+
183
215
  console.log(chalk.blue(' ──────────────────────────────────────────────────────────\n'));
184
216
 
185
- console.log(chalk.white(' To verify CodeBakers is working, ask the AI:\n'));
186
- console.log(chalk.green(' "Are you using CodeBakers?"\n'));
217
+ console.log(chalk.white(' Next step: Initialize patterns in your project:\n'));
218
+ console.log(chalk.cyan(' codebakers init\n'));
219
+
220
+ console.log(chalk.white(' To verify CodeBakers is working, ask the AI:\n'));
221
+ console.log(chalk.green(' "update codebakers patterns"\n'));
187
222
 
188
- console.log(chalk.gray(' The AI should respond with its CodeBakers status.'));
223
+ console.log(chalk.gray(' The AI should call the update_patterns MCP tool.'));
189
224
  console.log(chalk.gray(' Need help? https://codebakers.ai/docs\n'));
190
225
  }
package/src/index.ts CHANGED
@@ -32,7 +32,7 @@ import { join } from 'path';
32
32
  // Automatic Update Notification
33
33
  // ============================================
34
34
 
35
- const CURRENT_VERSION = '3.3.5';
35
+ const CURRENT_VERSION = '3.3.6';
36
36
 
37
37
  async function checkForUpdatesInBackground(): Promise<void> {
38
38
  // Check if we have a valid cached result first (fast path)