@scorehub/creator-outreach 1.0.6 → 1.0.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.
Files changed (2) hide show
  1. package/install.js +18 -7
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -29,19 +29,22 @@ const MCP_CONFIG = {
29
29
  },
30
30
  };
31
31
 
32
- // 工具函数:解析 WorkBuddy 捆绑的 npx 全路径(WorkBuddy PATH 中不含系统 npx)
33
- function resolveNpxPath() {
32
+ // 工具函数:解析 WorkBuddy 捆绑的 node bin 目录
33
+ // WorkBuddy spawn 子进程的 PATH 不含 node,npx 及其下载的包依赖 #!/usr/bin/env node,
34
+ // 找不到 node 会秒退导致 "Connection closed"。返回 npx 全路径 + bin 目录用于注入 PATH。
35
+ function resolveWorkBuddyNode() {
34
36
  const versionsDir = path.join(WORKBUDDY_DIR, 'binaries', 'node', 'versions');
35
37
  try {
36
38
  const versions = fs.readdirSync(versionsDir);
37
39
  if (versions.length > 0) {
38
- const npxPath = path.join(versionsDir, versions[0], 'bin', 'npx');
39
- if (fs.existsSync(npxPath)) return npxPath;
40
+ const binDir = path.join(versionsDir, versions[0], 'bin');
41
+ const npxPath = path.join(binDir, 'npx');
42
+ if (fs.existsSync(npxPath)) return { npx: npxPath, binDir };
40
43
  }
41
44
  } catch {
42
- // 目录不存在或无权限,fallback 到 "npx"
45
+ // 目录不存在或无权限
43
46
  }
44
- return 'npx';
47
+ return { npx: 'npx', binDir: null };
45
48
  }
46
49
 
47
50
  // 工具函数:合并 MCP Server 配置到 JSON 文件
@@ -102,7 +105,15 @@ if (hasWorkBuddy) {
102
105
  console.log(`✓ WorkBuddy: 插件文件已安装 → ${WORKBUDDY_PLUGIN_DIR}`);
103
106
 
104
107
  // 4. 合并 MCP Server 配置到 ~/.workbuddy/mcp.json
105
- const wbMCPConfig = Object.assign({}, MCP_CONFIG, { command: resolveNpxPath() });
108
+ // - 去掉 type 字段(WorkBuddy 不识别)
109
+ // - command 用 npx 全路径(WorkBuddy PATH 不含系统 npx)
110
+ // - env.PATH 注入 node bin 目录(否则 npx 及其子进程的 shebang 找不到 node,秒退报 Connection closed)
111
+ const { npx, binDir } = resolveWorkBuddyNode();
112
+ const { type: _, ...baseMCPConfig } = MCP_CONFIG;
113
+ const wbEnv = binDir
114
+ ? Object.assign({}, MCP_CONFIG.env, { PATH: `${binDir}:/usr/local/bin:/usr/bin:/bin` })
115
+ : MCP_CONFIG.env;
116
+ const wbMCPConfig = Object.assign({}, baseMCPConfig, { command: npx, env: wbEnv });
106
117
  mergeMcpConfig(WORKBUDDY_MCP_JSON, 'scorehub', wbMCPConfig, { disabled: false });
107
118
  console.log(`✓ WorkBuddy: MCP Server 已配置 → ${WORKBUDDY_MCP_JSON}`);
108
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scorehub/creator-outreach",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "ScoreHub Tiky 智能体 — Agent 定义 + Skills 配置",
5
5
  "files": [
6
6
  ".codebuddy-plugin",