Skip to main content
Glama

Cadesa

ci npm license: MIT

Know what your layout does at every width before you open a browser.

Point Cadesa at your coding agent (MCP), your existing CSS or your Tailwind page, and it tells you what breaks at 320px, what an edit will move three sections away, and where the design is muddled. It answers in milliseconds, as text, from a layout engine that runs without a browser.

What "matches Chromium" means here: every box Cadesa marks as exact matches Chromium within 0.5px in the conformance suites and a differential fuzzer that run in CI. Boxes it can't model exactly are marked ≈, and every report starts by saying how much of your page that is.

What a report looks like

$ cadesa check fixtures/verify/page.html --css fixtures/verify/page.css --widths 400,800
coverage: 7 boxes × 2 widths · 86% exact · 14% approximate (≈)
  ≈ because: transform: perspective(10vmin) translateZ(6vmin): only transforms in px or % are modelled (×2)

✖ [contrast] <p.note> text #999999 on #ffffff is 2.85:1; WCAG AA needs 4.5:1 · at 400, 800px
    element: fixtures/verify/page.html:11 <p class="note"> "Muted text, too light to read."
    color: fixtures/verify/page.css:43 .note { color: #999 }
    background: fixtures/verify/page.css:7 body { background-color: #fff }
⚠ [layout] <div.wide> overflows <div.box> by 100px at 400px · at 400, 800px
    element: fixtures/verify/page.html:12 <div class="box"> "A box wider than its parent"
    set on <div.wide>: fixtures/verify/page.css:52 .wide { width: 400px }

inconclusive (Cadesa can't decide these without a browser: confirm in one, or run check with --verify):
? [tap-target] <button.zoomed> is 20×20px; WCAG 2.5.8 needs at least 24×24px · at 400, 800px
    element: fixtures/verify/page.html:10 <button class="zoomed"> "+"
    size: fixtures/verify/page.css:33 .zoomed { width: 20px; height: 20px }
...

How to read it:

  • The coverage line comes first. It says how much of the page Cadesa predicted exactly, and why the rest is ≈. When most of a page is ≈, it says so, and you should treat the report as leads. Elements a browser shows that Cadesa doesn't lay out at all (anything floated; the rows of a table it keeps as one box, when something in it would get an anonymous cell) are counted under it, ! 31 of 77 elements not laid out: inside a table, laid out as one box (×31): nothing is checked there.

  • ✖ and ⚠ are definite. Act on them: each names the element, the widths and the rule to change. Contrast, text that runs together and other checks that don't depend on exact positions stay definite even on a mostly ≈ page.

  • ? is inconclusive. The finding depends on a box Cadesa can't predict exactly. Here .zoomed is drawn 2.5 times its size by a 3D transform in viewport units (perspective(10vmin) translateZ(6vmin)), so it is really 50×50px. Confirm it in a browser, or add --verify and Chromium decides.

  • whatif follows the same rule. It only says "unchanged" for boxes predicted exactly.

Related MCP server: bettercss

What Cadesa sees

Left: examples/landing in Chromium at 768px. Right: what Cadesa predicts for the same page, without a browser, drawn with cadesa render --svg. Every box, and every bar standing in for a line of text, is where Chromium puts it: all 5,412 boxes across 123 widths match (npm run conformance:landing).

Agents get the same information as text: every box's position and size, every wrapped line with its width, and for each value, the line of source that set it.

Structure here, polish anywhere

Cadesa is for the structural part of CSS: everything that decides where a box goes and how big it is. That's the part that breaks at one width and not another, and the part you can't judge from one screenshot. The rest is polish: colors, gradients, shadows, hover states, transitions. Polish never moves a box, so it can go on top in whatever you already use, written by you or an agent, without risking the layout.

Structure: let Cadesa check it

Polish: style it freely on top

layout (stack, wrapping rows, grids, layers), gaps, padding, margins

colors, gradients, background images

widths, max-widths, heights, aspect ratios

shadows, border colors, border radius, opacity

breakpoints, 2D transforms (where a box is drawn)

hover, focus and active states

font family, size, weight, line height, letter spacing, case

transitions, animations

text wrapping, long words

cursor, outlines, text color (but run check for contrast)

The rule of thumb: if it can move a box, it's structure. Some things that look like decoration are structural for that reason. A border's width, a heavier font weight, letter spacing or uppercase all change sizes or line breaks, so they belong on the left.

A good loop for an agent: get the structure right with Cadesa (check and critique clean at every width, whatif before each change), then layer the visual design on top. Cadesa can describe polish too (backdrop, shadow), but it never has to.

Try it in 60 seconds

Nothing to install: npx fetches it from npm. Node 20 or newer.

Give it to your agent. Claude Code:

claude mcp add cadesa -- npx -y cadesa mcp

Cursor and other MCP clients: {"mcpServers": {"cadesa": {"command": "npx", "args": ["-y", "cadesa", "mcp"]}}}. The server teaches the agent the render → explain → whatif → edit loop, so you can ask "check this page at every width" or "what else moves if I change this?"

Run it on a page you already have, with its CSS or the CSS Tailwind compiled for it:

npx -y cadesa check page.html --css styles.css
npx -y cadesa check page.html --css bootstrap.css,app.css   # a framework plus your own CSS
npx -y cadesa check page.html --tailwind compiled.css
$ cadesa check fixtures/bootstrap/dashboard.html --css fixtures/bootstrap/bootstrap.css,fixtures/bootstrap/app.css
...
✖ [contrast] <span.stat-delta.text-success> text #198754 on #f4f6f9 is 4.18:1; WCAG AA needs 4.5:1 · at all 57 widths
    element: fixtures/bootstrap/dashboard.html:55 <span class="stat-delta text-success"> "+4.2% on last week"
    color: fixtures/bootstrap/bootstrap.css:8503 .text-success { color: rgba(var(--bs-success-rgb), var(--bs-text-opacity)); --bs-text-opacity: 1 }
           fixtures/bootstrap/bootstrap.css:7 :root { --bs-success-rgb: 25, 135, 84 }
    background (on <div.card.stat-card>): fixtures/bootstrap/bootstrap.css:4359 .card { background-color: var(--bs-card-bg); --bs-card-bg: var(--bs-body-bg) }
                                          fixtures/bootstrap/app.css:8 :root { --bs-body-bg: #f4f6f9 }

Each finding names the element (its line in the page, tag, classes and the start of its text) and the rules in your stylesheets that set the property behind it, following var() to where the variable is set. --json has the same, plus the path in the generated Cadesa source (path).

check sweeps every 20px from 320 to 1440px by default. With --css, Cadesa reads the page the way the browser does: your stylesheet, <style> blocks, style attributes and the browser's own defaults, matched with real selectors and ordered by specificity at every breakpoint, with block flow, collapsing margins, percentage widths, padding and margins, inherited text, CSS Grid templates and placement, aligned flex items, auto margins, 2D transforms and icons inline in text. It also understands what Bootstrap 5 and Angular pages are built from: the grid (negative gutters, .col growth, col-* and row-cols-* widths), .container max-widths that disappear on phones, d-flex rows with justify-content and auto margins, per-side padding and borders, form controls, tables (.table and its variants, .table-responsive, plain <table>s with colspans, rowspans, captions and <col> widths, table-layout: fixed), and Angular's component elements. Anything it can't model (a float inside a word, buttons aligned to a line of text in a font without vertical metrics) is marked ≈ with the rule responsible, and findings there are reported as inconclusive rather than guessed. render, whatif, explain and critique take --css and --tailwind too.

Pages rendered by JavaScript: capture

An Angular, React or Vue app has no HTML file to check until it runs. capture loads the page in Chromium, waits for it to render and saves what it rendered:

npx -y cadesa capture http://localhost:4200/orders --out capture --wait app-orders
npx -y cadesa capture https://staging.example.com/orders --login-script login.mjs   # behind a login

It writes page.html (the rendered DOM, with scripts removed, one element per line wherever a line break can't change the rendering, so each finding's page.html:line points somewhere useful), every stylesheet in cascade order under css/ as 01-…, 02-… (linked files, @imports inlined where they were, <style> blocks, and CSS-in-JS rules read back from the browser when the <style> element has no text), and the font files the page loaded under fonts/. Then it prints the command to run on them: cadesa check capture/page.html --css capture/css (--css takes a directory of stylesheets, read in name order, in every command). A URL that answers with an error status (a 404, a login wall's 401) stops the capture with that status instead of saving the error page; a redirect elsewhere is noted. A login script is a module that exports async (page) => {} (a Playwright page) and runs before the URL is loaded. Cookies and storage are not saved, and password and hidden input values are removed from the page.

Confirm in Chromium: --verify

cadesa check page.html --css ... --verify runs the sweep, then loads the page in Chromium at every width with a finding (and six without), measures the elements the findings are about and marks each one:

$ cadesa check fixtures/verify/page.html --css fixtures/verify/page.css --widths 400,800 --verify
✖ [tap-target] <button.close> is 20×20px; WCAG 2.5.8 needs at least 24×24px · at 400, 800px
    element: fixtures/verify/page.html:10 <button class="close"> "x"
    size: fixtures/verify/page.css:23 .close { width: 20px; height: 20px }
    chromium: confirmed at 400, 800px (20×20px)
...
not reproduced in Chromium (no problem there at the widths it loaded):
○ [tap-target] <button.zoomed> is 20×20px; WCAG 2.5.8 needs at least 24×24px · at 400, 800px
    element: fixtures/verify/page.html:10 <button class="zoomed"> "+"
    size: fixtures/verify/page.css:33 .zoomed { width: 20px; height: 20px }
    chromium: not reproduced at 400, 800px (50×50px)

2 errors, 1 warning, 1 not reproduced in Chromium (distinct issues across 400, 800px)
verified in Chromium 153.0.8010.52 at 2 widths (2 with findings, 0 without)
  boxes marked exact: 10 of 12 match Chromium within 0.5px · boxes marked ≈: 2 of 2 match

Inconclusive findings are decided by what Chromium measures: on fixtures/bootstrap/orders.html both inconclusive contrast findings come back confirmed. Tap targets, contrast, horizontal overflow (also of text beside elements), unbreakable words, text cut off by overflow: hidden and text taller than a fixed height are measured; the others stay as predicted, each with the reason (text that runs together is decided by the markup, not by sizes). The last lines compare every box the engine laid out with Chromium's at those widths. --verify needs a Chrome, Chromium or Edge on the machine (or $CADESA_CHROME pointing at one), like metrics --measure.

Or try the examples:

git clone https://github.com/soma-ck/cadesa && cd cadesa && npm install
npx cadesa whatif fixtures/settings.html --source settings.cadesa.yaml --set styles.settings-panel.when.narrow.padding=panel
npx cadesa render examples/landing/landing.html --source examples/landing/landing.cadesa.yaml --widths 768 --svg landing.svg
  • In a project: npm i -D cadesa, then npx cadesa ....

  • The latest commit: npx -y --allow-git=all github:soma-ck/cadesa ... (npm 12 needs --allow-git for git installs).

  • From a checkout: npm run build:ts && claude mcp add --scope user cadesa -- node /path/to/cadesa/lib/cli.js mcp.

  • A browser is only needed for cadesa capture, check --verify, cadesa metrics and the conformance suites. Cadesa drives the Chrome, Chromium or Edge already on the machine (or the one $CADESA_CHROME points at) through playwright-core, which it installs; nothing else to add. With no browser installed, npx playwright install chromium downloads one.

What it found on a real site

An agent rebuilt a 20-component French-language WordPress site in Cadesa, checking every edit at 12 or more widths, in 60–900ms per check. It found bugs nobody had asked it to look for, most of them visible only at some widths:

  • A long word overflowing a card by 7.4px, only at 1100, 1280 and 1440px.

  • A link 23.8px tall, 0.2px under the WCAG 2.5.8 minimum of 24px.

  • Lines over 80 characters only at tablet widths, and an overflow at 300px introduced by a cleanup.

  • whatif stopped a fix to one card from collapsing the footer from 4 columns to 3, three sections away (footer height 437 → 682px).

  • critique flagged 15 font sizes, several only 1.08× apart. Consolidating to 7 visibly sharpened the hierarchy.

What it does

Command / MCP tool

Question it answers

whatif · cadesa_whatif

If I make this edit (to a Cadesa source, or rules added to your CSS), what moves at each width, and does anything regress? Runs in memory, writes nothing.

check · cadesa_check

Is anything overflowing, too small to tap or low contrast, at any width? --verify confirms each finding in Chromium.

critique · cadesa_critique

Does it read as designed: type scale, hierarchy, grouping, alignment, palette?

explain · cadesa_explain

Why is this value what it is, and which line do I edit?

render · cadesa_render

Where is every box and every wrapped line? (--lines lists the lines, --svg draws the wireframe above.)

lift · cadesa_lift

Convert existing CSS to Cadesa. What couldn't be converted, and which boxes does that affect?

build · cadesa_build

Compile a Cadesa source to plain CSS.

capture · cadesa_capture

Save a page rendered by JavaScript (DOM, stylesheets, fonts) so check can read it.

Add --json to any command for machine-readable output.

whatif: one proposed edit, every box it moves, the line that explains each new value, and the widths that didn't move. By default it checks the same widths as check, plus both sides of every breakpoint, and groups widths where the edit does the same thing:

$ cadesa whatif fixtures/settings.html --source settings.cadesa.yaml --set styles.settings-panel.when.narrow.padding=panel
coverage: 6 boxes × 59 widths · 100% exact · 0% approximate (≈)

check: no findings before or after the edit

at 320–576px
   #panel        padding 16px → 32px
                   ← space.panel = 2rem ← when.narrow (≤ 576px) ← styles.settings-panel.when.narrow.padding
                 h +32
   #title        x +16  y +16  w −32
   ...
✓ unchanged at 577–1440px: no box moved, no property changed

Every whatif also runs check before and after the edit and lists the findings it fixes, the ones still there (with their new numbers: a button that grows from 20 to 23.98px is still under 24px) and the ones it adds.

On plain CSS, preview rules before adding them (--add-css, appended to the stylesheet that comes last in the page's cascade), or compare an edited copy of a stylesheet (--after, one file per --css file). A removed declaration shows its initial value (margin 0px -12px → 0px). An added rule that matches nothing, or loses to a rule already in your CSS, is reported before anything else:

✖ your rule didn't apply: .bar .y { … } at app.css:4 is more specific (0,2,0 vs your 0,1,0)
    .y { padding: 8px } loses padding-top, padding-right, padding-bottom, padding-left on <button.y>
$ cadesa whatif fixtures/css/panel.html --css fixtures/css/panel.css --add-css ".icon-button { width: 44px; height: 44px }"
coverage: 28 boxes × 58 widths · 88% exact · 12% approximate (≈)
  ≈ because: row-gap: 4px: the row wraps and its row gap differs from its column gap (×189)

check, before → after the edit: 1 fixed, 0 still there, 0 new
  ✓ fixed [tap-target] <button.icon-button> is 32×32px; 44×44px is recommended for touch (WCAG 2.5.5) · at all 58 widths

at all 58 widths
  ≈#panel   h +12
   #header  h +12
   #title   y +6
   #close   width 32px → 44px
            height 32px → 44px
            x −12  w +12  h +12
  ≈24 boxes below move y +12: #item, #item-name, #item-desc, #details-label +20 more (20 approximate)

check covers overflow (horizontal, unbreakable words, text taller than a fixed height), text cut off by overflow: hidden or an ellipsis, text that runs together (<span>Total</span><span>42</span>), tap targets (WCAG 2.5.8 and 2.5.5), and contrast against the nearest painted background (every stop of a gradient, translucent colors blended, inline <span>s and badges in their own color). Content scrolling inside a scroll container (.table-responsive) isn't an overflow, and elements hidden at a width (d-none, a collapsed navbar menu) aren't laid out or reported there. Text over an image, or a background Cadesa can't see, comes back inconclusive, not passed (a page where nothing sets a background is white, as in a browser); so does a size-dependent finding on a box whose size isn't exactly predicted (a box that only moves keeps its findings).

critique asks whether the page reads as designed, from measurable signals rather than taste: font sizes within 1.12× of each other (they read as one level), headings that barely stand out, groups spaced as far apart inside as outside, text edges that almost line up, a palette with no hue or competing accents, and common template tells. Findings are suggestions with numbers and a source line:

$ cadesa critique fixtures/settings-long.html --source settings.cadesa.yaml
◇ [palette] every color in use is a grey, near-black or near-white (#ffffff, #191b20, #555964); with no hue
  anywhere the page reads as unbranded. One accent, from the subject, on the main action is usually enough

Benchmarks

Speed: 12–17× faster than driving a browser. Getting every box of a page at every width, on one laptop core, both sequential, both producing the same boxes:

Job

Cadesa

Playwright + Chromium

examples/landing, 113 widths (every 10px)

0.76s

9.44s

Same page, every pixel from 320 to 1440 (1,121 widths)

6.2s

75.9s

examples/pricing, 113 widths

0.31s

5.40s

That's why checking every width on every edit is practical. It covers geometry only; pixel diffs and interaction tests still need a browser. Reproduce with npm run speed.

Agents: catching what nobody described. Agents (sonnet, Claude Code 2.1.327) got a realistic change request for a six-section page and were not told where it breaks. A judge measured what they shipped in Chromium at 58 widths, 8 trials per arm per task. "Clean" means no layout defect and nothing moved in a section the request didn't touch.

Task

Plain CSS + screenshots

Cadesa

Translate the page to German

0 of 8 clean

8 of 8 clean

Add a fourth pricing plan

8 of 8

5 of 8

Make the text bigger

7 of 8

8 of 8

All

15 of 24 · $0.21 per trial

21 of 24 · $0.18 per trial

The gap is one task (p ≈ 0.0002). After the German translation, cadesa check named two overflows that existed only at some widths, and every Cadesa agent fixed them with two edits. The CSS agents couldn't see what was broken, so they patched defensively and changed 21–56 boxes in sections that already worked, or left an overflow. Cadesa lost the fourth-plan task to two gaps that are now fixed: long words couldn't break (now wrap: anywhere), and check only looked at the widths it was given (it now sweeps every 20px). One model, one page, three tasks chosen by Cadesa's authors; every trial is in bench/RESULTS.md.

How exact is "exact"?

The engine (src/engine/) is the spec: its box tree depends only on the source, the HTML and the width. That it matches Chromium is checked, not assumed. Every suite below loads the pages in Chromium with the exact CSS bytes and compares every box, x, y, width and height within 0.5px, so a text that wrapped to a different number of lines fails by a whole line height. All of them run in CI.

Suite

What it covers

Result

npm run fuzz

differential fuzzer: random pages covering the whole language, and (one for every four) random pages lifted from their CSS with inline runs in another size, font, face (italic) or vertical-align (top, bottom too), inline-blocks with content of their own and atomic inlines on shared lines, rows aligned on their baselines, form controls, root font sizes other than 16px, grids in column flow, subgrids and 3D transforms (scripts/fuzz-css.ts)

39,597 pages at 148,328 widths: 688,902 boxes, 0 disagreements (0 again on fresh seeds, column flow, subgrids and 3D transforms included); lifted CSS pages: 3,827 boxes marked exact on the last 125, 0 disagreements, and 0 again in 600 more on fresh seeds (badges, shrinking items, tables of text, animated layout properties, tall lines beside floats and break-all text included); after floats inside words and inline boxes, lone inline svgs and images and baseline-aligned badges were added: 3,532 exact on the last 125, and 0 disagreements in 600 more on fresh seeds (those that found divergences on the way are fixed or flagged); after the corpus patterns were added (flexboxes and grids placed by order with boxes without offsets, nesting, flex bases, flex and grid bodies, toggle buttons): 3,644 exact on the last 125 and 0 disagreements, and 0 in 600 more on fresh seeds but for one case whose 0.3s animation ended before it was paused on a loaded machine (it agrees when rerun)

conformance:tailwind

three Tailwind pages through --tailwind

all 20,280 boxes marked exact match (80 left ≈)

conformance:bootstrap

nine Angular + Bootstrap 5.3.8 pages (one at a smaller root font size), with the real bootstrap.css (navbar collapse, grid, cards, .table and its variants, d-* utilities, .form-select, .form-control-sm/lg, .form-check, .input-group)

all 69,310 boxes are marked exact, and all match, with overlay scrollbars (the default), inline spans' own rectangles included. With classic 15px scrollbars (conformance:bootstrap:classic), all 69,310 match too. Where a box is ≈ but check treats its size as known, the size matches too

conformance:css

plain CSS through --css: an app side panel, an article, a dashboard, scroll and clip containers, lone buttons and transforms, generated content and runs in another weight, line boxes and text fields, containment, percentages in min() and grid row gaps, static positions and inline-blocks sharing lines, tables, inline runs in another size, font or vertical-align and rows aligned on their baselines, form controls at their own sizes and on lines of text, a root font size other than 16px, italic faces, inline-blocks with content on shared lines, vertical-align: top and bottom, column flow, subgrids (with edges and gaps of their own), 3D transforms and preserve-3d, synthesized bold, scroll containers, animations at their start, inline-blocks holding blocks, date, time (with a step), month, week, datetime-local and file inputs (with a styled button), native selects in web fonts, floats (in block flow and among text, clearance, formatting contexts beside them, auto margins), runs aligned by their extent across lines, inline math set by KaTeX (its own CSS and fonts: superscripts, subscripts, fractions and roots), notes in a handwriting font (Caveat, with badges on its lines), inline-grid and inline-flex badges on lines of text, elements with display: table holding text, flex items with a width that shrink, keyframes that set layout properties, lines beside floats holding taller runs and inline-blocks, word-break: break-all, line-break: anywhere and keep-all, Inter's "x" between digits, buttons stretched taller than their content, scroll containers on a page that scrolls, wrapping notes in a handwriting font, floats inside words and inside inline boxes, break-all lines with runs of their own or letter-spacing, badges aligned on their baselines, lone inline svgs and images, and what a corpus of real pages had in common (icons alone in flex-item links, block and flex buttons, em-bordered carets, order, boxes without offsets in flexboxes and grids, CSS nesting, flex bases, a <body> that is a flex or grid container or a centered column)

all 170,280 boxes marked exact match, every 10px from 320 to 1440px

conformance:fonts

Roboto (variable, from Google Fonts) and Lato (two static faces via @font-face)

5,474 of 5,474, and the line count of all 4,347 text boxes, over 161 widths

conformance:landing

grid, text over images, aspect ratios, gradients

5,412 of 5,412 over 123 widths

conformance:pricing

nested components

4,290 of 4,290 over 143 widths

conformance:field2

every divergence found in real use, kept fixed

2,576 of 2,576 over 161 widths

conformance:sweep

long copy every 3px, to land on line-break boundaries

1,482 of 1,482 over 247 widths

conformance:lift

a hand-written BEM stylesheet vs the original

all 32 boxes match, none left uncertain

npm run fuzz:tables

differential fuzzer for tables: random tables (auto and fixed layout, separated and collapsed borders, spans, captions, columns, alignment, attributes, <div> tables, flex and grid parents) lifted from their CSS

500 pages at 1,500 widths: 26,115 boxes marked exact, 0 disagreements (300 more: 16,708, 0 disagreements); 3,400 earlier pages found the divergences now fixed (fixtures/css/tables-edge.html keeps them)

Real use has caught Cadesa wrong before: the site rebuild above found seven cases where it said "fine" and Chromium disagreed. Each was fixed and kept as a regression test, and the fuzzer then found and fixed the next ones, mostly in exactly how Chromium rounds text widths and picks line breaks (59 regression cases in fixtures/fuzz). Where Chromium's choice hinges on a fraction of a pixel, the box is flagged rather than guessed. Testing on Bootstrap pages also caught one released bug: 0.1.6 predicted an empty Angular <router-outlet> as full width instead of 0×0, and every box after it was off. 0.1.7 fixes it, and the Bootstrap suite keeps it fixed.

A corpus of 20 real pages (the Bootstrap examples, the Tailwind home page and docs, MDN, Docusaurus, VitePress and GitHub Docs pages, a Wikipedia article, Hacker News, a blog, a Material UI template, Bulma and Pico), captured with cadesa capture and checked with --verify across the default sweep, is how the next gaps are found. On it Cadesa crashed on two pages and ran out of memory on one, claimed the width of every Bootstrap example's theme toggle 8px too narrow, and left most boxes ≈. What those pages had most in common is now exact (see the changelog), the patterns are kept in fixtures/css/corpus.html and fixtures/css/body.html with neutral markup, and fuzz-css generates them.

Fonts. Text is measured from per-font tables of glyph widths and kerning, measured once in Chromium. Cadesa bundles them for Inter, Roboto, Open Sans, Montserrat, Lato, Poppins, Source Sans 3, Nunito and Raleway, so those work with no setup. For any other font:

cadesa fonts page.html --css styles.css            # which fonts the text uses, and where each comes from
cadesa fonts page.html --css styles.css --measure  # measure the ones text is set in (needs Chrome or Chromium)
cadesa metrics --google "Work Sans"                # or a Google font by name

cadesa fonts finds each family's @font-face file or Google Fonts link, measures the exact files the page loads, and writes .cadesa/metrics/<family>.metrics.json; commit it. Agents can do the same with the cadesa_fonts MCP tool. A page that loads an italic face gets it measured too, into <family>-italic.metrics.json, and italic text is measured with it (a family without one is slanted, as wide as upright). System fonts (Arial, Segoe UI, system-ui) differ by machine: reports say so, and --system measures this machine's, marked machine-specific. A table measured by an older Cadesa, without what this one measures, is measured again by --measure, and reports name the command where it leaves boxes ≈. Text in a font without metrics, or with characters outside the measured Latin set, falls back to a one-line assumption, and every report flags that box. text-wrap: balance and pretty keep the line count, so their boxes are exact, but the lines reported are the greedy ones. No hyphenation or bidirectional text yet.

Why a language

CSS layout is emergent: cascade, specificity, inheritance and intrinsic sizing all interact, so the usual way to know what an edit does is to render it. Cadesa is a styling language deliberately small enough to simulate exactly: no cascade, no inheritance, four layout patterns, and a named token for every value. That's what makes exact prediction possible, and why every number in a report points at the line that produced it. It compiles to plain, readable CSS with no runtime.

tokens:
  space: { section: 1.5rem, panel: 2rem, compact: 1rem, control: 0.75rem }
  color: { surface: "#ffffff", ink: "#191b20", muted: "#555964" }
text:
  section-title: { size: 1.5rem, weight: 650, lineHeight: 1.2, color: ink }
breakpoints:
  narrow: 36rem
styles:
  settings-panel:
    layout: { pattern: stack, gap: section }
    padding: panel
    slots:
      title: { text: section-title }
      actions: { layout: { pattern: cluster, gap: control } }
    when:
      narrow:
        padding: compact
        slots:
          actions: { layout: { pattern: stack, gap: control } }

Write it the way you would anyway: version is optional, names can be kebab-case or camelCase, a plain number is px, line heights can be 1.5, "24px" or "150%", and colors can be hex or rgb(). Errors name the file, line, field and expected values, with a "did you mean". The same input always compiles to byte-identical CSS. Add # yaml-language-server: $schema=./schema/cadesa.schema.json for editor autocomplete. Full example: settings.cadesa.yaml → dist/settings.css.

Already have CSS? cadesa lift styles.css --out styles.cadesa.yaml converts component-style CSS (.block, .block__element) and lift --tailwind page.html --css compiled.css converts a Tailwind page. Whatever doesn't convert is reported per box, with the rule responsible, not as a coverage percentage: a :hover rule moves nothing, while one min-width query can move every box at the widths where it applies.

Language reference

Key

Value

Compiles to

layout.pattern: stack

display:flex; flex-direction:column; align-items:stretch

layout.pattern: cluster

display:flex; flex-wrap:wrap; align-items:center

layout.pattern: grid + min

size token

grid-template-columns: repeat(auto-fill, minmax(min(<min>, 100%), 1fr))

layout.template (grid)

{ columns, rows, areas, autoRows, autoColumns, dense, flow, justifyContent, alignContent }, track lists as CSS writes them (columns: subgrid on a grid item)

grid-template-*, grid-auto-*, grid-auto-flow, content alignment; placed and sized by CSS Grid's algorithm (auto, min-content, max-content, fit-content(), minmax(), fr, repeat(), line names, areas)

place

{ row, column, align, justify } ("1 / -1", "span 2", an area name)

grid-row, grid-column, align-self, justify-self

layout.pattern: layer

one grid cell holding every child: text over a photo, a badge over a card

layout.pattern: flow

ordinary block flow (display: block): children stack, vertical margins collapse as in the browser

layout.pattern: table + collapse, fixed, min

display: table (border-collapse: collapse, table-layout: fixed, min-width); gap and rowGap are its border-spacing. Columns and rows are sized as Chromium sizes them

part

caption (top, bottom), column, column-group, header, body, footer, row, cell (baseline, top, middle, bottom; content-box)

a table's children: display: table-cell with vertical-align, and so on; cells span the columns and rows of their colspan and rowspan

layout.gap

space token (cluster, grid: or a percentage size token, between columns)

gap

layout.align

start, center, end, stretch; a cluster also baseline (first baselines on one line)

align-items (cluster defaults to center, grid, layer and stack to stretch; a stack aligned otherwise sizes its items to their content)

layout.justify

start, end, center, between, around, evenly

justify-content in a cluster, distributed as Chromium does

layout.wrap

false

a one-line row (flex-wrap: nowrap) whose items shrink to fit

grow

{ factor, basis: zero | auto }

flex: <factor> …: items share a row's free space (Bootstrap's .col, Tailwind's flex-1)

shrink

a number (0, 1, 2)

flex-shrink: how much an item gives up when its row is too full, never below its min-content width (at most its width). By default an item with a width doesn't shrink and one without does

order

an integer (-1, 2)

order: where an item of a stack, cluster or grid goes among its siblings: lower first, ties in document order (default 0)

padding

space token or percentage size token (of the parent's width), or { block, inline }

padding (a missing axis is 0)

margin

space token (negative allowed), percentage size token, auto, { block, inline } or { top, right, bottom, left }

margin; collapses between blocks in flow, adds to the outer size in stacks, rows and grids; auto takes free space (top and bottom: in stacks, rows and grids)

width

size token (px, rem, "50%" or "min(440px, 100%)"), fill, fit, max-content or min-content

fixed width, stretch in a stack, fit-content or a content width. Unset: stretch in a stack, sized to its content in a cluster

height

size token (a percentage: of a stretched or set parent height)

height

maxWidth

size token

a centered column (max-width + margin-inline: auto), e.g. content inside a full-bleed band

measure

size token

a left-aligned max-width: a comfortable line length

aspect

"16:9"

aspect-ratio: the height follows the width

text

text role

font family, size, weight, line height, color; optional letterSpacing (em), transform: uppercase, style: italic, decoration, wrap: anywhere (long words break), breaks: all or anywhere (lines break inside any word: word-break: break-all, line-break: anywhere)

overflow

hidden, clip, auto, scroll, or { x, y }

overflow-x / overflow-y: what doesn't fit scrolls or is cut off. Anything but clip also keeps the children's margins inside and lets the box shrink below its content in a cluster

contain

"layout paint", content, strict, size, inline-size, none

contain: layout or paint keeps the children's margins inside and places absolute and fixed children in the box; size sizes it as if empty

textAlign

start, center, end

text-align (fixed-height text is also centered vertically)

border

color token, or { color, width, top, right, bottom, left }

border with per-side widths (they count in layout, so it's structure)

transform

"rotate(3deg)", or { value, origin, style } (2D and 3D functions in px or %; style: preserve-3d, with value: none too)

transform, transform-origin, transform-style: where the box and its content are drawn (3D: projected; in a preserve-3d context, composed unflattened); nothing else moves

perspective

px, or { value, origin }

perspective, perspective-origin: the children's 3D transforms are seen from there

background, radius, backdrop, shadow, fit

tokens

polish: background-color, border-radius, background-image, box-shadow, object-fit

when.<breakpoint>

any of the above, plus slots

@media (max-width: …); each listed property replaces its base value, and the narrowest active breakpoint wins

none in when

e.g. maxWidth: none

removes a base value at a breakpoint (.container below 576px)

page.background

color token

:root { background-color }, the color text is checked against (without it, the page is white, as in a browser)

Components nest: put a .ca-plan-card inside .ca-pricing__plans and the card lays out its own slots and breakpoints inside the parent's layout (examples/pricing). Classes are .ca-<component> and .ca-<component>__<slot> (prefix: "" drops the ca-). The compiled CSS is plain, framework-free and has no runtime, so it works in React, Vue, Svelte or static HTML (examples/vue).

Roadmap

  • Inline layout beyond one box per line: the rectangle of an inline span (its lines are exact; its own content-area box is ≈), a run aligned middle (or text-top, text-bottom) whose content reaches past its strut and that splits across lines, and inline-blocks holding more than lines of inline text (flex rows, tables other than KaTeX's stacks). Runs in another size, font or vertical-align, atomic inlines of set size, inline-blocks of lines or of blocks of lines, and KaTeX's superscripts, subscripts, fractions and roots are measured.

  • Floats: a float at an edge of the inline box it is inside (floats inside words and inside inline boxes, and lines beside a float holding taller runs and inline-blocks, are exact).

  • Text: a handwriting font's text that holds inline elements and wraps (its runs, wrapped or not, are exact once cadesa fonts --measure has laid them out and measured every line they can break into); a break-all line with inline boxes or letter-spacing of its own whose width is within the kerning across its break of the room; "ffi" and "ffl" broken by break-all in a font with ligatures; a mid-word line start that fits only within a layout unit; an inline box taller than the line that opens where a full line breaks.

  • Form controls: a date input's inner parts styled beyond paint.

  • More of Tailwind: dark: and container queries.

Development

npm test && npm run typecheck   # unit tests, including the fuzzer's regression corpus
npm run conformance:css         # any conformance suite above (needs Chrome or Chromium)
npm run fuzz -- --cases 2000    # differential fuzzer against Chromium
npm run speed                   # engine vs Playwright
npm run bench                   # agent benchmark (uses the claude CLI and model usage)

License

Cadesa's source code is MIT. The bundled Inter font is under the SIL Open Font License 1.1.

The CSS you generate is yours. Running the compiler doesn't place your .cadesa.yaml sources or the CSS it emits under the MIT license or any other Cadesa license. License your output however you like, including proprietary.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Eyes for AI coding agents: deterministic MCP server that tells the LLM which CSS rule wins, in which file, on which line — and why. Cascade verdicts, blast radius, interaction timelines, pixel-perfect audits.
      22
      14 npm
      5
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables CSS layout verification and debugging by extracting deterministic, diffable rendered layout from a browser, allowing agents to inspect, explain, and diff CSS changes.
      14 npm
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI coding agents to audit rendered web pages for design and UI defects by measuring geometry, styles, contrast and motion in a local browser and judging them against evidence-tiered rules. Findings come back as short, fixable items expressed in the project's own design tokens, while only sanitized numeric measurements leave the machine.
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coding agents to deterministically audit markup and stylesheets for WCAG contrast failures, accessibility errors and design-token sprawl, and to compute contrast ratios and inventory hardcoded colors, sizes, radii and spacing before shipping UI code. Works across any web stack with Claude Code, Claude Desktop, Codex and Antigravity, and can also run as a CI check that exits non-zero on errors.
      195 npm
      MIT