@geoly-ai/social-hub-cli 0.0.11 → 0.0.13

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 (53) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/admin-index-gates.test.d.ts +2 -0
  3. package/dist/admin-index-gates.test.d.ts.map +1 -0
  4. package/dist/admin-index-gates.test.js +33 -0
  5. package/dist/admin-index-gates.test.js.map +1 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +723 -58
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.test.js +87 -5
  10. package/dist/index.test.js.map +1 -1
  11. package/dist/permission-runner.d.ts +11 -0
  12. package/dist/permission-runner.d.ts.map +1 -0
  13. package/dist/permission-runner.js +30 -0
  14. package/dist/permission-runner.js.map +1 -0
  15. package/dist/permission-runner.test.d.ts +2 -0
  16. package/dist/permission-runner.test.d.ts.map +1 -0
  17. package/dist/permission-runner.test.js +69 -0
  18. package/dist/permission-runner.test.js.map +1 -0
  19. package/dist/permissions-gates-admin.d.ts +4 -0
  20. package/dist/permissions-gates-admin.d.ts.map +1 -0
  21. package/dist/permissions-gates-admin.js +80 -0
  22. package/dist/permissions-gates-admin.js.map +1 -0
  23. package/dist/permissions-gates-admin.test.d.ts +2 -0
  24. package/dist/permissions-gates-admin.test.d.ts.map +1 -0
  25. package/dist/permissions-gates-admin.test.js +25 -0
  26. package/dist/permissions-gates-admin.test.js.map +1 -0
  27. package/dist/permissions.d.ts.map +1 -1
  28. package/dist/permissions.js +2 -3
  29. package/dist/permissions.js.map +1 -1
  30. package/dist/register-admin.d.ts.map +1 -1
  31. package/dist/register-admin.js +343 -29
  32. package/dist/register-admin.js.map +1 -1
  33. package/dist/register-extensions.d.ts.map +1 -1
  34. package/dist/register-extensions.js +16 -19
  35. package/dist/register-extensions.js.map +1 -1
  36. package/package.json +2 -2
  37. package/skills/README.md +7 -5
  38. package/skills/manifest.json +17 -7
  39. package/skills/social-hub-accounts/SKILL.md +46 -13
  40. package/skills/social-hub-admin/SKILL.md +76 -10
  41. package/skills/social-hub-calendar-jobs/SKILL.md +26 -10
  42. package/skills/social-hub-cli/SKILL.md +35 -191
  43. package/skills/social-hub-cli/evals/evals.json +4 -4
  44. package/skills/social-hub-events-observability/SKILL.md +49 -0
  45. package/skills/social-hub-graph-compliance/SKILL.md +60 -0
  46. package/skills/social-hub-intelligence/SKILL.md +72 -7
  47. package/skills/social-hub-migration/SKILL.md +18 -5
  48. package/skills/social-hub-openclaw-context/SKILL.md +21 -6
  49. package/skills/social-hub-ops-runtime/SKILL.md +10 -5
  50. package/skills/social-hub-posts/SKILL.md +54 -23
  51. package/skills/social-hub-posts/evals/evals.json +23 -0
  52. package/skills/social-hub-publishing/SKILL.md +75 -11
  53. package/skills/social-hub-shared/SKILL.md +8 -4
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: social-hub-events-observability
3
+ description: >-
4
+ 互动事件与可观测性:social-hub events append/list/batch/export-csv、dashboard summary、
5
+ audit list、reports list/create/ingest。用户要记事件、查运营总览、审计日志或报告库时用本 skill。
6
+ metadata:
7
+ cliVersion: ">=0.0.12"
8
+ ---
9
+
10
+ # social-hub-events-observability
11
+
12
+ > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
13
+ > 确认已 `auth login` 并 `context use <team-id>`。
14
+
15
+ ## 互动事件
16
+
17
+ ```bash
18
+ social-hub events append -t <team-id> --type comment --payload '{"permalink":"https://..."}'
19
+ social-hub events list -t <team-id> -n 20
20
+ social-hub events list-full -t <team-id> --account <uuid> --type post.published -n 100
21
+ social-hub events batch -t <team-id> -j '{"items":[{"type":"comment","payload":{...}}]}'
22
+ social-hub events export-csv -t <team-id> > events.csv
23
+ ```
24
+
25
+ ## 运营总览
26
+
27
+ ```bash
28
+ social-hub dashboard summary -t <team-id>
29
+ ```
30
+
31
+ ## 审计日志
32
+
33
+ ```bash
34
+ social-hub audit list -t <team-id> -n 50 [--type <prefix>] [--actor agent] [--account <uuid>]
35
+ ```
36
+
37
+ ## 报告库
38
+
39
+ ```bash
40
+ social-hub reports list -t <team-id> -n 20
41
+ social-hub reports create -t <team-id> -j '{"title":"Weekly","bodyMarkdown":"..."}'
42
+ social-hub reports ingest -t <team-id> -j '{"source":"external","payload":{...}}'
43
+ ```
44
+
45
+ ## 相关 skill
46
+
47
+ - 发布闭环:`social-hub-publishing`
48
+ - 图谱追溯:`social-hub-graph-compliance`
49
+ - 批量导出/回放:`social-hub-migration`(`export events-jsonl`、`runbook replay`)
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: social-hub-graph-compliance
3
+ description: >-
4
+ 账号图谱与合规风控:social-hub graph list/drilldown/v2-*、compliance sanctions-*、
5
+ risk-*、rule-caches-*。用户要查账号关联图谱、风险簇、制裁、风控配置或 subreddit
6
+ 规则缓存时用本 skill。
7
+ metadata:
8
+ cliVersion: ">=0.0.12"
9
+ ---
10
+
11
+ # social-hub-graph-compliance
12
+
13
+ > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
14
+ > 确认已 `auth login` 并 `context use <team-id>`。
15
+
16
+ ## 账号图谱(v1)
17
+
18
+ ```bash
19
+ social-hub graph list -t <team-id> [--account <uuid>] [--edge <type>] -n 100
20
+ social-hub graph drilldown -t <team-id> --account <uuid> -n 20
21
+ ```
22
+
23
+ ## 账号图谱(v2)
24
+
25
+ ```bash
26
+ social-hub graph v2-ego -t <team-id> --node-ref <account-uuid> --node-type account -n 100
27
+ social-hub graph v2-timeline -t <team-id> --node-ref <account-uuid> --node-type account --from 2026-01-01T00:00:00Z
28
+ social-hub graph v2-explain -t <team-id> --edge-id <edge-uuid>
29
+ social-hub graph v2-path -t <team-id> --source-ref <uuid> --source-type account --target-ref <uuid> --target-type account
30
+ social-hub graph v2-clusters -t <team-id> --scope-ref <account-uuid> --min-risk 60
31
+ social-hub graph v2-impact -t <team-id> --campaign-ref <campaign-uuid> --min-reuse 2
32
+ ```
33
+
34
+ ## 合规:制裁与风控
35
+
36
+ ```bash
37
+ social-hub compliance sanctions-list -t <team-id> [--account <uuid>] [--sub <name>]
38
+ social-hub compliance sanctions-create -t <team-id> -j '{"socialAccountId":"<uuid>","subreddit":"example","status":"blocked","reason":"..."}'
39
+
40
+ social-hub compliance risk-list -t <team-id> -n 100
41
+ social-hub compliance risk-get -t <team-id> -a <account-uuid>
42
+ social-hub compliance risk-put -t <team-id> -a <account-uuid> -j '{"riskLevel":"medium","safeHoursStart":"08:00","safeHoursEnd":"22:00"}'
43
+ ```
44
+
45
+ ## Subreddit 规则缓存
46
+
47
+ ```bash
48
+ social-hub compliance rule-caches-list -t <team-id> [--include-expired]
49
+ social-hub compliance rule-caches-upsert -t <team-id> --sub example -j '{
50
+ "rulesMarkdown": "# Rules\n...",
51
+ "sourceUrl": "https://www.reddit.com/r/example/about/rules",
52
+ "expiresInDays": 30
53
+ }'
54
+ ```
55
+
56
+ ## 相关 skill
57
+
58
+ - 账号详情:`social-hub-accounts`
59
+ - 互动事件追溯:`social-hub-events-observability`
60
+ - Agent 上下文(含 risk/guardrails):`social-hub-openclaw-context`
@@ -1,26 +1,91 @@
1
1
  ---
2
2
  name: social-hub-intelligence
3
3
  description: >-
4
- 板块情报:watchlists、hot posts、KOL intents、industry-pools、dispatch 等 social-hub intelligence 子命令。
5
- 用户要盯 subreddit、拉热帖、行业池、情报派发时用本 skill。
4
+ 板块情报:watchlists、hot-posts、kol-intents、industry-pools、tier-rules、runs、
5
+ kol-profiles、fetch-by-*、insights/*、dispatch social-hub intelligence 子命令。
6
+ 用户要盯 subreddit、拉热帖、行业池、情报派发、分层规则或洞察分析时用本 skill。
6
7
  metadata:
7
- cliVersion: ">=0.0.6"
8
+ cliVersion: ">=0.0.12"
8
9
  ---
9
10
 
10
11
  # social-hub-intelligence
11
12
 
12
13
  > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
13
- > 确认已 auth login 并 `context use <team-id>`。
14
+ > 确认已 `auth login` 并 `context use <team-id>`。
15
+
16
+ ## Watchlists 与行业池
14
17
 
15
18
  ```bash
16
19
  social-hub intelligence industry-pools-list -t <team-id>
17
- social-hub intelligence watchlists-list -t <team-id>
20
+ social-hub intelligence watchlists-list -t <team-id> [--campaign <uuid>]
21
+ social-hub intelligence watchlists-create -t <team-id> -j '{"subreddit":"technology","tags":["core"]}'
22
+ social-hub intelligence watchlists-update -t <team-id> --id <uuid> -j '{"tags":["updated"]}'
23
+ social-hub intelligence watchlists-delete -t <team-id> --id <uuid>
24
+ ```
25
+
26
+ ## 热帖
27
+
28
+ ```bash
18
29
  social-hub intelligence hot-posts -t <team-id> --subreddit technology --sort score -n 50
30
+ social-hub intelligence hot-posts-create -t <team-id> -j '{ ... }'
31
+ social-hub intelligence hot-posts-export -t <team-id> --subreddit technology > hot-posts.csv
32
+ ```
33
+
34
+ ## KOL
35
+
36
+ ```bash
19
37
  social-hub intelligence kol-intents -t <team-id> -n 20
20
- social-hub intelligence dispatch -t <team-id> -j '{ ... }' # 写操作:确认 payload 与 --apply(若命令支持)
38
+ social-hub intelligence kol-intents-create -t <team-id> -j '{ ... }'
39
+ social-hub intelligence kol-profiles-list -t <team-id> [--platform reddit]
40
+ social-hub intelligence kol-profiles-get -t <team-id> --id <uuid>
21
41
  ```
22
42
 
23
- 账号可发帖板块优先用 Hub DB 查询,不要猜 subreddit:
43
+ ## Tier rules
44
+
45
+ ```bash
46
+ social-hub intelligence tier-rules-list -t <team-id> [--tier T1] [--enabled true]
47
+ social-hub intelligence tier-rules-create -t <team-id> -j '{"subreddit":"example","tier":"T1","entryMode":"organic","enabled":true}'
48
+ social-hub intelligence tier-rules-update -t <team-id> --id <uuid> -j '{"enabled":false}'
49
+ social-hub intelligence tier-rules-delete -t <team-id> --id <uuid>
50
+ ```
51
+
52
+ ## 抓取任务(异步 run)
53
+
54
+ ```bash
55
+ social-hub intelligence fetch-by-industry -t <team-id> -j '{"mode":"all","industryKeys":["tech"],"sort":"hot","limitPerSubreddit":25}'
56
+ social-hub intelligence fetch-by-tier -t <team-id> -j '{"mode":"all","tier":"T1","sort":"hot"}'
57
+ social-hub intelligence fetch-by-keywords -t <team-id> -j '{"mode":"all","brandKeywords":["brand"],"competitorKeywords":["rival"]}'
58
+ social-hub intelligence runs-list -t <team-id> [--dimension industry] [--status queued]
59
+ ```
60
+
61
+ ## Insights
62
+
63
+ ```bash
64
+ social-hub intelligence brand-mention-radar -t <team-id> -j '{"keywords":["brand"]}'
65
+ social-hub intelligence opportunity-map -t <team-id> -j '{"keywords":["topic"]}'
66
+ social-hub intelligence sov -t <team-id> -j '{"brandKeywords":["brand"],"competitorKeywords":["rival"]}'
67
+ social-hub intelligence sentiment-intent -t <team-id>
68
+ social-hub intelligence campaign-lift -t <team-id> -j '{"keywords":["brand"],"campaignStartAt":"2026-01-01T00:00:00Z","campaignEndAt":"2026-02-01T00:00:00Z"}'
69
+ social-hub intelligence snapshot-latest -t <team-id>
70
+ social-hub intelligence snapshot-save -t <team-id> -j '{"payload":{"note":"manual snapshot"}}'
71
+ ```
72
+
73
+ ## 派发到调度任务
74
+
75
+ ```bash
76
+ social-hub intelligence dispatch -t <team-id> -j '{
77
+ "hotPostId": "<uuid>",
78
+ "socialAccountId": "<uuid>",
79
+ "action": "engage",
80
+ "runAt": "2026-05-07T09:00:00Z"
81
+ }'
82
+ ```
83
+
84
+ `dispatch` 无 `--dry-run`/`--apply`;确认 payload 后再执行。
85
+
86
+ ## 板块候选(Hub DB)
87
+
88
+ 不要猜账号可发哪些 subreddit:
24
89
 
25
90
  ```bash
26
91
  social-hub query account-pools -t <team-id> --account <ref>
@@ -2,15 +2,15 @@
2
2
  name: social-hub-migration
3
3
  description: >-
4
4
  Hub 数据批量:export events-jsonl、export agent-context、runbook replay、openclaw-ingest。
5
- 用户要导出 JSONL、回放事件、迁移/对账时用本 skill;不包含工作区 shared 目录批量 sync(需人工决策)。
5
+ 用户要导出 JSONL、回放事件、迁移/对账时用本 skill;不包含 agent 工作区目录的自动批量 sync
6
6
  metadata:
7
- cliVersion: ">=0.0.6"
7
+ cliVersion: ">=0.0.12"
8
8
  ---
9
9
 
10
10
  # social-hub-migration
11
11
 
12
12
  > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
13
- > 确认已 auth login;导出/回放目标 team 用 `-t <team-id>`。
13
+ > 确认已 `auth login`;导出/回放目标 team 用 `-t <team-id>`。
14
14
 
15
15
  ## 导出
16
16
 
@@ -19,6 +19,8 @@ social-hub export events-jsonl -t <team-id> -o events.jsonl -n 500
19
19
  social-hub export agent-context -t <team-id> --account <uuid> -o ctx.json
20
20
  ```
21
21
 
22
+ 事件 CSV 导出见 `social-hub-events-observability`(`events export-csv`)。
23
+
22
24
  ## Runbook 回放
23
25
 
24
26
  ```bash
@@ -30,6 +32,17 @@ JSONL 每行:`{"type":"comment","payload":{...}}`
30
32
 
31
33
  ## openclaw-ingest
32
34
 
33
- API 支持将工作区文档写入 `team_workspace_documents`;**不要**在本 skill 内自动化批量 sync 整个 `Javis-workspace/shared` 或 `Moss-workspace/shared`,除非用户明确要求并指定范围。
35
+ agent 工作区文档写入 `team_workspace_documents`(需用户明确范围):
36
+
37
+ ```bash
38
+ social-hub openclaw-ingest -t <team-id> -j '{"mode":"dry-run"}'
39
+ social-hub openclaw-ingest -t <team-id> -j '{
40
+ "mode": "apply",
41
+ "sourceRoot": "/path/to/agent-workspace",
42
+ "sourcePaths": { "guardrails": "shared/guardrails.md" }
43
+ }'
44
+ ```
45
+
46
+ **不要**在本 skill 内自动化批量 sync 整个 agent 工作区 `shared/`,除非用户明确要求并指定路径。
34
47
 
35
- 运行时查询请用 `social-hub-openclaw-context`,不是解析 Markdown。
48
+ 运行时查询请用 `social-hub-openclaw-context`(Hub DB 真源),不是解析 Markdown。
@@ -1,17 +1,26 @@
1
1
  ---
2
2
  name: social-hub-openclaw-context
3
3
  description: >-
4
- OpenClaw Agent 执行前上下文:social-hub context account/job、query account-pools、subreddit-candidates、
5
- export agent-context。用户问账号能发哪些版、任务上下文、板块池、guardrails、数据是否过期时,
6
- 必须用 Hub DB 聚合接口,不要解析 Javis/Moss/Panda 工作区里的 shared/*.md
4
+ OpenClaw Agent 执行前上下文:social-hub context account/job、query account-pools、
5
+ subreddit-candidates、export agent-context。用户问账号能发哪些版、任务上下文、板块池、
6
+ guardrails、数据是否过期时,必须用 Hub DB 聚合接口,不要解析 agent 工作区 Markdown
7
7
  metadata:
8
- cliVersion: ">=0.0.6"
8
+ cliVersion: ">=0.0.12"
9
9
  ---
10
10
 
11
11
  # social-hub-openclaw-context
12
12
 
13
13
  > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
14
- > 确认已 auth login。所有 `-t <team-id>` 与授权 team 一致。
14
+ > 确认已 `auth login`。所有 `-t <team-id>` 与授权 team 一致。
15
+
16
+ ## 与 shared 的分工
17
+
18
+ | 命令 | 所在 skill |
19
+ |------|------------|
20
+ | `context list` / `use` / `current` | `social-hub-shared` |
21
+ | `context account` / `context job` | 本 skill |
22
+ | `query account-pools` / `subreddit-candidates` | 本 skill |
23
+ | `export agent-context` | 本 skill(亦见 `social-hub-migration`) |
15
24
 
16
25
  ## 账号上下文
17
26
 
@@ -43,6 +52,12 @@ social-hub export agent-context -t <team-id> --account <uuid> -o /tmp/ctx.json
43
52
 
44
53
  ## freshness
45
54
 
46
- 响应中 `freshness.needsRefresh === true` 时,应先刷新账号指标或情报,再执行发帖/评论。
55
+ 响应中 `freshness.needsRefresh === true` 时,应先刷新账号指标或情报,再执行发帖/评论:
56
+
57
+ ```bash
58
+ social-hub accounts update -t <team-id> --account <uuid> -j '{"metricsUpdatedAt":"..."}'
59
+ social-hub reddit refresh-all -t <team-id>
60
+ social-hub intelligence fetch-by-industry -t <team-id> -j '{ ... }'
61
+ ```
47
62
 
48
63
  执行任务前配合 `social-hub-ops-runtime`;执行后 `ops complete` 回填 permalink。
@@ -4,25 +4,28 @@ 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.6"
7
+ cliVersion: ">=0.0.12"
8
8
  ---
9
9
 
10
10
  # social-hub-ops-runtime
11
11
 
12
12
  > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
13
- > 确认已 auth login 并 `context use <team-id>`。不要用环境变量传 team 或 API key。
13
+ > 确认已 `auth login` 并 `context use <team-id>`。
14
14
 
15
- Hub DB 是执行状态的真源;不要用 `shared/reddit-account-status.md` 等文件记录任务结果。
15
+ Hub DB 是执行状态的真源;不要用 agent 工作区 `shared/*.md` 记录任务结果。
16
16
 
17
17
  ## 推荐流程
18
18
 
19
19
  ```bash
20
- AGENT="javis" # 或 moss / 你的 agentId
20
+ AGENT="<agent-id>"
21
21
 
22
22
  social-hub ops claim-next -t <team-id> --agent "$AGENT"
23
+ # 或指定 job:
24
+ social-hub ops claim -t <team-id> --job <jobId> --agent "$AGENT"
25
+
23
26
  social-hub context job -t <team-id> --job <jobId>
24
27
  social-hub ops heartbeat -t <team-id> --job <jobId> --agent "$AGENT"
25
- # 执行 Reddit / 浏览器操作,并写 interaction events(见 social-hub-cli events)
28
+ # 执行 Reddit / 浏览器操作,并写 interaction events(见 social-hub-events-observability
26
29
  social-hub ops complete -t <team-id> --job <jobId> --agent "$AGENT" --permalink "https://reddit.com/..."
27
30
  ```
28
31
 
@@ -40,3 +43,5 @@ social-hub ops skip -t <team-id> --job <jobId> --agent "$AGENT" --reason manual_
40
43
  ## 并发
41
44
 
42
45
  同一账号同时只能有一个有效 lease;重复 claim 会被拒绝。`complete` 会原子更新 job 与关联 calendar(若 payload 含 calendarEntryId)。
46
+
47
+ 遗留路径 `jobs agent-status` 仅在未接 ops 链路时使用(见 `social-hub-calendar-jobs`)。
@@ -1,61 +1,92 @@
1
1
  ---
2
2
  name: social-hub-posts
3
3
  description: >-
4
- Reddit 帖快照与数据:social-hub reddit list/stats/refresh/refresh-all/create-snapshot/batch-upsert 等。
5
- 用户要查帖表现、刷新 score、写入/更新帖快照、permalink 对应快照时用本 skill(命令组名为 reddit)。
4
+ Reddit 帖快照 CRUD 与批量写入:social-hub reddit list/stats/refresh/refresh-all/
5
+ create-snapshot/update/delete/batch-upsert。用户要查帖表现、刷新 score、写入或更新
6
+ 外部来源帖快照时用本 skill(命令组名为 reddit)。不负责从飞书或其他系统取数。
6
7
  metadata:
7
- cliVersion: ">=0.0.6"
8
+ cliVersion: ">=0.0.12"
8
9
  ---
9
10
 
10
11
  # social-hub-posts
11
12
 
12
13
  > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
13
- > 确认已 auth login 并选定 team
14
+ > 确认已 `auth login` `context use <team-id>`。
15
+
16
+ ## 职责边界
17
+
18
+ | 做 | 不做 |
19
+ |---|---|
20
+ | Hub 内 Reddit 帖快照的查询、刷新、单条/批量写入 | 从飞书 Base、CSV、工作区 Markdown 读取并映射字段 |
21
+ | 说明 `batch-upsert` 的 JSON item 字段与幂等行为 | team 路由、外部 ETL 脚本、来源系统鉴权 |
22
+ | 删除/刷新前提示风险 | 用 `reddit import-feishu`(已废弃) |
23
+
24
+ 外部数据(飞书、表格、爬虫)应先在你自己的流程里整理成 JSON,再调用本模块命令写入 Hub。
14
25
 
15
26
  ## 查询与刷新
16
27
 
17
28
  ```bash
18
29
  social-hub reddit list -t <team-id> -n 20
19
30
  social-hub reddit stats -t <team-id> --campaign <uuid>
20
- social-hub reddit refresh-status -t <team-id> --id <snapshotId>
31
+ social-hub reddit refresh-status -t <team-id>
32
+ social-hub reddit refresh -t <team-id> --snapshot <snapshotId>
33
+ social-hub reddit refresh-progress -t <team-id> --task <taskId>
21
34
  social-hub reddit refresh-all -t <team-id>
22
35
  ```
23
36
 
24
- ## 写入帖快照(含飞书同步)
25
-
26
- **不要用 `reddit import-feishu`。** 飞书数据在本机用 `lark-cli` 读取,再用 Hub 写入命令同步。
37
+ ## 单条写入与更新
27
38
 
28
39
  ```bash
29
- # 本机读飞书 Base(示例)
30
- lark-cli base +record-list \
31
- --base-token <baseToken> \
32
- --table-id <tableId> \
33
- --view-id <viewId>
34
-
35
- # 单条补录
36
40
  social-hub reddit create-snapshot -t <team-id> -j '{
37
- "permalink": "https://www.reddit.com/r/.../comments/.../",
41
+ "permalink": "https://www.reddit.com/r/example/comments/abc/title/",
38
42
  "subreddit": "example",
43
+ "title": "Post title",
39
44
  "score": 0,
40
45
  "commentsCount": 0,
41
- "source": "feishu"
46
+ "source": "manual"
42
47
  }'
43
48
 
44
- # 批量幂等 upsert(推荐;同一 teamId + permalink 重复执行只更新)
49
+ social-hub reddit update -t <team-id> --snapshot <uuid> -j '{"score":42,"commentsCount":3}'
50
+ social-hub reddit delete -t <team-id> --snapshot <uuid> # 危险:确认用户意图
51
+ ```
52
+
53
+ ## 批量 upsert(外部来源帖快照)
54
+
55
+ ```bash
45
56
  social-hub reddit batch-upsert -t <team-id> -j '{
46
57
  "items": [
47
58
  {
48
- "permalink": "https://www.reddit.com/r/.../comments/.../",
59
+ "permalink": "https://www.reddit.com/r/example/comments/abc/title/",
49
60
  "subreddit": "example",
50
61
  "title": "...",
51
62
  "score": 12,
52
63
  "commentsCount": 3,
53
- "source": "feishu"
64
+ "source": "external",
65
+ "feishuRecordId": "recXXX",
66
+ "baseToken": "optional-base-token",
67
+ "tableId": "optional-table-id",
68
+ "viewCount": 100,
69
+ "brandRaw": "BrandName",
70
+ "rawPayload": { "custom": "fields" }
54
71
  }
55
72
  ]
56
- }'
73
+ }' --dry-run
57
74
  ```
58
75
 
59
- 多品牌/多 team:先 `social-hub agent-teams list` 建立品牌 → teamId 映射,再对每个 team 分别调用 `batch-upsert`(`-t` 为目标 team UUID)。
76
+ ### Item 字段说明
77
+
78
+ - **必填(推荐)**:`subreddit`;有真实 Reddit 链接时带 `permalink`
79
+ - **可选**:`title`、`score`、`commentsCount`、`postedAt`、`source`、`rawPayload`
80
+ - **`feishuRecordId`**:飞书记录 ID。当输入来自飞书时,Hub 优先按 `(teamId, feishuRecordId)` 幂等;同一 permalink 对应不同飞书记录时,后续记录可能获得 `feishu.local` 占位 permalink
81
+ - **无 permalink**:可只带 `feishuRecordId`(及 `baseToken`/`tableId`),Hub 会生成稳定占位 URL
82
+
83
+ ### 幂等与风险
84
+
85
+ - 重复 `batch-upsert` 同一条外部记录应更新而非重复插入(取决于提供的幂等键)
86
+ - `delete` 不可恢复;批量写入前先 `--dry-run` 查看计数
87
+ - 不要用已废弃的 `reddit import-feishu`
88
+
89
+ ## 与发布链路的关系
60
90
 
61
- 发帖成功后应通过 `social-hub ops complete --permalink ...` 写回任务链路(见 `social-hub-publishing` / `social-hub-ops-runtime`)。
91
+ 发帖任务成功后,优先通过 `social-hub ops complete --permalink ...` 回填(见 `social-hub-ops-runtime`)。
92
+ 需要手动补快照时用 `create-snapshot` 或 `batch-upsert`。
@@ -0,0 +1,23 @@
1
+ {
2
+ "skill_name": "social-hub-posts",
3
+ "evals": [
4
+ {
5
+ "id": 0,
6
+ "prompt": "查 team <team-id> 最近 20 条 Reddit 帖快照,并按 campaign <campaign-id> 看 stats 汇总。我已 auth login。",
7
+ "expected_output": "social-hub reddit list、reddit stats;不路由到飞书同步或 lark-cli",
8
+ "assertions": []
9
+ },
10
+ {
11
+ "id": 1,
12
+ "prompt": "我有一批外部 JSON 帖数据(含 permalink、subreddit、score、feishuRecordId recABC),要批量写入 Hub team <team-id>,先 dry-run 再 apply。",
13
+ "expected_output": "social-hub reddit batch-upsert --dry-run 然后正式 upsert;说明 feishuRecordId 幂等;不展开飞书取数流程",
14
+ "assertions": []
15
+ },
16
+ {
17
+ "id": 2,
18
+ "prompt": "刷新 team <team-id> 全部 Reddit 帖 score,并查看 refresh 任务进度。",
19
+ "expected_output": "social-hub reddit refresh-all、reddit refresh-status 或 refresh-progress",
20
+ "assertions": []
21
+ }
22
+ ]
23
+ }
@@ -1,34 +1,98 @@
1
1
  ---
2
2
  name: social-hub-publishing
3
3
  description: >-
4
- 内容发布闭环:campaign → plan → draft → calendar → scheduled_job → eventsreddit snapshot → report。
5
- 用户要从草稿到排期、执行任务、permalink 回填、避免 job 成功但 calendar 未更新时用本 skill。
4
+ 内容发布闭环:brands、campaigns、plans、drafts、calendar、jobs、eventsreddit snapshot
5
+ reports。用户要从草稿到排期、执行任务、permalink 回填、避免 job 成功但 calendar 未更新时用本 skill。
6
6
  metadata:
7
- cliVersion: ">=0.0.6"
7
+ cliVersion: ">=0.0.12"
8
8
  ---
9
9
 
10
10
  # social-hub-publishing
11
11
 
12
12
  > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
13
- > 确认已 auth login 并 `context use <team-id>`。
13
+ > 确认已 `auth login` 并 `context use <team-id>`。
14
14
 
15
15
  ## 事实源
16
16
 
17
17
  - **计划**:`calendar_entries`
18
18
  - **执行**:`scheduled_jobs`
19
- - 本地 Markdown 日历仅作导入/导出视图,不是运行时真源
19
+ - agent 工作区 Markdown 日历仅作导入/导出视图,不是运行时真源
20
20
 
21
21
  ## 链路
22
22
 
23
23
  ```
24
- campaignpublishing_plan → content_draft → calendar_entry → scheduled_job
24
+ brandcampaign → content_draft → publishing_plan → calendar_entry → scheduled_job
25
25
  → interaction_events → reddit_post_snapshot → op_report
26
26
  ```
27
27
 
28
- ## Agent 推荐
28
+ ## 品牌与 Campaign
29
29
 
30
- 1. 创建/查询 draft、plan、calendar、job(见 `social-hub-cli` 对应命令)
31
- 2. `social-hub ops claim-next` → 执行 → `social-hub ops complete --permalink <url>`
32
- 3. `complete` 原子更新 job + calendar(+ 可选 snapshot id)
30
+ ```bash
31
+ social-hub brands list -t <team-id>
32
+ social-hub brands create -t <team-id> -j '{"name":"My Brand","slug":"my-brand"}'
33
+ social-hub brands update -t <team-id> --brand <uuid> -j '{"name":"Updated"}'
33
34
 
34
- 失败时 `ops fail` / `ops skip`,并使用标准 `reason` 枚举(见 `social-hub-ops-runtime`)。
35
+ social-hub campaigns list -t <team-id> [--brand <uuid>]
36
+ social-hub campaigns create -t <team-id> -j '{"brandId":"<uuid>","name":"2026 Launch"}'
37
+ social-hub campaigns get -t <team-id> --campaign <uuid>
38
+ social-hub campaigns update -t <team-id> --campaign <uuid> -j '{"name":"Renamed"}'
39
+
40
+ social-hub campaigns accounts list -t <team-id> --campaign <uuid>
41
+ social-hub campaigns accounts assign -t <team-id> --campaign <uuid> --account <uuid>
42
+ social-hub campaigns accounts remove -t <team-id> --campaign <uuid> --account <uuid>
43
+ ```
44
+
45
+ ## 草稿与计划
46
+
47
+ ```bash
48
+ social-hub drafts list -t <team-id> -n 20
49
+ social-hub drafts create -t <team-id> -j '{"campaignId":"<uuid>","title":"Launch","body":"..."}'
50
+ social-hub drafts get -t <team-id> --draft <uuid>
51
+ social-hub drafts update -t <team-id> --draft <uuid> -j '{"body":"..."}'
52
+ social-hub drafts delete -t <team-id> --draft <uuid>
53
+
54
+ social-hub plans list -t <team-id>
55
+ social-hub plans create -t <team-id> -j '{"campaignId":"<uuid>","name":"Week 1","entries":[...]}'
56
+ social-hub plans cancel -t <team-id> --plan <uuid>
57
+ ```
58
+
59
+ ## 日历与任务
60
+
61
+ 见 `social-hub-calendar-jobs`:
62
+
63
+ ```bash
64
+ social-hub calendar list -t <team-id> --status scheduled
65
+ social-hub jobs list -t <team-id> --status scheduled
66
+ ```
67
+
68
+ ## Agent 执行与回填
69
+
70
+ 优先 ops 链路(见 `social-hub-ops-runtime`):
71
+
72
+ ```bash
73
+ social-hub ops claim-next -t <team-id> --agent <agent-id>
74
+ social-hub ops complete -t <team-id> --job <jobId> --agent <agent-id> --permalink "https://..."
75
+ ```
76
+
77
+ 手动回填(无 ops 时):
78
+
79
+ ```bash
80
+ social-hub calendar patch -t <team-id> -e <entryId> --body '{"status":"succeeded","permalink":"..."}'
81
+ social-hub events append -t <team-id> --type post.published --payload '{"permalink":"..."}'
82
+ ```
83
+
84
+ ## 帖快照与报告
85
+
86
+ ```bash
87
+ social-hub reddit create-snapshot -t <team-id> -j '{ ... }' # 见 social-hub-posts
88
+ social-hub reports list -t <team-id>
89
+ social-hub reports create -t <team-id> -j '{"title":"Weekly","bodyMarkdown":"..."}'
90
+ ```
91
+
92
+ ## 决策:ops complete vs 手动 patch
93
+
94
+ | 场景 | 推荐 |
95
+ |------|------|
96
+ | OpenClaw/Agent 刚执行完 scheduled job | `ops complete` |
97
+ | 无 job、仅补 calendar 状态 | `calendar patch` + `events append` |
98
+ | 外部已发帖、补 Hub 快照 | `reddit create-snapshot` 或 `batch-upsert` |
@@ -6,7 +6,7 @@ description: >-
6
6
  权限不足、或任何 Hub CLI 写操作前必须先读本 skill。Agent 日常凭证只用 auth login,
7
7
  不要用 SOCIAL_HUB_API_KEY 环境变量。
8
8
  metadata:
9
- cliVersion: ">=0.0.6"
9
+ cliVersion: ">=0.0.12"
10
10
  ---
11
11
 
12
12
  # social-hub-shared
@@ -65,7 +65,9 @@ social-hub auth login --duration long
65
65
  ```bash
66
66
  social-hub auth whoami # 同 auth status;含 role、teamId、visibleTeamIds
67
67
  social-hub auth status
68
- social-hub auth explain # 当前 role 可用命令
68
+ social-hub auth explain # 当前 role 可用命令(本地 gate 表)
69
+ social-hub permissions matrix -t <team-id> # 团队权限矩阵(API)
70
+ social-hub permissions explain # CLI 命令与权限映射
69
71
  social-hub auth logout
70
72
  social-hub auth logout --revoke # 同时撤销服务端 CLI token
71
73
  ```
@@ -75,7 +77,7 @@ social-hub auth logout --revoke # 同时撤销服务端 CLI token
75
77
  多数命令需要 `-t <team-uuid>`。先持久化当前 team,示例里可直接引用:
76
78
 
77
79
  ```bash
78
- social-hub context use <team-uuid> [--label "moss"]
80
+ social-hub context use <team-uuid> [--label "prod-team-a"]
79
81
  social-hub context current
80
82
  social-hub context list # 含 authTeamId、visibleTeamIds
81
83
  ```
@@ -118,9 +120,11 @@ CLI 仍兼容 `social-hub auth login --api-key sk_live_…` 与 `SOCIAL_HUB_API_
118
120
  1. `social-hub doctor` — API 可达性、`/health/live`、auth context
119
121
  2. `social-hub auth whoami` — 确认 `role` 与 `teamId`
120
122
  3. `social-hub context current` — 确认 `-t` 与授权 team 一致
121
- 4. `social-hub auth explain` — 当前 role 是否允许该命令
123
+ 4. `social-hub auth explain` — 当前 role 是否允许该命令(基于 CLI 本地 gate 表)
122
124
  5. 403 / permission denied — 换有权限的 Web 账号重新 `auth login`,或请 admin 调整成员角色
123
125
 
126
+ CLI 对部分命令(含 admin 域 settings/invites/members、reddit/accounts 写操作)会**先本地 RBAC 预检**再调 API;`auth explain` 展示的是本地 gate 映射,**后端 `assertRuntimePermission` 仍是最终裁决**。
127
+
124
128
  admin 专属操作(如 `agent-teams create`)需要 **admin** role 的 CLI token,不是「随便创建一个 API Key」就能替代。
125
129
 
126
130
  ## 安全规则