@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.
- package/dist/register-skills.d.ts.map +1 -1
- package/dist/register-skills.js +24 -6
- package/dist/register-skills.js.map +1 -1
- package/dist/skills/doctor.js +1 -1
- package/dist/skills/doctor.js.map +1 -1
- package/dist/skills/target-detector.d.ts +8 -1
- package/dist/skills/target-detector.d.ts.map +1 -1
- package/dist/skills/target-detector.js +69 -34
- package/dist/skills/target-detector.js.map +1 -1
- package/dist/skills/target-detector.test.d.ts +2 -0
- package/dist/skills/target-detector.test.d.ts.map +1 -0
- package/dist/skills/target-detector.test.js +64 -0
- package/dist/skills/target-detector.test.js.map +1 -0
- package/dist/skills/tui.d.ts +19 -1
- package/dist/skills/tui.d.ts.map +1 -1
- package/dist/skills/tui.js +120 -28
- package/dist/skills/tui.js.map +1 -1
- package/dist/skills/tui.test.d.ts +2 -0
- package/dist/skills/tui.test.d.ts.map +1 -0
- package/dist/skills/tui.test.js +37 -0
- package/dist/skills/tui.test.js.map +1 -0
- package/package.json +3 -3
- package/skills/README.md +20 -14
- package/skills/manifest.json +1 -1
- package/skills/social-hub-accounts/SKILL.md +14 -9
- package/skills/social-hub-admin/SKILL.md +15 -8
- package/skills/social-hub-calendar-jobs/SKILL.md +18 -9
- package/skills/social-hub-cli/SKILL.md +116 -242
- package/skills/social-hub-cli/evals/evals.json +6 -6
- package/skills/social-hub-intelligence/SKILL.md +12 -7
- package/skills/social-hub-migration/SKILL.md +8 -5
- package/skills/social-hub-openclaw-context/SKILL.md +11 -8
- package/skills/social-hub-ops-runtime/SKILL.md +11 -9
- package/skills/social-hub-posts/SKILL.md +10 -7
- package/skills/social-hub-publishing/SKILL.md +5 -2
- package/skills/social-hub-shared/SKILL.md +124 -22
|
@@ -4,31 +4,33 @@ description: >-
|
|
|
4
4
|
OpenClaw / Agent 任务运行时:social-hub ops claim-next、claim、heartbeat、complete、fail、skip。
|
|
5
5
|
用户要领任务、续租、心跳、回填 permalink、任务失败/跳过、避免改本地 Markdown 状态时必须用本 skill。
|
|
6
6
|
metadata:
|
|
7
|
-
cliVersion: ">=0.0.
|
|
7
|
+
cliVersion: ">=0.0.6"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# social-hub-ops-runtime
|
|
11
11
|
|
|
12
|
+
> **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
|
|
13
|
+
> 确认已 auth login 并 `context use <team-id>`。不要用环境变量传 team 或 API key。
|
|
14
|
+
|
|
12
15
|
Hub DB 是执行状态的真源;不要用 `shared/reddit-account-status.md` 等文件记录任务结果。
|
|
13
16
|
|
|
14
17
|
## 推荐流程
|
|
15
18
|
|
|
16
19
|
```bash
|
|
17
|
-
|
|
18
|
-
export AGENT="javis" # 或 moss / 你的 agentId
|
|
20
|
+
AGENT="javis" # 或 moss / 你的 agentId
|
|
19
21
|
|
|
20
|
-
social-hub ops claim-next -t
|
|
21
|
-
social-hub context job -t
|
|
22
|
-
social-hub ops heartbeat -t
|
|
22
|
+
social-hub ops claim-next -t <team-id> --agent "$AGENT"
|
|
23
|
+
social-hub context job -t <team-id> --job <jobId>
|
|
24
|
+
social-hub ops heartbeat -t <team-id> --job <jobId> --agent "$AGENT"
|
|
23
25
|
# 执行 Reddit / 浏览器操作,并写 interaction events(见 social-hub-cli events)
|
|
24
|
-
social-hub ops complete -t
|
|
26
|
+
social-hub ops complete -t <team-id> --job <jobId> --agent "$AGENT" --permalink "https://reddit.com/..."
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
失败或跳过:
|
|
28
30
|
|
|
29
31
|
```bash
|
|
30
|
-
social-hub ops fail -t
|
|
31
|
-
social-hub ops skip -t
|
|
32
|
+
social-hub ops fail -t <team-id> --job <jobId> --agent "$AGENT" --reason rule_blocked --message "..."
|
|
33
|
+
social-hub ops skip -t <team-id> --job <jobId> --agent "$AGENT" --reason manual_intervention_required
|
|
32
34
|
```
|
|
33
35
|
|
|
34
36
|
## `--reason` 枚举(仅允许下列值)
|
|
@@ -4,17 +4,20 @@ description: >-
|
|
|
4
4
|
Reddit 帖快照与数据:social-hub reddit list/stats/refresh/refresh-all/import-feishu 等。
|
|
5
5
|
用户要查帖表现、刷新 score、导入飞书表、permalink 对应快照时用本 skill(命令组名为 reddit)。
|
|
6
6
|
metadata:
|
|
7
|
-
cliVersion: ">=0.0.
|
|
7
|
+
cliVersion: ">=0.0.6"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# social-hub-posts
|
|
11
11
|
|
|
12
|
+
> **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
|
|
13
|
+
> 确认已 auth login 并选定 team。
|
|
14
|
+
|
|
12
15
|
```bash
|
|
13
|
-
social-hub reddit list -t
|
|
14
|
-
social-hub reddit stats -t
|
|
15
|
-
social-hub reddit refresh-status -t
|
|
16
|
-
social-hub reddit refresh-all -t
|
|
17
|
-
social-hub reddit import-feishu -t
|
|
16
|
+
social-hub reddit list -t <team-id> -n 20
|
|
17
|
+
social-hub reddit stats -t <team-id> --campaign <uuid>
|
|
18
|
+
social-hub reddit refresh-status -t <team-id> --id <snapshotId>
|
|
19
|
+
social-hub reddit refresh-all -t <team-id>
|
|
20
|
+
social-hub reddit import-feishu -t <team-id> -j '{ ... }'
|
|
18
21
|
```
|
|
19
22
|
|
|
20
|
-
发帖成功后应通过 `social-hub ops complete --permalink ...` 写回任务链路(见 `social-hub-publishing`)。
|
|
23
|
+
发帖成功后应通过 `social-hub ops complete --permalink ...` 写回任务链路(见 `social-hub-publishing` / `social-hub-ops-runtime`)。
|
|
@@ -4,11 +4,14 @@ description: >-
|
|
|
4
4
|
内容发布闭环:campaign → plan → draft → calendar → scheduled_job → events → reddit snapshot → report。
|
|
5
5
|
用户要从草稿到排期、执行任务、permalink 回填、避免 job 成功但 calendar 未更新时用本 skill。
|
|
6
6
|
metadata:
|
|
7
|
-
cliVersion: ">=0.0.
|
|
7
|
+
cliVersion: ">=0.0.6"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# social-hub-publishing
|
|
11
11
|
|
|
12
|
+
> **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
|
|
13
|
+
> 确认已 auth login 并 `context use <team-id>`。
|
|
14
|
+
|
|
12
15
|
## 事实源
|
|
13
16
|
|
|
14
17
|
- **计划**:`calendar_entries`
|
|
@@ -28,4 +31,4 @@ campaign → publishing_plan → content_draft → calendar_entry → scheduled_
|
|
|
28
31
|
2. `social-hub ops claim-next` → 执行 → `social-hub ops complete --permalink <url>`
|
|
29
32
|
3. `complete` 原子更新 job + calendar(+ 可选 snapshot id)
|
|
30
33
|
|
|
31
|
-
失败时 `ops fail` / `ops skip
|
|
34
|
+
失败时 `ops fail` / `ops skip`,并使用标准 `reason` 枚举(见 `social-hub-ops-runtime`)。
|
|
@@ -1,41 +1,143 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: social-hub-shared
|
|
3
3
|
description: >-
|
|
4
|
-
social-hub
|
|
5
|
-
|
|
4
|
+
social-hub 共享基础:config、auth login(Device Code)、context use/current、doctor、
|
|
5
|
+
permissions、权限排障与安全规则。用户首次配置、登录授权、连不上 API、team 不对、
|
|
6
|
+
权限不足、或任何 Hub CLI 写操作前必须先读本 skill。Agent 日常凭证只用 auth login,
|
|
7
|
+
不要用 SOCIAL_HUB_API_KEY 环境变量。
|
|
6
8
|
metadata:
|
|
7
|
-
cliVersion: ">=0.0.
|
|
9
|
+
cliVersion: ">=0.0.6"
|
|
8
10
|
---
|
|
9
11
|
|
|
10
12
|
# social-hub-shared
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
本 skill 是 Social Hub CLI 的**唯一详细鉴权与配置文档**。领域 skill(accounts、ops-runtime 等)开头会要求先读本文件;不要在各领域 skill 里重复展开鉴权流程。
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
## 凭证与配置真源
|
|
17
|
+
|
|
18
|
+
| 项 | 推荐来源 | 说明 |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| API 地址 | `~/.config/social-hub/config.json` → `apiUrl` | 生产默认 `https://reddit.eclick-geo.com/api` |
|
|
21
|
+
| 凭证 | 同上 → `authToken`(Device Code 登录后写入) | CLI 内部以 Bearer 发送;**不要用环境变量传 key** |
|
|
22
|
+
| 默认 team | `context.json` 的 `currentTeamId` 或 config 的 `teamId` | 用 `social-hub context use` 持久化 |
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
配置文件路径:`~/.config/social-hub/config.json`(权限 `600`)。
|
|
25
|
+
|
|
26
|
+
## 快速开始(生产)
|
|
21
27
|
|
|
22
28
|
```bash
|
|
23
|
-
|
|
24
|
-
social-hub auth login --api-
|
|
29
|
+
# 1. 浏览器 Device Code 授权(推荐,唯一日常路径)
|
|
30
|
+
social-hub auth login --api-url https://reddit.eclick-geo.com/api
|
|
31
|
+
|
|
32
|
+
# 2. 确认身份与 team
|
|
25
33
|
social-hub auth whoami
|
|
34
|
+
social-hub context list
|
|
35
|
+
|
|
36
|
+
# 3. 选定当前操作的 team(只需做一次,或切换 team 时再做)
|
|
37
|
+
social-hub context use <team-uuid>
|
|
38
|
+
|
|
39
|
+
# 4. 健康与鉴权自检
|
|
26
40
|
social-hub doctor
|
|
27
|
-
social-hub
|
|
28
|
-
|
|
41
|
+
social-hub health
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`health` 不需要登录;其他写读 Hub 数据的命令需要先完成 `auth login`。
|
|
45
|
+
|
|
46
|
+
## 认证
|
|
47
|
+
|
|
48
|
+
### 推荐:Device Code(`auth login`)
|
|
49
|
+
|
|
50
|
+
Agent 帮用户授权时,执行 `social-hub auth login` 并在终端输出 verification URL / user code,引导用户在浏览器完成审批:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
social-hub auth login --api-url https://reddit.eclick-geo.com/api
|
|
54
|
+
# 可选:登录时指定默认 team
|
|
55
|
+
social-hub auth login --api-url https://reddit.eclick-geo.com/api --team <team-uuid>
|
|
56
|
+
# 可选:CLI token 时长(需 Web 审批账号有相应权限)
|
|
57
|
+
social-hub auth login --duration short # 默认
|
|
58
|
+
social-hub auth login --duration long
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
成功后凭证写入 `config.json` 的 `authToken`,无需再 export 任何变量。
|
|
62
|
+
|
|
63
|
+
### 查看 / 退出
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
social-hub auth whoami # 同 auth status;含 role、teamId、visibleTeamIds
|
|
67
|
+
social-hub auth status
|
|
68
|
+
social-hub auth explain # 当前 role 可用命令
|
|
69
|
+
social-hub auth logout
|
|
70
|
+
social-hub auth logout --revoke # 同时撤销服务端 CLI token
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Team 上下文
|
|
74
|
+
|
|
75
|
+
多数命令需要 `-t <team-uuid>`。先持久化当前 team,示例里可直接引用:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
social-hub context use <team-uuid> [--label "moss"]
|
|
29
79
|
social-hub context current
|
|
30
|
-
social-hub
|
|
31
|
-
|
|
80
|
+
social-hub context list # 含 authTeamId、visibleTeamIds
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 配置命令
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
social-hub config show
|
|
87
|
+
social-hub config init --api-url https://reddit.eclick-geo.com/api [--team <uuid>]
|
|
88
|
+
social-hub config set apiUrl https://reddit.eclick-geo.com/api
|
|
89
|
+
social-hub config set teamId <team-uuid>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 本地开发(仅调试 API 时用)
|
|
93
|
+
|
|
94
|
+
本地 monorepo 跑 API 时,API 地址改为 `http://localhost:3000`:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pnpm dev # 在 social-ops-hub 根目录
|
|
98
|
+
social-hub auth login --api-url http://localhost:3000
|
|
32
99
|
```
|
|
33
100
|
|
|
34
|
-
|
|
101
|
+
本地 seed(`pnpm run db:seed:minimal-admin`)会打印 admin 账号;**仍应通过 Web 登录 + Device Code 授权 CLI**,不要把 seed 输出的 key 写进 skill 示例或环境变量。
|
|
102
|
+
|
|
103
|
+
## Legacy:静态 API Key(管理员资源,非 Agent 日常凭证)
|
|
104
|
+
|
|
105
|
+
CLI 仍兼容 `social-hub auth login --api-key sk_live_…` 与 `SOCIAL_HUB_API_KEY` 环境变量,但**仅用于**:
|
|
106
|
+
|
|
107
|
+
- 服务端自动化 / CI(若团队明确允许)
|
|
108
|
+
- 管理员在 Hub Web 创建、轮换的 **API Key 资源**(`social-hub api-keys *`)
|
|
109
|
+
|
|
110
|
+
**Agent 与人工日常操作一律用 Device Code,不要**:
|
|
111
|
+
|
|
112
|
+
- `export SOCIAL_HUB_API_KEY=...`
|
|
113
|
+
- 在 skill 示例里把 API Key 当默认登录方式
|
|
114
|
+
- 把「创建 api-key」和「CLI 登录」混为一谈
|
|
115
|
+
|
|
116
|
+
## 权限不足处理
|
|
117
|
+
|
|
118
|
+
1. `social-hub doctor` — API 可达性、`/health/live`、auth context
|
|
119
|
+
2. `social-hub auth whoami` — 确认 `role` 与 `teamId`
|
|
120
|
+
3. `social-hub context current` — 确认 `-t` 与授权 team 一致
|
|
121
|
+
4. `social-hub auth explain` — 当前 role 是否允许该命令
|
|
122
|
+
5. 403 / permission denied — 换有权限的 Web 账号重新 `auth login`,或请 admin 调整成员角色
|
|
123
|
+
|
|
124
|
+
admin 专属操作(如 `agent-teams create`)需要 **admin** role 的 CLI token,不是「随便创建一个 API Key」就能替代。
|
|
125
|
+
|
|
126
|
+
## 安全规则
|
|
127
|
+
|
|
128
|
+
- **禁止**在对话或日志中输出完整 token / API Key(`config show` 已脱敏)。
|
|
129
|
+
- **写入 / 删除**前确认用户意图;admin skill 中高风险操作用 `--dry-run` / `--apply`。
|
|
130
|
+
- **不要**用 `SOCIAL_HUB_CONFIG_DIR` 绕开标准配置路径,除非用户明确要求隔离环境。
|
|
131
|
+
- Session Cookie 认证不在 CLI 支持范围内;CLI 使用 Bearer token(Device Code 或 legacy API Key)。
|
|
132
|
+
|
|
133
|
+
## 排障顺序(简表)
|
|
35
134
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
135
|
+
| 现象 | 检查 |
|
|
136
|
+
|------|------|
|
|
137
|
+
| Not logged in | `social-hub auth login` |
|
|
138
|
+
| API unreachable | `config show` 的 apiUrl;生产应为 `https://reddit.eclick-geo.com/api` |
|
|
139
|
+
| Missing team id | `context use <uuid>` 或命令加 `-t` |
|
|
140
|
+
| team 不一致 warning | `auth whoami` 的 teamId vs `context current` |
|
|
141
|
+
| 401 / auth failed | 重新 `auth login`;过期则 `auth logout` 后重登 |
|
|
40
142
|
|
|
41
|
-
|
|
143
|
+
更完整命令速查见同包 `social-hub-cli` skill。
|