retakes-cli 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,75 @@
1
+ Required Notice: Copyright 2026 Simon Amable (https://github.com/SimonAmable)
2
+
3
+ # PolyForm Noncommercial License 1.0.0
4
+
5
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
6
+
7
+ ## Acceptance
8
+
9
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
14
+
15
+ ## Distribution License
16
+
17
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
18
+
19
+ ## Notices
20
+
21
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
22
+
23
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
24
+
25
+ ## Changes and New Works License
26
+
27
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
28
+
29
+ ## Patent License
30
+
31
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
32
+
33
+ ## Noncommercial Purposes
34
+
35
+ Any noncommercial purpose is a permitted purpose.
36
+
37
+ ## Personal Uses
38
+
39
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
40
+
41
+ ## Noncommercial Organizations
42
+
43
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
44
+
45
+ ## Fair Use
46
+
47
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
48
+
49
+ ## No Other Rights
50
+
51
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
52
+
53
+ ## Patent Defense
54
+
55
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
56
+
57
+ ## Violations
58
+
59
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
60
+
61
+ ## No Liability
62
+
63
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
64
+
65
+ ## Definitions
66
+
67
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
68
+
69
+ **You** refers to the individual or entity agreeing to these terms.
70
+
71
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
72
+
73
+ **Your licenses** are all the licenses granted to you for the software under these terms.
74
+
75
+ **Use** means anything you do with the software requiring one of your licenses.
package/README.md CHANGED
@@ -1,3 +1,49 @@
1
- # Temporary Holding Version
1
+ # retakes-cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Version control for agent-made video.** The `retake` CLI saves every render your AI agent makes, with its source files and the prompt behind it, and pushes it to [Retakes](https://retakes.simonamable.workers.dev), where you compare cuts and pin comments to frames. Your agent then pulls those comments back as a fix list.
4
+
5
+ Works with HyperFrames, Remotion and any other video folder. Needs Node 20+ and ffmpeg. Runs on macOS, Linux and Windows.
6
+
7
+ ## Quickstart
8
+
9
+ The fast way: on [the Retakes home page](https://retakes.simonamable.workers.dev) press **Copy prompt** and paste it into Claude Code, Codex, Cursor or any agent. Or by hand:
10
+
11
+ ```sh
12
+ npm i -g retakes-cli
13
+ retake skill install # teaches Claude Code and Codex to use it
14
+ retake login # opens the browser; approve the code
15
+ cd my-video
16
+ retake init # detects HyperFrames, Remotion or anything else
17
+ # …render…
18
+ retake save -m "first cut" --prompt "45s launch ad, green shader look"
19
+ retake push # prints the link (private: only you can see it)
20
+ ```
21
+
22
+ ## Commands
23
+
24
+ | Command | What it does |
25
+ | --- | --- |
26
+ | `init [dir] [--engine e] [--public]` | Start versioning a folder |
27
+ | `save -m "…" [--prompt "…"] [--render f] [--amend]` | Snapshot the source and the newest render |
28
+ | `log` · `status` · `diff [a] [b] [--patch]` | History and changes |
29
+ | `checkout <n> [--render]` | Put a version's source back |
30
+ | `push [--public\|--private]` | Upload new versions, with a 540p preview and poster made locally |
31
+ | `feedback [--json] [--all]` | Open frame comments for your agent, with marked stills |
32
+ | `resolve <ids>` | Close comments by hand |
33
+ | `fork handle/slug[@n] [dir]` | Copy a public project to build on |
34
+ | `remix handle/slug[@n] [dir]` | New project in another video's style |
35
+ | `watch <video>` | Turn any video into images and notes an image-only agent can read |
36
+ | `match <reference> [yours]` | Shot-by-shot score against a reference |
37
+ | `vdiff [a] [b]` | Which shots changed between two takes |
38
+ | `skill install` · `skill list` · `skill agents-md` | Install the agent skills, list them, or print an AGENTS.md block |
39
+
40
+ `RETAKES_REMOTE` and `RETAKES_TOKEN` override the server and the token (CI, sandboxed agents). `retake login --remote https://your.domain` points the CLI at a self-hosted server.
41
+
42
+ ## Links
43
+
44
+ - Docs: https://retakes.simonamable.workers.dev/docs (also [as Markdown](https://retakes.simonamable.workers.dev/docs.md))
45
+ - Source and self-hosting: https://github.com/SimonAmable/retakes
46
+
47
+ ## License
48
+
49
+ [PolyForm Noncommercial 1.0.0](https://polyformproject.org/licenses/noncommercial/1.0.0): free for personal and other noncommercial use. Commercial use needs a separate licence; see the repository.
package/bin/retake.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { main } from "../src/cli.js";
3
+
4
+ main(process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "retakes-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Version control for AI-made video: save every render your agent makes with its source and prompt, push it, and pull frame comments back as a fix list.",
5
+ "type": "module",
6
+ "bin": {
7
+ "retake": "bin/retake.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "src",
12
+ "skills",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "engines": {
17
+ "node": ">=20"
18
+ },
19
+ "keywords": [
20
+ "video",
21
+ "agents",
22
+ "version-control",
23
+ "hyperframes",
24
+ "remotion",
25
+ "claude-code",
26
+ "codex",
27
+ "ai",
28
+ "video-editing",
29
+ "cli",
30
+ "cursor",
31
+ "ffmpeg"
32
+ ],
33
+ "homepage": "https://retakes.simonamable.workers.dev",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/SimonAmable/retakes.git",
37
+ "directory": "packages/cli"
38
+ },
39
+ "bugs": {
40
+ "url": "https://github.com/SimonAmable/retakes/issues"
41
+ },
42
+ "author": "Simon Amable (https://github.com/SimonAmable)",
43
+ "license": "PolyForm-Noncommercial-1.0.0"
44
+ }
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: retakes
3
+ description: Version every render of a video you make with the `retake` CLI (Retakes), and fix review notes people pin on frames. Use whenever you render a video in a project that has a .retakes/ folder, when someone says "save this version", "push it", "what did reviewers say", "fix the comments", "fork/remix that video", or hands you a Retakes link. Works with HyperFrames, Remotion and any other video project.
4
+ ---
5
+
6
+ # Retakes: versions and frame feedback for agent-made video
7
+
8
+ `retake` keeps every version of a video: the source files, the render, and the prompt you were working from. People review on the web and pin comments to exact frames; you pull those comments back, already mapped to the scene file.
9
+
10
+ Check it's available with `retake --version`. If it isn't: `npm i -g retakes-cli` (or prefix every command with `npx retakes-cli`).
11
+
12
+ ## Starting
13
+ - In a project without `.retakes/`: run `retake init` once. It detects HyperFrames or Remotion; anything else is versioned as a plain folder.
14
+ - Not logged in (`retake whoami` fails)? Ask the person to run `retake login`. Never ask for or type their token.
15
+
16
+ ## After every render
17
+ Save a version as soon as a render finishes, before you show it or start the next change:
18
+
19
+ ```
20
+ retake save -m "<what changed, short>" --prompt "<what the person asked for, in their words>"
21
+ ```
22
+
23
+ - `-m` is the change ("tighter intro, music hard-cuts at 0:44"). `--prompt` is the request that led to it; quote the person closely. Both show on the web next to the video.
24
+ - `save` picks up the newest render in the engine's output folder. If you rendered somewhere else, add `--render path/to/file.mp4`.
25
+ - Saved source but rendered afterwards? `retake save --amend` attaches the render to the last unpushed version.
26
+ - Then `retake push`. It prints the page URL; give that link to the person.
27
+ - Projects are **private** unless someone chooses otherwise: only the owner can see them. Never run `retake push --public` (or `init --public`) unless the person asked to share or publish this video in this conversation. `retake push --private` hides it again.
28
+
29
+ Never edit or delete anything inside `.retakes/`.
30
+
31
+ ## Before revising after a review
32
+ Always start with:
33
+
34
+ ```
35
+ retake feedback
36
+ ```
37
+
38
+ Each open note shows:
39
+ - the comment id (`c_…`) and version
40
+ - the timestamp, plus where it lives in the source (HyperFrames: `compositions/s08-features.html @ 1.39s`; Remotion: the frame number)
41
+ - the marked region (x/y as fractions of the frame) and a path to a still with that region boxed. **Open the still and look at it** before changing anything.
42
+
43
+ Fix every note you can, then render. Before saving, check that your change did what the notes asked and nothing else:
44
+
45
+ ```
46
+ retake vdiff
47
+ ```
48
+
49
+ It compares your new render with the last saved one, lists only the shots that changed, and makes images only for those. Open those images; don't re-watch the whole video. Then close the notes in the same save:
50
+
51
+ ```
52
+ retake save -m "<what you fixed>" --prompt "<the notes you addressed>" --resolves c_abc,c_def
53
+ retake push
54
+ ```
55
+
56
+ If a note is unclear or you disagree, don't resolve it; tell the person why.
57
+
58
+ Review incrementally: on the next round, `retake feedback` only lists notes that are still open, and `retake vdiff` only shows what changed since the last take.
59
+
60
+ ## Related skills
61
+ - `retakes-watch`: understand any video (yours or a reference) as images: shots, bursts, beats.
62
+ - `retakes-recreate`: make a video in the style of a reference, with a direction round and cue-sheet approval.
63
+ - `retakes-match`: score your render against a reference, shot by shot, incrementally.
64
+
65
+ ## Comparing and history
66
+ - `retake log` lists versions; `retake diff 3 4 --patch` shows source changes between two.
67
+ - `retake checkout 3` restores a version's source (save or discard current changes first). The next save branches from it.
68
+ - On the web, `<project URL>/compare?a=3&b=4` plays two versions in sync, side by side or as a wipe.
69
+
70
+ ## Building on other videos
71
+ - `retake fork handle/project[@n] [dir]` copies a project to continue it.
72
+ - `retake remix handle/project[@n] [dir]` starts a new video in that one's style. It downloads the reference render and source into `reference/`, builds a watch pack of it, and writes `REMIX.md`. Then follow the `retakes-recreate` skill. Don't copy the reference's logos, footage or copy.
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: retakes-match
3
+ description: Check a render against a reference video, or against your previous take, shot by shot and incrementally, with `retake match` and `retake vdiff`. Scores layout, motion, color and timing per shot and makes side-by-side images only for shots that fail or changed since the last check, so repeated reviews stay cheap. Use after rendering a recreation or remix, after fixing review notes, or whenever you need to know "how close is this" or "what did my change actually change".
4
+ ---
5
+
6
+ # Checking your render: `retake match` and `retake vdiff`
7
+
8
+ Don't re-watch the whole video after every change. Both commands work out what's different and show you only that.
9
+
10
+ ## Against a reference: `retake match <reference> [yours]`
11
+ `<reference>` and `[yours]` can each be:
12
+ - a file;
13
+ - `v3`;
14
+ - `handle/project[@n]`;
15
+ - a URL.
16
+
17
+ `[yours]` defaults to the newest render in this project.
18
+
19
+ The reference's shots are paired with yours, which handles added, dropped and split shots. Each pair is scored from 0 to 1:
20
+
21
+ | score | measures | if it's low |
22
+ | --- | --- | --- |
23
+ | **timing** | shot length vs the reference | Change the shot's start/duration. `Δlength` tells you by how much. |
24
+ | **motion** | how much it moves, and when within the shot | Wrong easing, wrong amount of travel, or movement starting late or early. Compare the bursts (`retake watch` on both). |
25
+ | **color** | palette distance | Background or accent colour is off, or the grading is too dark or light. |
26
+ | **layout** | where light and dark masses sit (composition) | Elements are in the wrong place or at the wrong scale. For a remix with new content this can be low and still fine. |
27
+
28
+ `MATCH.md` lists "Look at these first", worst first. Each entry has a pair image: the top row is the reference, the bottom row is yours, at the same relative moments.
29
+ - Open only those images.
30
+ - Fix the worst shots first, render, `retake save`, then run `retake match` again.
31
+ - Shots you didn't touch come back as **unchanged** with their previous score and no new image.
32
+
33
+ Also listed:
34
+ - **Missing**: shots in the reference that you don't have.
35
+ - **Extra**: shots you have that the reference doesn't.
36
+
37
+ ## Between your own takes: `retake vdiff [a] [b]`
38
+ With no arguments it compares your newest render with the one before. Use it:
39
+ - after fixing review notes, to confirm you changed the right shots and nothing else;
40
+ - before pushing, to describe what changed.
41
+
42
+ Each shot is reported as:
43
+ - **changed**: the picture is different;
44
+ - **retimed**: the length changed;
45
+ - **shifted**: it only moved in time, because something earlier changed length;
46
+ - **added** or **removed**.
47
+
48
+ HyperFrames projects name the scene file. Images are made only for changed shots.
49
+
50
+ ## Budget rules
51
+ - Read the text report first. Open an image only when the report says that shot needs it.
52
+ - Never open pair images for shots marked `ok`, `unchanged`, `same` or `shifted`.
53
+ - If a single shot keeps failing, `retake watch` the reference and read that shot's burst rather than more pair images.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: retakes-recreate
3
+ description: Recreate a reference video at high quality: same pacing, cuts, motion and look, either as a close copy or in the same style with a new subject, brand and copy. Asks the person a short set of direction questions, studies the reference with `retake watch`, gets the cue sheet approved, builds, then checks against the reference with `retake match`, fixing only the shots that fail. Use when someone shares a video and says "make one like this", "remake", "recreate", "same style for my product", "remix", or runs `retake remix`.
4
+ ---
5
+
6
+ # Recreating a reference video
7
+
8
+ The quality bar is the reference itself. Measure it, agree the plan with the person, build to the measurements, and check your render against it shot by shot. Use the `retakes-watch` and `retakes-match` skills along the way.
9
+
10
+ ## 1. Ask for direction first (one round)
11
+ Ask everything in one go. Use your question tool if you have one (multiple choice, recommended option first); otherwise ask in one short message. Skip anything the person already told you.
12
+
13
+ 1. **Goal:** a close copy of this video, the same style with a new subject, or loose inspiration?
14
+ 2. **Keep:** which of these should match the reference?
15
+ - pacing and cut timing
16
+ - transitions and motion
17
+ - typography
18
+ - palette
19
+ - music feel and beat sync
20
+ - story structure
21
+ 3. **Swap in:** their product or brand, copy, footage or screenshots, logo, colours.
22
+ 4. **Format:** length, aspect ratio(s) and resolution. Default to the reference's.
23
+ 5. **Sound:**
24
+ - Voiceover: their script, or one you draft?
25
+ - Music: they supply it, royalty-free, or none?
26
+ - SFX: yes or no?
27
+ 6. **Engine:** HyperFrames by default when available; Remotion or another if they use one.
28
+
29
+ Rights: never reuse someone else's logos, footage, music, voice or exact copy unless the person says they own it. Match the craft, not the assets.
30
+
31
+ ## 2. Study the reference
32
+ ```
33
+ retake watch <reference>
34
+ ```
35
+ - Read `WATCH.md`, `timeline.png` and `overview.jpg`.
36
+ - Then read the scene strips and bursts for every shot you'll build.
37
+ - Fill the pack's `cuesheet.md`: on screen, text, motion notes, sound per shot.
38
+ - Note exact durations, transition lengths in frames, easing seen in the bursts, where cuts sit on beats, the palette hexes and the type style.
39
+
40
+ ## 3. Get the cue sheet approved
41
+ Show the person the plan, written for their version:
42
+ - the cue sheet with their subject swapped in;
43
+ - the timings you'll hit;
44
+ - the audio plan;
45
+ - anything you can't match and why.
46
+
47
+ Wait for a yes or edits before building. This is the one checkpoint; after it, build without stopping.
48
+
49
+ ## 4. Build to the measurements
50
+ - Set every shot's start and length from the cue sheet, to the frame.
51
+ - Copy transition lengths and easing from the bursts. For example, if the burst shows an element covering ~70% of its travel in the first 4 frames, that's a strong ease-out.
52
+ - Put cuts and hits where the reference has them relative to the beat. If you have different music, re-derive the beats from your track.
53
+ - Use the reference's palette roles (background, accent, text) with the person's colours swapped in, if they asked for their brand.
54
+
55
+ ## 5. Render, save, compare
56
+ ```
57
+ retake save -m "<what this take is>" --prompt "<the person's request>"
58
+ retake match <reference>
59
+ ```
60
+ - `MATCH.md` scores each shot on layout, motion, color and timing, and lists the ones to look at, worst first, with side-by-side images (top: reference, bottom: yours).
61
+ - Fix those shots only, render, `retake save`, then `retake match` again. Shots that haven't changed since the last check are skipped and get no new images. That's what keeps each pass cheap.
62
+ - To confirm a fix touched only what you meant to, run `retake vdiff`. It shows only the shots that changed since the previous take.
63
+
64
+ When to stop:
65
+ - **Close copy:** overall ≥ 0.85, no shot under 0.7.
66
+ - **New subject in the same style:** timing and motion ≥ 0.8 per shot. Layout and colour can differ by design.
67
+ - **Or after 3 fix passes:** report what's still off and why.
68
+
69
+ ## 6. Hand over
70
+ `retake push`, then give the person:
71
+ - the link;
72
+ - the match score;
73
+ - what deliberately differs from the reference;
74
+ - anything left to decide.
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: retakes-watch
3
+ description: Understand a video when you can only see images. Turns any video (a file, a URL, a Retakes project, your own render) into a watch pack — timeline strip, overview sheet, one strip per shot, every-frame bursts of transitions, shot list with cut types and palettes, tempo/beats/hits/loudness — with `retake watch`. Use whenever you need to know what happens in a video, how it's paced, how things move, or exactly when something occurs, before describing, recreating, reviewing or editing it.
4
+ ---
5
+
6
+ # Watching video with `retake watch`
7
+
8
+ You read images well but you can't play a video. Sampling a few frames misses what matters most in motion work: cut timing, easing, overshoot, how text arrives, what lands on the beat. `retake watch` measures those locally (ffmpeg, no API keys) and lays them out as images and tables you can read precisely.
9
+
10
+ ## Make the pack
11
+
12
+ ```
13
+ retake watch <video>
14
+ ```
15
+
16
+ `<video>` can be a file, `v3` (a saved version in this project), `handle/project[@n]` (a Retakes project), or a URL (needs `yt-dlp` installed). It prints the pack folder and reuses it if the video hasn't changed (`--force` rebuilds). Takes seconds.
17
+
18
+ ## Read it cheapest-first (save tokens)
19
+
20
+ 1. **`WATCH.md`** (text): length, size, fps, shot table (start, length, how each shot begins, motion level, palette), bursts list, holds, tempo, beats, hits, loudness.
21
+ 2. **`timeline.png`** (one image): the whole video on one strip.
22
+ - Green: how much the picture moves.
23
+ - Blue: audio energy.
24
+ - Grey ticks: beats. Orange ticks: hits.
25
+ - Red lines: cuts. Amber: transitions.
26
+ - Numbers: shot numbers.
27
+
28
+ From this one image you can see the pacing, where the energy peaks, and whether cuts ride the music.
29
+ 3. **`overview.jpg`** (one image): evenly spaced frames with timestamps. Story, look, typography at a glance.
30
+ 4. **`scenes/sNN.jpg`**: open only the shots you're working on. Each strip runs left to right through one shot.
31
+ 5. **`bursts/bNN.jpg`**: every frame through a transition or a fast move, timestamped. Read them to see:
32
+ - easing: how far it moves per frame, where it slows;
33
+ - overshoot or settle;
34
+ - motion blur;
35
+ - the exact frame something appears.
36
+
37
+ Stop reading once you can answer the question. Don't open every strip by default.
38
+
39
+ ## Getting detail
40
+ - Small text, a logo, or a precise layout: pull a single full-resolution frame and look at it.
41
+ ```
42
+ ffmpeg -ss <seconds> -i <video> -frames:v 1 frame.png
43
+ ```
44
+ - A span not covered by a burst: `retake watch` won't make it for you. Use ffmpeg with `select='between(t,a,b)'` and `tile`, or ask for `--bursts 16`.
45
+
46
+ ## What the measurements mean
47
+ - **in**: `cut` is a one-frame switch. `transition (Nf)` is a gradual hand-off over N frames: a dissolve, wipe, morph or animated push. `fade through black/white` passes through a solid colour.
48
+ - **motion**: `still`, `low`, `medium` or `high`, the average change per frame inside the shot. A "still" shot can still contain a slow drift; check the strip.
49
+ - **holds**: stretches where the picture doesn't move (title holds, end cards). They matter for pacing.
50
+ - **cuts on beat**: how many cuts land within two frames of a beat. A high share means it was cut to music.
51
+ - **hits**: sharp sound onsets (impacts, whooshes, drum hits). SFX usually sit on these.
52
+
53
+ ## What it can't tell you
54
+ - What the sound is (voice, words, genre, instruments) and what anyone says. There's a transcript only if openai-whisper is installed locally.
55
+ - If voice or music matters, say what you can infer from the beat and hit pattern, and ask the person for the script or the track.
56
+
57
+ ## Write it down
58
+ Fill `cuesheet.md` in the pack. One row per shot, with the measured columns already done; add:
59
+ - what's on screen;
60
+ - any text;
61
+ - how things move;
62
+ - the sound.
63
+
64
+ That cue sheet is the contract for recreating or editing the video.
@@ -0,0 +1,18 @@
1
+ // Any folder: footage edits, ffmpeg scripts, After Effects exports, other engines.
2
+ // Versions, compare and frame comments all work; there's just no scene map.
3
+ export default {
4
+ id: "generic",
5
+ label: "Any folder",
6
+ detect() {
7
+ return 1;
8
+ },
9
+ ignore: ["renders/", "exports/", "out/"],
10
+ renderDirs: ["renders", "exports", "out", "output"],
11
+ renderHint: null,
12
+ timeline() {
13
+ return [];
14
+ },
15
+ locate() {
16
+ return null;
17
+ },
18
+ };
@@ -0,0 +1,50 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { locateGeneric } from "./locate.js";
4
+
5
+ // HyperFrames: HTML compositions rendered frame by frame. index.html mounts one
6
+ // scene per sub-composition with data-composition-src, data-start and data-duration.
7
+ function attr(tag, name) {
8
+ const m = new RegExp(`\\s${name}\\s*=\\s*"([^"]*)"`, "i").exec(tag);
9
+ return m ? m[1] : null;
10
+ }
11
+
12
+ export function parseScenes(indexHtml) {
13
+ if (!indexHtml) return [];
14
+ const scenes = [];
15
+ for (const m of indexHtml.matchAll(/<[a-z][^>]*\sdata-composition-src\s*=\s*"[^"]*"[^>]*>/gi)) {
16
+ const tag = m[0];
17
+ const start = Number(attr(tag, "data-start"));
18
+ const duration = Number(attr(tag, "data-duration"));
19
+ if (!Number.isFinite(start) || !Number.isFinite(duration)) continue;
20
+ scenes.push({
21
+ id: attr(tag, "data-composition-id") || attr(tag, "id") || attr(tag, "data-composition-src"),
22
+ file: attr(tag, "data-composition-src"),
23
+ start,
24
+ duration,
25
+ });
26
+ }
27
+ return scenes.sort((a, b) => a.start - b.start);
28
+ }
29
+
30
+ export default {
31
+ id: "hyperframes",
32
+ label: "HyperFrames",
33
+ detect(root) {
34
+ if (fs.existsSync(path.join(root, "hyperframes.json"))) return 100;
35
+ try {
36
+ const html = fs.readFileSync(path.join(root, "index.html"), "utf8");
37
+ if (/data-composition-id/.test(html)) return 80;
38
+ } catch {
39
+ /* not HyperFrames */
40
+ }
41
+ return 0;
42
+ },
43
+ ignore: [".hyperframes/", ".thumbnails/", ".waveform-cache/", "renders/", "snapshots/"],
44
+ renderDirs: ["renders"],
45
+ renderHint: "npx hyperframes render --output renders/<name>.mp4",
46
+ timeline(readFile) {
47
+ return parseScenes(readFile("index.html"));
48
+ },
49
+ locate: locateGeneric,
50
+ };
@@ -0,0 +1,61 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { fail } from "../util.js";
4
+ import { VIDEO_EXT } from "../media.js";
5
+ import hyperframes from "./hyperframes.js";
6
+ import remotion from "./remotion.js";
7
+ import generic from "./generic.js";
8
+
9
+ // An adapter teaches Retakes one video engine. Everything is optional except id/label/detect.
10
+ // detect(root) → score 0..100 (highest wins)
11
+ // ignore → extra ignore patterns (caches, render output folders)
12
+ // renderDirs → where finished renders land
13
+ // renderHint → the command that makes a render, shown to people and agents
14
+ // timeline(readFile) → [{ id, file, start, duration }] scenes, sent with each version
15
+ // locate(timeline, t) → where a timestamp lives in the source (scene file + local time)
16
+ export const ADAPTERS = [hyperframes, remotion, generic];
17
+
18
+ export function getAdapter(id) {
19
+ const a = ADAPTERS.find((x) => x.id === id);
20
+ if (!a) fail(`Unknown engine "${id}". Known: ${ADAPTERS.map((x) => x.id).join(", ")}`);
21
+ return a;
22
+ }
23
+
24
+ export function detectAdapter(root) {
25
+ let best = generic;
26
+ let score = 0;
27
+ for (const a of ADAPTERS) {
28
+ const s = a.detect(root);
29
+ if (s > score) {
30
+ best = a;
31
+ score = s;
32
+ }
33
+ }
34
+ return best;
35
+ }
36
+
37
+ function newestVideo(dir, depth, out) {
38
+ let entries;
39
+ try {
40
+ entries = fs.readdirSync(dir, { withFileTypes: true });
41
+ } catch {
42
+ return;
43
+ }
44
+ for (const e of entries) {
45
+ const p = path.join(dir, e.name);
46
+ if (e.isDirectory()) {
47
+ if (depth > 0 && e.name !== "node_modules" && !e.name.startsWith(".")) newestVideo(p, depth - 1, out);
48
+ } else if (e.isFile() && VIDEO_EXT.includes(path.extname(e.name).toLowerCase())) {
49
+ const st = fs.statSync(p);
50
+ if (!out.best || st.mtimeMs > out.best.mtimeMs) out.best = { path: p, mtimeMs: st.mtimeMs, size: st.size };
51
+ }
52
+ }
53
+ }
54
+
55
+ // The newest video file in the engine's render folders (or the project root as a last resort).
56
+ export function findRender(root, adapter) {
57
+ const out = {};
58
+ for (const d of adapter.renderDirs ?? []) newestVideo(path.join(root, d), 3, out);
59
+ if (!out.best) newestVideo(root, 0, out);
60
+ return out.best ?? null;
61
+ }
@@ -0,0 +1,7 @@
1
+ // Find the scene that covers time t in a [{ id, file, start, duration }] timeline.
2
+ export function locateGeneric(timeline, t) {
3
+ if (!Array.isArray(timeline)) return null;
4
+ const hit = timeline.find((s) => t >= s.start && t < s.start + s.duration);
5
+ if (!hit) return null;
6
+ return { scene: hit.id, file: hit.file ?? null, local: Math.round((t - hit.start) * 1000) / 1000 };
7
+ }
@@ -0,0 +1,28 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+
4
+ // Remotion: React compositions. Scene boundaries live in JSX, so comments map to a
5
+ // frame number; agents find the <Sequence> that covers it.
6
+ export default {
7
+ id: "remotion",
8
+ label: "Remotion",
9
+ detect(root) {
10
+ try {
11
+ const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
12
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
13
+ if (deps.remotion || deps["@remotion/cli"]) return 90;
14
+ } catch {
15
+ /* not Remotion */
16
+ }
17
+ return 0;
18
+ },
19
+ ignore: ["out/", "build/", ".remotion/"],
20
+ renderDirs: ["out"],
21
+ renderHint: "npx remotion render <composition-id> out/video.mp4",
22
+ timeline() {
23
+ return [];
24
+ },
25
+ locate(_timeline, t, fps) {
26
+ return fps ? { frame: Math.round(t * fps), scene: null, file: null } : null;
27
+ },
28
+ };
package/src/brand.js ADDED
@@ -0,0 +1,12 @@
1
+ // Every user-facing name lives here, so renaming the product is one edit.
2
+ export const BRAND = {
3
+ name: "Retakes",
4
+ bin: "retake",
5
+ dir: ".retakes",
6
+ ignoreFile: ".retakesignore",
7
+ configHome: "retakes",
8
+ tokenEnv: "RETAKES_TOKEN",
9
+ remoteEnv: "RETAKES_REMOTE",
10
+ defaultRemote: "https://retakes.simonamable.workers.dev",
11
+ skillName: "retakes",
12
+ };