Skip to content

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

Merge video-loop gait guard, foot anchor, wide raised-limb canvas, gen --trim-alpha

Soohong Kim02a2c9caf3aa
diff --cc CHANGELOG.md
index 3cdb3eb,5bc7be6..7262572
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -2,16 -2,13 +2,21 @@@
All notable public changes to `sprite-gen` are recorded here. Versions track the `version:` field in `SKILL.md` and `pyproject.toml`.
-## Unreleased
+## Unreleased (v2.3.0)
+- `sprite-gen video` gains the other Grok Imagine generation modes: `--last-frame` pins the closing frame (alone or with `--image`), and `--reference` (repeatable, up to 7) guides the clip with reference images named `<IMAGE_0>`, `<IMAGE_1>`, … in the prompt. `--image` is no longer required on its own. The image-only request body is unchanged and pinned by a snapshot test; the video → loop pipeline (`video-canvas`, `video-frames`, `video-loop`, `video-set`) is untouched.
+- New `video-extend` (`POST /v1/videos/extensions`) continues a 2–15 s clip by 2–10 s and new `video-edit` (`POST /v1/videos/edits`) changes a clip of at most 8.7 s with a prompt. Both force the classic `grok-imagine-video` model (the 1.5 model refuses both endpoints), take no resolution / aspect / model flags because the output inherits the input's, check the input with ffprobe before uploading, and `video-extend` refuses a result shorter than its input.
+- Local pre-checks refuse, before any call: no input at all, more than 7 references, `<IMAGE_n>` tags outside the given references (or with none), 1080p with references, and `last_frame` / `image`+`reference` on the classic model.
+- The `sprite-gen-video-report` carries `mode` (`image-to-video`, `first-last`, `last-frame`, `reference`, `extend`, `edit`), `inputs` (local paths by role) and, for extend / edit, `input_duration`; every existing field stays.
+- Removed the retired `sprite_gen/gen/generate_image.py` shim. It shared its name with the `generate_image()` function that `sprite_gen.gen` exports, so `import sprite_gen.gen.generate_image` replaced the function with the shim module for the rest of the process and the next `sprite_gen.gen.run()` died with `TypeError: 'module' object is not callable` — at runtime, not only under pytest. Nothing routed to the shim (no CLI verb, no `-m` step, no MCP entry), so the fix is deletion: the old module path now fails with `ModuleNotFoundError`, and the only image-generation entry point remains `sprite_gen.gen` / `sprite-gen gen`. `sprite_gen._modules.MODULE_DOMAIN` and the packaging import-surface list drop the row; the `import_probe` fixture stays as a general isolation device.
+- Test isolation: the packaging import-surface probe now restores the parent package attribute and `sys.modules` entry it touched, so importing the retired `sprite_gen.gen.generate_image` shim no longer replaces the `generate_image()` function for later `tests/gen` runs. `pytest tests/packaging tests/gen` is green in any order.
+- Test isolation: `tests/curate` imports its shared helper from `tests/frames` through the `tests/` root instead of by bare module name, so `pytest tests/curate` passes on its own instead of depending on `tests/frames` having been collected first.
+- The expired-login prescription for Grok video and images no longer names a bare prompt (`grok -p ok`): on the grok CLI that starts the coding agent in the current directory, which can read, write and spend on its own. The prescription is now a non-agent round-trip (`grok models`) run from an empty directory, with `grok login` as the fallback, and the message says so. A test pins the prescription to a non-agent command.
+ - `video-loop` gait half-period guard: a `walk`/`run` period shorter than the state's floor (`LoopProfile.min_seconds`: 0.6 s / 0.35 s) is treated as one step of a two-step gait and doubled when the doubled period repeats within 25 % of it — the case where a costume hides the legs and the half period dips as deep as the full one, which the depth rule alone returned as a one-legged loop. The report carries `cycle.half_period_guard` (`applied`, `from`, `to`, depth ratio, or `below_floor` + why it was left alone). `--min-len` still overrides.
+ - `video-loop` one-shot detection no longer refuses an excursion shorter than the periodic window's lower edge; only a cut under 4 frames or longer than the clip is refused. Short performed actions (a set-down, a nod) come back as the frames they are.
+ - `video-loop --anchor feet` (also `video-set --anchor`): re-centre every strip cell on that frame's own foot line so a subject the model walked across an "in-place" canvas stops sliding once per cycle. Strip meta gains `foot_anchor`, `drift_px` and `foot_x`, and declares the spec loader's `anchor` as `[foot_x, h]` so scenes stand the sprite on its feet; the video-set table row carries `drift_px`. Default `none` keeps existing output byte-identical.
+ - `video-canvas` / `video-set`: `cheer`, `wave` and `celebrate` now take the wide canvas (raised limbs leave a 1:1 frame at the top corners), `video-set --shape` forces one shape for a whole batch (wide costumes), and `video-set` carries `cheer` / `wave` motion templates that name no limbs.
+ - `gen --trim-alpha` (with `--transparent`): crop the published PNG to its opaque bbox so the bottom edge is the foot line; the report records `extra.trim_alpha` (`bbox`, `before`, `after`, `margin_px`). The `.raw.png` is untouched.
## v2.2.0 - Independent asset tools and optional scenes