reelforge 0.9.0 → 0.10.0

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.
package/README.md CHANGED
@@ -152,6 +152,33 @@ rf create "..." --layout letterbox --layout-matte-color "#1a1a1a" # 柔和黑
152
152
  | `history list / get <id> / delete <id>` | Browse / delete completed runs |
153
153
  | `health` | Server health + capability check |
154
154
 
155
+ ### Heavy brand customization (custom overlay templates)
156
+
157
+ `--motion` / `--layout` / `--subtitle-*` / `--brand-*` cover the common cases. For full visual identity ownership (custom path bar, accent decorations, light theme, footer block, etc.) pass a custom overlay HTML via `--frame-template <local.html | preset_key>`:
158
+
159
+ ```bash
160
+ rf templates show 1080x1920/default.html -o ./my-brand.html
161
+ # ...edit my-brand.html (change colors, add structure, etc.)...
162
+ rf create "我的视频" --frame-template ./my-brand.html
163
+ ```
164
+
165
+ **Contract for custom HTML**:
166
+
167
+ - Canvas is **1080×1920** (pipeline-fixed; don't declare a different size in `<meta>`).
168
+ - Background must be **transparent** — the AI image is composited by ffmpeg OUTSIDE the HTML layer.
169
+ - **`{{image}}` no longer exists.** Using `<img src="{{image}}">` is a hard error at submit time. Image is composited by ffmpeg.
170
+ - The pipeline injects these placeholders for you:
171
+
172
+ | Placeholder | What it is |
173
+ |---|---|
174
+ | `{{title}}` `{{text}}` | per-frame content |
175
+ | `{{index}}` `{{total}}` | "scene N of M" — `{{total}}` is the LLM-decided scene count, don't hardcode |
176
+ | `{{layout}}` | `"full"` / `"blur-bg"` / `"letterbox"` — react via `body[data-layout="..."]` CSS to put title/subtitle in the matte zones when layout ≠ full |
177
+ | `{{subtitle_style}}` `{{subtitle_color}}` `{{subtitle_background}}` | subtitle preset + overrides |
178
+ | `{{brand_position}}` `{{brand_handle}}` `{{brand_slogan}}` `{{brand_logo}}` `{{brand_color}}` | brand-chrome inputs (use or ignore as you like) |
179
+
180
+ Inline HTML is hard-capped at 2 MB. The audio + motion + character-ref + scene-plan stages all keep working identically — only the overlay layer is yours.
181
+
155
182
  ## Examples
156
183
 
157
184
  ```bash
@@ -45,6 +45,22 @@ async function resolveTextOrFile(input) {
45
45
  * Returns undefined when input is missing/blank so the caller can branch on
46
46
  * "user actually provided this knob".
47
47
  */
48
+ /**
49
+ * Tell apart a preset template key (e.g. "1080x1920/default.html") from a
50
+ * local file path. Heuristic: anything that starts with ./ ~ /, contains a
51
+ * backslash, or whose .html extension corresponds to an existing file on
52
+ * disk is treated as a local path. Otherwise it's a key for the server's
53
+ * preset registry. Mirrors the 0.7.x detection so muscle memory carries over.
54
+ */
55
+ function looksLikeLocalHtmlPath(value) {
56
+ if (/^[.~]|^\//.test(value))
57
+ return true;
58
+ if (value.includes("\\"))
59
+ return true;
60
+ if (value.endsWith(".html") && fsSync.existsSync(value))
61
+ return true;
62
+ return false;
63
+ }
48
64
  async function resolveRefImage(input, flagName) {
49
65
  if (input === undefined)
50
66
  return undefined;
@@ -167,6 +183,22 @@ function optsToBody(opts) {
167
183
  out.layout = opts.layout;
168
184
  if (opts.layoutMatteColor !== undefined)
169
185
  out.layout_matte_color = opts.layoutMatteColor;
186
+ if (opts.frameTemplate !== undefined) {
187
+ // Local .html path? Read inline and send as frame_template_html. Otherwise
188
+ // treat as a preset key. Same heuristic as 0.7.x had for --frame-template.
189
+ if (looksLikeLocalHtmlPath(opts.frameTemplate)) {
190
+ const abs = path.resolve(opts.frameTemplate);
191
+ if (!fsSync.existsSync(abs)) {
192
+ throw new Error(`--frame-template: local file not found: ${abs}`);
193
+ }
194
+ out.frame_template_html = fsSync.readFileSync(abs, "utf-8");
195
+ }
196
+ else {
197
+ out.frame_template = opts.frameTemplate;
198
+ }
199
+ }
200
+ if (opts.frameTemplateHtml !== undefined)
201
+ out.frame_template_html = opts.frameTemplateHtml;
170
202
  if (opts.subtitleStyle !== undefined)
171
203
  out.subtitle_style = opts.subtitleStyle;
172
204
  if (opts.subtitleColor !== undefined)
@@ -322,6 +354,7 @@ export function registerCreate(program) {
322
354
  .option("--motion <preset>", "per-scene image animation intensity. See 'Motion presets' below. Default: lite.")
323
355
  .option("--layout <preset>", "image layout within canvas: full (default) | blur-bg | letterbox. See 'Layout presets' below.")
324
356
  .option("--layout-matte-color <css>", "letterbox matte color (CSS string, e.g. 'black', '#1a1a1a', '#2d3748'). Ignored unless --layout letterbox. Default: black.")
357
+ .option("--frame-template <keyOrPath>", "custom overlay template — preset key (e.g. 1080x1920/default.html) OR path to a local .html (auto-sent inline). See 'Custom templates' below.")
325
358
  .option("--subtitle-style <preset>", "subtitle visual style. See 'Subtitle styles' below. Default: plate.")
326
359
  .option("--subtitle-color <css>", "override subtitle text color, e.g. '#ffeb3b'. Omit for preset default.")
327
360
  .option("--subtitle-background <css>", "override plate-preset background, e.g. 'rgba(20,30,80,0.75)'. Other presets ignore.")
@@ -398,6 +431,28 @@ export function registerCreate(program) {
398
431
  " All fields optional; missing handle/slogan/logo are individually hidden.",
399
432
  " Per-request flags merge over config defaults field by field.",
400
433
  "",
434
+ "Custom templates (--frame-template) — heavy brand customization:",
435
+ " Override the entire overlay HTML when --brand-* and --subtitle-color aren't",
436
+ " enough (custom top bar / footer / decoration / theme color etc.).",
437
+ " --frame-template ./my-overlay.html # local .html, auto sent inline",
438
+ " --frame-template 1080x1920/default.html # preset key (the built-in default)",
439
+ "",
440
+ " Contract for custom HTML:",
441
+ " · Canvas is 1080×1920 (pipeline-fixed; don't declare a different size meta).",
442
+ " · Background must be transparent — the AI image is composited by ffmpeg",
443
+ " OUTSIDE the HTML layer. {{image}} placeholder no longer exists; using",
444
+ " <img src=\"{{image}}\"> in your template is a hard error at submit time.",
445
+ " · Inject points the pipeline writes for you:",
446
+ " {{title}} {{text}} per-frame content",
447
+ " {{index}} {{total}} \"scene N of M\"",
448
+ " {{layout}} \"full\" | \"blur-bg\" | \"letterbox\" — react via",
449
+ " body[data-layout=\"...\"] CSS to move title /",
450
+ " subtitle to the matte zones when layout != full.",
451
+ " {{subtitle_style}} / {{subtitle_color}} / {{subtitle_background}}",
452
+ " {{brand_*}} handle / slogan / logo / position / color",
453
+ " · Bootstrap from the built-in: rf templates show 1080x1920/default.html -o my-overlay.html",
454
+ " · Inline HTML hard-capped at 2 MB.",
455
+ "",
401
456
  "Image style presets (--style <preset>) — quick shortcut for --prompt-prefix:",
402
457
  formatStylePresetsList(),
403
458
  " · Pass --prompt-prefix to override (raw string always wins).",
@@ -437,6 +492,11 @@ export function registerCreate(program) {
437
492
  ' rf create "纪录片片段" --layout letterbox --motion max # 电影感',
438
493
  ' rf create "..." --layout letterbox --layout-matte-color "#1a1a1a" # 柔和黑',
439
494
  "",
495
+ " # Custom overlay HTML (heavy brand customization)",
496
+ " rf templates show 1080x1920/default.html -o ./brand.html # copy as starting point",
497
+ " # ...edit brand.html: change colors, add top path bar / footer, etc.",
498
+ ' rf create "..." --frame-template ./brand.html # apply your custom overlay',
499
+ "",
440
500
  " # Recipe + replay last",
441
501
  " rf create --recipe ./space.recipe.json",
442
502
  " rf create --redo # replay last successful create",
@@ -1,4 +1,6 @@
1
1
  import fs from "node:fs/promises";
2
+ import fsSync from "node:fs";
3
+ import path from "node:path";
2
4
  import { post } from "../client.js";
3
5
  import { waitForTask } from "../utils/task-waiter.js";
4
6
  import { downloadTo } from "../utils/download.js";
@@ -48,6 +50,7 @@ export function registerPipelines(program) {
48
50
  .option("--motion <preset>", "per-scene image animation: off | lite (default) | max")
49
51
  .option("--layout <preset>", "image layout: full (default) | blur-bg | letterbox. See below.")
50
52
  .option("--layout-matte-color <css>", "letterbox matte color (CSS). Ignored unless --layout letterbox. Default: black.")
53
+ .option("--frame-template <keyOrPath>", "custom overlay: preset key OR local .html (auto sent inline). Canvas 1080×1920, transparent bg, no {{image}}.")
51
54
  .option("--subtitle-style <preset>", "subtitle visual style: plate (default) | stroke | cinema")
52
55
  .option("--image-model <id>", "RelayX image model (rx-image-z | rx-image-flux | rx-image-qwen | rx-image-qwen-edit)")
53
56
  .option("--prompt-prefix <text>", "style prefix prepended to every image prompt")
@@ -109,6 +112,25 @@ export function registerPipelines(program) {
109
112
  topic = await fs.readFile(topic.slice(1), "utf-8");
110
113
  if (script?.startsWith("@"))
111
114
  script = await fs.readFile(script.slice(1), "utf-8");
115
+ // --frame-template can be a preset key OR a local .html — same heuristic
116
+ // as 0.7.x. Local path is read and sent as frame_template_html inline.
117
+ let frame_template;
118
+ let frame_template_html;
119
+ if (opts.frameTemplate) {
120
+ const v = opts.frameTemplate;
121
+ const isLocal = /^[.~]|^\//.test(v) || v.includes("\\") ||
122
+ (v.endsWith(".html") && fsSync.existsSync(v));
123
+ if (isLocal) {
124
+ const abs = path.resolve(v);
125
+ if (!fsSync.existsSync(abs)) {
126
+ throw new Error(`--frame-template: local file not found: ${abs}`);
127
+ }
128
+ frame_template_html = await fs.readFile(abs, "utf-8");
129
+ }
130
+ else {
131
+ frame_template = v;
132
+ }
133
+ }
112
134
  await submitAndMaybeWait("/api/v1/pipelines/standard", {
113
135
  topic,
114
136
  script,
@@ -117,6 +139,8 @@ export function registerPipelines(program) {
117
139
  motion: opts.motion,
118
140
  layout: opts.layout,
119
141
  layout_matte_color: opts.layoutMatteColor,
142
+ frame_template,
143
+ frame_template_html,
120
144
  subtitle_style: opts.subtitleStyle,
121
145
  image_model: opts.imageModel,
122
146
  prompt_prefix: opts.promptPrefix,
@@ -70,14 +70,15 @@ export function registerTemplates(program) {
70
70
  .addHelpText("after", [
71
71
  "",
72
72
  "Examples:",
73
- " # see what the default static template looks like",
74
- " rf templates show 1080x1920/static_default.html",
73
+ " # print the standard pipeline's default overlay HTML",
74
+ " rf templates show 1080x1920/default.html",
75
75
  "",
76
- " # copy a preset and tweak it as your own brand template",
77
- " rf templates show 1080x1920/image_default.html -o my-brand.html",
78
- " # ...edit my-brand.html...",
79
- " rf frames render -t ./my-brand.html --title 'X' -o frame.png",
76
+ " # copy as a starting point for a custom brand template",
77
+ " rf templates show 1080x1920/default.html -o my-brand.html",
78
+ " # ...edit my-brand.html (change colors, add path bar / footer, etc.)...",
79
+ " rf create '...' --frame-template ./my-brand.html",
80
80
  "",
81
+ " Contract for custom HTML: see `rf create --help` → 'Custom templates'.",
81
82
  " Get the list of keys via `rf templates list`.",
82
83
  ].join("\n"))
83
84
  .action(async (key, opts) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reelforge",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "CLI for ReelForge Studio — AI video engine. Installs as both `reelforge` and the short alias `rf`. Every REST API exposed as a command, with --help on every level.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",