Skip to content

feat(cli): keyframes command (surface GSAP/CSS/Anime keyframes + 3D onion-skin --shot)#1603

Open
miguel-heygen wants to merge 24 commits into
mainfrom
feat/keyframes-cli
Open

feat(cli): keyframes command (surface GSAP/CSS/Anime keyframes + 3D onion-skin --shot)#1603
miguel-heygen wants to merge 24 commits into
mainfrom
feat/keyframes-cli

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Problem

The PR originally introduced the motion-surfacing tool as hyperframes keyframes, but the intended product/skill name is now motion. Leaving the command, implementation files, and skill package named keyframes makes the public CLI surface feel narrower than what the tool actually does: inspect, debug, and improve rendered motion.

What this fixes

  • Exposes the CLI as npx hyperframes motion.
  • Renames the command implementation from keyframes*.ts to motion*.ts while preserving the keyframe data model inside the command where that term is still accurate.
  • Renames the shipped skill from hyperframes-keyframes to hyperframes-motion.
  • Expands the skill from a command reference into a motion-design workflow: reading motion, 3D angle verification, layered GSAP motion, one-shot reference reproduction, diagnostic checks, and eval-derived craft guidance.

Root cause

The original command name described one implementation detail: surfacing GSAP keyframes. The tool has grown into a broader motion-debugging loop with onion-skin screenshots, true-3D sampling, composed ancestor motion, multi-stroke traces, and motion-design critique. The source layout and skill name needed to match that broader behavior.

Verification

Local checks

  • git diff --cached --check
  • bunx oxfmt --check packages/cli/src/cli.ts packages/cli/src/commands/motion.ts packages/cli/src/commands/motion.test.ts packages/cli/src/commands/motionShot.ts packages/cli/src/commands/motionShotLayout.ts packages/cli/src/commands/motionShotLayout.test.ts
  • bunx oxlint packages/cli/src/cli.ts packages/cli/src/commands/motion.ts packages/cli/src/commands/motion.test.ts packages/cli/src/commands/motionShot.ts packages/cli/src/commands/motionShotLayout.ts packages/cli/src/commands/motionShotLayout.test.ts
  • bun run lint:skills
  • bun run test -- src/commands/motion.test.ts src/commands/motionShotLayout.test.ts from packages/cli (22 tests passed)
  • bun run typecheck from packages/cli
  • bun packages/cli/src/cli.ts motion --help

Pre-commit also ran lint, format, fallow, and typecheck successfully for the committed changes.

Browser verification

No browser app flow is affected by this CLI/skill rename. The user-visible smoke path is the CLI help output for hyperframes motion, verified locally.

Notes

  • The branch name is still feat/keyframes-cli; the PR title/body and code now use the motion product name.
  • Unrelated local package.json, bun.lock, and shots/ changes were left unstaged and were not pushed.

…shot

Read-then-edit-source tool for GSAP motion. Surfaces every tween's keyframes as
data; --shot renders a true-3D onion-skin of the real element (samples the live
timeline at N steps; rotation/scale/opacity/colour/3D, not just x/y) for visual
self-verify. Multi-stroke pen-up traces for holed/detached shapes. Framing:
--layout strip (filmstrip), --from/--to (time window), --no-fit, --angle (orbit
camera). Pure geometry+SVG in keyframesShotLayout.ts (unit-tested). Ships the
hyperframes-keyframes skill. Depends only on what's already in main.
Comment thread packages/cli/src/commands/keyframes.ts Fixed
One viewpoint hides depth — a flip reads as a static stack head-on, a tumble looks
flat. Mandate ≥3 angles (front+top+side/iso) for any 3D motion, and --layout strip
for in-place/overlapping motion.
…t-write-wins)

When a brief has channels independent in phase or rate (orbit + axial spin, path +
flap, bounce + roll), layer them across nested elements (parent=trajectory,
child=secondary) instead of cramming one tween; --shot --selector the leaf shows
the composition.
A nested child's rendered motion is composed with its animated ancestors, but the
per-element text/JSON surface showed only the child's own tween — hiding a parent's
path (a judge/agent reading text would miss it). Now each tween is annotated with
its animated DOM ancestors and their motion EXTENT (per-property min..max, so a
closed loop still reveals its travel).
…aligned squash vs spin, heading=tangent, per-channel check) + composed-surface note
@miguel-heygen miguel-heygen changed the title feat(cli): keyframes command — surface GSAP motion + 3D onion-skin --shot feat(cli): motion command — surface GSAP motion + 3D onion-skin --shot Jun 22, 2026
let projectName: string;
let projectDir: string | undefined;
if (raw && raw.endsWith(".html") && existsSync(raw) && statSync(raw).isFile()) {
comps = [surfaceComposition(readFileSync(raw, "utf-8"), basename(raw), raw)];
Internal eval loop guidance, renderable timeline contract, honest
diagnostics, explicit pen-up, geometry-morph rule, cursor causality.
- onUpdate/modifiers ARE seek-safe in HyperFrames (engine seeks with
  totalTime(t,false)); corrects the common 'onUpdate freezes on seek'
  folklore. Verified across core adapter, studio, runtime IIFE.
- morph: trust the emitted geometry string (degenerate Beziers,
  clip-path+border-radius, corner>=edge magnitude).
- 3D: no face-flat landing; backface-visibility on every rotating
  ancestor; don't compound perspective.
- flythrough: drive size by translateZ, cap z<P (projection inverts).
- seek-safety corollaries: drive followers from tl.time() not
  construction order; own t=0 explicitly (fromTo immediate-renders its
  from-state at build); animate values through a real channel.
- 3D: grouping properties (opacity<1/filter/clip-path/mask/overflow)
  flatten preserve-3d and break z-sort; orbit from one phase angle.

V2: skill 87 vs baseline 74, skill won 10/10 (V1 was 6/10); both V1
losses (p2,p4) flipped to wins.
Make 'npx hyperframes motion' see motion it was blind to:
- fold const expressions in keyframes (MemberExpression, array index,
  whitelisted Math.*) instead of emitting __raw:
- seed gsap.set()/tl.set() pre-states as the following tween's start
  keyframe (fixes grow/fold/fade-from reading as flat X->X no-ops)
- resolve addLabel() + label-relative positions to absolute times
- bind toArray()/slice collection aliases to their selector
- label proxy-onUpdate and empty dwell tweens instead of __unresolved__
window.__timelines = { 'comp-1': tl } now recognized as valid
registration and its keys extracted, matching the keyed-assignment form.
The render path seeks window.__timelines[root data-composition-id]; a
missing/mismatched id silently rendered frozen at t=0 while --shot
(which seeks __timelines directly) looked fine. Surface a diagnostic +
console.warn at render-ready instead of failing silently.
A selector matching a static .clip wrapper no longer errors with 'no
animated element to sample'; it samples the root's animated descendants.
Unblocks the documented '--selector .clip --angle iso' 3D verify command.
- render binds the timeline by the root's data-composition-id; register
  window.__timelines under that exact key or the render freezes at t=0
  (while --shot still looks fine). The #1 'looks fine, ships broken' trap.
- --shot shows an element's motion, not painted structure; use
  'snapshot --at' for masked type / metaballs / 3D / layers.
Derive orientation from width/height (1920x1080 was mislabeled
portrait) and read duration from data-duration instead of a default.
text_box_overflow no longer fires on content clipped by an overflow:hidden
ancestor (odometer reels); text_occluded no longer fires on preserve-3d
back faces. Genuine overflow/occlusion still reported.
Always capture a readable end-of-timeline frame (t=duration rendered
blank); --angle <top|side|iso|yaw,pitch> rotates the real painted stage
for orthogonal 3D occlusion/depth verification.
A staggered selector-collection reveal printed as a flat X->X no-op; it
now shows real from/to values and the stagger, so 'does it move' reads true.
The bbox-marker onion is blind to canvas-internal (WebGL) motion. --ghost
captures the canvas pixels at each sample via an in-tick drawImage (seek →
the composition's onUpdate render fires synchronously → read the GL buffer
before it clears, so no preserveDrawingBuffer needed) and composites them
as translucent ghosts (older fainter → newest solid). Errors clearly when
there's no <canvas> (the default onion already covers DOM/SVG).
Rename the `motion` command and `hyperframes-motion` skill to `keyframes` /
`hyperframes-keyframes`. While renaming, fix bugs found in review:

- CSS comments no longer leak into the surfaced rule selector. A `/* */`
  sitting above an @Keyframes reattached to the next rule once the block was
  stripped, corrupting the printed selector and the --shot querySelector.
- --selector now also filters CSS @Keyframes and Anime targets, instead of
  dropping CSS/Anime-only compositions and leaking unrelated runtimes through.
- A trace now requires strokes that actually travel, so in-place tweens (an
  opacity tween carrying a static y) no longer masquerade as multi-stroke
  traces.
- Empty-state message reads "no keyframes found".
- Tip prints the real `hyperframes keyframes` invocation; JSON reports the
  resolved runtime instead of a dead "gsap" default.
- Factory no longer exported (no external consumer).
- Skill notes that --shot seeks WAAPI even though the text surface omits it.

Adds a regression test for the CSS-comment selector leak.

Local fallow hook bypassed: its remaining findings (duplication in motionShot,
gsap, core.test; complexity in the renamed file) pre-date this change and live
in files this commit does not modify. lint, format, and typecheck all pass.
@miguel-heygen miguel-heygen changed the title feat(cli): motion command — surface GSAP motion + 3D onion-skin --shot feat(cli): keyframes command (surface GSAP/CSS/Anime keyframes + 3D onion-skin --shot) Jun 30, 2026
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Renamed the command + skill from motion to keyframes (hyperframes-motion to hyperframes-keyframes) and fixed bugs found in a review of the surfacer:

  • CSS comment leak (selector corruption). A /* */ above an @keyframes reattached to the next rule once the block was stripped, producing selectors like /* note */ .grain-texture. That broke the printed selector and silently dropped the element from --shot (querySelector threw on the corrupted string). Comments are now stripped before parsing. Regression test added.
  • --selector was GSAP-only. It dropped CSS/Anime-only compositions entirely and, when a GSAP tween matched, leaked every unrelated CSS/Anime block through. It now filters @keyframes and Anime targets too.
  • Trace over-detection. Ordinary repeated tweens (a caption fading in/out with a small y) were grouped as a multi-stroke "trace". A stroke now must actually travel, so in-place tweens no longer masquerade as drawing.
  • Empty-state message no longer reads "no all keyframes found"; tip prints the real hyperframes keyframes invocation; JSON reports the resolved runtime; the unused command factory is un-exported; the skill notes --shot seeks WAAPI.

lint / format / typecheck pass. The local fallow hook still flags pre-existing duplication/complexity in files this change does not touch (motionShot.ts, gsap.ts, core.test.ts) plus the renamed file's inherited complexity.

Follow-up not in this push: register hyperframes-keyframes in the skill catalog surfaces (CLAUDE.md, README.md, docs/guides/skills.mdx, skills/hyperframes/SKILL.md) per the repo's "Skill catalog maintenance" rule, so the skill is discoverable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants