Repository navigation
feat: ship an agent harness for harnesspm - #459
Merged
Merged
Conversation
Apps on Tasty get an always-on style rule, an index of the docs of the installed version (docs/llms.txt), and the tasty:styles tool, which prints the CSS a styles object produces after --setup modules load the app's configure(), and warns about values that stayed unresolved. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Contributor
📦 Snapshot releasePublished |
This branch was successfully 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
Tasty ships an agent harness in
harness/, for harnesspm. Every app on Tasty, and throughextendsevery app on a UI kit built on it, gets:tasty:rules/usage(always on, 599 bytes): read the brief and the project's config first, tokens and units, state maps, and the tool.tasty:docs:docs/of the installed version, indexed by a hand-writtendocs/llms.txtwith the 13 consumer pages.tasty:styles: the CSS a styles object produces, with the app'sconfigure()loaded through--setup, and a warning for every value that stayed unresolved.Design note
Units
tasty:rules/usageai-agents.mdsections 0–5 plus a pointer to the tool. It is copied into every consumer'sAGENTS.md, so it stays under 640 bytes (a test checks). Two##sections, so a UI kit can patch one, such as "Checking styles".ai-agents.mdharness/.docs/llms.txtpipeline,injector,runtime-benchmarks) and positioning (comparison,adoption) are left out. A test checks every link, and fails when a new page is in neither the index nor the internal list.tasty:stylesrenderStyles()looks authoritative and is wrong (see below).tasty:statetasty:stylesoutput as its selector or at-rule. The help says: put the key in a state map.tasty-componentmethodology.mdcover it, and a docs index works better than a skill an agent must choose to load.How
tasty:stylesgets the app's config:--setup <module>Units, presets, recipes and state aliases come from
configure(), which apps call at runtime. The tool imports each--setupmodule before rendering:configure()when imported, such assrc/tasty-setup.tsor@cube-dev/ui-kit/dist/components/Root.js;tasty-zero.config.tsthat the Babel plugin'sconfigFilealready reads. The tool passes it toconfigure().--setuptakes a file path or a path inside a package, and repeats. TypeScript works on Node 22.18 or later. Guards:--setup, a warning says the CSS is for Tasty's defaults, and names the project files that callconfigure().configure()inside a function), it says so.--setup tasty.config.tsis refused: that file only lists names for the linter.Rendering:
computeStyles(), notrenderStyles()Prototyping showed that a bare
renderStyles()printsrecipe: card;as a CSS declaration even when the recipe is configured:tasty()resolves recipes in an earlier step. The tool renders throughcomputeStyles(), the core thattasty()anduseStyles()share. In Node it returns the real CSS: recipes resolved, one class per style chunk (doubled, as at runtime), keyframes renamed.Unresolved values
Tasty is silent about some of them, so the tool checks:
10foo)configure(), so there it is not checked)''Verification
pnpm typecheck,pnpm lint(now alsoharness/),pnpm format:check(now alsoharness/**/*.mjs),pnpm knip,pnpm check:test-only, andpnpm test:node(2,326 tests). The browser project runs in CI; this change does not touch browser code. The public API snapshot is unchanged.src/harness.test.ts: 18 tests. The logic runs againstsrc/; the CLI tests run oncedist/exists, as in CI.pnpm check:harness(harnesspm check, now in CI): ✅ valid, always-on text 0.6 KiB.@tenphi/harnesspmis a devDependency.End to end
Recipe from the handoff:
pnpm pack, a fresh app (git init, the tarball as afile:dependency,@tenphi/harnesspm0.1.0 from npm, pnpm, an isolatedHOME),npx harnesspm init,"trust": { "@tenphi/tasty": true }, andsyncrun as a person (outside the agent markers).The app: a small dashboard with
src/tasty-setup.ts(configure()with unitsx = var(--gap)andr = var(--radius), the@mobileand@darkstates, tokens, 4 presets and 2 recipes), atasty.config.tswith the names, and aStatCardcomponent built withtasty().What harnesspm wrote:
AGENTS.mdhas the rule with both sections, the docs index atnode_modules/.harnesspm/pkgs/@tenphi/tasty/docs/llms.txt, and the script line..claude/settings.local.jsonallowsBash(npx harnesspm run tasty:styles *).npx harnesspm why tasty:rules/usageandwhy tasty:docsname the installed files.The tool through the runner:
--setup ./src/tasty-setup.ts(TypeScript, Node 22): the app's units, states and recipes applied, 0.46 s. The setup and the tool share one Tasty instance through pnpm's symlinks.--setup: the defaults warning namessrc/tasty-setup.ts.@cube-dev/ui-kit0.212.0, with a pnpm override that points its@tenphi/tastyat this tarball.--setup @cube-dev/ui-kit/dist/components/Root.jsloads in plain Node in 0.68 s, with UI Kit's units (x = var(--gap),cr = var(--card-radius), …), its@dark,@hc,@reduced-motionand@mobilestates, and its recipes. The output shows what@darkreally becomes:prefers-color-schememedia queries plus[data-scheme]selectors.A live agent run. Headless Claude Code,
--permission-mode acceptEdits, with a task that never mentions harnesspm, the rule or the tool:It finished in 10 turns (41 s). On its own, it:
ai-agents.md, and the project's setup;tasty:styles --help;#successand#dangertoconfigure()and totasty.config.ts;padding: { '': '4x', '@mobile': '2x' },preset: { '': 'h2', '@mobile': 'h3' }, andcolor: { '': '#accent', 'trend=up': '#success', 'trend=down': '#danger' }withmods={{ trend }};tasty:styles '<the full styles>' --setup src/tasty-setup.ts, found the right setup module by itself, got no warnings, and reported the real sizes from the output (padding 24px → 12px).Follow-ups
extends: ["@tenphi/glaze", "@tenphi/tasty"]; drop the Tasty pages andTASTY_PAGESfromscripts/prepare-docs.mjs; shorten the Tasty bullet inuikit:rules/usage; patch the "Checking styles" section oftasty:rules/usageto name--setup @cube-dev/ui-kit/dist/components/Root.js, or adduikit:styleswith that setup built in.harnesspm why tasty:scripts/stylesanswers "No unit", though the managed block names that ID.Generated by Claude Code