feat(video-from-script): 重构工作流为子Agent分步执行并新增提示词模板系统

将视频制作工作流拆分为独立子步骤:分镜 → 图片提示词 → 生图 → 视频提示词 → 生视频 → 成片,每步由子Agent独立执行。引入prompts/目录统一管理提示词模板(分镜.md、图片提示词.md、视频提示词.md),通过account.json的storyboardPrompt/imageStylePrompt/videoStylePrompt字段引用。

变更内容:
- 新增confirmed机制和pipeline.js confirm命令,生图后必须人工确认才能继续
- manifest schema改用shotDesc/narration/duration/directorRef替代旧字段
- 文件命名规则从keyword改为slug(从shotDesc/narration派生)
- 删除旧的storyboard-rules.md和prompt-rules.md
- pipeline.js脚本拆分为lib/目录下的独立模块(cmd-init/cmd-confirm/cmd-validate/phase-*)
- 新增cmd-create-account支持一键创建带prompts目录的账号
- capcut_assemble支持narration字段替代text作为字幕源
- 新增.gitclaude/settings.json权限配置
This commit is contained in:
2026-04-30 21:18:31 +08:00
parent 7f955647fe
commit 86b9b7948d
32 changed files with 2826 additions and 1292 deletions

View File

@@ -2,19 +2,23 @@
> `pipeline.js init` 创建Pipeline 执行Agent 审查。
>
> **禁止 AI 手写 manifest.json**,必须通过 `pipeline.js init` 初始化。脚本从 account.json 自动继承结构字段AI 只提供创意内容items 的 text/imagePrompt/videoPrompt/keyword)。
> **禁止 AI 手写 manifest.json**,必须通过 `pipeline.js init` 初始化。脚本从 account.json 自动继承结构字段AI 只提供创意内容items 的 shotDesc/narration/imagePrompt 等)。
---
## 创建方式
```bash
# AI 生成创意内容后,通过脚本初始化
node pipeline.js init --account military --mode single \
--items '[{"text":"中文文案","imagePrompt":"English prompt","videoPrompt":"motion prompt","keyword":"关键词","keywordColor":"#FF6B35"}]'
# Step 2-A 生成 imagePrompt 后,通过脚本初始化(不含 videoPrompt
node pipeline.js init --account 军事账号 --mode single \
--items '[{"shotDesc":"英文画面描述","narration":"中文口播旁白","duration":5,"imagePrompt":"English prompt","directorRef":"tarantino"}]'
# 或从文件读取
node pipeline.js init --account military --mode single --items-file ./items.json
node pipeline.js init --account 军事账号 --mode single --items-file ./items.json
# Step 2-C 人工确认
node pipeline.js confirm --manifest <path> --all
node pipeline.js confirm --manifest <path> --items 1,3,5
# 校验已有 manifest
node pipeline.js validate --manifest <path>
@@ -53,11 +57,18 @@ node pipeline.js validate --manifest <path>
| 字段 | 说明 |
|------|------|
| `status` | 固定写 `"pending"` |
| `text` | 中文字幕文案 |
| `imagePrompt` | 英文画面描述(给 Gemini/MJ |
| `videoPrompt` | 英文运动描述(给 Grok/VEO描述镜头运动而非内容 |
| `keyword` | 字幕高亮关键词 |
| `keywordColor` | 高亮颜色 |
| `shotDesc` | 英文分镜描述含隐性动势40-80词 |
| `narration` | 中文口播旁白≤22字 |
| `duration` | 计划视频时长(秒),来自分镜阶段 |
| `imagePrompt` | 英文画面描述(给 Gemini/MJStep 2-A 生成 |
| `directorRef` | 导演构图参考tarantino / kitano / fincher三层透传 |
| `confirmed` | 人工确认状态,默认 `false` |
### Agent 后续回写Step 3-A 视频提示词)
| 字段 | 说明 | 写入时机 |
|------|------|---------|
| `videoPrompt` | 英文运动描述(给 Grok/VEO描述镜头运动而非内容 | Step 3-A 由 Agent 回写 |
### Pipeline 回写(执行后)
@@ -67,17 +78,19 @@ node pipeline.js validate --manifest <path>
| `file` | 生成的图片路径(相对 manifest | images |
| `candidates` | MJ 拆分的 4 张候选图路径Gemini 无此字段) | images |
| `url` | 图片 OSS 公网 URL | upload |
| `confirmed` | 人工确认后设为 `true` | confirm |
| `video` | 生成的视频路径 | videos |
| `videoDuration` | 视频时长Grok=6, VEO=8 | videos |
| `videoUrl` | 视频 OSS 公网 URL | videos |
| `audio` | TTS 音频路径 | tts |
| `duration` | 音频时长(秒) | tts |
| `audioDuration` | 音频时长(秒) | tts |
### Agent 审查时可操作
- MJ 换选:`item.file = item.candidates[2]`
- 删除不合格 item直接从 items 数组移除,重新跑 `--phase images`
- 调整 prompt 重跑:改 `imagePrompt`status 改回 `pending`
- 人工确认:`node pipeline.js confirm --manifest <path> --all`
---
@@ -86,9 +99,9 @@ node pipeline.js validate --manifest <path>
### item 生命周期
```
pending → [images] → done → [upload: url填入] → done → [videos] → done → [tts] → done
↓ ↓
failed failed + error
pending → [images] → done → [confirm] → confirmed=true → [upload: url填入] → [videos] → done → [tts] → done
failed failed + error
```
status 一旦进入 `done` 就不再回退。后续阶段通过检查"有前置字段 + 无后置字段"来识别待处理 item不依赖 status 变化。
@@ -101,8 +114,8 @@ Agent **不需要记住这些条件**pipeline 内部自动匹配。仅供理
|------|------------------|
| images | `status=pending` + 有 `imagePrompt` |
| upload | `status=done` + 有 `file` + 无 `url` |
| videos | `status=done` + 有 `url` + 有 `videoPrompt` + 无 `video` |
| tts | `status=done` + 有 `text` + 无 `audio` |
| videos | `status=done` + `confirmed=true` +`url` + 有 `videoPrompt` + 无 `video` |
| tts | `status=done` + 有 `narration`(回退 `text` + 无 `audio` |
### pipeline.phases 整体状态
@@ -180,7 +193,9 @@ node pipeline.js run --manifest <path> --retry-failed
```
output/{account}_{YYYYMMDD}_{NNN}/
├── manifest.json # 主清单
├── images/ # scene_{NN}_{keyword}.jpeg首尾帧加 _lastMJ 候选加 _cand{1-4}
├── videos/ # scene_{NN}_{keyword}.mp4
├── images/ # scene_{NN}_{slug}.jpeg首尾帧加 _lastMJ 候选加 _cand{1-4}
├── videos/ # scene_{NN}_{slug}.mp4
└── audio/ # seg_001.mp3
```
slug 从 `shotDesc` 派生slugify: 保留中文和字母数字,最多 20 字符)。