feat(affinity): lint-icon-colors, export-icon, export-plate scripts #191

Merged
peterswimm merged 2 commits from docs/allow-affinity-scripts into main 2026-10-07 22:47:11 +00:00
Owner

Scope

The three Affinity Scripting Studio scripts that #190 was meant to carry. #190 was merged while
it held only the docs commit (the scoped JS exception in CLAUDE.md plus the folder README). The
scripts commit was pushed after that merge, so it never reached main. This PR carries that commit
and the test results:

  • Brand/source/_editor/affinity-scripts/lint-icon-colors.js: lists every colour that would not
    re-skin, judged against the category's color_maps in udg/config/assets.yml.
  • export-icon.js: runs the same lint and refuses failing art. Otherwise it writes
    Brand/source/<icons|infographics|wireframes>/ with the repo naming and prints the assets.yml entry.
  • export-plate.js: checks the art is a plate (one colour, no gradient, pattern or raster), then
    exports EPS under Brand/source/components/ and prints the entry (exports: [themeable]).
  • README "Testing notes" updated.

These are designer-side tools that run inside Affinity only. No generator, hook or CI job runs them.

Testing

Affinity 3.3.0.4850 (macOS):

  • Over MCP: lint passes icon-tools-toilville.svg and fails an unmapped colour and an unset
    fill. A re-exported icon builds to the same themed output as the committed one. export-plate
    rejects two-colour art.
  • Scripting panel (saved to the script library): all three scripts reach the repo folder allowed
    in Settings → Scripting, and the prompt, confirm and alert dialogs work, including the overwrite
    confirm.
  • just plates (run in a scratch clone): an Affinity 3.3 EPS export of the rectangle plate
    converts with ghostscript 10.08.0 + poppler to a stamped, single-fill SVG. It renders the same as
    the committed derivative, the committed plates regenerate byte-identical, and
    assets.py build/check pass with a var() fill. No test art was committed.
  • just check: every step passes except artifact.py check, which fails the same way on clean
    origin/main on this Mac (OpenMoji stand-in count 0 vs 16, a missing local source). This PR
    doesn't cause it.

Impact Statement

  • Existing features: no expected impact. No generator reads Brand/source/_editor/.
  • Public APIs / contracts: none.
  • Schemas: none.
  • Data / artifacts: no dist/ change. The scripts read udg/config/assets.yml only.
  • Integrations: Affinity Scripting Studio (designer-side, opt-in).
  • Mappings: none. The allowed colours are read from color_maps at run time, and no hex lives in the scripts.
  • Backward compatibility: fully compatible (additive).

Docs

Brand/source/_editor/affinity-scripts/README.md covers install, rules, settings and testing
notes. The CLAUDE.md exception is already on main via #190.

## Scope The three Affinity Scripting Studio scripts that #190 was meant to carry. #190 was merged while it held only the docs commit (the scoped JS exception in `CLAUDE.md` plus the folder README). The scripts commit was pushed after that merge, so it never reached main. This PR carries that commit and the test results: - `Brand/source/_editor/affinity-scripts/lint-icon-colors.js`: lists every colour that would not re-skin, judged against the category's `color_maps` in `udg/config/assets.yml`. - `export-icon.js`: runs the same lint and refuses failing art. Otherwise it writes `Brand/source/<icons|infographics|wireframes>/` with the repo naming and prints the `assets.yml` entry. - `export-plate.js`: checks the art is a plate (one colour, no gradient, pattern or raster), then exports EPS under `Brand/source/components/` and prints the entry (`exports: [themeable]`). - README "Testing notes" updated. These are designer-side tools that run inside Affinity only. No generator, hook or CI job runs them. ## Testing Affinity 3.3.0.4850 (macOS): - **Over MCP:** lint passes `icon-tools-toilville.svg` and fails an unmapped colour and an unset fill. A re-exported icon builds to the same themed output as the committed one. export-plate rejects two-colour art. - **Scripting panel** (saved to the script library): all three scripts reach the repo folder allowed in Settings → Scripting, and the prompt, confirm and alert dialogs work, including the overwrite confirm. - **`just plates`** (run in a scratch clone): an Affinity 3.3 EPS export of the rectangle plate converts with ghostscript 10.08.0 + poppler to a stamped, single-fill SVG. It renders the same as the committed derivative, the committed plates regenerate byte-identical, and `assets.py build`/`check` pass with a `var()` fill. No test art was committed. - **`just check`:** every step passes except `artifact.py check`, which fails the same way on clean `origin/main` on this Mac (OpenMoji stand-in count 0 vs 16, a missing local source). This PR doesn't cause it. ## Impact Statement - Existing features: no expected impact. No generator reads `Brand/source/_editor/`. - Public APIs / contracts: none. - Schemas: none. - Data / artifacts: no `dist/` change. The scripts read `udg/config/assets.yml` only. - Integrations: Affinity Scripting Studio (designer-side, opt-in). - Mappings: none. The allowed colours are read from `color_maps` at run time, and no hex lives in the scripts. - Backward compatibility: fully compatible (additive). ## Docs `Brand/source/_editor/affinity-scripts/README.md` covers install, rules, settings and testing notes. The `CLAUDE.md` exception is already on main via #190.
Scripting Studio scripts that export the current document, read the SVG
back, and check what assets.py will see: colours against the assets.yml
color_maps (read at run time, no hex in the scripts), plate = one colour
with no gradient/pattern/image. Also catches Affinity's omitted fill on
black shapes, which renders black but cannot re-skin.

Tested on Affinity 3.3.0.4850 via the Affinity MCP server; the re-exported
icon.tools builds to identical themed output.
docs(affinity): record panel and just plates test results
Some checks failed
PR policy check / policy-gate (pull_request) Successful in 0s
Security Scans / Gitleaks secret scan (pull_request) Successful in 40s
Security Scans / Trivy filesystem scan (pull_request) Failing after 46s
Test Generator / lint-workflows (pull_request) Successful in 20s
Test Generator / lint-prose (pull_request) Successful in 24s
Block Validation / validate (pull_request) Successful in 1m23s
UDG dist drift gate / dist/ matches dtcg + udg sources (pull_request) Failing after 19s
Copy coverage / Design copy reaching rendered HTML (pull_request) Successful in 35s
Test Generator / test (pull_request) Successful in 4m6s
da72acb8b1
Panel runs from the script library reach the repo folder allowed in
Settings -> Scripting, and the prompt/confirm/alert dialogs work for all
three scripts. An Affinity 3.3 EPS export of the rectangle plate converts
through `just plates` (gs 10.08.0 + poppler) to a stamped single-fill SVG
that renders identically to the committed derivative.

Notes the harmless ghostscript annotation warning (3.3 EPS carries XMP
pdfmarks) and the whole-point bounding-box rounding.
peterswimm deleted branch docs/allow-affinity-scripts 2026-10-07 22:47:11 +00:00
Sign in to join this conversation.
No description provided.