Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

gen-set: call the CLI gen verb (sprite_gen.gen has no __main__); pin the argv

Soohong Kima2c03a51b754
diff --git a/sprite_gen/gen/gen_set.py b/sprite_gen/gen/gen_set.py
index 13b0df6..9f4b5f8 100644
--- a/sprite_gen/gen/gen_set.py
+++ b/sprite_gen/gen/gen_set.py
@@ -75,7 +75,7 @@ def _stages(request: dict[str, Any], states: list[str]) -> list[list[str]]:
def run_gen_cli(prompt_file: Path, out: Path, refs: list[Path], report: Path, *, provider: str | None, model: str | None, log: Path) -> int:
import subprocess
- cmd = [sys.executable, "-m", "sprite_gen.gen", "--prompt-file", str(prompt_file), "--out", str(out), "--report", str(report)]
+ cmd = [sys.executable, "-m", "sprite_gen.cli", "gen", "--prompt-file", str(prompt_file), "--out", str(out), "--report", str(report)]
for ref in refs:
cmd += ["--ref", str(ref)]
if provider:
diff --git a/tests/gen/test_gen_set.py b/tests/gen/test_gen_set.py
index 1084f58..1cf84fe 100644
--- a/tests/gen/test_gen_set.py
+++ b/tests/gen/test_gen_set.py
@@ -119,3 +119,25 @@ def test_gen_set_direction_run_generates_anchors_first_and_stops_on_anchor_failu
# stage 2 rows were not started — the base is never re-attached in place of a missing anchor
assert payload["not_started"] and all("_idle" not in s for s in payload["not_started"])
assert not any(s.startswith("left_") for s in payload["states"]), "mirrored directions are skipped by contract"
+
+
+def test_run_gen_cli_invokes_the_cli_gen_verb(tmp_path: Path, monkeypatch) -> None:
+ """The row call is `python -m sprite_gen.cli gen …` — the package has no __main__, so
+ `-m sprite_gen.gen` is not a runnable module (2026-09-09 real-run regression)."""
+ import subprocess
+
+ captured: dict = {}
+
+ def fake_run(cmd, **kw):
+ captured["cmd"] = cmd
+ class R: # noqa: D401 — minimal CompletedProcess stand-in
+ returncode = 0
+ return R()
+
+ monkeypatch.setattr(subprocess, "run", fake_run)
+ log = tmp_path / "x.log"
+ rc = gen_set.run_gen_cli(tmp_path / "p.txt", tmp_path / "o.png", [tmp_path / "a.png", tmp_path / "b.png"], tmp_path / "r.json", provider="codex", model=None, log=log)
+ assert rc == 0
+ cmd = captured["cmd"]
+ assert cmd[1:4] == ["-m", "sprite_gen.cli", "gen"]
+ assert cmd.count("--ref") == 2 and "--provider" in cmd and "--model" not in cmd