Skip to content

Text to motion graphics for Claude Code and Codex: write a brief, get a checked MP4. 30 art forms from claymation and paper cut-out to anime and pixel art, 2D explainers, Shorts, 3D products. Installs brief2motion for websites. MIT.

feat: ArtCraft edit pack, audit fixes, verified examples 05-06

Varun Pratap Bhardwaj16ca21479d7f
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 3d0a467..7440be3 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -22,6 +22,7 @@ jobs:
CLAUDE_CONFIG_DIR: ${{ github.workspace }}/.tmp/claude
CODEX_HOME: ${{ github.workspace }}/.tmp/codex
B2M3D_HOME: ${{ github.workspace }}/.tmp/b2m3d
+ B2M_EDIT_HOME: ${{ github.workspace }}/.tmp/edit
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
@@ -53,7 +54,29 @@ jobs:
run: bash plugin/skills/brief2mp4/scripts/doctor.sh
- name: Detect 3D pack
- run: bash plugin/skills/brief2mp4/scripts/detect_3d.sh
+ run: |
+ bash plugin/skills/brief2mp4/scripts/detect_3d.sh | tee /dev/stderr | grep -q "3d: ready"
+
+ - name: Install the edit pack, film + sound (bash)
+ if: runner.os != 'Windows'
+ run: bash plugin/skills/brief2mp4/edit/install_edit.sh --components film,sound
+
+ - name: Install the edit pack, film + sound (PowerShell)
+ if: runner.os == 'Windows'
+ shell: pwsh
+ run: ./plugin/skills/brief2mp4/edit/install_edit.ps1 -Components film,sound
+
+ - name: Detect edit pack
+ run: |
+ bash plugin/skills/brief2mp4/scripts/detect_edit.sh | tee /dev/stderr | grep -q "edit: ready"
+
+ - name: Edit recipes (FilmCraft cut, SoundCraft mix)
+ run: |
+ mkdir -p .tmp/out
+ bash plugin/skills/brief2mp4/edit/recipes/film_timeline.sh --out .tmp/out/cut.mp4
+ bash plugin/skills/brief2mp4/edit/recipes/sound_mix.sh --out .tmp/out/mix.wav
+ bash plugin/skills/brief2mp4/scripts/finish.sh --in .tmp/out/cut.mp4 --out .tmp/out/final.mp4 --seconds 5 --size 1280x720 --audio .tmp/out/mix.wav
+ bash plugin/skills/brief2mp4/scripts/check_delivery.sh .tmp/out/final.mp4 --seconds 5 --size 1280x720
- name: Fast tests
- run: bash tests/run_tests.sh
+ run: bash tests/run_tests.sh -rs
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8a42f2a..2a8666f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ All notable changes to brief2mp4. The format follows [Keep a Changelog](https://
### Added
- **Optional 3D pack** (`plugin/skills/brief2mp4/3d/`): CAD and mesh models to GLB, material presets, deterministic Jolt physics bakes, shot JSON to a frame-seekable HyperFrames project, and a Blender hero-render route. Installs per component (`core`, `cad`, `blender`) with `install.sh --with-3d` or `install.ps1 -With3D`. The skill detects it and falls back to the Three.js template when it is missing.
+- **Optional edit pack** (`plugin/skills/brief2mp4/edit/`): installs the command-line tools of five free ArtCraft editors by storytold (FilmCraft, SoundCraft, EffectCraft, PhotoCraft, VectorCraft; Apache-2.0) at pinned versions, on macOS, Windows and Linux. Each download must match both the release's SHA256SUMS.txt and the hash pinned in this repository, and the release signature is verified against a pinned key fingerprint when gpg is present. One tested recipe per app: a timeline cut with a dissolve and title, a voice-over mix with ducking, an animated title, a thumbnail and an SVG lower third. `install.sh --with-edit`, `install.ps1 -WithEdit`, `scripts/detect_edit.sh`, example 07.
- **SETUP.md**: step-by-step instructions an agent follows to set up a machine on macOS, Windows or Linux, ending with a two-minute first render.
- **Windows support**: `install.ps1` (PowerShell 5.1 and 7, optional winget install of Node, ffmpeg and Git), Git Bash guidance in the skill.
- `scripts/doctor.sh` (with `--json`): checks every tool and prints the install command for this OS. `scripts/detect_3d.sh`. `scripts/bounds.py`: measures where content sits in a still and checks margins and safe zones, standard library only. `scripts/vendor_libs.sh`: pinned GSAP, three.js and fonts copied into a project. `sound_bed.sh --ticks` for click accents.
diff --git a/README.md b/README.md
index c643d05..58d541b 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,7 @@
<a href="#what-it-makes">What it makes</a> ·
<a href="#how-it-works">How it works</a> ·
<a href="#the-3d-pack">3D pack</a> ·
+ <a href="#the-edit-pack">Edit pack</a> ·
<a href="#examples">Examples</a> ·
<a href="#write-a-brief">Write a brief</a> ·
<a href="docs/README.md">Docs</a> ·
@@ -53,7 +54,7 @@ The agent detects your OS, asks before installing Node, ffmpeg (and Git Bash on
| macOS / Linux / WSL (both apps) | `git clone https://github.com/qualixar/brief2mp4.git && bash brief2mp4/install.sh` |
| Windows PowerShell (both apps) | `git clone https://github.com/qualixar/brief2mp4.git; powershell -ExecutionPolicy Bypass -File .\brief2mp4\install.ps1 -InstallTools` |
-Add the 3D pack with `--with-3d` (macOS/Linux) or `-With3D core` (Windows). Plugins install the skill only, so on a fresh machine also install the tools below. Start a new session after installing so the app loads the skill.
+Add the 3D pack with `--with-3d` (macOS/Linux) or `-With3D core` (Windows), and the edit pack with `--with-edit` or `-WithEdit film,sound`. Plugins install the skill only, so on a fresh machine also install the tools below. Start a new session after installing so the app loads the skill.
**Then make a video.** In a folder for the video:
@@ -101,7 +102,7 @@ Round 4 of the video: Fable 5.2 in Claude Code got a written brief for a 60-seco
| **Photoreal shots** | glass, metal, soft shadows | Blender |
<p align="center">
- <img src="assets/example05-explainer.png" alt="Example 05, a 2D explainer made by the skill: the hook question, the cache diagram mid-count at 626 ms, three labels, and the closing line Keep a copy close." width="49%">
+ <img src="assets/example05-explainer.png" alt="Example 05, a 2D explainer made by the skill: the hook question, the cache diagram mid-count at 652 ms, three labels, and the closing line Keep a copy close." width="49%">
<img src="assets/example06-short.png" alt="Example 06, a vertical Short made by the skill: four phone frames with the hook, rule one with an easing dot, rule three with a spinning dot, and Save this." width="49%">
</p>
@@ -161,6 +162,33 @@ powershell -ExecutionPolicy Bypass -File .\install.ps1 -With3D core,cad
The brief does the asking. "Parts fall and settle" becomes a physics bake with a camera that frames the landing zone; "show what's inside" becomes an exploded view; "hero product" becomes a Blender render with a dramatic light rig. The full mapping, the shot JSON and the look rules are in [3d/README-3D.md](plugin/skills/brief2mp4/3d/README-3D.md).
+## The edit pack
+
+Motion graphics are half of a video. The other half is editing: cutting your screen recording or footage on a timeline, mixing a voiceover over music so the music ducks when you speak, compositing titles, making the thumbnail. The optional edit pack installs the command-line tools of five free, open-source desktop editors, the ArtCraft apps by [storytold](https://github.com/storytold) (Apache-2.0), so Claude Code or Codex can do that work too, headless, and hand the result to the same checks.
+
+<p align="center">
+ <img src="assets/edit-pack-recipes.png" alt="Output of the four edit-pack recipes: a FilmCraft timeline mid cross-dissolve, an EffectCraft animated title, a PhotoCraft thumbnail reading Cut faster, and a VectorCraft lower third" width="720">
+</p>
+
+| Component | App | Like | The agent uses it for | Tested recipe |
+|---|---|---|---|---|
+| `film` | [FilmCraft](https://github.com/storytold/filmcraft) 0.20.1 | Premiere | cutting clips on a timeline, transitions, titles, export | `film_timeline.sh` |
+| `sound` | [SoundCraft](https://github.com/storytold/soundcraft) 0.20.1 | a DAW | voice + music mix, ducking with automation, bounce | `sound_mix.sh` |
+| `effect` | [EffectCraft](https://github.com/storytold/effectcraft) 0.24.1 | After Effects | layered, keyframed compositing and titles | `effect_title.sh` |
+| `photo` | [PhotoCraft](https://github.com/storytold/photocraft) 0.23.1 | Photoshop | thumbnails, title cards | `photo_thumbnail.sh` |
+| `vector` | [VectorCraft](https://github.com/storytold/vectorcraft) 0.24.1 | Illustrator | logos and lower thirds as SVG | `vector_lower_third.sh` |
+
+```bash
+bash install.sh --with-edit # film + sound
+bash install.sh --with-edit=film,sound,effect,photo,vector # all five, about 420 MB download on macOS
+```
+
+```powershell
+powershell -ExecutionPolicy Bypass -File .\install.ps1 -WithEdit film,sound
+```
+
+Every download is checked before anything is unpacked: its SHA-256 must match both the release's `SHA256SUMS.txt` and the hash pinned in this repository, and when `gpg` is installed the release signature must verify against the pinned signing-key fingerprint. Versions are pinned because these apps are alpha and move fast; the skill tells the agent to look up each app's real commands (`<app>-cli commands`) before using one a recipe does not cover. Details, sizes per platform and uninstall: [edit/README-EDIT.md](plugin/skills/brief2mp4/edit/README-EDIT.md).
+
## Examples
| # | Brief | Route | Length |
@@ -171,6 +199,7 @@ The brief does the asking. "Parts fall and settle" becomes a physics bake with a
| 04 | [3D product](examples/04-3d-product/BRIEF.md): parts drop and settle, explode, title | 3D pack | 8 s |
| 05 | [2D explainer](examples/05-2d-explainer/BRIEF.md): "How a cache works" | HyperFrames | 20 s |
| 06 | [Vertical Short](examples/06-vertical-short/BRIEF.md): "3 easing rules", 1080x1920 with safe zones | HyperFrames | 15 s |
+| 07 | [Edited tutorial](examples/07-edit-tutorial/BRIEF.md): two clips cut together with a title and a ducked voice-over mix | edit pack + HyperFrames | 14 s |
## Write a brief
@@ -238,6 +267,7 @@ plugin/
scripts/ finish, check_delivery, contact_sheet, sound_bed, doctor, detect_3d
templates/ SPEC.md, a Three.js scene, a Blender turntable
3d/ the optional 3D pack and its installers
+ edit/ the optional edit pack: verified installers, pinned versions, recipes
docs/ getting started, architecture, 3D walkthrough
examples/ six briefs; 01, 04, 05 and 06 with sample reports or a worked build
tests/ fast checks and render tests (bash tests/run_tests.sh [--slow])
@@ -249,6 +279,6 @@ Bad results are the most useful bug reports: open a **Brief result** issue with
## Licence
-MIT. Use it, change it, ship videos with it. HyperFrames (Apache-2.0), Three.js (MIT), GSAP (standard no-charge licence), Jolt (MIT), glTF-Transform (MIT), meshoptimizer (MIT), Manifold (Apache-2.0), CadQuery (Apache-2.0), trimesh (MIT), Blender (GPL) and ffmpeg (LGPL/GPL) keep their own licences; this repo does not bundle them.
+MIT. Use it, change it, ship videos with it. HyperFrames (Apache-2.0), Three.js (MIT), GSAP (standard no-charge licence), Jolt (MIT), glTF-Transform (MIT), meshoptimizer (MIT), Manifold (Apache-2.0), CadQuery (Apache-2.0), trimesh (MIT), Blender (GPL), ffmpeg (LGPL/GPL) and the ArtCraft apps by storytold (Apache-2.0, downloaded from their own releases by the edit pack) keep their own licences; this repo does not bundle them.
Made by [Varun Pratap Bhardwaj](https://github.com/qualixar).
diff --git a/SETUP.md b/SETUP.md
index 2b10f8e..bcd15d3 100644
--- a/SETUP.md
+++ b/SETUP.md
@@ -72,6 +72,8 @@ powershell -ExecutionPolicy Bypass -File .\install.ps1 -With3D core,cad
Install the 3D pack only when the user wants 3D products, physics, exploded views or turntables. Everything else works without it. The pack is described in `plugin/skills/brief2mp4/3d/README-3D.md`.
+Install the edit pack when the user edits real footage or recordings, mixes voice-over with music, or wants thumbnails and lower thirds made by the agent: `bash install.sh --with-edit` (FilmCraft and SoundCraft; `--with-edit=film,sound,effect,photo,vector` for all five) or `install.ps1 -WithEdit film,sound`. It downloads the free ArtCraft editors' command-line tools from their GitHub releases and checks each file's SHA-256 and signature before unpacking. Details: `plugin/skills/brief2mp4/edit/README-EDIT.md`.
+
The user may prefer the plugin route instead of the script. Then they run, inside Claude Code: `/plugin marketplace add qualixar/brief2mp4` and `/plugin install brief2mp4@brief2mp4`; in a terminal for Codex: `codex plugin marketplace add qualixar/brief2mp4` and `codex plugin add brief2mp4@brief2mp4`. Plugins do not install system tools, so Step 2 still applies.
## Step 4. Check the machine
diff --git a/assets/architecture.png b/assets/architecture.png
index 0f3b1e2..88a7b67 100644
Binary files a/assets/architecture.png and b/assets/architecture.png differ
diff --git a/assets/edit-pack-recipes.png b/assets/edit-pack-recipes.png
new file mode 100644
index 0000000..b6d4cf5
Binary files /dev/null and b/assets/edit-pack-recipes.png differ
diff --git a/assets/example05-explainer.png b/assets/example05-explainer.png
index da00f4b..7dbf55c 100644
Binary files a/assets/example05-explainer.png and b/assets/example05-explainer.png differ
diff --git a/assets/example06-short.png b/assets/example06-short.png
index dd91c7d..2d56686 100644
Binary files a/assets/example06-short.png and b/assets/example06-short.png differ
diff --git a/docs/architecture.md b/docs/architecture.md
index acd872b..105f792 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -108,6 +108,7 @@ Every subcommand prints one JSON object, so an agent reads results instead of pa
| `scripts/doctor.sh`, `detect_3d.sh` | What is installed, and the fix for what is not |
| `templates/` | Starting points that already render: SPEC.md, a Three.js scene, a Blender turntable |
| `3d/` | The optional pack: `b2m3d` CLI, shot runtime, material presets, installers |
+| `edit/` | The optional edit pack: verified installers for the ArtCraft editors' CLIs, pinned versions, one tested recipe per app |
| `SETUP.md` | Machine setup an agent follows, per OS |
| `tests/` | Determinism, generation, detection and render tests; CI on macOS, Windows and Ubuntu |
diff --git a/docs/diagrams/architecture.html b/docs/diagrams/architecture.html
index 31c49ee..6c6cf24 100644
--- a/docs/diagrams/architecture.html
+++ b/docs/diagrams/architecture.html
@@ -14,7 +14,7 @@ h1 span{color:var(--acc)}
.t{font:700 22px 'Space Grotesk';margin-bottom:6px}
.d{font:400 14.5px/1.42 Inter;color:var(--mute)}
.mono{font:500 13px 'JetBrains Mono';color:var(--ink);background:var(--paper);border-radius:6px;padding:2px 6px;display:inline-block;margin-top:8px}
-.lane{position:absolute;left:18px;right:18px;height:66px;border:1.5px solid var(--line);border-radius:12px;background:#fff;padding:10px 12px}
+.lane{position:absolute;left:18px;right:18px;height:58px;border:1.5px solid var(--line);border-radius:12px;background:#fff;padding:7px 12px}
.lane b{font:600 15.5px Inter;display:block}
.lane i{font:400 13px Inter;color:var(--mute);font-style:normal}
.lane .tag{position:absolute;right:10px;top:10px;font:500 11px 'JetBrains Mono';color:var(--mute)}
@@ -65,10 +65,11 @@ svg{position:absolute;left:0;top:0}
<div class="card" style="left:534px;top:170px;width:350px;height:490px">
<div class="n">3</div><div class="t">Route each beat</div>
<div class="d" style="margin-bottom:8px">Formats guide picks the beat sheet; each beat goes to the tool that fits it.</div>
- <div class="lane" style="top:150px"><span class="tag">2D</span><b>HyperFrames</b><i>type, UI, charts, explainers, Shorts</i></div>
- <div class="lane" style="top:228px"><span class="tag">3D</span><b>Three.js</b><i>stylised 3D, particles, camera moves</i></div>
- <div class="lane opt" style="top:306px"><span class="tag">optional</span><b>3D pack</b><i>CAD parts, materials, physics, explode</i></div>
- <div class="lane opt" style="top:384px"><span class="tag">optional</span><b>Blender</b><i>photoreal products, glass, metal</i></div>
+ <div class="lane" style="top:140px"><span class="tag">2D</span><b>HyperFrames</b><i>type, UI, charts, explainers, Shorts</i></div>
+ <div class="lane" style="top:206px"><span class="tag">3D</span><b>Three.js</b><i>stylised 3D, particles, camera moves</i></div>
+ <div class="lane opt" style="top:272px"><span class="tag">optional</span><b>3D pack</b><i>CAD parts, materials, physics, explode</i></div>
+ <div class="lane opt" style="top:338px"><span class="tag">optional</span><b>Blender</b><i>photoreal products, glass, metal</i></div>
+ <div class="lane opt" style="top:404px"><span class="tag">optional</span><b>Edit pack</b><i>timeline cuts, voice + music mix, thumbnails</i></div>
</div>
<!-- 4 compose -->
<div class="card acc accbg" style="left:924px;top:170px;width:200px;height:490px">
diff --git a/docs/getting-started.md b/docs/getting-started.md
index 466f030..5e40edc 100644
--- a/docs/getting-started.md
+++ b/docs/getting-started.md
@@ -64,7 +64,7 @@ Pick one way per app. Installing both ways gives you two copies of the same skil
| Script, macOS or Linux | `git clone https://github.com/qualixar/brief2mp4.git && bash brief2mp4/install.sh` |
| Script, Windows | clone the repo, then `powershell -ExecutionPolicy Bypass -File .\brief2mp4\install.ps1` |
-Add `--with-3d` (or `-With3D core`) for the 3D pack. See the [3D walkthrough](3d-walkthrough.md) for what it adds.
+Add `--with-3d` (or `-With3D core`) for the 3D pack; see the [3D walkthrough](3d-walkthrough.md). Add `--with-edit` (or `-WithEdit film,sound`) for the edit pack, the ArtCraft timeline editor and audio mixer, when your videos use real footage or a voice-over; see [edit/README-EDIT.md](../plugin/skills/brief2mp4/edit/README-EDIT.md).
## 3. Check the machine
diff --git a/examples/05-2d-explainer/SAMPLE-REPORT.md b/examples/05-2d-explainer/SAMPLE-REPORT.md
new file mode 100644
index 0000000..7e4c635
--- /dev/null
+++ b/examples/05-2d-explainer/SAMPLE-REPORT.md
@@ -0,0 +1,46 @@
+# REPORT: Brief 05, "How a cache works"
+
+Deliverable: `brief05-2d-explainer/final.mp4`. It runs 20.0 s at 1920x1080 and 30 fps, encoded as H.264 yuv420p with AAC 48 kHz stereo.
+
+## Done when, checked against the original brief
+
+| Requirement | Status | Evidence |
+|---|---|---|
+| final.mp4 1920x1080, 30 fps, exactly 20.0 s, H.264 + AAC | met | `check_delivery.sh`: h264, yuv420p, 1920x1080, 30/1, duration 20.000000s, aac 48 kHz stereo, -14.0 LUFS, true peak -1.4 dBTP. Result: PASS |
+| Background #F4F1EA, ink #1B1A17, accent #2F6BFF, grey #B9B4A8, Inter bold headlines and regular labels | met | CSS tokens in `index.html`. Stills show Inter loaded from `vendor/fonts` (the "y" and "a" shapes of Inter, not a fallback face). Accent is used only on the Cache box |
+| Hook "Why is the second visit faster?" types on word by word, 110 px, centred, 0.0 to 3.0 s | met | `font-size:110px` bold. `checks/t_000.00s.png` shows "Why" only; `t_001.50s.png` is mid-sentence; `t_002.50s.png` shows the full line on two rows, ink x 461-1454 (centre 957.5 of 960). Words arrive 0.0, 0.3, 0.6, 0.9, 1.2, 1.5 s; the hook fades out 2.7-3.0 s |
+| 3.0-8.0 s: Browser box, long arrow drawn on to Server box far right, "800 ms" above the arrow | met | `checks/t_006.00s.png`: Browser x 120-479, arrow to x 1428, Server x 1440-1799, "800 ms" centred over the arrow. Build order in the timeline: Browser 3.0 s, Server 3.6 s, arrow draw-on 4.2-5.6 s, label 5.8 s |
+| 8.0-14.0 s: Cache box in accent between them, arrow redrawn to stop at the cache | met | `checks/t_011.00s.png` and `t_013.90s.png`: Cache (accent) at x 780-1139, arrow measured x 492-767 stops 13 px before the cache's left edge |
+| Clock counts down from 800 to 12 and ends on "12 ms" | met | `t_011.00s.png` reads "652 ms" mid-count; `t_013.90s.png` reads "12 ms". Count runs 9.7-13.3 s |
+| 14.0-18.0 s: three 44 px labels appear one by one under the diagram | met | `font-size:44px`. Labels land at 14.2, 15.4 and 16.6 s. `checks/t_015.00s.png` shows the first, `t_016.90s.png` all three. Measured rows: y 570-604, 639-681, 708-750 |
+| 18.0-20.0 s: everything except the cache box fades to grey, "Keep a copy close." lands below, 96 px, still to the end | met | `checks/t_019.50s.png` and `t_019.90s.png`: Browser, Server, arrow, "12 ms" and the three labels are grey, Cache stays blue. Line is `font-size:96px`, ink x 526-1392, y 840-929, below the cache (bottom y 439) and the labels (bottom y 749). It lands 18.2-18.7 s. `freezedetect` reports a freeze from 18.47 s to the end |
+| Sound: quiet bed with soft clicks at 3.0, 8.0 and 14.0 s | met | Level above 1.5 kHz in a 0.1 s window: 2.5 s -17.5 dB, 3.0 s -2.0 dB, 5.0 s -11.6 dB, 8.0 s -3.7 dB, 11.0 s -19.1 dB, 14.0 s -2.3 dB, 16.0 s -16.9 dB. Each click stands 10 dB or more above the bed |
+| Every word spelled exactly | met | Read in `t_002.50s.png` (hook), `t_006.00s.png` (Browser, Server, 800 ms), `t_013.90s.png` (Cache, 12 ms), `t_016.90s.png` (three labels), `t_019.50s.png` (takeaway) |
+| Final number reads "12 ms" | met | `checks/t_013.90s.png`; also `t_016.90s.png` and `t_019.50s.png` |
+| At 13.9 s no text overlaps any box or arrow except a box's own label | met | `scripts/bounds.py` on regions of `t_013.90s.png`: "12 ms" box x 556-702, y 258-300; arrow x 492-767, y 326-353; Browser x 120-479; Cache x 780-1139. The label sits 26 px above the arrow and 77 px right of the Browser box. The three boxes' own labels sit inside them |
+| At 19.5 s no text overlaps any box or arrow except a box's own label | met | `bounds.py` on `t_019.50s.png`: "12 ms" x 557-702, y 259-300, arrow y 326-353, labels y 570-749, takeaway y 840-929, cache y 240-439. All separate rows, no shared pixels |
+| Headlines at least 90 px and labels at least 40 px (CSS font-size) | met | `index.html`: hook 110 px, takeaway 96 px, box labels 56 px, clock 56 px, example labels 44 px |
+| All text inside 96 px side and 54 px top and bottom margins | met | `bounds.py --margin 96,54` on full stills at 0.0, 1.5, 2.5, 6.0, 13.9, 16.9 and 19.5 s: inside = true every time. Widest extent x 120-1799, y 240-929 |
+
+## Decisions
+- The hook sets on two rows ("Why is the second" / "visit faster?"). One row at 110 px bold is about 1,980 px wide, more than the 1,728 px between margins. Words and order are unchanged.
+- "Everything except the cache box fades to the soft grey" is read literally: Browser, Server, arrow, clock and the three labels go grey and stay. The takeaway sits below them.
+- The "800 ms" label glides from over the middle of the long arrow to over the short arrow (8.0-8.4 s) before the Cache box appears, so it never overlaps the Cache box. Server stays in place; only the Browser-to-Cache arrow remains.
+- The first word "Why" is already on screen at frame 0 so the cover frame is not empty; the other five arrive one by one.
+- Quiet is read as a soft pad at the skill's -14 LUFS default. The clicks are 2.4 kHz ticks.
+
+## Render settings
+- Vendor: `vendor_libs.sh . --fonts inter` (GSAP 3.15.0, Inter 400 and 700). `index.html` has no http references, no `Math.random` and no `Date.now`.
+- Picture: `npx hyperframes render . -o render.mp4 --quality delivery --fps 30 --workers 4`, which rendered in 8.2 s.
+- Sound: `sound_bed.sh bed.wav --seconds 20 --ticks 3.0,8.0,14.0`. This run used a patched copy; the fix (clamping the exponent) is now in the shipped `sound_bed.sh`, which also refuses to report success on a silent result.
+- Finish: `finish.sh --in render.mp4 --out final.mp4 --seconds 20 --audio bed.wav` (CRF 18, AAC 192k).
+
+## Fix rounds: 1
+- Round 1: the first finished file measured -70 LUFS (silent) although `sound_bed.sh` printed success. With `--ticks` later than about 7.8 s the aevalsrc expression overflows (`exp(-90*(t-k))` at t=0 is infinite, times the zero gate is NaN) and the whole bed goes silent. I clamped the exponent in a local copy (`exp(-90*max(t-k,0))`), rebuilt the bed and finished again. `check_delivery.sh` then read -14.0 LUFS. This run found the bug; the clamp is now in the shipped `sound_bed.sh`, `sound_bed.sh` now fails on a silent result, and `check_delivery.sh` now FAILs a silent soundtrack unless `--silent-ok` is passed.
+- Before the first full render, `hyperframes check` showed that `tl.set(..., 0)` hidden states are not applied at frame 0 and that frame 0 was empty. Initial states moved to CSS, first word visible at 0.0 s.
+
+## Open
+- `check_delivery.sh` WARNs about 3 frozen stretches (5.9-8.4 s, 10.4-14.3 s, 18.5-20.0 s). They are the intended holds. The count-down changes only digits inside the label, which is below `freezedetect`'s noise threshold, so the second stretch contains the count-down.
+- `hyperframes check` reports contrast 1.83:1 on the grey (#B9B4A8 on #F4F1EA) for the final fade. The brief names that colour, so it stays.
+- `hyperframes check` says the closing line is on screen 1.5 s and suggests 2 s. The brief gives the final beat 2.0 s and the line must land inside it, so the brief wins.
+- Lint warns three times that nested elements want sub-compositions. This is an editor-organisation hint with no effect on the render.
diff --git a/examples/06-vertical-short/SAMPLE-REPORT.md b/examples/06-vertical-short/SAMPLE-REPORT.md
new file mode 100644
index 0000000..d273466
--- /dev/null
+++ b/examples/06-vertical-short/SAMPLE-REPORT.md
@@ -0,0 +1,44 @@
+# REPORT: Brief 06, "3 easing rules"
+
+Deliverable: `brief06-vertical-short/final.mp4`. It runs 15.0 s at 1080x1920 and 30 fps, encoded as H.264 yuv420p with AAC 48 kHz stereo.
+
+## Done when, checked against the original brief
+
+| Requirement | Status | Evidence |
+|---|---|---|
+| final.mp4 1080x1920, 30 fps, exactly 15.0 s, H.264 + AAC | met | `check_delivery.sh --size 1080x1920`: h264, yuv420p, 1080x1920, 30/1, duration 15.000000s, aac 48 kHz stereo, -14.0 LUFS, true peak -1.5 dBTP. Result: PASS |
+| Background #101114, text #F7F5F0, accent #FFB224, Space Grotesk Bold | met | CSS tokens in `index.html`. Stills show Space Grotesk loaded from `vendor/fonts` (its flagged "1" and open "y" in `t_005.50s.png`, `t_003.00s.png`), not a fallback face |
+| Every line spelled exactly | met | Read in `checks/t_001.00s.png` ("Your animations feel cheap?", set on three rows), `t_003.00s.png` ("3 rules." / "15 seconds."), `t_005.50s.png`, `t_008.50s.png`, `t_011.50s.png` (rules 1 to 3, one row each) and `t_014.50s.png` ("Save this.") |
+| First frame (0.0 s) already shows the hook text, and it is moving | met | `checks/t_000.00s.png` shows the full hook (ink x 206-743, y 655-957). `t_000.10s.png` differs: y 651-953, so it has drifted 4 px up in 0.1 s (power2.out drift from t = 0) |
+| Hook at 96 px, "3 rules. 15 seconds." at 80 px, "Save this." at 120 px | met | `index.html`: `#t1` 96 px, `#t2` 80 px, `#t6` 120 px. Rules are 60 px (the brief gives no size) |
+| Stills at 1.0, 3.0, 5.5, 8.5, 11.5, 14.5 s: all text and the dot inside the safe box | met | `bounds.py --safe top=288,bottom=672,left=64,right=192`, inside = true on every one. Boxes: 1.0 s x 206-743, y 629-931; 3.0 s x 250-698, y 694-843; 5.5 s x 193-756, y 543-787; 8.5 s x 222-771, y 543-787; 11.5 s x 148-802, y 543-787; 14.5 s x 199-750, y 723-810. Also true at 0.0 s, 4.3 s, 8.6 s (dot right edge x 885 of the 887 limit) and 14.9 s |
+| Every line at most 824 px wide, centred in the box | met | Ink widths (`bounds.py` per line): hook rows 204, 504, 538; "3 rules." block 449; rule lines 564, 508, 655; "Save this." 552. Widest is 655. Ink centres fall at x 474.5-475 against the box centre 476 |
+| Rule 1 eases out: at 4.6 s the dot has covered more than half | met | `t_004.60s.png`: dot centre x 398.5. Start centre 86, rest centre 475.5, so it has covered 312.5 of 389.5 px = 80 % (power3.out at one third of the way predicts 80 %) |
+| Rule 2 eases in: at 7.8 s the dot has covered less than a fifth | met | `t_007.80s.png`: dot centre x 480.5, rest 475.5, end 865.5. It has covered 5 of 390 px = 1.3 % (power3.in at one third predicts 1.2 %) |
+| Rule 3 is linear: 10.5, 11.0 and 11.5 s show the same 90 degree step (within 5) | met | Dot centres (orbit centre 475.5, 767.5): 10.5 s (555.5, 767.5), 11.0 s (475.5, 847.5), 11.5 s (395.5, 767.5). Angles 0.0, 90.0, 180.0 degrees: each step 90.0. Orbit radius 80 px (a 160 px circle) |
+| "Save this." fully on screen and unmoving from 13.3 s to 15.0 s | met | Ink box x 199-750, y 723-810 at 13.3, 14.0, 14.5 and 14.9 s, identical to the pixel. `freezedetect` reports a freeze from 13.13 s to the end. Fully on screen at 13.3 s (`t_013.30s.png`) |
+| Captions: none | met | No caption layer in `index.html`; the only text is the six lines |
+| Sound: quiet bed with a tick at 2.0, 4.0, 7.0, 10.0, 13.0 s | met | Level above 1.5 kHz in a 0.1 s window: 1.5 s -35.8 dB, 2.0 s -3.8, 3.0 s -37.9, 4.0 s -2.6, 5.5 s -21.1, 7.0 s -2.7, 8.5 s -14.0, 10.0 s -3.7, 11.5 s -11.9, 13.0 s -4.0, 14.0 s -21.2. Each tick is 10 dB or more above the bed around it |
+
+## Decisions
+- The hook sets on three rows and "3 rules. 15 seconds." on two. One row each would be about 1,400 and 930 px wide, over the 824 px limit. The words and punctuation are unchanged.
+- The dot starts with its left edge at x 66 and ends with its right edge at x 886, 2 px inside the safe box, so antialiasing never touches the zone line. Both moves are 390 px.
+- "A 160 px circle" is read as diameter 160 (radius 80), centred on the box centre (476, 768), clockwise, starting at the top at 10.0 s. No guide ring is drawn, so a still holds only text and the dot.
+- The dot is off screen from 8.7 s to 10.0 s; it fades in at the top of the orbit at 10.0 s and fades out at 12.9 s.
+- Rule lines are 60 px and sit above the dot lane (ink y 543-597); the dot stays at y 748-787 in all three rules.
+- Quiet is read as the skill's -14 LUFS default with a soft pad and 2.4 kHz ticks. GSAP's `power3` is a quartic curve, which is what the brief's one-third thresholds assume (80 % and 1.2 %).
+
+## Render settings
+- Vendor: `vendor_libs.sh . --fonts space-grotesk` (GSAP 3.15.0, Space Grotesk 400 and 700). `index.html` has no http references, no `Math.random` and no `Date.now`.
+- Picture: `npx hyperframes render . -o render.mp4 --quality delivery --fps 30 --workers 4`, which rendered in 5.8 s.
+- Sound: `sound_bed.sh bed.wav --seconds 15 --ticks 2,4,7,10,13`. This run used a patched copy; the fix (clamping the exponent) is now in the shipped `sound_bed.sh`, which also refuses to report success on a silent result.
+- Finish: `finish.sh --in render.mp4 --out final.mp4 --seconds 15 --size 1080x1920 --audio bed.wav` (CRF 18, AAC 192k).
+
+## Fix rounds: 0 after the first full render
+- Before rendering I had already met the same sound-bed fault as in Brief 05: with `--ticks` later than about 7.8 s, `sound_bed.sh` writes a silent file. I used a clamped copy from the start, so the first finished file had a real soundtrack. That fix is now in the shipped script.
+- The first snapshot used two-row rule lines at 64 px. I changed them to one row at 60 px before the full render, so each line reads as one string.
+
+## Open
+- `check_delivery.sh` WARNs about 5 frozen stretches (2.2-3.9 s, 4.2-6.9 s, 7.2-10.0 s, 10.2-12.9 s, 13.1-15.0 s). These are the held beats; the dot's small motion is below the whole-frame noise threshold. The last one is the hold the brief asks for.
+- `hyperframes check` says the closing line "Save this." is on screen 1.93 s and suggests 2 s. The brief gives the last beat 2.0 s and has the line land by 13.3 s, so the brief wins.
+- The screen is sparse by design: all content sits in the upper-middle of the safe box because the brief reserves the bottom 672 px and the right 192 px.
diff --git a/examples/07-edit-tutorial/BRIEF.md b/examples/07-edit-tutorial/BRIEF.md
new file mode 100644
index 0000000..fff1779
--- /dev/null
+++ b/examples/07-edit-tutorial/BRIEF.md
@@ -0,0 +1,12 @@
+# Brief 07: tutorial clip that needs real editing, "Tidy your layers"
+
+Make a 14-second tutorial-style video from two separately generated clips, cut together on a timeline with a cross dissolve, a title and a mixed soundtrack. This brief needs the optional edit pack (`scripts/detect_edit.sh` should print `edit: ready (film,sound,photo,...)`; if it does not, install it from `edit/README-EDIT.md`). Without it, say so and stop: ffmpeg alone is not an editor for this brief.
+
+- Delivery: final.mp4, 1920x1080, 30 fps, exactly 14.0 s, H.264 + AAC, -14 LUFS. Plus thumb.png, 1280x720.
+- Look: background #14213D, text #F5F5F0, accent #FCA311. One typeface, bold, for everything. Flat shapes, no gradients inside the clips.
+- Clip A, "before" (build it with HyperFrames, 8 s long, use the first 7.5 s): about a dozen rounded rectangles drift and overlap in a messy pile, each a slightly different size, all in the palette.
+- Clip B, "after" (HyperFrames, 8 s long, use 0.5 s to 7.5 s of it): the same rectangles settled into three neat aligned rows, with a slow push-in on the camera.
+- Edit (FilmCraft, `recipes/film_timeline.sh` is the pattern): clip A from 0.0 s, clip B from 7.0 s, a 1.0 s cross dissolve centred on the cut at 7.0 s. Title "Tidy your layers" in 96 px, lower left, in the accent colour, on screen from 1.0 s to 4.0 s.
+- Sound (SoundCraft, `recipes/sound_mix.sh` is the pattern): a quiet bed from `scripts/sound_bed.sh` under the whole video, plus a short chime at 1.0 s (the title) and another at 7.0 s (the cut). The bed is ducked by 12 dB for 1.5 s under each chime and comes back up smoothly.
+- Thumbnail (PhotoCraft, `recipes/photo_thumbnail.sh` is the pattern): thumb.png, 1280x720, the words "Tidy your layers" large, one rectangle from the clips as the picture, no other text.
+- Done when: final.mp4 is 14.0 s and `check_delivery.sh` passes; in a still at 7.0 s both the messy and the tidy rectangles are visible at the same time (the dissolve); the words "Tidy your layers" are spelled exactly in stills at 2.0 s and are gone at 5.0 s; the bed is at least 10 dB lower in the 1.0 to 2.5 s window than at 5.0 s; thumb.png is 1280x720 and the title is readable at 320 px wide.
diff --git a/install.ps1 b/install.ps1
index b6f5820..52b5f33 100644
--- a/install.ps1
+++ b/install.ps1
@@ -5,8 +5,9 @@
# powershell -ExecutionPolicy Bypass -File .\install.ps1 -Codex # Codex only
# powershell -ExecutionPolicy Bypass -File .\install.ps1 -InstallTools # also winget-install Node, ffmpeg, Git
# powershell -ExecutionPolicy Bypass -File .\install.ps1 -With3D core,cad # also the optional 3D pack
+# powershell -ExecutionPolicy Bypass -File .\install.ps1 -WithEdit film,sound # also the optional edit pack
# powershell -ExecutionPolicy Bypass -File .\install.ps1 -Uninstall
-# powershell -ExecutionPolicy Bypass -File .\install.ps1 -Uninstall -Uninstall3D # also remove the 3D pack folder
+# powershell -ExecutionPolicy Bypass -File .\install.ps1 -Uninstall -Uninstall3D -UninstallEdit # also remove the optional packs
#
# Claude Code reads skills from %USERPROFILE%\.claude\skills (or $env:CLAUDE_CONFIG_DIR\skills).
# Codex reads skills from %USERPROFILE%\.codex\skills (or $env:CODEX_HOME\skills).
@@ -16,6 +17,8 @@ param(
[switch]$Uninstall,
[switch]$InstallTools,
[switch]$Uninstall3D,
+ [switch]$UninstallEdit,
+ [string[]]$WithEdit = @(),
[string[]]$With3D = @()
)
$ErrorActionPreference = 'Stop'
@@ -109,6 +112,8 @@ if ($Uninstall) {
if ($DoCodex) { Uninstall-From $CodexBase 'Codex' }
if ($Uninstall3D) { & (Join-Path $Src '3d\install_3d.ps1') -Uninstall }
else { Write-Host " The optional 3D pack (if installed) stays in %USERPROFILE%\.brief2mp4\3d; add -Uninstall3D to remove it." }
+ if ($UninstallEdit) { & (Join-Path $Src 'edit\install_edit.ps1') -Uninstall }
+ else { Write-Host " The optional edit pack (if installed) stays in %USERPROFILE%\.brief2mp4\edit; add -UninstallEdit to remove it." }
exit 0
}
@@ -125,6 +130,12 @@ if ($With3D.Count -gt 0) {
& (Join-Path $Src '3d\install_3d.ps1') -Components $Components
}
+if ($WithEdit.Count -gt 0) {
+ Write-Host ''
+ Write-Host "Installing the edit pack (components: $($WithEdit -join ','))"
+ & (Join-Path $Src 'edit\install_edit.ps1') -Components $WithEdit
+}
+
Write-Host ''
$Bash = Find-Bash
if ($Bash) {
diff --git a/install.sh b/install.sh
index e2525fd..b79ddbe 100755
--- a/install.sh
+++ b/install.sh
@@ -5,9 +5,11 @@
# bash install.sh --claude # Claude Code only
# bash install.sh --codex # Codex only
# bash install.sh --uninstall # remove from both
-# bash install.sh --uninstall --uninstall-3d # also remove the 3D pack folder
+# bash install.sh --uninstall --uninstall-3d --uninstall-edit # also remove the optional packs
# bash install.sh --with-3d # also install the optional 3D pack (core components)
# bash install.sh --with-3d=core,cad # pick 3D components: core, cad, blender
+# bash install.sh --with-edit # also the optional edit pack (FilmCraft + SoundCraft CLIs)
+# bash install.sh --with-edit=film,sound,effect,photo,vector # pick editing apps
# Windows PowerShell: use install.ps1 instead.
#
# Claude Code reads skills from ~/.claude/skills (or $CLAUDE_CONFIG_DIR/skills).
@@ -21,16 +23,19 @@ VERSION="$(cat "$HERE/VERSION" 2>/dev/null || echo dev)"
CLAUDE_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/skills"
CODEX_DIR="${CODEX_HOME:-$HOME/.codex}/skills"
-DO_CLAUDE=1 DO_CODEX=1 UNINSTALL=0 UNINSTALL_3D=0 WITH_3D=""
+DO_CLAUDE=1 DO_CODEX=1 UNINSTALL=0 UNINSTALL_3D=0 UNINSTALL_EDIT=0 WITH_3D="" WITH_EDIT=""
for arg in "$@"; do
case "$arg" in
--claude) DO_CODEX=0 ;;
--codex) DO_CLAUDE=0 ;;
--uninstall) UNINSTALL=1 ;;
--uninstall-3d) UNINSTALL_3D=1 ;;
+ --uninstall-edit) UNINSTALL_EDIT=1 ;;
+ --with-edit) WITH_EDIT="film,sound" ;;
+ --with-edit=*) WITH_EDIT="${arg#--with-edit=}" ;;
--with-3d) WITH_3D="core" ;;
--with-3d=*) WITH_3D="${arg#--with-3d=}" ;;
- -h|--help) sed -n '2,14p' "$0"; exit 0 ;;
+ -h|--help) sed -n '2,17p' "$0"; exit 0 ;;
*) echo "install.sh: unknown option $arg" >&2; exit 2 ;;
esac
done
@@ -81,6 +86,8 @@ if [[ "$UNINSTALL" == 1 ]]; then
[[ "$DO_CODEX" == 1 ]] && uninstall_from "$CODEX_DIR" "Codex"
if [[ "$UNINSTALL_3D" == 1 ]]; then bash "$SRC/3d/install_3d.sh" --uninstall
else echo " The optional 3D pack (if installed) stays in ${B2M3D_HOME:-$HOME/.brief2mp4/3d}; add --uninstall-3d to remove it."; fi
+ if [[ "$UNINSTALL_EDIT" == 1 ]]; then bash "$SRC/edit/install_edit.sh" --uninstall
+ else echo " The optional edit pack (if installed) stays in ${B2M_EDIT_HOME:-$HOME/.brief2mp4/edit}; add --uninstall-edit to remove it."; fi
exit 0
fi
@@ -94,6 +101,12 @@ if [[ -n "$WITH_3D" ]]; then
bash "$SRC/3d/install_3d.sh" --components "$WITH_3D"
fi
+if [[ -n "$WITH_EDIT" ]]; then
+ echo
+ echo "Installing the edit pack (components: $WITH_EDIT)"
+ bash "$SRC/edit/install_edit.sh" --components "$WITH_EDIT"
+fi
+
echo
bash "$SRC/scripts/doctor.sh" || true
diff --git a/plugin/skills/brief2mp4/SKILL.md b/plugin/skills/brief2mp4/SKILL.md
index d17f609..8fa03fe 100644
--- a/plugin/skills/brief2mp4/SKILL.md
+++ b/plugin/skills/brief2mp4/SKILL.md
@@ -1,6 +1,6 @@
---
name: brief2mp4
-description: Turn a written brief into a finished, checked MP4 motion graphic. Use when asked to make an animation, motion graphic, 2D explainer, maths or algorithm animation, tutorial intro, animated story or skit, YouTube Short or Reel, data story, kinetic typography, lyric video, title sequence, logo sting, 3D scene, 3D product shot, physics drop, exploded view, product turntable or short explainer clip as a video file. Builds with HyperFrames (HTML + GSAP), Three.js, an optional 3D pack (CAD, materials, physics) or Blender, finishes with ffmpeg, then checks the video against the brief and fixes what fails before handing it over.
+description: Turn a written brief into a finished, checked MP4 motion graphic. Use when asked to make an animation, motion graphic, 2D explainer, maths or algorithm animation, tutorial intro, animated story or skit, YouTube Short or Reel, data story, kinetic typography, lyric video, title sequence, logo sting, 3D scene, 3D product shot, physics drop, exploded view, product turntable or short explainer clip as a video file. Builds with HyperFrames (HTML + GSAP), Three.js, an optional 3D pack (CAD, materials, physics), Blender or an optional edit pack (timeline cuts, multitrack mixing, compositing), finishes with ffmpeg, then checks the video against the brief and fixes what fails before handing it over.
---
# brief2mp4
@@ -60,6 +60,7 @@ If the brief names a kind of video (explainer, maths, tutorial intro, skit, Shor
| Stylised 3D, particles, many objects, flying cameras | Three.js inside HyperFrames | `references/threejs.md` |
| Realistic products, materials, soft light and shadows | Blender, scripted with Python, run headless | `references/blender.md` |
| A product or object that falls and settles, explodes into parts, turns on a turntable; a logo made 3D; a CAD part | The 3D pack, if installed (see below) | `3d/README-3D.md` |
+| Real footage cut on a timeline (tutorials, vlogs, skits from recordings), a multitrack voice + music + SFX mix with ducking, layered keyframed compositing, a thumbnail or title card, an SVG logo or lower third | The edit pack, if installed (see below) | `edit/README-EDIT.md` |
| Joining clips, adding sound, exact duration, loudness, encoding | ffmpeg (`scripts/finish.sh`) | `references/ffmpeg.md` |
Mixing is normal: render a Blender shot to frames, then use it as a video layer under HyperFrames type, or join HyperFrames and Blender clips with ffmpeg. Every path ends with `scripts/finish.sh` and `scripts/check_delivery.sh`.
@@ -72,6 +73,14 @@ Snapshot every 3D shot before the full render (`npx hyperframes snapshot --at 1,
If it prints `3d: not installed`, use the Three.js template for 3D beats, animate physics and exploded views by hand, and say so in REPORT.md. Mention once how to add the pack: `bash <this skill's folder>/3d/install_3d.sh --components core` (Windows: `powershell -ExecutionPolicy Bypass -File <this skill's folder>\3d\install_3d.ps1 -Components core`). This works for plugin and script installs alike.
+### The edit pack (optional)
+
+Run `bash <this skill's folder>/scripts/detect_edit.sh`. If it prints `edit: ready (...)`, the listed ArtCraft editors are installed as pinned command-line tools: FilmCraft (timeline editing), SoundCraft (multitrack mixing, automation, bounce), EffectCraft (layered compositing and keyframes), PhotoCraft (image editing) and VectorCraft (vector drawing). Read `edit/README-EDIT.md` first. Start from the tested recipes in `edit/recipes/` (`film_timeline.sh`, `sound_mix.sh`, `effect_title.sh`, `photo_thumbnail.sh`, `vector_lower_third.sh`) rather than writing commands from memory. These apps are alpha: before any command a recipe does not already use, list the real ids with `<app>-cli commands` (or `--help`) for the pinned version. Use the CLI by default and an app's MCP server only when the brief needs interactive back-and-forth.
+
+Edited output is a layer or a soundtrack like any other: a FilmCraft cut or an EffectCraft render goes into HyperFrames as video, a SoundCraft bounce goes to `finish.sh --audio`, and every route still ends with `finish.sh`, `check_delivery.sh` and the stills you look at.
+
+If it prints `edit: not installed`, cut with ffmpeg (`references/ffmpeg.md`) and mix with ffmpeg filters, and mention once how to add the pack: `bash <this skill's folder>/edit/install_edit.sh --components film,sound` (Windows: `install_edit.ps1 -Components film,sound`).
+
For briefs that mix tools, read `references/pipelines.md` (architecture, recipes for each mix, how layers meet in HyperFrames). For tools outside this stack (Remotion, Motion Canvas, Manim, Lottie, Rive, PixiJS, R3F, Babylon.js and more), read `references/ecosystem.md`: when each one beats the default, and how to bring its output in frame-exact.
Starters that already render: `templates/threejs/index.html` (run `scripts/vendor_libs.sh <project> --three` after copying it) and `templates/blender/scene.py`. Copy one into the project and change it, rather than starting from an empty file.
@@ -132,5 +141,6 @@ That message means: re-read the **original brief** (not your spec), go through i
- `references/pipelines.md`: architecture diagram, route per beat, recipes for mixed pipelines, methods
- `references/ecosystem.md`: 45+ open-source motion, 3D and agent-skill repos, when to use each, how to connect them
- `3d/README-3D.md`: the optional 3D pack (components, commands, shot JSON, brief-to-shot mapping, look rules)
-- `scripts/finish.sh`, `scripts/check_delivery.sh`, `scripts/contact_sheet.sh`, `scripts/sound_bed.sh`, `scripts/doctor.sh`, `scripts/detect_3d.sh`, `scripts/bounds.py`, `scripts/vendor_libs.sh`
+- `edit/README-EDIT.md`: the optional edit pack (ArtCraft editors: install, verification, recipes, command discovery, MCP)
+- `scripts/finish.sh`, `scripts/check_delivery.sh`, `scripts/contact_sheet.sh`, `scripts/sound_bed.sh`, `scripts/doctor.sh`, `scripts/detect_3d.sh`, `scripts/bounds.py`, `scripts/vendor_libs.sh`, `scripts/detect_edit.sh`
- `templates/SPEC.md`, `templates/threejs/index.html`, `templates/blender/scene.py`
diff --git a/plugin/skills/brief2mp4/edit/README-EDIT.md b/plugin/skills/brief2mp4/edit/README-EDIT.md
new file mode 100644
index 0000000..71b218b
--- /dev/null
+++ b/plugin/skills/brief2mp4/edit/README-EDIT.md
@@ -0,0 +1,163 @@
+# The edit pack (optional)
+
+brief2mp4 works without this folder. The pack adds real editing tools for briefs that are more than "generate a graphic and finish it with ffmpeg": footage cut on a timeline, a multitrack audio mix, layered compositing, image editing, vector art. It installs the command-line tools of five free desktop apps, pinned to exact versions, and ships one tested recipe per app.
+
+The apps are the ArtCraft family by **storytold**, released under **Apache-2.0** (each download carries its own `LICENSE-APACHE` and `NOTICE` files; read them). brief2mp4 does not redistribute them: the installer downloads each release from `github.com/storytold`. **They are alpha software.** Command ids and parameters change between versions, which is why this pack pins versions, tests its recipes against the pinned ones, and tells agents to discover commands at run time.
+
+| Component | App | Pinned | What it is |
+|---|---|---|---|
+| `film` | FilmCraft | 0.20.1 | timeline editor, Premiere class |
+| `sound` | SoundCraft | 0.20.1 | multitrack audio workstation: mix, automation, bounce |
+| `effect` | EffectCraft | 0.24.1 | layered, keyframed compositing, After Effects class |
+| `photo` | PhotoCraft | 0.23.1 | image editor: thumbnails, title cards |
+| `vector` | VectorCraft | 0.24.1 | vector drawing: logos, lower thirds as SVG |
+
+## Check and install
+
+Check first. The command always exits 0 and prints one line you can branch on. A component counts as ready only if its CLI runs (`<cli> --version` succeeds):
+
+```bash
+bash scripts/detect_edit.sh # macOS, Linux, Git Bash
+powershell -File scripts\detect_edit.ps1 # Windows
+# edit: ready (film,sound,effect,photo,vector) or edit: not installed
+```
+
+If the brief needs editing and it says `not installed`, install only the components the brief needs. Nothing uses sudo or admin rights, and nothing touches your system PATH.
+
+```bash
+# macOS and Linux (run from this skill's folder, or give the full path)
+bash edit/install_edit.sh # film + sound
+bash edit/install_edit.sh --components film,sound,effect,photo,vector
+bash edit/install_edit.sh --components all --dry-run # print what would be downloaded, change nothing
+
+# Windows (PowerShell)
+powershell -ExecutionPolicy Bypass -File edit\install_edit.ps1
+powershell -ExecutionPolicy Bypass -File edit\install_edit.ps1 -Components film,sound,effect,photo,vector
+powershell -ExecutionPolicy Bypass -File edit\install_edit.ps1 -Components all -DryRun
+```
+
+It needs `curl` and Node.js (already required by the skill) on macOS and Linux, plus `unzip` or `bsdtar` for the macOS zips. Each download is checked three ways: its SHA-256 must equal the line in the release's `SHA256SUMS.txt` and the hash pinned in `versions.json`, and, when `gpg` is installed, `SHA256SUMS.txt.asc` must verify against `release-signing-key.asc` and the signing key's fingerprint pinned in `versions.json`. Without gpg the installer says `signature: SKIPPED` and the two SHA-256 checks still run. A mismatch deletes nothing you had and installs nothing.
+
+### Where it goes, and how big
+
+Everything goes into `~/.brief2mp4/edit` (Windows `%USERPROFILE%\.brief2mp4\edit`); set `B2M_EDIT_HOME` to use another folder. It holds the app folders (`filmcraft/` and so on), `bin/` with one launcher per CLI, a copy of `versions.json` and of the `recipes/`, and `.b2m-edit-manifest`, the list of what the installer created. The installed pack never reads from the git clone or the plugin cache, so moving or deleting those does not break it. Launchers use relative paths, so the whole folder can be moved or copied too.
+
+| | macOS (CLI zip) | Linux x86_64 (app tarball) | Windows x64 (portable zip) |
+|---|---|---|---|
+| download: film | 95.4 MB | 107.0 MB | 108.2 MB |
+| download: sound | 8.6 MB | 20.9 MB | 19.0 MB |
+| download: effect | 73.7 MB | 78.0 MB | 81.1 MB |
+| download: photo | 114.9 MB | 133.0 MB | 136.5 MB |
+| download: vector | 127.8 MB | 150.4 MB | 155.4 MB |
+| download: all five | 420.4 MB | 489.3 MB | 500.2 MB |
+
+Measured on macOS after install: filmcraft 179 MB, soundcraft 22 MB, effectcraft 187 MB, photocraft 222 MB, vectorcraft 253 MB, about 1.2 GB for all five. Linux and Windows disk sizes were not measured. The Linux and Windows archives hold the whole desktop app next to the CLI (inspected for SoundCraft), and the installer keeps that folder as it came.
+
+To put the launchers on your PATH the installer prints one line to run yourself. The recipes do not need that: they find the pinned CLIs through `B2M_EDIT_HOME` and never use an older copy that happens to be on the PATH.
+
+### Uninstall
+
+```bash
+bash edit/install_edit.sh --uninstall # everything the installer created
+bash edit/install_edit.sh --uninstall --components photo # one component
+# Windows: install_edit.ps1 -Uninstall [-Components photo]
+```
+
+Only the paths listed in `.b2m-edit-manifest` are removed, one by one. Anything else you put in that folder stays, and the folder itself is removed only if it ends up empty. Entries in the manifest with `..` or an absolute path are skipped.
+
+macOS note: a download made with `curl` carries no quarantine flag, and the installer checked this (`no quarantine flag ... nothing to remove`). If a flag is ever present it removes `com.apple.quarantine` from the app folder and says so. That branch has not been exercised.
+
+## When to use which tool
+
+HyperFrames, Three.js and Blender stay the way to make graphics, type, charts and 3D. ffmpeg stays the finisher. Reach for the pack when the work is editing, not generating.
+
+| The brief needs | Use | Why not HyperFrames or ffmpeg alone |
+|---|---|---|
+| Footage-heavy tutorials, vlogs, skits: several clips, trims, a cross dissolve, a title on top, audio that follows the cut | FilmCraft (`film_timeline.sh`) | a timeline keeps clip, transition and title relationships; ffmpeg filter graphs for that are fragile and unreadable |
+| Voice, music and sound effects on separate tracks, music lowered under speech, a bounced mix | SoundCraft (`sound_mix.sh`) | per-track levels and automation instead of one opaque `amix` expression |
+| Layered, keyframed compositing: animated titles, bars, effects on layers, text animation presets | EffectCraft (`effect_title.sh`) | layers, keyframes and effects with a renderer, when an HTML page would be a re-implementation |
+| Thumbnails, title cards, image retouching | PhotoCraft (`photo_thumbnail.sh`) | real type and layers on a raster canvas |
+| SVG logos, lower thirds, icons that stay sharp at any size | VectorCraft (`vector_lower_third.sh`) | clean vector output with live text, which you can then place in a HyperFrames page |
+
+If HyperFrames already does the job in one page, use HyperFrames. The pack is for the cases above.
+
+## CLI first, MCP only when needed
+
+Drive each app through its CLI: it is scriptable, needs no server, and the recipes show the shape. Use an MCP server only when the CLI cannot do the job, for example to keep one document open across many steps, or to drive a running desktop app. These all start with `<cli> mcp`; the launchers are in `~/.brief2mp4/edit/bin`.
+
+```bash
+# Claude Code (syntax from `claude mcp add --help`)
+claude mcp add filmcraft -- ~/.brief2mp4/edit/bin/filmcraft-cli mcp
+claude mcp add vectorcraft -- ~/.brief2mp4/edit/bin/vectorcraft-cli mcp --headless
+# Codex (syntax from `codex mcp add --help`)
+codex mcp add filmcraft -- ~/.brief2mp4/edit/bin/filmcraft-cli mcp
+codex mcp add vectorcraft -- ~/.brief2mp4/edit/bin/vectorcraft-cli mcp --headless
+```
+
+Use the same pattern for `soundcraft-cli mcp`, `effectcraft-cli mcp` and `photocraft-cli mcp`. `vectorcraft-cli mcp` without `--headless` first tries a running VectorCraft app on 127.0.0.1:7979 and falls back to a headless session. Verified here: each of the five pinned CLIs answers the MCP `initialize` and `tools/list` calls over stdio with its pinned version (17, 17, 27, 26 and 33 tools for film, sound, effect, photo and vector). Not tested: registering them in a real Claude Code or Codex session and calling tools from there.
+
+**File confinement.** For the servers that have the flags, confine what an agent can read and write:
+
+```bash
+soundcraft-cli mcp --automation-read-root ./project --automation-write-root ./project/out
+```
+
+`--automation-read-root DIR` and `--automation-write-root DIR` exist on `soundcraft-cli mcp`, `effectcraft-cli mcp`, `photocraft-cli mcp` and `vectorcraft-cli mcp` in the pinned versions (checked in each `mcp --help`); repeat them for several folders. A root you leave out grants none of that access on photo and vector, and on vector they imply `--headless`. **FilmCraft 0.20.1 has no such flags**: `filmcraft-cli mcp --automation-read-root X` fails with `unknown mcp option`. So for FilmCraft prefer the CLI, which only touches the paths your script names, and keep it inside the project folder.
+
+## Discover commands; do not trust a list
+
+Command ids and parameters change between alpha versions. Before using any command, ask the pinned CLI:
+
+| App | List | Detail |
+|---|---|---|
+| FilmCraft | `filmcraft-cli commands [filter]` | `filmcraft-cli describe <id>` |
+| SoundCraft | `soundcraft-cli commands` (plus `soundcraft-cli plugins`) | `soundcraft-cli describe <id>` |
+| EffectCraft | `effectcraft-cli commands --filter TEXT` | the listing shows each command's parameters |
+| PhotoCraft | `photocraft-cli commands --filter TEXT [--json]` | the listing shows each command's parameters |
+| VectorCraft | `vectorcraft-cli commands` (JSON, about 1,400 entries: filter it) | the `params` field of each entry |
+
+Add `--help` for the subcommands and options. The ids the recipes use are named at the top of each recipe and are checked against the pinned CLIs by `tests/test_edit_slow.py`. If you move to other versions, re-run the recipes and the tests before trusting them.
+
+## The recipes
+
+Each recipe is a bash script (on Windows, Git Bash) that does one real job headless with the pinned CLI, makes its own sample inputs if you give none, and prints `ok: <file> ...`. They live in `recipes/` here and in `~/.brief2mp4/edit/recipes/` after install. Run any with `--help`.
+
+| Recipe | Job | Command ids it uses (pinned versions) |
+|---|---|---|
+| `film_timeline.sh` | two clips on a timeline, a 1 s cross dissolve at the cut, a title, export H.264 MP4 with AAC (5 s) | `file.newProject`, `file.newSequence`, `file.import`, `timeline.place`, `sequence.applyVideoTransition`, `graphics.newText`, `file.exportMedia` |
+| `sound_mix.sh` | a voice track over a music bed, the bed ducked by volume automation under the voice, bounced to a 48 kHz stereo 24-bit WAV | `session.new`, `file.import_audio`, `mix.volume`, `automation.set_point`, and `run --bounce` |
+| `effect_title.sh` | a 3 s animated title: a text layer with the Tracking In preset, fade and rise keyframes, a growing accent bar, rendered to H.264 | `comp.new`, `layer.newText`, `layer.applyTextPreset`, `layer.newSolid`, `prop.addKey`, `prop.set`, and `render` |
+| `photo_thumbnail.sh` | a 1280x720 PNG thumbnail: gradient, title, subtitle | `layer.newFillLayer.gradient`, `type.create`, started with `run --new` |
+| `vector_lower_third.sh` | a lower-third SVG with a panel, accent bar, name and role | `file.new`, `shape.rectangle`, `paint.setFill`, `paint.setStroke`, `text.create`, exported with `run --export` |
+
+How each app is driven, so you can adapt a recipe:
+
+- **FilmCraft** keeps state only inside one `run`, or in a project file between calls: `run script.jsonl --save-as p.fcproj`, then `--project p.fcproj --save run next.jsonl`. Each command's JSON result carries the ids (items, clips) the next step needs, which is why the recipe works in three stages. Time is in ticks (254016000000 per second); `timeline.place` also takes `{"seconds": ...}` for source in and duration. A dissolve needs spare frames on both sides of the cut, so the recipe takes the second clip from half a dissolve earlier.
+- **SoundCraft** takes repeated `--cmd ID=JSON` and `--bounce OUT`. Imported files become tracks named after the file, so the recipe copies inputs in as `voice.wav` and `music.wav`. The pinned compressor lists no sidechain input parameter, so ducking is done with volume automation points on the music track.
+- **EffectCraft**: `--empty run --commands file.jsonl --save-as p.ecproj`, then `--project p.ecproj render --out x.mp4 --format h264 --audio off`. Property paths come from `effectcraft-cli props <comp> <layer> --flat`.
+- **PhotoCraft**: `run --new '{"width":1280,"height":720}' --cmd ID --params '{...}' ... --out file.png`. Saving a layered document as PNG flattens it (the CLI says so).
+- **VectorCraft**: `run --commands file.jsonl --export file.svg`. New shapes get a black stroke unless you switch it off with `paint.setStroke {"none":true}`.
+
+## Every route still ends in the same two scripts
+
+Whatever made the picture and sound, the deliverable is checked the same way. An edit export is a rough render like any other:
+
+```bash
+bash scripts/finish.sh --in cut.mp4 --out final.mp4 --seconds 5 --size 1280x720 --keep-audio
+bash scripts/check_delivery.sh final.mp4 --seconds 5 --size 1280x720
+```
+
+Run on the output of `film_timeline.sh`, this gives `RESULT: PASS` (1280x720, 30 fps, 5.0 s, AAC, -14.1 LUFS). A SoundCraft WAV goes into `finish.sh --audio`; PhotoCraft and VectorCraft outputs are stills or overlays that go into the HyperFrames page or the FilmCraft timeline. `examples/07-edit-tutorial/BRIEF.md` is a brief that needs this pack.
+
+## What was tested, and what was not
+
+Tested on macOS 26.6 (Apple silicon) with the pinned versions: the installer end to end for all five components (download, both SHA-256 checks, gpg signature, install, launcher, idempotent re-run, a tampered pin refused, uninstall), `detect_edit.sh`, every recipe (outputs checked with ffprobe, frame hashes, tone levels, PNG and SVG parsing), the MCP handshake of all five CLIs, and `finish.sh` plus `check_delivery.sh` on the film recipe's output. The two PowerShell scripts were parsed and dry-run under PowerShell 7 on macOS, and their hash, signature and unzip steps ran against the Windows x64 SoundCraft zip there, up to starting the `.exe`.
+
+**Untested:**
+
+- Windows: the real install and the `.exe` CLIs, the `.cmd` launchers, Windows PowerShell 5.1 (the scripts avoid its known problems but were not run on it), the recipes under Git Bash, SmartScreen behaviour, and the arm64 build.
+- Linux: everything past `--dry-run`. The install layout (`<app>/bin/<app>-cli`) was read from the SoundCraft tarball listing; whether the Linux CLIs need system libraries is not known.
+- The desktop apps themselves and bridge mode (`--control`, `--bridge`).
+- Calling MCP tools from a real Claude Code or Codex session.
+
+None of the five apps was blocked: every recipe's job ran headless with the pinned versions.
diff --git a/plugin/skills/brief2mp4/edit/install_edit.ps1 b/plugin/skills/brief2mp4/edit/install_edit.ps1
new file mode 100644
index 0000000..ff7e216
--- /dev/null
+++ b/plugin/skills/brief2mp4/edit/install_edit.ps1
@@ -0,0 +1,232 @@
+# install_edit.ps1: install the command-line tools of the optional brief2mp4 edit pack on Windows. No admin rights needed.
+#
+# powershell -ExecutionPolicy Bypass -File install_edit.ps1 # film + sound
+# powershell -ExecutionPolicy Bypass -File install_edit.ps1 -Components film,sound,effect,photo,vector
+# powershell -ExecutionPolicy Bypass -File install_edit.ps1 -Components all -DryRun # show the plan, change nothing
+# powershell -ExecutionPolicy Bypass -File install_edit.ps1 -Uninstall # remove what this installer created
+# powershell -ExecutionPolicy Bypass -File install_edit.ps1 -Uninstall -Components photo
+#
+# Components (free ArtCraft apps by storytold, Apache-2.0, pinned in versions.json)
+# film FilmCraft, sound SoundCraft, effect EffectCraft, photo PhotoCraft, vector VectorCraft
+#
+# Each download is checked against the release's SHA256SUMS.txt and the hash pinned in versions.json.
+# When gpg is installed, the signature on SHA256SUMS.txt is checked too (skipped, and said so, otherwise).
+# Installs into $env:B2M_EDIT_HOME (default %USERPROFILE%\.brief2mp4\edit), copying versions.json and the
+# recipes there. Safe to run again. Never touches the system PATH: it prints the line you can add.
+[CmdletBinding()]
+param(
+ [string[]]$Components = @("film", "sound"),
+ [switch]$DryRun,
+ [switch]$Uninstall
+)
+$ErrorActionPreference = "Stop"
+$ProgressPreference = "SilentlyContinue"
+try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 } catch { }
+
+$Pack = Split-Path -Parent $MyInvocation.MyCommand.Path
+$HomeDir = if ($env:B2M_EDIT_HOME) { $env:B2M_EDIT_HOME } else { Join-Path $env:USERPROFILE ".brief2mp4\edit" }
+$Manifest = Join-Path $HomeDir ".b2m-edit-manifest"
+$All = @("film", "sound", "effect", "photo", "vector")
+$Utf8 = New-Object System.Text.UTF8Encoding($false)
+
+# Both `-Components film,sound` (an array) and `-File ... -Components film,sound` (one string) arrive here.
+$explicit = $PSBoundParameters.ContainsKey("Components")
+$wanted = @($Components | ForEach-Object { $_ -split "[,\s]+" } | Where-Object { $_ } | ForEach-Object { $_.ToLowerInvariant() })
+if ($wanted -contains "all") { $wanted = $All }
+if ($wanted.Count -eq 0) { throw "-Components needs a value (film, sound, effect, photo, vector, all)" }
+foreach ($c in $wanted) { if ($All -notcontains $c) { throw "unknown component '$c' (film, sound, effect, photo, vector, all)" } }
+$wanted = @($wanted | Select-Object -Unique)
+
+$Versions = ConvertFrom-Json ([System.IO.File]::ReadAllText((Join-Path $Pack "versions.json"), $Utf8))
+
+function Get-PlatformKey {
+ if ($env:B2M_EDIT_PLATFORM) { return $env:B2M_EDIT_PLATFORM } # test hook
+ if ((Get-Variable IsWindows -ErrorAction SilentlyContinue) -and -not $IsWindows) { throw "this is not Windows: run install_edit.sh instead" }
+ $arch = ""
+ try { $arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString() } catch { }
+ if (-not $arch) { $arch = if ($env:PROCESSOR_ARCHITEW6432) { $env:PROCESSOR_ARCHITEW6432 } else { $env:PROCESSOR_ARCHITECTURE } }
+ switch -Regex ($arch) {
+ "^(X64|AMD64)$" { return "windows-x64" }
+ "^ARM64$" { return "windows-arm64" }
+ default { throw "no pinned build for Windows $arch (x64 and arm64 only)" }
+ }
+}
+
+function Get-SizeMB([string]$path) {
+ if (-not (Test-Path $path)) { return 0 }
+ $item = Get-Item $path
+ if (-not $item.PSIsContainer) { return [int]($item.Length / 1MB) }
+ $sum = (Get-ChildItem -Path $path -Recurse -File -Force -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum
+ return [int](($sum + 0) / 1MB)
+}
+
+# Runs a program through .NET so its stderr never becomes a terminating error (Windows PowerShell 5.1 turns
+# redirected native stderr into one under $ErrorActionPreference = "Stop"). Returns exit code and stdout.
+function Invoke-Native([string]$file, [string[]]$arguments, [hashtable]$environment = @{}) {
+ $psi = New-Object System.Diagnostics.ProcessStartInfo
+ $psi.FileName = $file
+ $psi.Arguments = ($arguments | ForEach-Object { if ($_ -match '[\s"]') { '"' + ($_ -replace '"', '\"') + '"' } else { $_ } }) -join " "
+ $psi.UseShellExecute = $false
+ $psi.RedirectStandardOutput = $true
+ $psi.RedirectStandardError = $true
+ $psi.CreateNoWindow = $true
+ foreach ($k in $environment.Keys) { $psi.EnvironmentVariables[$k] = $environment[$k] }
+ try { $p = [System.Diagnostics.Process]::Start($psi) } catch { return [pscustomobject]@{ ExitCode = -1; Output = "" } }
+ $out = $p.StandardOutput.ReadToEnd()
+ $null = $p.StandardError.ReadToEnd()
+ $p.WaitForExit()
+ return [pscustomobject]@{ ExitCode = $p.ExitCode; Output = $out }
+}
+
+function Add-ToManifest([string]$rel) {
+ $lines = @()
+ if (Test-Path $Manifest) { $lines = @([System.IO.File]::ReadAllLines($Manifest, $Utf8) | Where-Object { $_ }) }
+ if ($lines -notcontains $rel) { [System.IO.File]::WriteAllLines($Manifest, @($lines + $rel), $Utf8) }
+}
+
+function Test-Hash([string]$file, [string]$asset, [string]$sums, [string]$pinned) {
+ $line = [System.IO.File]::ReadAllLines($sums, $Utf8) | Where-Object { ($_ -split "\s+")[1] -eq $asset } | Select-Object -First 1
+ if (-not $line) { throw "$asset is not listed in the release's SHA256SUMS.txt" }
+ $listed = ($line -split "\s+")[0].ToLowerInvariant()
+ if ($listed -ne $pinned.ToLowerInvariant()) { throw "SHA-256 in the release ($listed) differs from the one pinned in versions.json ($pinned). Refusing to install." }
+ $actual = (Get-FileHash -Algorithm SHA256 -Path $file).Hash.ToLowerInvariant()
+ if ($actual -ne $pinned.ToLowerInvariant()) { throw "SHA-256 mismatch for ${asset}: got $actual, expected $pinned." }
+ Write-Output " sha-256: OK ($asset)"
+}
+
+function Test-Signature([string]$dir, [string]$fingerprint) {
+ $gpg = Get-Command gpg -ErrorAction SilentlyContinue
+ if (-not $gpg) {
+ Write-Output " signature: SKIPPED (gpg not installed; the SHA-256 checks above still ran. Install Gpg4win to check the release signature too)"
+ return
+ }
+ $gh = Join-Path ([System.IO.Path]::GetTempPath()) ("b2m-" + [guid]::NewGuid().ToString("N").Substring(0, 8))
+ New-Item -ItemType Directory -Force -Path $gh | Out-Null
+ try {
+ $env2 = @{ GNUPGHOME = $gh }
+ # No agent is needed to check a signature; a failed import shows up as a failed verification below.
+ $null = Invoke-Native $gpg.Source @("--batch", "--quiet", "--no-autostart", "--import", (Join-Path $dir "release-signing-key.asc")) $env2
+ $ver = Invoke-Native $gpg.Source @("--batch", "--no-autostart", "--status-fd", "1", "--verify", (Join-Path $dir "SHA256SUMS.txt.asc"), (Join-Path $dir "SHA256SUMS.txt")) $env2
+ $ok = $ver.Output -split "`n" | Where-Object { $_ -like "*VALIDSIG *" -and ($_.Trim() -split " ")[-1] -eq $fingerprint }
+ if (-not $ok) { throw "the signature on SHA256SUMS.txt did not verify against the pinned key $fingerprint. Nothing was installed." }
+ Write-Output (" signature: OK (SHA256SUMS.txt signed by key " + $fingerprint.Substring(0, 8) + "..." + $fingerprint.Substring($fingerprint.Length - 8) + ")")
+ } finally { Remove-Item -Recurse -Force $gh -ErrorAction SilentlyContinue }
+}
+
+function Install-App([string]$app, [string]$plat, [string]$stage) {
+ $a = $Versions.apps.$app
+ $asset = $a.assets.$plat
+ if (-not $asset) { throw "$($a.name) $($a.version) has no build for $plat" }
+ $url = "$($Versions.source)/$($a.name)/releases/download/$($a.tag)"
+ $dest = Join-Path $HomeDir $a.name
+ $cli = Join-Path $dest "$($a.name)-cli.exe"
+ $mb = [math]::Round($asset.bytes / 1MB, 1)
+ if ($DryRun) { Write-Output "${app}: $($a.name) $($a.version) ($plat) would download $($asset.file), $mb MB, from $url/$($asset.file)"; return }
+ $stamp = Join-Path $dest ".b2m-version"
+ if ((Test-Path $cli) -and (Test-Path $stamp) -and (([System.IO.File]::ReadAllText($stamp, $Utf8)).Trim() -eq $a.version)) {
+ Write-Output "${app}: $($a.name) $($a.version) already installed ($(Get-SizeMB $dest) MB at $dest)"
+ Write-Launcher $a; Add-ToManifest $a.name; return
+ }
+ Write-Output "${app}: downloading $($a.name) $($a.version) ($mb MB) for $plat"
+ Invoke-WebRequest -UseBasicParsing -Uri "$url/$($asset.file)" -OutFile (Join-Path $stage $asset.file)
+ foreach ($f in @("SHA256SUMS.txt", "SHA256SUMS.txt.asc", "release-signing-key.asc")) {
+ Invoke-WebRequest -UseBasicParsing -Uri "$url/$f" -OutFile (Join-Path $stage $f)
+ }
+ Test-Hash (Join-Path $stage $asset.file) $asset.file (Join-Path $stage "SHA256SUMS.txt") $asset.sha256
+ Test-Signature $stage $Versions.signing.fingerprint
+ $x = Join-Path $stage "x-$app"
+ Add-Type -AssemblyName System.IO.Compression.FileSystem
+ [System.IO.Compression.ZipFile]::ExtractToDirectory((Join-Path $stage $asset.file), $x)
+ $top = Get-ChildItem -Path $x -Directory | Select-Object -First 1
+ if (-not $top) { throw "$($asset.file) had no folder inside" }
+ if (Test-Path $dest) { Remove-Item -Recurse -Force $dest }
+ Move-Item -Path $top.FullName -Destination $dest
+ Get-ChildItem -Path $dest -Recurse -File | Unblock-File -ErrorAction SilentlyContinue
+ Write-Output " windows: cleared any download block flag on the files (Unblock-File)"
+ $ver = Invoke-Native $cli @("--version")
+ if ($ver.ExitCode -ne 0) { throw "$cli was installed but does not run. Try: & `"$cli`" --version" }
+ [System.IO.File]::WriteAllText($stamp, $a.version + "`n", $Utf8)
+ Write-Launcher $a; Add-ToManifest $a.name
+ Write-Output "${app}: done, $(($ver.Output -split "`n")[0].Trim()), $(Get-SizeMB $dest) MB on disk"
+}
+
+function Write-Launcher($a) {
+ # Relative to the .cmd, so the folder can move. Pure ASCII, so any user name works.
+ New-Item -ItemType Directory -Force -Path (Join-Path $HomeDir "bin") | Out-Null
+ $text = "@echo off`r`n`"%~dp0..\$($a.name)\$($a.name)-cli.exe`" %*`r`n"
+ [System.IO.File]::WriteAllText((Join-Path $HomeDir "bin\$($a.name)-cli.cmd"), $text, (New-Object System.Text.UTF8Encoding($false)))
+ Add-ToManifest "bin/$($a.name)-cli.cmd"
+}
+
+function Copy-SupportFiles {
+ Copy-Item (Join-Path $Pack "versions.json") (Join-Path $HomeDir "versions.json") -Force
+ $rec = Join-Path $HomeDir "recipes"
+ if (Test-Path $rec) { Remove-Item -Recurse -Force $rec }
+ New-Item -ItemType Directory -Force -Path $rec | Out-Null
+ Copy-Item (Join-Path $Pack "recipes\*") $rec -Force
+ Add-ToManifest "versions.json"; Add-ToManifest "recipes"
+}
+
+function Invoke-Uninstall {
+ if (-not (Test-Path $Manifest)) { Write-Output "nothing to remove: $HomeDir has no edit-pack manifest (this installer created nothing there)"; return }
+ $names = @(); foreach ($c in $wanted) { $names += $Versions.apps.$c.name; $names += "bin/$($Versions.apps.$c.cli).cmd" }
+ $keep = @(); $freed = 0
+ foreach ($rel in [System.IO.File]::ReadAllLines($Manifest, $Utf8)) {
+ if (-not $rel) { continue }
+ if ($rel -notmatch '^[A-Za-z0-9._][A-Za-z0-9._/-]*$' -or $rel -like "*..*") { Write-Output "skipping unsafe manifest entry: $rel"; $keep += $rel; continue }
+ if ($explicit -and ($names -notcontains $rel)) { $keep += $rel; continue }
+ $target = Join-Path $HomeDir ($rel -replace "/", "\")
+ if (Test-Path $target) { $freed += Get-SizeMB $target; Remove-Item -Recurse -Force $target; Write-Output "removed $target" }
+ }
+ $support = @("versions.json", "recipes", ".components")
+ $apps = @($keep | Where-Object { $support -notcontains $_ })
+ if ($explicit -and $apps.Count -eq 0) {
+ # The last app is gone: take the shared files this installer made too.
+ foreach ($rel in $keep) {
+ $t = Join-Path $HomeDir $rel
+ if (Test-Path $t) { Remove-Item -Recurse -Force $t; Write-Output "removed $t" }
+ }
+ $keep = @()
+ }
+ if ($keep.Count -gt 0) {
+ [System.IO.File]::WriteAllLines($Manifest, $keep, $Utf8)
+ $marker = Join-Path $HomeDir ".components"
+ if ($explicit -and (Test-Path $marker)) {
+ $left = @([System.IO.File]::ReadAllLines($marker, $Utf8) | Where-Object { $_ -and ($wanted -notcontains $_) })
+ [System.IO.File]::WriteAllLines($marker, $left, $Utf8)
+ }
+ } else {
+ Remove-Item -Force $Manifest -ErrorAction SilentlyContinue
+ foreach ($d in @((Join-Path $HomeDir "bin"), $HomeDir)) { if ((Test-Path $d) -and -not (Get-ChildItem -Force $d)) { Remove-Item -Force $d } }
+ }
+ Write-Output "uninstall done, about $freed MB freed. Anything else in $HomeDir was not created by this installer and was left alone."
+}
+
+if ($Uninstall) { Invoke-Uninstall; exit 0 }
+
+$plat = Get-PlatformKey
+$stage = $null
+if (-not $DryRun) {
+ New-Item -ItemType Directory -Force -Path $HomeDir | Out-Null
+ $stage = Join-Path $HomeDir (".stage-" + $PID)
+ New-Item -ItemType Directory -Force -Path $stage | Out-Null
+}
+try {
+ Write-Output "brief2mp4 edit pack: ArtCraft apps by storytold (Apache-2.0), alpha software, versions pinned in versions.json"
+ foreach ($app in $wanted) { Install-App $app $plat $stage }
+ if (-not $DryRun) {
+ Copy-SupportFiles
+ $marker = Join-Path $HomeDir ".components"
+ $all = @()
+ if (Test-Path $marker) { $all += [System.IO.File]::ReadAllLines($marker, $Utf8) }
+ $all = @($all + $wanted | Where-Object { $_ } | Sort-Object -Unique)
+ [System.IO.File]::WriteAllLines($marker, $all, $Utf8)
+ Add-ToManifest ".components"
+ Write-Output ("installed components: " + ($all -join ",") + " total on disk: $(Get-SizeMB $HomeDir) MB in $HomeDir")
+ Write-Output "launchers are in $HomeDir\bin and recipes in $HomeDir\recipes. To type the launchers anywhere, run this yourself (this script does not):"
+ Write-Output " [Environment]::SetEnvironmentVariable('Path', '$HomeDir\bin;' + [Environment]::GetEnvironmentVariable('Path', 'User'), 'User')"
+ Write-Output "to remove everything this installer created: install_edit.ps1 -Uninstall"
+ }
+} finally {
+ if ($stage -and (Test-Path $stage)) { Remove-Item -Recurse -Force $stage -ErrorAction SilentlyContinue }
+}
diff --git a/plugin/skills/brief2mp4/edit/install_edit.sh b/plugin/skills/brief2mp4/edit/install_edit.sh
new file mode 100755
index 0000000..c163549
--- /dev/null
+++ b/plugin/skills/brief2mp4/edit/install_edit.sh
@@ -0,0 +1,262 @@
+#!/usr/bin/env bash
+# install_edit.sh: install the command-line tools of the optional brief2mp4 edit pack. No sudo, ever.
+#
+# bash install_edit.sh # film + sound
+# bash install_edit.sh --components film,sound,effect,photo,vector
+# bash install_edit.sh --components all --dry-run # show what would be downloaded, change nothing
+# bash install_edit.sh --uninstall # remove everything this installer created
+# bash install_edit.sh --uninstall --components photo
+#
+# Components (free ArtCraft apps by storytold, Apache-2.0, pinned in versions.json)
+# film FilmCraft timeline editor (Premiere class)
+# sound SoundCraft multitrack audio workstation (mix, ducking, bounce)
+# effect EffectCraft layered, keyframed compositing (After Effects class)
+# photo PhotoCraft image editing (thumbnails, title cards)
+# vector VectorCraft vector drawing (logos, lower thirds as SVG)
+#
+# Each download is checked against the release's SHA256SUMS.txt and against the hash pinned in
+# versions.json. When gpg is installed, SHA256SUMS.txt's signature is checked too.
+# Installs into $B2M_EDIT_HOME (default ~/.brief2mp4/edit), copying versions.json and the recipes
+# there so the pack keeps working if this folder moves. Safe to run again: finished apps are skipped.
+# Never touches the system PATH: it prints the one line you can add yourself.
+set -euo pipefail
+
+PACK="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+HOME_DIR="${B2M_EDIT_HOME:-$HOME/.brief2mp4/edit}"
+MANIFEST="$HOME_DIR/.b2m-edit-manifest"
+ALL="film sound effect photo vector"
+COMPONENTS="film,sound"; EXPLICIT=0; DRY=0; UNINSTALL=0
+STAGE=""
+
+say() { printf '%s\n' "$*"; }
+die() { printf 'install_edit.sh: %s\n' "$1" >&2; exit "${2:-1}"; }
+
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --components) COMPONENTS="${2:-}"; EXPLICIT=1; shift 2 ;;
+ --components=*) COMPONENTS="${1#*=}"; EXPLICIT=1; shift ;;
+ --dry-run) DRY=1; shift ;;
+ --uninstall) UNINSTALL=1; shift ;;
+ -h|--help) sed -n '2,24p' "$0"; exit 0 ;;
+ *) die "unknown option $1" 2 ;;
+ esac
+done
+COMPONENTS="${COMPONENTS// /,}"
+[[ "$COMPONENTS" == "all" ]] && COMPONENTS="${ALL// /,}"
+[[ -n "$COMPONENTS" ]] || die "--components needs a value (film, sound, effect, photo, vector, all)" 2
+for c in ${COMPONENTS//,/ }; do
+ [[ " $ALL " == *" $c "* ]] || die "unknown component '$c' (film, sound, effect, photo, vector, all)" 2
+done
+
+platform_key() {
+ if [[ -n "${B2M_EDIT_PLATFORM:-}" ]]; then printf '%s' "$B2M_EDIT_PLATFORM"; return; fi # test hook
+ local os arch; os="$(uname -s)"; arch="$(uname -m)"
+ case "$os" in
+ Darwin) printf 'macos-universal' ;;
+ Linux)
+ case "$arch" in
+ x86_64|amd64) printf 'linux-x86_64' ;;
+ aarch64|arm64) printf 'linux-aarch64' ;;
+ *) die "no pinned build for Linux $arch (x86_64 and aarch64 only)" ;;
+ esac ;;
+ MINGW*|MSYS*|CYGWIN*) die "this is Windows: run install_edit.ps1 from PowerShell instead" ;;
+ *) die "unsupported OS $os" ;;
+ esac
+}
+
+# vget <app> <field> [platform]: read one value from versions.json (node is a requirement of the skill itself).
+vget() {
+ command -v node >/dev/null 2>&1 || die "node not found. Install Node.js 22 or newer (the doctor script prints how)."
+ node -e '
+const [, file, app, field, plat] = process.argv;
+const j = JSON.parse(require("fs").readFileSync(file, "utf8"));
+const a = j.apps[app]; if (!a) process.exit(3);
+const s = (a.assets || {})[plat] || {};
+const m = { name: a.name, version: a.version, cli: a.cli, tag: a.tag, file: s.file, sha: s.sha256, bytes: s.bytes,
+ fingerprint: j.signing.fingerprint, source: j.source };
+if (m[field] === undefined) process.exit(4);
+console.log(m[field]);' "$PACK/versions.json" "$1" "$2" "${3:-}"
+}
+
+mb() { awk -v b="$1" 'BEGIN { printf "%.1f", b / 1048576 }'; }
+size_mb() { if [[ -e "$1" ]]; then du -sk "$1" | awk '{printf "%d", $1/1024}'; else echo 0; fi; }
+sha_of() { if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$1" | awk '{print $1}'; else sha256sum "$1" | awk '{print $1}'; fi; }
+rel_cli() { # path of the CLI inside the app folder, per platform
+ case "$2" in linux-*) printf 'bin/%s-cli' "$1" ;; *) printf '%s-cli' "$1" ;; esac
+}
+
+fetch() { # fetch <url> <out>
+ command -v curl >/dev/null 2>&1 || die "curl not found. Install curl and run this again."
+ local quiet="-sS"; [[ -t 2 ]] && quiet="--progress-bar"
+ curl -fL --retry 3 --retry-delay 2 $quiet -o "$2" "$1" || die "download failed: $1"
+}
+
+verify_hash() { # verify_hash <file> <asset> <sums> <pinned>
+ local listed actual
+ listed="$(awk -v f="$2" '$2 == f {print $1}' "$3")"
+ [[ -n "$listed" ]] || die "$2 is not listed in the release's SHA256SUMS.txt"
+ [[ "$listed" == "$4" ]] || die "SHA-256 in the release ($listed) differs from the one pinned in versions.json ($4). Refusing to install."
+ actual="$(sha_of "$1")"
+ [[ "$actual" == "$4" ]] || die "SHA-256 mismatch for $2: got $actual, expected $4."
+ say " sha-256: OK ($2)"
+}
+
+verify_signature() { # verify_signature <dir> <wanted primary-key fingerprint>
+ local dir="$1" want="$2" gh status
+ if ! command -v gpg >/dev/null 2>&1; then
+ say " signature: SKIPPED (gpg not installed; the SHA-256 checks above still ran. Install gnupg to check the release signature too)"
+ return 0
+ fi
+ gh="$(mktemp -d)"; chmod 700 "$gh"
+ # No agent is needed to check a signature; a failed import shows up as a failed verification below.
+ GNUPGHOME="$gh" gpg --batch --quiet --no-autostart --import "$dir/release-signing-key.asc" >/dev/null 2>&1 || true
+ status="$(GNUPGHOME="$gh" gpg --batch --no-autostart --status-fd 1 --verify "$dir/SHA256SUMS.txt.asc" "$dir/SHA256SUMS.txt" 2>/dev/null || true)"
+ rm -rf "${gh:?}"
+ if grep '^\[GNUPG:\] VALIDSIG ' <<<"$status" | awk '{print $NF}' | grep -qx "$want"; then
+ say " signature: OK (SHA256SUMS.txt signed by key ${want:0:8}...${want: -8})"
+ else
+ die "the signature on SHA256SUMS.txt did not verify against the pinned key $want. Nothing was installed."
+ fi
+}
+
+unpack() { # unpack <archive> <dest>
+ mkdir -p "$2"
+ case "$1" in
+ *.zip)
+ if command -v unzip >/dev/null 2>&1; then unzip -q "$1" -d "$2"
+ elif command -v bsdtar >/dev/null 2>&1; then bsdtar -xf "$1" -C "$2"
+ else die "unzip not found. Install it with your package manager and run this again."; fi ;;
+ *.tar.gz) tar -xzf "$1" -C "$2" ;;
+ *) die "do not know how to unpack $1" ;;
+ esac
+}
+
+strip_quarantine() { # macOS only, and only when the flag is present (curl does not set it)
+ [[ "$(uname -s)" == "Darwin" ]] || return 0
+ if xattr -p com.apple.quarantine "$1" >/dev/null 2>&1; then
+ xattr -dr com.apple.quarantine "$(dirname "$1")" 2>/dev/null || true
+ say " macOS: removed the download quarantine flag from $(basename "$1")"
+ else
+ say " macOS: no quarantine flag on $(basename "$1"), nothing to remove"
+ fi
+}
+
+manifest_add() { # manifest_add <relative path>: remember what this installer created
+ touch "$MANIFEST"
+ grep -qxF "$1" "$MANIFEST" || printf '%s\n' "$1" >> "$MANIFEST"
+}
+
+write_launcher() { # write_launcher <cli name> <relative cli path>; relative, so the folder can move
+ mkdir -p "$HOME_DIR/bin"
+ cat > "$HOME_DIR/bin/$1" <<LAUNCH
+#!/usr/bin/env bash
+# brief2mp4 edit pack launcher. Paths are relative to this file, so the folder can move.
+SELF="\${BASH_SOURCE[0]}"
+while [ -L "\$SELF" ]; do T="\$(readlink "\$SELF")"; case "\$T" in /*) SELF="\$T" ;; *) SELF="\$(dirname "\$SELF")/\$T" ;; esac; done
+HERE="\$(cd "\$(dirname "\$SELF")/.." && pwd)"
+exec "\$HERE/${1%-cli}/$2" "\$@"
+LAUNCH
+ chmod +x "$HOME_DIR/bin/$1"
+ manifest_add "bin/$1"
+}
+
+copy_support_files() { # everything the installed pack needs, so it never reads from the clone
+ cp "$PACK/versions.json" "$HOME_DIR/versions.json"
+ rm -rf "${HOME_DIR:?}/recipes"; mkdir -p "$HOME_DIR/recipes"
+ cp "$PACK"/recipes/* "$HOME_DIR/recipes/"
+ chmod +x "$HOME_DIR"/recipes/*.sh
+ manifest_add "versions.json"; manifest_add "recipes"
+}
+
+install_app() { # install_app <app> <platform>
+ local app="$1" plat="$2" name ver file sha bytes tag url dest cli top
+ name="$(vget "$app" name)"; ver="$(vget "$app" version)"; tag="$(vget "$app" tag)"
+ file="$(vget "$app" file "$plat")" || die "$name $ver has no build for $plat"
+ sha="$(vget "$app" sha "$plat")"; bytes="$(vget "$app" bytes "$plat")"
+ url="$(vget "$app" source)/$name/releases/download/$tag"
+ dest="$HOME_DIR/$name"; cli="$dest/$(rel_cli "$name" "$plat")"
+ if [[ "$DRY" == 1 ]]; then say "$app: $name $ver ($plat) would download $file, $(mb "$bytes") MB, from $url/$file"; return; fi
+ if [[ -x "$cli" && "$(cat "$dest/.b2m-version" 2>/dev/null || true)" == "$ver" ]]; then
+ say "$app: $name $ver already installed ($(size_mb "$dest") MB at $dest)"
+ write_launcher "$name-cli" "$(rel_cli "$name" "$plat")"; manifest_add "$name"; return
+ fi
+ say "$app: downloading $name $ver ($(mb "$bytes") MB) for $plat"
+ fetch "$url/$file" "$STAGE/$file"
+ for f in SHA256SUMS.txt SHA256SUMS.txt.asc release-signing-key.asc; do fetch "$url/$f" "$STAGE/$f"; done
+ verify_hash "$STAGE/$file" "$file" "$STAGE/SHA256SUMS.txt" "$sha"
+ verify_signature "$STAGE" "$(vget "$app" fingerprint)"
+ unpack "$STAGE/$file" "$STAGE/x"
+ top="$(find "$STAGE/x" -mindepth 1 -maxdepth 1 -type d | head -1)"
+ [[ -n "$top" ]] || die "$file had no folder inside"
+ rm -rf "${dest:?}.new"; mv "$top" "$dest.new"
+ if [[ -d "$dest" ]]; then rm -rf "${dest:?}"; fi
+ mv "$dest.new" "$dest"
+ chmod +x "$cli" 2>/dev/null || true
+ strip_quarantine "$cli"
+ "$cli" --version >/dev/null 2>&1 || die "$cli was installed but does not run. Try: $cli --version"
+ printf '%s\n' "$ver" > "$dest/.b2m-version"
+ write_launcher "$name-cli" "$(rel_cli "$name" "$plat")"; manifest_add "$name"
+ say "$app: done, $("$cli" --version | head -1), $(size_mb "$dest") MB on disk"
+}
+
+safe_rel() { [[ "$1" =~ ^[A-Za-z0-9._][A-Za-z0-9._/-]*$ && "$1" != *..* ]]; }
+
+uninstall() {
+ [[ -f "$MANIFEST" ]] || { say "nothing to remove: $HOME_DIR has no edit-pack manifest (this installer created nothing there)"; return 0; }
+ local keep="" rel app freed=0 wanted=" "
+ if [[ "$EXPLICIT" == 1 ]]; then
+ for app in ${COMPONENTS//,/ }; do wanted+="$(vget "$app" name) $(vget "$app" cli) "; done
+ fi
+ while IFS= read -r rel; do
+ [[ -n "$rel" ]] || continue
+ safe_rel "$rel" || { say "skipping unsafe manifest entry: $rel"; keep+="$rel"$'\n'; continue; }
+ if [[ "$EXPLICIT" == 1 && "$wanted" != *" ${rel#bin/} "* ]]; then keep+="$rel"$'\n'; continue; fi
+ if [[ -e "$HOME_DIR/$rel" ]]; then
+ freed=$((freed + $(size_mb "$HOME_DIR/$rel"))); rm -rf "${HOME_DIR:?}/$rel"; say "removed $HOME_DIR/$rel"
+ fi
+ done < "$MANIFEST"
+ if [[ "$EXPLICIT" == 1 && -n "$keep" ]] && ! grep -vxE 'versions\.json|recipes|\.components' <<<"${keep%$'\n'}" >/dev/null; then
+ # The last app is gone: take the shared files this installer made too.
+ while IFS= read -r rel; do
+ if [[ -e "$HOME_DIR/$rel" ]]; then rm -rf "${HOME_DIR:?}/$rel"; say "removed $HOME_DIR/$rel"; fi
+ done <<<"${keep%$'\n'}"
+ keep=""
+ fi
+ if [[ -n "$keep" ]]; then
+ printf '%s' "$keep" > "$MANIFEST"
+ if [[ "$EXPLICIT" == 1 && -f "$HOME_DIR/.components" ]]; then
+ grep -vxF -f <(printf '%s\n' ${COMPONENTS//,/ }) "$HOME_DIR/.components" > "$HOME_DIR/.components.tmp" || true
+ mv "$HOME_DIR/.components.tmp" "$HOME_DIR/.components"
+ fi
+ else
+ rm -f "${MANIFEST:?}" "${HOME_DIR:?}/.components"
+ rmdir "${HOME_DIR:?}/bin" 2>/dev/null || true
+ rmdir "${HOME_DIR:?}" 2>/dev/null || true
+ fi
+ say "uninstall done, about $freed MB freed. Anything else in $HOME_DIR was not created by this installer and was left alone."
+}
+
+record_components() {
+ touch "$HOME_DIR/.components"
+ { cat "$HOME_DIR/.components"; printf '%s\n' ${COMPONENTS//,/ }; } | sort -u > "$HOME_DIR/.components.tmp"
+ mv "$HOME_DIR/.components.tmp" "$HOME_DIR/.components"
+ manifest_add ".components"
+}
+
+cleanup() { if [[ -n "$STAGE" && "$STAGE" == "$HOME_DIR"/.stage-* ]]; then rm -rf "${STAGE:?}"; fi; return 0; }
+
+main() {
+ if [[ "$UNINSTALL" == 1 ]]; then uninstall; return 0; fi
+ local plat app; plat="$(platform_key)"
+ if [[ "$DRY" == 0 ]]; then mkdir -p "$HOME_DIR"; STAGE="$HOME_DIR/.stage-$$"; mkdir -p "$STAGE"; trap cleanup EXIT; fi
+ say "brief2mp4 edit pack: ArtCraft apps by storytold (Apache-2.0), alpha software, versions pinned in versions.json"
+ for app in ${COMPONENTS//,/ }; do install_app "$app" "$plat"; done
+ if [[ "$DRY" == 1 ]]; then return 0; fi
+ copy_support_files; record_components; cleanup
+ say "installed components: $(paste -sd, "$HOME_DIR/.components") total on disk: $(size_mb "$HOME_DIR") MB in $HOME_DIR"
+ say "launchers are in $HOME_DIR/bin and recipes in $HOME_DIR/recipes. To type the launchers anywhere, add this line to your shell profile (this script does not):"
+ say " export PATH=\"$HOME_DIR/bin:\$PATH\""
+ say "to remove everything this installer created: bash install_edit.sh --uninstall"
+}
+
+main
diff --git a/plugin/skills/brief2mp4/edit/recipes/_lib.sh b/plugin/skills/brief2mp4/edit/recipes/_lib.sh
new file mode 100755
index 0000000..e6f87d9
--- /dev/null
+++ b/plugin/skills/brief2mp4/edit/recipes/_lib.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+# _lib.sh: helpers shared by the edit-pack recipes. Source it; do not run it.
+#
+# The recipes use the pinned CLIs from $B2M_EDIT_HOME (default ~/.brief2mp4/edit), never whatever
+# older copy happens to be on the PATH. Works from the skill folder and from the installed copy,
+# on macOS, Linux and Windows (Git Bash).
+
+B2M_EDIT_HOME="${B2M_EDIT_HOME:-$HOME/.brief2mp4/edit}"
+B2M_RECIPE="${B2M_RECIPE:-recipe}"
+
+b2m_die() { printf '%s: %s\n' "$B2M_RECIPE" "$1" >&2; exit "${2:-1}"; }
+
+b2m_need() { command -v "$1" >/dev/null 2>&1 || b2m_die "$1 not found. The skill's doctor script (scripts/doctor.sh) prints how to install it." 3; }
+
+# b2m_cli <app folder>: path of the pinned CLI, for any of the three layouts (macOS, Linux bin/, Windows .exe).
+b2m_cli() {
+ local n="$1" c
+ for c in "$B2M_EDIT_HOME/$n/$n-cli" "$B2M_EDIT_HOME/$n/bin/$n-cli" "$B2M_EDIT_HOME/$n/$n-cli.exe"; do
+ if [[ -f "$c" ]]; then printf '%s' "$c"; return 0; fi
+ done
+ b2m_die "$n-cli is not installed in $B2M_EDIT_HOME. Install it with: bash <skill folder>/edit/install_edit.sh --components ${n%craft}" 3
+}
+
+# b2m_abs <path>: absolute path, then native form (C:/... under Git Bash) for the Windows .exe files.
+b2m_abs() {
+ local p="$1"
+ case "$p" in /*|[A-Za-z]:*) ;; *) p="$PWD/$p" ;; esac
+ if command -v cygpath >/dev/null 2>&1; then cygpath -m "$p"; else printf '%s' "$p"; fi
+}
+
+# b2m_str <text>: the text as a JSON string (quotes, backslashes, newlines escaped).
+b2m_str() { node -p 'JSON.stringify(process.argv[1])' -- "$1"; }
+
+# b2m_pick <js expression>: read the CLI's JSON-lines output on stdin as array L, print the expression.
+b2m_pick() {
+ node -e '
+const L = require("fs").readFileSync(0, "utf8").split("\n").filter(s => s.trim().startsWith("{")).map(s => JSON.parse(s));
+const v = (function (L) { return eval(process.argv[1]); })(L);
+console.log(Array.isArray(v) ? v.join(" ") : v);' "$1"
+}
+
+# b2m_secs <file>: duration of a media file in seconds.
+b2m_secs() { ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 "$1" | head -1; }
+
+# b2m_workdir: a fresh temp folder, removed when the recipe exits (unless B2M_KEEP_WORK=1).
+b2m_workdir() {
+ B2M_WORK="$(mktemp -d)"
+ if [[ "${B2M_KEEP_WORK:-0}" != 1 ]]; then trap 'rm -rf "${B2M_WORK:?}"' EXIT; fi
+}
+
+b2m_usage() { sed -n '2,/^set -/p' "$1" | sed '$d' | sed 's/^# \{0,1\}//'; }
diff --git a/plugin/skills/brief2mp4/edit/recipes/effect_title.sh b/plugin/skills/brief2mp4/edit/recipes/effect_title.sh
new file mode 100755
index 0000000..4e9f3f4
--- /dev/null
+++ b/plugin/skills/brief2mp4/edit/recipes/effect_title.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+# effect_title.sh: EffectCraft, headless. Render an animated title: a text layer with the Tracking In
+# animation preset, a fade and a rise, plus an accent bar that grows underneath. Pinned CLI: effectcraft 0.24.1.
+#
+# effect_title.sh --out title.mp4
+# effect_title.sh --text "Chapter one" --seconds 4 --size 1920x1080 --out title.mp4
+#
+# Options
+# --text TEXT the title (default "Edit pack")
+# --seconds S length (default 3)
+# --size WxH, --fps N composition format (default 1280x720, 30)
+# --bg HEX, --ink HEX, --accent HEX colours (default #1b2a41, #f5f5f5, #ffb224)
+# --save-project FILE also keep the EffectCraft project (.ecproj)
+# --out FILE output MP4, H.264, silent (default effect_title.mp4)
+# Command ids used (discover them again with `effectcraft-cli commands`; ids change between versions):
+# comp.new layer.newSolid layer.newText layer.applyTextPreset prop.addKey, and `render` for the file
+set -euo pipefail
+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+B2M_RECIPE=effect_title; source "$HERE/_lib.sh"
+
+TEXT="Edit pack" SECS=3 SIZE=1280x720 FPS=30 BG="#1b2a41" INK="#f5f5f5" ACCENT="#ffb224" KEEP="" OUT=effect_title.mp4
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --text) TEXT="$2"; shift 2 ;; --seconds) SECS="$2"; shift 2 ;; --size) SIZE="$2"; shift 2 ;; --fps) FPS="$2"; shift 2 ;;
+ --bg) BG="$2"; shift 2 ;; --ink) INK="$2"; shift 2 ;; --accent) ACCENT="$2"; shift 2 ;;
+ --save-project) KEEP="$2"; shift 2 ;; --out) OUT="$2"; shift 2 ;; -h|--help) b2m_usage "$0"; exit 0 ;;
+ *) b2m_die "unknown option $1" 2 ;;
+ esac
+done
+b2m_need ffprobe; b2m_need node
+CLI="$(b2m_cli effectcraft)"; W="${SIZE%x*}"; H="${SIZE#*x}"; b2m_workdir
+CX=$((W / 2)); CY=$((H / 2)); FS=$((H / 6)); BAR=$((W * 3 / 10))
+
+cat > "$B2M_WORK/c.jsonl" <<JSON
+{"command":"comp.new","params":{"name":"Title","width":$W,"height":$H,"frameRate":$FPS,"duration":$SECS,"background":$(b2m_str "$BG")}}
+{"command":"layer.newText","params":{"name":"Headline","text":$(b2m_str "$TEXT"),"size":$FS,"fill":$(b2m_str "$INK"),"position":[$CX,$CY]}}
+{"command":"layer.applyTextPreset","params":{"layer":"Headline","preset":"trackingIn"}}
+{"command":"prop.addKey","params":{"layer":"Headline","path":"transform/position","time":0,"value":[$CX,$((CY + H / 12)),0]}}
+{"command":"prop.addKey","params":{"layer":"Headline","path":"transform/position","time":1,"value":[$CX,$CY,0]}}
+{"command":"prop.addKey","params":{"layer":"Headline","path":"transform/opacity","time":0,"value":0}}
+{"command":"prop.addKey","params":{"layer":"Headline","path":"transform/opacity","time":0.6,"value":100}}
+{"command":"layer.newSolid","params":{"name":"Bar","color":$(b2m_str "$ACCENT"),"width":$BAR,"height":$((H / 90 + 4))}}
+{"command":"prop.set","params":{"layer":"Bar","path":"transform/position","value":[$CX,$((CY + H / 6)),0]}}
+{"command":"prop.addKey","params":{"layer":"Bar","path":"transform/scale","time":0.4,"value":[0,100,100]}}
+{"command":"prop.addKey","params":{"layer":"Bar","path":"transform/scale","time":1.4,"value":[100,100,100]}}
+JSON
+PROJ="$(b2m_abs "$B2M_WORK/p.ecproj")"; mkdir -p "$(dirname "$OUT")"
+"$CLI" --empty run --commands "$(b2m_abs "$B2M_WORK/c.jsonl")" --save-as "$PROJ" --json > "$B2M_WORK/run.log" 2>&1 || b2m_die "effectcraft-cli failed: $(cat "$B2M_WORK/run.log")"
+"$CLI" --project "$PROJ" render --out "$(b2m_abs "$OUT")" --format h264 --audio off > "$B2M_WORK/render.log" 2>&1 || b2m_die "render failed: $(cat "$B2M_WORK/render.log")"
+[[ -z "$KEEP" ]] || cp "$B2M_WORK/p.ecproj" "$KEEP"
+[[ -s "$OUT" ]] || b2m_die "EffectCraft reported success but $OUT is missing"
+echo "ok: $OUT ($(b2m_secs "$OUT") s, ${W}x${H}) rendered with effectcraft"
diff --git a/plugin/skills/brief2mp4/edit/recipes/film_timeline.sh b/plugin/skills/brief2mp4/edit/recipes/film_timeline.sh
new file mode 100755
index 0000000..9f1cd73
--- /dev/null
+++ b/plugin/skills/brief2mp4/edit/recipes/film_timeline.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+# film_timeline.sh: FilmCraft, headless. Cut two clips together on a timeline with a cross dissolve and
+# a title, then export an MP4. Pinned CLI: filmcraft 0.20.1.
+#
+# film_timeline.sh --out cut.mp4
+# film_timeline.sh --clip-a a.mp4 --clip-b b.mp4 --title "Step one" --out cut.mp4
+#
+# Options
+# --clip-a FILE, --clip-b FILE footage with audio (default: two generated 4 s test clips)
+# --title TEXT title burned in from 0.5 s for 2 s (default "Hello edit pack")
+# --each S seconds taken from each clip (default 2.5)
+# --dissolve S cross dissolve length, centred on the cut (default 1)
+# --size WxH, --fps N sequence format (default 1280x720, 30)
+# --crf N x264 quality for the export, lower is better (default 23)
+# --save-project FILE also keep the FilmCraft project (.fcproj)
+# --out FILE output MP4 (default film_timeline.mp4)
+# Command ids used (discover them again with `filmcraft-cli commands`; ids change between versions):
+# file.newProject file.newSequence file.import timeline.place sequence.applyVideoTransition
+# graphics.newText file.exportMedia
+set -euo pipefail
+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+B2M_RECIPE=film_timeline; source "$HERE/_lib.sh"
+
+A="" B="" TITLE="Hello edit pack" EACH=2.5 DISSOLVE=1 SIZE=1280x720 FPS=30 CRF=23 KEEP="" OUT=film_timeline.mp4
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --clip-a) A="$2"; shift 2 ;; --clip-b) B="$2"; shift 2 ;; --title) TITLE="$2"; shift 2 ;;
+ --each) EACH="$2"; shift 2 ;; --dissolve) DISSOLVE="$2"; shift 2 ;; --size) SIZE="$2"; shift 2 ;;
+ --fps) FPS="$2"; shift 2 ;; --crf) CRF="$2"; shift 2 ;; --save-project) KEEP="$2"; shift 2 ;;
+ --out) OUT="$2"; shift 2 ;; -h|--help) b2m_usage "$0"; exit 0 ;;
+ *) b2m_die "unknown option $1" 2 ;;
+ esac
+done
+b2m_need ffmpeg; b2m_need ffprobe; b2m_need node
+CLI="$(b2m_cli filmcraft)"; W="${SIZE%x*}"; H="${SIZE#*x}"
+b2m_workdir
+TICKS() { awk -v s="$1" 'BEGIN { printf "%.0f", s * 254016000000 }'; }
+
+if [[ -z "$A" ]]; then
+ ffmpeg -v error -y -f lavfi -i "testsrc2=size=${SIZE}:rate=$FPS:duration=4" -f lavfi -i "sine=frequency=440:duration=4" \
+ -c:v libx264 -pix_fmt yuv420p -c:a aac -shortest "$B2M_WORK/a.mp4"; A="$B2M_WORK/a.mp4"
+fi
+if [[ -z "$B" ]]; then
+ ffmpeg -v error -y -f lavfi -i "gradients=size=${SIZE}:rate=$FPS:duration=4" -f lavfi -i "sine=frequency=330:duration=4" \
+ -c:v libx264 -pix_fmt yuv420p -c:a aac -shortest "$B2M_WORK/b.mp4"; B="$B2M_WORK/b.mp4"
+fi
+NEED="$(awk -v e="$EACH" -v d="$DISSOLVE" 'BEGIN { print e + d / 2 }')"
+for f in "$A" "$B"; do
+ awk -v have="$(b2m_secs "$f")" -v need="$NEED" 'BEGIN { exit !(have + 0.001 >= need) }' \
+ || b2m_die "$f is shorter than $NEED s (--each plus half the dissolve, so the dissolve has spare frames to blend)" 2
+done
+
+PROJ="$(b2m_abs "$B2M_WORK/p.fcproj")"; OUT_ABS="$(b2m_abs "$OUT")"; mkdir -p "$(dirname "$OUT")"
+run() { local out; out="$("$CLI" "$@" 2>&1)" || b2m_die "filmcraft-cli failed: $out"; printf '%s\n' "$out"; }
+
+# Stage 1: project, sequence, import.
+cat > "$B2M_WORK/s1.jsonl" <<JSON
+{"id":"file.newProject","params":{"name":"b2m-film"}}
+{"id":"file.newSequence","params":{"name":"Main","width":$W,"height":$H,"fps":$FPS}}
+{"id":"file.import","params":{"paths":[$(b2m_str "$(b2m_abs "$A")"),$(b2m_str "$(b2m_abs "$B")")]}}
+JSON
+OUT1="$(run run "$(b2m_abs "$B2M_WORK/s1.jsonl")" --save-as "$PROJ")"
+ERR="$(b2m_pick 'L.find(x => x.id === "file.import").result.errors.length' <<<"$OUT1")"
+[[ "$ERR" == 0 ]] || b2m_die "FilmCraft could not import the clips: $OUT1"
+IDS=($(b2m_pick 'L.find(x => x.id === "file.import").result.items' <<<"$OUT1"))
+
+# Stage 2: place both clips back to back; the second one starts DISSOLVE/2 early in its source (spare frames).
+HALF="$(awk -v d="$DISSOLVE" 'BEGIN { print d / 2 }')"
+cat > "$B2M_WORK/s2.jsonl" <<JSON
+{"id":"timeline.place","params":{"item":${IDS[0]},"track":"V1","seconds":0,"sourceIn":{"seconds":0},"duration":{"seconds":$EACH}}}
+{"id":"timeline.place","params":{"item":${IDS[1]},"track":"V1","seconds":$EACH,"sourceIn":{"seconds":$HALF},"duration":{"seconds":$EACH}}}
+JSON
+OUT2="$(run --project "$PROJ" --save run "$(b2m_abs "$B2M_WORK/s2.jsonl")")"
+VIDEO_A="$(b2m_pick 'L[0].result.clips[0]' <<<"$OUT2")"
+
+# Stage 3: dissolve at the cut, title on V2, export.
+FRAMES="$(awk -v d="$DISSOLVE" -v f="$FPS" 'BEGIN { printf "%d", d * f + 0.5 }')"
+cat > "$B2M_WORK/s3.jsonl" <<JSON
+{"id":"sequence.applyVideoTransition","params":{"clip":$VIDEO_A,"effect":"cross_dissolve","edge":"out","frames":$FRAMES,"align":"center"}}
+{"id":"graphics.newText","params":{"text":$(b2m_str "$TITLE"),"size":$((H / 8)),"position":[$((W / 12)),$((H * 5 / 6))],"seconds":2,"time":$(TICKS 0.5),"track":2}}
+{"id":"file.exportMedia","params":{"path":$(b2m_str "$OUT_ABS"),"format":"h264","bitrateMode":"crf","crf":$CRF,"wait":true}}
+JSON
+run --project "$PROJ" --save run "$(b2m_abs "$B2M_WORK/s3.jsonl")" >/dev/null
+[[ -z "$KEEP" ]] || cp "$B2M_WORK/p.fcproj" "$KEEP"
+[[ -s "$OUT" ]] || b2m_die "FilmCraft reported success but $OUT is missing"
+echo "ok: $OUT ($(b2m_secs "$OUT") s, ${W}x${H}) cut with filmcraft"
diff --git a/plugin/skills/brief2mp4/edit/recipes/photo_thumbnail.sh b/plugin/skills/brief2mp4/edit/recipes/photo_thumbnail.sh
new file mode 100755
index 0000000..3d8e8fd
--- /dev/null
+++ b/plugin/skills/brief2mp4/edit/recipes/photo_thumbnail.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+# photo_thumbnail.sh: PhotoCraft, headless. Make a thumbnail or title-card PNG: a gradient background
+# with a large title and a subtitle. Pinned CLI: photocraft 0.23.1.
+#
+# photo_thumbnail.sh --out thumb.png
+# photo_thumbnail.sh --title "Cut faster" --subtitle "Three editing habits" --size 1920x1080 --out card.png
+#
+# Options
+# --title TEXT, --subtitle TEXT defaults "Edit pack" and "real editing, headless"
+# --size WxH default 1280x720
+# --from HEX, --to HEX gradient colours (default #1b2a41 to #324a5f)
+# --ink HEX, --accent HEX title and subtitle colours (default #f5f5f5, #ffb224)
+# --out FILE output PNG (default photo_thumbnail.png)
+# Command ids used (discover them again with `photocraft-cli commands`; ids change between versions):
+# layer.newFillLayer.gradient type.create, started from `run --new`
+set -euo pipefail
+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+B2M_RECIPE=photo_thumbnail; source "$HERE/_lib.sh"
+
+TITLE="Edit pack" SUB="real editing, headless" SIZE=1280x720 FROM="#1b2a41" TO="#324a5f" INK="#f5f5f5" ACCENT="#ffb224" OUT=photo_thumbnail.png
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --title) TITLE="$2"; shift 2 ;; --subtitle) SUB="$2"; shift 2 ;; --size) SIZE="$2"; shift 2 ;;
+ --from) FROM="$2"; shift 2 ;; --to) TO="$2"; shift 2 ;; --ink) INK="$2"; shift 2 ;; --accent) ACCENT="$2"; shift 2 ;;
+ --out) OUT="$2"; shift 2 ;; -h|--help) b2m_usage "$0"; exit 0 ;;
+ *) b2m_die "unknown option $1" 2 ;;
+ esac
+done
+b2m_need node
+CLI="$(b2m_cli photocraft)"; W="${SIZE%x*}"; H="${SIZE#*x}"
+X=$((W * 7 / 100)); TS=$((H / 6)); SS=$((H / 16)) # type sizes are in points, which are pixels at 72 ppi
+mkdir -p "$(dirname "$OUT")"
+LOG="$("$CLI" run --new "{\"width\":$W,\"height\":$H,\"background\":$(b2m_str "$FROM")}" \
+ --cmd layer.newFillLayer.gradient --params "{\"from\":$(b2m_str "$FROM"),\"to\":$(b2m_str "$TO"),\"angle\":45}" \
+ --cmd type.create --params "{\"x\":$X,\"y\":$((H / 2)),\"text\":$(b2m_str "$TITLE"),\"size\":$TS,\"color\":$(b2m_str "$INK")}" \
+ --cmd type.create --params "{\"x\":$((X + 4)),\"y\":$((H / 2 + H / 8)),\"text\":$(b2m_str "$SUB"),\"size\":$SS,\"color\":$(b2m_str "$ACCENT")}" \
+ --out "$(b2m_abs "$OUT")" 2>&1)" || b2m_die "photocraft-cli failed: $LOG"
+[[ -s "$OUT" ]] || b2m_die "PhotoCraft reported success but $OUT is missing"
+echo "ok: $OUT (${W}x${H}) made with photocraft"
diff --git a/plugin/skills/brief2mp4/edit/recipes/sound_mix.sh b/plugin/skills/brief2mp4/edit/recipes/sound_mix.sh
new file mode 100755
index 0000000..57286fc
--- /dev/null
+++ b/plugin/skills/brief2mp4/edit/recipes/sound_mix.sh
@@ -0,0 +1,65 @@
+#!/usr/bin/env bash
+# sound_mix.sh: SoundCraft, headless. Mix a voice track over a music bed, duck the bed while the voice
+# speaks (volume automation on the music track), and bounce a WAV. Pinned CLI: soundcraft 0.20.1.
+#
+# sound_mix.sh --out mix.wav
+# sound_mix.sh --voice vo.wav --music bed.mp3 --voice-start 2 --duck-db -18 --out mix.wav
+#
+# Options
+# --voice FILE, --music FILE any audio ffmpeg can read (default: a generated voice-like tone and a chord bed)
+# --voice-start S where the voice starts on the timeline (default 2)
+# --bed-db DB music level while nobody speaks (default -6)
+# --duck-db DB music level while the voice speaks (default -18)
+# --ramp S length of each duck down and back up (default 0.3)
+# --out FILE bounced WAV, 48 kHz stereo (default sound_mix.wav)
+# Command ids used (discover them again with `soundcraft-cli commands`; ids change between versions):
+# session.new file.import_audio mix.volume automation.set_point, and `run --bounce` for the bounce
+set -euo pipefail
+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+B2M_RECIPE=sound_mix; source "$HERE/_lib.sh"
+
+VOICE="" MUSIC="" VS=2 BED=-6 DUCK=-18 RAMP=0.3 OUT=sound_mix.wav
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --voice) VOICE="$2"; shift 2 ;; --music) MUSIC="$2"; shift 2 ;; --voice-start) VS="$2"; shift 2 ;;
+ --bed-db) BED="$2"; shift 2 ;; --duck-db) DUCK="$2"; shift 2 ;; --ramp) RAMP="$2"; shift 2 ;;
+ --out) OUT="$2"; shift 2 ;; -h|--help) b2m_usage "$0"; exit 0 ;;
+ *) b2m_die "unknown option $1" 2 ;;
+ esac
+done
+b2m_need ffmpeg; b2m_need ffprobe; b2m_need node
+CLI="$(b2m_cli soundcraft)"; b2m_workdir
+
+# The files are copied in as voice.wav and music.wav, so the tracks are named "voice" and "music".
+if [[ -z "$VOICE" ]]; then
+ ffmpeg -v error -y -f lavfi -i "sine=frequency=140:duration=5,tremolo=f=4:d=0.9,volume=4" "$B2M_WORK/v_in.wav"; VOICE="$B2M_WORK/v_in.wav"
+fi
+if [[ -z "$MUSIC" ]]; then
+ ffmpeg -v error -y -f lavfi -i "sine=frequency=220:duration=10" -f lavfi -i "sine=frequency=277:duration=10" \
+ -f lavfi -i "sine=frequency=330:duration=10" -filter_complex "amix=inputs=3:normalize=0,volume=4" "$B2M_WORK/m_in.wav"; MUSIC="$B2M_WORK/m_in.wav"
+fi
+ffmpeg -v error -y -i "$VOICE" -ar 48000 -c:a pcm_s24le "$B2M_WORK/voice.wav"
+ffmpeg -v error -y -i "$MUSIC" -ar 48000 -c:a pcm_s24le "$B2M_WORK/music.wav"
+VDUR="$(b2m_secs "$B2M_WORK/voice.wav")"
+
+# Duck times: down just before the voice, back up just after it.
+T() { awk -v a="$VS" -v b="$VDUR" -v r="$RAMP" -v w="$1" 'BEGIN {
+ s = a - r; if (s < 0) s = 0
+ if (w == "down0") print s; if (w == "down1") print s + r
+ if (w == "up0") print a + b; if (w == "up1") print a + b + r }'; }
+P() { printf '{"track":"music","param":"volume","at":{"seconds":%s},"value":%s}' "$1" "$2"; }
+
+mkdir -p "$(dirname "$OUT")"
+"$CLI" run \
+ --cmd 'session.new={"name":"b2m-mix","sample_rate":48000}' \
+ --cmd "file.import_audio={\"path\":$(b2m_str "$(b2m_abs "$B2M_WORK/music.wav")")}" \
+ --cmd "file.import_audio={\"path\":$(b2m_str "$(b2m_abs "$B2M_WORK/voice.wav")"),\"at\":{\"seconds\":$VS}}" \
+ --cmd "mix.volume={\"track\":\"music\",\"db\":$BED}" \
+ --cmd "automation.set_point=$(P 0 "$BED")" \
+ --cmd "automation.set_point=$(P "$(T down0)" "$BED")" \
+ --cmd "automation.set_point=$(P "$(T down1)" "$DUCK")" \
+ --cmd "automation.set_point=$(P "$(T up0)" "$DUCK")" \
+ --cmd "automation.set_point=$(P "$(T up1)" "$BED")" \
+ --bounce "$(b2m_abs "$OUT")" > "$B2M_WORK/run.log" 2>&1 || b2m_die "soundcraft-cli failed: $(cat "$B2M_WORK/run.log")"
+[[ -s "$OUT" ]] || b2m_die "SoundCraft reported success but $OUT is missing"
+echo "ok: $OUT ($(b2m_secs "$OUT") s) mixed with soundcraft; $(tail -1 "$B2M_WORK/run.log")"
diff --git a/plugin/skills/brief2mp4/edit/recipes/vector_lower_third.sh b/plugin/skills/brief2mp4/edit/recipes/vector_lower_third.sh
new file mode 100755
index 0000000..0eae6cd
--- /dev/null
+++ b/plugin/skills/brief2mp4/edit/recipes/vector_lower_third.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+# vector_lower_third.sh: VectorCraft, headless. Draw a lower third (rounded panel, accent bar, name and
+# role) and export it as an SVG you can place in a video. Pinned CLI: vectorcraft 0.24.1.
+#
+# vector_lower_third.sh --out lower_third.svg
+# vector_lower_third.sh --name "Alex Doe" --role "Video editor" --out lower_third.svg
+#
+# Options
+# --name TEXT, --role TEXT defaults "Presenter Name" and "Role or topic line"
+# --width N, --height N artboard in pixels (default 1280 x 200)
+# --panel HEX, --ink HEX, --accent HEX colours (default #1b2a41, #f5f5f5, #ffb224)
+# --out FILE output SVG (default vector_lower_third.svg); transparent background
+# Command ids used (discover them again with `vectorcraft-cli commands`; ids change between versions):
+# file.new shape.rectangle paint.setFill paint.setStroke text.create, then `run --export`
+set -euo pipefail
+HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+B2M_RECIPE=vector_lower_third; source "$HERE/_lib.sh"
+
+NAME="Presenter Name" ROLE="Role or topic line" W=1280 H=200 PANEL="#1b2a41" INK="#f5f5f5" ACCENT="#ffb224" OUT=vector_lower_third.svg
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --name) NAME="$2"; shift 2 ;; --role) ROLE="$2"; shift 2 ;; --width) W="$2"; shift 2 ;; --height) H="$2"; shift 2 ;;
+ --panel) PANEL="$2"; shift 2 ;; --ink) INK="$2"; shift 2 ;; --accent) ACCENT="$2"; shift 2 ;;
+ --out) OUT="$2"; shift 2 ;; -h|--help) b2m_usage "$0"; exit 0 ;;
+ *) b2m_die "unknown option $1" 2 ;;
+ esac
+done
+b2m_need node
+CLI="$(b2m_cli vectorcraft)"; b2m_workdir
+PW=$((W * 70 / 100)); PY=$((H / 5)); PH=$((H * 3 / 5)); NS=$((PH * 36 / 100)); RS=$((PH * 22 / 100)); TX=$((PW / 20))
+NONE='{"none":true}'
+cat > "$B2M_WORK/c.jsonl" <<JSON
+{"command":"file.new","params":{"name":"LowerThird","width":$W,"height":$H,"units":"Pixels","backgroundContents":"transparent"}}
+{"command":"shape.rectangle","params":{"x":0,"y":$PY,"width":$PW,"height":$PH,"radius":8}}
+{"command":"paint.setFill","params":{"color":$(b2m_str "$PANEL")}}
+{"command":"paint.setStroke","params":$NONE}
+{"command":"shape.rectangle","params":{"x":0,"y":$PY,"width":12,"height":$PH}}
+{"command":"paint.setFill","params":{"color":$(b2m_str "$ACCENT")}}
+{"command":"paint.setStroke","params":$NONE}
+{"command":"text.create","params":{"x":$TX,"y":$((PY + PH * 5 / 9)),"text":$(b2m_str "$NAME"),"size":$NS,"color":$(b2m_str "$INK")}}
+{"command":"text.create","params":{"x":$TX,"y":$((PY + PH * 5 / 6)),"text":$(b2m_str "$ROLE"),"size":$RS,"color":$(b2m_str "$ACCENT")}}
+JSON
+mkdir -p "$(dirname "$OUT")"
+LOG="$("$CLI" run --commands "$(b2m_abs "$B2M_WORK/c.jsonl")" --export "$(b2m_abs "$OUT")" 2>&1)" || b2m_die "vectorcraft-cli failed: $LOG"
+[[ -s "$OUT" ]] || b2m_die "VectorCraft reported success but $OUT is missing"
+echo "ok: $OUT (${W}x${H} SVG) drawn with vectorcraft"
diff --git a/plugin/skills/brief2mp4/edit/versions.json b/plugin/skills/brief2mp4/edit/versions.json
new file mode 100644
index 0000000..4a3b727
--- /dev/null
+++ b/plugin/skills/brief2mp4/edit/versions.json
@@ -0,0 +1,177 @@
+{
+ "schema": 1,
+ "checked": "2026-11-15",
+ "source": "https://github.com/storytold",
+ "license": "Apache-2.0",
+ "signing": {
+ "key_asset": "release-signing-key.asc",
+ "fingerprint": "2B76741B414AAD6CD33E631213A005C0B9D7C3ED"
+ },
+ "apps": {
+ "film": {
+ "name": "filmcraft",
+ "version": "0.20.1",
+ "cli": "filmcraft-cli",
+ "tag": "v0.20.1",
+ "assets": {
+ "macos-universal": {
+ "file": "filmcraft-cli-0.20.1-macos-universal.zip",
+ "sha256": "1651d9defb54f853cbd69016428bb9f72a7bf26d56e4755b8e2a79535fd0ac82",
+ "bytes": 100056028
+ },
+ "windows-x64": {
+ "file": "filmcraft-0.20.1-windows-x64-portable.zip",
+ "sha256": "bfb00e2089df5f13e6f76aab117a4572a8d005d009c5818989688b140a502710",
+ "bytes": 113447048
+ },
+ "windows-arm64": {
+ "file": "filmcraft-0.20.1-windows-arm64-portable.zip",
+ "sha256": "4b20b604d3c2227d052b4b055c78b455ecd404988bdb63c6de1db4e82dfb3806",
+ "bytes": 109053960
+ },
+ "linux-x86_64": {
+ "file": "filmcraft-0.20.1-linux-x86_64.tar.gz",
+ "sha256": "3e4fea3cb8d473e68f189a0a8792ba46160fab507adab3ab8920073fd41f24fa",
+ "bytes": 112162847
+ },
+ "linux-aarch64": {
+ "file": "filmcraft-0.20.1-linux-aarch64.tar.gz",
+ "sha256": "cdce3d832620c7cf7150e6609fd98ad9702e7d4c57f827aab562e87d816ea13f",
+ "bytes": 108309163
+ }
+ }
+ },
+ "sound": {
+ "name": "soundcraft",
+ "version": "0.20.1",
+ "cli": "soundcraft-cli",
+ "tag": "v0.20.1",
+ "assets": {
+ "macos-universal": {
+ "file": "soundcraft-cli-0.20.1-macos-universal.zip",
+ "sha256": "866fcbfe32179e6652159385b4f676ba756e1cadb88fac3e9173e9643f763b51",
+ "bytes": 9011758
+ },
+ "windows-x64": {
+ "file": "soundcraft-0.20.1-windows-x64-portable.zip",
+ "sha256": "9769223e26f727866b249fc5176caa8b3791a98c7d89e901b78f5f48aff03b82",
+ "bytes": 19876437
+ },
+ "windows-arm64": {
+ "file": "soundcraft-0.20.1-windows-arm64-portable.zip",
+ "sha256": "8b339489417ef1237596501a2bf03cac9ea0708c8d873690983712963919d2bd",
+ "bytes": 18266338
+ },
+ "linux-x86_64": {
+ "file": "soundcraft-0.20.1-linux-x86_64.tar.gz",
+ "sha256": "caefcf85c4f1138717d592d31ce5be07f2fca616ec36d63fac6760cdefbe28a9",
+ "bytes": 21894484
+ },
+ "linux-aarch64": {
+ "file": "soundcraft-0.20.1-linux-aarch64.tar.gz",
+ "sha256": "93c6c6e5e37c0e57acea76201faacc777ed0f7b8fb8b86baaa71bb55cfd33dfd",
+ "bytes": 20185891
+ }
+ }
+ },
+ "effect": {
+ "name": "effectcraft",
+ "version": "0.24.1",
+ "cli": "effectcraft-cli",
+ "tag": "v0.24.1",
+ "assets": {
+ "macos-universal": {
+ "file": "effectcraft-cli-0.24.1-macos-universal.zip",
+ "sha256": "2781eda194372ad47f4c0c7df8b1d38501a3e90bb499282f57e9598a85958673",
+ "bytes": 77299801
+ },
+ "windows-x64": {
+ "file": "effectcraft-0.24.1-windows-x64-portable.zip",
+ "sha256": "707bb7480783904e153fd71fd43ffaaf806fbbaa7f803090c2d32f5d920bd996",
+ "bytes": 85071674
+ },
+ "windows-arm64": {
+ "file": "effectcraft-0.24.1-windows-arm64-portable.zip",
+ "sha256": "b4eadf1d19f55cf69aa6ec6076ad754b3ff6bf6210f32811cff40a573b068041",
+ "bytes": 78234941
+ },
+ "linux-x86_64": {
+ "file": "effectcraft-0.24.1-linux-x86_64.tar.gz",
+ "sha256": "5ce0393690144227fa9186e82308ad638a6ef6d9f976c996e6d03b5b51b65a7b",
+ "bytes": 81826579
+ },
+ "linux-aarch64": {
+ "file": "effectcraft-0.24.1-linux-aarch64.tar.gz",
+ "sha256": "ad10c445065681760de9353117c6e2c45167eabcccf0ed19bde2f5c5ac908695",
+ "bytes": 76125337
+ }
+ }
+ },
+ "photo": {
+ "name": "photocraft",
+ "version": "0.23.1",
+ "cli": "photocraft-cli",
+ "tag": "v0.23.1",
+ "assets": {
+ "macos-universal": {
+ "file": "photocraft-cli-0.23.1-macos-universal.zip",
+ "sha256": "a6ecdc6d4add02881642bda0a0b191b4974118651f2ec5641dc71b2c3ff4b752",
+ "bytes": 120474491
+ },
+ "windows-x64": {
+ "file": "photocraft-0.23.1-windows-x64-portable.zip",
+ "sha256": "6317e764ecfa804227c38079311bea489283ab383ef040c81ef2fd6d86bd60b1",
+ "bytes": 143135209
+ },
+ "windows-arm64": {
+ "file": "photocraft-0.23.1-windows-arm64-portable.zip",
+ "sha256": "f02f0e754072836355b4aa8c46496fb0acff18a5fc780084bb4a40a2d9e1ab76",
+ "bytes": 136391920
+ },
+ "linux-x86_64": {
+ "file": "photocraft-0.23.1-linux-x86_64.tar.gz",
+ "sha256": "4383aef67a07cc370ad250a6ed60015205d3e6c463faf3ff4b0f67b8178ccfc8",
+ "bytes": 139481224
+ },
+ "linux-aarch64": {
+ "file": "photocraft-0.23.1-linux-aarch64.tar.gz",
+ "sha256": "fcc81c38ae62c72fa9f4fd1ec3d18396493ba261662792d6995cc35905ce71d2",
+ "bytes": 133431133
+ }
+ }
+ },
+ "vector": {
+ "name": "vectorcraft",
+ "version": "0.24.1",
+ "cli": "vectorcraft-cli",
+ "tag": "v0.24.1",
+ "assets": {
+ "macos-universal": {
+ "file": "vectorcraft-cli-0.24.1-macos-universal.zip",
+ "sha256": "7f0c8261e5c831d9681e48272f9ba73bf8702dbf6ceb84f98177c7c007faddf2",
+ "bytes": 133990423
+ },
+ "windows-x64": {
+ "file": "vectorcraft-0.24.1-windows-x64-portable.zip",
+ "sha256": "589d1c9c7090a05a033462af04042ee0a9dd3a188d7440a9f965799d2d66161d",
+ "bytes": 162939900
+ },
+ "windows-arm64": {
+ "file": "vectorcraft-0.24.1-windows-arm64-portable.zip",
+ "sha256": "885df2b888c3d670c6b0a785813039f9d0426eea00ed750da7ec4cbb0bf8d612",
+ "bytes": 154458186
+ },
+ "linux-x86_64": {
+ "file": "vectorcraft-0.24.1-linux-x86_64.tar.gz",
+ "sha256": "a090514252fde145495ac6fc65d6ff1311d698998e57ba434d5d0896c3d1fbfa",
+ "bytes": 157661878
+ },
+ "linux-aarch64": {
+ "file": "vectorcraft-0.24.1-linux-aarch64.tar.gz",
+ "sha256": "4b9735489789d336c1ca4344689eb4a1d4a3f0b6e8db7f8c0659c24d10653455",
+ "bytes": 150492030
+ }
+ }
+ }
+ }
+}
diff --git a/plugin/skills/brief2mp4/references/formats.md b/plugin/skills/brief2mp4/references/formats.md
index c0b0d7e..024d401 100644
--- a/plugin/skills/brief2mp4/references/formats.md
+++ b/plugin/skills/brief2mp4/references/formats.md
@@ -44,7 +44,7 @@ Checks: every symbol correct (pull stills and read them); colours consistent acr
## Tutorial and screen-recording intros
-Length 5-20 s for an intro, plus lower thirds and callouts over a recording. Route: HyperFrames with the recording as a `<video>` layer; trim and normalise the recording with ffmpeg first (`references/ffmpeg.md`).
+Length 5-20 s for an intro, plus lower thirds and callouts over a recording. Route: HyperFrames with the recording as a `<video>` layer; trim and normalise the recording with ffmpeg first (`references/ffmpeg.md`). When the video is mostly the recording, with several cuts, a voice-over and music, cut it on a timeline with the edit pack (FilmCraft, `edit/recipes/film_timeline.sh`), mix the voice over the music with ducking (SoundCraft, `edit/recipes/sound_mix.sh`), and use HyperFrames for the titles and callouts layered on top.
| Element | How |
|---|---|
@@ -58,7 +58,7 @@ Checks: callouts land on the right UI element at the right time (pull stills at
## Storytelling, skits and character pieces
-Length 15-90 s. Route: HyperFrames with SVG characters or cut-out illustrations; simple 3D props from the Three.js template or the 3D pack. Lip sync and full character animation are outside this skill: use pre-made Lottie or Rive characters ([references/ecosystem.md](ecosystem.md)) seeked by time, or keep characters still and let the camera, captions and props carry the motion.
+Length 15-90 s. Route: HyperFrames with SVG characters or cut-out illustrations; simple 3D props from the Three.js template or the 3D pack. A skit made from recorded takes is an editing job: cut the takes in FilmCraft and mix dialogue, music and sound effects in SoundCraft (edit pack). Lip sync and full character animation are outside this skill: use pre-made Lottie or Rive characters ([references/ecosystem.md](ecosystem.md)) seeked by time, or keep characters still and let the camera, captions and props carry the motion.
| Beat | What is on screen |
|---|---|
diff --git a/plugin/skills/brief2mp4/references/hyperframes.md b/plugin/skills/brief2mp4/references/hyperframes.md
index 3bac45e..eaea56e 100644
--- a/plugin/skills/brief2mp4/references/hyperframes.md
+++ b/plugin/skills/brief2mp4/references/hyperframes.md
@@ -13,7 +13,7 @@ npx hyperframes init . --example blank --non-interactive --skip-skills
cd my-video
```
-This writes `index.html` (the root composition), `hyperframes.json`, `meta.json` and `package.json`. Add `--resolution portrait` for 1080x1920. `--skip-skills` stops `init` from installing HyperFrames' own agent skills into the user's skill folders; leave it off only if the user wants them.
+This writes `index.html` (the root composition), `hyperframes.json`, `meta.json` and `package.json`. Add `--resolution portrait` for 1080x1920. `--skip-skills` stops `init` from installing HyperFrames' own agent skills into the user's skill folders; leave it off only if the user wants them. `init` still writes its own `AGENTS.md` and `CLAUDE.md` into the project folder: they are HyperFrames' notes for agents, harmless, and you can delete them if the user does not want them.
## The composition contract
@@ -84,3 +84,6 @@ Quality presets: `draft` for iterating, `looks` (default) for review, `delivery`
- `render` prints a long trace. The line that matters says `rendered in`; search for it rather than reading the whole log.
- `hyperframes check` and `check_delivery.sh` warn about **holds**: a closing line held still, or a freeze over 1.5 s. When the brief asks for that hold, the warning is expected: say so in REPORT.md next to the brief line that asked for it. When it did not, it is dead air: fix it.
- `hyperframes check` may also suggest a longer closing hold than the brief allows. The brief wins; note the difference in REPORT.md.
+- **Eases, by name.** GSAP's `power1` is quadratic, `power2` cubic, `power3` quartic and `power4` quintic; `.out` decelerates into place (arrivals), `.in` accelerates away (exits), `.inOut` does both. `none` is linear: use it only for constant spins and turntables. When a brief names a feel ("snappy", "soft"), write the ease you chose into SPEC.md.
+- **Freeze warnings and small motion.** `check_delivery.sh` looks for whole-frame freezes. A small element that keeps moving (a counter, a dot) can still trip it, because the change is below its threshold. Pull two stills a second apart inside the flagged stretch and compare them before you call it dead air.
+- **Starting states belong in CSS.** A `tl.set(el, {...}, 0)` at time 0 may not be applied when the renderer captures frame 0, so an element meant to start hidden flashes in the first frame. Put the starting state (`opacity: 0`, an offset transform) in CSS and animate from it; `hyperframes check` warns about this.
diff --git a/plugin/skills/brief2mp4/references/pipelines.md b/plugin/skills/brief2mp4/references/pipelines.md
index c81e504..0e59d3c 100644
--- a/plugin/skills/brief2mp4/references/pipelines.md
+++ b/plugin/skills/brief2mp4/references/pipelines.md
@@ -39,6 +39,8 @@ Route each beat of the beat sheet on its own, not the whole video. A 15 s produc
| A logo or icon that becomes 3D | 3D pack `model` (extrude) + `material` + `reveal` | about a minute |
| Real footage, screen recordings | `<video>` layer in HyperFrames; trim and normalise with ffmpeg first | seconds |
| Captions from a voiceover | HyperFrames caption layer timed to the audio | seconds |
+| Real footage with several cuts, a voice-over and music | edit pack: FilmCraft cut, SoundCraft mix, HyperFrames titles on top | a minute or two |
+| A thumbnail or title card, an SVG lower third or logo | edit pack: PhotoCraft or VectorCraft | seconds |
When the 3D pack is not installed (`scripts/detect_3d.sh` says `not installed`), use the Three.js template for 3D beats and say in REPORT.md that physics and exploded views were animated by hand.
diff --git a/plugin/skills/brief2mp4/scripts/bounds.py b/plugin/skills/brief2mp4/scripts/bounds.py
index 8a75e7b..2d9e271 100644
--- a/plugin/skills/brief2mp4/scripts/bounds.py
+++ b/plugin/skills/brief2mp4/scripts/bounds.py
@@ -15,6 +15,11 @@ PNGs that contact_sheet.sh and ffmpeg write.
Prints one JSON object. Exit 0 when the box is inside the zones (or none were given), 1 otherwise.
A box height is a good proxy for text height when you measure a single line.
+
+Measuring one element (a moving dot, one label): pass a --region that contains only that element,
+then read its box centre: cx = (x0 + x1) / 2, cy = (y0 + y1) / 2. For easing, measure the centre at
+the start, at the end and at the time the brief names: covered = (c_t - c_start) / (c_end - c_start).
+For an orbit, the angle is atan2(cy - circle_y, cx - circle_x) at each still.
"""
import argparse
import json
diff --git a/plugin/skills/brief2mp4/scripts/check_delivery.sh b/plugin/skills/brief2mp4/scripts/check_delivery.sh
index 59a8781..3bc6221 100755
--- a/plugin/skills/brief2mp4/scripts/check_delivery.sh
+++ b/plugin/skills/brief2mp4/scripts/check_delivery.sh
@@ -61,7 +61,7 @@ else
il="$(echo "$stats" | awk '/I:/{v=$2} END{print v}')"
tp="$(echo "$stats" | awk '/Peak:/{v=$2} END{print v}')"
if [[ -z "$il" || "$il" == "-inf" ]] || awk -v i="$il" 'BEGIN{exit !(i < -60)}'; then
- [[ "$SILENT_OK" == 1 ]] && pass "soundtrack silent (brief allows it)" || warn "soundtrack is silent; pass --silent-ok if the brief asked for silence"
+ [[ "$SILENT_OK" == 1 ]] && pass "soundtrack silent (brief allows it)" || fail "soundtrack is silent; fix the audio, or pass --silent-ok if the brief asked for silence"
else
awk -v i="$il" -v t="$LUFS" 'BEGIN{d=i-t; if(d<0)d=-d; exit !(d<=1.5)}' \
&& pass "loudness ${il} LUFS (target ${LUFS})" || fail "loudness ${il} LUFS, target ${LUFS} +/- 1.5"
diff --git a/plugin/skills/brief2mp4/scripts/contact_sheet.sh b/plugin/skills/brief2mp4/scripts/contact_sheet.sh
index 38d00e0..5c8d64b 100755
--- a/plugin/skills/brief2mp4/scripts/contact_sheet.sh
+++ b/plugin/skills/brief2mp4/scripts/contact_sheet.sh
@@ -5,24 +5,29 @@
# contact_sheet.sh final.mp4 # a frame every second
# contact_sheet.sh final.mp4 --at 0.5,3,7.2 # exactly these moments (seconds)
# contact_sheet.sh final.mp4 --every 0.5 --out checks/
+# contact_sheet.sh final.mp4 --at 9.5 --keep # add moments, keep the stills already in checks/
+#
+# By default the stills from an earlier run are deleted first, so a re-render never leaves stale
+# frames behind. Use --keep only when adding moments for the SAME render.
#
# Output: <out>/t_003.00s.png ... and <out>/sheet.png (6 columns, read left to
# right, top to bottom, in time order).
set -euo pipefail
FILE="${1:-}"; shift || true
-EVERY=1 AT="" OUT="checks"
+EVERY=1 AT="" OUT="checks" KEEP=0
while [[ $# -gt 0 ]]; do
case "$1" in
--every) EVERY="$2"; shift 2 ;;
--at) AT="$2"; shift 2 ;;
--out) OUT="$2"; shift 2 ;;
+ --keep) KEEP=1; shift ;;
*) echo "contact_sheet.sh: unknown option $1" >&2; exit 2 ;;
esac
done
-[[ -f "$FILE" ]] || { echo "usage: contact_sheet.sh FILE [--every S | --at t1,t2] [--out DIR]" >&2; exit 2; }
+[[ -f "$FILE" ]] || { echo "usage: contact_sheet.sh FILE [--every S | --at t1,t2] [--out DIR] [--keep]" >&2; exit 2; }
mkdir -p "$OUT"
-rm -f "$OUT"/t_*.png "$OUT"/sheet.png
+if [[ "$KEEP" == 1 ]]; then rm -f "$OUT"/sheet.png; else rm -f "$OUT"/t_*.png "$OUT"/sheet.png; fi
dur="$(ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 "$FILE")"
if [[ -z "$AT" ]]; then
@@ -35,7 +40,7 @@ for t in "${TIMES[@]}"; do
ffmpeg -v error -y -ss "$t" -i "$FILE" -frames:v 1 "$OUT/$name"
done
-n="${#TIMES[@]}"; cols=6; rows=$(( (n + cols - 1) / cols ))
+n="$(ls "$OUT"/t_*.png | wc -l | tr -d " ")"; cols=6; rows=$(( (n + cols - 1) / cols ))
ffmpeg -v error -y -pattern_type glob -i "$OUT/t_*.png" \
-vf "scale=480:-1,tile=${cols}x${rows}:padding=6:color=0x222222" -frames:v 1 "$OUT/sheet.png"
echo "contact_sheet.sh: $n frames in $OUT/, grid at $OUT/sheet.png (6 per row, time order)"
diff --git a/plugin/skills/brief2mp4/scripts/detect_edit.ps1 b/plugin/skills/brief2mp4/scripts/detect_edit.ps1
new file mode 100644
index 0000000..6fd16a4
--- /dev/null
+++ b/plugin/skills/brief2mp4/scripts/detect_edit.ps1
@@ -0,0 +1,42 @@
+# detect_edit.ps1: say whether the optional edit pack is installed. Always exits 0, so a caller can branch on the text.
+#
+# edit: ready (film,sound,effect,photo,vector)
+# edit: not installed
+#
+# A component is listed only when its pinned CLI is there AND runs (<cli> --version exits 0).
+# It needs nothing but B2M_EDIT_HOME (default %USERPROFILE%\.brief2mp4\edit).
+$HomeDir = if ($env:B2M_EDIT_HOME) { $env:B2M_EDIT_HOME } else { Join-Path $env:USERPROFILE ".brief2mp4\edit" }
+$found = @()
+
+function Test-Cli([string]$path) {
+ # Run through .NET so native stderr never becomes a terminating error under $ErrorActionPreference = 'Stop'.
+ try {
+ $psi = New-Object System.Diagnostics.ProcessStartInfo
+ $psi.FileName = $path
+ $psi.Arguments = "--version"
+ $psi.UseShellExecute = $false
+ $psi.RedirectStandardOutput = $true
+ $psi.RedirectStandardError = $true
+ $psi.CreateNoWindow = $true
+ $p = [System.Diagnostics.Process]::Start($psi)
+ $null = $p.StandardOutput.ReadToEnd()
+ $null = $p.StandardError.ReadToEnd()
+ $p.WaitForExit()
+ return ($p.ExitCode -eq 0)
+ } catch { return $false }
+}
+
+foreach ($pair in @("film:filmcraft", "sound:soundcraft", "effect:effectcraft", "photo:photocraft", "vector:vectorcraft")) {
+ $short, $name = $pair -split ":"
+ $candidates = @(
+ (Join-Path $HomeDir "$name\$name-cli.exe"),
+ (Join-Path $HomeDir "$name\bin\$name-cli"),
+ (Join-Path $HomeDir "$name\$name-cli"))
+ foreach ($c in $candidates) {
+ if ((Test-Path $c) -and (Test-Cli $c)) { $found += $short; break }
+ }
+}
+
+if ($found.Count -gt 0) { Write-Output ("edit: ready (" + ($found -join ",") + ")") }
+else { Write-Output "edit: not installed" }
+exit 0
diff --git a/plugin/skills/brief2mp4/scripts/detect_edit.sh b/plugin/skills/brief2mp4/scripts/detect_edit.sh
new file mode 100755
index 0000000..9235b8d
--- /dev/null
+++ b/plugin/skills/brief2mp4/scripts/detect_edit.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+# detect_edit.sh: say whether the optional edit pack is installed. Always exits 0, so a caller can branch on the text.
+#
+# edit: ready (film,sound,effect,photo,vector)
+# edit: not installed
+#
+# A component is listed only when its pinned CLI is there AND runs (`<cli> --version` succeeds), so a
+# half-deleted or broken install does not count as ready. It needs nothing but B2M_EDIT_HOME
+# (default ~/.brief2mp4/edit): not this repository, not the plugin folder.
+set -u
+
+HOME_DIR="${B2M_EDIT_HOME:-$HOME/.brief2mp4/edit}"
+found=()
+
+for pair in film:filmcraft sound:soundcraft effect:effectcraft photo:photocraft vector:vectorcraft; do
+ short="${pair%%:*}"; name="${pair##*:}"
+ for cli in "$HOME_DIR/$name/$name-cli" "$HOME_DIR/$name/bin/$name-cli" "$HOME_DIR/$name/$name-cli.exe"; do
+ if [[ -f "$cli" ]] && "$cli" --version >/dev/null 2>&1; then found+=("$short"); break; fi
+ done
+done
+
+if [[ ${#found[@]} -gt 0 ]]; then
+ (IFS=,; echo "edit: ready (${found[*]})")
+else
+ echo "edit: not installed"
+fi
+exit 0
diff --git a/plugin/skills/brief2mp4/scripts/doctor.sh b/plugin/skills/brief2mp4/scripts/doctor.sh
index cb1888e..f558512 100755
--- a/plugin/skills/brief2mp4/scripts/doctor.sh
+++ b/plugin/skills/brief2mp4/scripts/doctor.sh
@@ -88,6 +88,10 @@ d3="$(bash "$HERE/detect_3d.sh" 2>/dev/null || echo '3d: not installed')"
if [[ "$d3" == *ready* ]]; then row 3d-pack 0 ok "${d3#3d: }"
else row 3d-pack 0 missing "optional. Install: bash \"$(cd "$HERE/.." && pwd)/3d/install_3d.sh\" --components core (Windows: install_3d.ps1 -Components core in the same folder)"; fi
+de="$(bash "$HERE/detect_edit.sh" 2>/dev/null || echo 'edit: not installed')"
+if [[ "$de" == *ready* ]]; then row edit-pack 0 ok "${de#edit: }"
+else row edit-pack 0 missing "optional (ArtCraft editors). Install: bash \"$(cd "$HERE/.." && pwd)/edit/install_edit.sh\" --components film,sound (Windows: install_edit.ps1 -Components film,sound in the same folder)"; fi
+
if [[ "$JSON" == 1 ]]; then
printf '{"os":"%s","ok":%s,"tools":[' "$OS" "$([[ $FAIL == 0 ]] && echo true || echo false)"
sep=""
diff --git a/plugin/skills/brief2mp4/scripts/sound_bed.sh b/plugin/skills/brief2mp4/scripts/sound_bed.sh
index 6864d89..773827a 100755
--- a/plugin/skills/brief2mp4/scripts/sound_bed.sh
+++ b/plugin/skills/brief2mp4/scripts/sound_bed.sh
@@ -34,18 +34,21 @@ EXPR="${PAD}+${PULSE}"
if [[ -n "$HITS" ]]; then
IFS=',' read -r -a H <<< "$HITS"
for h in "${H[@]}"; do
- EXPR="${EXPR}+0.5*sin(2*PI*45*(t-${h}))*exp(-4*(t-${h}))*gte(t\,${h})"
+ EXPR="${EXPR}+0.5*sin(2*PI*45*(t-${h}))*exp(-4*max(t-${h}\,0))*gte(t\,${h})"
done
fi
if [[ -n "$TICKS" ]]; then
IFS=',' read -r -a K <<< "$TICKS"
for k in "${K[@]}"; do
- EXPR="${EXPR}+0.35*sin(2*PI*2400*(t-${k}))*exp(-90*(t-${k}))*gte(t\,${k})"
+ EXPR="${EXPR}+0.35*sin(2*PI*2400*(t-${k}))*exp(-90*max(t-${k}\,0))*gte(t\,${k})"
done
fi
ffmpeg -v error -y -f lavfi -i "aevalsrc=${EXPR}|${EXPR}:s=48000:d=${SECONDS_}" \
-af "afade=t=in:d=0.6,afade=t=out:st=$(awk -v s="$SECONDS_" 'BEGIN{print s-1}'):d=1,lowpass=f=6000" \
-c:a pcm_s16le "$OUT"
+# Guard: a NaN anywhere in the expression silences the whole file, so never report success on silence.
+peak="$(ffmpeg -hide_banner -nostats -i "$OUT" -af volumedetect -f null - 2>&1 | sed -n 's/.*max_volume: *\(-*[0-9.inf]*\) dB.*/\1/p')"
+case "$peak" in ""|-inf|-9[0-9]*|-[1-9][0-9][0-9]*) echo "sound_bed.sh: generated audio is silent (max volume ${peak:-unknown} dB); check --hits/--ticks times" >&2; exit 1 ;; esac
echo "sound_bed.sh: wrote $OUT (${SECONDS_} s, ${BPM} bpm)"
diff --git a/tests/test_edit_common.py b/tests/test_edit_common.py
new file mode 100644
index 0000000..a8d2767
--- /dev/null
+++ b/tests/test_edit_common.py
@@ -0,0 +1,63 @@
+"""Helpers shared by the edit-pack tests (no tests here)."""
+from __future__ import annotations
+
+import json
+import os
+import shutil
+import subprocess
+from pathlib import Path
+
+import pytest
+
+REPO = Path(__file__).resolve().parents[1]
+SKILL = REPO / "plugin" / "skills" / "brief2mp4"
+EDIT = SKILL / "edit"
+RECIPES = EDIT / "recipes"
+SCRIPTS = SKILL / "scripts"
+VERSIONS = json.loads((EDIT / "versions.json").read_text(encoding="utf-8"))
+APPS = ("film", "sound", "effect", "photo", "vector")
+PLATFORMS = ("macos-universal", "windows-x64", "windows-arm64", "linux-x86_64", "linux-aarch64")
+
+BASH = None if os.name == "nt" else "bash"
+posix_only = pytest.mark.skipif(BASH is None, reason="bash scripts (Git Bash on Windows runs the recipes, not this installer)")
+
+
+def run(cmd: list, env: dict | None = None, cwd: Path | None = None, timeout: int = 900) -> subprocess.CompletedProcess:
+ return subprocess.run([str(c) for c in cmd], capture_output=True, text=True, timeout=timeout,
+ env={**os.environ, **(env or {})}, cwd=cwd)
+
+
+def make_stub_cli(path: Path, exit_code: int = 0) -> Path:
+ """A fake pinned CLI: answers --version with the given exit code."""
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(f"#!/bin/sh\necho stub 0.0.0\nexit {exit_code}\n", encoding="utf-8")
+ path.chmod(0o755)
+ return path
+
+
+def ffprobe(path: Path, entries: str, stream: str = "v:0") -> dict:
+ out = subprocess.run(["ffprobe", "-v", "error", "-select_streams", stream, "-show_entries", entries,
+ "-of", "json", str(path)], capture_output=True, text=True, check=True).stdout
+ return json.loads(out)
+
+
+def frame_hash(path: Path, seconds: float, crop: str | None = None) -> str:
+ """md5 of one decoded frame (optionally a crop WxH+X+Y given as ffmpeg crop=w:h:x:y)."""
+ vf = f"crop={crop}," if crop else ""
+ out = subprocess.run(["ffmpeg", "-v", "error", "-ss", str(seconds), "-i", str(path), "-frames:v", "1",
+ "-vf", vf + "format=rgb24", "-f", "md5", "-"], capture_output=True, text=True, check=True).stdout
+ return out.strip()
+
+
+def tone_peak_db(path: Path, start: float, dur: float, freq: int) -> float:
+ """Peak level (dB) of one sine tone in a time window of a WAV, isolated with a band-pass filter."""
+ err = subprocess.run(["ffmpeg", "-hide_banner", "-ss", str(start), "-t", str(dur), "-i", str(path), "-af",
+ f"bandpass=f={freq}:width_type=h:w=40,volumedetect", "-f", "null", "-"],
+ capture_output=True, text=True, check=True).stderr
+ line = next(l for l in err.splitlines() if "max_volume" in l)
+ return float(line.split("max_volume:")[1].split("dB")[0])
+
+
+needs_ffmpeg = pytest.mark.skipif(shutil.which("ffmpeg") is None or shutil.which("ffprobe") is None,
+ reason="ffmpeg/ffprobe not found")
+needs_node = pytest.mark.skipif(shutil.which("node") is None, reason="node not found")
diff --git a/tests/test_edit_fast.py b/tests/test_edit_fast.py
new file mode 100644
index 0000000..2b42bd1
--- /dev/null
+++ b/tests/test_edit_fast.py
@@ -0,0 +1,310 @@
+"""Edit pack, fast tests: versions.json, installer arguments, detect, uninstall, recipes' guard rails, hygiene.
+
+Nothing here downloads anything. The slow tests (test_edit_slow.py) install the pinned apps and run the recipes.
+"""
+from __future__ import annotations
+
+import json
+import os
+import re
+import shutil
+import stat
+
+import pytest
+
+from test_edit_common import (APPS, BASH, EDIT, PLATFORMS, RECIPES, REPO, SCRIPTS, SKILL, VERSIONS, make_stub_cli,
+ needs_node, posix_only, run)
+
+INSTALL_SH = EDIT / "install_edit.sh"
+INSTALL_PS1 = EDIT / "install_edit.ps1"
+DETECT_SH = SCRIPTS / "detect_edit.sh"
+DETECT_PS1 = SCRIPTS / "detect_edit.ps1"
+RECIPE_FILES = sorted(p for p in RECIPES.glob("*.sh"))
+EDIT_FILES = [p for p in EDIT.rglob("*") if p.is_file()] + [DETECT_SH, DETECT_PS1]
+
+
+# ---- versions.json ---------------------------------------------------------------------------------------------
+
+def test_versions_json_schema():
+ v = VERSIONS
+ assert v["schema"] == 1 and v["license"] == "Apache-2.0" and v["source"] == "https://github.com/storytold"
+ assert re.fullmatch(r"[0-9A-F]{40}", v["signing"]["fingerprint"]) and v["signing"]["key_asset"] == "release-signing-key.asc"
+ assert set(v["apps"]) == set(APPS)
+ for short, app in v["apps"].items():
+ assert app["name"] == f"{short}craft" and app["cli"] == f"{app['name']}-cli"
+ assert re.fullmatch(r"\d+\.\d+\.\d+", app["version"]) and app["tag"] == "v" + app["version"]
+ assert set(app["assets"]) == set(PLATFORMS), short
+ for plat, asset in app["assets"].items():
+ assert re.fullmatch(r"[0-9a-f]{64}", asset["sha256"]), (short, plat)
+ assert isinstance(asset["bytes"], int) and asset["bytes"] > 1_000_000
+ assert app["version"] in asset["file"] and asset["file"].startswith(app["name"])
+
+
+def test_asset_names_follow_each_platforms_convention():
+ for app in VERSIONS["apps"].values():
+ n, ver = app["name"], app["version"]
+ a = app["assets"]
+ assert a["macos-universal"]["file"] == f"{n}-cli-{ver}-macos-universal.zip"
+ assert a["windows-x64"]["file"] == f"{n}-{ver}-windows-x64-portable.zip"
+ assert a["windows-arm64"]["file"] == f"{n}-{ver}-windows-arm64-portable.zip"
+ assert a["linux-x86_64"]["file"] == f"{n}-{ver}-linux-x86_64.tar.gz"
+ assert a["linux-aarch64"]["file"] == f"{n}-{ver}-linux-aarch64.tar.gz"
+
+
+# ---- installer arguments ---------------------------------------------------------------------------------------
+
+@posix_only
+@needs_node
[email protected]("plat,suffix", [("macos-universal", "-cli-"), ("linux-x86_64", "linux-x86_64.tar.gz"),
+ ("linux-aarch64", "linux-aarch64.tar.gz"), ("windows-x64", "windows-x64-portable.zip")])
+def test_dry_run_plans_every_component_per_platform_and_changes_nothing(tmp_path, plat, suffix):
+ home = tmp_path / "home"
+ proc = run([BASH, INSTALL_SH, "--components", "all", "--dry-run"], {"B2M_EDIT_HOME": str(home), "B2M_EDIT_PLATFORM": plat})
+ assert proc.returncode == 0, proc.stderr
+ lines = [l for l in proc.stdout.splitlines() if "would download" in l]
+ assert len(lines) == 5 and all(suffix in l and " MB, from https://github.com/storytold/" in l for l in lines)
+ assert not home.exists()
+
+
+@posix_only
+@needs_node
+def test_default_components_are_film_and_sound_and_spaces_work(tmp_path):
+ env = {"B2M_EDIT_HOME": str(tmp_path / "h")}
+ default = run([BASH, INSTALL_SH, "--dry-run"], env)
+ assert [l.split(":")[0] for l in default.stdout.splitlines() if "would download" in l] == ["film", "sound"]
+ spaced = run([BASH, INSTALL_SH, "--components", "photo vector", "--dry-run"], env)
+ assert [l.split(":")[0] for l in spaced.stdout.splitlines() if "would download" in l] == ["photo", "vector"]
+
+
+@posix_only
+def test_installer_rejects_bad_arguments(tmp_path):
+ env = {"B2M_EDIT_HOME": str(tmp_path / "h")}
+ bad = run([BASH, INSTALL_SH, "--components", "film,bogus"], env)
+ assert bad.returncode == 2 and "unknown component 'bogus'" in bad.stderr
+ assert run([BASH, INSTALL_SH, "--nonsense"], env).returncode == 2
+ assert run([BASH, INSTALL_SH, "--components", ""], env).returncode == 2
+ assert not (tmp_path / "h").exists()
+ helped = run([BASH, INSTALL_SH, "--help"], env)
+ assert helped.returncode == 0 and "--uninstall" in helped.stdout and "SHA256SUMS" in helped.stdout
+
+
+@posix_only
+def test_installer_has_no_sudo_and_never_edits_shell_profiles():
+ for installer in (INSTALL_SH, INSTALL_PS1):
+ code = "\n".join(l for l in installer.read_text(encoding="utf-8").splitlines()
+ if not l.lstrip().startswith(("#", "say ", "Write-Output")))
+ assert "sudo" not in code and ".bashrc" not in code and ".zshrc" not in code and "setx" not in code.lower()
+
+
+# ---- detect ----------------------------------------------------------------------------------------------------
+
+@posix_only
+def test_detect_branches_on_a_cli_that_actually_runs(tmp_path):
+ env = {"B2M_EDIT_HOME": str(tmp_path / "none")}
+ empty = run([BASH, DETECT_SH], env)
+ assert empty.returncode == 0 and empty.stdout.strip() == "edit: not installed"
+
+ home = tmp_path / "home"
+ make_stub_cli(home / "filmcraft" / "filmcraft-cli") # macOS layout
+ make_stub_cli(home / "soundcraft" / "bin" / "soundcraft-cli") # Linux layout
+ make_stub_cli(home / "effectcraft" / "effectcraft-cli.exe") # Windows layout
+ make_stub_cli(home / "photocraft" / "photocraft-cli", exit_code=1) # present but broken
+ (home / "vectorcraft").mkdir(parents=True)
+ (home / "vectorcraft" / "vectorcraft-cli").write_text("not a program") # present, not executable
+ out = run([BASH, DETECT_SH], {"B2M_EDIT_HOME": str(home)})
+ assert out.returncode == 0 and out.stdout.strip() == "edit: ready (film,sound,effect)"
+
+
+@posix_only
+def test_detect_needs_only_the_install_folder(tmp_path):
+ """Run from a copy of the script with no repository around it, with a stub install."""
+ lone = tmp_path / "elsewhere" / "detect_edit.sh"
+ lone.parent.mkdir()
+ shutil.copy(DETECT_SH, lone)
+ home = tmp_path / "home"
+ make_stub_cli(home / "vectorcraft" / "vectorcraft-cli")
+ out = run([BASH, lone], {"B2M_EDIT_HOME": str(home)}, cwd=tmp_path)
+ assert out.stdout.strip() == "edit: ready (vector)"
+
+
+# ---- uninstall -------------------------------------------------------------------------------------------------
+
+def _fake_install(home, apps=("sound", "photo")):
+ manifest = ["versions.json", "recipes", ".components"]
+ (home / "recipes").mkdir(parents=True)
+ (home / "recipes" / "x.sh").write_text("#!/bin/sh\n")
+ (home / "versions.json").write_text("{}")
+ (home / ".components").write_text("\n".join(sorted(apps)) + "\n")
+ for a in apps:
+ make_stub_cli(home / f"{a}craft" / f"{a}craft-cli")
+ make_stub_cli(home / "bin" / f"{a}craft-cli")
+ manifest += [f"{a}craft", f"bin/{a}craft-cli"]
+ (home / ".b2m-edit-manifest").write_text("\n".join(manifest) + "\n")
+
+
+@posix_only
+@needs_node
+def test_uninstall_removes_only_what_the_manifest_lists(tmp_path):
+ home = tmp_path / "home"
+ _fake_install(home)
+ (home / "my-notes.txt").write_text("keep me")
+ (home / "bin" / "my-tool").write_text("keep me too")
+ proc = run([BASH, INSTALL_SH, "--uninstall"], {"B2M_EDIT_HOME": str(home)})
+ assert proc.returncode == 0, proc.stderr
+ assert sorted(p.name for p in home.iterdir()) == ["bin", "my-notes.txt"]
+ assert [p.name for p in (home / "bin").iterdir()] == ["my-tool"]
+ assert "left alone" in proc.stdout
+
+
+@posix_only
+@needs_node
+def test_uninstall_one_component_keeps_the_rest_then_removes_shared_files(tmp_path):
+ home = tmp_path / "home"
+ _fake_install(home)
+ env = {"B2M_EDIT_HOME": str(home)}
+ assert run([BASH, INSTALL_SH, "--uninstall", "--components", "photo"], env).returncode == 0
+ assert not (home / "photocraft").exists() and not (home / "bin" / "photocraft-cli").exists()
+ assert (home / "soundcraft").is_dir() and (home / "recipes").is_dir()
+ assert (home / ".components").read_text().split() == ["sound"]
+ assert run([BASH, INSTALL_SH, "--uninstall", "--components", "sound"], env).returncode == 0
+ assert not home.exists() # nothing of ours left, and the empty folder went too
+
+
+@posix_only
+@needs_node
+def test_uninstall_skips_unsafe_manifest_entries_and_missing_manifest(tmp_path):
+ home = tmp_path / "home"
+ victim = tmp_path / "victim"
+ victim.mkdir()
+ (victim / "file").write_text("x")
+ home.mkdir()
+ (home / ".b2m-edit-manifest").write_text("../victim\n/etc\nsoundcraft/../../victim\n")
+ proc = run([BASH, INSTALL_SH, "--uninstall"], {"B2M_EDIT_HOME": str(home)})
+ assert proc.returncode == 0 and (victim / "file").exists() and proc.stdout.count("skipping unsafe") == 3
+ other = run([BASH, INSTALL_SH, "--uninstall"], {"B2M_EDIT_HOME": str(tmp_path / "never-installed")})
+ assert other.returncode == 0 and "nothing to remove" in other.stdout
+
+
+# ---- recipes: guard rails --------------------------------------------------------------------------------------
+
+def test_there_is_one_recipe_per_app():
+ assert sorted(p.name for p in RECIPE_FILES if p.name != "_lib.sh") == [
+ "effect_title.sh", "film_timeline.sh", "photo_thumbnail.sh", "sound_mix.sh", "vector_lower_third.sh"]
+
+
+@posix_only
[email protected]("recipe", [p for p in RECIPE_FILES if p.name != "_lib.sh"], ids=lambda p: p.name)
+def test_recipe_help_and_missing_cli_message(recipe, tmp_path):
+ helped = run([BASH, recipe, "--help"])
+ assert helped.returncode == 0 and "--out" in helped.stdout and "Command ids used" in helped.stdout
+ assert run([BASH, recipe, "--bogus"]).returncode == 2
+ # A pinned CLI that is not installed is a clear error, and an older copy on the PATH is never used.
+ name = {"film": "filmcraft", "sound": "soundcraft", "effect": "effectcraft", "photo": "photocraft", "vector": "vectorcraft"}[
+ recipe.name.split("_")[0]]
+ make_stub_cli(tmp_path / "pathbin" / f"{name}-cli")
+ proc = run([BASH, recipe, "--out", str(tmp_path / "o.out")],
+ {"B2M_EDIT_HOME": str(tmp_path / "empty"), "PATH": f"{tmp_path / 'pathbin'}{os.pathsep}{os.environ['PATH']}"})
+ assert proc.returncode == 3 and "install_edit.sh --components" in proc.stderr and not (tmp_path / "o.out").exists()
+
+
+@posix_only
+@needs_node
+def test_lib_json_string_escaping_and_output_picking():
+ script = 'source "' + str(RECIPES / "_lib.sh") + '"; b2m_str "$1"; printf "%s\\n" "$2" | b2m_pick "$3"'
+ tricky = 'He said "hi" \\ back\nline two \u00e9'
+ proc = run([BASH, "-c", script, "x", tricky, '{"id":"a","result":{"items":[8,9]}}\nnoise\n{"id":"b","result":{"n":3}}',
+ 'L.find(x => x.id === "a").result.items'])
+ first, second = proc.stdout.split("\n", 1) if "\n" in proc.stdout else (proc.stdout, "")
+ assert json.loads(first) == tricky and second.strip() == "8 9"
+
+
+@posix_only
+def test_lib_finds_every_cli_layout(tmp_path):
+ home = tmp_path / "home"
+ make_stub_cli(home / "filmcraft" / "filmcraft-cli")
+ make_stub_cli(home / "soundcraft" / "bin" / "soundcraft-cli")
+ make_stub_cli(home / "effectcraft" / "effectcraft-cli.exe")
+ for name, rel in (("filmcraft", "filmcraft/filmcraft-cli"), ("soundcraft", "soundcraft/bin/soundcraft-cli"),
+ ("effectcraft", "effectcraft/effectcraft-cli.exe")):
+ proc = run([BASH, "-c", f'source "{RECIPES / "_lib.sh"}"; b2m_cli {name}'], {"B2M_EDIT_HOME": str(home)})
+ assert proc.stdout == str(home / rel), proc.stderr
+
+
+def test_example_brief_exists_and_needs_real_editing():
+ brief = (REPO / "examples" / "07-edit-tutorial" / "BRIEF.md").read_text(encoding="utf-8")
+ for word in ("two separately generated clips", "cross dissolve", "title", "ducked", "final.mp4"):
+ assert word in brief.lower() or word in brief, word
+
+
+# ---- script hygiene --------------------------------------------------------------------------------------------
+
+def test_scripts_are_lf_utf8_and_executable_where_needed():
+ for path in EDIT_FILES:
+ if path.suffix in {".sh", ".ps1", ".json", ".md"}:
+ data = path.read_bytes()
+ data.decode("utf-8")
+ if path.suffix != ".ps1": # .gitattributes checks .ps1 out as CRLF on purpose; the others stay LF
+ assert b"\r" not in data, f"{path.name} has CRLF line endings"
+ if path.suffix == ".ps1":
+ data.decode("ascii") # Windows PowerShell 5.1 reads BOM-less files as ANSI: keep them pure ASCII
+ for path in RECIPE_FILES + [INSTALL_SH, DETECT_SH]:
+ assert path.stat().st_mode & stat.S_IXUSR, f"{path.name} is not executable"
+ assert path.read_text(encoding="utf-8").startswith("#!/usr/bin/env bash")
+
+
+def test_powershell_scripts_follow_the_known_pitfalls():
+ text = INSTALL_PS1.read_text(encoding="utf-8")
+ assert "[string[]]$Components" in text and '-split "[,\\s]+"' in text # both -Components forms
+ assert "2>$null" not in text and "2>&1" not in text # no native stderr redirects
+ assert "UTF8Encoding" in text and "Set-Content" not in text and "Out-File" not in text # explicit UTF-8 only
+ assert "-Uninstall" in text and ".b2m-edit-manifest" in text and "-DryRun" in text
+ assert "2>$null" not in DETECT_PS1.read_text(encoding="utf-8")
+
+
+def test_powershell_parses_and_dry_runs_when_pwsh_is_available(tmp_path):
+ pwsh = os.environ.get("B2M_PWSH") or shutil.which("pwsh")
+ if not pwsh:
+ pytest.skip("no PowerShell available (set B2M_PWSH to a pwsh binary to run this)")
+ for script in (INSTALL_PS1, DETECT_PS1):
+ parse = run([pwsh, "-NoProfile", "-Command",
+ f"$e=$null;$t=$null;[void][System.Management.Automation.Language.Parser]::ParseFile('{script}',[ref]$t,[ref]$e);if($e){{$e|%{{$_.Message}};exit 1}}"])
+ assert parse.returncode == 0, parse.stdout + parse.stderr
+ env = {"B2M_EDIT_HOME": str(tmp_path / "h"), "B2M_EDIT_PLATFORM": "windows-x64"}
+ for args in (["-File", INSTALL_PS1, "-Components", "film,sound", "-DryRun"],
+ ["-Command", f"& '{INSTALL_PS1}' -Components film,vector -DryRun"]):
+ proc = run([pwsh, "-NoProfile", *args], env)
+ assert proc.returncode == 0 and proc.stdout.count("would download") == 2 and "windows-x64-portable.zip" in proc.stdout, proc.stdout + proc.stderr
+ assert not (tmp_path / "h").exists()
+ bad = run([pwsh, "-NoProfile", "-File", INSTALL_PS1, "-Components", "bogus", "-DryRun"], env)
+ assert bad.returncode != 0 and "unknown component" in (bad.stdout + bad.stderr)
+
+
+def test_recipes_make_no_network_calls_and_stay_small():
+ for path in RECIPE_FILES:
+ code = "\n".join(l for l in path.read_text(encoding="utf-8").splitlines() if not l.lstrip().startswith("#"))
+ assert not re.search(r"\b(curl|wget|Invoke-WebRequest)\b", code), path.name
+ assert len(path.read_text(encoding="utf-8").splitlines()) < 200
+
+
+def test_edit_pack_public_repo_hygiene():
+ """No personal paths, private names or credentials in anything the edit pack ships."""
+ banned = ["/Us" + "ers/", "C:\\Us" + "ers\\", "api_" + "key", "sec" + "ret", "/private/" + "tmp"]
+ banned += [t for t in os.environ.get("B2M_BANNED", "").split(",") if t]
+ hits = []
+ for path in EDIT_FILES + [REPO / "examples" / "07-edit-tutorial" / "BRIEF.md"]:
+ text = path.read_text(encoding="utf-8")
+ hits += [f"{path.relative_to(REPO)}: {b}" for b in banned if b.lower() in text.lower()]
+ assert len(text.splitlines()) < 800, path.name
+ assert not hits, hits
+
+
+def test_readme_matches_the_pins():
+ text = (EDIT / "README-EDIT.md").read_text(encoding="utf-8")
+ for app in VERSIONS["apps"].values():
+ assert app["name"] in text.lower() or app["name"].capitalize() in text
+ assert app["version"] in text, f"README-EDIT.md does not mention {app['name']} {app['version']}"
+ for recipe in ("film_timeline.sh", "sound_mix.sh", "effect_title.sh", "photo_thumbnail.sh", "vector_lower_third.sh"):
+ assert recipe in text
+ for must in ("storytold", "Apache-2.0", "alpha", "finish.sh", "check_delivery.sh", "B2M_EDIT_HOME", "--uninstall",
+ "untested", "automation-read-root"):
+ assert must.lower() in text.lower(), must
diff --git a/tests/test_edit_slow.py b/tests/test_edit_slow.py
new file mode 100644
index 0000000..8bb1cd3
--- /dev/null
+++ b/tests/test_edit_slow.py
@@ -0,0 +1,258 @@
+"""Edit pack, slow tests: install the pinned apps for real and run every recipe against them.
+
+The pinned CLIs go into a temp B2M_EDIT_HOME (set B2M_EDIT_TEST_HOME to reuse one between runs and skip the
+~450 MB download). Needs network on the first run, ffmpeg, node and bash. Run with: bash tests/run_tests.sh --slow
+"""
+from __future__ import annotations
+
+import json
+import re
+import shutil
+import socket
+import struct
+import subprocess
+import xml.etree.ElementTree as ET
+from pathlib import Path
+
+import pytest
+
+from test_edit_common import (APPS, BASH, EDIT, RECIPES, SCRIPTS, VERSIONS, frame_hash, ffprobe, needs_ffmpeg, needs_node,
+ posix_only, run, tone_peak_db)
+
+pytestmark = [pytest.mark.slow, posix_only, needs_ffmpeg, needs_node]
+INSTALL = EDIT / "install_edit.sh"
+NAMES = {a: VERSIONS["apps"][a]["name"] for a in APPS}
+
+
+def _online() -> bool:
+ try:
+ socket.create_connection(("github.com", 443), timeout=5).close()
+ return True
+ except OSError:
+ return False
+
+
[email protected](scope="module")
+def home(tmp_path_factory) -> Path:
+ import os
+ reuse = os.environ.get("B2M_EDIT_TEST_HOME")
+ path = Path(reuse) if reuse else tmp_path_factory.mktemp("edit-home") / "home"
+ if not _online() and not (path / "filmcraft").exists():
+ pytest.skip("github.com not reachable and no preinstalled B2M_EDIT_TEST_HOME")
+ proc = run([BASH, INSTALL, "--components", "all"], {"B2M_EDIT_HOME": str(path)})
+ assert proc.returncode == 0, proc.stdout + proc.stderr
+ return path
+
+
[email protected](scope="module")
+def env(home) -> dict:
+ return {"B2M_EDIT_HOME": str(home)}
+
+
+def recipe(env: dict, name: str, *args) -> subprocess.CompletedProcess:
+ proc = run([BASH, RECIPES / name, *args], env)
+ assert proc.returncode == 0, f"{name} failed:\n{proc.stdout}\n{proc.stderr}"
+ assert proc.stdout.startswith("ok: ")
+ return proc
+
+
+# ---- the installer, for real -----------------------------------------------------------------------------------
+
+def test_every_pinned_cli_runs_with_its_pinned_version(home):
+ for short, app in VERSIONS["apps"].items():
+ launcher = home / "bin" / app["cli"]
+ out = run([launcher, "--version"])
+ assert out.returncode == 0 and app["version"] in out.stdout, (short, out.stdout, out.stderr)
+ assert (home / app["name"] / ".b2m-version").read_text().strip() == app["version"]
+
+
+def test_second_install_is_a_no_op_and_detect_sees_everything(home):
+ again = run([BASH, INSTALL, "--components", "film,sound"], {"B2M_EDIT_HOME": str(home)})
+ assert again.returncode == 0 and again.stdout.count("already installed") == 2 and "downloading" not in again.stdout
+ out = run([BASH, SCRIPTS / "detect_edit.sh"], {"B2M_EDIT_HOME": str(home)})
+ assert out.stdout.strip() == "edit: ready (film,sound,effect,photo,vector)"
+
+
+def test_installed_pack_does_not_depend_on_the_repository(home, tmp_path):
+ assert (home / "versions.json").exists() and (home / "recipes" / "_lib.sh").exists()
+ out = run([BASH, home / "recipes" / "photo_thumbnail.sh", "--out", tmp_path / "t.png"], {"B2M_EDIT_HOME": str(home)})
+ assert out.returncode == 0, out.stderr
+ moved = tmp_path / "moved"
+ shutil.copytree(home, moved, symlinks=True) # a copied folder still launches: launchers use relative paths
+ assert run([moved / "bin" / "photocraft-cli", "--version"]).returncode == 0
+
+
+def test_a_changed_hash_pin_is_refused_and_installs_nothing(tmp_path):
+ clone = tmp_path / "edit"
+ shutil.copytree(EDIT, clone)
+ pins = json.loads((clone / "versions.json").read_text())
+ pins["apps"]["sound"]["assets"]["macos-universal"]["sha256"] = "0" * 64
+ pins["apps"]["sound"]["assets"]["linux-x86_64"]["sha256"] = "0" * 64
+ pins["apps"]["sound"]["assets"]["linux-aarch64"]["sha256"] = "0" * 64
+ (clone / "versions.json").write_text(json.dumps(pins))
+ home = tmp_path / "home"
+ proc = run([BASH, clone / "install_edit.sh", "--components", "sound"], {"B2M_EDIT_HOME": str(home)})
+ assert proc.returncode == 1 and "differs from the one pinned" in proc.stderr
+ assert not (home / "soundcraft").exists() and not list(home.glob(".stage-*"))
+
+
+def test_the_release_checksums_still_match_the_pins():
+ """Catches a re-uploaded release: every pinned hash must equal the live SHA256SUMS.txt entry."""
+ import urllib.request
+ for app in VERSIONS["apps"].values():
+ url = f"{VERSIONS['source']}/{app['name']}/releases/download/{app['tag']}/SHA256SUMS.txt"
+ sums = dict(reversed(l.split()) for l in urllib.request.urlopen(url, timeout=30).read().decode().splitlines() if l.strip())
+ for plat, asset in app["assets"].items():
+ assert sums[asset["file"]] == asset["sha256"], (app["name"], plat)
+
+
+# ---- the recipes -----------------------------------------------------------------------------------------------
+
+def test_film_recipe_cuts_dissolves_and_titles(env, tmp_path):
+ a, b = tmp_path / "a.mp4", tmp_path / "b.mp4"
+ for out, src in ((a, "testsrc2"), (b, "gradients")):
+ subprocess.run(["ffmpeg", "-v", "error", "-y", "-f", "lavfi", "-i", f"{src}=size=1280x720:rate=30:duration=4", "-f", "lavfi",
+ "-i", "sine=frequency=440:duration=4", "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac", "-shortest", str(out)], check=True)
+ one, two = tmp_path / "one.mp4", tmp_path / "two.mp4"
+ recipe(env, "film_timeline.sh", "--clip-a", str(a), "--clip-b", str(b), "--title", "AAA", "--out", str(one),
+ "--save-project", str(tmp_path / "p.fcproj"))
+ recipe(env, "film_timeline.sh", "--clip-a", str(a), "--clip-b", str(b), "--title", "WWWWWWWWWW", "--out", str(two))
+ v = ffprobe(one, "stream=codec_name,width,height,pix_fmt,nb_frames")["streams"][0]
+ assert (v["codec_name"], v["width"], v["height"], v["pix_fmt"]) == ("h264", 1280, 720, "yuv420p")
+ assert abs(float(ffprobe(one, "format=duration")["format"]["duration"]) - 5.0) < 0.1
+ assert ffprobe(one, "stream=codec_name", "a:0")["streams"][0]["codec_name"] == "aac"
+ assert (tmp_path / "p.fcproj").stat().st_size > 1000
+ # Before the title (0.2 s) both cuts are identical; with the title on screen (1.0 s) they differ.
+ assert frame_hash(one, 0.2) == frame_hash(two, 0.2) and frame_hash(one, 1.0) != frame_hash(two, 1.0)
+ # The dissolve: the frame at the cut is neither of the frames either side of it.
+ assert len({frame_hash(one, 1.9), frame_hash(one, 2.5), frame_hash(one, 3.1)}) == 3
+ # The clean-clip frame just after the dissolve ends is B's picture: it differs from the frame inside the dissolve.
+ assert frame_hash(one, 2.5) != frame_hash(one, 3.5)
+
+
+def test_film_recipe_default_inputs_and_bad_input(env, tmp_path):
+ recipe(env, "film_timeline.sh", "--out", tmp_path / "d.mp4", "--size", "640x360", "--fps", "25")
+ assert ffprobe(tmp_path / "d.mp4", "stream=width,height")["streams"][0]["width"] == 640
+ short = tmp_path / "short.mp4"
+ subprocess.run(["ffmpeg", "-v", "error", "-y", "-f", "lavfi", "-i", "testsrc2=size=320x180:rate=30:duration=1", "-f", "lavfi", "-i",
+ "sine=duration=1", "-shortest", str(short)], check=True)
+ bad = run([BASH, RECIPES / "film_timeline.sh", "--clip-a", short, "--out", tmp_path / "x.mp4"], env)
+ assert bad.returncode == 2 and "shorter than" in bad.stderr
+
+
+def test_sound_recipe_mixes_and_ducks(env, tmp_path):
+ voice, music = tmp_path / "voice.wav", tmp_path / "bed.wav"
+ subprocess.run(["ffmpeg", "-v", "error", "-y", "-f", "lavfi", "-i", "sine=frequency=150:duration=5,volume=4", str(voice)], check=True)
+ subprocess.run(["ffmpeg", "-v", "error", "-y", "-f", "lavfi", "-i", "sine=frequency=880:duration=10,volume=4", str(music)], check=True)
+ out = tmp_path / "mix.wav"
+ recipe(env, "sound_mix.sh", "--voice", str(voice), "--music", str(music), "--voice-start", "2", "--out", str(out))
+ a = ffprobe(out, "stream=codec_name,channels,sample_rate", "a:0")["streams"][0]
+ assert (a["codec_name"], a["channels"], a["sample_rate"]) == ("pcm_s24le", 2, "48000")
+ assert abs(float(ffprobe(out, "format=duration")["format"]["duration"]) - 10.0) < 0.05
+ bed_before, bed_after = tone_peak_db(out, 0.2, 1.2, 880), tone_peak_db(out, 9.0, 0.8, 880)
+ bed_under_voice, voice = tone_peak_db(out, 3.0, 3.5, 880), tone_peak_db(out, 3.0, 3.5, 150)
+ assert bed_before - bed_under_voice >= 10 and bed_after - bed_under_voice >= 10 # ducked by about 12 dB
+ assert voice > bed_under_voice + 10 # the voice sits above the bed
+ assert tone_peak_db(out, 0.2, 1.2, 150) < voice - 20 # nothing of the voice before it starts
+
+
+def test_sound_recipe_with_generated_inputs(env, tmp_path):
+ recipe(env, "sound_mix.sh", "--out", tmp_path / "g.wav", "--duck-db", "-24")
+ assert ffprobe(tmp_path / "g.wav", "stream=codec_name", "a:0")["streams"][0]["codec_name"] == "pcm_s24le"
+
+
+def test_effect_recipe_renders_an_animated_title(env, tmp_path):
+ out = tmp_path / "t.mp4"
+ recipe(env, "effect_title.sh", "--text", "Chapter one", "--seconds", "3", "--out", str(out), "--save-project", str(tmp_path / "t.ecproj"))
+ v = ffprobe(out, "stream=codec_name,width,height,pix_fmt,r_frame_rate")["streams"][0]
+ assert (v["codec_name"], v["width"], v["height"], v["pix_fmt"], v["r_frame_rate"]) == ("h264", 1280, 720, "yuv420p", "30/1")
+ assert abs(float(ffprobe(out, "format=duration")["format"]["duration"]) - 3.0) < 0.05
+ assert ffprobe(out, "stream=codec_name", "a:0")["streams"] == []
+ assert (tmp_path / "t.ecproj").stat().st_size > 500
+ # Animated: the title is invisible at 0 s, there at 2.5 s, and the bar has grown by then.
+ assert len({frame_hash(out, 0.0), frame_hash(out, 0.5), frame_hash(out, 2.5)}) == 3
+
+
+def test_photo_recipe_makes_a_thumbnail(env, tmp_path):
+ out = tmp_path / "t.png"
+ recipe(env, "photo_thumbnail.sh", "--title", "Cut faster", "--subtitle", "three habits", "--out", str(out))
+ head = out.read_bytes()[:33]
+ assert head[:8] == b"\x89PNG\r\n\x1a\n" and struct.unpack(">II", head[16:24]) == (1280, 720)
+ other = tmp_path / "u.png"
+ recipe(env, "photo_thumbnail.sh", "--title", "Something else", "--subtitle", "three habits", "--out", str(other))
+ # Title zone (left, upper middle) differs between the two cards; the bottom strip (no text) is identical.
+ assert frame_hash(out, 0, "900:200:80:260") != frame_hash(other, 0, "900:200:80:260")
+ assert frame_hash(out, 0, "1200:80:40:600") == frame_hash(other, 0, "1200:80:40:600")
+ # The title is bright text on a dark gradient.
+ stats = subprocess.run(["ffmpeg", "-hide_banner", "-i", str(out), "-vf", "crop=900:200:80:260,signalstats,metadata=print", "-f", "null", "-"],
+ capture_output=True, text=True).stderr
+ assert float(re.search(r"YMAX=(\d+)", stats).group(1)) > 220
+
+
+def test_photo_recipe_other_size(env, tmp_path):
+ recipe(env, "photo_thumbnail.sh", "--size", "1920x1080", "--out", tmp_path / "big.png")
+ assert struct.unpack(">II", (tmp_path / "big.png").read_bytes()[16:24]) == (1920, 1080)
+
+
+def test_vector_recipe_exports_a_lower_third_svg(env, tmp_path):
+ out = tmp_path / "lt.svg"
+ recipe(env, "vector_lower_third.sh", "--name", "Alex & Doe", "--role", "Video <editor>", "--out", str(out))
+ root = ET.parse(out).getroot() # parses: special characters were escaped
+ assert root.tag.endswith("svg") and root.get("width") == "1280" and root.get("height") == "200"
+ texts = ["".join(t.itertext()).strip() for t in root.iter() if t.tag.endswith("text")]
+ assert texts == ["Alex & Doe", "Video <editor>"]
+ shapes = [t.tag.split("}")[1] for t in root.iter() if t.tag.split("}")[1] in {"rect", "path"}]
+ assert len(shapes) == 2
+ assert 'stroke="#000000"' not in out.read_text() # strokes were switched off
+ recipe(env, "vector_lower_third.sh", "--width", "1920", "--height", "300", "--out", tmp_path / "big.svg")
+ assert ET.parse(tmp_path / "big.svg").getroot().get("width") == "1920"
+
+
+# ---- what README-EDIT.md tells agents --------------------------------------------------------------------------
+
+def _cli(home: Path, short: str) -> str:
+ return str(home / "bin" / VERSIONS["apps"][short]["cli"])
+
+
+def test_command_ids_named_in_recipe_headers_exist_in_the_pinned_cli(home):
+ for recipe_name, short in (("film_timeline.sh", "film"), ("sound_mix.sh", "sound"), ("effect_title.sh", "effect"),
+ ("photo_thumbnail.sh", "photo"), ("vector_lower_third.sh", "vector")):
+ header = (RECIPES / recipe_name).read_text(encoding="utf-8").split("set -euo")[0]
+ block = header.split("Command ids used", 1)[1]
+ ids = re.findall(r"\b([a-z]+\.[A-Za-z_.]+[A-Za-z_])\b", block)
+ assert ids, recipe_name
+ listing = run([_cli(home, short), "commands"] + (["--json"] if short in {"photo"} else []))
+ assert listing.returncode == 0
+ for command_id in ids:
+ assert re.search(rf'(?m)^\s*(?:"id": ")?{re.escape(command_id)}\b|"id":\s*"{re.escape(command_id)}"', listing.stdout), (recipe_name, command_id)
+
+
+def test_each_cli_serves_mcp_over_stdio_at_its_pinned_version(home):
+ init = {"jsonrpc": "2.0", "id": 1, "method": "initialize",
+ "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "t", "version": "0"}}}
+ messages = [init, {"jsonrpc": "2.0", "method": "notifications/initialized"}, {"jsonrpc": "2.0", "id": 2, "method": "tools/list"}]
+ for short, app in VERSIONS["apps"].items():
+ args = [_cli(home, short), "mcp"] + (["--headless"] if short == "vector" else [])
+ proc = subprocess.run(args, input="\n".join(json.dumps(m) for m in messages) + "\n", capture_output=True, text=True, timeout=60)
+ replies = [json.loads(l) for l in proc.stdout.splitlines() if l.startswith("{")]
+ assert replies[0]["result"]["serverInfo"]["version"] == app["version"], short
+ assert len(replies[1]["result"]["tools"]) > 5, short
+
+
+def test_file_confinement_flags_exist_exactly_where_the_readme_says(home):
+ for short in ("sound", "effect", "photo", "vector"):
+ helped = run([_cli(home, short), "mcp", "--help"])
+ assert "--automation-read-root" in helped.stdout + helped.stderr and "--automation-write-root" in helped.stdout + helped.stderr, short
+ film = run([_cli(home, "film"), "mcp", "--automation-read-root", str(home)], cwd=home)
+ assert "unknown mcp option" in film.stdout + film.stderr
+
+
+def test_uninstall_really_removes_the_install(tmp_path):
+ """Uses a small throwaway install (sound only) so the shared home stays intact for the other tests."""
+ h = tmp_path / "home"
+ e = {"B2M_EDIT_HOME": str(h)}
+ assert run([BASH, INSTALL, "--components", "sound"], e).returncode == 0
+ (h / "keep.txt").write_text("mine")
+ proc = run([BASH, INSTALL, "--uninstall"], e)
+ assert proc.returncode == 0 and sorted(p.name for p in h.iterdir()) == ["keep.txt"]
+ assert run([BASH, SCRIPTS / "detect_edit.sh"], e).stdout.strip() == "edit: not installed"