Skip to content

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

docs(ui-kit): the mark between the two dots in the test list

Soohong Kim0f6d32d8ee84
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c0e48a8..3c6a32a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,7 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the
## Unreleased
- **Behavior change: the UI kit cut reads the drawing with one exact judgment instead of a centring heuristic.** Previously, each part went to the box that holds its centroid, with every box widened by half the gap. When that left a box empty, the layout was fitted to the drawing (least squares of box centres to the centres of what the boxes held, then assign again, at most 8 rounds) and kept when it left fewer required boxes empty, or as many and fewer boxes in all, reported as `layout_fit`. The only refusal of the cut was an empty frame. With several band elements missing on a drifted sheet, a drawn element could be cut under a neighbour's name, a drawn part named missing, or an undrawn element present; a drawing that fit the layout in two ways was cut silently under one of them; and a fit dragged by a small element placed off its box's centre gave wrong readings. The cut is the one reading within 1 px of the least cost, found by one exact search over the drifts the cut considers (a scale from 0.875 to 1.125 and an offset of at most 120 px at 1024), and every refusal comes from that one result ([ui-kit](docs/ui-kit.md#reading-the-drawing)). Every drawn element is cut under its own name, or the sheet is refused. A drawing that fits the layout in two ways is refused, naming both readings. New refusals: drifted further, ambiguous, off-centre, and off the layout. A sheet drawn on its guide is cut exactly as before, report bytes included. A sheet whose every part lies at least 1 px inside its box under some drift within the accepted range (along each axis a scale from 0.9 to 1.1 and an offset of at most 96 px at 1024), with all seven frames drawn, is cut exactly as drawn or refused as fitting the layout in two ways, never refused for another reason. A sheet with stray marks (parts in no box under the drift it was drawn with) is outside it.
-- **Tests** — synthetic sheets cover the change: the two-way ambiguous sheet (512 × 768 px, seven 20 × 8 px frames, one dot on `pip_on` and squeezed `pip_off`) with an 18 px and a 60 px dot, refused by `split_ui_kit` and the CLI; the control sheet cut as `pip_off`; 512 sheets of small drawings and 256 sheets of full-size frames with small band drawings cut as drawn or refused as ambiguous, with three sheets previously refused as drifted now cut as drawn; each of the 256 sets of missing band elements under random accepted drifts; squeezes from the top by 0.90 to 0.99; a 17-sheet counterexample search; sheets refused as drifted further (20 % shorter), off-centre (dot in the gap), and required (each frame left out); and 4 px scattered squares proved off the layout within 10 seconds. A square sheet and a 2:3 sheet drawn on their guide are cut byte for byte as before, with no `layout_fit`.
+- **Tests** — synthetic sheets cover the change: the two-way ambiguous sheet (512 × 768 px, seven 20 × 8 px frames, one dot on `pip_on` and squeezed `pip_off`) with an 18 px and a 60 px dot, refused by `split_ui_kit` and the CLI; the control sheet cut as `pip_off`; 512 sheets of small drawings and 256 sheets of full-size frames with small band drawings cut as drawn or refused as ambiguous, with three sheets previously refused as drifted now cut as drawn; each of the 256 sets of missing band elements under random accepted drifts; squeezes from the top by 0.90 to 0.99; a 17-sheet counterexample search; sheets refused as drifted further (20 % shorter), off-centre (dot in the gap), and required (each frame left out); a 2:3 sheet drawn on its guide with a mark 4 px wide and 20 px tall centred in the gap between the boxes of the two dots (`pip_on` above, `pip_off` below), refused as ambiguous (`pip_on, pip_off`); and 4 px scattered squares proved off the layout within 10 seconds. A square sheet and a 2:3 sheet drawn on their guide are cut byte for byte as before, with no `layout_fit`.
- **Fix: the test suite runs on Windows.** `pyproject.toml` named pytest-timeout's `signal` method, and Windows has no SIGALRM, so pytest stopped with an internal error before its first test unless `-o timeout_method=thread` was given. The method is now left to pytest-timeout, which takes `signal` where SIGALRM exists (Linux, macOS: unchanged) and `thread` on Windows. Test: `tests/packaging/test_project_metadata.py`. `tests/video/test_one_step_cut.py` skips where img2webp is missing, as the other loop tests do, instead of failing all twelve of its tests.
- **Fix: `sprite-gen prepare --request` keeps the request's `style`.** The subcommand declared its own copy of prepare's options, with `--style` defaulting to the default style sentence and `--cell-size` to 256, so a flag nobody gave counted as given: the request's `style` was replaced by the default sentence under a note that `--style, --cell-size` were given both ways (`scripts/prepare_sprite_run.py` and `prepare.run` were right). The subcommand now takes prepare's own declaration (`prepare.add_arguments`), which also gives it `--directions` and `--mirror`, missing until now. A request with no style and no cell still gets the default sentence and 256. Test: `tests/gen/test_flags_over_spec.py` (through `sprite-gen prepare`: a request alone keeps its style and cell with no note, a given `--style` wins and says so, the subcommand takes every option prepare declares).
- **Behavior change: `pixel-draw` runs on your Claude subscription first, and on `ANTHROPIC_API_KEY` only without one** — the order `codex` and `grok` keep. When `claude auth status` says Claude Code is signed in with a subscription (`claude.ai` or `oauth_token`), every call — the drawings, the row repairs, the pick — goes through the unmodified `claude` binary in print mode, from an empty directory, with no tool, no session written and no CLAUDE.md, hook, skill, plugin or MCP server loaded, and costs nothing per call: `report.json` says `auth_source: claude-login`, each call's `mode` is `subscription` and its `cost_usd` `0`, its usage kept. The child never sees `ANTHROPIC_API_KEY`, which print mode would use instead of the login. Without a subscription login the run uses the key as before, billed per call and said on stderr; with neither it is refused naming both, before the run folder is made. A login that refuses a call, has expired or has reached its usage limit fails the call; the run never switches to the key on its own. `--batch` is the API's Message Batches and runs on the key even when signed in. An answer the binary continues past the output cap is read whole from every message, not from its `result`, which holds only the last part; one it cannot finish is read as `stop_reason: max_tokens`, so the one redraw one effort lower happens on either route. One call may take up to `SPRITE_GEN_CLAUDE_CALL_TIMEOUT_SECONDS` (1800). When candidates ask at once, none of their requests leaves before the billing line has been printed. `report.json`'s `auth_source` is what the calls ran on by their records, `mixed` (with `auth_sources`) for a run resumed under the other credential. A `--resume` that reads every call back no longer prints the billing line ([pixel-draw](docs/pixel-draw.md#which-credential-a-call-runs-on)).
diff --git a/docs/ui-kit.md b/docs/ui-kit.md
index 61875ca..0db632f 100644
--- a/docs/ui-kit.md
+++ b/docs/ui-kit.md
@@ -113,6 +113,7 @@ The tests (all synthetic sheets):
* A sheet squeezed from the top by 0.90 to 0.99 with three band elements left out names exactly those missing.
* A counterexample search, which proves nothing when it finds none: on 17 sheets, thousands of drifts at random (uniform over the drifts the cut considers, and near the drift drawn and the cut's), evaluated by the test itself. None reads the drawing at a lower cost than the least the cut found, and for a cut sheet no valid reading within 1 px of the least valid cost reads it otherwise.
* Still refused with their own reasons: a sheet drawn 20 % shorter (drifted further), the lit dot drawn into the gap below its box (off-centre, named by the box whose widened box holds it), each frame left out (required).
+* The gap between the boxes of the two dots (`pip_on` above, `pip_off` below) is exactly twice the reach (half the gap is the widening), so their widened boxes touch: under every drift that keeps a mark inside the dots' columns, the mark's centroid lies in one of the two widened boxes. The test draws a 2:3 sheet on its guide and a mark 4 px wide and 20 px tall centred in that gap. In no box it would cost less than in either dot's box, but no drift reads it in no box, so no such reading is cut or named. The two readings that put it in a dot's box fit the sheet equally well: the sheet is refused as ambiguous (`pip_on, pip_off`), and each of the two readings the refusal names reads the sheet as it says (checked by the test's own evaluation), with the mark in a box.
* A sheet whose elements are 4 px squares (16 px, the smallest part kept), each anywhere inside its moved box, with about half the band left out and sixty more such squares scattered over the sheet, is decided within 10 seconds: most squares lie in no box under any drift, and the search proves every reading costs more than 1 px within its work bound and refuses it as off the layout.
* A square sheet and a 2:3 sheet drawn on their guide are cut byte for byte as before, with no `layout_fit`.