Skip to content

chore(harness): use harnesspm in UI Kit's own repo - #1655

Merged
tenphi merged 3 commits into
claude/clever-lovelace-wz2ua2from
claude/scope-gpookh
Nov 13, 2026
Merged

tenphi merged 3 commits into
claude/clever-lovelace-wz2ua2from
claude/scope-gpookh

Conversation

@tenphi

@tenphi tenphi commented Nov 13, 2026

Copy link
Copy Markdown
Member

Describe changes

Agents that work on @cube-dev/ui-kit now get the harnesses of the packages it builds on (Tasty, Glaze and the Tasty lint plugin) from the installed versions, through harnesspm. They replace the hand-made docs/tasty and docs/glaze symlinks. UI Kit's own harness/ becomes the project layer here, so contributors see what consumers see, plus four patches for this repo.

Stacked on #1643. Retarget to main after #1643 merges.

What changed

  • harnesspm init, run as a person: prepare is now husky install && harnesspm sync, plus harnesspm.json, harnesspm.lock.json, and CLAUDE.md with @AGENTS.md.
  • Trust: @tenphi/tasty, @tenphi/glaze and @tenphi/eslint-plugin-tasty, as true, since @tenphi/* packages are ours. Their tools (tasty:styles, glaze:*, tasty-lint:check) and the lint-on-edit hook now run here. uikit:tokens comes from the project layer, which is trusted already.
  • Four project patches in harnesspm/patches/, for this repo only (see the decisions below).
  • Nested CLAUDE.md files. A root CLAUDE.md turns off Claude Code's reading of nested AGENTS.md files: with a CLAUDE.md in the working folder or above, it reads only CLAUDE.md files (docs). So each of the five folders that has one gets a CLAUDE.md with @AGENTS.md.
  • The symlinks are gone. AGENTS.md's "Tasty and Glaze Documentation" points at the two indexes in the block. docs/rules/review.md and docs/rules/probe.md link the pages through harnesspm's stable paths (node_modules/.harnesspm/pkgs/@tenphi/…).
  • update-tasty / update-glaze keep the version bump, then run harnesspm sync, because pnpm add runs no prepare. They had no symlink steps.
  • CI: the lint job fails when the committed agent files are out of date. The planner reads harnesspm's files as repository notes.
  • Prettier: the block is wrapped in <!-- prettier-ignore-start -->/-end -->, outside harnesspm's markers. Prettier adds a blank line after BEGIN:harnesspm and before END:harnesspm, and harnesspm sync --check then fails. harnesspm leaves text outside its markers alone.

No changeset: consumers get nothing new. files is unchanged, and prepare does not run when a package is installed from the registry.

What agents working on UI Kit now get

The managed block at the end of AGENTS.md:

Section Units
@tenphi/eslint-plugin-tasty 1.19.0 tasty-lint:rules/usage (patched here), the rule-page index, tasty-lint:check, the PostToolUse lint hook
@tenphi/glaze 3.1.0 glaze:rules/colors (UI Kit's patch, then this repo's), the docs index, the glaze-theme skill, glaze:inspect / glaze:color / glaze:contrast
@tenphi/harnesspm 0.3.0 harnesspm:rules/generated-files, the file-scoped harnesspm-config rule, the docs index, the harnesspm-import / -export / -improve skills
@tenphi/tasty 3.19.1 tasty:rules/usage (UI Kit's patch, then this repo's), the docs index, tasty:styles
@cube-dev/ui-kit (this project) uikit:rules/usage (patched here), the docs index, uikit:tokens

In this repo, UI Kit's docs index lists every page in src/, not only the shipped ones: specs, READMEs and the nested AGENTS.md files too. For contributors that helps.

Decisions about the project layer

Each shipped text is right for consumers and misleads only here, so the fixes live in harnesspm.json patches, not in harness/.

Rule, section Shipped text In this repo Decision
uikit:rules/usage, Components Build screens from UI Kit components; read their pages Applies: compose from existing components. The barrel-import rule is in AGENTS.md and lint. Kept
uikit:rules/usage, Styling Find a token with uikit:tokens It reads dist/. In a fresh checkout: cannot find UI Kit's build at …/dist/tokens/palette.js. After a build, it can be out of date. Patched: pnpm probe tokens --filter <part>
glaze:rules/colors, Where colors come from "In an app on UI Kit … a color the palette lacks comes from your own Glaze theme or glaze.color()" UI Kit is the palette: src/tokens/palette.ts builds it with Glaze. A theme of a component's own is the wrong fix. Patched: add the color to the palette
glaze:rules/colors, Checking a theme Run glaze:inspect on the theme's file glaze:inspect src/tokens/palette.ts fails (Cannot find module …/lazy-styles: imports without extensions). dist/tokens/palette.js exports no palette object either: getPalette() builds it. Patched: diff pnpm probe tokens --json across all four schemes, and pnpm test -- src/tokens. glaze:color and glaze:contrast work and stay.
tasty:rules/usage, Checking styles tasty:styles … --setup @cube-dev/ui-kit/dist/components/Root.js Without dist/: cannot resolve --setup. With it, it may be out of date. AGENTS.md already says pnpm probe. Patched: pnpm probe styles '<json>'
tasty:rules/usage, Writing styles Read ai-agents.md; project tokens only; no style prop Applies Kept
tasty-lint:rules/usage, both sections Lint with tasty-lint:check; exceptions as eslint-disable-next-line On Button.tsx, tasty-lint:check reports 6 problems (1 error) and pnpm exec oxlint reports none. Each flagged line carries // oxlint-disable-next-line tasty/… -- <reason>, which ESLint ignores (src/ has 79 of those and 4 in the eslint spelling). The tools also run without typeAwareJSX and mergeFunctions. Fed a file with such a directive, the hook exits 2. Patched: pnpm exec oxlint <files> decides; exceptions in UI Kit's spelling. The hook stays: it reports only problems an edit adds.

Size

pnpm exec harnesspm status: Codex 47.1 KiB of 32 KiB · Claude Code 368 lines.

Before this PR After
UI Kit's own text 40.9 KiB 41.2 KiB
harnesspm block — 5.9 KiB
AGENTS.md 40.9 KiB 47.1 KiB

UI Kit's AGENTS.md was over Codex's 32 KiB already. Codex cuts it in "Tasty and Glaze Documentation", so it misses the harness section, Stack, i18n, TypeScript & Exports, Testing and the whole block. Claude Code reads all of it. This PR cuts none of UI Kit's rules. Proposal, for a follow-up: move these sections into on-demand pages in docs/rules/, each with a one-line pointer in the "Rules" list:

Section Size To
Commands 5.8 KiB docs/rules/commands.md, keeping the five most-used commands
Harness for Coding Agents 4.1 KiB docs/rules/harness.md
Styling: Keep Components Customizable 3.4 KiB docs/rules/coding.md, keeping a two-line summary
Linear Issues 2.6 KiB docs/rules/linear.md
Bundle Size, CI 2.7 KiB docs/rules/ci.md
Snapshot Budget, Accessibility Baseline 2.2 KiB storybook.md has them in full already: one line each

That moves about 18 KiB and brings AGENTS.md to about 30 KiB with the block. It also brings Claude Code nearer the vendor's advice of about 200 lines. Until then, a Codex user can raise project_doc_max_bytes in their own ~/.codex/config.toml.

CI

The lint job now runs this right after pnpm install --frozen-lockfile:

- name: Check the agent files match the installed harness (harnesspm)
  run: |
    files="AGENTS.md CLAUDE.md harnesspm.json harnesspm.lock.json"
    if [ -n "$(git status --porcelain -- $files)" ]; then
      git --no-pager diff -- $files
      echo "::error::The harnesspm block in AGENTS.md or harnesspm.lock.json is out of date. Run \`pnpm exec harnesspm sync\` and commit the result."
      exit 1
    fi

Why not harnesspm sync --check: the install runs harnesspm sync in prepare, and with CI=true it still rewrites the committed outputs. So --check passes on a PR that forgot to sync. Checked locally with harnesspm 0.3.0: after a patch edit without a sync, CI=true pnpm install --frozen-lockfile was followed by sync --check → ✅ "up to date", while this step failed with the message. It uses git status, so a file the sync created counts too.

scripts/ci/plan-jobs.mjs: harnesspm.json, harnesspm.lock.json and harnesspm/ are repo-notes. Only the lint job checks them, and nothing else reads them. CLAUDE.md files fall under notes. plan-jobs.test.mjs covers each path.

Agent runs

Headless Claude Code 2.1.323 in the worktree, with the session variables unset. The task never mentions harnesspm, docs or tools: "The inline-size Badge looks cramped: give it more horizontal padding, about 1x instead of .5x. Also, the label of a disabled Badge is hard to read: pick a palette text color that reads better on its fill in both light and dark mode. Change only Badge.tsx, and check the CSS your change produces before you finish."

  1. --permission-mode acceptEdits only (13 tool calls). It made the padding edit, and the lint hook fired (PostToolUse:Edit, exit 0: no new problem). Then it stopped. pnpm install, pnpm probe tokens --filter surface-text (the patch's wording) and node scripts/probe.mjs all need approval, and this repo allows none of them. It did not try the trusted harness tools, which are allowed.
  2. The same, with pnpm install, pnpm rebuild esbuild, pnpm probe * and pnpm exec oxlint * allowed, as a person would approve them (20 tool calls, 87 s):
    • ran pnpm install: prepare → harnesspm sync, "Nothing changed";
    • pnpm probe tokens --filter surface (the UI Kit patch), then glaze:contrast (Glaze's rule) on the literal values: 8 measurements across the schemes;
    • made the padding edit, and the lint hook fired again (exit 0);
    • checked the CSS with pnpm probe render (the Tasty patch points at probe styles), and linted with pnpm exec oxlint (the lint patch): clean;
    • left the disabled color as it was, with a measured reason: no palette text token beats #surface on that fill in dark mode (4.55:1). It proposed changing the fill instead (#surface-text-soft: 9.54:1 light, 7.17:1 dark).
    • It never opened a docs index or Tasty's ai-agents.md, and never used the glaze-theme skill, uikit:tokens or tasty:styles.

The edits of both runs were discarded.

Checklist
  • Pipeline is passed
  • Tests are passed successfully
  • Commit message follows commit guidelines

Other information

Verification

  • pnpm lint, pnpm test:types and pnpm check:harness pass. scripts/ci/plan-jobs.test.mjs and src/harness.test.ts pass (63 tests), and so does the full suite (pre-push).
  • pnpm exec harnesspm sync --check: ✅ outputs up to date.
  • pnpm exec harnesspm doctor, after a sync as a person: ✅ ready. 12 per-machine files are ignored and untracked, 17 per-machine outputs are in place, and nothing waits for trust.
  • The existing .claude/ content (the implement, ui-review, entropy-review, create-ticket and modern-web-guidance skills, and launch.json) is untouched. harnesspm adds links next to it (.claude/skills/glaze-theme, harnesspm-*) and .claude/settings.local.json, all listed in .git/info/exclude.
  • harnesspm sync in a copy without .git, like a deploy that installs without one: exit 0.

Found along the way (for harnesspm and the lint plugin, not this PR)

  • harnesspm writes the block in a form Prettier changes (no blank line after BEGIN or before END), so a Prettier-formatted repo needs the ignore wrapper.
  • harnesspm status says "close to Codex's 32 KiB limit" at 47.1 KiB.
  • harnesspm init adds a root CLAUDE.md, which silences nested AGENTS.md files for Claude Code. It could add the same CLAUDE.md next to each, as it does for workspaces.
  • Outside a git repository, sync creates .git/harnesspm/state.json.
  • With pnpm, the lock records no tarball URL or integrity, so harnesspm fetch has nothing to download.
  • eslint-plugin-tasty's tool and hook ignore oxlint-disable comments and the project's settings.tasty. In an Oxlint project they report lines its lint accepts.

Generated by Claude Code

Agents that work on UI Kit now get the harnesses of the packages it builds
on, from the installed versions, through the same block consumers get.

- `harnesspm init` adds `harnesspm sync` to `prepare` (after `husky
  install`), `harnesspm.json`, the lock, and `CLAUDE.md` with `@AGENTS.md`.
- `harnesspm.json` trusts `@tenphi/tasty`, `@tenphi/glaze` and
  `@tenphi/eslint-plugin-tasty`, so their tools and the lint hook run here.
- Its patches fit the shipped rules to this repo. They name `dist/`, which
  is missing or stale here, a consumer's own Glaze theme, and the plugin's
  own lint, which ignores UI Kit's `oxlint-disable` comments and settings.
  The block now points at `pnpm probe`, `src/tokens/palette.ts` and
  `pnpm exec oxlint`.
- A root `CLAUDE.md` makes Claude Code skip nested `AGENTS.md` files, so
  each folder that has one gets a `CLAUDE.md` that imports it.
- `update-tasty` and `update-glaze` sync after `pnpm add`, which runs no
  `prepare`.
- The block is wrapped in prettier-ignore: Prettier adds blank lines
  inside it, and `harnesspm sync --check` then fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
The hand-made `docs/tasty` and `docs/glaze` symlinks into `node_modules`
are gone. AGENTS.md points at the docs indexes in the harnesspm block,
which `pnpm install` writes for the pinned versions, and names the pages to
start with. The review and probe rules link the same pages through
harnesspm's stable package paths (`node_modules/.harnesspm/pkgs/...`).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
`pnpm install` runs `harnesspm sync` in `prepare`, and with `CI=true` it
still rewrites the committed outputs. So a later `harnesspm sync --check`
passes on a PR that forgot to sync. The lint job now checks right after the
install that `AGENTS.md`, `CLAUDE.md`, `harnesspm.json` and the lock did not
change, and tells the author to run `pnpm exec harnesspm sync`. It uses
`git status`, so a file the sync created also counts.

The CI planner reads `harnesspm.json`, its lock and `harnesspm/` as
repository notes: only the lint job checks them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
cube-ui-kit Ready Ready Preview Nov 13, 2026 5:03pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 965ad73

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

📦 NPM canary release

Deployed canary version 0.0.0-canary-f7776c2.

@github-actions

Copy link
Copy Markdown
Contributor

🏋️ Size limit report

Name Size Change
All 647.38 KB Baseline not found
Tree shaking (just a Button) 163.38 KB · 25.2% of All Baseline not found

⚠️ No baseline found for claude/clever-lovelace-wz2ua2 — the sizes above are absolute, with nothing to compare them to.

Third-party packages

✅ No third-party package entered or left the bundle, and none grew more than 10 KB past its approved size.


No module-level report for this run — Statoscope needs a baseline build to diff against.

@github-actions

Copy link
Copy Markdown
Contributor

@tenphi
tenphi merged commit 965ad73 into claude/clever-lovelace-wz2ua2 Nov 13, 2026
31 checks passed
@tenphi
tenphi deleted the claude/scope-gpookh branch November 13, 2026 17:12

This branch was successfully deployed

2 active deployments
Chromatic staging — 965ad737 Deployed Nov 13, 2026 by tenphi via Prepare Storybook for review & tests #4401
Preview — 965ad737 Deployed Nov 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants