Show it a video you love. Get a new video in the same style. An AI crew (Claude Code or Codex) plans, builds and reviews it with you.
JavaScript 2d-animationai-agentsai-videoanimationclaude-codecodexmulti-agentstyle-transfervideo-generation
render.mjs: sweep Chrome temp profiles left by killed renders (15 GB had piled up)
許元豪2f5b891fafe7
diff --git a/.claude/skills/anime-cel/template/render.mjs b/.claude/skills/anime-cel/template/render.mjsindex df708de..e1e42f0 100644--- a/.claude/skills/anime-cel/template/render.mjs+++ b/.claude/skills/anime-cel/template/render.mjs@@ -19,7 +19,7 @@// At most RENDER_SLOTS (default 4) renders hold a Chrome at once on this machine; the rest wait their turn.import puppeteer from 'puppeteer-core';import { spawn } from 'node:child_process';-import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync } from 'node:fs';+import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync, rmSync } from 'node:fs';import { createHash } from 'node:crypto';import { dirname, resolve } from 'node:path';import { pathToFileURL } from 'node:url';@@ -89,6 +89,14 @@ async function takeSlot() {await new Promise(r => setTimeout(r, 1000));}}+// Chrome's temp profile is removed on browser.close(), but a render killed mid-way (an agent's turn ending) leaves it+// behind: 266 of them (15 GB) had piled up on one machine. Sweep profiles untouched for 6 hours (none of those is live).+try {+ for (const d of readdirSync(tmpdir()).filter(n => n.startsWith('puppeteer_dev_chrome_profile-'))) {+ const p = `${tmpdir()}/${d}`;+ if (Date.now() - statSync(p).mtimeMs > 6 * 3600e3) rmSync(p, { recursive: true, force: true });+ }+} catch {}const slot = await takeSlot();process.on('exit', () => { try { unlinkSync(slot); } catch {} });for (const sig of ['SIGINT', 'SIGTERM']) process.on(sig, () => process.exit(1));diff --git a/.claude/skills/crayon-storybook/template/render.mjs b/.claude/skills/crayon-storybook/template/render.mjsindex 10093e4..33a1b8a 100644--- a/.claude/skills/crayon-storybook/template/render.mjs+++ b/.claude/skills/crayon-storybook/template/render.mjs@@ -19,7 +19,7 @@// At most RENDER_SLOTS (default 4) renders hold a Chrome at once on this machine; the rest wait their turn.import puppeteer from 'puppeteer-core';import { spawn } from 'node:child_process';-import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync } from 'node:fs';+import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync, rmSync } from 'node:fs';import { createHash } from 'node:crypto';import { dirname, resolve } from 'node:path';import { pathToFileURL } from 'node:url';@@ -89,6 +89,14 @@ async function takeSlot() {await new Promise(r => setTimeout(r, 1000));}}+// Chrome's temp profile is removed on browser.close(), but a render killed mid-way (an agent's turn ending) leaves it+// behind: 266 of them (15 GB) had piled up on one machine. Sweep profiles untouched for 6 hours (none of those is live).+try {+ for (const d of readdirSync(tmpdir()).filter(n => n.startsWith('puppeteer_dev_chrome_profile-'))) {+ const p = `${tmpdir()}/${d}`;+ if (Date.now() - statSync(p).mtimeMs > 6 * 3600e3) rmSync(p, { recursive: true, force: true });+ }+} catch {}const slot = await takeSlot();process.on('exit', () => { try { unlinkSync(slot); } catch {} });for (const sig of ['SIGINT', 'SIGTERM']) process.on(sig, () => process.exit(1));diff --git a/.claude/skills/painted-animation/template/render.mjs b/.claude/skills/painted-animation/template/render.mjsindex df708de..e1e42f0 100644--- a/.claude/skills/painted-animation/template/render.mjs+++ b/.claude/skills/painted-animation/template/render.mjs@@ -19,7 +19,7 @@// At most RENDER_SLOTS (default 4) renders hold a Chrome at once on this machine; the rest wait their turn.import puppeteer from 'puppeteer-core';import { spawn } from 'node:child_process';-import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync } from 'node:fs';+import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync, rmSync } from 'node:fs';import { createHash } from 'node:crypto';import { dirname, resolve } from 'node:path';import { pathToFileURL } from 'node:url';@@ -89,6 +89,14 @@ async function takeSlot() {await new Promise(r => setTimeout(r, 1000));}}+// Chrome's temp profile is removed on browser.close(), but a render killed mid-way (an agent's turn ending) leaves it+// behind: 266 of them (15 GB) had piled up on one machine. Sweep profiles untouched for 6 hours (none of those is live).+try {+ for (const d of readdirSync(tmpdir()).filter(n => n.startsWith('puppeteer_dev_chrome_profile-'))) {+ const p = `${tmpdir()}/${d}`;+ if (Date.now() - statSync(p).mtimeMs > 6 * 3600e3) rmSync(p, { recursive: true, force: true });+ }+} catch {}const slot = await takeSlot();process.on('exit', () => { try { unlinkSync(slot); } catch {} });for (const sig of ['SIGINT', 'SIGTERM']) process.on(sig, () => process.exit(1));diff --git a/.claude/skills/paper-cutout/template/render.mjs b/.claude/skills/paper-cutout/template/render.mjsindex df708de..e1e42f0 100644--- a/.claude/skills/paper-cutout/template/render.mjs+++ b/.claude/skills/paper-cutout/template/render.mjs@@ -19,7 +19,7 @@// At most RENDER_SLOTS (default 4) renders hold a Chrome at once on this machine; the rest wait their turn.import puppeteer from 'puppeteer-core';import { spawn } from 'node:child_process';-import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync } from 'node:fs';+import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync, rmSync } from 'node:fs';import { createHash } from 'node:crypto';import { dirname, resolve } from 'node:path';import { pathToFileURL } from 'node:url';@@ -89,6 +89,14 @@ async function takeSlot() {await new Promise(r => setTimeout(r, 1000));}}+// Chrome's temp profile is removed on browser.close(), but a render killed mid-way (an agent's turn ending) leaves it+// behind: 266 of them (15 GB) had piled up on one machine. Sweep profiles untouched for 6 hours (none of those is live).+try {+ for (const d of readdirSync(tmpdir()).filter(n => n.startsWith('puppeteer_dev_chrome_profile-'))) {+ const p = `${tmpdir()}/${d}`;+ if (Date.now() - statSync(p).mtimeMs > 6 * 3600e3) rmSync(p, { recursive: true, force: true });+ }+} catch {}const slot = await takeSlot();process.on('exit', () => { try { unlinkSync(slot); } catch {} });for (const sig of ['SIGINT', 'SIGTERM']) process.on(sig, () => process.exit(1));diff --git a/.claude/skills/pixel-art/template/render.mjs b/.claude/skills/pixel-art/template/render.mjsindex df708de..e1e42f0 100644--- a/.claude/skills/pixel-art/template/render.mjs+++ b/.claude/skills/pixel-art/template/render.mjs@@ -19,7 +19,7 @@// At most RENDER_SLOTS (default 4) renders hold a Chrome at once on this machine; the rest wait their turn.import puppeteer from 'puppeteer-core';import { spawn } from 'node:child_process';-import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync } from 'node:fs';+import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync, rmSync } from 'node:fs';import { createHash } from 'node:crypto';import { dirname, resolve } from 'node:path';import { pathToFileURL } from 'node:url';@@ -89,6 +89,14 @@ async function takeSlot() {await new Promise(r => setTimeout(r, 1000));}}+// Chrome's temp profile is removed on browser.close(), but a render killed mid-way (an agent's turn ending) leaves it+// behind: 266 of them (15 GB) had piled up on one machine. Sweep profiles untouched for 6 hours (none of those is live).+try {+ for (const d of readdirSync(tmpdir()).filter(n => n.startsWith('puppeteer_dev_chrome_profile-'))) {+ const p = `${tmpdir()}/${d}`;+ if (Date.now() - statSync(p).mtimeMs > 6 * 3600e3) rmSync(p, { recursive: true, force: true });+ }+} catch {}const slot = await takeSlot();process.on('exit', () => { try { unlinkSync(slot); } catch {} });for (const sig of ['SIGINT', 'SIGTERM']) process.on(sig, () => process.exit(1));diff --git a/.claude/skills/whiteboard/template/render.mjs b/.claude/skills/whiteboard/template/render.mjsindex df708de..e1e42f0 100644--- a/.claude/skills/whiteboard/template/render.mjs+++ b/.claude/skills/whiteboard/template/render.mjs@@ -19,7 +19,7 @@// At most RENDER_SLOTS (default 4) renders hold a Chrome at once on this machine; the rest wait their turn.import puppeteer from 'puppeteer-core';import { spawn } from 'node:child_process';-import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync } from 'node:fs';+import { mkdirSync, writeFileSync, existsSync, statSync, renameSync, readdirSync, readFileSync, unlinkSync, rmSync } from 'node:fs';import { createHash } from 'node:crypto';import { dirname, resolve } from 'node:path';import { pathToFileURL } from 'node:url';@@ -89,6 +89,14 @@ async function takeSlot() {await new Promise(r => setTimeout(r, 1000));}}+// Chrome's temp profile is removed on browser.close(), but a render killed mid-way (an agent's turn ending) leaves it+// behind: 266 of them (15 GB) had piled up on one machine. Sweep profiles untouched for 6 hours (none of those is live).+try {+ for (const d of readdirSync(tmpdir()).filter(n => n.startsWith('puppeteer_dev_chrome_profile-'))) {+ const p = `${tmpdir()}/${d}`;+ if (Date.now() - statSync(p).mtimeMs > 6 * 3600e3) rmSync(p, { recursive: true, force: true });+ }+} catch {}const slot = await takeSlot();process.on('exit', () => { try { unlinkSync(slot); } catch {} });for (const sig of ['SIGINT', 'SIGTERM']) process.on(sig, () => process.exit(1));