Skip to content

fix(core,cli): parent-relative figma child geometry; groups stop rejecting subcommand flags#2063

Open
vanceingalls wants to merge 1 commit into
mainfrom
vi/figma-mapper-fixes
Open

fix(core,cli): parent-relative figma child geometry; groups stop rejecting subcommand flags#2063
vanceingalls wants to merge 1 commit into
mainfrom
vi/figma-mapper-fixes

Conversation

@vanceingalls

Copy link
Copy Markdown
Collaborator

Both bugs surfaced while executing the brand-loop guide end-to-end against Figma's Simple Design System (follow-up to #2053).

1. Figma mapper: nested children were positioned root-relative

nodeToHtml subtracted the ROOT frame's origin from every node's absolute bounds. CSS absolute positioning resolves against the nearest positioned ancestor, so every nesting level re-added its ancestors' offsets — nested content drifted down-right and deep children left the frame entirely. On real SDS frames: hero buttons invisible, three-card pricing grid collapsed to a single off-center card.

Children now subtract their parent's box. Regression test with a two-level tree asserts parent-relative coords and rejects the double-offset values.

Before/after on the same SDS import (Hero Actions, Card Grid Pricing):

  • before: title bottom-right of an empty box, no buttons; pricing = one dark rectangle
  • after: pixel-faithful hero (title, subtitle, neutral + brand buttons) and full three-card grid with featured card

2. CLI: command groups rejected their subcommands' flags

trackCommandFailures runs assertKnownFlags on every wrapped run. A command group like figma (subCommands + fallback-help run) asserted the raw args against its own flagless table, so hyperframes figma component <ref> --name x completed the import and THEN threw Unknown flag: --name. The check is now skipped when the first positional names a subcommand; leaf commands and non-delegating group invocations still reject unknown flags (all covered by new tests).

Validation

  • core figma suite 96/96, cli utils 431/431
  • Live: SDS hero + pricing re-imported and rendered pixel-faithful; full brand-loop (v1 stock → figma rebrand → value-only re-sync → v2 purple) re-run with components byte-identical

🤖 Generated with Claude Code

…cting subcommand flags

Both found running the brand-loop guide end-to-end against the Simple
Design System:

- nodeToHtml subtracted the ROOT origin from every node's absolute bounds,
  but CSS absolute positioning resolves against the nearest positioned
  ancestor — every nesting level re-added its ancestors' offsets, drifting
  nested content down-right and pushing deep children off-frame (hero
  buttons invisible, pricing grid collapsed to one card). Children now
  subtract their PARENT's box; regression test with a two-level tree.

- trackCommandFailures asserted unknown flags against the command group's
  own (flagless) arg table even when the group was delegating to a
  subcommand, so `figma component <ref> --name x` imported and THEN threw
  "Unknown flag: --name". The assertion is now skipped when the first
  positional names a subcommand; leaf and non-delegating behavior is
  unchanged and covered by tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant