Skip to content

feat(cli): add the inspect command and a config type check - #346

Merged
alexgrozav merged 3 commits into
styleframe-agent-ergonomics-uxf-406from
add-inspect-command-uxf-412
Oct 21, 2026
Merged

alexgrozav merged 3 commits into
styleframe-agent-ergonomics-uxf-406from
add-inspect-command-uxf-412

Conversation

@alexgrozav

@alexgrozav alexgrozav commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds styleframe inspect [entry] [section] [--json], which prints the snapshot inspect() returns: the variables, themes, utilities, modifiers and recipes a configuration registers, all of them or one section, as readable lists or as one JSON document on stdout. An agent can now see the token names, the themes a preset adds, a utility's class names and a recipe's variant options without reading the source or the generated CSS.

The check command gains --typecheck. It resolves the tsc of the TypeScript the entry file's project installs (TypeScript 7's typescript package ships no JavaScript compiler API), writes a temporary tsconfig that extends the nearest tsconfig.json with files: [<entry>] and include: [], runs tsc --noEmit on it and reports each type error as a diagnostic with the code typescript, its TS number in the message and file:line as its path. The temporary tsconfig sits in the project's node_modules/.cache, so types and @types resolve as they do for the project, and it's removed afterwards. When node_modules is read-only, it goes in the system's temporary directory instead. It turns incremental off, and for a composite project it turns composite off and keeps declaration on, so the check writes no build info and accepts local imports. Without a resolvable TypeScript it prints one line and exits with 1. typescript becomes an optional peer dependency of @styleframe/cli.

Related issue

None.

Type of change

  • 🐞 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📖 Documentation
  • ♻️ Refactor / internal (no functional change)
  • 🔧 Build / tooling / CI

Checklist

  • My commits follow Conventional Commits with a package scope (e.g. feat(theme): …)
  • I ran pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm test and everything passes
  • I added a changeset (pnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/tests
  • I added or updated tests where relevant
  • I updated documentation where relevant
  • I did not edit generated files (dist/, .styleframe/)
  • My PR targets main and stays focused in scope

Notes / screenshots

This PR targets the integration branch for the agent ergonomics work, on top of the check command, not main. The fixtures with deliberate type errors are .mts files, so the CLI package's own tsc, which includes src/**/*.ts, leaves them alone.

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.
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
styleframe-dev Ready Ready Preview Oct 21, 2026 8:37am UTC
styleframe-dev-storybook Ready Ready Preview Oct 21, 2026 8:37am UTC

Request Review

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.
@alexgrozav
alexgrozav merged commit 4c74470 into styleframe-agent-ergonomics-uxf-406 Oct 21, 2026
3 checks passed
@alexgrozav
alexgrozav deleted the add-inspect-command-uxf-412 branch October 21, 2026 08:40

This branch was successfully deployed

2 active deployments
Preview – styleframe-dev — 53810457 Deployed Oct 21, 2026 by vercel[bot]
Preview – styleframe-dev-storybook — 53810457 Deployed Oct 21, 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.

1 participant