yuanflow-cli 0.1.1 → 0.1.2

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.
@@ -90,6 +90,11 @@ function resolveRepositoryRoot(extractDir) {
90
90
  }
91
91
 
92
92
  function resolveLocalSkillRoot(packageRoot) {
93
+ const packagedRoot = path.resolve(packageRoot, 'skills', 'yuanflow-skill');
94
+ if (fs.existsSync(path.join(packagedRoot, 'SKILL.md'))) {
95
+ return packagedRoot;
96
+ }
97
+
93
98
  const localRoot = path.resolve(packageRoot, '..', 'YuanFlow-skill');
94
99
  if (fs.existsSync(path.join(localRoot, 'SKILL.md'))) {
95
100
  return localRoot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuanflow-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "YuanFlow API CLI and skill installer for supported AI coding agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,6 +28,7 @@
28
28
  "generated",
29
29
  "scripts",
30
30
  "lib",
31
+ "skills",
31
32
  "README.md",
32
33
  "LICENSE"
33
34
  ],
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: yuanflow-skill
3
+ description: Use when the user asks about social-media API workflows, platform data queries, command discovery, or choosing among yuanflow-cli sub-skills for atomic access to Douyin, Xiaohongshu, Bilibili, WeChat, TikTok, YouTube, Weibo, Zhihu and related platforms.
4
+ ---
5
+
6
+ # YuanFlow Skill
7
+
8
+ 这个目录是 yuanflow-cli 能力总入口,只负责分流和索引,不重复维护子 Skill 的内部规则。
9
+
10
+ ## 当前发布范围
11
+
12
+ 当前 skill 目录只包含:
13
+
14
+ - 根目录这一份 `SKILL.md`
15
+ - `yuanflow-cli/`
16
+
17
+ ## 分流规则
18
+
19
+ ### 1. 走 `yuanflow-cli`
20
+
21
+ 遇到下面这些需求,直接进入这个子 Skill:
22
+
23
+ - 调用自媒体平台原子级 API
24
+ - 查询接口列表、命令列表、schema、帮助命令
25
+ - 获取抖音、小红书、B站、微信视频号、微信公众号等平台数据
26
+ - 查询作品详情、作者主页、评论、搜索结果、热榜、文章详情
27
+ - 使用 `yuanflow-cli` npm 包
28
+
29
+ 适合的典型输入:
30
+
31
+ - 平台名和数据查询目标
32
+ - 作品 URL、笔记 ID、BV 号、公众号文章 URL
33
+ - API 路径或 endpoint 名称
34
+ - “查一下有哪些接口可以用”
35
+ - “帮我用 CLI 调这个接口”
36
+
37
+ 子 Skill 名称:
38
+
39
+ - `yuanflow-cli`
40
+
41
+ ## 多需求时怎么处理
42
+
43
+ 如果用户一次提了多段流程,不要强行塞进一个子 Skill,按阶段拆开:
44
+
45
+ 1. 先判断目标平台
46
+ 2. 再判断当前处于数据查询、取材还是处理阶段
47
+ 3. 把每一段交给对应的子 Skill
48
+
49
+ 例如:
50
+
51
+ - “查抖音作品详情、评论、热榜”:
52
+ 走 `yuanflow-cli`
53
+
54
+ ## 维护规则
55
+
56
+ - 这个总 Skill 只维护分流逻辑
57
+ - 子 Skill 内部内容保持各自独立
58
+ - 子 Skill 自己升级时,只改子 Skill 目录
59
+ - 总 Skill 不复制子 Skill 的脚本细节
60
+ - 只要子 Skill 名称保持不变,这个总入口就可以继续工作
@@ -0,0 +1,207 @@
1
+ ---
2
+ name: yuanflow-cli
3
+ description: Use when the user needs atomic API calls for social-media platforms through the yuanflow-cli CLI, including Douyin, Xiaohongshu, Bilibili, WeChat Channels, WeChat MP, TikTok, YouTube, Weibo, Zhihu, Instagram, Twitter/X, Reddit and other platform data queries, command discovery, schema lookup, dry-run validation, or stable agent-json output.
4
+ ---
5
+
6
+ # YuanFlow CLI
7
+
8
+ 这个 Skill 用于调用 `yuanflow-cli` 这个 npm 包。它适合做原子级 API 调用:查作品详情、下载地址、作者主页、评论、搜索结果、热榜、公众号文章、视频号内容等。
9
+
10
+ ## 先判断是否要用
11
+
12
+ 遇到下面这类需求,优先使用本 Skill:
13
+
14
+ - 用户要查某个平台的数据,而不是写文案或发布内容
15
+ - 用户要调用抖音、小红书、B站、微信视频号、微信公众号等接口
16
+ - 用户要看可用接口、命令列表、schema、请求参数
17
+ - 用户要用 CLI 调接口并保存 JSON
18
+ - 用户要让 Agent 稳定解析调用结果
19
+
20
+ ## 安装和更新
21
+
22
+ 要求 Node.js 20 或更高版本。
23
+
24
+ ```powershell
25
+ npm install -g yuanflow-cli
26
+ ```
27
+
28
+ 更新到最新版:
29
+
30
+ ```powershell
31
+ npm update -g yuanflow-cli
32
+ ```
33
+
34
+ 查看已安装版本:
35
+
36
+ ```powershell
37
+ npm list -g yuanflow-cli --depth=0
38
+ npm view yuanflow-cli version
39
+ ```
40
+
41
+ 命令入口:
42
+
43
+ ```powershell
44
+ yuanflow-cli --help
45
+ ```
46
+
47
+ ## 配置
48
+
49
+ 保存 Yuan API 令牌和服务地址:
50
+
51
+ ```powershell
52
+ yuanflow-cli config set-token <你的令牌>
53
+ yuanflow-cli config set-base-url https://open.yuanchuangai.com
54
+ yuanflow-cli config show
55
+ ```
56
+
57
+ 也可以临时传参,不写入配置文件:
58
+
59
+ ```powershell
60
+ yuanflow-cli douyin video-detail "https://v.douyin.com/xxx/" --token <你的令牌>
61
+ ```
62
+
63
+ 或用环境变量:
64
+
65
+ ```powershell
66
+ $env:YUANFLOW_TOKEN="<你的令牌>"
67
+ yuanflow-cli douyin hot-search
68
+ ```
69
+
70
+ ## Agent 调用规则
71
+
72
+ 给 AI Agent 使用时,先查命令和 schema,再调用接口。
73
+
74
+ ```powershell
75
+ yuanflow-cli commands list
76
+ yuanflow-cli commands describe douyin.video-detail
77
+ yuanflow-cli schema douyin.video-detail
78
+ ```
79
+
80
+ 业务调用建议加 `--format agent-json`,输出会固定成:
81
+
82
+ ```json
83
+ {
84
+ "success": true,
85
+ "command": "douyin video-detail",
86
+ "data": {},
87
+ "warnings": [],
88
+ "error": null,
89
+ "meta": {}
90
+ }
91
+ ```
92
+
93
+ 失败时读取 `error.code` 和 `error.message`。常见错误码:
94
+
95
+ | 错误码 | 含义 |
96
+ | --- | --- |
97
+ | `TOKEN_MISSING` | 没有配置 Yuan API token |
98
+ | `BAD_ARGUMENT` | 参数或命令写错 |
99
+ | `AUTH_INVALID` | token 无效或权限不足 |
100
+ | `UPSTREAM_ERROR` | 上游平台或服务报错 |
101
+ | `NETWORK_ERROR` | 网络或超时错误 |
102
+ | `INTERNAL_ERROR` | 未分类错误 |
103
+
104
+ ## 命令发现
105
+
106
+ 这个 CLI 有两类命令:
107
+
108
+ - 高频快捷命令:更适合日常使用,例如 `douyin video-detail`
109
+ - 自动生成 endpoint 命令:覆盖完整接口,例如 `douyin app v3 fetch-multi-video-v2`
110
+
111
+ 常用发现命令:
112
+
113
+ ```powershell
114
+ yuanflow-cli shortcuts
115
+ yuanflow-cli shortcuts douyin
116
+ yuanflow-cli list douyin
117
+ yuanflow-cli commands list
118
+ yuanflow-cli commands describe xiaohongshu.search-notes
119
+ yuanflow-cli schema xiaohongshu.search-notes
120
+ ```
121
+
122
+ 当前 registry 覆盖的平台包括:
123
+
124
+ `bilibili`、`douyin`、`instagram`、`kuaishou`、`lemon8`、`linkedin`、`pipixia`、`reddit`、`threads`、`tiktok`、`toutiao`、`twitter`、`wechat`、`weibo`、`xiaohongshu`、`xigua`、`youtube`、`zhihu`。
125
+
126
+ ## 通用透传调用
127
+
128
+ 快捷命令没有覆盖到的接口,用 `call` 直接传 `/social` 后面的路径。
129
+
130
+ ```powershell
131
+ yuanflow-cli call /douyin/app/v3/fetch_multi_video_v2 --json "{\"url\":\"https://v.douyin.com/xxx/\"}"
132
+ ```
133
+
134
+ 如果要核对请求但不真正发起请求,用 `--dry-run`:
135
+
136
+ ```powershell
137
+ yuanflow-cli douyin user-posts sec_user_id --count 20 --dry-run
138
+ ```
139
+
140
+ 保存结果到文件:
141
+
142
+ ```powershell
143
+ yuanflow-cli bilibili video-detail "https://www.bilibili.com/video/BVxxx" -o bilibili-video.json
144
+ ```
145
+
146
+ ## 高频快捷命令
147
+
148
+ ### 抖音
149
+
150
+ | 需求 | 命令 |
151
+ | --- | --- |
152
+ | 作品详情 | `yuanflow-cli douyin video-detail "https://v.douyin.com/xxx/" --format agent-json` |
153
+ | 视频播放/下载地址 | `yuanflow-cli douyin video-download "https://v.douyin.com/xxx/" --region CN --format agent-json` |
154
+ | 作者主页资料 | `yuanflow-cli douyin user-profile <sec_user_id> --format agent-json` |
155
+ | 作者作品列表 | `yuanflow-cli douyin user-posts <sec_user_id> --count 20 --cursor 0 --format agent-json` |
156
+ | 作品评论 | `yuanflow-cli douyin comments <aweme_id> --count 20 --cursor 0 --format agent-json` |
157
+ | 抖音热榜 | `yuanflow-cli douyin hot-search --format agent-json` |
158
+
159
+ ### 小红书
160
+
161
+ | 需求 | 命令 |
162
+ | --- | --- |
163
+ | 笔记详情 | `yuanflow-cli xiaohongshu note-detail <note_id> --xsec-token <xsec_token> --format agent-json` |
164
+ | 笔记评论 | `yuanflow-cli xiaohongshu note-comments <note_id> --cursor <cursor> --format agent-json` |
165
+ | 搜索笔记 | `yuanflow-cli xiaohongshu search-notes "关键词" --page 1 --sort general --note-type 0 --format agent-json` |
166
+ | 搜索用户 | `yuanflow-cli xiaohongshu search-users "关键词" --page 1 --format agent-json` |
167
+ | 作者笔记 | `yuanflow-cli xiaohongshu user-notes <user_id> --cursor <cursor> --format agent-json` |
168
+
169
+ ### Bilibili
170
+
171
+ | 需求 | 命令 |
172
+ | --- | --- |
173
+ | 视频详情 | `yuanflow-cli bilibili video-detail "https://www.bilibili.com/video/BVxxx" --format agent-json` |
174
+ | 视频播放信息 | `yuanflow-cli bilibili video-download "https://www.bilibili.com/video/BVxxx" --format agent-json` |
175
+ | 按 BV 和 cid 获取视频流 | `yuanflow-cli bilibili video-playurl <bv_id> <cid> --format agent-json` |
176
+ | UP 主资料 | `yuanflow-cli bilibili user-profile <uid> --format agent-json` |
177
+ | UP 主投稿 | `yuanflow-cli bilibili user-posts <uid> --page 1 --order pubdate --format agent-json` |
178
+ | 综合搜索 | `yuanflow-cli bilibili search "关键词" --page 1 --page-size 20 --order totalrank --format agent-json` |
179
+ | 视频评论 | `yuanflow-cli bilibili comments <bv_id> --page 1 --format agent-json` |
180
+
181
+ ### 微信视频号
182
+
183
+ | 需求 | 命令 |
184
+ | --- | --- |
185
+ | 综合搜索 | `yuanflow-cli wechat channels-search "关键词" --format agent-json` |
186
+ | 最新视频搜索 | `yuanflow-cli wechat channels-latest "关键词" --format agent-json` |
187
+ | 用户搜索 | `yuanflow-cli wechat channels-user-search "关键词" --page 1 --format agent-json` |
188
+ | 视频详情 | `yuanflow-cli wechat channels-video-detail <id> --export-id <exportId> --format agent-json` |
189
+ | 主页采集 | `yuanflow-cli wechat channels-home --json "{...}" --format agent-json` |
190
+
191
+ ### 微信公众号
192
+
193
+ | 需求 | 命令 |
194
+ | --- | --- |
195
+ | 文章详情 JSON | `yuanflow-cli wechat mp-article-detail "https://mp.weixin.qq.com/s/xxx" --format agent-json` |
196
+ | 文章 HTML | `yuanflow-cli wechat mp-article-html "https://mp.weixin.qq.com/s/xxx" --format agent-json` |
197
+ | 文章列表 | `yuanflow-cli wechat mp-article-list <ghid> --offset 0 --format agent-json` |
198
+ | 文章评论 | `yuanflow-cli wechat mp-comments "https://mp.weixin.qq.com/s/xxx" --comment-id <comment_id> --buffer <buffer> --format agent-json` |
199
+
200
+ ## 使用习惯
201
+
202
+ - 不确定命令时,先执行 `yuanflow-cli shortcuts <platform>`。
203
+ - 不确定参数时,执行 `yuanflow-cli schema <command-key>`。
204
+ - 不确定完整接口名时,执行 `yuanflow-cli list <platform>`。
205
+ - 调真实接口前,先用 `--dry-run` 核对 URL、method、headers 和 body。
206
+ - Agent 自动处理结果时,统一加 `--format agent-json`。
207
+ - 不要把 token 写进文档、日志或最终回复。