Repository navigation
feat: ship an agent harness with theme and color tools - #113
Merged
Merged
Conversation
Projects that use Glaze through harnesspm get a short rule, the docs index, a glaze-theme skill and two tools: glaze:inspect resolves a theme or palette in all four schemes and checks every contrast floor the way the solver measures it, and glaze:contrast measures two colors. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7GamurMRrRt4fBQ4Zy
Contributor
📦 Snapshot releasePublished |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7GamurMRrRt4fBQ4Zy
5 tasks done
…export - glaze:color resolves one color without a theme file: its value, hue, saturation and tone in all four schemes, and with --base / --contrast its WCAG and APCA contrast on that base in each scheme. - glaze:inspect takes --color <part> and --theme <name> to narrow a large palette; bases of shown colors stay, and only their warnings print. - The measuring module is public as @tenphi/glaze/harness/measure, with hand-written types checked by tsconfig.harness.json. - CI runs `harnesspm check`; @tenphi/harnesspm is a devDependency. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
tenphi
marked this pull request as ready for review
November 12, 2026 14:08
Merged
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Glaze now ships a harness for coding agents (Claude Code, Codex) in
harness/, inside the npm package. A project that depends on Glaze and uses harnesspm (@tenphi/harnesspm) gets it on install:glaze:rules/colors(always-on, 0.8 KiB)glaze:docsdocs/(all 19 pages,.mdand.mdx, titled by frontmatter) pointing at the installed version.glaze-themeglaze:inspectbase. Eachcontrastfloor gets ✓ / ✗; Glaze's own warnings are listed. Exits 1 on a miss. 🆕--color <part>and--theme <name>narrow a large palette.glaze:color🆕--base/--contrastits WCAG and APCA contrast on that base in each scheme.glaze:contrast@tenphi/glaze/harness/measure🆕uikit:tokens) build on it.Scripts run only in projects that trust the package (
"trust": { "@tenphi/glaze": true }inharnesspm.json).Why
The methodology checklist asks people to verify "rendered WCAG/APCA results" in every scheme and "no unexplained warnings". An agent can't see a rendered page, so today it writes a throwaway script or guesses.
glaze:inspectturns that checklist item into one command, and its numbers are the solver's own.The two new tools come from what the pilot agent runs showed:
glaze:inspecteach time.glaze:coloranswers "what tone is this brand color, and where does Glaze put it on this surface?" in one call, before any edit.glaze:contrastfour times, once per scheme, with copied hex values.glaze:color <color> --base <surface>measures all four schemes at once (the base adapts likeglaze.color(<base>)).glaze:inspectprints 339 lines.--color brand --theme defaultprints only what the agent asked about.How it looks
What
AGENTS.mdgets in a consumer project:npx harnesspm run glaze:color '#2563eb' --base '#ffffff' --contrast AA:The color is a value (hex,
rgb(),hsl(),okhsl(),okhst(),oklch()) or aglaze.color()input as JSON ('{"from":"#2563eb","tone":40}'). Floors:AA,AAA,AA-large, a ratio such as4.5,apca:content,apca:75, or JSON. Exits 1 on a missed floor.npx harnesspm run glaze:inspect src/palette.mjs --theme danger --color accent-texton UI Kit's palette:--colorkeeps colors whose name contains a part (a comma list matches any part), plus the base each is measured against, so every "vs" row has its base on screen.--themekeeps palette themes by name; an unknown name fails and lists the themes.The measuring module,
@tenphi/glaze/harness/measureinspectTheme,filterThemes,missesOf,inspectColor,measurePair,parseColor,formatVariant,roleOf,themesFromSnapshot,themesFromObject,kindOf,SCHEMES,WCAG_PRESETS,FORMATS.measure.d.mts, checked by a newtsconfig.harness.json(withoutskipLibCheck) inpnpm typecheck.AGENTS.md, which marks the module as public.Design notes
measure.mjsuses the metric's own luminance (gamutClampedLuminance/apcaLuminanceFromLinearRgb), each variant'spastel, the floor resolved per scheme withresolveContrastForLevel(socontrastLeveland HC escalation apply), and APCA polarity from the role.roleOfmirrorsresolveRoleInMapinsrc/resolver.ts, the one place that must stay in step with the resolver (noted inAGENTS.md).inspectColorreads a token's role and floor from its own snapshot, and a base it brought along throughglaze.colorFrom().measure.mjstakes the Glaze module, sosrc/harness.test.tsruns it onsrc/(no build needed) while the CLI usesdist/. New tests:inspectColorkeeps a value exact in light, measures the adapting base in every scheme, sees the solver's APCA landing (+0.5 Lc), marks an unmeetable floor (7:1 on a mid gray) and takes tokens;filterThemes; the CLI parsers; the./harness/measureexport..mjs, Node ≥ 20 (a TS theme module needs Node 22.18+ type stripping; JSON works everywhere).harnesspm checkin CI.@tenphi/harnesspmis a devDependency, and CI runspnpm exec harnesspm checkafter the tests.package.json:harnessinfiles; the./harness/measureexport;format/format:checkcoverharness/**/*.{mjs,mts}.tsconfig.test.jsongetsallowJs,resolveJsonModuleand apathsentry so the types resolve@tenphi/glazetosrc/.README.md"Coding agents" section,AGENTS.mdharness/table, and twominorchangesets: the harness with its three tools, and the public measuring module.Verification
pnpm typecheck,pnpm lint,pnpm format:check,pnpm test(879 tests),pnpm exec harnesspm check✅ — CI green onbfcaf6a, including the new harness check step and the docs build.@tenphi/harnesspm0.1.0 from npm, an isolatedHOME,harnesspm init,trustfor@tenphi/glaze,syncrun as a person. ✅ Managed block (above), docs index, skill link, and allow rules for all three scripts. All three tools ran throughnpx harnesspm run.src/palette.mjsis UI Kit's palette (8 themes, 164 colors), written out as plainglaze()themes. Headless Claude Code, asked: "Our brand color is #2563eb. Add it to the app's color palette in the default theme: a brand fill for primary buttons with readable text on it, and a brand color for links on the page surface. All text must stay readable (WCAG AA) in light, dark and high contrast." No mention of harnesspm or the tools. What it did, in 12 turns (41 s):glaze-themeskill.glaze:color '#2563eb'andglaze:color '#2563eb' --base '#ffffff' --contrast AAbefore editing anything, then read the color-definitions reference from the docs index.brand-fill(from: '#2563eb',mode: 'fixed',contrast: 'AA'against a fixedbrand-fill-text),brand-text(from: '#2563eb',base: 'surface',contrast: 'AA'), bothpastel: falseto keep the brand's chroma.glaze:inspect src/palette.mjs --color brand --theme default, then the full palette before and after: 308 floors met, no warnings.--color brand --theme defaultshows 8 of 8 floors met, the full palette 308 of 308.harnesspm why glaze:scripts/coloranswers "No unit" in 0.1.0 (it knows only rules and skills).Before merging
@tenphi/harnesspm0.1.0 is on npm, so the README / AGENTS.md / changeset links work.uikit:tokens/ itssrc/harness.test.tscan import@tenphi/glaze/harness/measureinstead of the file path.harness/adds about 43 KB (uncompressed) to the package.🤖 Generated with Claude Code
https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV