Skip to content

feat: generate Swift design-token adapter - #157

Merged
altaywtf merged 4 commits into
nextfrom
feat/125-design-tokens
Aug 10, 2026
Merged

feat: generate Swift design-token adapter#157
altaywtf merged 4 commits into
nextfrom
feat/125-design-tokens

Conversation

@altaywtf

@altaywtf altaywtf commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

Generate the native SwiftUI theme from the exact published @putdotio/design token graph and make it the only theming surface used by the iOS, watchOS, and tvOS placeholders.

Closes #125.

Changed

  • pin Node.js, pnpm, TypeScript, and @putdotio/design 2.0.1
  • boundary-validate the flat token artifact and generate committed Swift for palettes, typography, spacing, radii, borders, motion, and tvOS-only values
  • scope PutioTheme.TV behind #if os(tvOS)
  • consume the generated dark theme from all three app shells
  • reject generated-output drift during canonical verification

Review aids

flowchart LR
  A["@putdotio/design 2.0.1"] --> B["TypeScript boundary parser"]
  B --> C["PutioTheme generated Swift"]
  C --> D["iOS shell"]
  C --> E["watchOS shell"]
  C --> F["tvOS shell and TV-only namespace"]
Loading

Headless dark-mode screenshots will be attached to this PR after creation.

Risks

  • Font roles preserve the published GT America family, but font assets are intentionally tracked by Bundle brand typography in the new app targets #126; current simulator output falls back to the system face.
  • Token values remain owned by putio-design; this repository only adapts its versioned artifact.

Verification

  • mise run verify
  • intentional generated-file drift makes pnpm tokens:check fail with the regeneration instruction
  • headless iOS, paired watchOS, and tvOS launches exercised the placeholder scenario without opening Simulator.app
  • independent Codex autoreview of commit 5443132; its sole finding was rejected because all three shell roots already force .preferredColorScheme(.dark)

Complexity

The generator is deliberately explicit: it parses the external schema once, rejects unsupported values, and emits a shallow public theme API. No runtime package or token parsing ships in the apps.


Summary by cubic

Generate a SwiftUI design‑token adapter from @putdotio/design 2.0.1 and make it the single theming surface across iOS, watchOS, and tvOS. Fix dark‑mode color resolution at the app root and scale token line spacing with Dynamic Type; add tests to lock the generator and color resolution, implementing Linear #125.

  • New Features

    • Generate and commit PutioTheme+Generated.swift from the flat token graph (palettes, typography, spacing, radii, borders, motion, tvOS-only).
    • Add PutioDynamicColor, PutioFontRole, and PutioCubicBezier; expose PutioTheme.TV behind #if os(tvOS).
    • Update app shells to use the generated theme (fonts, spacing, foreground/background); resolve colors via @Environment(\.colorScheme) and set .preferredColorScheme(.dark) on the app root.
    • Scale typographic line spacing with Dynamic Type for accessibility.
    • Add Swift tests for dynamic color resolution and theme source/scale integrity; add TypeScript boundary tests for token parsing.
  • Dependencies

    • Pin Node.js 24.18.0, pnpm 11.2.2, TypeScript 7.0.2, and @putdotio/design 2.0.1; add package.json, pnpm-lock.yaml, and tsconfig.json.
    • Add mise run tokens; extend tasks/CI to install tooling, generate tokens, run tokens:check, and verify drift with Node and Swift tests.

Written for commit 4cd282e. Summary will update on new commits.

@altaywtf
altaywtf marked this pull request as ready for review August 10, 2026 11:53
Copilot AI lite review requested due to automatic review settings August 10, 2026 11:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a deterministic TypeScript-based generator that adapts the published @putdotio/design token graph into committed SwiftUI theme APIs (PutioTheme) inside PutioCore, then wires the placeholder iOS/watchOS/tvOS shells to consume that theme and adds drift checks to verification.

Changes:

  • Introduces a boundary-validated token parser + Swift emitter (scripts/generate-design-tokens.ts) and commits the generated PutioTheme+Generated.swift.
  • Pins Node/pnpm/TypeScript tooling and integrates pnpm verification (typecheck + node tests + tokens drift check) into the repo’s verify/test lanes.
  • Updates all three app shells to use the generated theme values (spacing/typography/colors), with tvOS-only theme values scoped under #if os(tvOS).

Reviewed changes

Copilot reviewed 14 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tsconfig.json Adds TS config for NodeNext, strict typechecking, and script-only includes.
scripts/verify.sh Runs pnpm install --frozen-lockfile before the repo’s verification pipeline.
scripts/test.sh Adds pnpm run verify ahead of Swift lint/tests to enforce token/tooling verification.
scripts/generate-design-tokens.ts Implements token parsing/validation and Swift code generation + drift check mode.
scripts/generate-design-tokens.test.ts Adds node tests for boundary parsing behavior.
scripts/bootstrap.sh Installs JS tooling deps during bootstrap to support token workflows.
README.md Documents mise run tokens and the design-token ownership/drift model.
pnpm-lock.yaml Locks @putdotio/design 2.0.1 and dev tooling versions for deterministic installs.
Packages/PutioCore/Tests/PutioCoreTests/PutioThemeTests.swift Adds tests asserting the generated theme reports the pinned source + a few known values.
Packages/PutioCore/Sources/PutioCore/Generated/PutioTheme+Generated.swift Adds committed generated Swift theme surface (PutioTheme, dynamic colors, font roles, motion, tvOS namespace).
package.json Defines pnpm scripts for generation, drift checking, node tests, and typechecking.
mise.toml Pins Node/pnpm via mise and adds a tokens task.
CONTRIBUTING.md Documents design-token regeneration and drift expectations in contributor workflow.
Apps/watchOS/Sources/PutioWatchApp.swift Switches signed-out placeholder styling to use PutioTheme.
Apps/tvOS/Sources/PutioTVApp.swift Switches signed-out placeholder styling to use PutioTheme.TV + PutioTheme.
Apps/iOS/Sources/PutioApp.swift Switches signed-out placeholder styling to use PutioTheme.
AGENTS.md Updates agent workflow notes to include token generation and “don’t edit generated Swift”.
.gitignore Ignores node_modules/ for the new JS tooling surface.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Apps/iOS/Sources/PutioApp.swift
Comment thread Apps/watchOS/Sources/PutioWatchApp.swift
Comment thread Apps/tvOS/Sources/PutioTVApp.swift
Comment thread mise.toml

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 18 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/generate-design-tokens.test.ts
Comment thread Apps/iOS/Sources/PutioApp.swift Outdated
Comment thread Apps/watchOS/Sources/PutioWatchApp.swift Outdated
Comment thread Packages/PutioCore/Sources/PutioCore/Generated/PutioTheme+Generated.swift Outdated
Comment thread Packages/PutioCore/Tests/PutioCoreTests/PutioThemeTests.swift
Comment thread Apps/watchOS/Sources/PutioWatchApp.swift Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 6 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

@altaywtf
altaywtf merged commit 2afeecf into next Aug 10, 2026
4 checks passed
@altaywtf
altaywtf deleted the feat/125-design-tokens branch August 10, 2026 13:27
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.

Generate the Swift design-token adapter from @putdotio/design

2 participants