Skip to content

feat(cli): generate reviewable tonal palettes - #5992

Open
rubyycheung wants to merge 18 commits into
codex/palette-generator-contractfrom
codex/palette-generator-cli
Open

feat(cli): generate reviewable tonal palettes#5992
rubyycheung wants to merge 18 commits into
codex/palette-generator-contractfrom
codex/palette-generator-cli

Conversation

@rubyycheung

@rubyycheung rubyycheung commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extracts the current Sandbox OKLCH result into the versioned astryx-oklch-v1 production engine.
  • Adds the pure generateTonalPalette() authoring API with no filesystem or theme side effects.
  • Adds astryx theme palette generate <config> for previewing candidates and explicitly writing them.
  • Writes importable TypeScript palettes by default when .ts is requested, with JSON available for tooling.
  • Adds an optional, standardized palette-preview-v1 HTML artifact for visual review. Light and dark modes are stacked, and every family uses matching stop columns.
  • Writes a detached generation receipt with the normalized request, diagnostics, candidate digest, and preview digest.
  • Defaults to the complete 21-stop range from 0 through 100 while accepting any non-empty, ordered custom stop list, including layouts that omit the repeated black and white endpoints.
  • Documents exact, bounded, and flexible anchor policies, vibrancy, shared stops, and ambiguous accent handling in the public API and CLI docs.
  • Keeps blind agent-evaluation prompts separate from their answer key.
  • Refuses to overwrite author-owned palette or preview files unless --overwrite is explicit.
  • Does not modify defineTheme, map semantic tokens, or make accessibility claims.

Stack

Depends on #5986, which defines the generation contract. The accepted-palette contract is #5985. Neutral adoption remains in #5987.

Neutral is not converted to direct palette imports in this PR. A bundle check showed that importing one palette value currently includes the complete authoring palette in dist/source.mjs; that requires a separate build-time resolution design.

Verification

  • CLI structure check
  • JSON API typecheck
  • CLI authoring-contract typecheck
  • Focused generator, API, preview, command, manifest, error-code, and agent-fixture tests
  • Blind documentation-comprehension run covering ten author requests
  • Canonical candidate SHA-256 fixtures
  • Exact parity test against the pinned Sandbox OKLCH implementation
  • Full pre-commit repository checks
  • git diff --check

Release

Includes a patch Changeset for @astryxdesign/cli.

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 4, 2026 4:12pm UTC

Request Review

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Palette authors can currently lose files or receive a candidate that silently ignores part of their request.

Before this lands:

  • Protect every input and output by filesystem identity, not path spelling. On case-insensitive macOS, Palette.config.json with --out palette.config.json --overwrite replaces the input config. Temporary output files are also predictable and may overwrite an existing file without --overwrite. Use exclusive randomized temporary files and refuse any input/output identity collision.
  • Validate and normalize the complete request before generation. An anchors object currently becomes an empty array and exits successfully; anchors for an omitted mode are ignored; receipt anchors retain unnormalized casing. Invalid author intent must fail clearly rather than generate a different unanchored candidate.
  • Preserve requested stop order through JSON/TypeScript serialization and preview rendering. Mixed stops such as [12.5, 50, 80] currently enumerate as 50, 80, 12.5 because integer-like object keys move first. Keep ordered entries until rendering and add a mixed decimal/integer regression fixture.

The canonical recipe fixtures, public API/CLI split, generated TypeScript typing, JSON parity, preview isolation, and package boundaries otherwise passed focused review.

[Reviewed by Robohands]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants