Skip to content

gooseworks-ai/goose-skills / skills/video/render-street-interview

render-street-interview

Verified

Write a street-interview ad from a complete inspected commercial interaction and current brand facts. Render product guessing, or prepare mic-only, prepared-sample or visible-task conversation script/prompt previews. Premise, actions and ad connection vary; capture rules stay fixed. Conversation media delivery is unverified.

FileKindSize
REFERENCE.mdmarkdown7.4 KB
SKILL.mdskill md16.7 KB
TAKES.mdmarkdown1.5 KB
brands/demo-tallgrass-oat.jsonconfig3.9 KB
brands/fizzroot-ep3-a.jsonconfig2.2 KB
brands/fizzroot-ep3-b.jsonconfig2.6 KB
brands/fizzroot-ep3-c.jsonconfig2.3 KB
brands/grimwater.jsonconfig4.6 KB
brands/oleara-ep1-a2.jsonconfig2.5 KB
brands/oleara-ep1-b.jsonconfig2.7 KB
brands/oleara-ep1-c.jsonconfig2.5 KB
episodes/fizzroot-ep3.jsonconfig1009 B
episodes/oleara-ep1.jsonconfig784 B
references/cast-writing.mdmarkdown9.6 KB
references/h3-generation.mdmarkdown2.2 KB
references/model-behaviors.mdmarkdown5.0 KB
references/reference-format-rules.mdmarkdown7.5 KB
references/reference-ledger-items-01-23.mdmarkdown15.6 KB
references/reference-ledger-items-17-28.mdmarkdown13.2 KB
references/reference-ledger-items-29-42.mdmarkdown14.3 KB
references/reference-pipeline.mdmarkdown7.3 KB
references/street-reference-library.jsonconfig6.6 KB
references/street-script-writing.mdmarkdown16.7 KB
scripts/bench.pyscript18.2 KB
scripts/brandkit.pyscript19.3 KB
scripts/build.pyscript8.0 KB
scripts/build_episode.pyscript77.5 KB
scripts/build_looks.pyscript32.2 KB
scripts/check-cut.pyscript66.3 KB
scripts/conversation.pyscript12.8 KB
scripts/edit_timeline.pyscript7.6 KB
scripts/falsify-all.pyscript19.8 KB
scripts/fit_grade.pyscript7.7 KB
scripts/format_spec.pyscript93.2 KB
scripts/measure-pace.pyscript2.8 KB
scripts/media_proxy.pyscript56.8 KB
scripts/paths.pyscript3.0 KB
scripts/phone_look_video.pyscript7.2 KB
scripts/prepare_script_context.pyscript12.0 KB
scripts/recut.pyscript26.5 KB
scripts/selftest.pyscript23.5 KB
scripts/single_gen.pyscript24.9 KB
scripts/variants_gen.pyscript14.0 KB
skill.meta.jsonconfig656 B
tests/READINESS.mdmarkdown13.3 KB
tests/fixtures/brands/grimwater-4816.jsonconfig4.6 KB
tests/fixtures/brands/grimwater-4817.jsonconfig2.3 KB
tests/fixtures/brands/grimwater-4818.jsonconfig2.6 KB
tests/fixtures/brands/grimwater-4819.jsonconfig2.1 KB
tests/fixtures/brands/grimwater-4820.jsonconfig2.8 KB
tests/fixtures/brands/grimwater-4821.jsonconfig2.8 KB
tests/fixtures/brands/grimwater-4822.jsonconfig2.5 KB
tests/fixtures/brands/grimwater-4823.jsonconfig2.3 KB
tests/fixtures/brands/grimwater-4824.jsonconfig4.1 KB
tests/fixtures/brands/grimwater-4827.jsonconfig4.6 KB
tests/fixtures/brands/grimwater-4828.jsonconfig4.3 KB
tests/fixtures/brands/grimwater-4829.jsonconfig3.8 KB
tests/fixtures/brands/grimwater-4830.jsonconfig3.9 KB
tests/fixtures/brands/grimwater-4831.jsonconfig4.2 KB
tests/fixtures/brands/grimwater-4832.jsonconfig3.5 KB
tests/fixtures/brands/grimwater-4833.jsonconfig3.7 KB
tests/fixtures/brands/grimwater-4834.jsonconfig3.9 KB
tests/fixtures/brands/grimwater-4835.jsonconfig3.9 KB
tests/fixtures/episodes/grimwater-ep1.jsonconfig2.2 KB
tests/fixtures/episodes/grimwater-ep2.jsonconfig2.2 KB
tests/fixtures/episodes/grimwater-ep2fix-v2.jsonconfig4.9 KB
tests/fixtures/episodes/grimwater-ep2fix-v3.jsonconfig5.7 KB
tests/fixtures/episodes/grimwater-ep2fix.jsonconfig3.7 KB
tests/fixtures/episodes/grimwater-ep3.jsonconfig2.5 KB
tests/fixtures/episodes/grimwater-ep3b.jsonconfig2.3 KB
tests/fixtures/episodes/grimwater-ep3c.jsonconfig2.3 KB
tests/fixtures/episodes/grimwater-ep4.jsonconfig3.7 KB
tests/fixtures/prompt-snapshots.jsonconfig20.3 KB
tests/smoke-test.mdmarkdown627 B
tests/test_cast_advice.pyscript3.6 KB
tests/test_conversation.pyscript20.5 KB
tests/test_edit_timeline.pyscript8.6 KB
tests/test_finishing.pyscript10.9 KB
tests/test_h3_provider_route.pyscript9.2 KB
tests/test_opt_in_hold_grammar.pyscript4.7 KB
tests/test_prompt_budget.pyscript10.5 KB
tests/test_recut_media.pyscript6.2 KB
tests/test_selector_route.pyscript8.7 KB
tests/test_single_gen_rejection.pyscript7.6 KB
tests/test_skin_and_voice_options.pyscript4.1 KB

scripts/edit_timeline.py

View on GitHub
#!/usr/bin/env python3
"""One source-span map for a recut's captions, shot boundaries and source room tone.

Word times must be measured on the original source. A boundary through a spoken
word is an invalid edit, not permission to print or discard a partial word.
"""
import json
import hashlib
import math
from pathlib import Path

EPS = 0.001


def file_hash(path):
    digest = hashlib.sha256()
    with Path(path).open("rb") as source:
        for chunk in iter(lambda: source.read(1024 * 1024), b""):
            digest.update(chunk)
    return digest.hexdigest()


def load_map(path):
    path = Path(path).resolve()
    data = json.loads(path.read_text(encoding="utf-8"))
    for field in ("source_duration", "output_duration"):
        if not isinstance(data.get(field), (int, float)) or not math.isfinite(data[field]) or data[field] <= 0:
            raise ValueError(f"edit map needs a positive finite {field}")
    if not data.get("segments"):
        raise ValueError("edit map contains no source spans")
    previous = 0.0
    for segment in data["segments"]:
        s, e, a, b = (segment.get(k) for k in ("src_start", "src_end", "out_start", "out_end"))
        if any(not isinstance(v, (int, float)) or not math.isfinite(v) for v in (s, e, a, b)):
            raise ValueError("edit map has an invalid span")
        if not (0 <= s < e <= data["source_duration"] + EPS and a < b):
            raise ValueError("edit map span is outside its source/output")
        if abs(a - previous) > EPS:
            raise ValueError("edit map output spans must be contiguous and start at zero")
        # Measured encode durations can differ by a frame; speed changes need a different map.
        if abs((b - a) - (e - s)) > 0.1:
            raise ValueError("edit map does not describe normal-speed source spans")
        previous = b
    if abs(previous - data["output_duration"]) > EPS:
        raise ValueError("edit map output duration does not match its spans")
    for key in ("source", "output"):
        value = data.get(key)
        if not value and key == "output":
            value = str(path).removesuffix(".plan.json") + ".mp4"
        if not isinstance(value, str) or not value:
            raise ValueError(f"edit map needs {key}")
        candidate = Path(value)
        if not candidate.is_absolute():
            candidate = path.parent / candidate
        data[key] = str(candidate.resolve())
        if data.get(key + "_sha256") and file_hash(data[key]) != data[key + "_sha256"]:
            raise ValueError(f"edit map {key} changed; rebuild from this source rather than reuse stale timings")
    data["_path"] = str(path)
    return data


def load_words(path, source):
    data = json.loads(Path(path).read_text(encoding="utf-8"))
    if not isinstance(data, dict) or Path(data.get("source", "")).resolve() != Path(source).resolve():
        raise ValueError("word timings must name this edit map's original source")
    if data.get("source_sha256") and data["source_sha256"] != file_hash(source):
        raise ValueError("original source changed; measure its word times again")
    words = data.get("words")
    if not isinstance(words, list) or not words:
        raise ValueError("no measured source word timings")
    previous = -1.0
    for s, e, text in words:
        if not all(isinstance(v, (int, float)) and math.isfinite(v) for v in (s, e)) or not (0 <= s < e):
            raise ValueError("invalid source word timing")
        if s < previous or not isinstance(text, str) or not text.strip():
            raise ValueError("source words must be ordered and nonempty")
        previous = s
    return words


def cuts_after_edit(cuts, plan):
    result = []
    previous = None
    for segment in plan["segments"]:
        s, e, a, b = (segment[k] for k in ("src_start", "src_end", "out_start", "out_end"))
        if previous is not None and abs(s - previous) > EPS:
            result.append(a)
        result.extend(a + c - s for c in cuts if s < c < e and a + c - s < b)
        previous = e
    return sorted(set(round(c, 6) for c in result if EPS < c < plan["output_duration"] - EPS))


def captions_after_edit(rows, plan, words=None):
    if words is not None:
        for ws, we, word in words:
            if we > plan["source_duration"] + EPS:
                raise ValueError("word timing is outside the original source")
            for segment in plan["segments"]:
                s, e = segment["src_start"], segment["src_end"]
                if we <= s + EPS or ws >= e - EPS:
                    continue
                if ws < s - EPS or we > e + EPS:
                    raise ValueError(f"edit boundary cuts spoken word {word!r} at {ws:.3f}-{we:.3f}; widen the source span")
    result = []
    for segment in plan["segments"]:
        s, e, a, b = (segment[k] for k in ("src_start", "src_end", "out_start", "out_end"))
        for start, end, text, style, job, sentence in rows:
            left, right = max(start, s), min(end, e)
            if right <= left + EPS:
                continue
            clipped = start < s - EPS or end > e + EPS
            if style != "title" and words is not None:
                line = [w for w in words if start <= (w[0] + w[1]) / 2 < end]
                if not line:
                    raise ValueError("caption source span contains no measured words; correct the source schedule or transcription")
                kept = []
                for ws, we, word in line:
                    if we <= s + EPS or ws >= e - EPS:
                        continue
                    if ws < s - EPS or we > e + EPS:
                        raise ValueError(f"edit boundary cuts spoken word {word!r} at {ws:.3f}-{we:.3f}; widen the source span")
                    kept.append((ws, we, word))
                if not kept:
                    continue
                left, right = max(left, kept[0][0]), min(right, kept[-1][1] + 0.1)
                if len(kept) != len(line):
                    sentence = " ".join(w[2] for w in kept)
                    text = sentence.upper()
            elif style != "title" and clipped:
                raise ValueError("partial caption span needs measured original word timings; supply --word-times")
            out_start, out_end = a + left - s, min(b, a + right - s)
            if out_end > out_start + EPS:
                result.append((out_start, out_end, text, style, job, sentence))
    return sorted(result, key=lambda row: row[0])


def measure_words(source, cfg):
    # Reuse the existing episode's local transcription and spelling alignment.
    # Imports stay lazy: fixtures and complete-span maps need no Whisper install.
    import brandkit
    from build_episode import word_times, spell_from_script
    words, _heard = word_times(Path(source))
    words, problems = spell_from_script(words, " ".join([cfg["question"]] + brandkit.spoken_lines(cfg)))
    for problem in problems:
        print(f"CAPTION SOURCE: {problem}")
    if not words:
        raise ValueError("local transcription returned no measured source words")
    return words


if __name__ == "__main__":
    import argparse
    import brandkit
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--source", type=Path, required=True)
    parser.add_argument("--brand", required=True)
    parser.add_argument("--word-times", type=Path, required=True, help="output measured word-times JSON, free local Whisper")
    args = parser.parse_args()
    words = measure_words(args.source.resolve(), brandkit.load(args.brand))
    args.word_times.parent.mkdir(parents=True, exist_ok=True)
    args.word_times.write_text(json.dumps({"source": str(args.source.resolve()), "source_sha256": file_hash(args.source), "words": words}, indent=2) + "\n", encoding="utf-8")
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexUnverifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall