norahe0304-art/30x-video / cli/skill
30x-web-to-video
FlaggedUse when a user gives a brand URL and wants a premium launch, demo, or marketing video. Zero-manual workflow — Claude runs the V2 orchestrator itself (scrapes brand evidence, auto-installs missing tools, generates the first-cut Remotion project). User only sees the URL and the Studio preview.
scripts/iterate.ts
View on GitHub#!/usr/bin/env -S node --experimental-strip-types --no-warnings=ExperimentalWarning
/**
* [INPUT]: 一个生成好的视频项目目录 (含 scene-constitution.json、src/index.ts、src/MainVideo.tsx),
* 依赖 critique-scenes.ts 与 regenerate-scene.ts 两个姐妹模块。
* [OUTPUT]: 对外提供 iterate(projectDir, options),跑 render-still → critique → regenerate 的
* 闭环,每轮结果落在 `.iterate/round-N/`,终止于 rounds 用尽或 overallScore >= threshold。
* [POS]: scripts/ 的"品味回路"终编排器,把单次渲染的首稿进化成多轮打磨的成稿。
* [PROTOCOL]: 变更时更新此头部,然后检查 AGENTS.md
*/
import { mkdirSync, readFileSync, writeFileSync, existsSync } from "node:fs";
import { join, resolve } from "node:path";
import { critiqueScenes } from "./critique-scenes.ts";
import { regenerateWeakest } from "./regenerate-scene.ts";
// ================================================================
// 参数 — rounds 上限与停止阈值
// ================================================================
type IterateOptions = {
rounds?: number;
threshold?: number;
};
// ================================================================
// 闭环主流程
// ================================================================
export async function iterate(projectDir: string, options: IterateOptions = {}): Promise<void> {
const absProject = resolve(projectDir);
const rounds = options.rounds ?? 3;
const threshold = options.threshold ?? 8;
const history: Array<{ round: number; overallScore: number; weakest: string; directive: string }> = [];
for (let round = 1; round <= rounds; round += 1) {
const roundDir = join(absProject, ".iterate", `round-${round}`);
mkdirSync(roundDir, { recursive: true });
console.log(`\n======== round ${round}/${rounds} ========`);
// 1. critique (包含渲帧)
await critiqueScenes(absProject, roundDir);
const critique = JSON.parse(
readFileSync(join(roundDir, "critique.json"), "utf8"),
) as { overallScore: number; weakest: { actId: string; directive: string }; summary: string };
console.log(`[iterate] round ${round} overallScore = ${critique.overallScore}`);
console.log(`[iterate] summary: ${critique.summary}`);
history.push({
round,
overallScore: critique.overallScore,
weakest: critique.weakest.actId,
directive: critique.weakest.directive,
});
// 2. 够好就停
if (critique.overallScore >= threshold) {
console.log(`[iterate] threshold ${threshold} reached, stopping.`);
break;
}
// 3. 没到阈值且还有下一轮 → 重生最弱场景
if (round < rounds) {
await regenerateWeakest(absProject, roundDir);
} else {
console.log(`[iterate] rounds budget exhausted, final score ${critique.overallScore}`);
}
}
// history 落盘, 方便排查
writeFileSync(
join(absProject, ".iterate", "history.json"),
JSON.stringify(history, null, 2),
);
console.log(`\n[iterate] done. history written to .iterate/history.json`);
}
// ================================================================
// CLI — iterate <project-dir> [--rounds N] [--threshold X]
// ================================================================
if (import.meta.url === `file://${process.argv[1]}`) {
const args = process.argv.slice(2);
const projectDir = args.find((a) => !a.startsWith("--")) ?? process.cwd();
const roundsIdx = args.indexOf("--rounds");
const thresholdIdx = args.indexOf("--threshold");
const rounds = roundsIdx >= 0 ? Number(args[roundsIdx + 1]) : 3;
const threshold = thresholdIdx >= 0 ? Number(args[thresholdIdx + 1]) : 8;
if (!existsSync(join(projectDir, "scene-constitution.json"))) {
console.error(`[iterate] ${projectDir} does not look like a generated video project (no scene-constitution.json)`);
process.exit(1);
}
iterate(projectDir, { rounds, threshold }).catch((err) => {
console.error(err);
process.exit(1);
});
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies. | Stars: 108k | Updated | Claude CodeCodex | Verified | Install |
| meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要". | Stars: 108k | Updated | Claude CodeCodex | Verified | Install |