Skip to main content

crunk: declare your design system once; crunk exports it, lints against it, and fixes the drift.

PyPI version Python 3.11+ License: MIT CI status

crunk

crunk brings Figma-style design discipline to front-end code: declare your palette, scales, and file organization once in crunk.toml, and crunk exports the tokens, lints your CSS against them, auto-fixes the drift, and enforces the organization -- deterministically, in CI, with no browser in the loop.

Highlights

  • One source of truth. Palette, type/spacing scales, and organization rules live in a single declarative crunk.toml; every other artifact (CSS custom properties, Tailwind theme, docs) is generated from it, never hand-maintained.
  • A linter, not a style guide. crunk check fails on any color, size, or shadow that is not in the declared system -- including role-pair contrast ratios (--contrast) -- so drift is a red build, not a review-time opinion.
  • Deterministic autofix. crunk fix applies the mechanical remediations check found (nearest-token rewrites, organization moves), with --dry-run to preview.
  • Reuse before rebuild. crunk query find button asks the design system whether a component already exists before you write a second, slightly different one.
  • Terminal-native. crunk preview prints the token sheet and crunk diff compares two token sets, both straight to the terminal.

Install

uv tool install crunk
# or
pip install crunk

The package installs two equivalent binaries on PATH: crunk and the short alias crk.

Quickstart

crunk init --preset default   # scaffold crunk.toml + a skeleton project
crunk check                   # lint tracked CSS against crunk.toml
crunk tokens                  # export the declared tokens as CSS
crunk fix --dry-run           # preview the mechanical fixes check found
crunk map                     # print the organization inventory
crunk check --contrast        # print role-pair contrast ratios, PASS/FAIL
crunk query find button       # is there already a button component?
crunk preview                 # print the terminal token sheet
crunk diff ../other-project   # diff two crunk.toml token sets

Customize the design system by editing the scaffolded crunk.toml (palette, scales, organization rules) -- see docs/design/02-specification.md for the full schema and rule catalog.

Commands

Command What it does
crunk init scaffold crunk.toml + skeleton
crunk check lint against the spec
crunk tokens export/verify tokens
crunk fix deterministic autofix
crunk map organization inventory
crunk query ask the design system: reuse before rebuild
crunk preview terminal token sheet, no browser needed
crunk diff OTHER token-set diff vs another spec

8 commands. See docs/commands/ for each one's flags and exit codes: init, check, tokens, fix, map, query, preview (also covers diff). check/fix/map/query accept --no-cache to bypass the result cache (see docs/design/subsystems/cache.md).

Tailwind integration

To expose a declared sizes scale as real utility classes (min-h-size-44 etc.) rather than one-off arbitrary values, adopt the generated tailwind.tokens.json wholesale -- theme: { extend: require("./tailwind.tokens.json") } with namespace_keys on -- instead of hand-wiring only some categories into theme.extend: the generated file carries all six sizing categories, and hand-picking a subset silently drops the rest. See docs/commands/tokens.md for the full mapping.

Documentation

The design docs are a waterfall under docs/design/: requirements, specification, system design, subsystems, components -- each layer with its test plan. Per-command references live under docs/commands/.

Development

git clone https://github.com/lognd/crunk.git
cd crunk
make install     # stamp-guarded uv sync

This is a frob-enabled project: frob <verb> is the interface for everything past install, not a make wrapper around it.

frob test        # select and run tests for the touched set (or --all)
frob format      # ruff check --fix + ruff format
frob coverage    # refresh coverage.xml / the coverage stamp
frob check       # the aggregate gate: ruff, ty, frob cycle/dup/arch/...

make install/make clean/make upload remain (bootstrap and build/publish -- see the Makefile's own comment on this split). You do not need frob installed to contribute; uv run pytest -q covers the test suite and CONTRIBUTING.md covers the rest.

Contributing

Contributions are welcome, from a typo fix to a new feature. Read CONTRIBUTING.md before opening a pull request; it covers the local dev setup, the commit format, and the AI-assisted-contributions policy in particular. Everyone participating in this project is expected to follow the Code of Conduct.

Security

See SECURITY.md for how to report a vulnerability; please do not file a public issue for one.

License

MIT, see LICENSE.

Metadata

Release files for crunk 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crunk 0.1.1
File Size Uploaded Provenance
crunk-0.1.1.tar.gz 118.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for crunk 0.1.1
File Interpreter ABI Platform
crunk-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 262.3 kB

Release files / crunk-0.1.1.tar.gz

Download URL crunk-0.1.1.tar.gz
Size 118.6 kB
Tags Source
SHA-256 checksum
How to use checksums
616e1813b6c0d5a7b6c34fcb408ab18fb5700d70f99ec1bf5b97f34df1bcc201
BLAKE2b-256 checksum
How to use checksums
10cb320f6ea5429efb5620bf6092147bc860b5e2942ce6fbd7e7b361ddf0e192
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release files / crunk-0.1.1-py3-none-any.whl

Download URL crunk-0.1.1-py3-none-any.whl
Size 143.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73d3b7efa00887bf159bea8f2ff561dfe59914c316b1a2f3481261429746625f
BLAKE2b-256 checksum
How to use checksums
d2248d95045cbc99d5ac896ffbb28fffbebebfc487a24310f16672f73ebe75d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Security for crunk 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for crunk-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page