From e8a184fa6e9e15a1e670da4448c9cd115b06e904 Mon Sep 17 00:00:00 2001 From: Vance Ingalls Date: Wed, 25 Mar 2026 17:08:12 -0700 Subject: [PATCH] fix(cli): match both TRANSCRIPT and script variable names in templates Three templates use `const TRANSCRIPT = [...]` while warm-grain uses `const script = [...]`. The patchTranscript function now matches both. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/cli/src/commands/init.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index 98394c8bbe..0ed60eb959 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -277,10 +277,13 @@ function patchTranscript(dir: string, transcriptPath: string): void { for (const file of htmlFiles) { let content = readFileSync(file, "utf-8"); - // Match: const script = [ ... ]; (the hardcoded word array in captions) - const match = content.match(/const script = \[[\s\S]*?\];/); + // Match: const script = [...] or const TRANSCRIPT = [...] (hardcoded word arrays in captions) + const scriptMatch = content.match(/const script = \[[\s\S]*?\];/); + const transcriptMatch = content.match(/const TRANSCRIPT = \[[\s\S]*?\];/); + const match = scriptMatch ?? transcriptMatch; if (match) { - content = content.replace(match[0], `const script = ${wordsJson};`); + const varName = scriptMatch ? "script" : "TRANSCRIPT"; + content = content.replace(match[0], `const ${varName} = ${wordsJson};`); writeFileSync(file, content, "utf-8"); } }