refactor: split build.py into brand package #12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refactor/brand-package"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
scripts/build.pymonolith intoscripts/brand/— a Python package with 17 focused modulesbuild.py,validate.py) are now thin orchestrators that import from the packagescripts/**to catch module changesWhat changed
Why
Adding a new export format (after this PR)
scripts/brand/exports/newformat.pywith awrite_newformat(path, brand)functionscripts/brand/exports/__init__.pyTest plan
uv run scripts/build.py— full pipeline passesuv run scripts/build.py validate— single-stage worksuv run scripts/validate.py— standalone validator works🤖 Generated with Claude Code
Move 2,400 lines from scripts/build.py into scripts/brand/ — a proper Python package with focused modules. Each file handles one concern: brand/colors.py — color math (hex↔RGB/HSL/CMYK, WCAG contrast) brand/helpers.py — text utilities (kebab-case, slugify, escape) brand/loader.py — YAML loading brand/paths.py — all path constants brand/validation.py — schema + structural validation brand/stage_json.py — brand.json assembly brand/stage_css.py — brand.css generation brand/stage_swatches.py — MCP swatch PNG generation brand/stage_docs.py — BRAND.md generation brand/exports/ — one module per format (ASE, GPL, SCSS, tokens, Procreate, Tailwind, showcase) Entry points (build.py, validate.py) are now thin orchestrators. Workflow path triggers updated to scripts/** to catch module changes. Adding a new export format: drop one file in brand/exports/ and add one import + call in brand/exports/__init__.py. All outputs are byte-for-byte identical after refactoring. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>