check reads a React app and lists what still goes around the UI kit: colours typed by hand, controls built by hand where the kit has one, your own versions of kit components, and a second copy of the theme's variables. It is how you, or a coding agent, see whether "use the design system" was done.
How to use it
npx designsource check [folder] [--json] [--strict]Run it in the app's folder, or name the folder. It needs no token, no sign-in and no network, and it writes nothing.
| Flag | Does |
|---|---|
folder |
The app's folder (default: the current one). |
--json |
The report as JSON, with a version field (1). Fields are only ever added. |
--strict |
Exit 1 when anything is found, for CI. The report always prints first. |
Without --strict it exits 0 whatever it finds, so a first run on an app that has a lot to do is still useful.
Checked 142 files in this app. The UI kit is here: 38 components.
Kit share: 78% of controls use the kit (156 of 200).
Hardcoded colours: 23 in 9 files
src/app/page.tsx:14 #1f2937
src/app/page.tsx:22 bg-blue-600
… and 21 more
Hand-built controls: 44 (<button> 30, <input> 14)
Own versions of kit components: none
A second theme: none
Theme variables used by hand: 11 (fine, though a kit component or utility is better)A coding agent gets the same report from the MCP tool check_design_system, with twenty findings per measure.
How it works
It walks the folder and reads .tsx, .jsx, .ts, .js, .mjs, .css and .scss files. It skips node_modules, build output, public, scripts, every dot-folder, tests, stories, type declarations and tool configuration such as tailwind.config.ts. It never follows a symlink, and it stops at 5,000 files or 32 MB, skipping any file over 512 KB, and says so.
Files add wrote carry a designsource: stamp: they are the kit, so they are never findings. A kit file you edited is listed. The theme between the designsource:theme markers is read only to learn which variables it defines.
| Measure | Counted when |
|---|---|
| Hardcoded colours | A hex colour or rgb(), hsl(), oklch() value with no var() inside, in a stylesheet or under a colour-named key or prop in a component (style={{ color: '#fff' }}, fill="#000"); a Tailwind palette class such as bg-blue-500 or text-white, or an arbitrary one such as bg-[#fff]. |
| Hand-built controls | A raw <button>, <input>, <textarea>, <select>, <table>, <dialog>, <progress>, <hr> or <label>, counted only when the app holds the kit component that covers it. |
| Own versions of kit components | A function, const or class named like a kit component in the app, such as Button or Card. |
| A second theme | A theme variable such as --primary declared again in another stylesheet. |
| Theme variables used by hand | var(--primary) and the like. Information, not a finding. |
| Kit share | Uses of the kit's controls over those uses plus the hand-built controls. |
Each finding prints its file, line and the matched text only, never the line around it. It is an estimate made with patterns, not a parser: it can miss things, and a colour in a string it cannot place is not counted.
What can go wrong
This app does not have the UI kit yet: run npx designsource add.The kit is not in this folder; the colour count still runs.<folder> does not exist or is not a folder.Check the path.- The home folder or a folder above it is refused, and so is a folder that is not a React app. See CLI errors.
Related
add: put the kit in, and the rules block for coding agents.- For coding agents.
- CLI errors.