@geoly-ai/social-hub-cli 0.0.6 → 0.0.8

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 (36) hide show
  1. package/dist/register-skills.d.ts.map +1 -1
  2. package/dist/register-skills.js +24 -6
  3. package/dist/register-skills.js.map +1 -1
  4. package/dist/skills/doctor.js +1 -1
  5. package/dist/skills/doctor.js.map +1 -1
  6. package/dist/skills/target-detector.d.ts +8 -1
  7. package/dist/skills/target-detector.d.ts.map +1 -1
  8. package/dist/skills/target-detector.js +69 -34
  9. package/dist/skills/target-detector.js.map +1 -1
  10. package/dist/skills/target-detector.test.d.ts +2 -0
  11. package/dist/skills/target-detector.test.d.ts.map +1 -0
  12. package/dist/skills/target-detector.test.js +64 -0
  13. package/dist/skills/target-detector.test.js.map +1 -0
  14. package/dist/skills/tui.d.ts +19 -1
  15. package/dist/skills/tui.d.ts.map +1 -1
  16. package/dist/skills/tui.js +120 -28
  17. package/dist/skills/tui.js.map +1 -1
  18. package/dist/skills/tui.test.d.ts +2 -0
  19. package/dist/skills/tui.test.d.ts.map +1 -0
  20. package/dist/skills/tui.test.js +37 -0
  21. package/dist/skills/tui.test.js.map +1 -0
  22. package/package.json +3 -3
  23. package/skills/README.md +20 -14
  24. package/skills/manifest.json +1 -1
  25. package/skills/social-hub-accounts/SKILL.md +14 -9
  26. package/skills/social-hub-admin/SKILL.md +15 -8
  27. package/skills/social-hub-calendar-jobs/SKILL.md +18 -9
  28. package/skills/social-hub-cli/SKILL.md +116 -242
  29. package/skills/social-hub-cli/evals/evals.json +6 -6
  30. package/skills/social-hub-intelligence/SKILL.md +12 -7
  31. package/skills/social-hub-migration/SKILL.md +8 -5
  32. package/skills/social-hub-openclaw-context/SKILL.md +11 -8
  33. package/skills/social-hub-ops-runtime/SKILL.md +11 -9
  34. package/skills/social-hub-posts/SKILL.md +10 -7
  35. package/skills/social-hub-publishing/SKILL.md +5 -2
  36. package/skills/social-hub-shared/SKILL.md +124 -22
@@ -1,363 +1,237 @@
1
1
  ---
2
2
  name: social-hub-cli
3
3
  description: >-
4
- Social Ops Hub 命令行 social-hub:账号、事件、日历、调度任务、Reddit 帖、报告、API Key、OpenClaw 回填等。
4
+ Social Ops Hub 命令行 social-hub:账号、事件、日历、调度任务、Reddit 帖、报告、OpenClaw 回填等。
5
5
  只要用户提到 social-hub、Social Ops Hub、Hub 写数据、查账号、发帖计划、permalink 回填、openclaw、
6
- 调度任务、团队 API Key、互动事件,或要在 Hub 里查/改运营数据,就应使用本 skill(即使用户没说 CLI)。
7
- 先读本 skill 做路由,再打开对应领域 skill(ops-runtime、openclaw-context 等)。
6
+ 调度任务、互动事件,或要在 Hub 里查/改运营数据,就应使用本 skill(即使用户没说 CLI)。
7
+ 先读本 skill 做路由;执行任何命令前必须先读 social-hub-shared 完成 auth login 与 context
8
8
  metadata:
9
- cliVersion: ">=0.0.4"
10
- homepage: https://github.com/your-org/social-ops-hub/tree/main/skills
9
+ cliVersion: ">=0.0.6"
10
+ homepage: https://github.com/geoly-ai/geoly-reddit/tree/main/social-ops-hub/skills
11
11
  ---
12
12
 
13
13
  # Social Hub CLI
14
14
 
15
- `social-hub` 封装 Social Ops Hub REST API,供人工与 Agent 使用。配套领域 skill 与本目录同级(`skills/social-hub-*`)。
15
+ `social-hub` 封装 Social Ops Hub REST API,供人工与 Agent 使用。
16
16
 
17
- ## 安装 Skill
17
+ > **前置条件:** 执行 Hub 命令前 MUST 先读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
18
+ > 完成 `social-hub auth login`(Device Code)并 `social-hub context use <team-id>`。
19
+ > 日常**不要**使用 `SOCIAL_HUB_API_KEY` / `SOCIAL_HUB_API_URL` 环境变量。
18
20
 
19
- - **推荐(CLI)**:`social-hub skills tui` 或 `social-hub skills install --agent cursor --global --yes`
21
+ ## 快速开始(生产)
22
+
23
+ ```bash
24
+ social-hub auth login --api-url https://reddit.eclick-geo.com/api
25
+ social-hub auth whoami
26
+ social-hub context use <team-uuid>
27
+ social-hub doctor
28
+ social-hub health
29
+ ```
30
+
31
+ 生产 API 基址:**`https://reddit.eclick-geo.com/api`**。下文示例中 `<team-id>` 指当前 context 的 team UUID。
32
+
33
+ ## 安装 CLI 与 Skill
34
+
35
+ ```bash
36
+ npm install -g @geoly-ai/social-hub-cli@latest
37
+ social-hub version
38
+ ```
39
+
40
+ 安装 Agent Skills:
41
+
42
+ - **交互式(推荐,默认)**:`social-hub skills install` 或 `social-hub skills install <skillId>`(TTY 下打开 TUI,CLI 参数会预填 agent/skill/scope)
43
+ - **Cursor 全局(脚本)**:`social-hub skills install --agent cursor --global --yes`
44
+ - **单 skill 脚本化**:`social-hub skills install social-hub-cli --agent cursor --global --yes`
45
+ - **更新已装 skills**:`social-hub skills update --agent cursor --global --yes`
46
+ - **所有已检测 agent 目录(显式 opt-in)**:`social-hub skills install --agent '*' --global --yes`
20
47
  - **免全局安装**:`npx @geoly-ai/social-hub-cli skills bootstrap`
21
- - **GitHub 最新**:`social-hub skills install --source github --repo geoly-ai/geoly-reddit --yes`
22
- - **更新已装 skill**:`social-hub skills update --all --yes`(可加 `--source github`)
48
+ - **GitHub 最新**:`social-hub skills install --source github --repo geoly-ai/geoly-reddit --agent cursor --global --yes`
23
49
  - **检查状态**:`social-hub skills doctor`
24
- - **同仓开发**:`pnpm skills:install`(或 `pnpm --filter @geoly-ai/social-hub-cli run build` 后使用内置 bundle)
25
- - **skill.sh / 公开市场**:从 [skill.sh](https://skill.sh) 导入本仓库 `skills/` 子目录(见 `skills/README.md`)
26
50
 
27
- ## 领域 Skill 路由(先读子 skill)
51
+ ## 领域 Skill 路由
28
52
 
29
53
  | 场景 | Skill |
30
54
  |------|--------|
31
- | 配置 / doctor / auth | `social-hub-shared` |
55
+ | 鉴权 / config / doctor / context | **`social-hub-shared`**(必读) |
32
56
  | OpenClaw 领任务 / 回填 | `social-hub-ops-runtime` |
33
57
  | 账号/任务上下文(DB) | `social-hub-openclaw-context` |
34
58
  | 账号 CRUD | `social-hub-accounts` |
35
59
  | Reddit 帖 | `social-hub-posts` |
36
60
  | 日历 / jobs | `social-hub-calendar-jobs` |
37
61
  | 发布闭环 | `social-hub-publishing` |
38
- | settings / invites | `social-hub-admin` |
62
+ | settings / invites / 成员 | `social-hub-admin` |
39
63
  | 情报 | `social-hub-intelligence` |
40
64
  | 导入导出 replay | `social-hub-migration` |
41
65
 
42
- `social-hub` Social Ops Hub 的命令行工具,封装了全部 REST API
66
+ 命中上表场景时,打开对应领域 skill,**不要**只在总览里硬写命令而跳过子 skill
43
67
 
44
- ## 配置(环境变量)
68
+ ## 同仓开发 Build
45
69
 
46
- 使用前需设置以下环境变量:
70
+ 在 **social-ops-hub monorepo** 内改 CLI/SDK 后:
47
71
 
48
72
  ```bash
49
- export SOCIAL_HUB_API_URL="http://localhost:3000" # Hub API 地址,默认 localhost:3000
50
- export SOCIAL_HUB_API_KEY="soh_..." # API Key(除 health 外均必需)
51
- export SOCIAL_HUB_TEAM_ID="<uuid>" # 当前操作的 Team UUID(命令中用 $SOCIAL_HUB_TEAM_ID)
52
- ```
53
-
54
- `health` 命令不需要 API Key。其他所有命令必须设置 `SOCIAL_HUB_API_KEY`。
55
-
56
- ## 前置步骤:Build
57
-
58
- 在 **本 monorepo 根目录** 首次使用或更新代码后,需先 build:
59
-
60
- ```bash
61
- cd "$(git rev-parse --show-toplevel)"
62
73
  pnpm --filter @geoly-ai/social-hub-sdk run build
63
74
  pnpm --filter @geoly-ai/social-hub-cli run build
64
75
  ```
65
76
 
66
- ---
67
-
68
- ## 初始化工作流(新环境冷启动)
77
+ ## 本地 API 冷启动(仅开发)
69
78
 
70
- ### 步骤 0:部署前置
79
+ 部署/seed 细节见仓库文档;CLI 侧只需改 API 地址并重新 login:
71
80
 
72
81
  ```bash
73
- # 1. 复制并填写环境变量
74
- cp .env.example .env
75
- # 至少填写:DATABASE_URL、REDIS_URL、API_KEY_PEPPER、JWT_SECRET
76
-
77
- # 2. 执行数据库迁移
82
+ cp .env.example .env # 填写 DATABASE_URL、REDIS_URL 等
78
83
  pnpm run db:migrate
79
-
80
- # 3. 初始化最小管理员种子(自动创建 moss team + admin 用户 + seed-cli API Key)
81
84
  SOCIAL_OPS_SEED_MODE=minimal-admin pnpm run db:seed
82
- # 控制台输出:
83
- # admin@local.test / password123
84
- # SOCIAL_HUB_TEAM_ID=<uuid>
85
- # SOCIAL_HUB_API_KEY=soh_...
86
-
87
- # 4. 导出环境变量(或写入 .env)
88
- export SOCIAL_HUB_API_URL="http://localhost:3000"
89
- export SOCIAL_HUB_API_KEY="soh_..." # 从上面控制台复制
90
- export SOCIAL_HUB_TEAM_ID="<moss-team-uuid>" # 从上面控制台复制
91
-
92
- # 5. 验证 Hub 是否正常
85
+ pnpm dev
86
+ social-hub auth login --api-url http://localhost:3000
87
+ social-hub context use <seed 输出的 team uuid>
93
88
  social-hub health
94
89
  ```
95
90
 
96
- ### 步骤 1:创建新团队(若需要独立 team)
97
-
98
- ```bash
99
- # 使用 admin API Key 创建新团队
100
- NEW_TEAM=$(social-hub agent-teams create --slug javis --name "Javis Agent Team" | jq -r '.id')
101
- export T=$NEW_TEAM
102
-
103
- # 创建运营用户(密码直接设置,不需要 set-password 额外操作)
104
- social-hub users create -t $T -j '{"email":"ops@javis.local","password":"Ops2026!","name":"Javis Ops","role":"manager"}'
91
+ 创建新 team、用户等业务初始化:在 **已 auth login 且 role 足够** 的前提下执行下方「团队与用户管理」命令;**不要**再 export API Key。
105
92
 
106
- # 为新团队创建 API Key(Web 登录后进入 API Keys 页面,或用 admin key)
107
- social-hub api-keys create -t $T -j '{"name":"javis-ops","role":"manager"}'
108
- # → 记录返回的 rawKey,后续操作换用该 Key
109
-
110
- export SOCIAL_HUB_TEAM_ID=$T
111
- export SOCIAL_HUB_API_KEY="soh_..." # 上面新建的 Key
112
-
113
- # 确认团队列表
114
- social-hub agent-teams list
115
- ```
116
-
117
- ### 步骤 2:创建业务数据(Brand → Campaign → Account → Plan)
93
+ ### 业务数据初始化示例
118
94
 
119
95
  ```bash
120
- T=$SOCIAL_HUB_TEAM_ID
121
-
122
- # 创建品牌
123
- BRAND_ID=$(social-hub brands create -t $T -j '{"name":"My Brand","slug":"my-brand"}' | jq -r '.id')
124
-
125
- # 创建 Campaign
126
- CAMP_ID=$(social-hub campaigns create -t $T -j \
127
- "{\"brandId\":\"$BRAND_ID\",\"name\":\"2026 Q3 Launch\"}" | jq -r '.id')
128
-
129
- # 添加 Reddit 账号
130
- ACCOUNT_ID=$(social-hub accounts create -t $T -j \
131
- "{\"platform\":\"reddit\",\"handle\":\"u/my_ops_account\",\"credentialsRef\":\"vault:javis/main\"}" | jq -r '.id')
132
-
133
- # 创建内容草稿
134
- DRAFT_ID=$(social-hub drafts create -t $T -j \
135
- "{\"campaignId\":\"$CAMP_ID\",\"title\":\"Launch Post\",\"body\":\"...\"}" | jq -r '.id')
136
-
137
- # 创建发布计划(自动生成 scheduled_jobs)
138
- social-hub plans create -t $T -j "{
139
- \"campaignId\": \"$CAMP_ID\",
140
- \"name\": \"Q3 Week 1\",
141
- \"entries\": [{
142
- \"socialAccountId\": \"$ACCOUNT_ID\",
143
- \"subreddit\": \"LocalLLaMA\",
144
- \"plannedAt\": \"2026-07-01T09:00:00Z\",
145
- \"contentDraftId\": \"$DRAFT_ID\"
146
- }]
147
- }"
148
-
149
- # 验证:查看日历和任务
150
- social-hub calendar list -t $T --status scheduled
151
- social-hub jobs list -t $T --status scheduled
96
+ # 创建品牌 → campaign → 账号 → 计划(<team-id> 来自 context current)
97
+ BRAND_ID=$(social-hub brands create -t <team-id> -j '{"name":"My Brand","slug":"my-brand"}' | jq -r '.id')
98
+ CAMP_ID=$(social-hub campaigns create -t <team-id> -j "{\"brandId\":\"$BRAND_ID\",\"name\":\"2026 Q3 Launch\"}" | jq -r '.id')
99
+ ACCOUNT_ID=$(social-hub accounts create -t <team-id> -j '{"platform":"reddit","handle":"u/my_ops_account","credentialsRef":"vault:javis/main"}' | jq -r '.id')
100
+ DRAFT_ID=$(social-hub drafts create -t <team-id> -j "{\"campaignId\":\"$CAMP_ID\",\"title\":\"Launch Post\",\"body\":\"...\"}" | jq -r '.id')
101
+ social-hub plans create -t <team-id> -j "{\"campaignId\":\"$CAMP_ID\",\"name\":\"Q3 Week 1\",\"entries\":[{\"socialAccountId\":\"$ACCOUNT_ID\",\"subreddit\":\"LocalLLaMA\",\"plannedAt\":\"2026-07-01T09:00:00Z\",\"contentDraftId\":\"$DRAFT_ID\"}]}"
102
+ social-hub calendar list -t <team-id> --status scheduled
103
+ social-hub jobs list -t <team-id> --status scheduled
152
104
  ```
153
105
 
154
106
  ---
155
107
 
156
108
  ## 命令速查表
157
109
 
110
+ 以下 `-t <team-id>` 可换为 `social-hub context current` 中的 `currentTeamId`。
111
+
158
112
  ### health & dashboard
159
113
 
160
114
  ```bash
161
115
  social-hub health
162
- social-hub dashboard summary -t $T
163
- social-hub dashboard summary -t $T # 支持 campaignId 过滤(通过 API 传参)
116
+ social-hub dashboard summary -t <team-id>
164
117
  ```
165
118
 
166
119
  ### 互动事件
167
120
 
168
121
  ```bash
169
- social-hub events append -t $T --type comment --payload '{"permalink":"https://..."}'
170
- social-hub events list -t $T -n 20 # 简单列表
171
- social-hub events list-full -t $T --account <uuid> # 按账号过滤
172
- social-hub events list-full -t $T --type comment --result succeeded --from 2026-05-01T00:00:00Z
173
- social-hub events export-csv -t $T > events.csv
174
- social-hub events export-csv -t $T --account <uuid> --from 2026-05-01T00:00:00Z > filtered.csv
122
+ social-hub events append -t <team-id> --type comment --payload '{"permalink":"https://..."}'
123
+ social-hub events list -t <team-id> -n 20
124
+ social-hub events list-full -t <team-id> --account <uuid>
125
+ social-hub events export-csv -t <team-id> > events.csv
175
126
  ```
176
127
 
177
128
  ### 发布日历
178
129
 
179
130
  ```bash
180
- social-hub calendar list -t $T --status scheduled
181
- social-hub calendar list-full -t $T --account <accountId> --status scheduled
182
- social-hub calendar patch -t $T -e <entryId> --body '{"status":"succeeded","permalink":"https://..."}'
131
+ social-hub calendar list -t <team-id> --status scheduled
132
+ social-hub calendar list-full -t <team-id> --account <accountId> --status scheduled
133
+ social-hub calendar patch -t <team-id> -e <entryId> --body '{"status":"succeeded","permalink":"https://..."}'
183
134
  ```
184
135
 
185
136
  ### 调度任务
186
137
 
187
138
  ```bash
188
- social-hub jobs list -t $T --status scheduled
189
- social-hub jobs list-full -t $T --account <accountId>
190
- social-hub jobs create -t $T -j '{"socialAccountId":"<uuid>","action":"engage","subreddit":"LocalLLaMA","runAt":"2026-05-07T09:00:00Z"}'
191
- social-hub jobs agent-status -t $T -i <jobId> -j '{"status":"succeeded"}'
192
- social-hub jobs agent-status -t $T -i <jobId> -j '{"status":"failed","lastError":"timeout"}'
193
- social-hub jobs retry -t $T -i <jobId>
194
- social-hub jobs cancel -t $T -i <jobId>
195
- ```
196
-
197
- ### 发布计划
198
-
199
- ```bash
200
- social-hub plans list -t $T
201
- social-hub plans list -t $T --campaign <campaignId>
202
- social-hub plans create -t $T -j '{"campaignId":"<uuid>","name":"Q3 Week1","entries":[{"socialAccountId":"<uuid>","subreddit":"LocalLLaMA","plannedAt":"2026-07-01T09:00:00Z"}]}'
203
- social-hub plans cancel -t $T --plan <planId>
139
+ social-hub jobs list -t <team-id> --status scheduled
140
+ social-hub jobs create -t <team-id> -j '{"socialAccountId":"<uuid>","action":"engage","subreddit":"LocalLLaMA","runAt":"2026-05-07T09:00:00Z"}'
141
+ social-hub jobs retry -t <team-id> -i <jobId>
142
+ social-hub jobs cancel -t <team-id> -i <jobId>
204
143
  ```
205
144
 
206
- ### 内容草稿
207
-
208
- ```bash
209
- social-hub drafts list -t $T -n 20
210
- social-hub drafts create -t $T -j '{"campaignId":"<uuid>","title":"Test Post","body":"Content..."}'
211
- social-hub drafts get -t $T --draft <uuid>
212
- social-hub drafts update -t $T --draft <uuid> -j '{"status":"approved"}'
213
- social-hub drafts delete -t $T --draft <uuid>
214
- ```
215
-
216
- ### 报告库
217
-
218
- ```bash
219
- social-hub reports list -t $T -n 20
220
- social-hub reports create -t $T -j '{"reportType":"campaign-digest","title":"5月报告","source":"manual","contentMarkdown":"# 报告..."}'
221
- social-hub reports ingest -t $T -j '{"reportType":"reddit-post-snapshot","source":"path/to/file.md"}'
222
- ```
145
+ OpenClaw 执行态优先 `social-hub ops *`(见 `social-hub-ops-runtime`);`jobs agent-status` 为遗留路径。
223
146
 
224
- ### 账号管理
147
+ ### 发布计划 / 草稿 / 报告
225
148
 
226
149
  ```bash
227
- social-hub accounts list -t $T
228
- social-hub accounts list -t $T --status active
229
- social-hub accounts get -t $T --account <uuid>
230
- social-hub accounts create -t $T -j '{"platform":"reddit","handle":"u_example","externalId":"..."}'
231
- social-hub compliance risk-get -t $T -a <accountId>
232
- social-hub compliance risk-put -t $T -a <accountId> -j '{"riskLevel":"medium","notes":"..."}'
150
+ social-hub plans list -t <team-id>
151
+ social-hub plans create -t <team-id> -j '{"campaignId":"<uuid>","name":"Q3 Week1","entries":[...]}'
152
+ social-hub drafts list -t <team-id> -n 20
153
+ social-hub reports list -t <team-id> -n 20
233
154
  ```
234
155
 
235
- ### 品牌与 Campaign
156
+ ### 账号 / 品牌 / Campaign
236
157
 
237
158
  ```bash
238
- social-hub brands list -t $T
239
- social-hub brands create -t $T -j '{"name":"My Brand","slug":"my-brand"}'
240
- social-hub brands update -t $T --brand <brandId> -j '{"name":"New Name"}'
241
- social-hub campaigns list -t $T --brand <brandId>
242
- social-hub campaigns get -t $T --campaign <uuid>
243
- social-hub campaigns create -t $T -j '{"brandId":"<uuid>","name":"2026 Q2"}'
244
- social-hub campaigns update -t $T --campaign <uuid> -j '{"name":"2026 Q3"}'
159
+ social-hub accounts list -t <team-id> --status active
160
+ social-hub accounts get -t <team-id> --account <uuid>
161
+ social-hub brands list -t <team-id>
162
+ social-hub campaigns list -t <team-id> --brand <brandId>
245
163
  ```
246
164
 
247
165
  ### 板块情报
248
166
 
249
167
  ```bash
250
- social-hub intelligence hot-posts -t $T --subreddit LocalLLaMA
251
- social-hub intelligence hot-posts -t $T --sort score -n 50
252
- social-hub intelligence dispatch -t $T -j '{"hotPostId":"<uuid>","socialAccountId":"<uuid>","action":"engage"}'
253
- social-hub intelligence kol-intents -t $T -n 20
254
- social-hub intelligence watchlists-list -t $T
168
+ social-hub intelligence hot-posts -t <team-id> --subreddit LocalLLaMA --sort score -n 50
169
+ social-hub intelligence dispatch -t <team-id> -j '{"hotPostId":"<uuid>","socialAccountId":"<uuid>","action":"engage"}'
170
+ social-hub intelligence watchlists-list -t <team-id>
255
171
  ```
256
172
 
257
173
  ### 团队与用户管理
258
174
 
259
175
  ```bash
260
176
  social-hub agent-teams list
261
- social-hub agent-teams create --slug moss --name "Moss Agent Team" # admin only
262
- social-hub agent-teams add-member -t $T --user <userId> --role manager # admin only
263
- social-hub users list -t $T
264
- social-hub users create -t $T -j '{"email":"agent@example.com","password":"xxx","role":"manager"}'
177
+ social-hub agent-teams create --slug javis --name "Javis Agent Team" # admin only
178
+ social-hub users list -t <team-id>
179
+ social-hub users create -t <team-id> -j '{"email":"ops@example.com","password":"...","role":"manager"}'
265
180
  ```
266
181
 
267
182
  ### 通知渠道
268
183
 
269
184
  ```bash
270
- social-hub notification-channels list -t $T
271
- social-hub notification-channels create -t $T -j '{"provider":"feishu","externalId":"https://open.feishu.cn/open-apis/bot/v2/hook/..."}'
272
- social-hub notification-channels test -t $T --channel <uuid>
273
- social-hub notification-channels delete -t $T --channel <uuid>
185
+ social-hub notification-channels list -t <team-id>
186
+ social-hub notification-channels create -t <team-id> -j '{"provider":"feishu","externalId":"https://..."}'
274
187
  ```
275
188
 
276
- ### API Key 管理
189
+ ### API Key 管理(管理员资源,非 CLI 登录方式)
277
190
 
278
191
  ```bash
279
- social-hub api-keys list -t $T
280
- social-hub api-keys create -t $T -j '{"name":"agent-key","role":"manager"}'
281
- social-hub api-keys rotate -t $T --key <uuid>
282
- social-hub api-keys delete -t $T --key <uuid>
192
+ social-hub api-keys list -t <team-id>
193
+ social-hub api-keys create -t <team-id> -j '{"name":"integration","role":"manager"}'
283
194
  ```
284
195
 
285
196
  ---
286
197
 
287
198
  ## 典型工作流
288
199
 
289
- ### 工作流 1:Agent 执行完成后回填 Hub
200
+ ### Agent 执行完成后回填
290
201
 
291
- ```bash
292
- T=$SOCIAL_HUB_TEAM_ID
293
- ENTRY_ID="<calendarEntryId>"
294
- PERMALINK="https://www.reddit.com/r/LocalLLaMA/comments/xxx/yyy/"
295
-
296
- # 1. 更新日历条目状态为 succeeded
297
- social-hub calendar patch -t $T -e $ENTRY_ID \
298
- --body "{\"status\":\"succeeded\",\"permalink\":\"$PERMALINK\"}"
202
+ 优先 `social-hub ops complete --permalink ...`(见 `social-hub-ops-runtime`)。手动 patch 示例:
299
203
 
300
- # 2. 写入互动事件
301
- social-hub events append -t $T \
302
- --type "post.published" \
303
- --payload "{\"permalink\":\"$PERMALINK\",\"calendarEntryId\":\"$ENTRY_ID\"}"
304
-
305
- # 3. 查看该账号近期事件(验证写入)
306
- social-hub events list-full -t $T --account $ACCOUNT_ID -n 10
204
+ ```bash
205
+ social-hub calendar patch -t <team-id> -e <entryId> \
206
+ --body '{"status":"succeeded","permalink":"https://www.reddit.com/r/.../..."}'
207
+ social-hub events append -t <team-id> --type post.published \
208
+ --payload '{"permalink":"...","calendarEntryId":"<entryId>"}'
307
209
  ```
308
210
 
309
- ### 工作流 2:查看账号运营数据
211
+ ### 查看账号运营数据
310
212
 
311
213
  ```bash
312
- T=$SOCIAL_HUB_TEAM_ID
313
- ACCOUNT_ID="<socialAccountId>"
314
-
315
- # 账号详情
316
- social-hub accounts get -t $T --account $ACCOUNT_ID
317
-
318
- # 近期事件
319
- social-hub events list-full -t $T --account $ACCOUNT_ID -n 20
320
-
321
- # 近期调度任务
322
- social-hub jobs list-full -t $T --account $ACCOUNT_ID --status scheduled
323
-
324
- # 关联发布日历
325
- social-hub calendar list-full -t $T --account $ACCOUNT_ID --status scheduled
326
-
327
- # 风险档案
328
- social-hub compliance risk-get -t $T -a $ACCOUNT_ID
214
+ social-hub accounts get -t <team-id> --account <accountId>
215
+ social-hub events list-full -t <team-id> --account <accountId> -n 20
216
+ social-hub jobs list-full -t <team-id> --account <accountId> --status scheduled
217
+ social-hub compliance risk-get -t <team-id> -a <accountId>
329
218
  ```
330
219
 
331
- ### 工作流 3:情报热帖派发任务
220
+ ### 情报热帖派发
332
221
 
333
222
  ```bash
334
- T=$SOCIAL_HUB_TEAM_ID
335
-
336
- # 1. 查看热帖
337
- social-hub intelligence hot-posts -t $T --sort score -n 10
338
-
339
- # 2. 查看可用账号
340
- social-hub accounts list -t $T --status active
341
-
342
- # 3. 派发互动任务
343
- social-hub intelligence dispatch -t $T -j '{
344
- "hotPostId": "<hotPostId>",
345
- "socialAccountId": "<accountId>",
346
- "action": "engage",
347
- "runAt": "2026-05-07T09:00:00Z"
348
- }'
349
-
350
- # 4. 确认任务已创建
351
- social-hub jobs list -t $T --status scheduled -n 5
223
+ social-hub intelligence hot-posts -t <team-id> --sort score -n 10
224
+ social-hub accounts list -t <team-id> --status active
225
+ social-hub intelligence dispatch -t <team-id> -j '{"hotPostId":"...","socialAccountId":"...","action":"engage","runAt":"..."}'
226
+ social-hub jobs list -t <team-id> --status scheduled -n 5
352
227
  ```
353
228
 
354
229
  ---
355
230
 
356
231
  ## 注意事项
357
232
 
358
- - 所有命令输出均为 **JSON**,可管道传给 `jq` 处理:`social-hub accounts list -t $T | jq '.items[].handle'`
359
- - `DELETE` 端点(drafts delete、plans cancel、notification-channels delete)返回空响应(204),成功时打印 `OK`
360
- - `events export-csv` 和 `intelligence hot-posts-export` 输出 CSV 到 stdout,可直接重定向:`> output.csv`
361
- - 团队管理操作(`agent-teams create/update/add-member`)需要 **admin** 角色的 API Key
362
- - SessionCookie)认证不在 CLI 支持范围内,始终使用 API Key
363
-
233
+ - 命令输出多为 **JSON**,可管道 `jq`。
234
+ - `DELETE` / cancel 成功时可能返回 204,CLI 打印 `OK`。
235
+ - `events export-csv`、`intelligence hot-posts-export` 输出 CSV 到 stdout
236
+ - 团队管理(`agent-teams create` 等)需要 **admin** role CLI token。
237
+ - CLI 凭证来自 **Device Code**(`auth login`),不是 Web Session Cookie,也不是日常手动创建的 API Key
@@ -3,20 +3,20 @@
3
3
  "evals": [
4
4
  {
5
5
  "id": 0,
6
- "prompt": "我刚在本地部署好了 Social Ops Hub,openclaw-template 也初始化完了。我需要在 Hub 里注册一个新团队叫 javisslug 也是 javis,然后给这个团队添加一个管理员用户,email ops@javis.local,密码是 Javis2026!。完成后确认一下团队列表里有了这个团队。",
7
- "expected_output": "使用 social-hub-cli skill,依次执行:social-hub agent-teams create、social-hub users create -t <newTeamId>、social-hub agent-teams list,输出各步骤的命令和 JSON 结果",
6
+ "prompt": "我要连生产 Social Ops Hub(https://reddit.eclick-geo.com/api),用 social-hub 登录并确认当前身份和 team,然后在 Hub 里注册一个新团队 javisslug 也是 javis),给这个团队添加管理员用户 ops@javis.local,密码 Javis2026!,最后确认团队列表里有 javis。不要用 SOCIAL_HUB_API_KEY 环境变量。",
7
+ "expected_output": "先读 social-hub-shared:auth login --api-url 生产地址、auth whoami、context use;再读 social-hub-cli/admin:agent-teams create、users createagent-teams list;全程 Device Code 凭证,不 export API key",
8
8
  "assertions": []
9
9
  },
10
10
  {
11
11
  "id": 1,
12
- "prompt": "我的 Reddit 账号 u/example_user(id abc123-...-uuid)刚刚在 r/LocalLLaMA 发了一个帖子,permalink 是 https://www.reddit.com/r/LocalLLaMA/comments/abc123/test_post/。对应的发布日历条目 id 是 def456-...-uuid。帮我把这个结果写进 Social Ops Hub:把日历条目标记为 succeeded,写入 permalink,同时记录一条 post.published 事件。最后查一下这个账号最近的互动事件确认写入成功。",
13
- "expected_output": "执行 calendar patch(succeeded + permalink)、events append(post.published)、events list-full --account,输出每步的命令和结果",
12
+ "prompt": "Reddit 账号 u/example_user 刚在 r/LocalLLaMA 发帖,permalink 是 https://www.reddit.com/r/LocalLLaMA/comments/abc123/test_post/,日历条目 def456-uuid。我已在生产 Hub auth login 并 context use 了 team。帮我把日历标 succeeded、写 post.published 事件,并查该账号最近事件。优先 ops complete,若需手动则 calendar patch + events append。",
13
+ "expected_output": "确认已 auth/context;执行 ops complete 或 calendar patch + events append + events list-full;不要求设置 SOCIAL_HUB_API_KEY",
14
14
  "assertions": []
15
15
  },
16
16
  {
17
17
  "id": 2,
18
- "prompt": "帮我查一下 Social Ops Hub 里板块情报里 r/Entrepreneur 最近按分数排名的前 5 条热帖,然后选第一条,派发一个 engage 互动任务给账号 ghi789-...-uuid,运行时间设为明天上午 9 点(2026-05-07T01:00:00Z UTC)。任务派发完后确认一下调度任务列表里有这条新任务。",
19
- "expected_output": "执行 intelligence hot-posts --subreddit Entrepreneur --sort score -n 5、intelligence dispatch(带 hotPostId/socialAccountId/action/runAt)、jobs list 确认,输出各步命令和结果",
18
+ "prompt": "查生产 Hub r/Entrepreneur score 5 热帖,给账号 ghi789-uuid 派发 engage 任务,runAt 2026-05-07T01:00:00Z,并确认 jobs 列表有新任务。我已 social-hub auth login 到 reddit.eclick-geo.com。",
19
+ "expected_output": "路由 social-hub-intelligencehot-posts、dispatch;social-hub-calendar-jobs:jobs list;使用 -t team-id 来自 context,不用 localhost API key env",
20
20
  "assertions": []
21
21
  }
22
22
  ]
@@ -4,22 +4,27 @@ description: >-
4
4
  板块情报:watchlists、hot posts、KOL intents、industry-pools、dispatch 等 social-hub intelligence 子命令。
5
5
  用户要盯 subreddit、拉热帖、行业池、情报派发时用本 skill。
6
6
  metadata:
7
- cliVersion: ">=0.0.1"
7
+ cliVersion: ">=0.0.6"
8
8
  ---
9
9
 
10
10
  # social-hub-intelligence
11
11
 
12
+ > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
13
+ > 确认已 auth login 并 `context use <team-id>`。
14
+
12
15
  ```bash
13
- social-hub intelligence industry-pools-list -t "$T"
14
- social-hub intelligence watchlists-list -t "$T"
15
- social-hub intelligence hot-posts -t "$T" --subreddit technology
16
- social-hub intelligence dispatch -t "$T" -j '{ ... }' # 写操作注意 --apply
16
+ social-hub intelligence industry-pools-list -t <team-id>
17
+ social-hub intelligence watchlists-list -t <team-id>
18
+ social-hub intelligence hot-posts -t <team-id> --subreddit technology --sort score -n 50
19
+ social-hub intelligence kol-intents -t <team-id> -n 20
20
+ social-hub intelligence dispatch -t <team-id> -j '{ ... }' # 写操作:确认 payload 与 --apply(若命令支持)
17
21
  ```
18
22
 
19
- 账号可发帖板块优先用:
23
+ 账号可发帖板块优先用 Hub DB 查询,不要猜 subreddit:
20
24
 
21
25
  ```bash
22
- social-hub query account-pools -t "$T" --account <ref>
26
+ social-hub query account-pools -t <team-id> --account <ref>
27
+ social-hub query subreddit-candidates -t <team-id> --account <ref> --action publish_post
23
28
  ```
24
29
 
25
30
  WebSocket `runs/ws` 为 watch 能力,不适合普通 CLI 批处理。
@@ -4,23 +4,26 @@ description: >-
4
4
  Hub 数据批量:export events-jsonl、export agent-context、runbook replay、openclaw-ingest。
5
5
  用户要导出 JSONL、回放事件、迁移/对账时用本 skill;不包含工作区 shared 目录批量 sync(需人工决策)。
6
6
  metadata:
7
- cliVersion: ">=0.0.1"
7
+ cliVersion: ">=0.0.6"
8
8
  ---
9
9
 
10
10
  # social-hub-migration
11
11
 
12
+ > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
13
+ > 确认已 auth login;导出/回放目标 team 用 `-t <team-id>`。
14
+
12
15
  ## 导出
13
16
 
14
17
  ```bash
15
- social-hub export events-jsonl -t "$T" -o events.jsonl -n 500
16
- social-hub export agent-context -t "$T" --account "<uuid>" -o ctx.json
18
+ social-hub export events-jsonl -t <team-id> -o events.jsonl -n 500
19
+ social-hub export agent-context -t <team-id> --account <uuid> -o ctx.json
17
20
  ```
18
21
 
19
22
  ## Runbook 回放
20
23
 
21
24
  ```bash
22
- social-hub runbook replay -t "$T" -f events.jsonl --dry-run
23
- social-hub runbook replay -t "$T" -f events.jsonl # 实际 append events
25
+ social-hub runbook replay -t <team-id> -f events.jsonl --dry-run
26
+ social-hub runbook replay -t <team-id> -f events.jsonl # 实际 append events
24
27
  ```
25
28
 
26
29
  JSONL 每行:`{"type":"comment","payload":{...}}`
@@ -5,15 +5,18 @@ description: >-
5
5
  export agent-context。用户问账号能发哪些版、任务上下文、板块池、guardrails、数据是否过期时,
6
6
  必须用 Hub DB 聚合接口,不要解析 Javis/Moss/Panda 工作区里的 shared/*.md。
7
7
  metadata:
8
- cliVersion: ">=0.0.1"
8
+ cliVersion: ">=0.0.6"
9
9
  ---
10
10
 
11
11
  # social-hub-openclaw-context
12
12
 
13
+ > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
14
+ > 确认已 auth login。所有 `-t <team-id>` 与授权 team 一致。
15
+
13
16
  ## 账号上下文
14
17
 
15
18
  ```bash
16
- social-hub context account -t "$T" --account A1 \
19
+ social-hub context account -t <team-id> --account A1 \
17
20
  --expand pools,jobs,persona,risk,env,guardrails
18
21
  ```
19
22
 
@@ -22,24 +25,24 @@ social-hub context account -t "$T" --account A1 \
22
25
  ## 任务上下文
23
26
 
24
27
  ```bash
25
- social-hub context job -t "$T" --job "<scheduledJobId>"
28
+ social-hub context job -t <team-id> --job <scheduledJobId>
26
29
  ```
27
30
 
28
31
  ## 板块与候选
29
32
 
30
33
  ```bash
31
- social-hub query account-pools -t "$T" --account A1 --limit 50
32
- social-hub query subreddit-candidates -t "$T" --account A1 --action publish_post
34
+ social-hub query account-pools -t <team-id> --account A1 --limit 50
35
+ social-hub query subreddit-candidates -t <team-id> --account A1 --action publish_post
33
36
  ```
34
37
 
35
- ## 导出(给人看或离线审计)
38
+ ## 导出(审计 / 离线查看)
36
39
 
37
40
  ```bash
38
- social-hub export agent-context -t "$T" --account "<uuid>" -o /tmp/ctx.json
41
+ social-hub export agent-context -t <team-id> --account <uuid> -o /tmp/ctx.json
39
42
  ```
40
43
 
41
44
  ## freshness
42
45
 
43
- 响应中的 `freshness.needsRefresh === true` 时,应先刷新账号指标或情报,再执行发帖/评论。
46
+ 响应中 `freshness.needsRefresh === true` 时,应先刷新账号指标或情报,再执行发帖/评论。
44
47
 
45
48
  执行任务前配合 `social-hub-ops-runtime`;执行后 `ops complete` 回填 permalink。