Skip to content

[refactor] Lift the theme contract out of the Tailwind config - #5740

Merged
bekossy merged 2 commits into
release/v0.109.1from
fe-refactor/shared-theme-tokens
Aug 5, 2026
Merged

[refactor] Lift the theme contract out of the Tailwind config#5740
bekossy merged 2 commits into
release/v0.109.1from
fe-refactor/shared-theme-tokens

Conversation

@ardaerzin

Copy link
Copy Markdown
Contributor

Context

Two objects that describe the design system live inside web/oss/tailwind.config.ts, private to a Tailwind v3 JS config:

  • controlScale — control geometry (heights, widths, paddings, radii, type ramps)
  • shadcnTokens — the utility-name → CSS-variable contract the @agenta/ui primitives are written against

Anything that is not a Tailwind v3 config cannot read either one. A second consumer has to restate the values and then drift silently, which for shared components means the same Button rendering at different sizes per app. shadcnTokens already describes itself as "ONE shared definition for the app + Storybook" — this makes that literally true.

The concrete motivation: web/mobile is Tailwind v4 (CSS-first, no JS config). It cannot import this file, so today it can only hand-copy pixel values. A follow-up makes its token generator import these modules instead.

Changes

Both objects move to web/oss/src/styles/theme/, beside palette.ts, and the config imports them:

web/oss/tailwind.config.ts
  - const controlScale = { … }      →  import {controlScale} from "./src/styles/theme/controlScale"
  - const shadcnTokens  = { … }      →  import {shadcnTokens}  from "./src/styles/theme/shadcnTokens"

The objects themselves are unchanged. This is a move, not a retune — no token value differs.

Tests / notes

  • The config still loads and resolves 148 colours, with the btn family present, control height 28px, control radius 8px, and the btn-md type ramp ["12px", {lineHeight: "normal"}] — all identical to before.
  • web/oss type-checks clean.
  • No behaviour change, so nothing to QA visually. A CSS diff of any built page should be empty.

Two definitions that describe the design system sit inside `web/oss/tailwind.config.ts`, private
to a Tailwind v3 JS config:

- `controlScale` — the control geometry (heights, widths, paddings, radii, type ramps)
- `shadcnTokens` — the utility-name to CSS-variable contract the `@agenta/ui` primitives are
  written against

Anything that is not a Tailwind v3 config cannot read either one, so a second consumer has to
restate them and drift silently. `shadcnTokens` already describes itself as one shared definition
for the app and Storybook; this makes that literally true.

Both move to `web/oss/src/styles/theme/`, beside `palette.ts`, and the config imports them. The
objects are unchanged — this is a move, not a retune.

No behaviour change. Verified the config still loads and resolves 148 colours with the `btn`
family, `control` height 28px, `control` radius 8px, and the `btn-md` type ramp intact, and that
`web/oss` type-checks clean.
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 5, 2026
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Aug 5, 2026 11:14am

Request Review

@dosubot dosubot Bot added Frontend refactoring A code change that neither fixes a bug nor adds a feature labels Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fd3c60d8-bdc1-4e33-894f-991aa3075be2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Summary by CodeRabbit

  • Style
    • Standardized control dimensions, spacing, typography, and border-radius values across web and mobile interfaces.
    • Unified semantic colors and component styling tokens for buttons, inputs, states, tags, and empty states.
    • Improved consistency with established design system dimensions and visual patterns.

Walkthrough

The change extracts shared control-scale and shadcn token definitions into dedicated theme modules. Tailwind imports these exports and continues using them through its existing theme extensions.

Changes

Shared theme tokens

Layer / File(s) Summary
Control scale contract
web/oss/src/styles/theme/controlScale.ts
Adds shared dimensions, spacing, border-radius, and typography tokens for controls, buttons, inputs, fields, and badges.
Shadcn token contract
web/oss/src/styles/theme/shadcnTokens.ts
Adds shared mappings for semantic colors, states, statuses, tags, buttons, empty-state layers, chips, and fills.
Tailwind theme wiring
web/oss/tailwind.config.ts
Imports controlScale and shadcnTokens from the dedicated theme modules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • Agenta-AI/agenta#5098: Adds related TemplateStrip palette and CSS tokens to shared Tailwind theme infrastructure.
  • Agenta-AI/agenta#5392: Changes the theme palette and Tailwind token seeding used by this configuration.
  • Agenta-AI/agenta#5679: Uses related shared control and shadcn token generation for mobile styling.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes extracting the theme contract from the Tailwind configuration.
Description check ✅ Passed The description directly explains moving the shared theme objects, the motivation, and the unchanged behavior.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fe-refactor/shared-theme-tokens

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
web/oss/src/styles/theme/controlScale.ts (1)

1-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reduce the module preambles.

These preambles describe design context, not a narrow code-level constraint. Replace each preamble with one short contract comment. Keep longer comments only where they explain a surprising parity or ordering constraint.

  • web/oss/src/styles/theme/controlScale.ts#L1-L19: Replace the multi-line module rationale with a short control-scale contract comment.
  • web/oss/src/styles/theme/shadcnTokens.ts#L1-L16: Replace the multi-line module rationale with a short semantic-token contract comment.

As per coding guidelines, keep in-code comments to at most one short line; use longer comments only for genuinely surprising constraints such as bugs, races, or ordering requirements.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 87c010fc-c942-48f5-825f-b60763a4026a

📥 Commits

Reviewing files that changed from the base of the PR and between b8712ed and b7a5916.

📒 Files selected for processing (3)
  • web/oss/src/styles/theme/controlScale.ts
  • web/oss/src/styles/theme/shadcnTokens.ts
  • web/oss/tailwind.config.ts

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-5740.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-5740-cc07209
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-08-05T11:23:29.250Z

@ardaerzin
ardaerzin changed the base branch from main to release/v0.109.1 August 5, 2026 09:08
Resolve tailwind.config.ts conflict: keep the extracted controlScale/shadcnTokens
module structure from this branch, and port the tag-pink/yellow/volcano/geekblue/lime
entries release/v0.109.1 added inline into the extracted shadcnTokens.ts so no tokens
are lost.
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 5, 2026
@bekossy
bekossy merged commit 69bc7d3 into release/v0.109.1 Aug 5, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend lgtm This PR has been approved by a maintainer refactoring A code change that neither fixes a bug nor adds a feature size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants