@funnelsgrove/cli 0.1.367 → 0.1.370

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.
@@ -2,6 +2,7 @@ import { createHash } from 'node:crypto';
2
2
  import { mkdir, readdir, readFile, stat, writeFile } from 'node:fs/promises';
3
3
  import path from 'node:path';
4
4
  import { pathToFileURL } from 'node:url';
5
+ import { downloadMontage, previewBackdrops, resolveCutSheet, reviseCutSheet, summarizeMontage, writeStoryboard, } from './creativeMontage.js';
5
6
  const ANGLE_STATUSES = ['working', 'burned_out', 'no_data', 'under_review', 'idea', 'failed'];
6
7
  const DICTIONARY_FIELDS = ['format', 'task_type', 'creo_type', 'brand', 'size', 'visual_hook', 'text_hook'];
7
8
  const api = (scope, procedure, type, data = {}) => (scope.callApi({
@@ -536,7 +537,7 @@ const registerGenerationRunCommands = (root, input) => {
536
537
  .option('--pain <moment>', 'Format without --texts: the pain moment the copy opens with')
537
538
  .option('--swap <instruction>', 'Remix: brand swap made once on the clean plate and shared by every text set, such as "Replace the PayPal wordmark with the Venmo wordmark"')
538
539
  .option('--pack <creative>', 'Approve outputs into this existing Creative, such as st003 (default: one new Creative per batch)')
539
- .option('--model <model>', 'nano-banana-2.1 | gpt-image-2 (image); seedance-2-mini | seedance-2.5 (video)')
540
+ .option('--model <model>', 'nano-banana-2.1 | gpt-image-2 (image); seedance-2-mini | seedance-2.5 | kling-4 (video)')
540
541
  .option('--quality <quality>', 'low | medium | high (image scenes and keyframes)')
541
542
  .option('--resolution <resolution>', 'Video clips: 480p | 720p | 1080p (default 720p)')
542
543
  .option('--sizes <list>', 'Comma-separated sizes, such as 1080x1350,1080x1920').option('--count <n>', 'Images to make (1-4); each is rendered in every size')
@@ -1207,6 +1208,122 @@ const registerCaptionCommands = (root, input) => {
1207
1208
  return { fileName: exported.fileName, contentType: exported.contentType, content: exported.content };
1208
1209
  }));
1209
1210
  };
1211
+ // --- Montage (CRE-BR-045 to CRE-BR-048) ---
1212
+ const MONTAGE_MODEL_HINT = 'Video model of the generated clips: seedance-2-mini | seedance-2.5 | kling-4 (people and faces); a Shot may set its own';
1213
+ const MONTAGE_RESOLUTION_HINT = 'Resolution of the generated clips: 480p | 720p | 1080p (Kling 4.0: 720p or 1080p)';
1214
+ /** Uploads one file a cut sheet names and returns its upload ref. */
1215
+ const uploadMontageFile = async (scope, file, body, hash, fetchFn = fetch) => {
1216
+ const prepared = await api(scope, 'prepareMontageUpload', 'mutation', {
1217
+ contentType: file.contentType, sizeBytes: body.byteLength, sha256: hash,
1218
+ });
1219
+ const response = await fetchFn(prepared.uploadUrl, { method: 'PUT', headers: prepared.headers, body: new Uint8Array(body) });
1220
+ if (!response.ok) {
1221
+ throw new Error(`Upload of ${path.basename(file.path)} failed with HTTP ${response.status}`);
1222
+ }
1223
+ return { key: prepared.key, sha256: hash };
1224
+ };
1225
+ /**
1226
+ * Reads a local cut sheet and resolves its `{ file }` refs (uploaded once per distinct file) and `{ variation }` refs.
1227
+ * A preview uploads nothing: each file is sent as a placeholder upload ref.
1228
+ */
1229
+ const readMontageCutSheet = async (scope, file, options) => {
1230
+ let json;
1231
+ try {
1232
+ json = JSON.parse(await readFile(file, 'utf8'));
1233
+ }
1234
+ catch (error) {
1235
+ throw new Error(`Cut sheet ${file}: ${error.message}`);
1236
+ }
1237
+ // Refs resolve one at a time, so a file named twice is read and uploaded once.
1238
+ const uploads = new Map();
1239
+ let variations = null;
1240
+ return resolveCutSheet(json, {
1241
+ dir: path.dirname(path.resolve(file)),
1242
+ upload: async (local) => {
1243
+ if (!options.upload) {
1244
+ return { key: `preview/${path.basename(local.path)}`, sha256: sha256(Buffer.from(local.path)) };
1245
+ }
1246
+ const body = await readFile(local.path);
1247
+ const hash = sha256(body);
1248
+ if (!uploads.has(hash)) {
1249
+ uploads.set(hash, await uploadMontageFile(scope, local, body, hash));
1250
+ }
1251
+ return uploads.get(hash);
1252
+ },
1253
+ variationId: async (ref) => findVariation(await (variations ??= options.variations()), ref).id,
1254
+ });
1255
+ };
1256
+ const montageSummary = (detail) => ({ ...summarizeGeneration(detail), montage: summarizeMontage(detail) });
1257
+ /** `fgrove creatives montage …` */
1258
+ const registerMontageCommands = (root, input) => {
1259
+ const { scoped, run } = input;
1260
+ const montage = root.command('montage').description('Montage: cut one video per variant from Shots described by a JSON cut sheet (CRE-BR-045 to CRE-BR-048)');
1261
+ montage.addHelpText('after', `
1262
+ In a local cut sheet a stored file may be written { "file": "<path relative to the cut sheet>" } wherever a media ref goes
1263
+ (clip, generate.keyframe, still, music.track, also in variants[].replace); it is uploaded once per command. A Variation's
1264
+ video may be written { "variation": "<full name or vd005_01>", "size": "1080x1920" }.`);
1265
+ scoped(montage.command('preview <cutSheet>').description('Render every Shot\'s on-screen text for free, over its local still or keyframe, as an HTML storyboard; uploads nothing')
1266
+ .option('--out <dir>', 'Storyboard folder (default: <cut sheet name>.storyboard beside the cut sheet)')
1267
+ .option('--model <model>', MONTAGE_MODEL_HINT)
1268
+ .option('--resolution <resolution>', MONTAGE_RESOLUTION_HINT))
1269
+ .action(run(async (scope, options, file) => {
1270
+ const { cutSheet, files } = await readMontageCutSheet(scope, file, { upload: false, variations: () => input.variations(scope) });
1271
+ const backdrops = previewBackdrops(files);
1272
+ const preview = await api(scope, 'previewMontage', 'mutation', {
1273
+ cutSheet, ...(Object.keys(backdrops).length > 0 ? { backdrops } : {}),
1274
+ ...(options.model ? { model: options.model } : {}), ...(options.resolution ? { resolution: options.resolution } : {}),
1275
+ });
1276
+ const name = path.basename(file, path.extname(file));
1277
+ const { index, written } = await writeStoryboard(preview, options.out ?? path.join(path.dirname(file), `${name}.storyboard`), name);
1278
+ return {
1279
+ size: preview.size, fps: preview.fps, textStyle: preview.textStyle,
1280
+ variants: preview.variants.map((variant) => ({ name: variant.name, seconds: variant.seconds, shots: variant.shots.length })),
1281
+ clips: preview.clips, storyboard: index, written,
1282
+ };
1283
+ }));
1284
+ scoped(montage.command('start <cutSheet>').description('Upload the cut sheet\'s files and start a Montage Generation; every credit is reserved at start')
1285
+ .requiredOption('--angle <angle>', 'Angle code or slug of the Variations an approved video makes')
1286
+ .requiredOption('--brand <brand>', 'Brand with a Brand Kit')
1287
+ .option('--model <model>', MONTAGE_MODEL_HINT)
1288
+ .option('--resolution <resolution>', MONTAGE_RESOLUTION_HINT)
1289
+ .option('--pack <creative>', 'Approve videos into this existing Creative, such as vd007 (default: one new Creative per batch)')
1290
+ .option('--estimate', 'Print the credits per step, the variants and the clips, and the balance; start nothing')
1291
+ .option('--wait', 'Poll until the Generation finished'))
1292
+ .action(run(async (scope, options, file) => {
1293
+ const angleId = findAngle(await input.angles(scope), options.angle).id;
1294
+ const packCreativeId = options.pack ? findCreative(await input.creatives(scope), options.pack).id : null;
1295
+ const { cutSheet } = await readMontageCutSheet(scope, file, { upload: true, variations: () => input.variations(scope) });
1296
+ const request = {
1297
+ montage: { angleId, brand: options.brand, cutSheet },
1298
+ ...(options.model ? { model: options.model } : {}), ...(options.resolution ? { resolution: options.resolution } : {}),
1299
+ ...(packCreativeId ? { packCreativeId } : {}),
1300
+ };
1301
+ // A POST: a cut sheet with many prompts does not fit the query string of estimateGeneration.
1302
+ if (options.estimate) {
1303
+ return api(scope, 'estimateMontage', 'mutation', request);
1304
+ }
1305
+ const detail = await api(scope, 'startGeneration', 'mutation', request);
1306
+ return montageSummary(options.wait ? await waitForGeneration(scope, detail.generation.id) : detail);
1307
+ }));
1308
+ scoped(montage.command('show <generationId>').description('Show a Montage Generation: each variant\'s video and each generated clip, with their output ids')
1309
+ .option('--wait', 'Poll until the Generation finished')
1310
+ .option('--download <dir>', 'Save every delivered video as <variant>.mp4 and every delivered generated clip as clip-<shot>.mp4'))
1311
+ .action(run(async (scope, options, generationId) => {
1312
+ const detail = options.wait ? await waitForGeneration(scope, generationId) : await api(scope, 'generation', 'query', { generationId });
1313
+ return { ...montageSummary(detail), ...(options.download ? { downloaded: await downloadMontage(detail, options.download) } : {}) };
1314
+ }));
1315
+ scoped(montage.command('revise <generationId>').description('Write the cut sheet of a follow-up Montage: delivered generated clips are reused at no cost, '
1316
+ + 'rerolled and undelivered Shots generate again')
1317
+ .option('--reroll <shots...>', 'Generated Shots to make again, by id')
1318
+ .option('--out <file>', 'Where to write the cut sheet (default: montage-<first 8 of the id>.revised.json)'))
1319
+ .action(run(async (scope, options, generationId) => {
1320
+ const read = (id) => api(scope, 'generation', 'query', { generationId: id });
1321
+ const revised = await reviseCutSheet(await read(generationId), options.reroll ?? [], read);
1322
+ const out = options.out ?? `montage-${generationId.slice(0, 8)}.revised.json`;
1323
+ await writeFile(out, `${JSON.stringify(revised.cutSheet, null, 2)}\n`, 'utf8');
1324
+ return { written: out, reused: revised.reused, generating: revised.generating };
1325
+ }));
1326
+ };
1210
1327
  export const registerCreativeCommands = (program, deps) => {
1211
1328
  const run = (work) => (async (...args) => {
1212
1329
  const command = args[args.length - 1];
@@ -1264,7 +1381,11 @@ Examples:
1264
1381
  fgrove creatives captions render ./talk.mp4 --style highlight-box --angle C004 --brand Amazon --wait --project claimbee
1265
1382
  fgrove creatives captions transcribe ./talk.mp4 --angle C004 --brand Amazon --wait --project claimbee > words.json
1266
1383
  fgrove creatives captions approve <generation id> --words words.json --style neon-glow --wait --project claimbee
1267
- fgrove creatives captions export <generation id> --format srt --out talk.srt --project claimbee`);
1384
+ fgrove creatives captions export <generation id> --format srt --out talk.srt --project claimbee
1385
+ fgrove creatives montage preview ./vd007/cut.json --project acme
1386
+ fgrove creatives montage start ./vd007/cut.json --angle C004 --brand "Acme Claims" --model kling-4 --estimate --project acme
1387
+ fgrove creatives montage show <generation id> --wait --download ./vd007/out --project acme
1388
+ fgrove creatives montage revise <generation id> --reroll s04 --out ./vd007/cut.v2.json --project acme`);
1268
1389
  const settings = root.command('settings').description('Project creative settings');
1269
1390
  scoped(settings.command('show').description('Show the name prefix and dictionaries'))
1270
1391
  .action(run((scope) => api(scope, 'settings', 'query')));
@@ -1413,4 +1534,5 @@ Examples:
1413
1534
  registerGenerationRunCommands(root, { scoped, run, angles, creatives });
1414
1535
  registerFormatCommands(root, { scoped, run, angles });
1415
1536
  registerCaptionCommands(root, { scoped, run, angles, creatives, variations });
1537
+ registerMontageCommands(root, { scoped, run, angles, creatives, variations });
1416
1538
  };
@@ -0,0 +1,136 @@
1
+ import type { GenerationDetail, GenerationOutput } from './creativeCommands.js';
2
+ export declare const MONTAGE_FILE_TYPES: Record<string, string>;
3
+ type Json = Record<string, unknown>;
4
+ export type MontageUploadRef = {
5
+ key: string;
6
+ sha256: string;
7
+ };
8
+ /** A `{ file }` ref after its path was checked: where it is and what it is. */
9
+ export type MontageLocalFile = {
10
+ path: string;
11
+ contentType: string;
12
+ };
13
+ type LocalFileRef = {
14
+ shotId: string | null;
15
+ where: string;
16
+ file: MontageLocalFile;
17
+ };
18
+ /**
19
+ * The API's cut sheet from a local one: each `{ file }` becomes `{ upload }` through `upload`, each `{ variation: name }`
20
+ * the Variation's id. Every file is checked before the first upload. Also returns the local files with their Shots.
21
+ */
22
+ export declare const resolveCutSheet: (sheet: unknown, input: {
23
+ /** The cut sheet's folder: `{ file }` paths are relative to it. */
24
+ dir: string;
25
+ upload: (file: MontageLocalFile) => Promise<MontageUploadRef>;
26
+ variationId: (ref: string) => Promise<string>;
27
+ }) => Promise<{
28
+ cutSheet: Json;
29
+ files: LocalFileRef[];
30
+ }>;
31
+ /** The backdrops of a preview: a Shot's still or keyframe when it is a local image. */
32
+ export declare const previewBackdrops: (files: LocalFileRef[]) => {
33
+ [k: string]: string;
34
+ };
35
+ export type MontagePreviewShot = {
36
+ id: string;
37
+ start: number;
38
+ seconds: number;
39
+ source: string;
40
+ html: string | null;
41
+ };
42
+ export type MontagePreview = {
43
+ size: string;
44
+ fps: number;
45
+ textStyle: string;
46
+ variants: {
47
+ name: string;
48
+ seconds: number;
49
+ shots: MontagePreviewShot[];
50
+ }[];
51
+ clips: {
52
+ shotId: string;
53
+ seconds: number;
54
+ model: string;
55
+ resolution: string;
56
+ credits: number;
57
+ }[];
58
+ };
59
+ /** `0:03`, `1:02.5`. */
60
+ export declare const montageTime: (seconds: number) => string;
61
+ export declare const shotFileName: (index: number, shotId: string) => string;
62
+ /** One self-contained page: every variant as a row of its Shots in order, each Shot's page scaled down in a frame. */
63
+ export declare const storyboardHtml: (preview: MontagePreview, title: string) => string;
64
+ /** Writes `<dir>/<variant>/<NN>-<shot>.html` for each Shot with html and `<dir>/index.html`; returns the written paths. */
65
+ export declare const writeStoryboard: (preview: MontagePreview, dir: string, title: string) => Promise<{
66
+ index: string;
67
+ written: string[];
68
+ }>;
69
+ export type MontageRecipe = {
70
+ flow: 'montage';
71
+ cutSheet: Json;
72
+ clips: {
73
+ shotId: string;
74
+ seconds: number;
75
+ model: string;
76
+ resolution: string;
77
+ }[];
78
+ variants: {
79
+ name: string;
80
+ seconds: number;
81
+ }[];
82
+ };
83
+ /** The variants' videos in order and the generated clips with their Shots. */
84
+ export declare const montageOutputs: (detail: GenerationDetail) => {
85
+ recipe: MontageRecipe;
86
+ variants: {
87
+ output: GenerationOutput;
88
+ name: string;
89
+ seconds: number;
90
+ }[];
91
+ clips: {
92
+ output: GenerationOutput | undefined;
93
+ shotId: string;
94
+ seconds: number;
95
+ model: string;
96
+ resolution: string;
97
+ }[];
98
+ };
99
+ /** The `montage` part of `montage show`: each variant's video and each generated clip, with their outputs. */
100
+ export declare const summarizeMontage: (detail: GenerationDetail) => {
101
+ approving?: string | undefined;
102
+ variants: {
103
+ name: string;
104
+ seconds: number;
105
+ outputId: string;
106
+ status: string;
107
+ videoUrl: string | null;
108
+ posterUrl: string | null;
109
+ error: string | null;
110
+ keptVariationId: string | null;
111
+ }[];
112
+ clips: {
113
+ shotId: string;
114
+ seconds: number;
115
+ model: string;
116
+ resolution: string;
117
+ outputId: string | null;
118
+ status: string | null;
119
+ url: string | null;
120
+ error: string | null;
121
+ }[];
122
+ };
123
+ /** Saves every delivered variant video as `<variant>.mp4` and every delivered clip as `clip-<shot>.mp4`. */
124
+ export declare const downloadMontage: (detail: GenerationDetail, dir: string, fetchFn?: typeof fetch) => Promise<string[]>;
125
+ /**
126
+ * The cut sheet of a follow-up Montage (CRE-BR-045): each `generate` Shot whose clip was delivered becomes a `clip`
127
+ * naming that clip, unless it is rerolled; everything else is copied as stored. A rerolled Shot that shows a clip an
128
+ * earlier Montage generated gets that Montage's keyframe and prompt back (`earlier` reads it), so a Shot can be made
129
+ * again in any later revision.
130
+ */
131
+ export declare const reviseCutSheet: (detail: GenerationDetail, reroll: string[], earlier: (generationId: string) => Promise<GenerationDetail>) => Promise<{
132
+ cutSheet: Json;
133
+ reused: string[];
134
+ generating: string[];
135
+ }>;
136
+ export {};
@@ -0,0 +1,305 @@
1
+ /**
2
+ * `fgrove creatives montage …` helpers (CRE-BR-045 to CRE-BR-048): the local cut sheet's conveniences, the storyboard
3
+ * of a preview, the summary of a Montage Generation and the cut sheet of a follow-up Montage.
4
+ *
5
+ * A local cut sheet is the API's cut sheet where a stored file may also be written `{ "file": "<path>" }` (relative to
6
+ * the cut sheet's folder) and a Variation `{ "variation": "<full name or vd005_01>" }`; both are resolved before any
7
+ * request.
8
+ */
9
+ import { mkdir, stat, writeFile } from 'node:fs/promises';
10
+ import path from 'node:path';
11
+ import { pathToFileURL } from 'node:url';
12
+ export const MONTAGE_FILE_TYPES = {
13
+ '.mp4': 'video/mp4', '.mov': 'video/quicktime', '.webm': 'video/webm',
14
+ '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp',
15
+ '.mp3': 'audio/mpeg', '.wav': 'audio/wav', '.m4a': 'audio/mp4',
16
+ };
17
+ const isObject = (value) => Boolean(value) && typeof value === 'object' && !Array.isArray(value);
18
+ /** Every media ref of a cut sheet, replaced by `map` one at a time (body, variants' replacements and music), with where it is. */
19
+ const mapMediaRefs = async (sheet, map) => {
20
+ const mapShot = async (shot, where) => {
21
+ if (!isObject(shot)) {
22
+ return shot;
23
+ }
24
+ const id = typeof shot.id === 'string' ? shot.id : null;
25
+ const next = { ...shot };
26
+ for (const key of ['clip', 'still']) {
27
+ if (shot[key] !== undefined) {
28
+ next[key] = await map(shot[key], `${where}.${key}`, id);
29
+ }
30
+ }
31
+ if (isObject(shot.generate) && shot.generate.keyframe !== undefined) {
32
+ next.generate = { ...shot.generate, keyframe: await map(shot.generate.keyframe, `${where}.generate.keyframe`, id) };
33
+ }
34
+ return next;
35
+ };
36
+ const mapShots = async (shots, where) => {
37
+ if (!Array.isArray(shots)) {
38
+ return shots;
39
+ }
40
+ const mapped = [];
41
+ for (const [index, shot] of shots.entries()) {
42
+ mapped.push(await mapShot(shot, `${where}[${index}]`));
43
+ }
44
+ return mapped;
45
+ };
46
+ const next = { ...sheet, shots: await mapShots(sheet.shots, 'shots') };
47
+ if (isObject(sheet.music) && sheet.music.track !== undefined) {
48
+ next.music = { ...sheet.music, track: await map(sheet.music.track, 'music.track', null) };
49
+ }
50
+ if (Array.isArray(sheet.variants)) {
51
+ const variants = [];
52
+ for (const [index, variant] of sheet.variants.entries()) {
53
+ if (!isObject(variant) || !isObject(variant.replace)) {
54
+ variants.push(variant);
55
+ continue;
56
+ }
57
+ const replace = {};
58
+ for (const [id, shots] of Object.entries(variant.replace)) {
59
+ replace[id] = await mapShots(shots, `variants[${index}].replace.${id}`);
60
+ }
61
+ variants.push({ ...variant, replace });
62
+ }
63
+ next.variants = variants;
64
+ }
65
+ return next;
66
+ };
67
+ /**
68
+ * The API's cut sheet from a local one: each `{ file }` becomes `{ upload }` through `upload`, each `{ variation: name }`
69
+ * the Variation's id. Every file is checked before the first upload. Also returns the local files with their Shots.
70
+ */
71
+ export const resolveCutSheet = async (sheet, input) => {
72
+ if (!isObject(sheet) || !Array.isArray(sheet.shots)) {
73
+ throw new Error('A cut sheet is a JSON object with "shots" (CRE-BR-045)');
74
+ }
75
+ const files = new Map();
76
+ await mapMediaRefs(sheet, async (ref, where, shotId) => {
77
+ if (!isObject(ref) || typeof ref.file !== 'string') {
78
+ return ref;
79
+ }
80
+ const file = path.resolve(input.dir, ref.file);
81
+ const contentType = MONTAGE_FILE_TYPES[path.extname(file).toLowerCase()];
82
+ if (!contentType) {
83
+ throw new Error(`${ref.file} (${where}): use an mp4, mov, webm, png, jpg, webp, mp3, wav or m4a file`);
84
+ }
85
+ if (!(await stat(file).catch(() => null))?.isFile()) {
86
+ throw new Error(`${ref.file} (${where}) is not a file`);
87
+ }
88
+ files.set(where, { shotId, where, file: { path: file, contentType } });
89
+ return ref;
90
+ });
91
+ const cutSheet = await mapMediaRefs(sheet, async (ref, where) => {
92
+ if (!isObject(ref)) {
93
+ return ref;
94
+ }
95
+ const local = files.get(where);
96
+ if (local) {
97
+ return { upload: await input.upload(local.file) };
98
+ }
99
+ if (typeof ref.variation === 'string') {
100
+ return { variation: await input.variationId(ref.variation), ...(ref.size !== undefined ? { size: ref.size } : {}) };
101
+ }
102
+ return ref;
103
+ });
104
+ return { cutSheet, files: [...files.values()] };
105
+ };
106
+ /** The backdrops of a preview: a Shot's still or keyframe when it is a local image. */
107
+ export const previewBackdrops = (files) => Object.fromEntries(files
108
+ .filter(({ shotId, where, file }) => shotId && file.contentType.startsWith('image/') && /\.(still|generate\.keyframe)$/.test(where))
109
+ .map(({ shotId, file }) => [shotId, pathToFileURL(file.path).href]));
110
+ const escapeHtml = (value) => value
111
+ .replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
112
+ const round = (value) => Math.round(value * 1000) / 1000;
113
+ /** `0:03`, `1:02.5`. */
114
+ export const montageTime = (seconds) => {
115
+ const minutes = Math.floor(round(seconds) / 60);
116
+ const rest = round(round(seconds) - minutes * 60);
117
+ return `${minutes}:${rest < 10 ? '0' : ''}${rest}`;
118
+ };
119
+ export const shotFileName = (index, shotId) => `${String(index + 1).padStart(2, '0')}-${shotId}.html`;
120
+ const THUMB_WIDTH = 180;
121
+ /** One self-contained page: every variant as a row of its Shots in order, each Shot's page scaled down in a frame. */
122
+ export const storyboardHtml = (preview, title) => {
123
+ const [width, height] = preview.size.split('x').map(Number);
124
+ const scale = THUMB_WIDTH / width;
125
+ const tile = (variant, shot, index) => {
126
+ const picture = shot.html
127
+ ? `<iframe src="${escapeHtml(`${encodeURIComponent(variant)}/${shotFileName(index, shot.id)}`)}" title="${escapeHtml(shot.id)}" loading="lazy" scrolling="no" tabindex="-1"></iframe>`
128
+ : '<span class="empty">No on-screen text</span>';
129
+ return `<li class="shot"><div class="frame">${picture}</div>`
130
+ + `<div class="meta"><span class="id">${escapeHtml(shot.id)}</span><span class="source">${escapeHtml(shot.source)}</span></div>`
131
+ + `<div class="time">${montageTime(shot.start)}–${montageTime(shot.start + shot.seconds)} · ${round(shot.seconds)} s</div></li>`;
132
+ };
133
+ const rows = preview.variants.map((variant) => `<section><h2>${escapeHtml(variant.name)} <span>${round(variant.seconds)} s · ${variant.shots.length} shots</span></h2>`
134
+ + `<ol class="row">${variant.shots.map((shot, index) => tile(variant.name, shot, index)).join('')}</ol></section>`).join('\n');
135
+ const credits = preview.clips.reduce((sum, clip) => sum + clip.credits, 0);
136
+ return `<!doctype html>
137
+ <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
138
+ <title>${escapeHtml(title)} storyboard</title>
139
+ <style>
140
+ :root{color-scheme:light dark;--bg:#fafafa;--fg:#0a0a0a;--muted:rgba(10,10,10,.6);--border:rgba(10,10,10,.12);--surface:#fff;--tile:#f0f0f0}
141
+ @media (prefers-color-scheme:dark){:root{--bg:#0a0a0a;--fg:#fff;--muted:rgba(255,255,255,.6);--border:rgba(255,255,255,.15);--surface:rgba(255,255,255,.05);--tile:rgba(255,255,255,.08)}}
142
+ *{box-sizing:border-box;margin:0;padding:0}
143
+ body{background:var(--bg);color:var(--fg);font:14px/1.4 Geist,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;padding:24px 16px}
144
+ header{margin-bottom:24px}
145
+ h1{font-size:20px;font-weight:600}
146
+ header p,h2 span,.meta .source,.time{color:var(--muted)}
147
+ header p{font-size:13px;margin-top:4px}
148
+ section{margin-bottom:32px}
149
+ h2{font-size:16px;font-weight:600;margin-bottom:12px}
150
+ h2 span{font-size:13px;font-weight:400;margin-left:8px}
151
+ .row{list-style:none;display:flex;gap:12px;overflow-x:auto;padding-bottom:8px}
152
+ .shot{flex:none;width:${THUMB_WIDTH + 2}px;background:var(--surface);border:1px solid var(--border);border-radius:8px;overflow:hidden}
153
+ .frame{position:relative;width:${THUMB_WIDTH}px;height:${Math.round(height * scale)}px;overflow:hidden;background:var(--tile)}
154
+ .frame iframe{position:absolute;top:0;left:0;width:${width}px;height:${height}px;border:0;transform:scale(${Number(scale.toFixed(5))});transform-origin:0 0;pointer-events:none}
155
+ .empty{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:11px;color:var(--muted)}
156
+ .meta{display:flex;justify-content:space-between;gap:8px;padding:8px 8px 0;font-size:13px}
157
+ .meta .id{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
158
+ .meta .source,.time{font-size:11px}
159
+ .time{padding:2px 8px 8px;font-family:"Geist Mono",ui-monospace,SFMono-Regular,Menlo,monospace;font-variant-numeric:tabular-nums}
160
+ </style></head>
161
+ <body><header><h1>${escapeHtml(title)}</h1><p>${escapeHtml(preview.size)} · ${preview.fps} fps · ${escapeHtml(preview.textStyle)} · `
162
+ + `${preview.clips.length} generated clip(s), ${credits} credits</p></header>
163
+ ${rows}
164
+ </body></html>
165
+ `;
166
+ };
167
+ /** Writes `<dir>/<variant>/<NN>-<shot>.html` for each Shot with html and `<dir>/index.html`; returns the written paths. */
168
+ export const writeStoryboard = async (preview, dir, title) => {
169
+ const written = [];
170
+ for (const variant of preview.variants) {
171
+ for (const [index, shot] of variant.shots.entries()) {
172
+ if (!shot.html) {
173
+ continue;
174
+ }
175
+ const file = path.join(dir, variant.name, shotFileName(index, shot.id));
176
+ await mkdir(path.dirname(file), { recursive: true });
177
+ await writeFile(file, shot.html, 'utf8');
178
+ written.push(file);
179
+ }
180
+ }
181
+ await mkdir(dir, { recursive: true });
182
+ const index = path.join(dir, 'index.html');
183
+ await writeFile(index, storyboardHtml(preview, title), 'utf8');
184
+ return { index, written: [index, ...written] };
185
+ };
186
+ const recipeOf = (detail) => {
187
+ const recipe = detail.generation.recipe;
188
+ if (recipe?.flow !== 'montage') {
189
+ throw new Error(`Generation ${detail.generation.id} is not a Montage`);
190
+ }
191
+ return recipe;
192
+ };
193
+ const urlOf = (output) => output.files[0]?.url ?? output.raw_url;
194
+ const delivered = (output) => output?.status === 'succeeded' && Boolean(urlOf(output));
195
+ /** The variants' videos in order and the generated clips with their Shots. */
196
+ export const montageOutputs = (detail) => {
197
+ const recipe = recipeOf(detail);
198
+ const videos = detail.outputs.filter((output) => output.role === 'video')
199
+ .sort((a, b) => Number(a.ordinal ?? 0) - Number(b.ordinal ?? 0));
200
+ return {
201
+ recipe,
202
+ variants: recipe.variants.map((variant, index) => ({ ...variant, output: videos[index] })),
203
+ clips: recipe.clips.map((clip, index) => ({ ...clip, output: detail.outputs.find((output) => output.role === 'clip' && output.scene_index === index) })),
204
+ };
205
+ };
206
+ /** The `montage` part of `montage show`: each variant's video and each generated clip, with their outputs. */
207
+ export const summarizeMontage = (detail) => {
208
+ const { variants, clips } = montageOutputs(detail);
209
+ const videoIds = variants.flatMap(({ output }) => (delivered(output) ? [output.id] : []));
210
+ return {
211
+ variants: variants.map(({ name, seconds, output }) => ({
212
+ name, seconds, outputId: output?.id ?? null, status: output?.status ?? null, videoUrl: output ? urlOf(output) : null,
213
+ posterUrl: output?.files[0]?.posterUrl ?? null, error: output?.error?.message ?? null,
214
+ keptVariationId: output?.kept_variation_id ?? null,
215
+ })),
216
+ clips: clips.map(({ shotId, seconds, model, resolution, output }) => ({
217
+ shotId, seconds, model, resolution, outputId: output?.id ?? null, status: output?.status ?? null, url: output ? urlOf(output) : null,
218
+ error: output?.error?.message ?? null,
219
+ })),
220
+ ...(videoIds.length > 0 ? { approving: `fgrove creatives generations approve ${videoIds.join(' ')}` } : {}),
221
+ };
222
+ };
223
+ /** Saves every delivered variant video as `<variant>.mp4` and every delivered clip as `clip-<shot>.mp4`. */
224
+ export const downloadMontage = async (detail, dir, fetchFn = fetch) => {
225
+ const { variants, clips } = montageOutputs(detail);
226
+ const files = [
227
+ ...variants.flatMap(({ name, output }) => (delivered(output) ? [{ url: urlOf(output), file: path.join(dir, `${name}.mp4`) }] : [])),
228
+ ...clips.flatMap(({ shotId, output }) => (delivered(output) ? [{ url: urlOf(output), file: path.join(dir, `clip-${shotId}.mp4`) }] : [])),
229
+ ];
230
+ await mkdir(dir, { recursive: true });
231
+ for (const { url, file } of files) {
232
+ const response = await fetchFn(url);
233
+ if (!response.ok) {
234
+ throw new Error(`Download of ${path.basename(file)} failed with HTTP ${response.status}`);
235
+ }
236
+ await writeFile(file, Buffer.from(await response.arrayBuffer()));
237
+ }
238
+ return files.map(({ file }) => file);
239
+ };
240
+ /** Every Shot of a stored cut sheet: the body and the variants' replacements. */
241
+ const shotsOf = (sheet) => [
242
+ ...(Array.isArray(sheet.shots) ? sheet.shots : []),
243
+ ...(Array.isArray(sheet.variants) ? sheet.variants : [])
244
+ .flatMap((variant) => (isObject(variant) && isObject(variant.replace) ? Object.values(variant.replace).flat() : [])),
245
+ ].filter(isObject);
246
+ /**
247
+ * The cut sheet of a follow-up Montage (CRE-BR-045): each `generate` Shot whose clip was delivered becomes a `clip`
248
+ * naming that clip, unless it is rerolled; everything else is copied as stored. A rerolled Shot that shows a clip an
249
+ * earlier Montage generated gets that Montage's keyframe and prompt back (`earlier` reads it), so a Shot can be made
250
+ * again in any later revision.
251
+ */
252
+ export const reviseCutSheet = async (detail, reroll, earlier) => {
253
+ const { recipe, clips } = montageOutputs(detail);
254
+ const generated = new Set(recipe.clips.map((clip) => clip.shotId));
255
+ const sheet = recipe.cutSheet;
256
+ const restored = new Map();
257
+ const unknown = [];
258
+ for (const id of reroll.filter((shotId) => !generated.has(shotId))) {
259
+ const ref = shotsOf(sheet).find((shot) => shot.id === id)?.clip;
260
+ const source = isObject(ref) && typeof ref.generation === 'string'
261
+ ? shotsOf(recipeOf(await earlier(ref.generation)).cutSheet).find((shot) => shot.id === ref.shot)?.generate
262
+ : undefined;
263
+ if (source === undefined) {
264
+ unknown.push(id);
265
+ }
266
+ else {
267
+ restored.set(id, source);
268
+ }
269
+ }
270
+ if (unknown.length > 0) {
271
+ throw new Error(`--reroll ${unknown.join(', ')}: not a generated Shot of this Montage (${[...generated].join(', ') || 'none'})`);
272
+ }
273
+ const reuse = new Set(clips.filter(({ shotId, output }) => delivered(output) && !reroll.includes(shotId)).map(({ shotId }) => shotId));
274
+ const generating = [];
275
+ const reviseShot = (shot) => {
276
+ if (!isObject(shot)) {
277
+ return shot;
278
+ }
279
+ const id = shot.id;
280
+ if (restored.has(id)) {
281
+ generating.push(id);
282
+ const { clip: _clip, ...rest } = shot;
283
+ return { ...rest, generate: restored.get(id) };
284
+ }
285
+ if (shot.generate === undefined) {
286
+ return shot;
287
+ }
288
+ if (!reuse.has(id)) {
289
+ generating.push(id);
290
+ return shot;
291
+ }
292
+ const { generate: _generate, ...rest } = shot;
293
+ return { ...rest, clip: { generation: detail.generation.id, shot: id } };
294
+ };
295
+ const cutSheet = {
296
+ ...sheet,
297
+ shots: sheet.shots.map(reviseShot),
298
+ ...(Array.isArray(sheet.variants) ? {
299
+ variants: sheet.variants.map((variant) => (isObject(variant) && isObject(variant.replace)
300
+ ? { ...variant, replace: Object.fromEntries(Object.entries(variant.replace).map(([id, shots]) => [id, shots.map(reviseShot)])) }
301
+ : variant)),
302
+ } : {}),
303
+ };
304
+ return { cutSheet, reused: [...reuse], generating };
305
+ };
@@ -4,10 +4,10 @@
4
4
  "minimumCliVersion": "0.1.20",
5
5
  "entries": [
6
6
  {
7
- "repositoryCliVersion": "0.1.367",
7
+ "repositoryCliVersion": "0.1.370",
8
8
  "manifest": {
9
9
  "schemaVersion": 1,
10
- "bundleVersion": "2.0.360",
10
+ "bundleVersion": "2.0.363",
11
11
  "stepContractVersion": 3,
12
12
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
13
13
  "managedFiles": [
@@ -29,7 +29,7 @@
29
29
  },
30
30
  {
31
31
  "path": "docs/funnelsgrove/contracts/content-answers.md",
32
- "sha256": "49ef258b7320628c42fc8381fab7e65fdf4067e8bd6da7afe72e6ab634e2a4b2"
32
+ "sha256": "b0b15b74a397a46977be9b60be4dd9391101208369e16fed182d4831b963ddef"
33
33
  },
34
34
  {
35
35
  "path": "docs/funnelsgrove/contracts/flow-routing.md",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  {
47
47
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
48
- "sha256": "bd323bff8a5b6312aa4e5734c83e50980d0d35d45f94ab6a3a3193e9a696b4cb"
48
+ "sha256": "20fa52d74baf761ec9fa1b8042bb1e680872c5bef8c6d253da658867dca419ba"
49
49
  },
50
50
  {
51
51
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -145,16 +145,16 @@
145
145
  },
146
146
  {
147
147
  "path": "funnel-docs.config.json",
148
- "sha256": "9638246c7490ae1dfe1ff07b20a9d820b995df59643119d18ccd11f69b6f6b2f"
148
+ "sha256": "67f7d08d21485b19fb066e639a119095934545097c5623635f7862edfc2d304a"
149
149
  }
150
150
  ]
151
151
  }
152
152
  },
153
153
  {
154
- "repositoryCliVersion": "0.1.366",
154
+ "repositoryCliVersion": "0.1.369",
155
155
  "manifest": {
156
156
  "schemaVersion": 1,
157
- "bundleVersion": "2.0.359",
157
+ "bundleVersion": "2.0.362",
158
158
  "stepContractVersion": 3,
159
159
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
160
160
  "managedFiles": [
@@ -168,7 +168,7 @@
168
168
  },
169
169
  {
170
170
  "path": "docs/funnelsgrove/START-HERE.md",
171
- "sha256": "5442274f8ca7ddded834147a693677e203a9c223e1db4260e56bf498ec06a362"
171
+ "sha256": "d80f71fcd0fb555ad25808c98e69b3a4b8dc6752d0381ad473e1764ebe0a062c"
172
172
  },
173
173
  {
174
174
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
@@ -176,7 +176,7 @@
176
176
  },
177
177
  {
178
178
  "path": "docs/funnelsgrove/contracts/content-answers.md",
179
- "sha256": "efd912eb405e4c64b33becb1cf9a397ba5fe9afc2d4e2aea115a0f5e0703ca87"
179
+ "sha256": "b0b15b74a397a46977be9b60be4dd9391101208369e16fed182d4831b963ddef"
180
180
  },
181
181
  {
182
182
  "path": "docs/funnelsgrove/contracts/flow-routing.md",
@@ -184,7 +184,7 @@
184
184
  },
185
185
  {
186
186
  "path": "docs/funnelsgrove/contracts/payments.md",
187
- "sha256": "6e64acdf171351fddedc96e908f4135e2240751a726c05d938c6e8644ab42082"
187
+ "sha256": "ac346fe0aed3bc3ca48679772870ce98ec7446f23a963f86d707a7fcb051bb46"
188
188
  },
189
189
  {
190
190
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -192,7 +192,7 @@
192
192
  },
193
193
  {
194
194
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
195
- "sha256": "4a9ad9c35fd31e0c4fc3fe1912223604d726e74664f1735b022876bdee79da86"
195
+ "sha256": "034e15a21dd82f0f15468015f3b70e4ba34bd6aeee9ce29a3718e0857da93759"
196
196
  },
197
197
  {
198
198
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -216,11 +216,11 @@
216
216
  },
217
217
  {
218
218
  "path": "docs/funnelsgrove/recipes/add-step.md",
219
- "sha256": "fba92b8394b0d622b9886a677af38ddb78042a633c60ab5cb6b1ff600abe2cb9"
219
+ "sha256": "be390e3da8097d5b5a644f33468568939b5f415979920696bec1a6f3d53e002b"
220
220
  },
221
221
  {
222
222
  "path": "docs/funnelsgrove/recipes/edit-step.md",
223
- "sha256": "49eb688c0b3145c025dffe30a9be35e5f5e018da66cbeddf2a08af6a1cc250dc"
223
+ "sha256": "bb9509746bdf8c0e4710b81d32a31f2accf394736fe1e31e0a70d5da5306e21b"
224
224
  },
225
225
  {
226
226
  "path": "docs/funnelsgrove/steps/INDEX.md",
@@ -248,11 +248,11 @@
248
248
  },
249
249
  {
250
250
  "path": "docs/funnelsgrove/steps/paywall_offer.md",
251
- "sha256": "0cf35f69c7d7bfaf3a53ef41cbb833393231ac5dab779f8ace5c529ed3a5d2e8"
251
+ "sha256": "ea24a8474585185bae8793b337956b53ca5a4d34c3f768e464a2b8b84ec5a159"
252
252
  },
253
253
  {
254
254
  "path": "docs/funnelsgrove/steps/progress_interstitial.md",
255
- "sha256": "7ed2d0bf4ac45ee74e36bd87865c250206353ddbd6b34b93975bf87fb0ea09bb"
255
+ "sha256": "5e97cae3e3a4b048efa5d5c4aec9c6371de8db0c1427c012b1eb395ea62a678d"
256
256
  },
257
257
  {
258
258
  "path": "docs/funnelsgrove/steps/purchase_completed.md",
@@ -292,16 +292,16 @@
292
292
  },
293
293
  {
294
294
  "path": "funnel-docs.config.json",
295
- "sha256": "df03c20bd0244edbaebc33f9754ebfd93de79b5dc5f4ffca9b22e3098672e6d4"
295
+ "sha256": "d6d910da200611b719c9385d8467cf3675450dbae684f2e961c1442d9ac98eb3"
296
296
  }
297
297
  ]
298
298
  }
299
299
  },
300
300
  {
301
- "repositoryCliVersion": "0.1.365",
301
+ "repositoryCliVersion": "0.1.368",
302
302
  "manifest": {
303
303
  "schemaVersion": 1,
304
- "bundleVersion": "2.0.358",
304
+ "bundleVersion": "2.0.361",
305
305
  "stepContractVersion": 3,
306
306
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
307
307
  "managedFiles": [
@@ -315,7 +315,7 @@
315
315
  },
316
316
  {
317
317
  "path": "docs/funnelsgrove/START-HERE.md",
318
- "sha256": "5442274f8ca7ddded834147a693677e203a9c223e1db4260e56bf498ec06a362"
318
+ "sha256": "d80f71fcd0fb555ad25808c98e69b3a4b8dc6752d0381ad473e1764ebe0a062c"
319
319
  },
320
320
  {
321
321
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
@@ -323,7 +323,7 @@
323
323
  },
324
324
  {
325
325
  "path": "docs/funnelsgrove/contracts/content-answers.md",
326
- "sha256": "efd912eb405e4c64b33becb1cf9a397ba5fe9afc2d4e2aea115a0f5e0703ca87"
326
+ "sha256": "b0b15b74a397a46977be9b60be4dd9391101208369e16fed182d4831b963ddef"
327
327
  },
328
328
  {
329
329
  "path": "docs/funnelsgrove/contracts/flow-routing.md",
@@ -331,7 +331,7 @@
331
331
  },
332
332
  {
333
333
  "path": "docs/funnelsgrove/contracts/payments.md",
334
- "sha256": "6e64acdf171351fddedc96e908f4135e2240751a726c05d938c6e8644ab42082"
334
+ "sha256": "ac346fe0aed3bc3ca48679772870ce98ec7446f23a963f86d707a7fcb051bb46"
335
335
  },
336
336
  {
337
337
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -339,7 +339,7 @@
339
339
  },
340
340
  {
341
341
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
342
- "sha256": "177644c417fe80371536b9fa0ee0b01ae84d6c66e083e05cc576093ec06c57fc"
342
+ "sha256": "275ee52e64610321259b8af3418dfb21745cdf4c82ad3a10bb1d1922dc64c6a7"
343
343
  },
344
344
  {
345
345
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -363,11 +363,11 @@
363
363
  },
364
364
  {
365
365
  "path": "docs/funnelsgrove/recipes/add-step.md",
366
- "sha256": "fba92b8394b0d622b9886a677af38ddb78042a633c60ab5cb6b1ff600abe2cb9"
366
+ "sha256": "be390e3da8097d5b5a644f33468568939b5f415979920696bec1a6f3d53e002b"
367
367
  },
368
368
  {
369
369
  "path": "docs/funnelsgrove/recipes/edit-step.md",
370
- "sha256": "49eb688c0b3145c025dffe30a9be35e5f5e018da66cbeddf2a08af6a1cc250dc"
370
+ "sha256": "bb9509746bdf8c0e4710b81d32a31f2accf394736fe1e31e0a70d5da5306e21b"
371
371
  },
372
372
  {
373
373
  "path": "docs/funnelsgrove/steps/INDEX.md",
@@ -395,11 +395,11 @@
395
395
  },
396
396
  {
397
397
  "path": "docs/funnelsgrove/steps/paywall_offer.md",
398
- "sha256": "0cf35f69c7d7bfaf3a53ef41cbb833393231ac5dab779f8ace5c529ed3a5d2e8"
398
+ "sha256": "ea24a8474585185bae8793b337956b53ca5a4d34c3f768e464a2b8b84ec5a159"
399
399
  },
400
400
  {
401
401
  "path": "docs/funnelsgrove/steps/progress_interstitial.md",
402
- "sha256": "7ed2d0bf4ac45ee74e36bd87865c250206353ddbd6b34b93975bf87fb0ea09bb"
402
+ "sha256": "5e97cae3e3a4b048efa5d5c4aec9c6371de8db0c1427c012b1eb395ea62a678d"
403
403
  },
404
404
  {
405
405
  "path": "docs/funnelsgrove/steps/purchase_completed.md",
@@ -439,16 +439,16 @@
439
439
  },
440
440
  {
441
441
  "path": "funnel-docs.config.json",
442
- "sha256": "b13c96ce585929d457017df600c19e0b4d315c52ef18a67c194ba29fc7355172"
442
+ "sha256": "a322833e7872e04d895ab4ea07dbe410855ee98b867e8ba9d9f61502fc9285a9"
443
443
  }
444
444
  ]
445
445
  }
446
446
  },
447
447
  {
448
- "repositoryCliVersion": "0.1.364",
448
+ "repositoryCliVersion": "0.1.367",
449
449
  "manifest": {
450
450
  "schemaVersion": 1,
451
- "bundleVersion": "2.0.357",
451
+ "bundleVersion": "2.0.360",
452
452
  "stepContractVersion": 3,
453
453
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
454
454
  "managedFiles": [
@@ -462,7 +462,7 @@
462
462
  },
463
463
  {
464
464
  "path": "docs/funnelsgrove/START-HERE.md",
465
- "sha256": "5442274f8ca7ddded834147a693677e203a9c223e1db4260e56bf498ec06a362"
465
+ "sha256": "d80f71fcd0fb555ad25808c98e69b3a4b8dc6752d0381ad473e1764ebe0a062c"
466
466
  },
467
467
  {
468
468
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
@@ -470,7 +470,7 @@
470
470
  },
471
471
  {
472
472
  "path": "docs/funnelsgrove/contracts/content-answers.md",
473
- "sha256": "efd912eb405e4c64b33becb1cf9a397ba5fe9afc2d4e2aea115a0f5e0703ca87"
473
+ "sha256": "49ef258b7320628c42fc8381fab7e65fdf4067e8bd6da7afe72e6ab634e2a4b2"
474
474
  },
475
475
  {
476
476
  "path": "docs/funnelsgrove/contracts/flow-routing.md",
@@ -478,7 +478,7 @@
478
478
  },
479
479
  {
480
480
  "path": "docs/funnelsgrove/contracts/payments.md",
481
- "sha256": "6e64acdf171351fddedc96e908f4135e2240751a726c05d938c6e8644ab42082"
481
+ "sha256": "ac346fe0aed3bc3ca48679772870ce98ec7446f23a963f86d707a7fcb051bb46"
482
482
  },
483
483
  {
484
484
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -486,7 +486,7 @@
486
486
  },
487
487
  {
488
488
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
489
- "sha256": "2d2420f64f3a2db89f52cd1d5c8e6fe83812e7676514299129e975f463bb6738"
489
+ "sha256": "bd323bff8a5b6312aa4e5734c83e50980d0d35d45f94ab6a3a3193e9a696b4cb"
490
490
  },
491
491
  {
492
492
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -510,11 +510,11 @@
510
510
  },
511
511
  {
512
512
  "path": "docs/funnelsgrove/recipes/add-step.md",
513
- "sha256": "fba92b8394b0d622b9886a677af38ddb78042a633c60ab5cb6b1ff600abe2cb9"
513
+ "sha256": "be390e3da8097d5b5a644f33468568939b5f415979920696bec1a6f3d53e002b"
514
514
  },
515
515
  {
516
516
  "path": "docs/funnelsgrove/recipes/edit-step.md",
517
- "sha256": "49eb688c0b3145c025dffe30a9be35e5f5e018da66cbeddf2a08af6a1cc250dc"
517
+ "sha256": "bb9509746bdf8c0e4710b81d32a31f2accf394736fe1e31e0a70d5da5306e21b"
518
518
  },
519
519
  {
520
520
  "path": "docs/funnelsgrove/steps/INDEX.md",
@@ -542,11 +542,11 @@
542
542
  },
543
543
  {
544
544
  "path": "docs/funnelsgrove/steps/paywall_offer.md",
545
- "sha256": "0cf35f69c7d7bfaf3a53ef41cbb833393231ac5dab779f8ace5c529ed3a5d2e8"
545
+ "sha256": "ea24a8474585185bae8793b337956b53ca5a4d34c3f768e464a2b8b84ec5a159"
546
546
  },
547
547
  {
548
548
  "path": "docs/funnelsgrove/steps/progress_interstitial.md",
549
- "sha256": "7ed2d0bf4ac45ee74e36bd87865c250206353ddbd6b34b93975bf87fb0ea09bb"
549
+ "sha256": "5e97cae3e3a4b048efa5d5c4aec9c6371de8db0c1427c012b1eb395ea62a678d"
550
550
  },
551
551
  {
552
552
  "path": "docs/funnelsgrove/steps/purchase_completed.md",
@@ -586,16 +586,16 @@
586
586
  },
587
587
  {
588
588
  "path": "funnel-docs.config.json",
589
- "sha256": "e7cfae8c8095e634e44442110d2acf003c5e3437a6ba780686a14e2f31ebe53d"
589
+ "sha256": "9638246c7490ae1dfe1ff07b20a9d820b995df59643119d18ccd11f69b6f6b2f"
590
590
  }
591
591
  ]
592
592
  }
593
593
  },
594
594
  {
595
- "repositoryCliVersion": "0.1.363",
595
+ "repositoryCliVersion": "0.1.366",
596
596
  "manifest": {
597
597
  "schemaVersion": 1,
598
- "bundleVersion": "2.0.356",
598
+ "bundleVersion": "2.0.359",
599
599
  "stepContractVersion": 3,
600
600
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
601
601
  "managedFiles": [
@@ -633,7 +633,7 @@
633
633
  },
634
634
  {
635
635
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
636
- "sha256": "b571ab9465df1100e6a735ba6cc167a491864d1a9fe421a74ed50f4a4c5ec454"
636
+ "sha256": "4a9ad9c35fd31e0c4fc3fe1912223604d726e74664f1735b022876bdee79da86"
637
637
  },
638
638
  {
639
639
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -733,16 +733,16 @@
733
733
  },
734
734
  {
735
735
  "path": "funnel-docs.config.json",
736
- "sha256": "0c004825b04b4b6dda7125e3b98b314c4124b8f0ab64b8d1c4b0dd0f4e28eb21"
736
+ "sha256": "df03c20bd0244edbaebc33f9754ebfd93de79b5dc5f4ffca9b22e3098672e6d4"
737
737
  }
738
738
  ]
739
739
  }
740
740
  },
741
741
  {
742
- "repositoryCliVersion": "0.1.362",
742
+ "repositoryCliVersion": "0.1.365",
743
743
  "manifest": {
744
744
  "schemaVersion": 1,
745
- "bundleVersion": "2.0.355",
745
+ "bundleVersion": "2.0.358",
746
746
  "stepContractVersion": 3,
747
747
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
748
748
  "managedFiles": [
@@ -780,7 +780,7 @@
780
780
  },
781
781
  {
782
782
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
783
- "sha256": "d085e5aabede9a981c940d95fcbbc81788f9c6769094e2d6f44d9e021e5fb445"
783
+ "sha256": "177644c417fe80371536b9fa0ee0b01ae84d6c66e083e05cc576093ec06c57fc"
784
784
  },
785
785
  {
786
786
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -880,16 +880,16 @@
880
880
  },
881
881
  {
882
882
  "path": "funnel-docs.config.json",
883
- "sha256": "75b55e12be2c73c387ef8e3ee3222b7f08e8e0ec4649b559e834ee6bebd5601a"
883
+ "sha256": "b13c96ce585929d457017df600c19e0b4d315c52ef18a67c194ba29fc7355172"
884
884
  }
885
885
  ]
886
886
  }
887
887
  },
888
888
  {
889
- "repositoryCliVersion": "0.1.361",
889
+ "repositoryCliVersion": "0.1.364",
890
890
  "manifest": {
891
891
  "schemaVersion": 1,
892
- "bundleVersion": "2.0.354",
892
+ "bundleVersion": "2.0.357",
893
893
  "stepContractVersion": 3,
894
894
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
895
895
  "managedFiles": [
@@ -927,7 +927,7 @@
927
927
  },
928
928
  {
929
929
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
930
- "sha256": "743837afa746bd63ffb9fbd2caa0ee6d64137f017802ab43fb746549cf57affa"
930
+ "sha256": "2d2420f64f3a2db89f52cd1d5c8e6fe83812e7676514299129e975f463bb6738"
931
931
  },
932
932
  {
933
933
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -1027,7 +1027,7 @@
1027
1027
  },
1028
1028
  {
1029
1029
  "path": "funnel-docs.config.json",
1030
- "sha256": "9a17d1b37d62b21a7306cde0affe58f9563af24a34ff2b1024f29dc0c10617c9"
1030
+ "sha256": "e7cfae8c8095e634e44442110d2acf003c5e3437a6ba780686a14e2f31ebe53d"
1031
1031
  }
1032
1032
  ]
1033
1033
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/cli",
3
- "version": "0.1.367",
3
+ "version": "0.1.370",
4
4
  "description": "FunnelsGrove command-line tools for editing, syncing, and publishing funnels",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.360",
3
+ "bundleVersion": "2.0.363",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
@@ -22,7 +22,7 @@
22
22
  },
23
23
  {
24
24
  "path": "docs/funnelsgrove/contracts/content-answers.md",
25
- "sha256": "49ef258b7320628c42fc8381fab7e65fdf4067e8bd6da7afe72e6ab634e2a4b2"
25
+ "sha256": "b0b15b74a397a46977be9b60be4dd9391101208369e16fed182d4831b963ddef"
26
26
  },
27
27
  {
28
28
  "path": "docs/funnelsgrove/contracts/flow-routing.md",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "bd323bff8a5b6312aa4e5734c83e50980d0d35d45f94ab6a3a3193e9a696b4cb"
41
+ "sha256": "20fa52d74baf761ec9fa1b8042bb1e680872c5bef8c6d253da658867dca419ba"
42
42
  },
43
43
  {
44
44
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -138,7 +138,7 @@
138
138
  },
139
139
  {
140
140
  "path": "funnel-docs.config.json",
141
- "sha256": "9638246c7490ae1dfe1ff07b20a9d820b995df59643119d18ccd11f69b6f6b2f"
141
+ "sha256": "67f7d08d21485b19fb066e639a119095934545097c5623635f7862edfc2d304a"
142
142
  }
143
143
  ]
144
144
  }
@@ -114,8 +114,9 @@ payment fields and messages are configured through that provider's locale suppor
114
114
  `src/localization/ru/`, mirroring each original path relative to `src/`:
115
115
  `src/steps/content/intro.content.ts` →
116
116
  `src/localization/ru/steps/content/intro.content.ts`.
117
- Use a code from the runtime's `LOCALE_CATALOG` (the 50 Apple App Store metadata
118
- locales), such as `de-DE`, `ru`, or `pt-BR`. CLI rejects codes outside this list.
117
+ Use a code from the runtime's `LOCALE_CATALOG` (Apple App Store metadata
118
+ locales plus Lithuanian `lt`, Latvian `lv`, and Estonian `et`), such as `de-DE`,
119
+ `lt`, or `pt-BR`. CLI rejects codes outside this list.
119
120
  CLI copies source only: no translation, login,
120
121
  sync or publication. Repeating the command preserves translated values, adds missing exports and
121
122
  repairs missing registrations in the originals.
@@ -17,7 +17,7 @@ Supported read versions: `1`, `2`, `3`. Authoring and publish target version `3`
17
17
 
18
18
  ### Package release order
19
19
 
20
- Release `@funnelsgrove/sdk` `0.4.0` first, then `@funnelsgrove/runtime` `0.45.0`, then `@funnelsgrove/analytics` `0.28.0`, then `@funnelsgrove/payments` `0.72.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.367`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
20
+ Release `@funnelsgrove/sdk` `0.4.0` first, then `@funnelsgrove/runtime` `0.46.0`, then `@funnelsgrove/analytics` `0.29.0`, then `@funnelsgrove/payments` `0.73.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.370`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
21
21
  <!-- funnelsgrove:generated:end contract-v3/migration/step-contract-v3 -->
22
22
 
23
23
  ## Version-last policy
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.360",
3
+ "bundleVersion": "2.0.363",
4
4
  "contractSource": "funnelsgrove-repository://apps/funnel-runtime/contracts/step-contract-v2.json",
5
5
  "fullyGenerated": [
6
6
  ".funnelsgrove-docs.json",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.360",
3
+ "bundleVersion": "2.0.363",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
@@ -22,7 +22,7 @@
22
22
  },
23
23
  {
24
24
  "path": "docs/funnelsgrove/contracts/content-answers.md",
25
- "sha256": "49ef258b7320628c42fc8381fab7e65fdf4067e8bd6da7afe72e6ab634e2a4b2"
25
+ "sha256": "b0b15b74a397a46977be9b60be4dd9391101208369e16fed182d4831b963ddef"
26
26
  },
27
27
  {
28
28
  "path": "docs/funnelsgrove/contracts/flow-routing.md",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "bd323bff8a5b6312aa4e5734c83e50980d0d35d45f94ab6a3a3193e9a696b4cb"
41
+ "sha256": "20fa52d74baf761ec9fa1b8042bb1e680872c5bef8c6d253da658867dca419ba"
42
42
  },
43
43
  {
44
44
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -138,7 +138,7 @@
138
138
  },
139
139
  {
140
140
  "path": "funnel-docs.config.json",
141
- "sha256": "9638246c7490ae1dfe1ff07b20a9d820b995df59643119d18ccd11f69b6f6b2f"
141
+ "sha256": "67f7d08d21485b19fb066e639a119095934545097c5623635f7862edfc2d304a"
142
142
  }
143
143
  ]
144
144
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "sourceTreeHash": "ac50ff54c29b0f202bd27ffa8b394fa9573ab73ca83f87d4221324ebec3f0866",
3
+ "sourceTreeHash": "b8ed24ba5afac53b8cd14acc5cd84e41b57fd8063c260d58d7eee59a265d2223",
4
4
  "stepContractVersion": 3,
5
- "docsBundleVersion": "2.0.360",
5
+ "docsBundleVersion": "2.0.363",
6
6
  "files": [
7
7
  {
8
8
  "path": ".env.example",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  {
18
18
  "path": ".funnelsgrove-docs.json",
19
- "sha256": "d2f68b059534d7883174b350574a8f019262c48e6184560a1cc18a71dba7f79e",
19
+ "sha256": "cdb58ffe792363c33eb22ad6d0222ec0c2e6113e3435edc17272d67764403e80",
20
20
  "mode": "100644"
21
21
  },
22
22
  {
@@ -56,7 +56,7 @@
56
56
  },
57
57
  {
58
58
  "path": "docs/funnelsgrove/contracts/content-answers.md",
59
- "sha256": "49ef258b7320628c42fc8381fab7e65fdf4067e8bd6da7afe72e6ab634e2a4b2",
59
+ "sha256": "b0b15b74a397a46977be9b60be4dd9391101208369e16fed182d4831b963ddef",
60
60
  "mode": "100644"
61
61
  },
62
62
  {
@@ -76,7 +76,7 @@
76
76
  },
77
77
  {
78
78
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
79
- "sha256": "bd323bff8a5b6312aa4e5734c83e50980d0d35d45f94ab6a3a3193e9a696b4cb",
79
+ "sha256": "20fa52d74baf761ec9fa1b8042bb1e680872c5bef8c6d253da658867dca419ba",
80
80
  "mode": "100644"
81
81
  },
82
82
  {
@@ -206,7 +206,7 @@
206
206
  },
207
207
  {
208
208
  "path": "funnel-docs.config.json",
209
- "sha256": "9638246c7490ae1dfe1ff07b20a9d820b995df59643119d18ccd11f69b6f6b2f",
209
+ "sha256": "67f7d08d21485b19fb066e639a119095934545097c5623635f7862edfc2d304a",
210
210
  "mode": "100644"
211
211
  },
212
212
  {
@@ -114,8 +114,9 @@ payment fields and messages are configured through that provider's locale suppor
114
114
  `src/localization/ru/`, mirroring each original path relative to `src/`:
115
115
  `src/steps/content/intro.content.ts` →
116
116
  `src/localization/ru/steps/content/intro.content.ts`.
117
- Use a code from the runtime's `LOCALE_CATALOG` (the 50 Apple App Store metadata
118
- locales), such as `de-DE`, `ru`, or `pt-BR`. CLI rejects codes outside this list.
117
+ Use a code from the runtime's `LOCALE_CATALOG` (Apple App Store metadata
118
+ locales plus Lithuanian `lt`, Latvian `lv`, and Estonian `et`), such as `de-DE`,
119
+ `lt`, or `pt-BR`. CLI rejects codes outside this list.
119
120
  CLI copies source only: no translation, login,
120
121
  sync or publication. Repeating the command preserves translated values, adds missing exports and
121
122
  repairs missing registrations in the originals.
@@ -17,7 +17,7 @@ Supported read versions: `1`, `2`, `3`. Authoring and publish target version `3`
17
17
 
18
18
  ### Package release order
19
19
 
20
- Release `@funnelsgrove/sdk` `0.4.0` first, then `@funnelsgrove/runtime` `0.45.0`, then `@funnelsgrove/analytics` `0.28.0`, then `@funnelsgrove/payments` `0.72.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.367`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
20
+ Release `@funnelsgrove/sdk` `0.4.0` first, then `@funnelsgrove/runtime` `0.46.0`, then `@funnelsgrove/analytics` `0.29.0`, then `@funnelsgrove/payments` `0.73.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.370`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
21
21
  <!-- funnelsgrove:generated:end contract-v3/migration/step-contract-v3 -->
22
22
 
23
23
  ## Version-last policy
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.360",
3
+ "bundleVersion": "2.0.363",
4
4
  "contractSource": "funnelsgrove-repository://apps/funnel-runtime/contracts/step-contract-v2.json",
5
5
  "fullyGenerated": [
6
6
  ".funnelsgrove-docs.json",