mobbdev 1.0.184 → 1.0.185
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/index.mjs +97 -30
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -13357,52 +13357,119 @@ var gitInfo = {
|
|
|
13357
13357
|
name: runCommand("git config user.name"),
|
|
13358
13358
|
email: runCommand("git config user.email")
|
|
13359
13359
|
};
|
|
13360
|
-
var
|
|
13360
|
+
var getClaudeWorkspacePaths = () => {
|
|
13361
13361
|
const home = os3.homedir();
|
|
13362
|
+
const claudeIdePath = path11.join(home, ".claude", "ide");
|
|
13363
|
+
const workspacePaths = [];
|
|
13364
|
+
if (!fs10.existsSync(claudeIdePath)) {
|
|
13365
|
+
return workspacePaths;
|
|
13366
|
+
}
|
|
13367
|
+
try {
|
|
13368
|
+
const lockFiles = fs10.readdirSync(claudeIdePath).filter((file) => file.endsWith(".lock"));
|
|
13369
|
+
for (const lockFile of lockFiles) {
|
|
13370
|
+
const lockFilePath = path11.join(claudeIdePath, lockFile);
|
|
13371
|
+
try {
|
|
13372
|
+
const lockContent = JSON.parse(fs10.readFileSync(lockFilePath, "utf8"));
|
|
13373
|
+
if (lockContent.workspaceFolders && Array.isArray(lockContent.workspaceFolders)) {
|
|
13374
|
+
workspacePaths.push(...lockContent.workspaceFolders);
|
|
13375
|
+
}
|
|
13376
|
+
} catch (error) {
|
|
13377
|
+
logWarn(
|
|
13378
|
+
`[UsageService] Failed to read Claude lock file: ${lockFilePath}`
|
|
13379
|
+
);
|
|
13380
|
+
}
|
|
13381
|
+
}
|
|
13382
|
+
} catch (error) {
|
|
13383
|
+
logWarn(
|
|
13384
|
+
`[UsageService] Failed to read Claude IDE directory: ${claudeIdePath}`
|
|
13385
|
+
);
|
|
13386
|
+
}
|
|
13387
|
+
return workspacePaths;
|
|
13388
|
+
};
|
|
13389
|
+
var getMCPConfigPaths = (hostName) => {
|
|
13390
|
+
const home = os3.homedir();
|
|
13391
|
+
const currentDir = process.env["WORKSPACE_FOLDER_PATHS"] || process.env["PWD"] || process.cwd();
|
|
13362
13392
|
switch (hostName.toLowerCase()) {
|
|
13363
13393
|
case "cursor":
|
|
13364
|
-
return
|
|
13394
|
+
return [
|
|
13395
|
+
path11.join(currentDir, ".cursor", "mcp.json"),
|
|
13396
|
+
// local first
|
|
13397
|
+
path11.join(home, ".cursor", "mcp.json")
|
|
13398
|
+
];
|
|
13365
13399
|
case "windsurf":
|
|
13366
|
-
return
|
|
13400
|
+
return [
|
|
13401
|
+
path11.join(currentDir, ".codeium", "mcp_config.json"),
|
|
13402
|
+
// local first
|
|
13403
|
+
path11.join(home, ".codeium", "windsurf", "mcp_config.json")
|
|
13404
|
+
];
|
|
13367
13405
|
case "webstorm":
|
|
13368
|
-
return
|
|
13406
|
+
return [];
|
|
13369
13407
|
case "visualstudiocode":
|
|
13370
13408
|
case "vscode":
|
|
13371
|
-
return
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
"
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
|
|
13409
|
+
return [
|
|
13410
|
+
path11.join(currentDir, ".vscode", "mcp.json"),
|
|
13411
|
+
// local first
|
|
13412
|
+
process.platform === "win32" ? path11.join(home, "AppData", "Roaming", "Code", "User", "mcp.json") : path11.join(
|
|
13413
|
+
home,
|
|
13414
|
+
"Library",
|
|
13415
|
+
"Application Support",
|
|
13416
|
+
"Code",
|
|
13417
|
+
"User",
|
|
13418
|
+
"mcp.json"
|
|
13419
|
+
)
|
|
13420
|
+
];
|
|
13421
|
+
case "claude": {
|
|
13422
|
+
const claudePaths = [
|
|
13423
|
+
path11.join(currentDir, ".claude.json"),
|
|
13424
|
+
// local first
|
|
13425
|
+
path11.join(home, ".claude.json")
|
|
13426
|
+
];
|
|
13427
|
+
const workspacePaths = getClaudeWorkspacePaths();
|
|
13428
|
+
for (const workspacePath of workspacePaths) {
|
|
13429
|
+
claudePaths.push(path11.join(workspacePath, ".mcp.json"));
|
|
13430
|
+
}
|
|
13431
|
+
return claudePaths;
|
|
13432
|
+
}
|
|
13381
13433
|
default:
|
|
13382
13434
|
throw new Error(`Unknown hostName: ${hostName}`);
|
|
13383
13435
|
}
|
|
13384
13436
|
};
|
|
13385
|
-
var
|
|
13386
|
-
const filePath = getMCPConfigPath(hostName);
|
|
13437
|
+
var readConfigFile = (filePath) => {
|
|
13387
13438
|
if (!fs10.existsSync(filePath)) return null;
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13439
|
+
try {
|
|
13440
|
+
return JSON.parse(fs10.readFileSync(filePath, "utf8"));
|
|
13441
|
+
} catch (error) {
|
|
13442
|
+
logWarn(`[UsageService] Failed to read MCP config: ${filePath}`);
|
|
13443
|
+
return null;
|
|
13444
|
+
}
|
|
13445
|
+
};
|
|
13446
|
+
var readMCPConfig = (hostName) => {
|
|
13447
|
+
const configPaths = getMCPConfigPaths(hostName);
|
|
13448
|
+
const mergedConfig = {};
|
|
13449
|
+
for (const configPath of configPaths) {
|
|
13450
|
+
const config4 = readConfigFile(configPath);
|
|
13451
|
+
if (hostName === "claude" && config4?.projects) {
|
|
13452
|
+
const allMcpServers = {};
|
|
13453
|
+
for (const projectPath in config4.projects) {
|
|
13454
|
+
const project = config4.projects[projectPath];
|
|
13455
|
+
if (project?.mcpServers) {
|
|
13456
|
+
Object.assign(allMcpServers, project.mcpServers);
|
|
13398
13457
|
}
|
|
13399
13458
|
}
|
|
13459
|
+
mergedConfig.mcpServers = { ...mergedConfig.mcpServers, ...allMcpServers };
|
|
13460
|
+
continue;
|
|
13461
|
+
}
|
|
13462
|
+
if (config4?.mcpServers) {
|
|
13463
|
+
mergedConfig.mcpServers = {
|
|
13464
|
+
...mergedConfig.mcpServers,
|
|
13465
|
+
...config4.mcpServers
|
|
13466
|
+
};
|
|
13467
|
+
}
|
|
13468
|
+
if (config4?.servers) {
|
|
13469
|
+
mergedConfig.servers = { ...mergedConfig.servers, ...config4.servers };
|
|
13400
13470
|
}
|
|
13401
|
-
return {
|
|
13402
|
-
mcpServers: allMcpServers
|
|
13403
|
-
};
|
|
13404
13471
|
}
|
|
13405
|
-
return
|
|
13472
|
+
return Object.keys(mergedConfig).length > 0 ? mergedConfig : null;
|
|
13406
13473
|
};
|
|
13407
13474
|
var getRunningProcesses = () => {
|
|
13408
13475
|
try {
|