@teambit/cli-mcp-server 0.0.43 → 0.0.45
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/cli-mcp-server.main.runtime.d.ts +1 -1
- package/dist/cli-mcp-server.main.runtime.js +12 -59
- package/dist/cli-mcp-server.main.runtime.js.map +1 -1
- package/dist/{preview-1752588566113.js → preview-1752761705188.js} +1 -1
- package/package.json +8 -7
- package/bit-rules-consumer-template.md +0 -11
- package/bit-rules-template.md +0 -115
- package/dist/bit-rules-consumer-template.md +0 -11
- package/dist/bit-rules-template.md +0 -115
- package/dist/setup-utils.d.ts +0 -122
- package/dist/setup-utils.js +0 -613
- package/dist/setup-utils.js.map +0 -1
package/dist/setup-utils.js
DELETED
|
@@ -1,613 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.McpSetupUtils = void 0;
|
|
7
|
-
function _fsExtra() {
|
|
8
|
-
const data = _interopRequireDefault(require("fs-extra"));
|
|
9
|
-
_fsExtra = function () {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _path() {
|
|
15
|
-
const data = _interopRequireDefault(require("path"));
|
|
16
|
-
_path = function () {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
function _os() {
|
|
22
|
-
const data = require("os");
|
|
23
|
-
_os = function () {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
|
-
/**
|
|
30
|
-
* Options for setting up MCP server configuration
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Options for writing rules/instructions files
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Utility class for setting up MCP server configurations across different editors
|
|
39
|
-
*/
|
|
40
|
-
class McpSetupUtils {
|
|
41
|
-
/**
|
|
42
|
-
* Build MCP server arguments based on provided options
|
|
43
|
-
*/
|
|
44
|
-
static buildMcpServerArgs(options) {
|
|
45
|
-
const {
|
|
46
|
-
consumerProject,
|
|
47
|
-
includeAdditional
|
|
48
|
-
} = options;
|
|
49
|
-
const args = ['mcp-server', 'start'];
|
|
50
|
-
if (consumerProject) {
|
|
51
|
-
args.push('--consumer-project');
|
|
52
|
-
}
|
|
53
|
-
if (includeAdditional) {
|
|
54
|
-
args.push('--include-additional', includeAdditional);
|
|
55
|
-
}
|
|
56
|
-
return args;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Read and parse a JSON file, returning empty object if file doesn't exist
|
|
61
|
-
*/
|
|
62
|
-
static async readJsonFile(filePath) {
|
|
63
|
-
if (!(await _fsExtra().default.pathExists(filePath))) {
|
|
64
|
-
return {};
|
|
65
|
-
}
|
|
66
|
-
try {
|
|
67
|
-
const content = await _fsExtra().default.readFile(filePath, 'utf8');
|
|
68
|
-
return JSON.parse(content);
|
|
69
|
-
} catch (error) {
|
|
70
|
-
throw new Error(`Failed to parse ${_path().default.basename(filePath)}: ${error.message}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Get display name for an editor
|
|
76
|
-
*/
|
|
77
|
-
static getEditorDisplayName(editor) {
|
|
78
|
-
switch (editor) {
|
|
79
|
-
case 'vscode':
|
|
80
|
-
return 'VS Code';
|
|
81
|
-
case 'cursor':
|
|
82
|
-
return 'Cursor';
|
|
83
|
-
case 'windsurf':
|
|
84
|
-
return 'Windsurf';
|
|
85
|
-
case 'roo':
|
|
86
|
-
return 'Roo Code';
|
|
87
|
-
case 'cline':
|
|
88
|
-
return 'Cline';
|
|
89
|
-
case 'claude-code':
|
|
90
|
-
return 'Claude Code';
|
|
91
|
-
default:
|
|
92
|
-
return editor;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Get VS Code settings.json path based on global/workspace scope
|
|
98
|
-
*/
|
|
99
|
-
static getVSCodeSettingsPath(isGlobal, workspaceDir) {
|
|
100
|
-
if (isGlobal) {
|
|
101
|
-
// Global VS Code settings
|
|
102
|
-
const platform = process.platform;
|
|
103
|
-
switch (platform) {
|
|
104
|
-
case 'win32':
|
|
105
|
-
return _path().default.join((0, _os().homedir)(), 'AppData', 'Roaming', 'Code', 'User', 'settings.json');
|
|
106
|
-
case 'darwin':
|
|
107
|
-
return _path().default.join((0, _os().homedir)(), 'Library', 'Application Support', 'Code', 'User', 'settings.json');
|
|
108
|
-
case 'linux':
|
|
109
|
-
return _path().default.join((0, _os().homedir)(), '.config', 'Code', 'User', 'settings.json');
|
|
110
|
-
default:
|
|
111
|
-
throw new Error(`Unsupported platform: ${platform}`);
|
|
112
|
-
}
|
|
113
|
-
} else {
|
|
114
|
-
// Workspace-specific settings
|
|
115
|
-
const targetDir = workspaceDir || process.cwd();
|
|
116
|
-
return _path().default.join(targetDir, '.vscode', 'settings.json');
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Get VS Code mcp.json path for workspace configuration
|
|
122
|
-
*/
|
|
123
|
-
static getVSCodeMcpConfigPath(workspaceDir) {
|
|
124
|
-
const targetDir = workspaceDir || process.cwd();
|
|
125
|
-
return _path().default.join(targetDir, '.vscode', 'mcp.json');
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Setup VS Code MCP integration
|
|
130
|
-
*/
|
|
131
|
-
static async setupVSCode(options) {
|
|
132
|
-
const {
|
|
133
|
-
isGlobal,
|
|
134
|
-
workspaceDir
|
|
135
|
-
} = options;
|
|
136
|
-
if (isGlobal) {
|
|
137
|
-
// For global configuration, use settings.json with mcp.servers structure
|
|
138
|
-
const settingsPath = this.getVSCodeSettingsPath(isGlobal, workspaceDir);
|
|
139
|
-
|
|
140
|
-
// Ensure directory exists
|
|
141
|
-
await _fsExtra().default.ensureDir(_path().default.dirname(settingsPath));
|
|
142
|
-
|
|
143
|
-
// Read existing settings or create empty object
|
|
144
|
-
const settings = await this.readJsonFile(settingsPath);
|
|
145
|
-
|
|
146
|
-
// Build MCP server args
|
|
147
|
-
const args = this.buildMcpServerArgs(options);
|
|
148
|
-
|
|
149
|
-
// Create or update MCP configuration
|
|
150
|
-
if (!settings.mcp) {
|
|
151
|
-
settings.mcp = {};
|
|
152
|
-
}
|
|
153
|
-
if (!settings.mcp.servers) {
|
|
154
|
-
settings.mcp.servers = {};
|
|
155
|
-
}
|
|
156
|
-
settings.mcp.servers['bit-cli'] = {
|
|
157
|
-
type: 'stdio',
|
|
158
|
-
command: 'bit',
|
|
159
|
-
args: args
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// Write updated settings
|
|
163
|
-
await _fsExtra().default.writeFile(settingsPath, JSON.stringify(settings, null, 2));
|
|
164
|
-
} else {
|
|
165
|
-
// For workspace configuration, use .vscode/mcp.json with direct servers structure
|
|
166
|
-
const mcpConfigPath = this.getVSCodeMcpConfigPath(workspaceDir);
|
|
167
|
-
|
|
168
|
-
// Ensure directory exists
|
|
169
|
-
await _fsExtra().default.ensureDir(_path().default.dirname(mcpConfigPath));
|
|
170
|
-
|
|
171
|
-
// Read existing MCP configuration or create empty object
|
|
172
|
-
const mcpConfig = await this.readJsonFile(mcpConfigPath);
|
|
173
|
-
|
|
174
|
-
// Build MCP server args
|
|
175
|
-
const args = this.buildMcpServerArgs(options);
|
|
176
|
-
|
|
177
|
-
// Create or update MCP configuration
|
|
178
|
-
if (!mcpConfig.servers) {
|
|
179
|
-
mcpConfig.servers = {};
|
|
180
|
-
}
|
|
181
|
-
mcpConfig.servers['bit-cli'] = {
|
|
182
|
-
type: 'stdio',
|
|
183
|
-
command: 'bit',
|
|
184
|
-
args: args
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
// Write updated MCP configuration
|
|
188
|
-
await _fsExtra().default.writeFile(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Get Cursor mcp.json path based on global/workspace scope
|
|
194
|
-
*/
|
|
195
|
-
static getCursorSettingsPath(isGlobal, workspaceDir) {
|
|
196
|
-
if (isGlobal) {
|
|
197
|
-
// Global Cursor MCP configuration
|
|
198
|
-
return _path().default.join((0, _os().homedir)(), '.cursor', 'mcp.json');
|
|
199
|
-
} else {
|
|
200
|
-
// Workspace-specific MCP configuration
|
|
201
|
-
const targetDir = workspaceDir || process.cwd();
|
|
202
|
-
return _path().default.join(targetDir, '.cursor', 'mcp.json');
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Setup Cursor MCP integration
|
|
208
|
-
*/
|
|
209
|
-
static async setupCursor(options) {
|
|
210
|
-
const {
|
|
211
|
-
isGlobal,
|
|
212
|
-
workspaceDir
|
|
213
|
-
} = options;
|
|
214
|
-
|
|
215
|
-
// Determine mcp.json path
|
|
216
|
-
const mcpConfigPath = this.getCursorSettingsPath(isGlobal, workspaceDir);
|
|
217
|
-
|
|
218
|
-
// Ensure directory exists
|
|
219
|
-
await _fsExtra().default.ensureDir(_path().default.dirname(mcpConfigPath));
|
|
220
|
-
|
|
221
|
-
// Read existing MCP configuration or create empty object
|
|
222
|
-
const mcpConfig = await this.readJsonFile(mcpConfigPath);
|
|
223
|
-
|
|
224
|
-
// Build MCP server args
|
|
225
|
-
const args = this.buildMcpServerArgs(options);
|
|
226
|
-
|
|
227
|
-
// Create or update MCP configuration for Cursor
|
|
228
|
-
if (!mcpConfig.mcpServers) {
|
|
229
|
-
mcpConfig.mcpServers = {};
|
|
230
|
-
}
|
|
231
|
-
mcpConfig.mcpServers.bit = {
|
|
232
|
-
type: 'stdio',
|
|
233
|
-
command: 'bit',
|
|
234
|
-
args: args
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
// Write updated MCP configuration
|
|
238
|
-
await _fsExtra().default.writeFile(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Get Windsurf mcp.json path based on global/workspace scope
|
|
243
|
-
*/
|
|
244
|
-
static getWindsurfSettingsPath(isGlobal, workspaceDir) {
|
|
245
|
-
if (isGlobal) {
|
|
246
|
-
// Global Windsurf MCP configuration
|
|
247
|
-
return _path().default.join((0, _os().homedir)(), '.windsurf', 'mcp.json');
|
|
248
|
-
} else {
|
|
249
|
-
// Workspace-specific MCP configuration
|
|
250
|
-
const targetDir = workspaceDir || process.cwd();
|
|
251
|
-
return _path().default.join(targetDir, '.windsurf', 'mcp.json');
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Setup Windsurf MCP integration
|
|
257
|
-
*/
|
|
258
|
-
static async setupWindsurf(options) {
|
|
259
|
-
const {
|
|
260
|
-
isGlobal,
|
|
261
|
-
workspaceDir
|
|
262
|
-
} = options;
|
|
263
|
-
|
|
264
|
-
// Determine mcp.json path
|
|
265
|
-
const mcpConfigPath = this.getWindsurfSettingsPath(isGlobal, workspaceDir);
|
|
266
|
-
|
|
267
|
-
// Ensure directory exists
|
|
268
|
-
await _fsExtra().default.ensureDir(_path().default.dirname(mcpConfigPath));
|
|
269
|
-
|
|
270
|
-
// Read existing MCP configuration or create empty object
|
|
271
|
-
const mcpConfig = await this.readJsonFile(mcpConfigPath);
|
|
272
|
-
|
|
273
|
-
// Build MCP server args
|
|
274
|
-
const args = this.buildMcpServerArgs(options);
|
|
275
|
-
|
|
276
|
-
// Create or update MCP configuration for Windsurf
|
|
277
|
-
if (!mcpConfig.mcpServers) {
|
|
278
|
-
mcpConfig.mcpServers = {};
|
|
279
|
-
}
|
|
280
|
-
mcpConfig.mcpServers.bit = {
|
|
281
|
-
type: 'stdio',
|
|
282
|
-
command: 'bit',
|
|
283
|
-
args: args
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
// Write updated MCP configuration
|
|
287
|
-
await _fsExtra().default.writeFile(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Get VS Code prompts path based on global/workspace scope
|
|
292
|
-
*/
|
|
293
|
-
static getVSCodePromptsPath(isGlobal, workspaceDir) {
|
|
294
|
-
if (isGlobal) {
|
|
295
|
-
// Global VS Code prompts - use the official User Data prompts directory
|
|
296
|
-
const platform = process.platform;
|
|
297
|
-
switch (platform) {
|
|
298
|
-
case 'win32':
|
|
299
|
-
return _path().default.join((0, _os().homedir)(), 'AppData', 'Roaming', 'Code', 'User', 'prompts', 'bit.instructions.md');
|
|
300
|
-
case 'darwin':
|
|
301
|
-
return _path().default.join((0, _os().homedir)(), 'Library', 'Application Support', 'Code', 'User', 'prompts', 'bit.instructions.md');
|
|
302
|
-
case 'linux':
|
|
303
|
-
return _path().default.join((0, _os().homedir)(), '.config', 'Code', 'User', 'prompts', 'bit.instructions.md');
|
|
304
|
-
default:
|
|
305
|
-
throw new Error(`Unsupported platform: ${platform}`);
|
|
306
|
-
}
|
|
307
|
-
} else {
|
|
308
|
-
// Workspace-specific prompts
|
|
309
|
-
const targetDir = workspaceDir || process.cwd();
|
|
310
|
-
return _path().default.join(targetDir, '.github', 'instructions', 'bit.instructions.md');
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Get Cursor prompts path based on global/workspace scope
|
|
316
|
-
*/
|
|
317
|
-
static getCursorPromptsPath(isGlobal, workspaceDir) {
|
|
318
|
-
if (isGlobal) {
|
|
319
|
-
throw new Error('Cursor does not support global prompts configuration in a file');
|
|
320
|
-
} else {
|
|
321
|
-
const targetDir = workspaceDir || process.cwd();
|
|
322
|
-
return _path().default.join(targetDir, '.cursor', 'rules', 'bit.rules.mdc');
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Get Roo Code prompts path based on global/workspace scope
|
|
328
|
-
*/
|
|
329
|
-
static getRooCodePromptsPath(isGlobal, workspaceDir) {
|
|
330
|
-
if (isGlobal) {
|
|
331
|
-
// Global Roo Code rules
|
|
332
|
-
return _path().default.join((0, _os().homedir)(), '.roo', 'rules', 'bit.instructions.md');
|
|
333
|
-
} else {
|
|
334
|
-
// Workspace-specific rules
|
|
335
|
-
const targetDir = workspaceDir || process.cwd();
|
|
336
|
-
return _path().default.join(targetDir, '.roo', 'rules', 'bit.instructions.md');
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Get default Bit MCP rules content from template file
|
|
342
|
-
*/
|
|
343
|
-
static getDefaultRulesContent(consumerProject = false) {
|
|
344
|
-
const templateName = consumerProject ? 'bit-rules-consumer-template.md' : 'bit-rules-template.md';
|
|
345
|
-
const templatePath = _path().default.join(__dirname, templateName);
|
|
346
|
-
return _fsExtra().default.readFile(templatePath, 'utf8');
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Write Bit MCP rules file for VS Code
|
|
351
|
-
*/
|
|
352
|
-
static async writeVSCodeRules(options) {
|
|
353
|
-
const {
|
|
354
|
-
isGlobal,
|
|
355
|
-
workspaceDir,
|
|
356
|
-
consumerProject = false
|
|
357
|
-
} = options;
|
|
358
|
-
|
|
359
|
-
// Determine prompts file path
|
|
360
|
-
const promptsPath = this.getVSCodePromptsPath(isGlobal, workspaceDir);
|
|
361
|
-
|
|
362
|
-
// Ensure directory exists
|
|
363
|
-
await _fsExtra().default.ensureDir(_path().default.dirname(promptsPath));
|
|
364
|
-
|
|
365
|
-
// Write rules content
|
|
366
|
-
const rulesContent = await this.getDefaultRulesContent(consumerProject);
|
|
367
|
-
await _fsExtra().default.writeFile(promptsPath, rulesContent);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Write Bit MCP rules file for Cursor
|
|
372
|
-
*/
|
|
373
|
-
static async writeCursorRules(options) {
|
|
374
|
-
const {
|
|
375
|
-
isGlobal,
|
|
376
|
-
workspaceDir,
|
|
377
|
-
consumerProject = false
|
|
378
|
-
} = options;
|
|
379
|
-
|
|
380
|
-
// Determine prompts file path
|
|
381
|
-
const promptsPath = this.getCursorPromptsPath(isGlobal, workspaceDir);
|
|
382
|
-
|
|
383
|
-
// Ensure directory exists
|
|
384
|
-
await _fsExtra().default.ensureDir(_path().default.dirname(promptsPath));
|
|
385
|
-
|
|
386
|
-
// Write rules content
|
|
387
|
-
const rulesContent = await this.getDefaultRulesContent(consumerProject);
|
|
388
|
-
await _fsExtra().default.writeFile(promptsPath, rulesContent);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Write Bit MCP rules file for Roo Code
|
|
393
|
-
*/
|
|
394
|
-
static async writeRooCodeRules(options) {
|
|
395
|
-
const {
|
|
396
|
-
isGlobal,
|
|
397
|
-
workspaceDir,
|
|
398
|
-
consumerProject = false
|
|
399
|
-
} = options;
|
|
400
|
-
|
|
401
|
-
// Determine prompts file path
|
|
402
|
-
const promptsPath = this.getRooCodePromptsPath(isGlobal, workspaceDir);
|
|
403
|
-
|
|
404
|
-
// Ensure directory exists
|
|
405
|
-
await _fsExtra().default.ensureDir(_path().default.dirname(promptsPath));
|
|
406
|
-
|
|
407
|
-
// Write rules content
|
|
408
|
-
const rulesContent = await this.getDefaultRulesContent(consumerProject);
|
|
409
|
-
await _fsExtra().default.writeFile(promptsPath, rulesContent);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* Write Bit MCP rules file for Cline
|
|
414
|
-
*/
|
|
415
|
-
static async writeClineRules(options) {
|
|
416
|
-
const {
|
|
417
|
-
isGlobal,
|
|
418
|
-
workspaceDir,
|
|
419
|
-
consumerProject = false
|
|
420
|
-
} = options;
|
|
421
|
-
|
|
422
|
-
// Determine prompts file path
|
|
423
|
-
const promptsPath = this.getClinePromptsPath(isGlobal, workspaceDir);
|
|
424
|
-
|
|
425
|
-
// Ensure directory exists
|
|
426
|
-
await _fsExtra().default.ensureDir(_path().default.dirname(promptsPath));
|
|
427
|
-
|
|
428
|
-
// Write rules content
|
|
429
|
-
const rulesContent = await this.getDefaultRulesContent(consumerProject);
|
|
430
|
-
await _fsExtra().default.writeFile(promptsPath, rulesContent);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Get Roo Code mcp.json path based on global/workspace scope
|
|
435
|
-
*/
|
|
436
|
-
static getRooCodeSettingsPath(isGlobal, workspaceDir) {
|
|
437
|
-
if (isGlobal) {
|
|
438
|
-
// Roo Code doesn't support global configuration, show warning
|
|
439
|
-
throw new Error('Roo Code global configuration is not supported as it uses VS Code internal storage that cannot be accessed. Please use workspace-specific configuration instead.');
|
|
440
|
-
} else {
|
|
441
|
-
// Workspace-specific MCP configuration
|
|
442
|
-
const targetDir = workspaceDir || process.cwd();
|
|
443
|
-
return _path().default.join(targetDir, '.roo', 'mcp.json');
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Setup Roo Code MCP integration
|
|
449
|
-
*/
|
|
450
|
-
static async setupRooCode(options) {
|
|
451
|
-
const {
|
|
452
|
-
isGlobal,
|
|
453
|
-
workspaceDir
|
|
454
|
-
} = options;
|
|
455
|
-
if (isGlobal) {
|
|
456
|
-
throw new Error('Roo Code global configuration is not supported as it uses VS Code internal storage that cannot be accessed. Please use workspace-specific configuration instead.');
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
// Determine mcp.json path
|
|
460
|
-
const mcpConfigPath = this.getRooCodeSettingsPath(isGlobal, workspaceDir);
|
|
461
|
-
|
|
462
|
-
// Ensure directory exists
|
|
463
|
-
await _fsExtra().default.ensureDir(_path().default.dirname(mcpConfigPath));
|
|
464
|
-
|
|
465
|
-
// Read existing MCP configuration or create empty object
|
|
466
|
-
const mcpConfig = await this.readJsonFile(mcpConfigPath);
|
|
467
|
-
|
|
468
|
-
// Build MCP server args
|
|
469
|
-
const args = this.buildMcpServerArgs(options);
|
|
470
|
-
|
|
471
|
-
// Create or update MCP configuration for Roo Code
|
|
472
|
-
if (!mcpConfig.mcpServers) {
|
|
473
|
-
mcpConfig.mcpServers = {};
|
|
474
|
-
}
|
|
475
|
-
mcpConfig.mcpServers.bit = {
|
|
476
|
-
type: 'stdio',
|
|
477
|
-
command: 'bit',
|
|
478
|
-
args: args
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
// Write updated MCP configuration
|
|
482
|
-
await _fsExtra().default.writeFile(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Get Cline prompts path based on global/workspace scope
|
|
487
|
-
*/
|
|
488
|
-
static getClinePromptsPath(isGlobal, workspaceDir) {
|
|
489
|
-
if (isGlobal) {
|
|
490
|
-
// Global Cline rules - using Mac path as specified, error for others
|
|
491
|
-
const platform = process.platform;
|
|
492
|
-
if (platform === 'darwin') {
|
|
493
|
-
return _path().default.join((0, _os().homedir)(), 'Documents', 'Cline', 'Rules', 'bit.instructions.md');
|
|
494
|
-
} else {
|
|
495
|
-
throw new Error(`Global Cline rules configuration is not supported on ${platform}. ` + 'The global path is only known for macOS (~/Documents/Cline/Rules/). ' + 'For other operating systems, please use the --print flag to get the rules content ' + 'and add it manually to your global Cline configuration.');
|
|
496
|
-
}
|
|
497
|
-
} else {
|
|
498
|
-
// Workspace-specific rules
|
|
499
|
-
const targetDir = workspaceDir || process.cwd();
|
|
500
|
-
return _path().default.join(targetDir, '.clinerules', 'bit.instructions.md');
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Get Claude Code mcp.json path based on global/workspace scope
|
|
506
|
-
*/
|
|
507
|
-
static getClaudeCodeSettingsPath(isGlobal, workspaceDir) {
|
|
508
|
-
if (isGlobal) {
|
|
509
|
-
// Global Claude Code MCP configuration
|
|
510
|
-
const platform = process.platform;
|
|
511
|
-
switch (platform) {
|
|
512
|
-
case 'win32':
|
|
513
|
-
return _path().default.join((0, _os().homedir)(), 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
|
|
514
|
-
case 'darwin':
|
|
515
|
-
return _path().default.join((0, _os().homedir)(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
516
|
-
case 'linux':
|
|
517
|
-
return _path().default.join((0, _os().homedir)(), '.config', 'claude', 'claude_desktop_config.json');
|
|
518
|
-
default:
|
|
519
|
-
throw new Error(`Unsupported platform: ${platform}`);
|
|
520
|
-
}
|
|
521
|
-
} else {
|
|
522
|
-
// Workspace-specific MCP configuration
|
|
523
|
-
const targetDir = workspaceDir || process.cwd();
|
|
524
|
-
return _path().default.join(targetDir, '.mcp.json');
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Setup Claude Code MCP integration
|
|
530
|
-
*/
|
|
531
|
-
static async setupClaudeCode(options) {
|
|
532
|
-
const {
|
|
533
|
-
isGlobal,
|
|
534
|
-
workspaceDir
|
|
535
|
-
} = options;
|
|
536
|
-
|
|
537
|
-
// Determine mcp.json path
|
|
538
|
-
const mcpConfigPath = this.getClaudeCodeSettingsPath(isGlobal, workspaceDir);
|
|
539
|
-
|
|
540
|
-
// Ensure directory exists
|
|
541
|
-
await _fsExtra().default.ensureDir(_path().default.dirname(mcpConfigPath));
|
|
542
|
-
|
|
543
|
-
// Read existing MCP configuration or create empty object
|
|
544
|
-
const mcpConfig = await this.readJsonFile(mcpConfigPath);
|
|
545
|
-
|
|
546
|
-
// Build MCP server args
|
|
547
|
-
const args = this.buildMcpServerArgs(options);
|
|
548
|
-
|
|
549
|
-
// Create or update MCP configuration for Claude Code
|
|
550
|
-
if (!mcpConfig.mcpServers) {
|
|
551
|
-
mcpConfig.mcpServers = {};
|
|
552
|
-
}
|
|
553
|
-
mcpConfig.mcpServers.bit = {
|
|
554
|
-
command: 'bit',
|
|
555
|
-
args: args
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
// Write updated MCP configuration
|
|
559
|
-
await _fsExtra().default.writeFile(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* Get Claude Code prompts path based on global/workspace scope
|
|
564
|
-
*/
|
|
565
|
-
static getClaudeCodePromptsPath(isGlobal, workspaceDir) {
|
|
566
|
-
if (isGlobal) {
|
|
567
|
-
// Global Claude Code rules - using .claude directory
|
|
568
|
-
return _path().default.join((0, _os().homedir)(), '.claude', 'bit.md');
|
|
569
|
-
} else {
|
|
570
|
-
// Workspace-specific rules in .claude directory
|
|
571
|
-
const targetDir = workspaceDir || process.cwd();
|
|
572
|
-
return _path().default.join(targetDir, '.claude', 'bit.md');
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* Write Bit MCP rules file for Claude Code
|
|
578
|
-
*/
|
|
579
|
-
static async writeClaudeCodeRules(options) {
|
|
580
|
-
const {
|
|
581
|
-
isGlobal,
|
|
582
|
-
workspaceDir,
|
|
583
|
-
consumerProject = false
|
|
584
|
-
} = options;
|
|
585
|
-
|
|
586
|
-
// Determine prompts file path
|
|
587
|
-
const promptsPath = this.getClaudeCodePromptsPath(isGlobal, workspaceDir);
|
|
588
|
-
|
|
589
|
-
// Ensure directory exists
|
|
590
|
-
await _fsExtra().default.ensureDir(_path().default.dirname(promptsPath));
|
|
591
|
-
|
|
592
|
-
// Get base rules content
|
|
593
|
-
const rulesContent = await this.getDefaultRulesContent(consumerProject);
|
|
594
|
-
|
|
595
|
-
// Add integration instructions at the top
|
|
596
|
-
const integrationInstructions = `<!--
|
|
597
|
-
To use these Bit instructions, add the following to your main CLAUDE.md file:
|
|
598
|
-
|
|
599
|
-
@.claude/bit.md
|
|
600
|
-
|
|
601
|
-
This will automatically include all Bit-specific instructions in your Claude Code context.
|
|
602
|
-
-->
|
|
603
|
-
|
|
604
|
-
`;
|
|
605
|
-
const finalContent = integrationInstructions + rulesContent;
|
|
606
|
-
|
|
607
|
-
// Write rules content with integration instructions
|
|
608
|
-
await _fsExtra().default.writeFile(promptsPath, finalContent);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
exports.McpSetupUtils = McpSetupUtils;
|
|
612
|
-
|
|
613
|
-
//# sourceMappingURL=setup-utils.js.map
|
package/dist/setup-utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_path","_os","e","__esModule","default","McpSetupUtils","buildMcpServerArgs","options","consumerProject","includeAdditional","args","push","readJsonFile","filePath","fs","pathExists","content","readFile","JSON","parse","error","Error","path","basename","message","getEditorDisplayName","editor","getVSCodeSettingsPath","isGlobal","workspaceDir","platform","process","join","homedir","targetDir","cwd","getVSCodeMcpConfigPath","setupVSCode","settingsPath","ensureDir","dirname","settings","mcp","servers","type","command","writeFile","stringify","mcpConfigPath","mcpConfig","getCursorSettingsPath","setupCursor","mcpServers","bit","getWindsurfSettingsPath","setupWindsurf","getVSCodePromptsPath","getCursorPromptsPath","getRooCodePromptsPath","getDefaultRulesContent","templateName","templatePath","__dirname","writeVSCodeRules","promptsPath","rulesContent","writeCursorRules","writeRooCodeRules","writeClineRules","getClinePromptsPath","getRooCodeSettingsPath","setupRooCode","getClaudeCodeSettingsPath","setupClaudeCode","getClaudeCodePromptsPath","writeClaudeCodeRules","integrationInstructions","finalContent","exports"],"sources":["setup-utils.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\nimport { homedir } from 'os';\n\n/**\n * Options for setting up MCP server configuration\n */\nexport interface SetupOptions {\n consumerProject?: boolean;\n includeAdditional?: string;\n isGlobal: boolean;\n workspaceDir?: string;\n}\n\n/**\n * Options for writing rules/instructions files\n */\nexport interface RulesOptions {\n isGlobal: boolean;\n workspaceDir?: string;\n consumerProject?: boolean;\n}\n\n/**\n * Utility class for setting up MCP server configurations across different editors\n */\nexport class McpSetupUtils {\n /**\n * Build MCP server arguments based on provided options\n */\n static buildMcpServerArgs(options: SetupOptions): string[] {\n const { consumerProject, includeAdditional } = options;\n const args = ['mcp-server', 'start'];\n\n if (consumerProject) {\n args.push('--consumer-project');\n }\n\n if (includeAdditional) {\n args.push('--include-additional', includeAdditional);\n }\n\n return args;\n }\n\n /**\n * Read and parse a JSON file, returning empty object if file doesn't exist\n */\n static async readJsonFile(filePath: string): Promise<any> {\n if (!(await fs.pathExists(filePath))) {\n return {};\n }\n\n try {\n const content = await fs.readFile(filePath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n throw new Error(`Failed to parse ${path.basename(filePath)}: ${(error as Error).message}`);\n }\n }\n\n /**\n * Get display name for an editor\n */\n static getEditorDisplayName(editor: string): string {\n switch (editor) {\n case 'vscode':\n return 'VS Code';\n case 'cursor':\n return 'Cursor';\n case 'windsurf':\n return 'Windsurf';\n case 'roo':\n return 'Roo Code';\n case 'cline':\n return 'Cline';\n case 'claude-code':\n return 'Claude Code';\n default:\n return editor;\n }\n }\n\n /**\n * Get VS Code settings.json path based on global/workspace scope\n */\n static getVSCodeSettingsPath(isGlobal: boolean, workspaceDir?: string): string {\n if (isGlobal) {\n // Global VS Code settings\n const platform = process.platform;\n switch (platform) {\n case 'win32':\n return path.join(homedir(), 'AppData', 'Roaming', 'Code', 'User', 'settings.json');\n case 'darwin':\n return path.join(homedir(), 'Library', 'Application Support', 'Code', 'User', 'settings.json');\n case 'linux':\n return path.join(homedir(), '.config', 'Code', 'User', 'settings.json');\n default:\n throw new Error(`Unsupported platform: ${platform}`);\n }\n } else {\n // Workspace-specific settings\n const targetDir = workspaceDir || process.cwd();\n return path.join(targetDir, '.vscode', 'settings.json');\n }\n }\n\n /**\n * Get VS Code mcp.json path for workspace configuration\n */\n static getVSCodeMcpConfigPath(workspaceDir?: string): string {\n const targetDir = workspaceDir || process.cwd();\n return path.join(targetDir, '.vscode', 'mcp.json');\n }\n\n /**\n * Setup VS Code MCP integration\n */\n static async setupVSCode(options: SetupOptions): Promise<void> {\n const { isGlobal, workspaceDir } = options;\n\n if (isGlobal) {\n // For global configuration, use settings.json with mcp.servers structure\n const settingsPath = this.getVSCodeSettingsPath(isGlobal, workspaceDir);\n\n // Ensure directory exists\n await fs.ensureDir(path.dirname(settingsPath));\n\n // Read existing settings or create empty object\n const settings = await this.readJsonFile(settingsPath);\n\n // Build MCP server args\n const args = this.buildMcpServerArgs(options);\n\n // Create or update MCP configuration\n if (!settings.mcp) {\n settings.mcp = {};\n }\n\n if (!settings.mcp.servers) {\n settings.mcp.servers = {};\n }\n\n settings.mcp.servers['bit-cli'] = {\n type: 'stdio',\n command: 'bit',\n args: args,\n };\n\n // Write updated settings\n await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2));\n } else {\n // For workspace configuration, use .vscode/mcp.json with direct servers structure\n const mcpConfigPath = this.getVSCodeMcpConfigPath(workspaceDir);\n\n // Ensure directory exists\n await fs.ensureDir(path.dirname(mcpConfigPath));\n\n // Read existing MCP configuration or create empty object\n const mcpConfig = await this.readJsonFile(mcpConfigPath);\n\n // Build MCP server args\n const args = this.buildMcpServerArgs(options);\n\n // Create or update MCP configuration\n if (!mcpConfig.servers) {\n mcpConfig.servers = {};\n }\n\n mcpConfig.servers['bit-cli'] = {\n type: 'stdio',\n command: 'bit',\n args: args,\n };\n\n // Write updated MCP configuration\n await fs.writeFile(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));\n }\n }\n\n /**\n * Get Cursor mcp.json path based on global/workspace scope\n */\n static getCursorSettingsPath(isGlobal: boolean, workspaceDir?: string): string {\n if (isGlobal) {\n // Global Cursor MCP configuration\n return path.join(homedir(), '.cursor', 'mcp.json');\n } else {\n // Workspace-specific MCP configuration\n const targetDir = workspaceDir || process.cwd();\n return path.join(targetDir, '.cursor', 'mcp.json');\n }\n }\n\n /**\n * Setup Cursor MCP integration\n */\n static async setupCursor(options: SetupOptions): Promise<void> {\n const { isGlobal, workspaceDir } = options;\n\n // Determine mcp.json path\n const mcpConfigPath = this.getCursorSettingsPath(isGlobal, workspaceDir);\n\n // Ensure directory exists\n await fs.ensureDir(path.dirname(mcpConfigPath));\n\n // Read existing MCP configuration or create empty object\n const mcpConfig = await this.readJsonFile(mcpConfigPath);\n\n // Build MCP server args\n const args = this.buildMcpServerArgs(options);\n\n // Create or update MCP configuration for Cursor\n if (!mcpConfig.mcpServers) {\n mcpConfig.mcpServers = {};\n }\n\n mcpConfig.mcpServers.bit = {\n type: 'stdio',\n command: 'bit',\n args: args,\n };\n\n // Write updated MCP configuration\n await fs.writeFile(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));\n }\n\n /**\n * Get Windsurf mcp.json path based on global/workspace scope\n */\n static getWindsurfSettingsPath(isGlobal: boolean, workspaceDir?: string): string {\n if (isGlobal) {\n // Global Windsurf MCP configuration\n return path.join(homedir(), '.windsurf', 'mcp.json');\n } else {\n // Workspace-specific MCP configuration\n const targetDir = workspaceDir || process.cwd();\n return path.join(targetDir, '.windsurf', 'mcp.json');\n }\n }\n\n /**\n * Setup Windsurf MCP integration\n */\n static async setupWindsurf(options: SetupOptions): Promise<void> {\n const { isGlobal, workspaceDir } = options;\n\n // Determine mcp.json path\n const mcpConfigPath = this.getWindsurfSettingsPath(isGlobal, workspaceDir);\n\n // Ensure directory exists\n await fs.ensureDir(path.dirname(mcpConfigPath));\n\n // Read existing MCP configuration or create empty object\n const mcpConfig = await this.readJsonFile(mcpConfigPath);\n\n // Build MCP server args\n const args = this.buildMcpServerArgs(options);\n\n // Create or update MCP configuration for Windsurf\n if (!mcpConfig.mcpServers) {\n mcpConfig.mcpServers = {};\n }\n\n mcpConfig.mcpServers.bit = {\n type: 'stdio',\n command: 'bit',\n args: args,\n };\n\n // Write updated MCP configuration\n await fs.writeFile(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));\n }\n\n /**\n * Get VS Code prompts path based on global/workspace scope\n */\n static getVSCodePromptsPath(isGlobal: boolean, workspaceDir?: string): string {\n if (isGlobal) {\n // Global VS Code prompts - use the official User Data prompts directory\n const platform = process.platform;\n switch (platform) {\n case 'win32':\n return path.join(homedir(), 'AppData', 'Roaming', 'Code', 'User', 'prompts', 'bit.instructions.md');\n case 'darwin':\n return path.join(\n homedir(),\n 'Library',\n 'Application Support',\n 'Code',\n 'User',\n 'prompts',\n 'bit.instructions.md'\n );\n case 'linux':\n return path.join(homedir(), '.config', 'Code', 'User', 'prompts', 'bit.instructions.md');\n default:\n throw new Error(`Unsupported platform: ${platform}`);\n }\n } else {\n // Workspace-specific prompts\n const targetDir = workspaceDir || process.cwd();\n return path.join(targetDir, '.github', 'instructions', 'bit.instructions.md');\n }\n }\n\n /**\n * Get Cursor prompts path based on global/workspace scope\n */\n static getCursorPromptsPath(isGlobal: boolean, workspaceDir?: string): string {\n if (isGlobal) {\n throw new Error('Cursor does not support global prompts configuration in a file');\n } else {\n const targetDir = workspaceDir || process.cwd();\n return path.join(targetDir, '.cursor', 'rules', 'bit.rules.mdc');\n }\n }\n\n /**\n * Get Roo Code prompts path based on global/workspace scope\n */\n static getRooCodePromptsPath(isGlobal: boolean, workspaceDir?: string): string {\n if (isGlobal) {\n // Global Roo Code rules\n return path.join(homedir(), '.roo', 'rules', 'bit.instructions.md');\n } else {\n // Workspace-specific rules\n const targetDir = workspaceDir || process.cwd();\n return path.join(targetDir, '.roo', 'rules', 'bit.instructions.md');\n }\n }\n\n /**\n * Get default Bit MCP rules content from template file\n */\n static getDefaultRulesContent(consumerProject: boolean = false): Promise<string> {\n const templateName = consumerProject ? 'bit-rules-consumer-template.md' : 'bit-rules-template.md';\n const templatePath = path.join(__dirname, templateName);\n return fs.readFile(templatePath, 'utf8');\n }\n\n /**\n * Write Bit MCP rules file for VS Code\n */\n static async writeVSCodeRules(options: RulesOptions): Promise<void> {\n const { isGlobal, workspaceDir, consumerProject = false } = options;\n\n // Determine prompts file path\n const promptsPath = this.getVSCodePromptsPath(isGlobal, workspaceDir);\n\n // Ensure directory exists\n await fs.ensureDir(path.dirname(promptsPath));\n\n // Write rules content\n const rulesContent = await this.getDefaultRulesContent(consumerProject);\n await fs.writeFile(promptsPath, rulesContent);\n }\n\n /**\n * Write Bit MCP rules file for Cursor\n */\n static async writeCursorRules(options: RulesOptions): Promise<void> {\n const { isGlobal, workspaceDir, consumerProject = false } = options;\n\n // Determine prompts file path\n const promptsPath = this.getCursorPromptsPath(isGlobal, workspaceDir);\n\n // Ensure directory exists\n await fs.ensureDir(path.dirname(promptsPath));\n\n // Write rules content\n const rulesContent = await this.getDefaultRulesContent(consumerProject);\n await fs.writeFile(promptsPath, rulesContent);\n }\n\n /**\n * Write Bit MCP rules file for Roo Code\n */\n static async writeRooCodeRules(options: RulesOptions): Promise<void> {\n const { isGlobal, workspaceDir, consumerProject = false } = options;\n\n // Determine prompts file path\n const promptsPath = this.getRooCodePromptsPath(isGlobal, workspaceDir);\n\n // Ensure directory exists\n await fs.ensureDir(path.dirname(promptsPath));\n\n // Write rules content\n const rulesContent = await this.getDefaultRulesContent(consumerProject);\n await fs.writeFile(promptsPath, rulesContent);\n }\n\n /**\n * Write Bit MCP rules file for Cline\n */\n static async writeClineRules(options: RulesOptions): Promise<void> {\n const { isGlobal, workspaceDir, consumerProject = false } = options;\n\n // Determine prompts file path\n const promptsPath = this.getClinePromptsPath(isGlobal, workspaceDir);\n\n // Ensure directory exists\n await fs.ensureDir(path.dirname(promptsPath));\n\n // Write rules content\n const rulesContent = await this.getDefaultRulesContent(consumerProject);\n await fs.writeFile(promptsPath, rulesContent);\n }\n\n /**\n * Get Roo Code mcp.json path based on global/workspace scope\n */\n static getRooCodeSettingsPath(isGlobal: boolean, workspaceDir?: string): string {\n if (isGlobal) {\n // Roo Code doesn't support global configuration, show warning\n throw new Error(\n 'Roo Code global configuration is not supported as it uses VS Code internal storage that cannot be accessed. Please use workspace-specific configuration instead.'\n );\n } else {\n // Workspace-specific MCP configuration\n const targetDir = workspaceDir || process.cwd();\n return path.join(targetDir, '.roo', 'mcp.json');\n }\n }\n\n /**\n * Setup Roo Code MCP integration\n */\n static async setupRooCode(options: SetupOptions): Promise<void> {\n const { isGlobal, workspaceDir } = options;\n\n if (isGlobal) {\n throw new Error(\n 'Roo Code global configuration is not supported as it uses VS Code internal storage that cannot be accessed. Please use workspace-specific configuration instead.'\n );\n }\n\n // Determine mcp.json path\n const mcpConfigPath = this.getRooCodeSettingsPath(isGlobal, workspaceDir);\n\n // Ensure directory exists\n await fs.ensureDir(path.dirname(mcpConfigPath));\n\n // Read existing MCP configuration or create empty object\n const mcpConfig = await this.readJsonFile(mcpConfigPath);\n\n // Build MCP server args\n const args = this.buildMcpServerArgs(options);\n\n // Create or update MCP configuration for Roo Code\n if (!mcpConfig.mcpServers) {\n mcpConfig.mcpServers = {};\n }\n\n mcpConfig.mcpServers.bit = {\n type: 'stdio',\n command: 'bit',\n args: args,\n };\n\n // Write updated MCP configuration\n await fs.writeFile(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));\n }\n\n /**\n * Get Cline prompts path based on global/workspace scope\n */\n static getClinePromptsPath(isGlobal: boolean, workspaceDir?: string): string {\n if (isGlobal) {\n // Global Cline rules - using Mac path as specified, error for others\n const platform = process.platform;\n if (platform === 'darwin') {\n return path.join(homedir(), 'Documents', 'Cline', 'Rules', 'bit.instructions.md');\n } else {\n throw new Error(\n `Global Cline rules configuration is not supported on ${platform}. ` +\n 'The global path is only known for macOS (~/Documents/Cline/Rules/). ' +\n 'For other operating systems, please use the --print flag to get the rules content ' +\n 'and add it manually to your global Cline configuration.'\n );\n }\n } else {\n // Workspace-specific rules\n const targetDir = workspaceDir || process.cwd();\n return path.join(targetDir, '.clinerules', 'bit.instructions.md');\n }\n }\n\n /**\n * Get Claude Code mcp.json path based on global/workspace scope\n */\n static getClaudeCodeSettingsPath(isGlobal: boolean, workspaceDir?: string): string {\n if (isGlobal) {\n // Global Claude Code MCP configuration\n const platform = process.platform;\n switch (platform) {\n case 'win32':\n return path.join(homedir(), 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');\n case 'darwin':\n return path.join(homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');\n case 'linux':\n return path.join(homedir(), '.config', 'claude', 'claude_desktop_config.json');\n default:\n throw new Error(`Unsupported platform: ${platform}`);\n }\n } else {\n // Workspace-specific MCP configuration\n const targetDir = workspaceDir || process.cwd();\n return path.join(targetDir, '.mcp.json');\n }\n }\n\n /**\n * Setup Claude Code MCP integration\n */\n static async setupClaudeCode(options: SetupOptions): Promise<void> {\n const { isGlobal, workspaceDir } = options;\n\n // Determine mcp.json path\n const mcpConfigPath = this.getClaudeCodeSettingsPath(isGlobal, workspaceDir);\n\n // Ensure directory exists\n await fs.ensureDir(path.dirname(mcpConfigPath));\n\n // Read existing MCP configuration or create empty object\n const mcpConfig = await this.readJsonFile(mcpConfigPath);\n\n // Build MCP server args\n const args = this.buildMcpServerArgs(options);\n\n // Create or update MCP configuration for Claude Code\n if (!mcpConfig.mcpServers) {\n mcpConfig.mcpServers = {};\n }\n\n mcpConfig.mcpServers.bit = {\n command: 'bit',\n args: args,\n };\n\n // Write updated MCP configuration\n await fs.writeFile(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));\n }\n\n /**\n * Get Claude Code prompts path based on global/workspace scope\n */\n static getClaudeCodePromptsPath(isGlobal: boolean, workspaceDir?: string): string {\n if (isGlobal) {\n // Global Claude Code rules - using .claude directory\n return path.join(homedir(), '.claude', 'bit.md');\n } else {\n // Workspace-specific rules in .claude directory\n const targetDir = workspaceDir || process.cwd();\n return path.join(targetDir, '.claude', 'bit.md');\n }\n }\n\n /**\n * Write Bit MCP rules file for Claude Code\n */\n static async writeClaudeCodeRules(options: RulesOptions): Promise<void> {\n const { isGlobal, workspaceDir, consumerProject = false } = options;\n\n // Determine prompts file path\n const promptsPath = this.getClaudeCodePromptsPath(isGlobal, workspaceDir);\n\n // Ensure directory exists\n await fs.ensureDir(path.dirname(promptsPath));\n\n // Get base rules content\n const rulesContent = await this.getDefaultRulesContent(consumerProject);\n\n // Add integration instructions at the top\n const integrationInstructions = `<!--\nTo use these Bit instructions, add the following to your main CLAUDE.md file:\n\n@.claude/bit.md\n\nThis will automatically include all Bit-specific instructions in your Claude Code context.\n-->\n\n`;\n\n const finalContent = integrationInstructions + rulesContent;\n\n // Write rules content with integration instructions\n await fs.writeFile(promptsPath, finalContent);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,GAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6B,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE7B;AACA;AACA;;AAQA;AACA;AACA;;AAOA;AACA;AACA;AACO,MAAMG,aAAa,CAAC;EACzB;AACF;AACA;EACE,OAAOC,kBAAkBA,CAACC,OAAqB,EAAY;IACzD,MAAM;MAAEC,eAAe;MAAEC;IAAkB,CAAC,GAAGF,OAAO;IACtD,MAAMG,IAAI,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC;IAEp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