Skip to content

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

refactor(pixel-draw): the effort order is anthropic_api.EFFORTS, the copy removed, and an effect strip's kind is the drawing's kind, EFFECT

Soohong Kim40812f9493e1
diff --git a/sprite_gen/gen/pixel_draw.py b/sprite_gen/gen/pixel_draw.py
index aa7d5ce..ee45e3c 100644
--- a/sprite_gen/gen/pixel_draw.py
+++ b/sprite_gen/gen/pixel_draw.py
@@ -62,7 +62,7 @@ from sprite_gen.spec.runio import atomic_write_text
from sprite_gen.util.cli_kwargs import namespace_from_kwargs
from . import anthropic_api as api
from . import claude_login, refusal
-from .anthropic_api import ApiError, Reply
+from .anthropic_api import EFFORTS, ApiError, Reply
from .base import announce_api_billing, flags_over_spec, print_json
from .pixel_gates import EFFECT, KINDS, SPRITE, TILE, colors_used, evaluate, safe_area
from .pixel_grid import (
@@ -85,7 +85,6 @@ EFFECT_FRAMES = ("birth", "peak", "decay", "gone")
CANDIDATES_MIN, CANDIDATES_MAX, CANDIDATES_DEFAULT = 1, 6, 2
EFFORT_CHOICES = ("medium", "high", "xhigh")
EFFORT_DEFAULT = "high"
-EFFORTS = ("low", "medium", "high", "xhigh", "max")
LOWER_EFFORT = {"max": "xhigh", "xhigh": "high", "high": "medium", "medium": "low"}
MAX_TOKENS_SINGLE, MAX_TOKENS_MULTI = 32000, 64000
MAX_TOKENS_MIN = 1024
@@ -1104,7 +1103,7 @@ def write_files(directory: Path, grid: Grid, request_frames: tuple[str, ...], ki
for i, pixels in enumerate(frames.values()):
strip.paste(image_of(pixels), (i * grid.width, 0))
strip.save(directory / "effect.strip.png")
- meta = {"kind": "effect", "frames": len(frames), "w": grid.width, "h": grid.height,
+ meta = {"kind": EFFECT, "frames": len(frames), "w": grid.width, "h": grid.height,
"loop": False, "hold_last": False, "end_frame": len(frames) - 1,
"events": [], "blend": "add", "anchor": [grid.width / 2, grid.height / 2],
"delay_ms": duration_ms, "frame_names": list(frames)}
diff --git a/tests/gen/test_pixel_draw.py b/tests/gen/test_pixel_draw.py
index ff87fb9..28947b0 100644
--- a/tests/gen/test_pixel_draw.py
+++ b/tests/gen/test_pixel_draw.py
@@ -124,6 +124,10 @@ def asked(fake: FakeClaude) -> list[str]:
return [call_id for call_id, _ in fake.asked]
+def test_the_effort_order_is_the_api_s() -> None:
+ assert pixel_draw.EFFORTS is api.EFFORTS
+
+
def test_one_candidate_is_drawn_checked_and_written(tmp_path, claude, capsys):
fake = claude({"c1-gen1": reply(SPRITE16, output=2515, thinking=2300)})
out = tmp_path / "run"