Skip to content

Make visual-parity dom-box-provider node-id attribute configurable (de-figma)#263

Merged
chubes4 merged 1 commit into
trunkfrom
cook/visual-parity-dom-box-generic
Jun 28, 2026
Merged

Make visual-parity dom-box-provider node-id attribute configurable (de-figma)#263
chubes4 merged 1 commit into
trunkfrom
cook/visual-parity-dom-box-generic

Conversation

@chubes4

@chubes4 chubes4 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What

First step of the visual-parity centralization: de-figma the php-transformer/tools/visual-parity/bin/dom-box-provider.mjs so the product-neutral visual-parity tool no longer hardcodes figma DOM attributes.

Change

  • The node-identity attribute is now configurable via --node-id-attr / --node-name-attr and HOMEBOY_DOM_BOX_NODE_ID_ATTR / HOMEBOY_DOM_BOX_NODE_NAME_ATTR (CLI overrides env; names validated). Selector generation, node enumeration, and id/name reads all key off the configured attribute — no hardcoded data-figma-* in logic.
  • Backward-compatible default kept as data-figma-node-id / data-figma-node-name,data-figma-name (+ aria-label name fallback), because the figma runtime supplies the provider command externally via HOMEBOY_DOM_BOX_CAPTURE_COMMAND; a generic default would have silently broken live figma capture. The default flips to generic when figma repoints during the package extraction (documented).

Verification

  • node --check all bins; npm test (smoke) green — now asserts both the figma default path and a generic-attr path (via env and CLI).
  • composer test:contract in figma-transformer → green (figma consumer unaffected).

Follow-up

Staged plan for the remaining extraction (sibling blocks-engine/visual-parity package, Tier-1/Tier-2 split, 4-repo consumer repoints, comparator de-dup) is in the cook report; this PR is the isolated, self-contained down-payment.

AI assistance

  • AI assistance: Yes
  • Tool(s): Claude Code (Claude Opus 4.8, 1M context)
  • Used for: Implementation + tests under human review.

The visual-parity dom-box-provider hardcoded figma's data-figma-* attributes
for node enumeration, selector generation, and id/name reads, coupling the
otherwise product-neutral tool to a single source format.

Make the node-identity attribute configurable via CLI flag (--node-id-attr,
--node-name-attr) and env var (HOMEBOY_DOM_BOX_NODE_ID_ATTR,
HOMEBOY_DOM_BOX_NODE_NAME_ATTR). The configured attribute drives element
enumeration, selector generation, and id reads; node-name attributes are
tried in order with aria-label as a generic final fallback. Defaults stay
data-figma-node-id / data-figma-node-name,data-figma-name so existing figma
callers (figma-fixture-matrix.php and its contract) work unchanged.

Cover both the figma default path and the configured generic attribute path
(env and flag) in the smoke test. Document the settings in the README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chubes4 chubes4 merged commit 536fd07 into trunk Jun 28, 2026
1 check passed
@chubes4 chubes4 deleted the cook/visual-parity-dom-box-generic branch June 28, 2026 01:10
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