yuanflow-cli 0.1.37 → 0.1.40

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 (26) hide show
  1. package/README.md +50 -1
  2. package/package.json +1 -1
  3. package/skills/yuanflow-skill/IP/350/277/220/350/220/245/SKILL.md +1 -0
  4. package/skills/yuanflow-skill/README.md +12 -2
  5. package/skills/yuanflow-skill/SKILL.md +12 -4
  6. package/skills/yuanflow-skill//345/205/254/344/274/227/345/217/267/347/224/237/346/210/220/344/270/216/345/217/221/345/270/203/SKILL.md +1 -1
  7. package/skills/yuanflow-skill//345/210/233/344/275/234/346/200/273/347/233/221/SKILL.md +94 -0
  8. package/skills/yuanflow-skill//345/260/217/347/272/242/344/271/246/350/277/220/350/220/245/{344/270/216/345/217/221/345/270/203/SKILL.md → SKILL.md} +14 -6
  9. package/skills/yuanflow-skill//345/270/220/345/217/267/345/256/232/344/275/215/SKILL.md +1 -0
  10. package/skills/yuanflow-skill//346/226/207/346/241/210/345/210/233/344/275/234/SKILL.md +1 -0
  11. package/skills/yuanflow-skill//347/203/255/351/227/250/345/206/205/345/256/271/346/225/264/347/220/206/SKILL.md +83 -0
  12. package/skills/yuanflow-skill//347/233/264/346/222/255/346/212/225/346/265/201/347/255/226/347/225/245/SKILL.md +1 -0
  13. package/skills/yuanflow-skill//347/233/264/346/222/255/350/257/235/346/234/257/347/224/237/346/210/220/SKILL.md +1 -0
  14. package/skills/yuanflow-skill//350/207/252/345/252/222/344/275/223/346/265/217/350/247/210/345/231/250/350/207/252/345/212/250/345/214/226/SKILL.md +23 -3
  15. package/skills/yuanflow-skill//350/207/252/345/252/222/344/275/223/347/237/245/350/257/206/345/272/223/SKILL.md +4 -0
  16. package/skills/yuanflow-skill//350/247/206/351/242/221/346/212/225/346/265/201/347/255/226/347/225/245/SKILL.md +1 -0
  17. package/skills/yuanflow-skill//350/247/206/351/242/221/346/231/272/350/203/275/345/211/252/350/276/221/SKILL.md +374 -0
  18. package/skills/yuanflow-skill//351/200/211/351/242/230/347/255/226/345/210/222/SKILL.md +1 -0
  19. package/skills/yuanflow-skill//351/243/236/344/271/246/345/256/230/346/226/271/346/212/200/350/203/275/SKILL.md +93 -0
  20. package/src/agent-protocol.js +6 -0
  21. package/src/cli.js +43 -0
  22. package/src/trending-tools.js +117 -0
  23. package/src/video-tools.js +969 -0
  24. /package/skills/yuanflow-skill//345/260/217/347/272/242/344/271/246/350/277/220/350/220/245/{344/270/216/345/217/221/345/270/203/references → references}/commands.md" +0 -0
  25. /package/skills/yuanflow-skill//345/260/217/347/272/242/344/271/246/350/277/220/350/220/245/{344/270/216/345/217/221/345/270/203/references → references}/interaction-policy.md" +0 -0
  26. /package/skills/yuanflow-skill//345/260/217/347/272/242/344/271/246/350/277/220/350/220/245/{344/270/216/345/217/221/345/270/203/references → references}/publishing-policy.md" +0 -0
@@ -0,0 +1,374 @@
1
+ ---
2
+ name: 视频智能剪辑
3
+ description: "用于把主音频、文案、B-roll 视频或图片素材组合成可解释的智能剪辑项目。执行前先查询自媒体知识库中的视频剪辑策略规则,再用音视频在线转文字取得 ASR/时间戳,导入音频对齐,按 1秒1帧抽帧并回写视觉理解,由 Agent 生成 EDL,交给 yuanflow-cli video 校验和渲染。"
4
+ metadata:
5
+ builtin_skill_version: "1.0.1"
6
+ yuanflow:
7
+ emoji: "🎬"
8
+ requires:
9
+ ffmpeg: true
10
+ tags:
11
+ - creator
12
+ - video
13
+ - editing
14
+ - broll
15
+ ---
16
+
17
+ # 视频智能剪辑技能
18
+
19
+ 当用户要求自动剪辑、智能剪辑、用口播音频匹配画面、把 B-roll 素材配成视频、重排视频画面、生成预览剪辑或导出成片时,使用本 Skill。
20
+
21
+ ## 规则库优先
22
+
23
+ 视频剪辑策略不写死在本 Skill 里。接到视频剪辑任务后,先调用“自媒体知识库”能力查询 `视频剪辑策略`,再执行剪辑。
24
+
25
+ 推荐查询顺序:
26
+
27
+ 1. 先用 `knowledge entry` 建立任务入口,`domain` 填 `视频剪辑`,`content_goal` 写清本次剪辑目标。
28
+ - 查询时,必须先明确用户具体需求,然后从知识库的一级能力开始,依次使用渐进式查询。不能跳级、跨越式查询。
29
+ 2. 再用 `knowledge packs --capability-code video_editing_strategy` 查看视频剪辑策略下的方法包。
30
+ 3. 必查 `video_edit_logic_layer_pack`,获得通用剪辑逻辑层规则。
31
+ 4. 如果任务是口播、旁白、主音频驱动,查询 `talking_head_edit_template_pack`。
32
+ 5. 如果任务是带货、种草、产品转化,查询 `short_video_sales_edit_template_pack`。
33
+ 6. 必查 `video_cli_validation_render_pack`,获得 EDL 校验、预览、自检和基础渲染规则。
34
+ 7. 读取每个规则包下的 `rules` 或 `rule-detail` 后,再生成 timeline plan / EDL。
35
+
36
+ YuanFlow 主程序内优先用 `yuanflow_cli_call` 调用知识库,不要让用户手动提供 token:
37
+
38
+ ```json
39
+ {
40
+ "args": [
41
+ "knowledge",
42
+ "entry",
43
+ "--domain",
44
+ "视频剪辑",
45
+ "--content-goal",
46
+ "口播视频剪辑,需要主音频匹配 B-roll 并生成 EDL",
47
+ "--communication-mode",
48
+ "口播",
49
+ "--output-format",
50
+ "video_edit_plan",
51
+ "--format",
52
+ "agent-json"
53
+ ]
54
+ }
55
+ ```
56
+
57
+ 查询规则包示例:
58
+
59
+ ```json
60
+ {
61
+ "args": [
62
+ "knowledge",
63
+ "rules",
64
+ "--pack-code",
65
+ "video_edit_logic_layer_pack",
66
+ "--domain",
67
+ "视频剪辑",
68
+ "--content-goal",
69
+ "口播视频剪辑,需要主音频匹配 B-roll 并生成 EDL",
70
+ "--output-format",
71
+ "video_edit_plan",
72
+ "--format",
73
+ "agent-json"
74
+ ]
75
+ }
76
+ ```
77
+
78
+ 如果知识库暂时不可用,要明确说明规则库查询失败,再按本 Skill 的基础版流程兜底执行;不能假装已经读取了规则库。
79
+
80
+ ### 保存策略快照
81
+
82
+ 人工测试或 Agent 执行时,把知识库查询结果保存为 JSON 文件后,导入剪辑项目:
83
+
84
+ ```bash
85
+ yuanflow-cli video strategy \
86
+ --project "D:\素材\yuanflow-video-edit" \
87
+ --template-type talking_head \
88
+ --rules-file "D:\规则\logic.json,D:\规则\talking_head.json,D:\规则\cli.json" \
89
+ --format agent-json
90
+ ```
91
+
92
+ `--template-type` 可用:
93
+
94
+ - `talking_head`:口播/旁白/主音频驱动。
95
+ - `short_video_sales`:短视频带货/种草/产品转化。
96
+
97
+ CLI 会生成 `strategy_snapshot.json`,后续 Agent 必须基于这个快照生成 `timeline_plan.agent.json` 和 EDL。
98
+
99
+ ## 基础版边界
100
+
101
+ 基础版必须支持“主音频 + B-roll 素材匹配”:
102
+
103
+ - 主音频可以是口播、旁白或已经录好的音频。
104
+ - B-roll 可以是视频或图片素材。
105
+ - 第一版音频对齐优先使用“音视频在线转文字”Skill 的 ASR 时间戳结果;如果 ASR 没有时间戳,使用 forced alignment 或人工按文案切分,不编造时间戳。
106
+ - 第一版视觉理解不调用固定视觉模型,使用 `yuanflow-cli video timeline --fps 1` 按 1秒1帧抽帧。
107
+ - Agent 或人工需要查看抽帧结果,判断每段画面的语义、主体、动作和适合承接的文案,再用 `video visual-review` 回写结构化视觉描述。
108
+ - 第一版 `video plan` 不自动生成 EDL,由 Agent 生成 EDL 后交给 CLI 校验和渲染。
109
+
110
+ ## 执行原则
111
+
112
+ - 不要直接手写随意 ffmpeg 命令完成剪辑。
113
+ - 不要把素材目录当输出目录乱写文件。
114
+ - 所有中间产物进入独立剪辑项目目录。
115
+ - 每个 EDL 片段必须有 `reason`,说明为什么选这段画面。
116
+ - 如果素材无法支撑文案,要明确报告缺少素材,不要硬凑。
117
+ - 在 YuanFlow 主程序内优先调用 `yuanflow_cli_call`,外部 Agent 才直接运行本地 `yuanflow-cli`。
118
+
119
+ ## YuanFlow 主程序内调用
120
+
121
+ 使用 `yuanflow_cli_call` 时,参数数组不要包含 token:
122
+
123
+ ```json
124
+ {
125
+ "args": [
126
+ "video",
127
+ "init",
128
+ "--input",
129
+ "D:\\素材",
130
+ "--primary-audio",
131
+ "D:\\素材\\口播.mp3",
132
+ "--broll",
133
+ "D:\\素材\\素材1.mp4,D:\\素材\\素材2.mp4",
134
+ "--target-duration",
135
+ "60",
136
+ "--aspect",
137
+ "9:16",
138
+ "--format",
139
+ "agent-json"
140
+ ]
141
+ }
142
+ ```
143
+
144
+ ## 标准流程
145
+
146
+ ### 1. 初始化项目
147
+
148
+ ```bash
149
+ yuanflow-cli video init \
150
+ --input "D:\素材" \
151
+ --primary-audio "D:\素材\口播.mp3" \
152
+ --broll "D:\素材\素材1.mp4,D:\素材\素材2.mp4" \
153
+ --target-duration 60 \
154
+ --aspect 9:16 \
155
+ --format agent-json
156
+ ```
157
+
158
+ ### 2. 扫描素材
159
+
160
+ ```bash
161
+ yuanflow-cli video inspect --project "D:\素材\yuanflow-video-edit" --format agent-json
162
+ ```
163
+
164
+ 如果只是验证命令结构,可以加 `--dry-run`。
165
+
166
+ ### 3. 音频对齐
167
+
168
+ 主音频驱动的剪辑必须先建立音频时间轴。优先使用“音视频在线转文字”Skill 调用在线 ASR;如果 ASR 返回 `segments` / `words` 时间戳,保存为 JSON 后导入:
169
+
170
+ ```bash
171
+ yuanflow-cli video align \
172
+ --project "D:\素材\yuanflow-video-edit" \
173
+ --asr-file "D:\素材\asr.json" \
174
+ --format agent-json
175
+ ```
176
+
177
+ 如果 ASR 只返回纯文本,没有时间戳:
178
+
179
+ - 先明确说明缺少时间戳。
180
+ - 可用 forced alignment 或人工按文案切分生成 `segments`。
181
+ - 只有在用户允许“粗对齐”时,才能按文本段落和音频总时长均分兜底。
182
+
183
+ `video align` 会生成:
184
+
185
+ - `audio_alignment.json`
186
+ - 带 `start_s / end_s` 的 `beats.json`
187
+
188
+ ### 4. 生成 1秒1帧时间线
189
+
190
+ ```bash
191
+ yuanflow-cli video timeline \
192
+ --project "D:\素材\yuanflow-video-edit" \
193
+ --fps 1 \
194
+ --format agent-json
195
+ ```
196
+
197
+ CLI 会生成:
198
+
199
+ - `frames_manifest.json`
200
+ - `visual_segments.json`
201
+ - `frames/<asset_id>/frame_000001.jpg` 等抽帧图片
202
+
203
+ Agent 必须基于这些抽帧图片判断画面,不要凭文件名猜。
204
+
205
+ ### 5. 视觉理解回写
206
+
207
+ Agent 或人工查看抽帧图片后,先写出 `visual_review.agent.json`,不要直接跳到 EDL。基础格式:
208
+
209
+ ```json
210
+ {
211
+ "version": 1,
212
+ "reviews": [
213
+ {
214
+ "segment_id": "vis_0001",
215
+ "description": "产品近景,手持展示刷头。",
216
+ "subjects": ["产品", "手"],
217
+ "scene": "厨房水槽",
218
+ "motion": "展示",
219
+ "semantic_tags": ["product_closeup", "kitchen"],
220
+ "quality_score": 0.88
221
+ }
222
+ ]
223
+ }
224
+ ```
225
+
226
+ 导入视觉理解:
227
+
228
+ ```bash
229
+ yuanflow-cli video visual-review \
230
+ --project "D:\素材\yuanflow-video-edit" \
231
+ --review-file "D:\素材\yuanflow-video-edit\visual_review.agent.json" \
232
+ --format agent-json
233
+ ```
234
+
235
+ CLI 会生成或更新:
236
+
237
+ - `visual_understanding.json`
238
+ - 带结构化描述的 `visual_segments.json`
239
+
240
+ ### 6. Agent 生成 timeline_plan 和 EDL
241
+
242
+ Agent 读取:
243
+
244
+ - `project.json`
245
+ - `assets.json`
246
+ - `audio_alignment.json`
247
+ - `beats.json`
248
+ - `visual_segments.json`
249
+ - `visual_understanding.json`
250
+ - `strategy_snapshot.json`
251
+ - 抽帧图片
252
+
253
+ 然后先写出 `timeline_plan.agent.json`。基础格式:
254
+
255
+ ```json
256
+ {
257
+ "version": 1,
258
+ "template_type": "talking_head",
259
+ "beats": [
260
+ {
261
+ "beat_id": "beat_001",
262
+ "text": "先看这个问题到底卡在哪里",
263
+ "selected_segment_id": "vis_0001"
264
+ }
265
+ ],
266
+ "matches": [
267
+ {
268
+ "beat_id": "beat_001",
269
+ "segment_id": "vis_0001",
270
+ "score": 0.82,
271
+ "reason": "画面展示操作场景,能承接开头问题。"
272
+ }
273
+ ],
274
+ "material_gaps": [],
275
+ "edl": {
276
+ "version": 1,
277
+ "audio": {
278
+ "source": "asset_001",
279
+ "mode": "primary_audio"
280
+ },
281
+ "ranges": [
282
+ {
283
+ "source": "asset_002",
284
+ "start": 0,
285
+ "end": 3,
286
+ "output_start": 0,
287
+ "beat_id": "beat_001",
288
+ "reason": "画面展示操作场景,能承接开头问题。"
289
+ }
290
+ ],
291
+ "total_duration_s": 60
292
+ }
293
+ }
294
+ ```
295
+
296
+ 如果需要单独写 EDL,也可以写出 `edl.agent.json`:
297
+
298
+ ```json
299
+ {
300
+ "version": 1,
301
+ "audio": {
302
+ "source": "asset_001",
303
+ "mode": "primary_audio"
304
+ },
305
+ "ranges": [
306
+ {
307
+ "source": "asset_002",
308
+ "start": 0,
309
+ "end": 3,
310
+ "output_start": 0,
311
+ "beat_id": "beat_001",
312
+ "reason": "画面展示操作场景,能承接开头问题。"
313
+ }
314
+ ],
315
+ "total_duration_s": 60
316
+ }
317
+ ```
318
+
319
+ ### 7. 校验 EDL
320
+
321
+ ```bash
322
+ yuanflow-cli video plan \
323
+ --project "D:\素材\yuanflow-video-edit" \
324
+ --timeline-plan "D:\素材\yuanflow-video-edit\timeline_plan.agent.json" \
325
+ --format agent-json
326
+ ```
327
+
328
+ 如果 EDL 没有内嵌在 `timeline_plan.agent.json`,再额外传入:
329
+
330
+ ```bash
331
+ yuanflow-cli video plan \
332
+ --project "D:\素材\yuanflow-video-edit" \
333
+ --timeline-plan "D:\素材\yuanflow-video-edit\timeline_plan.agent.json" \
334
+ --edl "D:\素材\yuanflow-video-edit\edl.agent.json" \
335
+ --format agent-json
336
+ ```
337
+
338
+ 只有校验通过后,才允许渲染。
339
+
340
+ ### 8. 渲染预览和自检
341
+
342
+ ```bash
343
+ yuanflow-cli video render-preview --project "D:\素材\yuanflow-video-edit" --format agent-json
344
+ yuanflow-cli video evaluate --project "D:\素材\yuanflow-video-edit" --file "D:\素材\yuanflow-video-edit\preview.mp4" --format agent-json
345
+ ```
346
+
347
+ ### 9. 最终导出
348
+
349
+ ```bash
350
+ yuanflow-cli video render-final --project "D:\素材\yuanflow-video-edit" --format agent-json
351
+ ```
352
+
353
+ 完成后在 YuanFlow 主程序内必须调用 `artifact_files_register` 登记 `final.mp4`、`edl.json` 和 `eval_report.json`,不要只告诉用户内部路径。
354
+
355
+ ## EDL 判断要求
356
+
357
+ Agent 生成 EDL 时必须检查:
358
+
359
+ - 画面是否支撑当前文案 beat。
360
+ - 是否存在更合适的 B-roll 片段。
361
+ - 同一个片段是否重复过多。
362
+ - 画面是否明显跳跃、黑屏、晃动或无关。
363
+ - 每个片段是否有明确 `reason`。
364
+ - 无法匹配时要写明缺素材,不要硬剪。
365
+
366
+ ## 输出给用户
367
+
368
+ 最终回复要包含:
369
+
370
+ - 预览或成片路径。
371
+ - EDL 路径。
372
+ - 自检报告路径。
373
+ - 简短说明剪辑逻辑。
374
+ - 如果有素材不足或画面不匹配,要明确说明。
@@ -16,6 +16,7 @@ emoji: 💡
16
16
  - 如果没有命中,说明“未发现可用历史参考记录”,继续下一步。
17
17
  2. 调用 `自媒体知识库`。
18
18
  - 先查 `knowledge docs` 或 `knowledge entry`,根据平台、受众、内容目标和选题方向构造 `domain` 和 `content_goal`。
19
+ - 查询时,必须先明确用户具体需求,然后从知识库的一级能力开始,依次使用渐进式查询。不能跳级、跨越式查询。
19
20
  - 按返回的 `next_actions` 分层查看 `packs`、`rules` 或 `rule-detail`,直到拿到足够的方法摘要。
20
21
  - 不要自己拼 SQL,不要跳过知识库直接凭空输出。
21
22
  3. 结合用户要求、历史参考记录和知识库结果,输出选题策划结果。
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: 飞书官方技能
3
+ description: 当用户需要使用飞书/Lark 官方 CLI 操作文档、表格、多维表格、日历、邮箱、任务、知识库、通讯录、即时消息、妙记、会议记录或开放平台 API 时使用。
4
+ emoji: 🪽
5
+ ---
6
+
7
+ # 飞书官方技能
8
+
9
+ 本 Skill 对接飞书官方发布的 `@larksuite/cli` 和官方 Skill 体系。YuanFlow 不复制、不改造官方 CLI 源码,只负责安装、托管、认证状态检查、权限续接和受控调用。
10
+
11
+ 官方来源:
12
+
13
+ - GitHub:`https://github.com/larksuite/cli`
14
+ - npm:`@larksuite/cli`
15
+ - CLI 可执行入口:`lark-cli`
16
+
17
+ ## 使用原则
18
+
19
+ 如果当前 Agent 可用 `lark_cli_call`,优先使用该受控工具,不要用 `execute_shell_command` 直接运行 `npx`、`npm install -g` 或全局 `lark-cli`。
20
+
21
+ YuanFlow 内部会把官方 CLI 安装到本机用户数据目录的受管位置,并固定版本执行。Agent 只需要传官方 CLI 参数数组,例如:
22
+
23
+ ```json
24
+ {
25
+ "args": ["docs", "search", "--keyword", "项目计划"]
26
+ }
27
+ ```
28
+
29
+ 不要把 token、refresh token、cookie、二维码识别结果或完整授权凭证写入回复、文件、执行看板或创作产物。
30
+
31
+ ## 认证流程
32
+
33
+ 飞书官方 CLI 通常需要用户先完成本地配置和登录。
34
+
35
+ 推荐流程:
36
+
37
+ 1. 先调用 `lark_cli_call` 检查状态或查看帮助。
38
+ 2. 如果 CLI 返回未配置或未登录,调用官方配置/登录命令。
39
+ 3. 把工具返回的官方认证 URL、二维码文本或设备码原样展示在聊天回复里,让用户在 YuanFlow 对话页完成扫码/授权。
40
+ 4. 在执行看板记录“等待用户完成飞书认证”和当前续接点。
41
+ 5. 用户回复“已登录/继续”后,再调用状态检查或原任务命令继续。
42
+
43
+ 常用认证命令:
44
+
45
+ ```json
46
+ {"args": ["config", "init", "--new"]}
47
+ ```
48
+
49
+ ```json
50
+ {"args": ["auth", "login", "--recommend", "--no-wait"]}
51
+ ```
52
+
53
+ 如果官方 CLI 返回 `device_code` 或类似设备码,后续优先按官方提示使用 `--device-code` 续接,而不是重新发起一轮登录。
54
+
55
+ ## 权限与确认
56
+
57
+ 读取、搜索、查询类动作默认可以直接执行。
58
+
59
+ 创建、写入、更新、导出、上传等动作,如果用户已经在当前任务里明确授权,可以继续执行,并在执行看板记录“用户已授权飞书写入动作”。同一任务后续同类写入动作不要反复询问。
60
+
61
+ 以下高风险动作必须二次确认:
62
+
63
+ - 发送邮件、群发消息、发送 IM 消息。
64
+ - 删除文档、删除表格、删除任务、删除日程。
65
+ - 批量修改权限、公开分享、转移所有者。
66
+ - 对外部人员授权、邀请外部成员。
67
+ - 清空数据、批量覆盖数据。
68
+
69
+ 用户确认后,只对当前明确动作放行;不要把“确认一次”扩大成所有飞书危险动作永久放行。
70
+
71
+ ## 常见任务路由
72
+
73
+ 根据用户需求选择官方 CLI 对应能力:
74
+
75
+ - 飞书文档:创建、搜索、读取、追加、覆盖、插入图片或附件。
76
+ - 飞书表格:读写单元格、追加行、查找内容、导出表格。
77
+ - 飞书多维表格:建表、字段管理、记录读写、视图配置。
78
+ - 飞书日历:查日程、创建日程、查忙闲、推荐时间。
79
+ - 飞书邮箱:写邮件、查邮件、回复、转发、草稿。
80
+ - 飞书任务:创建待办、拆分子任务、更新状态、分配成员。
81
+ - 飞书通讯录:查询组织、搜索员工、获取 open_id。
82
+ - 飞书云空间/知识库:上传下载文件、整理目录、管理知识库节点。
83
+ - 飞书即时消息:发送消息、搜索聊天、下载群文件。
84
+ - 飞书妙记/会议:查询会议记录、获取纪要、总结待办。
85
+ - 飞书 OpenAPI:当封装命令不足时,查找官方开放接口并用 CLI 调用。
86
+
87
+ ## 输出要求
88
+
89
+ - 先说明当前使用的是飞书官方 CLI 托管能力。
90
+ - 对认证类输出,必须把官方返回的认证 URL、二维码文本或设备码展示给用户。
91
+ - 对写入类动作,必须说明写入对象、动作、是否已获得用户确认。
92
+ - 对失败结果,区分是未登录、权限不足、应用未配置、网络失败、参数错误,还是官方 CLI 命令不存在。
93
+ - 任务中断时,把下一步续接命令和当前状态写入执行看板。
@@ -5,6 +5,8 @@ import { listKnowledgeCommands } from './knowledge-tools.js';
5
5
  import { listOssCommands } from './oss-tools.js';
6
6
  import { listBrowserCommands } from './browser-tools.js';
7
7
  import { listSearchCommands, listWorkCommands } from './work-tools.js';
8
+ import { listVideoCommands } from './video-tools.js';
9
+ import { listTrendingCommands } from './trending-tools.js';
8
10
 
9
11
  const ERROR_MAP = [
10
12
  {
@@ -107,6 +109,8 @@ export function buildCommandRegistry() {
107
109
  const knowledgeCommands = listKnowledgeCommands();
108
110
  const ossCommands = listOssCommands();
109
111
  const browserCommands = listBrowserCommands();
112
+ const videoCommands = listVideoCommands();
113
+ const trendingCommands = listTrendingCommands();
110
114
  return [
111
115
  ...shortcuts,
112
116
  ...endpoints,
@@ -116,6 +120,8 @@ export function buildCommandRegistry() {
116
120
  ...knowledgeCommands,
117
121
  ...ossCommands,
118
122
  ...browserCommands,
123
+ ...videoCommands,
124
+ ...trendingCommands,
119
125
  ].sort((left, right) => left.key.localeCompare(right.key));
120
126
  }
121
127
 
package/src/cli.js CHANGED
@@ -20,12 +20,14 @@ import { collectComments } from './comment-collector.js';
20
20
  import { getKnowledgeDocs, navigateKnowledge } from './knowledge-tools.js';
21
21
  import { copyObject, signedUrl, tempUpload } from './oss-tools.js';
22
22
  import { runBrowserCommand } from './browser-tools.js';
23
+ import { runVideoCommand } from './video-tools.js';
23
24
  import {
24
25
  getWorkDetail,
25
26
  getWorkDownload,
26
27
  searchContent,
27
28
  searchUsers,
28
29
  } from './work-tools.js';
30
+ import { fetchVideoHotList } from './trending-tools.js';
29
31
 
30
32
  export async function main(argv) {
31
33
  const args = argv.slice(2);
@@ -71,6 +73,11 @@ export async function main(argv) {
71
73
  return;
72
74
  }
73
75
 
76
+ if (command === 'trending') {
77
+ await handleTrending(rest);
78
+ return;
79
+ }
80
+
74
81
  if (command === 'knowledge') {
75
82
  await handleKnowledge(rest);
76
83
  return;
@@ -86,6 +93,11 @@ export async function main(argv) {
86
93
  return;
87
94
  }
88
95
 
96
+ if (command === 'video') {
97
+ await handleVideo(rest);
98
+ return;
99
+ }
100
+
89
101
  if (command === 'schema') {
90
102
  await handleSchema(rest);
91
103
  return;
@@ -345,6 +357,19 @@ async function handleSearch(args) {
345
357
  });
346
358
  }
347
359
 
360
+ async function handleTrending(args) {
361
+ const { positionals, options } = parseOptions(args);
362
+ const [action = 'video-hot-list'] = positionals;
363
+ if (action !== 'video-hot-list') {
364
+ throw new Error('未知 trending 命令。用法:yuanflow-cli trending video-hot-list');
365
+ }
366
+ const result = await fetchVideoHotList({ options });
367
+ await outputResult(result, options, {
368
+ command: 'trending video-hot-list',
369
+ meta: { endpoint: result.endpoint.path, kind: result.endpoint.kind },
370
+ });
371
+ }
372
+
348
373
  async function handleKnowledge(args) {
349
374
  const { positionals, options } = parseOptions(args);
350
375
  const [action = 'docs'] = positionals;
@@ -396,6 +421,16 @@ async function handleBrowser(args) {
396
421
  });
397
422
  }
398
423
 
424
+ async function handleVideo(args) {
425
+ const { positionals, options } = parseOptions(args);
426
+ const [action = 'init'] = positionals;
427
+ const result = await runVideoCommand({ action, options });
428
+ await outputResult(result, options, {
429
+ command: `video ${action}`,
430
+ meta: { kind: 'video-editing' },
431
+ });
432
+ }
433
+
399
434
  async function handleGeneratedCommand(platform, args) {
400
435
  if (!getPlatforms().includes(platform)) {
401
436
  throw new Error(`未知平台:${platform}。可用平台:${getPlatforms().join(', ')}`);
@@ -562,16 +597,24 @@ function printHelp() {
562
597
  yuanflow-cli works download --platform youtube --target "dQw4w9WgXcQ" --dry-run
563
598
  yuanflow-cli search content --platform xiaohongshu --keyword "美妆" --dry-run
564
599
  yuanflow-cli search users --platform instagram --keyword "nasa" --dry-run
600
+ yuanflow-cli trending video-hot-list --dry-run --format agent-json
565
601
  yuanflow-cli knowledge docs --dry-run
566
602
  yuanflow-cli knowledge entry --output-format short_video_script --domain 自媒体运营 --content-goal "写一个创业者短视频选题" --target-audience 创业者 --format agent-json
567
603
  yuanflow-cli oss signed-url --key path/to/file.png --ttl-seconds 1800 --format agent-json
568
604
  yuanflow-cli browser profile-path --platform douyin --account main --format agent-json
569
605
  yuanflow-cli browser task-plan --platform xiaohongshu --task publish --account main --format agent-json
606
+ yuanflow-cli video init --input "D:\\素材" --primary-audio "D:\\素材\\口播.mp3" --broll "D:\\素材\\画面.mp4" --format agent-json
607
+ yuanflow-cli video strategy --project "D:\\素材\\yuanflow-video-edit" --template-type talking_head --rules-file "D:\\规则\\logic.json,D:\\规则\\template.json,D:\\规则\\cli.json" --format agent-json
608
+ yuanflow-cli video align --project "D:\\素材\\yuanflow-video-edit" --asr-file "D:\\素材\\asr.json" --format agent-json
609
+ yuanflow-cli video timeline --project "D:\\素材\\yuanflow-video-edit" --fps 1 --format agent-json
610
+ yuanflow-cli video visual-review --project "D:\\素材\\yuanflow-video-edit" --review-file "D:\\素材\\yuanflow-video-edit\\visual_review.agent.json" --format agent-json
611
+ yuanflow-cli video plan --project "D:\\素材\\yuanflow-video-edit" --timeline-plan "D:\\素材\\yuanflow-video-edit\\timeline_plan.agent.json" --format agent-json
570
612
  yuanflow-cli list douyin
571
613
 
572
614
  说明:
573
615
  社媒请求调用 Yuan API 的 /social/*path;知识库和 OSS 原子能力调用 /api/* 或 /atomic/*。
574
616
  browser 命令是自媒体平台专用浏览器自动化协议,只返回受控 profile/cookie/任务路径与执行计划,不用于普通网页搜索。
617
+ video 命令是视频智能剪辑基础链路:规则库策略快照、主音频+B-roll、ASR 时间戳对齐、1秒1帧抽帧、视觉理解回写、Agent 生成 timeline_plan/EDL、CLI 校验和渲染。
575
618
  需要鉴权的请求都会使用 Authorization: Bearer <token>。
576
619
  token 优先级:--token > YUANCHUANG_API_TOKEN > 本地 config.token。
577
620
  YuanFlow 主程序内使用时,token 由主程序认证系统注入,不需要手动配置。