Repository navigation
feat(cli): add check and inspect commands for agents - #348
Merged
Merged
Conversation
A reference to a missing token in a recipe or a utility value built silently and emitted a var() that is never declared, and a misspelled theme override or a duplicate variable lost a value without a word. validate(instance) walks the finished instance and returns every problem in one pass: unresolved-reference, undefined-theme-override and duplicate-variable, each with the path that made it and the closest token name within two edits. transpile() runs it once and returns the diagnostics beside files, or throws one error listing them all under the new strict option. variable() and the utility namespace fallback keep a record on the root of what the finished tree no longer holds. Nested at-rules keep hyphenated names, so @starting-style and @font-feature-values emit as written. The theme gains z-index.tooltip, which the tooltip recipe already used, and the xs chip indicator stops referencing the undefined font-size.4xs. The transpiler and barrel peer on the core release that ships validate(). The theme typecheck builds again without the duplicate wcagContrast declaration.
A plain @token string in a selector or theme still throws when it's defined, so the docs and changeset now say which references validate() reports. The default z-index output blocks list the tooltip level, and a namespace fallback whose variable was defined later says so instead of claiming no variable exists.
`styleframe build` logged a failed build and exited 0, so neither CI nor an agent could trust it. It now prints one warning line per diagnostic that `validate()` finds, exits 1 under `strict: true` without writing files, and exits 1 when the build fails. The new `styleframe check [--json]` reports the same diagnostics without writing anything, and exits 1 on any. The plugin logs each diagnostic once per build, although it transpiles up to three times, and under `strict` the debounced type generation in the dev server sends its failure to the error overlay instead of only logging. Core gains `inspect(instance)`, a JSON-serialisable snapshot of the variables, themes, utilities, modifiers and recipes an instance defines.
…406' into add-check-command-uxf-411
`styleframe check` on an entry that doesn't exist reported a clean config, because the loader falls back to an empty instance. It now prints "Config file not found" on stderr and exits 1. The plugin keyed logged diagnostics on code and path, so a second unresolved reference in the same value was never logged. It now keys on the message too. The check tests now run in a temporary working directory with every consola level on, so a written file or a stray stdout line fails them.
`check` resolved the entry with `path.resolve`, which drops a trailing slash and collapses `..` by text, so an entry the loader can't find, like `styleframe.config.ts/`, still loaded an empty instance and passed. It now builds the path with `path.join`, as the loader does.
An agent had no way to list what a configuration registers short of reading its source or the generated CSS. `styleframe inspect [entry] [section] [--json]` prints the snapshot `inspect()` returns, all of it or one section, as readable lists or as one JSON document on stdout. `styleframe check --typecheck` runs the project's own `tsc` on the entry file, through a temporary tsconfig outside the project that extends the nearest `tsconfig.json`, and reports each type error as a `typescript` diagnostic beside the ones `validate()` finds. TypeScript 7 ships no JavaScript compiler API, so it spawns the `tsc` binary, and `typescript` becomes an optional peer of the CLI.
The temporary tsconfig that `check --typecheck` writes lived in the OS temp directory, so TypeScript resolved `types` entries like `node` or `vite/client` from there and reported a false TS2688. It now lives in the project's `node_modules/.cache`, which resolves the same packages as the project, and is removed afterwards. An inherited `incremental` or `composite` made `tsc --noEmit` write build info into the project, overwriting its `.tsbuildinfo` or leaving files in its `outDir`. The temporary config turns both off.
Turning `composite` off for every project dropped the `declaration` it implies, so a project with `declarationMap` or `emitDeclarationOnly` failed `check --typecheck` with TS5069. Keeping `composite` on instead rejects any local file the config imports with TS6307. The type check now asks `tsc --showConfig` for the resolved options and, only for a composite project, turns `composite` off and `declaration` on. Creating the temporary directory in a read-only `node_modules`, like under Nix or in a root-owned image, threw a raw EACCES stack trace. It now falls back to the system's temporary directory.
Agents that write a Styleframe config made the same mistakes over and over, because the traps were written down only in the contributor guides. Add a "Using Styleframe with AI agents" page with the inspect, check and strict loop and the mistakes that build without a warning, and fix two claims the output contradicts: the colour levels in the design system guide are fixed oklch() values, and the Tailwind comparison now says what the type checks and the build checks cover. The utilities page warns that an uncalled creator emits no CSS. Nine published packages listed README.md in their files but shipped none, so their npm pages were empty. Each now says what it is, how to install it and where its docs and the agents page are.
A plain "@token" in a selector or a theme declaration still throws when it's defined; only recipes, utility values and css template literals report it as a diagnostic. The Tailwind comparison now says so, in three short paragraphs, and the agents page matches it. The scanner README says the plugin only scans once scanner.content is set. The agents page splits its overview, says that check prints no JSON when a config throws and that --typecheck needs typescript, and the theme, plugin and core READMEs are more exact about runtime, Bun and the standalone core import.
A string "@token" in a utility created with an object throws when it is defined, like one in a selector; only the array form reports unresolved-reference. The Tailwind comparison and the agents page now name both forms.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
alexgrozav
marked this pull request as ready for review
October 21, 2026 09:48
alexgrozav
marked this pull request as draft
October 21, 2026 10:22
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.
Description
This PR makes Styleframe report the mistakes that used to build without a word, gives the CLI a way to check and inspect a configuration, and documents both for AI agents. It collects three PRs that were each reviewed on their own. The first part,
validate()andstrict(#343), is already onmain.checkand exit codes.styleframe check [entry] [--json]runsvalidate()without writing files and exits1on any diagnostic. With--json, it prints one{ "ok", "diagnostics" }document on stdout.styleframe buildprints one warning line per diagnostic, and now exits1when the build fails (it used to exit0). The bundler plugin logs each diagnostic once per build and fails the build understrict: true. Core gainsinspect(instance), a JSON-serialisable snapshot of what an instance registers.inspectand--typecheck.styleframe inspect [entry] [section] [--json]lists the variables, themes, utilities, modifiers and recipes a configuration registers.styleframe check --typecheckruns the project'stscon the entry file and reports each type error as a diagnostic.typescriptis an optional peer dependency of@styleframe/cli.08.tooling/03.agents.md), covers the loop and the common mistakes. The PR fixes the stale claims in the guide, the Tailwind comparison and the utilities page, and adds a README to the nine published packages that shipped none.Related issue
None in this repository.
Type of change
Checklist
feat(theme): …)pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm testand everything passespnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/testsdist/,.styleframe/)mainand stays focused in scopeNotes / screenshots
styleframe buildexiting1on a failed build is a behaviour change for scripts that relied on0. The@styleframe/clichangeset names it.strict: true.maingives one commit.