Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
refactor(video): a source identity's kind is declared once, as video.evidence.SOURCE_KIND, which source_identity writes, a source manifest rebuilds and loop-compare checks
Soohong Kimc220ed4528d0
diff --git a/sprite_gen/video/compare.py b/sprite_gen/video/compare.pyindex 1577f9c..c681a46 100644--- a/sprite_gen/video/compare.py+++ b/sprite_gen/video/compare.py@@ -95,7 +95,7 @@ class Loop:if self.source_report.get("kind") != loop_mod.REPORT_KIND or self.source_report.get("status") != loop_mod.REPORT_PASSED:return "source-report-unverified"sha = src.get("sha256")- if (src.get("kind") != "keyed-frame-sequence" or not isinstance(sha, str) or len(sha) != 64+ if (src.get("kind") != evidence.SOURCE_KIND or not isinstance(sha, str) or len(sha) != 64or any(c not in "0123456789abcdef" for c in sha)or not isinstance(src.get("frames"), int) or isinstance(src["frames"], bool) or src["frames"] < 1or not _number(src.get("fps")) or src["fps"] <= 0):diff --git a/sprite_gen/video/evidence.py b/sprite_gen/video/evidence.pyindex cf14bdf..3efc804 100644--- a/sprite_gen/video/evidence.py+++ b/sprite_gen/video/evidence.py@@ -11,6 +11,10 @@ from PIL import Imagefrom sprite_gen.video import legs+# What a source identity is (`source_identity`): the ordered keyed frames a cut was read from. A source manifest+# rebuilds one from its files (`source`) and a comparison checks a report's against it (`compare`).+SOURCE_KIND = "keyed-frame-sequence"+def digest(data: bytes) -> str:return hashlib.sha256(data).hexdigest()@@ -27,7 +31,7 @@ def engine_identity() -> dict[str, str]:def source_identity(files: list[Path], fps: float) -> dict[str, Any]:"""Ordered original keyed-file bytes, before anchoring, cleanup, or size hold."""- return {"kind": "keyed-frame-sequence", "sha256": digest(b"".join(bytes.fromhex(digest(p.read_bytes())) for p in files)),+ return {"kind": SOURCE_KIND, "sha256": digest(b"".join(bytes.fromhex(digest(p.read_bytes())) for p in files)),"frames": len(files), "fps": fps}diff --git a/sprite_gen/video/source.py b/sprite_gen/video/source.pyindex ad7050e..ceeb39f 100644--- a/sprite_gen/video/source.py+++ b/sprite_gen/video/source.py@@ -118,7 +118,7 @@ class Source:raise ValueError("source must contain PNG frames")images.append(im.convert("RGBA"))hashes.append(bytes.fromhex(evidence.digest(blob)))- identity = {"kind": "keyed-frame-sequence", "sha256": evidence.digest(b"".join(hashes)),+ identity = {"kind": evidence.SOURCE_KIND, "sha256": evidence.digest(b"".join(hashes)),"frames": len(images), "fps": fps}if m.get("source") != identity or report.get("frames") != len(images):raise ValueError("source sequence identity differs from actual files")