@scorehub/creator-outreach 1.0.5 → 1.0.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.
- package/install.js +17 -1
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -29,6 +29,21 @@ const MCP_CONFIG = {
|
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
// 工具函数:解析 WorkBuddy 捆绑的 npx 全路径(WorkBuddy PATH 中不含系统 npx)
|
|
33
|
+
function resolveNpxPath() {
|
|
34
|
+
const versionsDir = path.join(WORKBUDDY_DIR, 'binaries', 'node', 'versions');
|
|
35
|
+
try {
|
|
36
|
+
const versions = fs.readdirSync(versionsDir);
|
|
37
|
+
if (versions.length > 0) {
|
|
38
|
+
const npxPath = path.join(versionsDir, versions[0], 'bin', 'npx');
|
|
39
|
+
if (fs.existsSync(npxPath)) return npxPath;
|
|
40
|
+
}
|
|
41
|
+
} catch {
|
|
42
|
+
// 目录不存在或无权限,fallback 到 "npx"
|
|
43
|
+
}
|
|
44
|
+
return 'npx';
|
|
45
|
+
}
|
|
46
|
+
|
|
32
47
|
// 工具函数:合并 MCP Server 配置到 JSON 文件
|
|
33
48
|
function mergeMcpConfig(configPath, serverName, serverConfig, extraFields) {
|
|
34
49
|
let config = {};
|
|
@@ -87,7 +102,8 @@ if (hasWorkBuddy) {
|
|
|
87
102
|
console.log(`✓ WorkBuddy: 插件文件已安装 → ${WORKBUDDY_PLUGIN_DIR}`);
|
|
88
103
|
|
|
89
104
|
// 4. 合并 MCP Server 配置到 ~/.workbuddy/mcp.json
|
|
90
|
-
|
|
105
|
+
const wbMCPConfig = Object.assign({}, MCP_CONFIG, { command: resolveNpxPath() });
|
|
106
|
+
mergeMcpConfig(WORKBUDDY_MCP_JSON, 'scorehub', wbMCPConfig, { disabled: false });
|
|
91
107
|
console.log(`✓ WorkBuddy: MCP Server 已配置 → ${WORKBUDDY_MCP_JSON}`);
|
|
92
108
|
}
|
|
93
109
|
|