用途:把 story-telling 项目准备到可直接运行 story-new 与 story-render 的状态,避免后续流程出错。可选参数 $0 为项目目录,默认当前目录。
主要能力与步骤:
- 若项目不存在则先拉取仓库。检测:test -f cli/generate.ts && test -f src/Root.tsx;也会查看下层 story-telling 目录。缺失时提示后执行 npx --yes degit marketcalls/story-telling story-telling,或回退到 git clone --depth 1 https://github.com/marketcalls/story-telling story-telling。
- 检查环境:node --version、npm --version,要求 Node 20 及以上;不需要 bun 或 ffmpeg。
- 安装依赖:npm install。
- 创建 .env:若不存在则 cp .env.example .env,并告知需填写的密钥。不要把真实密钥写入 .env.example、技能文件或 .claude/settings.local.json;若在受跟踪文件中发现已有密钥,应停止并建议轮换。必需 SARVAM_API_KEY(旁白)、FAL_KEY(图像),可选 OPENAI_API_KEY(仅 npm run draft 使用,手写 story.json 可跳过)。cli/env.ts 也会读取上级目录的 .env,SARVAM_KEY 可作为 SARVAM_API_KEY 的别名。
- 校验密钥:读取 .env 后分别用 curl 请求 OpenAI、Sarvam 与 fal,检查状态码;不要把密钥值打印给用户或写入日志。
- 检查 Remotion:npx remotion versions,所有 @remotion/* 包版本与 mediabunny 需一致,混装会报 'Logging' was not found in 'mediabunny',可用 npx remotion upgrade 与 npm install 修复。
- 类型检查与冒烟测试:npm run typecheck、npx remotion compositions,应能列出 public/ 下每个故事文件夹对应的合成。
- 汇报 Node/npm 版本、.env 状态与缺失密钥、各项密钥检测状态码、Remotion 版本是否对齐,并给出下一条命令,例如 npm run story -- --slug my-story --context ./article.md --seconds 60。
使用方式:/story-setup 或 /story-setup ./story-telling。
限制:资料未提供各步骤失败时的详细排查说明、密钥申请流程及收费信息。