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
Optional: post a finished video with npm run publish (Upload-Post)
mutonbye8b9e118eba4
diff --git a/README.md b/README.mdindex 06afa97..4df381f 100644--- a/README.md+++ b/README.md@@ -131,6 +131,20 @@ committed. See [`secrets.example.json`](secrets.example.json) for the format.| `CODEX_SANDBOX` | Codex sandbox mode (default `danger-full-access`, like Claude Code with Bash allowed; `workspace-write` blocks the Chrome renderer) || `BUILDERS`, `MAX_AGENTS` | How many agents work on one video at once (default 6), and the limit across all projects (default 12) || `PORT` | Web port (default 4318) |+| `UPLOAD_POST_KEY`, `UPLOAD_POST_USER` | Optional. Post a finished video to TikTok, Instagram, YouTube and others with `npm run publish` (see below) |++### Posting the finished video (optional)++ReelMimic never posts anything by itself. Once a project's final review is done and you're happy with the video, you can+send it to your social accounts through [Upload-Post](https://upload-post.com) from the `app/` folder:++```bash+npm run publish -- <project id> --platforms tiktok,instagram,youtube # dry run: shows what it would post+npm run publish -- <project id> --platforms tiktok --at 2026-10-05T18:00 --tz Europe/Madrid --send+```++Without `--send` nothing leaves your computer. It only takes projects whose stage is `done`, uses the plan's title+unless you pass `--title`, and a rerun of the same video won't post it twice.## Docsdiff --git a/app/package.json b/app/package.jsonindex 2fc65df..2f6a340 100644--- a/app/package.json+++ b/app/package.json@@ -12,6 +12,7 @@"test": "node --test --experimental-test-module-mocks \"server/**/*.test.ts\"","check": "npm run typecheck && npm run lint && npm test","doctor": "node scripts/doctor.mjs",+ "publish": "node scripts/publish.mjs","setup": "npm install && node scripts/doctor.mjs"},"dependencies": {diff --git a/app/scripts/publish.mjs b/app/scripts/publish.mjsnew file mode 100644index 0000000..e2318c1--- /dev/null+++ b/app/scripts/publish.mjs@@ -0,0 +1,59 @@+// Optional: post a finished video to social platforms through Upload-Post (https://upload-post.com). npm run publish -- <project>+// Never runs on its own: nothing in the pipeline calls it, and it only takes a project whose final review is done.+// Without --send it is a dry run: it prints what it would post and sends nothing.+// npm run publish -- 20261003-ab12c --platforms tiktok,instagram,youtube+// npm run publish -- 20261003-ab12c --platforms tiktok --title "Bath Time" --at 2026-10-05T18:00 --tz Europe/Madrid --send+// Needs UPLOAD_POST_KEY (an API key) and UPLOAD_POST_USER (the profile the accounts are connected to) in ~/.reelmimic/secrets.json.+// @ts-check+import { createHash } from 'node:crypto';+import { existsSync, openAsBlob, readFileSync, statSync } from 'node:fs';+import { basename, join, resolve } from 'node:path';+import { parseArgs } from 'node:util';++await import('../server/env.ts'); // same secrets as the server+const API = process.env.UPLOAD_POST_API || 'https://api.upload-post.com';+const PROJECTS = process.env.REELMIMIC_PROJECTS ? resolve(process.env.REELMIMIC_PROJECTS) : join(import.meta.dirname, '..', '..', 'projects');++/** @param {string} m */+const fail = (m) => { console.error(` \x1b[31m✗\x1b[0m ${m}`); process.exit(1); };+/** @param {string} p */+const readJSON = (p) => { try { return JSON.parse(readFileSync(p, 'utf8')); } catch { return null; } };++const { values: o, positionals } = parseArgs({ allowPositionals: true, options: {+ platforms: { type: 'string' }, title: { type: 'string' }, description: { type: 'string' },+ at: { type: 'string' }, tz: { type: 'string' }, send: { type: 'boolean', default: false },+} });+const id = positionals[0];+if (!id || !o.platforms) fail('usage: npm run publish -- <project id> --platforms tiktok,instagram [--title …] [--description …] [--at 2026-10-05T18:00 --tz Europe/Madrid] [--send]');+if (!/^[\w-]+$/.test(id)) fail(`not a project id: ${id}`);+const dir = join(PROJECTS, id), job = readJSON(join(dir, 'job.json')), video = join(dir, 'out', 'video.mp4');+if (!job) fail(`no such project: ${dir}`);+// Only after the final review: a video still being produced or revised is not the one you approved.+if (job.stage !== 'done') fail(`project is "${job.stage}", not "done". Publish only once the final review is finished`);+if (!existsSync(video)) fail(`no final video at ${video}`);+const platforms = String(o.platforms).split(',').map((p) => p.trim().toLowerCase()).filter(Boolean);+const title = (o.title || readJSON(join(dir, 'plan.json'))?.title || job.title || '').trim();+if (!title && platforms.includes('youtube')) fail('YouTube needs a title: pass --title');+if (o.tz && !o.at) fail('--tz only applies with --at');++// Same project + same video file → same key, so a retried run never posts the video twice.+const st = statSync(video), idem = createHash('sha256').update(`${id}:${st.size}:${st.mtimeMs}:${platforms.join(',')}:${o.at || ''}`).digest('hex').slice(0, 32);+const form = new FormData();+form.append('user', process.env.UPLOAD_POST_USER || '');+for (const p of platforms) form.append('platform[]', p);+if (title) form.append('title', title);+if (o.description) form.append('description', o.description);+if (o.at) form.append('scheduled_date', o.at);+if (o.tz) form.append('timezone', o.tz);+form.append('async_upload', 'true');++console.log(`\n ${basename(dir)} · ${(st.size / 1024 ** 2).toFixed(1)} MB · ${platforms.join(', ')}${o.at ? ` · scheduled ${o.at}${o.tz ? ` ${o.tz}` : ' UTC'}` : ' · now'}\n title: ${title || '(none)'}`);+if (!o.send) { console.log('\n Dry run, nothing sent. Add --send to post it.\n'); process.exit(0); }+if (!process.env.UPLOAD_POST_KEY || !process.env.UPLOAD_POST_USER) fail('set UPLOAD_POST_KEY and UPLOAD_POST_USER in ~/.reelmimic/secrets.json');++form.append('video', await openAsBlob(video, { type: 'video/mp4' }), `${id}.mp4`);+const res = await fetch(`${API}/api/upload`, { method: 'POST', body: form, headers: { Authorization: `Apikey ${process.env.UPLOAD_POST_KEY}`, 'Idempotency-Key': idem } });+const body = /** @type {Record<string, any>} */ (await res.json().catch(() => ({})));+if (!res.ok) fail(`Upload-Post answered ${res.status}: ${body.message || body.error || JSON.stringify(body)}`);+console.log(` \x1b[32m✓\x1b[0m ${o.at ? 'scheduled' : 'sent'}${body.request_id ? ` · request_id ${body.request_id}` : ''}${body.job_id ? ` · job_id ${body.job_id}` : ''}`);+console.log(' Progress and post links: https://app.upload-post.com (or GET /api/uploadposts/status?request_id=…)\n');diff --git a/secrets.example.json b/secrets.example.jsonindex c3bf364..ddc24f2 100644--- a/secrets.example.json+++ b/secrets.example.json@@ -6,5 +6,7 @@"FFMPEG_DIR": "folder containing ffmpeg/ffprobe if they are not on PATH","CODEX_BIN": "path to a specific codex CLI if an old one shadows it on PATH","BUILDERS": "parallel shot builders per video (default 5)",- "MAX_AGENTS": "agents running at once across all projects (default 10)"+ "MAX_AGENTS": "agents running at once across all projects (default 10)",+ "UPLOAD_POST_KEY": "optional: post finished videos with npm run publish (upload-post.com API key)",+ "UPLOAD_POST_USER": "optional: the Upload-Post profile your social accounts are connected to"}