Skip to content

feat!: transform source maps, agent CLI, DTCG tokens - #426

Merged
codecaaron merged 3 commits into
mainfrom
feat/leverage-batch-1
Nov 28, 2026
Merged

codecaaron merged 3 commits into
mainfrom
feat/leverage-batch-1

Conversation

@codecaaron

Copy link
Copy Markdown
Owner

Three additions, one commit each.

Source maps for transformed modules; Rolldown hook filters

  • The extractor used to build a source map for every module and discard it, and every host returned map: null, so breakpoints and stack traces below a rewritten builder chain pointed at the wrong lines. Every edit now goes through one tracked emission, and the engine returns a map that matches the final text. It is built only when the host asks for one.
  • The map flows through the Vite plugin, the Next webpack and Turbopack loaders and the unplugin adapters, composed with any incoming map.
  • Emitted code is byte-identical: verify:parity passes against untouched baselines.
  • resolveId, load and transform in the Vite plugin, layergate's Vite adapter and the unplugin adapters are object hooks with filters. On a production build of e2e/vite-app, load handler calls drop from 51 to 2; transform and resolveId barely move in that small app.
  • One kept test, packages/_integration/__tests__/source-map.test.ts, pins that a statement after a rewritten chain maps back to its original line.

Limits: through unplugin, Rollup and Rolldown always build a map (the host gives no signal at transform time), and webpack and rspack only receive the map when an upstream loader supplied one.

animus describe, animus check, animus mcp

  • describe prints the project's system and components as one JSON document: token scales with values, CSS variables and per-mode values; prop groups; selector and condition aliases; components with variants, states and inherited props.
  • check <file...> analyses the named files without a build, or unsaved source through --stdin-filepath, and reports skipped properties, dynamic props, token misses and diagnostics with the CSS each component would emit. It exits 1 on an error-level finding.
  • mcp serves both over stdio as Model Context Protocol tools (describe_system, list_components, check_source) and keeps the project loaded between calls. It implements the protocol directly, without the SDK, and speaks the 2026-07-28 revision and the earlier initialize-based ones.
  • Kept: a type fixture for the output types, and an assertion in e2e/rollup-app that describe lists the fixture's components and tokens and check reports a known token miss with its code.

DTCG 2025.10 import and export

  • @animus-ui/core/dtcg adds fromDTCG(document), which returns a theme builder with token paths inferred from the document, and toDTCG(theme). A consumer who never imports the subpath pays nothing.
  • One Resolver modifier maps to color modes. Shadows, borders and transitions become scalar scales; typography becomes a declaration scale.
  • Gradients, dash-array stroke styles and $extends are rejected with the token path.
  • Kept: a type fixture for the inference, and one test pinning that a document round-trips for every supported type and an unrepresentable token fails with its path.

Release notes

  • Transforms return real source maps where they returned map: null.
  • ExtractEngine.transformFile(path, sourceMapSource?); its result gains map when a source name is passed. EngineApi.transformFile takes a fourth argument and TransformFileResult gains map.
  • @animus-ui/next-plugin: transformWithManifest returns { code, map }.
  • @animus-ui/unplugin: transformWithEngine returns code with a map.
  • @animus-ui/layergate: the Vite plugin's resolveId, load and transform are { filter, handler } objects.
  • New: animus describe, animus check, animus mcp; @animus-ui/core/dtcg.

Verification

  • vp run verify:full passes at e9d59fa8: 54 of 54 tasks.
  • verify:bench against release 0.2.0 passed all four rows on the source-map change (ratios 0.999 to 1.019).

🤖 Generated with Claude Code

codecaaron and others added 3 commits November 28, 2026 02:17
Every edit to a module now goes through one tracked emission, so the engine can return a source map that matches the final text. The map is built only when the host asks for one and flows through the Vite plugin, both Next loaders and the unplugin adapters, composed with any incoming map. Emitted code is byte-identical: the parity baselines are untouched.

resolveId, load and transform in the Vite plugin, layergate's Vite adapter and the unplugin adapters are object hooks with filters derived from the same patterns the handlers test.

Breaking: ExtractEngine.transformFile takes an optional source name and its result gains map; next-plugin transformWithManifest and unplugin transformWithEngine return code with a map; the layergate Vite plugin's hooks are {filter, handler} objects.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
describe prints the project's system and components as one JSON document. check analyses named files, or unsaved source on stdin, without a build and reports skipped properties, token misses and diagnostics with the CSS each component would emit. mcp serves both over stdio as Model Context Protocol tools, keeping the project loaded between calls; it speaks the 2026-07-28 revision and the earlier initialize-based ones without the SDK.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@animus-ui/core/dtcg adds fromDTCG, which builds a theme from a token or resolver document with token paths inferred from the document, and toDTCG, which writes a built theme back out. One resolver modifier maps to color modes. Gradients, dash-array stroke styles and $extends are rejected with the token path. The packed proof loads the new entry.

Verified at this commit: vp run verify:full (54 of 54 tasks); verify:bench passed all four rows on the source-map change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@codecaaron
codecaaron merged commit 2a63f39 into main Nov 28, 2026
16 checks passed
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