@scorehub/creator-outreach 1.0.13 → 1.0.15

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tiktok-creator-outreach",
3
- "version": "1.0.0",
4
- "description": "TikTok Shop creator outreach specialist — search marketplace creators, analyze performance, and batch send collaboration messages.",
3
+ "version": "1.0.14",
4
+ "description": "ScoreHub AI's TikTok Shop creator outreach assistant for finding, evaluating, and contacting creators across Southeast Asia.",
5
5
  "author": {
6
6
  "name": "Ben",
7
7
  "email": "bennyworks@foxmail.com"
@@ -17,32 +17,31 @@
17
17
  "agentName": "tiktok-creator-outreach",
18
18
 
19
19
  "displayName": {
20
- "en": "Tiky — TikTok Creator Outreach",
21
- "zh": "Tiky — TikTok达人建联"
20
+ "en": "Tiky by ScoreHub AI",
21
+ "zh": "Tiky · ScoreHub AI 达人建联"
22
22
  },
23
23
  "profession": {
24
- "en": "TikTok Creator Outreach Expert",
25
- "zh": "TikTok达人建联专家"
24
+ "en": "ScoreHub AI TikTok Creator Outreach Expert",
25
+ "zh": "ScoreHub AI TikTok达人建联专家"
26
26
  },
27
27
  "displayDescription": {
28
- "en": "Find, analyze, and connect with TikTok creators at scale. Search by category/GMV/audience, rate creator performance, and batch-send outreach messages.",
29
- "zh": "TikTok达人建联专家,支持达人搜索筛选、带货数据分析、批量会话建联。"
28
+ "en": "ScoreHub AI helps TikTok Shop sellers discover creators, score recent performance, and prepare batch outreach across Southeast Asia.",
29
+ "zh": "ScoreHub AI 助力 TikTok Shop 卖家在东南亚搜索达人、评估近 30 天表现,并批量发起合作建联。"
30
30
  },
31
- "avatar": "avatars/expert.png",
31
+ "avatar": "avatars/scorehub-ai.png",
32
32
  "categoryId": "07-SalesCommerce",
33
33
  "defaultInitPrompt": {
34
- "zh": "帮我搜索适合合作的TikTok达人,类目是美妆,GMV在1000-10000美元区间",
35
- "en": "Search TikTok creators in the beauty category with GMV between $1,000-$10,000"
34
+ "zh": "我想了解 Tiky 能帮我做什么",
35
+ "en": "What can Tiky help me do?"
36
36
  },
37
37
  "plugin": "tiktok-creator-outreach",
38
38
  "tags": [
39
+ { "en": "ScoreHub AI", "zh": "ScoreHub AI" },
39
40
  { "en": "TikTok Shop", "zh": "TikTok电商" },
40
- { "en": "Creator Outreach", "zh": "达人建联" },
41
- { "en": "Affiliate Marketing", "zh": "联盟营销" }
41
+ { "en": "Creator Marketing", "zh": "达人营销" },
42
+ { "en": "Southeast Asia", "zh": "东南亚" }
42
43
  ],
43
44
  "quickPrompts": [
44
- { "en": "Search TikTok creators in the beauty category with GMV between $1,000-$10,000", "zh": "帮我搜索适合合作的TikTok达人,类目是美妆,GMV在1000-10000美元区间" },
45
- { "en": "Analyze the performance of these 10 creators and rank them", "zh": "分析这10个达人的带货表现,帮我打分排名" },
46
- { "en": "Send outreach messages to these 50 creators with my collaboration template", "zh": "用我的建联话术模板,给这50个达人批量发送合作消息" }
45
+ { "en": "What can Tiky help me do?", "zh": "我想了解 Tiky 能帮我做什么" }
47
46
  ]
48
47
  }
package/README.en.md ADDED
@@ -0,0 +1,68 @@
1
+ # @scorehub/creator-outreach
2
+
3
+ Chinese version: [README.md](./README.md)
4
+
5
+ **Tiky** is ScoreHub AI's creator outreach agent for TikTok Shop sellers. It searches creators by category, GMV, and audience profile; analyzes and ranks their sales performance; and sends outreach messages in batches. TikTok operations run through ScoreHub MCP, and ScoreHub manages the TikTok API credentials so users do not need to configure them.
6
+
7
+ ## Supported Clients
8
+
9
+ - Claude Code
10
+ - WorkBuddy
11
+
12
+ Claude Desktop is not currently supported by this installer.
13
+
14
+ ## Install
15
+
16
+ ### Prerequisites
17
+
18
+ - Node.js 18 or later
19
+ - npm and network access to the npm registry
20
+ - Claude Code or WorkBuddy installed and launched at least once
21
+
22
+ Run:
23
+
24
+ ```bash
25
+ npx -y @scorehub/creator-outreach
26
+ ```
27
+
28
+ The installer configures only clients it detects. If it finds neither Claude Code nor WorkBuddy, it exits without writing configuration files.
29
+
30
+ | Client | Detection | Installed content | How to use |
31
+ |---|---|---|---|
32
+ | Claude Code | `~/.claude/` exists | Agent definition in `~/.claude/agents/`; MCP configuration merged into `~/.claude.json` | Restart, then enter `@tiktok-creator-outreach` |
33
+ | WorkBuddy | `~/.workbuddy/` exists | Plugin files in `~/.workbuddy/plugins/.../`; MCP configuration merged into `~/.workbuddy/mcp.json` | Restart, then select “Tiky — TikTok Creator Outreach” from the Agent list |
34
+
35
+ The MCP server (`@scorehub/mcp-server`) is downloaded automatically by the configured `npx -y` command the first time it starts. A global installation is not required. WorkBuddy uses its bundled Node.js and the installer handles Windows `npx.cmd` and PATH separators.
36
+
37
+ > You can also search for `@scorehub/creator-outreach` in the WorkBuddy plugin marketplace.
38
+
39
+ ## First Use and Authorization
40
+
41
+ At the start of every new conversation, Tiky introduces its creator search, performance analysis, and batch outreach capabilities, supported Southeast Asian markets, typical use cases, and next-step options. After you choose an operation, its first TikTok call opens a browser for ScoreHub login. Tokens are then cached under `~/.scorehub/` and shared by Claude Code and WorkBuddy, so you do not need to authorize again.
42
+
43
+ If Tiky says that the current shop's TikTok authorization is invalid or unavailable, your local ScoreHub login is usually still valid. Rebind the shop in ScoreHub and try again; do not repeat browser login.
44
+
45
+ If a request is rate limited or quota limited, wait, retry in smaller batches, or narrow the operation. Reauthorization does not resolve rate limits.
46
+
47
+ ## Quick Start
48
+
49
+ Ask Tiky:
50
+
51
+ - Find TikTok creators in the beauty category with GMV between $1,000 and $10,000.
52
+ - Analyze the sales performance of these 10 creators and rank them.
53
+ - Send outreach messages to these 50 creators using my collaboration template.
54
+
55
+ ## Troubleshooting
56
+
57
+ ### No supported client found
58
+
59
+ Install and launch Claude Code or WorkBuddy once, then run the install command again. Claude Desktop is outside the current support scope.
60
+
61
+ ### MCP tools are unavailable, the tool list is empty, or the connection closes
62
+
63
+ ScoreHub is temporarily unavailable. Fully quit and reopen Claude Code or WorkBuddy, then try again. Contact ScoreHub support if the problem continues.
64
+
65
+ ## Related Links
66
+
67
+ - MCP Server: [@scorehub/mcp-server](https://www.npmjs.com/package/@scorehub/mcp-server)
68
+ - Repository: [ScoreHub-AI/creator-outreach](https://github.com/ScoreHub-AI/creator-outreach)
package/README.md CHANGED
@@ -1,38 +1,48 @@
1
1
  # @scorehub/creator-outreach
2
2
 
3
- **Tiky** — TikTok 达人建联 AI 智能体。一条命令装进 Claude Code 和 WorkBuddy。
3
+ English version: [README.en.md](./README.en.md)
4
4
 
5
- 按类目 / GMV / 粉丝画像搜索 TikTok Shop 达人,分析带货表现并打分排名,批量发送建联消息(`create_conversation` → `send_message`)。所有 TikTok API 调用通过 ScoreHub MCP 完成。
5
+ **Tiky** 是 ScoreHub AI 面向 TikTok Shop 卖家的达人建联智能体。它可按类目、GMV 和粉丝画像搜索达人,分析带货表现并排名,以及批量发送合作消息。TikTok 操作通过 ScoreHub MCP 完成,TikTok API 凭证由 ScoreHub 托管,使用者无需配置。
6
+
7
+ ## 支持的客户端
8
+
9
+ - Claude Code
10
+ - WorkBuddy
11
+
12
+ Claude Desktop 当前不受此安装器支持。
6
13
 
7
14
  ## 安装
8
15
 
9
- ```bash
10
- npx @scorehub/creator-outreach
11
- ```
16
+ ### 前置条件
12
17
 
13
- 命令会自动检测本机已安装的 AI 客户端并完成配置:
18
+ - Node.js 18 或更高版本
19
+ - npm 和可访问 npm registry 的网络
20
+ - 已安装并至少启动过 Claude Code 或 WorkBuddy
14
21
 
15
- | 客户端 | 安装内容 |
16
- |--------|----------|
17
- | **Claude Code / Claude Desktop** | Agent 定义 → `~/.claude/agents/`;MCP 配置 → `~/.claude.json` |
18
- | **WorkBuddy**(检测到 `~/.workbuddy/` 时) | 插件文件 → `~/.workbuddy/plugins/.../`;MCP 配置 → `~/.workbuddy/mcp.json` |
22
+ 运行:
19
23
 
20
- MCP Server(`@scorehub/mcp-server`)由配置中的 `npx -y` 在首次启动时自动拉取,无需单独安装。
24
+ ```bash
25
+ npx -y @scorehub/creator-outreach
26
+ ```
21
27
 
22
- 安装完成后重启客户端,即可唤起 Tiky:
28
+ 安装器只会配置已检测到的客户端;未检测到 Claude Code 或 WorkBuddy 时,会退出且不写入任何配置文件。
23
29
 
24
- - **Claude Code**:输入 `@tiktok-creator-outreach`
25
- - **WorkBuddy**:在 Agent 列表中选择 "Tiky — TikTok Creator Outreach"
30
+ | 客户端 | 检测条件 | 安装内容 | 使用方式 |
31
+ |---|---|---|---|
32
+ | Claude Code | `~/.claude/` 存在 | Agent 定义写入 `~/.claude/agents/`;MCP 配置合并到 `~/.claude.json` | 重启后输入 `@tiktok-creator-outreach` |
33
+ | WorkBuddy | `~/.workbuddy/` 存在 | 插件文件写入 `~/.workbuddy/plugins/.../`;MCP 配置合并到 `~/.workbuddy/mcp.json` | 重启后在 Agent 列表选择 “Tiky — TikTok Creator Outreach” |
34
+
35
+ MCP Server(`@scorehub/mcp-server`)由配置中的 `npx -y` 在首次启动时自动拉取,无需全局安装。WorkBuddy 会使用其捆绑的 Node.js,并自动适配 Windows 的 `npx.cmd` 与 PATH 分隔符。
26
36
 
27
37
  > 也可在 WorkBuddy 插件市场直接搜索 `@scorehub/creator-outreach` 安装。
28
38
 
29
- ## 首次使用:授权
39
+ ## 首次使用与授权
30
40
 
31
- Tiky 首次调用 TikTok 工具时会自动打开浏览器引导登录 ScoreHub。登录一次后 Token 缓存在本地(`~/.scorehub/`),Claude Code 与 WorkBuddy 共享,无需重复授权。
41
+ 每个新对话的第一轮,Tiky 会先介绍达人搜索、表现评估和批量建联三项能力,说明目前支持的东南亚市场,并给出典型用法和下一步选项。选择需要的操作后,它才会在首次调用 TikTok 功能时打开浏览器引导你登录 ScoreHub。登录后 Token 缓存在 `~/.scorehub/`,Claude Code 与 WorkBuddy 共享,无需重复授权。
32
42
 
33
- 如果 Tiky 提示当前店铺的 TikTok 授权已失效或异常,说明本地登录通常仍是正常的,但该店铺需要先到 ScoreHub 重新绑定后再继续使用。此时不用反复重新做浏览器登录。
43
+ 如果提示当前店铺的 TikTok 授权已失效或异常,本地 ScoreHub 登录通常仍然有效。请先到 ScoreHub 重新绑定店铺,再重试;不要反复进行浏览器登录。
34
44
 
35
- 如果 Tiky 提示当前请求过于频繁或配额受限,先耐心等待、分批重试或缩小本次操作范围即可,不需要为了解除限流去重新登录。只有你自己明确想重新授权时,才需要手动执行。
45
+ 如果提示请求过于频繁或配额受限,请等待、分批重试或缩小操作范围。限流不需要重新登录。
36
46
 
37
47
  ## 快速开始
38
48
 
@@ -42,6 +52,16 @@ Tiky 首次调用 TikTok 工具时会自动打开浏览器引导登录 ScoreHub
42
52
  - 分析这 10 个达人的带货表现,帮我打分排名
43
53
  - 用我的建联话术模板,给这 50 个达人批量发送合作消息
44
54
 
55
+ ## 故障排查
56
+
57
+ ### 找不到受支持的客户端
58
+
59
+ 先安装并启动 Claude Code 或 WorkBuddy 一次,再重新运行安装命令。Claude Desktop 不在当前支持范围内。
60
+
61
+ ### MCP 工具不可用、工具列表为空或连接已关闭
62
+
63
+ ScoreHub 服务暂时未连接。请完全退出并重新打开 Claude Code 或 WorkBuddy 后重试;如仍无法使用,请联系 ScoreHub 支持。
64
+
45
65
  ## 相关链接
46
66
 
47
67
  - MCP Server:[@scorehub/mcp-server](https://www.npmjs.com/package/@scorehub/mcp-server)
@@ -20,6 +20,53 @@ skills:
20
20
 
21
21
  我不是一个冷冰冰的工具。我有自己的判断——达人好不好,值不值得建联,我会告诉你我的看法,而不是把数据一丢了事。
22
22
 
23
+ ## 新会话首轮引导(最高优先级)
24
+
25
+ 每个新对话的第一条回复,**无论用户输入问候、快捷指令还是具体需求**,我都必须先完成能力介绍,不执行搜索、分析、建联或授权。不要展示工具名、技术配置、错误码或内部流程。
26
+
27
+ 首轮使用以下完整中文欢迎语,随后等待用户选择。若已知用户姓名,在开头称呼该姓名;未知时直接以“你好”开头,绝不猜测姓名:
28
+
29
+ > 你好,我是 Tiky,你的 TikTok 达人建联专属助手。以下是我能帮你做的事情:
30
+ >
31
+ > ## 三大核心能力
32
+ >
33
+ > **1. 搜索达人** — 从 TikTok Creator Marketplace 多维度筛选
34
+ > - 按品类(美妆、3C、家居等)
35
+ > - 按 GMV 区间(1K-10K / 10K+ 等)
36
+ > - 按粉丝画像(年龄、性别、地区)
37
+ > - 按用户名或昵称关键词
38
+ > - 支持翻页获取更多结果
39
+ >
40
+ > **2. 评估达人** — 拉取近 30 天详细表现并打分
41
+ > - 带货数据:GMV、销量、客单价
42
+ > - 内容表现:视频数、播放量、互动率
43
+ > - 粉丝画像:年龄、性别、地区分布
44
+ > - 为每位达人给出 100 分制综合评分和合作建议
45
+ >
46
+ > **3. 批量建联** — 自动创建会话并发送合作消息
47
+ > - 支持文本、商品卡片、定向合作邀请、免费样品邀请和图片消息
48
+ > - 文本消息支持 `{name}` / `{brand}` / `{commission}` 变量替换
49
+ > - 智能控制发送频率,降低触发频率限制的风险
50
+ >
51
+ > ## 支持的市场
52
+ >
53
+ > 东南亚六国:印度尼西亚(ID)、泰国(TH)、马来西亚(MY)、越南(VN)、菲律宾(PH)、新加坡(SG)。
54
+ >
55
+ > ## 典型用法
56
+ >
57
+ > “帮我找 5 位印尼美妆达人” → “分析一下 Babyoliv 的表现” → “给这 3 位达人批量发送建联消息,品牌名 XXX,佣金 15%”
58
+ >
59
+ > 想从哪一步开始?
60
+
61
+ 只有当前对话上下文明确包含此前搜索结果时,才在“想从哪一步开始?”之前追加以下后续建议;不得声称“上次已搜索到”或“报告在 outputs 目录”,除非上下文明确提供了这些事实:
62
+
63
+ > 你已经有一批达人搜索结果了,接下来可以让我:
64
+ > - **深入分析**某位达人的详细表现;
65
+ > - **批量建联**,请告诉我品牌名和佣金比例;
66
+ > - **换条件重新搜索**,例如换品类、换市场或增加 GMV 筛选。
67
+
68
+ 首轮回复结束后,等待用户下一条消息;从下一条消息开始,按本文件已有的授权、搜索、分析和建联规则执行。不要重复展示此欢迎语,也不要把“首次使用”状态跨会话保存。
69
+
23
70
  ## 我的灵魂
24
71
 
25
72
  - **数据驱动但不唯数据论**:GMV 高的达人未必适合你,我会结合品类匹配度、粉丝画像、内容风格做综合判断。
@@ -111,7 +158,9 @@ Step 3: 批量建联
111
158
  - `authorize` — OAuth 授权
112
159
  - `status` — 连接状态
113
160
 
114
- 如果尚未授权,我会先引导你走 `authorize` 完成 OAuth 登录。如果 MCP 工具不可用,才降级使用环境变量中的 TikTok API 凭证直接调用。
161
+ 如果尚未授权,我会先引导你走 `authorize` 完成 OAuth 登录。
162
+
163
+ 如果 ScoreHub MCP 工具不可见、工具列表为空、连接已关闭或本地 MCP 未启动,我会直接告诉你“ScoreHub 服务暂时未连接,请完全退出并重新打开 Claude Code 或 WorkBuddy 后重试;如仍无法使用,请联系 ScoreHub 支持”。不要向终端用户提及 Node.js、npm、网络、环境变量、TikTok API 凭证或直连 API,也不要调用 `authorize`。
115
164
 
116
165
  如果本地登录状态正常,但真实工具调用提示当前店铺的 TikTok 授权已失效或异常,我会直接提醒你去 ScoreHub 重新绑定该店铺后再试,不会再让你重复浏览器登录。
117
166
 
@@ -119,6 +168,7 @@ Step 3: 批量建联
119
168
 
120
169
  如果工具返回结构化错误类型,我会按以下顺序处理:
121
170
 
171
+ - 本地 MCP 不可用 → 提示“ScoreHub 服务暂时未连接,请完全退出并重新打开客户端后重试;如仍无法使用,请联系 ScoreHub 支持”;不调用 `authorize`
122
172
  - `oauth_invalid` → 允许建议 `authorize`
123
173
  - `shop_auth_invalid` → 提示去 ScoreHub 重新绑定店铺
124
174
  - `rate_limited` / `quota_exhausted` → 只提示等待、分批或缩量
Binary file
package/install.js CHANGED
@@ -6,24 +6,8 @@ const os = require('os');
6
6
  const { execSync } = require('child_process');
7
7
 
8
8
  const pkg = require('./package.json');
9
- console.log(`${pkg.name} v${pkg.version}\n`);
9
+ const MIN_NODE_MAJOR = 18;
10
10
 
11
- // === Claude Code 路径 ===
12
- const CLAUDE_DIR = path.join(os.homedir(), '.claude');
13
- const AGENTS_DIR = path.join(CLAUDE_DIR, 'agents');
14
- const CLAUDE_JSON = path.join(os.homedir(), '.claude.json');
15
-
16
- const AGENT_SRC = path.join(__dirname, 'agents', 'tiktok-creator-outreach.md');
17
- const AGENT_DEST = path.join(AGENTS_DIR, 'tiktok-creator-outreach.md');
18
-
19
- // === WorkBuddy 路径 ===
20
- const WORKBUDDY_DIR = path.join(os.homedir(), '.workbuddy');
21
- const WORKBUDDY_PLUGIN_DIR = path.join(
22
- WORKBUDDY_DIR, 'plugins', 'marketplaces', 'my-experts', 'plugins', 'tiktok-creator-outreach',
23
- );
24
- const WORKBUDDY_MCP_JSON = path.join(WORKBUDDY_DIR, 'mcp.json');
25
-
26
- // === 共享 MCP 配置 ===
27
11
  const MCP_CONFIG = {
28
12
  type: 'stdio',
29
13
  command: 'npx',
@@ -33,27 +17,49 @@ const MCP_CONFIG = {
33
17
  },
34
18
  };
35
19
 
36
- // 工具函数:解析 WorkBuddy 捆绑的 node bin 目录
37
- // WorkBuddy spawn 子进程的 PATH 不含 node,npx 及其下载的包依赖 #!/usr/bin/env node,
38
- // 找不到 node 会秒退导致 "Connection closed"。返回 npx 全路径 + bin 目录用于注入 PATH。
39
- function resolveWorkBuddyNode() {
40
- const versionsDir = path.join(WORKBUDDY_DIR, 'binaries', 'node', 'versions');
20
+ function getNodeMajorVersion(nodeVersion = process.versions.node) {
21
+ return Number.parseInt(nodeVersion.split('.')[0], 10);
22
+ }
23
+
24
+ function isSupportedNode(nodeVersion = process.versions.node) {
25
+ return getNodeMajorVersion(nodeVersion) >= MIN_NODE_MAJOR;
26
+ }
27
+
28
+ function getPaths(homeDir) {
29
+ const claudeDir = path.join(homeDir, '.claude');
30
+ const workBuddyDir = path.join(homeDir, '.workbuddy');
31
+
32
+ return {
33
+ claudeDir,
34
+ agentsDir: path.join(claudeDir, 'agents'),
35
+ claudeJson: path.join(homeDir, '.claude.json'),
36
+ workBuddyDir,
37
+ workBuddyPluginDir: path.join(
38
+ workBuddyDir, 'plugins', 'marketplaces', 'my-experts', 'plugins', 'tiktok-creator-outreach',
39
+ ),
40
+ workBuddyMcpJson: path.join(workBuddyDir, 'mcp.json'),
41
+ };
42
+ }
43
+
44
+ function resolveWorkBuddyNode(workBuddyDir) {
45
+ const versionsDir = path.join(workBuddyDir, 'binaries', 'node', 'versions');
46
+ const npxExecutable = process.platform === 'win32' ? 'npx.cmd' : 'npx';
41
47
  try {
42
48
  const versions = fs.readdirSync(versionsDir);
43
49
  if (versions.length > 0) {
44
- const binDir = path.join(versionsDir, versions[0], 'bin');
45
- const npxPath = path.join(binDir, 'npx');
46
- if (fs.existsSync(npxPath)) return { npx: npxPath, binDir };
50
+ const versionDir = path.join(versionsDir, versions[0]);
51
+ const binDirs = [path.join(versionDir, 'bin'), versionDir];
52
+ for (const binDir of binDirs) {
53
+ const npxPath = path.join(binDir, npxExecutable);
54
+ if (fs.existsSync(npxPath)) return { npx: npxPath, binDir };
55
+ }
47
56
  }
48
57
  } catch {
49
- // 目录不存在或无权限
58
+ // WorkBuddy or its bundled Node.js is not available at this path.
50
59
  }
51
60
  return { npx: 'npx', binDir: null };
52
61
  }
53
62
 
54
- // 工具函数:查询 mcp-server 在 npm registry 的当前最新版本
55
- // 注意:这是 install 此刻的最新版;实际 MCP 拉起时由 npx 现场解析 @latest,
56
- // 若之后 registry 更新,运行时版本可能与此不同。失败时静默返回 null(不阻断安装)。
57
63
  function fetchLatestMcpServerVersion() {
58
64
  try {
59
65
  const out = execSync('npm view @scorehub/mcp-server version', {
@@ -67,91 +73,107 @@ function fetchLatestMcpServerVersion() {
67
73
  }
68
74
  }
69
75
 
70
- // 工具函数:合并 MCP Server 配置到 JSON 文件
71
76
  function mergeMcpConfig(configPath, serverName, serverConfig, extraFields) {
72
77
  let config = {};
73
78
  if (fs.existsSync(configPath)) {
74
79
  try {
75
80
  config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
76
81
  } catch {
77
- console.warn(`警告:${configPath} 解析失败,将重新写入`);
82
+ console.warn(`Warning: ${configPath} could not be parsed and will be replaced.`);
78
83
  }
79
84
  }
80
85
 
81
86
  config.mcpServers = config.mcpServers || {};
82
87
  config.mcpServers[serverName] = Object.assign({}, serverConfig, extraFields);
83
-
84
88
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
85
89
  }
86
90
 
87
- // ========== Claude Code ==========
88
-
89
- // 1. 复制 Agent 定义文件
90
- fs.mkdirSync(AGENTS_DIR, { recursive: true });
91
- fs.copyFileSync(AGENT_SRC, AGENT_DEST);
92
- console.log(`✓ Claude Code: Agent 已安装 → ${AGENT_DEST}`);
91
+ function install({
92
+ homeDir = os.homedir(),
93
+ nodeVersion = process.versions.node,
94
+ getLatestMcpServerVersion = fetchLatestMcpServerVersion,
95
+ } = {}) {
96
+ console.log(`${pkg.name} v${pkg.version}\n`);
93
97
 
94
- // 2. 合并 MCP Server 配置到 ~/.claude.json
95
- mergeMcpConfig(CLAUDE_JSON, 'scorehub', MCP_CONFIG, {});
96
- console.log(`✓ Claude Code: MCP Server 已配置 → ${CLAUDE_JSON}`);
97
-
98
- // ========== WorkBuddy ==========
99
-
100
- const hasWorkBuddy = fs.existsSync(WORKBUDDY_DIR);
98
+ if (!isSupportedNode(nodeVersion)) {
99
+ console.error(`Node.js ${MIN_NODE_MAJOR}+ is required. Detected ${nodeVersion}. No configuration files were changed.`);
100
+ return 1;
101
+ }
101
102
 
102
- if (hasWorkBuddy) {
103
- // 3. 复制插件文件到 WorkBuddy 插件目录
104
- const pluginDirs = ['.codebuddy-plugin', 'agents', 'skills', 'avatars'];
105
- const pluginFiles = ['package.json', 'README.md'];
103
+ const paths = getPaths(homeDir);
104
+ const hasClaudeCode = fs.existsSync(paths.claudeDir);
105
+ const hasWorkBuddy = fs.existsSync(paths.workBuddyDir);
106
106
 
107
- fs.mkdirSync(WORKBUDDY_PLUGIN_DIR, { recursive: true });
107
+ if (!hasClaudeCode && !hasWorkBuddy) {
108
+ console.error('No supported client was found. Launch Claude Code or WorkBuddy once, then run this command again. No configuration files were changed.');
109
+ return 1;
110
+ }
108
111
 
109
- for (const dir of pluginDirs) {
110
- const src = path.join(__dirname, dir);
111
- const dest = path.join(WORKBUDDY_PLUGIN_DIR, dir);
112
- if (fs.existsSync(src)) {
113
- fs.cpSync(src, dest, { recursive: true });
114
- }
112
+ if (hasClaudeCode) {
113
+ const agentSource = path.join(__dirname, 'agents', 'tiktok-creator-outreach.md');
114
+ const agentDestination = path.join(paths.agentsDir, 'tiktok-creator-outreach.md');
115
+ fs.mkdirSync(paths.agentsDir, { recursive: true });
116
+ fs.copyFileSync(agentSource, agentDestination);
117
+ mergeMcpConfig(paths.claudeJson, 'scorehub', MCP_CONFIG, {});
118
+ console.log(`Claude Code: Agent installed at ${agentDestination}`);
119
+ console.log(`Claude Code: MCP server configured at ${paths.claudeJson}`);
115
120
  }
116
121
 
117
- for (const file of pluginFiles) {
118
- const src = path.join(__dirname, file);
119
- const dest = path.join(WORKBUDDY_PLUGIN_DIR, file);
120
- if (fs.existsSync(src)) {
121
- fs.copyFileSync(src, dest);
122
+ if (hasWorkBuddy) {
123
+ const pluginDirs = ['.codebuddy-plugin', 'agents', 'skills', 'avatars'];
124
+ const pluginFiles = ['package.json', 'README.md', 'README.en.md'];
125
+
126
+ fs.mkdirSync(paths.workBuddyPluginDir, { recursive: true });
127
+ for (const dir of pluginDirs) {
128
+ const source = path.join(__dirname, dir);
129
+ const destination = path.join(paths.workBuddyPluginDir, dir);
130
+ if (fs.existsSync(source)) {
131
+ fs.cpSync(source, destination, { recursive: true });
132
+ }
122
133
  }
123
- }
124
134
 
125
- console.log(`✓ WorkBuddy: 插件文件已安装 → ${WORKBUDDY_PLUGIN_DIR}`);
126
-
127
- // 4. 合并 MCP Server 配置到 ~/.workbuddy/mcp.json
128
- // - 去掉 type 字段(WorkBuddy 不识别)
129
- // - command 用 npx 全路径(WorkBuddy PATH 不含系统 npx)
130
- // - env.PATH 注入 node bin 目录(否则 npx 及其子进程的 shebang 找不到 node,秒退报 Connection closed)
131
- const { npx, binDir } = resolveWorkBuddyNode();
132
- const { type: _, ...baseMCPConfig } = MCP_CONFIG;
133
- const wbEnv = binDir
134
- ? Object.assign({}, MCP_CONFIG.env, { PATH: `${binDir}:/usr/local/bin:/usr/bin:/bin` })
135
- : MCP_CONFIG.env;
136
- const wbMCPConfig = Object.assign({}, baseMCPConfig, { command: npx, env: wbEnv });
137
- mergeMcpConfig(WORKBUDDY_MCP_JSON, 'scorehub', wbMCPConfig, { disabled: false });
138
- console.log(`✓ WorkBuddy: MCP Server 已配置 → ${WORKBUDDY_MCP_JSON}`);
139
- }
135
+ for (const file of pluginFiles) {
136
+ const source = path.join(__dirname, file);
137
+ const destination = path.join(paths.workBuddyPluginDir, file);
138
+ if (fs.existsSync(source)) {
139
+ fs.copyFileSync(source, destination);
140
+ }
141
+ }
140
142
 
141
- // ========== 完成 ==========
143
+ const { npx, binDir } = resolveWorkBuddyNode(paths.workBuddyDir);
144
+ const { type: _, ...baseMcpConfig } = MCP_CONFIG;
145
+ const existingPath = process.env.PATH || process.env.Path || '';
146
+ const env = binDir
147
+ ? Object.assign({}, MCP_CONFIG.env, { PATH: [binDir, existingPath].filter(Boolean).join(path.delimiter) })
148
+ : MCP_CONFIG.env;
149
+ const workBuddyMcpConfig = Object.assign({}, baseMcpConfig, { command: npx, env });
150
+ mergeMcpConfig(paths.workBuddyMcpJson, 'scorehub', workBuddyMcpConfig, { disabled: false });
151
+ console.log(`WorkBuddy: Plugin installed at ${paths.workBuddyPluginDir}`);
152
+ console.log(`WorkBuddy: MCP server configured at ${paths.workBuddyMcpJson}`);
153
+ }
142
154
 
143
- const platforms = ['Claude Code'];
144
- if (hasWorkBuddy) platforms.push('WorkBuddy');
155
+ const mcpServerVersion = getLatestMcpServerVersion();
156
+ if (mcpServerVersion) {
157
+ console.log(`\nmcp-server latest version: v${mcpServerVersion} (npx resolves @latest again when it starts).`);
158
+ } else {
159
+ console.log('\nmcp-server: @latest (the current version could not be queried).');
160
+ }
145
161
 
146
- const mcpServerVersion = fetchLatestMcpServerVersion();
147
- if (mcpServerVersion) {
148
- console.log(`\n→ mcp-server 当前最新版本:v${mcpServerVersion}(运行时由 npx 解析 @latest,届时可能更新)`);
149
- } else {
150
- console.log('\n→ mcp-server:@latest(运行时由 npx 解析,未能查询到具体版本号)');
162
+ const platforms = [];
163
+ if (hasClaudeCode) platforms.push('Claude Code');
164
+ if (hasWorkBuddy) platforms.push('WorkBuddy');
165
+ console.log(`\nInstallation complete. Restart ${platforms.join(' / ')} and use Tiky.`);
166
+ return 0;
151
167
  }
152
168
 
153
- console.log(`\n安装完成!重启 ${platforms.join(' / ')} 后使用 Tiky。`);
154
- if (!hasWorkBuddy) {
155
- console.log('提示:未检测到 WorkBuddy,仅安装了 Claude Code。如需 WorkBuddy 支持请先安装 WorkBuddy 后重新运行本命令。');
169
+ if (require.main === module) {
170
+ process.exitCode = install();
156
171
  }
157
172
 
173
+ module.exports = {
174
+ MIN_NODE_MAJOR,
175
+ getNodeMajorVersion,
176
+ getPaths,
177
+ install,
178
+ isSupportedNode,
179
+ };
package/package.json CHANGED
@@ -1,14 +1,21 @@
1
1
  {
2
2
  "name": "@scorehub/creator-outreach",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "ScoreHub Tiky 智能体 — Agent 定义 + Skills 配置",
5
+ "engines": {
6
+ "node": ">=18"
7
+ },
5
8
  "files": [
6
9
  ".codebuddy-plugin",
7
10
  "agents",
8
11
  "skills",
9
12
  "avatars",
10
- "install.js"
13
+ "install.js",
14
+ "README.en.md"
11
15
  ],
16
+ "scripts": {
17
+ "test": "node --test test/install.test.js"
18
+ },
12
19
  "bin": {
13
20
  "creator-outreach": "./install.js"
14
21
  },
@@ -24,6 +24,8 @@
24
24
  1. **建会话**:调用 **`create_conversation`**,入参 `creator_open_id`(来自搜索结果),返回 `conversation_id`。
25
25
  2. **发消息**:调用 **`send_message`**,入参 `conversation_id` + `msg_type: "TEXT"` + `content`(模板填充后的文本)。
26
26
 
27
+ 如果 ScoreHub MCP 工具不可见、工具列表为空、连接已关闭或本地 MCP 未启动,直接提示用户:“ScoreHub 服务暂时未连接,请完全退出并重新打开 Claude Code 或 WorkBuddy 后重试;如仍无法使用,请联系 ScoreHub 支持。”不要向终端用户提及 Node.js、npm、网络、环境变量、TikTok API 凭证或直连 API,也不要调用 `authorize`。
28
+
27
29
  如果工具返回结构化 JSON,优先按 `error_type` 做分流,不要靠自然语言错误文本猜测。
28
30
 
29
31
  如果本地登录状态正常,但工具提示当前店铺的 TikTok 授权失效或异常,直接提醒用户去 ScoreHub 重新绑定该店铺后再试;不要展示错误码,也不要要求用户重复执行 `authorize`。
@@ -47,17 +49,11 @@
47
49
  - `create_conversation` 必须用 **`creator_open_id`**(不是 `creator_user_id`)。
48
50
  - `creator_open_id` **仅来自搜索接口**,分析接口不返回——务必从搜索结果透传。
49
51
 
50
- ## 降级:直接 API
51
-
52
- ```
53
- POST /affiliate_seller/202508/conversations Body: {"creator_open_id": "xxx"}
54
- POST /affiliate_seller/202412/conversations/{id}/messages Body: {"msg_type":"TEXT","content":"{\"content\":\"...\"}"}
55
- ```
56
-
57
52
  ## 错误处理
58
53
 
59
54
  | 问题类型 | 处理 |
60
55
  |----------|------|
56
+ | MCP 工具不可见、工具列表为空、连接关闭或本地 MCP 未启动 | 提示“ScoreHub 服务暂时未连接,请完全退出并重新打开客户端后重试;如仍无法使用,请联系 ScoreHub 支持。”不提及技术配置,不走 `authorize` |
61
57
  | `oauth_invalid` | 仅在真正未授权或本地 OAuth 失效时,才允许提示用户调用 `authorize` |
62
58
  | 当前店铺的 TikTok 授权失效或异常 | 用中文提醒用户:本地登录状态正常,但当前店铺需要先到 ScoreHub 重新绑定后再试;不要展示错误码,不要要求重复 `authorize` |
63
59
  | 建会话入参不对或达人标识无效 | 检查传入的是来自搜索结果的 `creator_open_id` |
@@ -15,6 +15,8 @@
15
15
  对候选达人**逐个**调用 MCP 工具 **`creator_performance`**(入参 `creator_user_id`),拿到表现数据后应用
16
16
  [评分模型](./references/scoring-model.md) 打分排序。批量分析属多步操作,先与用户确认名单再执行。
17
17
 
18
+ 如果 ScoreHub MCP 工具不可见、工具列表为空、连接已关闭或本地 MCP 未启动,直接提示用户:“ScoreHub 服务暂时未连接,请完全退出并重新打开 Claude Code 或 WorkBuddy 后重试;如仍无法使用,请联系 ScoreHub 支持。”不要向终端用户提及 Node.js、npm、网络、环境变量、TikTok API 凭证或直连 API,也不要调用 `authorize`。
19
+
18
20
  如果工具返回结构化 JSON,优先按 `error_type` 做分流,不要靠自然语言错误文本猜测。
19
21
 
20
22
  如果本地登录状态正常,但工具提示当前店铺的 TikTok 授权失效或异常,直接提醒用户去 ScoreHub 重新绑定该店铺后再试;不要展示错误码,也不要要求用户重复执行 `authorize`。
@@ -39,21 +41,11 @@
39
41
  完整归一化公式、标签体系(💎带货王者 / 🎬内容高手 / 🎯精准美妆 / 📢大V 等)、以及 MCP 字段与
40
42
  原始接口字段的映射说明,见 [references/scoring-model.md](./references/scoring-model.md)。
41
43
 
42
- ## 降级:直接 API
43
-
44
- MCP 不可用时降级调用:
45
-
46
- ```
47
- GET https://open-api.tiktokglobalshop.com/affiliate_seller/202508/marketplace_creators/{creator_open_id}
48
- ```
49
-
50
- > 注意:详情接口不返回 `creator_open_id`,需从搜索结果透传。原始接口返回字段(`gmv.amount` 为字符串、
51
- > `avg_commission_rate` 单位 1/100、`follower_gender.value` 为小数)与评分公式的对应关系见 references。
52
-
53
44
  ## 错误处理
54
45
 
55
46
  | 问题类型 | 处理 |
56
47
  |----------|------|
48
+ | MCP 工具不可见、工具列表为空、连接关闭或本地 MCP 未启动 | 提示“ScoreHub 服务暂时未连接,请完全退出并重新打开客户端后重试;如仍无法使用,请联系 ScoreHub 支持。”不提及技术配置,不走 `authorize` |
57
49
  | `oauth_invalid` | 仅在真正未授权或本地 OAuth 失效时,才允许提示用户调用 `authorize` |
58
50
  | 当前店铺的 TikTok 授权失效或异常 | 用中文提醒用户:本地登录状态正常,但当前店铺需要先到 ScoreHub 重新绑定后再试;不要展示错误码,不要要求重复 `authorize` |
59
51
  | 达人当前不可分析(如无电商权限或区域不匹配) | 跳过该达人,并说明当前达人不满足分析条件 |
@@ -33,6 +33,8 @@
33
33
 
34
34
  调用 MCP 工具 **`search_creators`**,不要写脚本。若已授权可直接调用;未授权时先走 `authorize`。
35
35
 
36
+ 如果 ScoreHub MCP 工具不可见、工具列表为空、连接已关闭或本地 MCP 未启动,直接提示用户:“ScoreHub 服务暂时未连接,请完全退出并重新打开 Claude Code 或 WorkBuddy 后重试;如仍无法使用,请联系 ScoreHub 支持。”不要向终端用户提及 Node.js、npm、网络、环境变量、TikTok API 凭证或直连 API,也不要调用 `authorize`。
37
+
36
38
  如果工具返回结构化 JSON,优先按 `error_type` 做分流,不要靠自然语言错误文本猜测。
37
39
 
38
40
  如果本地登录状态正常,但工具提示当前店铺的 TikTok 授权失效或异常,直接提醒用户去 ScoreHub 重新绑定该店铺后再试;不要展示错误码,也不要要求用户重复执行 `authorize`。
@@ -66,17 +68,6 @@
66
68
  2. 回退到更浅的类目层级重搜:把所传的深层子类目换成其**父类目**(只传 `parent_category_id`)重新 `search_creators`;仍零重叠时再上溯一级到顶级父类目。
67
69
  - 若有重叠,说明过滤生效,正常展示。
68
70
 
69
- ## 降级:直接 API
70
-
71
- MCP 不可用时,降级用环境变量凭证直接调用:
72
-
73
- ```
74
- POST https://open-api.tiktokglobalshop.com/affiliate_seller/202508/marketplace_creators/search
75
- ```
76
-
77
- - 签名:HMAC-SHA256,body 为空 `{}` 时不参与签名;compact JSON `separators=(",", ":")`
78
- - 类目 ID 应通过 `GET /product/202309/categories` 获取,不要硬编码。MCP 可用时用 `get_categories` 工具。注意达人搜索的 `category` 只认「父类目 + 直接下一级子类目」,深层叶子无效;已知父类目段 ID 形如 `600001`(6 位),可作层级参考。
79
-
80
71
  ## 市场限制
81
72
 
82
73
  当前仅支持以下东南亚市场:
@@ -96,6 +87,7 @@ POST https://open-api.tiktokglobalshop.com/affiliate_seller/202508/marketplace_c
96
87
 
97
88
  | 问题类型 | 处理 |
98
89
  |----------|------|
90
+ | MCP 工具不可见、工具列表为空、连接关闭或本地 MCP 未启动 | 提示“ScoreHub 服务暂时未连接,请完全退出并重新打开客户端后重试;如仍无法使用,请联系 ScoreHub 支持。”不提及技术配置,不走 `authorize` |
99
91
  | `oauth_invalid` | 仅在真正未授权或本地 OAuth 失效时,才允许提示用户调用 `authorize` |
100
92
  | 当前店铺的 TikTok 授权失效或异常 | 用中文提醒用户:本地登录状态正常,但当前店铺需要先到 ScoreHub 重新绑定后再试;不要展示错误码,不要要求重复 `authorize` |
101
93
  | 日配额已用完 | 明确告知用户,停止 |