From f6617db1517488d4a8b66925519d5ffbeef965b3 Mon Sep 17 00:00:00 2001 From: Ada Sen Date: Thu, 27 Aug 2026 16:46:48 +0000 Subject: feat(skills): import proving-it-works-with-a-movie from its standalone repo Brings the proving-it-works-with-a-movie skill (demo/screencast/proof-video recording, plus the check-movie timeline gate that catches frozen pictures, narration drift, and dropped words) into superpowers core, along with its supporting docs, scripts, and shell regression tests. Source: prime-radiant-inc/proving-it-works (MIT, same copyright holder), skills/proving-it-works-with-a-movie/ at time of import. The five scripts (narrate, make-subtitles, assemble, burn-subtitles, check-movie) are self-contained uv --script files with inline PEP 723 dependency declarations, so they port with no new project-level dependency wiring. Test paths were adjusted one directory level to match superpowers' tests// layout (the standalone repo kept tests/ as a top-level sibling of skills/). Adds a Verification entry to README's Skills Library list. Goal: fold this into 6.4 and retire the standalone repo. --- .../proving-it-works-with-a-movie/test-assemble.sh | 88 +++++++++++++++++ .../test-check-movie.sh | 105 +++++++++++++++++++++ .../proving-it-works-with-a-movie/test-narrate.sh | 54 +++++++++++ 3 files changed, 247 insertions(+) create mode 100755 tests/proving-it-works-with-a-movie/test-assemble.sh create mode 100755 tests/proving-it-works-with-a-movie/test-check-movie.sh create mode 100755 tests/proving-it-works-with-a-movie/test-narrate.sh (limited to 'tests') diff --git a/tests/proving-it-works-with-a-movie/test-assemble.sh b/tests/proving-it-works-with-a-movie/test-assemble.sh new file mode 100755 index 0000000..c5eca66 --- /dev/null +++ b/tests/proving-it-works-with-a-movie/test-assemble.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +# Regression tests for scripts/assemble and scripts/make-subtitles. +# +# The property that matters: a segment lasts max(narration, visuals), and +# the scene offsets written for the subtitler match where scenes actually +# start in the finished cut. Hand-computed offsets silently mistime every +# cue after an inserted scene, which is why assemble emits them. +# +# Usage: tests/proving-it-works-with-a-movie/test-assemble.sh +set -uo pipefail + +HERE="$(cd "$(dirname "$0")" && pwd)" +SCRIPTS="$HERE/../../skills/proving-it-works-with-a-movie/scripts" +WORK="$(mktemp -d)" +trap 'rm -rf "$WORK"' EXIT +pass=0; fail=0 + +for tool in ffmpeg ffprobe uv; do + command -v "$tool" >/dev/null || { echo "SKIP: $tool not on PATH"; exit 0; } +done + +ok() { echo "ok $1"; pass=$((pass + 1)); } +no() { echo "FAIL $1"; fail=$((fail + 1)); } +dur() { ffprobe -v error -show_entries format=duration -of csv=p=0 "$1"; } +about() { # about + awk -v a="$1" -v b="$2" -v t="$3" 'BEGIN{exit !(a-b "$WORK/scenes.yaml" <<'YAML' +resolution: { width: 640, height: 360 } +fps: 30 +scenes: + - id: opener + kind: image + src: shots/s01.png + duration: 2 + - id: body + kind: frames + src: shots + rate: 1.0 +YAML + +out="$WORK/out.mp4" +if "$SCRIPTS/assemble" "$WORK/scenes.yaml" "$out" >"$WORK/log" 2>&1; then + ok "assemble runs" +else + no "assemble runs"; sed 's/^/ /' "$WORK/log" +fi + +# opener 2s + body max(4s pictures, 6s narration) = 8s +total="$(dur "$out")" +if about "$total" 8 0.4; then ok "segment = max(narration, visuals)" +else no "segment = max(narration, visuals): got ${total}s, wanted ~8"; fi + +offset="$(python3 -c "import json;print(json.load(open('$WORK/segments/offsets.json'))['body'])" 2>/dev/null)" +if about "${offset:-0}" 2 0.3; then ok "offsets.json places the narrated scene" +else no "offsets.json places the narrated scene: got ${offset:-none}, wanted ~2"; fi + +if "$SCRIPTS/make-subtitles" "$WORK/narration/manifest.json" "$WORK/out.srt" \ + --offsets-json "$WORK/segments/offsets.json" >/dev/null 2>&1 \ + && grep -q "00:00:0[2-9]" "$WORK/out.srt"; then + ok "cues start at the scene's real offset, not zero" +else + no "cues start at the scene's real offset, not zero" +fi + +echo +echo "$pass passed, $fail failed" +[ "$fail" -eq 0 ] diff --git a/tests/proving-it-works-with-a-movie/test-check-movie.sh b/tests/proving-it-works-with-a-movie/test-check-movie.sh new file mode 100755 index 0000000..05242da --- /dev/null +++ b/tests/proving-it-works-with-a-movie/test-check-movie.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash +# Regression tests for scripts/check-movie. +# +# Synthesizes movies with known defects using ffmpeg's lavfi sources - no +# fixtures committed, nothing downloaded - and asserts the checker's verdict +# on each. The front-loaded case reproduces the real failure this skill +# exists to prevent: a movie whose action finishes in the first seconds +# while narration keeps talking over a frozen picture. +# +# Usage: tests/proving-it-works-with-a-movie/test-check-movie.sh +set -uo pipefail + +HERE="$(cd "$(dirname "$0")" && pwd)" +CHECKER="$HERE/../../skills/proving-it-works-with-a-movie/scripts/check-movie" +WORK="$(mktemp -d)" +trap 'rm -rf "$WORK"' EXIT + +pass=0 +fail=0 + +for tool in ffmpeg ffprobe uv; do + command -v "$tool" >/dev/null || { echo "SKIP: $tool not on PATH"; exit 0; } +done +[ -x "$CHECKER" ] || { echo "FAIL: $CHECKER is not executable"; exit 1; } + +# --- fixtures ------------------------------------------------------------- +# action for 2s, then a frozen picture for 20s, narration (tone) throughout +ffmpeg -nostdin -y -v error \ + -f lavfi -i "testsrc2=size=320x240:rate=10:d=2" \ + -f lavfi -i "color=c=navy:size=320x240:rate=10:d=20" \ + -f lavfi -i "sine=frequency=300:duration=22" \ + -filter_complex "[0:v][1:v]concat=n=2:v=1:a=0[v]" \ + -map "[v]" -map 2:a -c:v libx264 -pix_fmt yuv420p -c:a aac -shortest \ + "$WORK/front-loaded.mp4" + +# picture changing throughout, narration throughout +ffmpeg -nostdin -y -v error \ + -f lavfi -i "testsrc2=size=320x240:rate=10:d=22" \ + -f lavfi -i "sine=frequency=300:duration=22" \ + -c:v libx264 -pix_fmt yuv420p -c:a aac -shortest "$WORK/paced.mp4" + +# one static frame for the whole runtime, narration throughout +ffmpeg -nostdin -y -v error \ + -f lavfi -i "color=c=navy:size=320x240:rate=10:d=12" \ + -f lavfi -i "sine=frequency=300:duration=12" \ + -c:v libx264 -pix_fmt yuv420p -c:a aac -shortest "$WORK/still.mp4" + +# motion, but no audio track at all +ffmpeg -nostdin -y -v error \ + -f lavfi -i "testsrc2=size=320x240:rate=10:d=12" \ + -c:v libx264 -pix_fmt yuv420p "$WORK/silent.mp4" + +# subtitles: one covering the whole runtime, one that gives up early +cat > "$WORK/paced.srt" <<'SRT' +1 +00:00:00,000 --> 00:00:07,000 +A narrated movie needs subtitles: +plenty of people watch muted. + +2 +00:00:07,000 --> 00:00:14,000 +The checker treats their absence +as a defect, not a nicety. + +3 +00:00:14,000 --> 00:00:21,500 +And it notices when they stop +before the narration does. +SRT +head -8 "$WORK/paced.srt" > "$WORK/short.srt" +cp "$WORK/paced.mp4" "$WORK/short.mp4" + +# --- assertions ----------------------------------------------------------- +check() { # check