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.
Python 3dagent-skillsai-videoanimationblenderclaude-codeclaude-skillsclaymationcodexexplainer-videoffmpeggsaphyperframeskinetic-typographymanimmotion-graphicstext-to-videothreejsvideo-generationyoutube-shorts
fix: read and write art-form files as UTF-8 with LF, for Windows
Varun Pratap Bhardwaj654532f8a8de
diff --git a/docs/art-forms-guide/build.py b/docs/art-forms-guide/build.pyindex 9e461ee..2af19e0 100644--- a/docs/art-forms-guide/build.py+++ b/docs/art-forms-guide/build.py@@ -15,7 +15,7 @@ from pathlib import PathHERE = Path(__file__).resolve().parentREPO = HERE.parent.parentSKILL = REPO / 'plugin' / 'skills' / 'brief2mp4'-DATA = json.loads((SKILL / 'references' / 'art-forms.json').read_text())+DATA = json.loads((SKILL / 'references' / 'art-forms.json').read_text(encoding='utf-8'))FORMS = DATA['forms']E = html.escape@@ -202,10 +202,10 @@ doc = '''<!doctype html><html lang="en"><head><meta charset="utf-8"><title>brief<meta name="author" content="Varun Pratap Bhardwaj"><meta name="description" content="%d art forms for animated video, with the rules, timing and build recipe for each."><meta name="keywords" content="animation styles, claymation, paper cut-out, cel shading, stop motion, HyperFrames, three.js, Claude Code skill"><link rel="stylesheet" href="guide.css"></head><body>%s</body></html>''' % (len(FORMS), ''.join(parts))-(HERE / 'brief2mp4-art-forms.html').write_text(doc)+(HERE / 'brief2mp4-art-forms.html').write_text(doc, encoding='utf-8')text = re.sub(r'<pre>.*?</pre>', ' ', doc, flags=re.S)text = re.sub(r'<p class="src">.*?</p>', ' ', text, flags=re.S)text = re.sub(r'</(p|h1|h2|h3|li|td|th|figcaption|div|a|section)>', '\n', text)text = html.unescape(re.sub(r'<[^>]+>', '', text))-(HERE / 'guide-prose.txt').write_text('\n'.join(line.strip() for line in text.splitlines() if line.strip()) + '\n')+(HERE / 'guide-prose.txt').write_text('\n'.join(line.strip(, encoding='utf-8') for line in text.splitlines() if line.strip()) + '\n')print('%d sections, %d words of prose' % (len(SECTIONS) + 2, len(text.split())))diff --git a/plugin/skills/brief2mp4/scripts/art_route.py b/plugin/skills/brief2mp4/scripts/art_route.pyindex 6a9b7ab..78b6a21 100644--- a/plugin/skills/brief2mp4/scripts/art_route.py+++ b/plugin/skills/brief2mp4/scripts/art_route.py@@ -41,7 +41,7 @@ SUBJECTS = [def load():- return json.loads((REF / 'art-forms.json').read_text())+ return json.loads((REF / 'art-forms.json').read_text(encoding='utf-8'))def route(brief, data=None):@@ -103,12 +103,15 @@ def report(r):def main(argv):+ for stream in (sys.stdout, sys.stdin): # Windows consoles default to a legacy code page+ if hasattr(stream, 'reconfigure'):+ stream.reconfigure(encoding='utf-8')args = [a for a in argv if not a.startswith('--')]if '--help' in argv or '-h' in argv or not args:print('usage: python3 art_route.py <BRIEF.md | -> [--json]\n Proposes an art form for a video brief, with reasons. "-" reads the brief from standard input.')return 0 if ('--help' in argv or '-h' in argv) else 2try:- brief = sys.stdin.read() if args[0] == '-' else Path(args[0]).read_text()+ brief = sys.stdin.read() if args[0] == '-' else Path(args[0]).read_text(encoding='utf-8')except OSError as e:print('art_route.py: cannot read %s: %s' % (args[0], e), file=sys.stderr)return 2diff --git a/plugin/skills/brief2mp4/scripts/build_art_forms.py b/plugin/skills/brief2mp4/scripts/build_art_forms.pyindex 582f50f..bcee8e5 100644--- a/plugin/skills/brief2mp4/scripts/build_art_forms.py+++ b/plugin/skills/brief2mp4/scripts/build_art_forms.py@@ -17,8 +17,8 @@ from pathlib import PathSKILL = Path(__file__).resolve().parent.parentREF = SKILL / 'references'-DATA = json.loads((REF / 'art-forms.json').read_text())-LOOKS_JS = (SKILL / 'art-forms' / 'looks.js').read_text()+DATA = json.loads((REF / 'art-forms.json').read_text(encoding='utf-8'))+LOOKS_JS = (SKILL / 'art-forms' / 'looks.js').read_text(encoding='utf-8').replace('\r\n', '\n')def look_source(look_id):@@ -110,14 +110,14 @@ def main():check = '--check' in sys.argvstale = 0for path, text in files.items():- if path.exists() and path.read_text() == text:+ if path.exists() and path.read_text(encoding='utf-8').replace('\r\n', '\n') == text: # a Windows checkout may hold CRLFcontinueif check:print('out of date: %s' % path.relative_to(SKILL))stale += 1else:path.parent.mkdir(parents=True, exist_ok=True)- path.write_text(text)+ path.write_text(text, encoding='utf-8', newline='\n')if check:print('art forms: %d generated files are current' % len(files) if not stale else '%d generated file(s) out of date: run python3 scripts/build_art_forms.py' % stale)sys.exit(1 if stale else 0)diff --git a/tests/test_art_forms.py b/tests/test_art_forms.pyindex bac168d..5be7d58 100644--- a/tests/test_art_forms.py+++ b/tests/test_art_forms.py@@ -13,8 +13,8 @@ import pytestREPO = Path(__file__).resolve().parents[1]SKILL = REPO / "plugin" / "skills" / "brief2mp4"REF = SKILL / "references"-DATA = json.loads((REF / "art-forms.json").read_text())-LOOKS_JS = (SKILL / "art-forms" / "looks.js").read_text()+DATA = json.loads((REF / "art-forms.json").read_text(encoding='utf-8'))+LOOKS_JS = (SKILL / "art-forms" / "looks.js").read_text(encoding="utf-8").replace("\r\n", "\n")sys.path.insert(0, str(SKILL / "scripts"))import art_route # noqa: E402@@ -64,12 +64,12 @@ def test_stepped_looks_quantise_time():def test_generated_pages_are_current():- out = subprocess.run([sys.executable, str(SKILL / "scripts" / "build_art_forms.py"), "--check"], capture_output=True, text=True)+ out = subprocess.run([sys.executable, str(SKILL / "scripts" / "build_art_forms.py"), "--check"], capture_output=True, text=True, encoding="utf-8")assert out.returncode == 0, out.stdoutfor form in DATA["forms"]:- page = (REF / "art-forms" / f"{form['id']}.md").read_text()+ page = (REF / "art-forms" / f"{form['id']}.md").read_text(encoding='utf-8')assert "## Tested demo" in page and "```js" in page and "## Sources" in page- index = (REF / "art-forms.md").read_text()+ index = (REF / "art-forms.md").read_text(encoding='utf-8')assert all(f"art-forms/{f['id']}.md" in index for f in DATA["forms"])@@ -103,14 +103,14 @@ def test_router_says_so_when_nothing_fits():def test_router_command_line(tmp_path):script = str(SKILL / "scripts" / "art_route.py")brief = tmp_path / "BRIEF.md"- brief.write_text("A voxel style trailer for our game")- out = subprocess.run([sys.executable, script, str(brief), "--json"], capture_output=True, text=True)+ brief.write_text("A voxel style trailer for our game", encoding='utf-8')+ out = subprocess.run([sys.executable, script, str(brief), "--json"], capture_output=True, text=True, encoding="utf-8")assert out.returncode == 0 and json.loads(out.stdout)["form"] == "voxel"- piped = subprocess.run([sys.executable, script, "-"], input="neon sign that says OPEN", capture_output=True, text=True)+ piped = subprocess.run([sys.executable, script, "-"], input="neon sign that says OPEN", capture_output=True, text=True, encoding="utf-8")assert piped.returncode == 0 and piped.stdout.startswith("Art form: Neon sign")- empty = subprocess.run([sys.executable, script, "-"], input=" ", capture_output=True, text=True)+ empty = subprocess.run([sys.executable, script, "-"], input=" ", capture_output=True, text=True, encoding="utf-8")assert empty.returncode == 2- assert subprocess.run([sys.executable, script, "--help"], capture_output=True, text=True).returncode == 0+ assert subprocess.run([sys.executable, script, "--help"], capture_output=True, text=True, encoding="utf-8").returncode == 0@pytest.mark.slow