Skip to content

Extract-data#28

Merged
dallasbpeters merged 6 commits intomainfrom
extract-data
Feb 5, 2026
Merged

Extract-data#28
dallasbpeters merged 6 commits intomainfrom
extract-data

Conversation

@dallasbpeters
Copy link
Member

@dallasbpeters dallasbpeters commented Feb 5, 2026

Why?

The optics-data.ts file was manually maintained. When Optics updates, someone has to manually update token lists and add new components. This PR adds an automated sync script that extracts data directly from the Optics source repo.

What Changed

  • Add scripts/sync-optics-data.ts - Automated script that extracts tokens and components from Optics. Requires local Optics repo at ../optics. Reads Storybook MDX for component metadata, validates against actual CSS.

  • Add scripts/tsconfig.json - TypeScript config for scripts folder.

  • Add src/utils/component-tokens.ts - Helper to get token dependencies for a component.

  • Regenerate src/optics-data.ts - Now has 29 components (was ~24):

  • Added: ContentHeader, Divider, SegmentedControl, Stack, Cluster, Split

  • Tooltip now properly included (data-attribute based)

Update src/resources/00-system-overview.md - Document color pairing rule and "use existing components" guidance.
Clean up src/tools/theme-generator.ts - Remove unused functions.
Update package.json - Add npm run sync-data, add dev dependencies.

How to use

Development/
├── optics/ ← Clone github.com/RoleModel/optics here
└── optics-mcp/
Then run: npm run sync-data

dallasbpeters and others added 6 commits February 5, 2026 22:10
Extracts tokens and components from Optics source repo.
Generates optics-data.ts with 29 real components.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Helper to get token dependencies for components.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replaces 152 bloated entries with actual components:
- 26 from Storybook (Accordion through Tooltip)
- 3 layout utilities (Stack, Cluster, Split)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add npm run sync-data command
- Add @rolemodel/optics and ts-node as dev deps

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document the two most common AI mistakes:
- Not pairing background/text colors
- Writing custom CSS instead of using existing components

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add missing cssVar property to generated tokens.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dallasbpeters dallasbpeters merged commit d47d163 into main Feb 5, 2026
2 checks passed
@dallasbpeters dallasbpeters deleted the extract-data branch February 5, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants