Skip to content

Add shadcn Registry compatibility - #5973

Merged
josephfarina merged 1 commit into
mainfrom
agentcloud/shadcn-registry-experiment
Sep 10, 2026
Merged

josephfarina merged 1 commit into
mainfrom
agentcloud/shadcn-registry-experiment

Conversation

@josephfarina

@josephfarina josephfarina commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • generate a standard shadcn Registry projection from the existing Astryx component and template catalogs
  • keep components package-backed while copying editable showcases, examples, blocks, and pages
  • add secondary per-page install commands, a compatibility guide, and a draft blog post

Architecture

The existing .doc.mjs metadata, sibling composition source, and owning package.json remain the source of truth. The docsite generator emits a static registry index and one JSON item per installable surface. There is no parallel hand-authored catalog.

The normal Astryx component and template documentation remains the human browse experience. Applicable pages show a secondary shadcn command after their primary documentation. Raw machine routes are organized under /shadcn/components, /shadcn/hooks, /shadcn/showcases/<component>, /shadcn/examples/<component>, /shadcn/blocks, and /shadcn/templates. exampleFor is optional. Unowned compositions are standalone blocks, while component-owned records become examples or showcases. IDs derive from stable doc/catalog identity, with optional registry.slug, compatibility aliases, collision checks, and a reviewed route lock.

Component items install the owning Astryx package and write a public re-export. Composition items write editable app code that imports published Astryx package paths. Fourteen compositions with local StyleX declarations are precompiled to compiler-free JSX during generation.

Launch boundary

The compatibility foundation is approved and preview builds emit the full registry from their own /shadcn origin with @canary dependencies. The production latest target stays disabled until copied-composition upgrades and public support ownership are ready. /r remains reserved for a future Astryx-native protocol.

Validation

  • 968 generated items: 216 components, 54 hooks, 160 showcases, 486 component examples, 0 standalone blocks, and 52 pages
  • every prior locked route remains available as a canonical path or alias
  • all items validate against the pinned shadcn 4.19.0 schema
  • real shadcn 4.19.0 install from an arbitrary nested /shadcn/... URL with a full-URL registryDependencies item
  • prior whole-catalog proof installed all 921 entries into a clean Vite app and built 6,620 modules
  • workspace build and full docsite production build
  • CLI typecheck and 3,577 CLI tests
  • docsite typecheck and 495 docsite tests
  • 30 focused registry and authoring contract tests
  • strict lint, repository checks, and knowledge checks

@vercel

vercel Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 10, 2026 5:20am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 3, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Sep 3, 2026
github-actions Bot added a commit that referenced this pull request Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang

cixzhang commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Two cleanup items are behind the current docsite failure:

  • docsite-test detects generated shadcn names/routes that differ from the reviewed route lock. Please preserve prior paths with doc.registry.aliases when a route moved unintentionally; refresh the reviewed lock only for routes this experiment intentionally adds.
  • This draft currently uses spec:AST-018, which is already the palette-authoring specification. Please renumber the shadcn Registry experiment to an unoccupied spec ID and update its references consistently.

I’m treating these as PR comments, not a request-changes review.

@cixzhang

cixzhang commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Correction after checking the current head 070164d2: both items from my previous comment are already addressed here.

  • The shadcn route lock is committed, and docsite-test now passes.
  • The experiment was renumbered from the conflicting AST-018 to spec:AST-026.

The previous comment described the older failing head. No request-changes review was submitted.

github-actions Bot added a commit that referenced this pull request Sep 4, 2026
@astracat-bot

astracat-bot Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
📝 Draft — not reviewed automatically (for maintainers only) Sep 10, 2026, 5:14 AM UTC

Summary:
Generate standard shadcn Registry JSON from the existing Astryx catalogs. Components stay package-backed, compositions stay editable, and stable `/shadcn` routes now have a reviewed alias lock and secondary install actions in the docs.

Test Plan:
- `pnpm build`
- `pnpm -F @astryxdesign/docsite build`
- `pnpm -F @astryxdesign/docsite typecheck`
- `pnpm -F @astryxdesign/docsite test`
- `pnpm -F @astryxdesign/cli exec tsc --project tsconfig.api-dts.json`
- `pnpm exec vitest run packages/cli`
- `pnpm exec vitest run internal/shadcn-registry/generate-shadcn-registry.test.mjs packages/cli/authoring/doctypes/template/parse.test.mjs`
- `pnpm lint:strict`
- `pnpm check:repo`
@josephfarina
josephfarina force-pushed the agentcloud/shadcn-registry-experiment branch from 070164d to 1d5f28f Compare September 10, 2026 05:14
@josephfarina josephfarina changed the title Experimental shadcn Registry compatibility Add shadcn Registry compatibility Sep 10, 2026
@josephfarina
josephfarina marked this pull request as ready for review September 10, 2026 05:15
github-actions Bot added a commit that referenced this pull request Sep 10, 2026
@josephfarina
josephfarina merged commit fdb0149 into main Sep 10, 2026
31 checks passed
@github-actions
github-actions Bot deleted the agentcloud/shadcn-registry-experiment branch September 10, 2026 06:23
sangwook-dev added a commit to sangwook-dev/astryx that referenced this pull request Sep 10, 2026
The shadcn registry (meta#5973) landed against the hoisted layout and reads two
things from the workspace root that only a hoisted node_modules puts there.

- apps/docsite's generate-data.mjs requires `recharts/package.json` to pin the
  registry's external dependency specs. docsite declares the other three of
  that list; recharts was missing, so `pnpm generate` failed and 14 docsite
  test files could not load.
- generate-shadcn-registry.test.mjs spawned `node_modules/.bin/shadcn` from the
  repo root. shadcn is a docsite dependency, so its bin lives beside that
  package. The test now walks up from apps/docsite to find it.
sangwook-dev added a commit to sangwook-dev/astryx that referenced this pull request Sep 11, 2026
The shadcn registry (meta#5973) landed against the hoisted layout and reads two
things from the workspace root that only a hoisted node_modules puts there.

- apps/docsite's generate-data.mjs requires `recharts/package.json` to pin the
  registry's external dependency specs. docsite declares the other three of
  that list; recharts was missing, so `pnpm generate` failed and 14 docsite
  test files could not load.
- generate-shadcn-registry.test.mjs spawned `node_modules/.bin/shadcn` from the
  repo root. shadcn is a docsite dependency, so its bin lives beside that
  package. The test now walks up from apps/docsite to find it.
sangwook-dev added a commit to sangwook-dev/astryx that referenced this pull request Sep 11, 2026
The shadcn registry (meta#5973, meta#6228, meta#6231) landed against the hoisted layout and
reaches for three things the workspace root only carries when hoisted.

- apps/docsite's generate-data.mjs requires `recharts/package.json` to pin the
  registry's external dependency specs. docsite declares the other three of
  that list; recharts was missing, so `pnpm generate` failed and 14 docsite
  test files could not load.
- generate-shadcn-registry.mjs named `@babel/preset-typescript` as a string.
  Babel resolves a string preset from `cwd`, and the registry-contract job runs
  the script from the repo root. It is now imported, the way the StyleX plugin
  beside it already was, so it resolves through docsite's own node_modules.
- generate-shadcn-registry.test.mjs spawned `node_modules/.bin/shadcn` from the
  repo root, at four call sites. shadcn is a docsite dependency, so its bin
  lives beside that package. The test now walks up from apps/docsite to find it.
sangwook-dev added a commit to sangwook-dev/astryx that referenced this pull request Sep 13, 2026
The shadcn registry (meta#5973, meta#6228, meta#6231) landed against the hoisted layout and
reaches for three things the workspace root only carries when hoisted.

- apps/docsite's generate-data.mjs requires `recharts/package.json` to pin the
  registry's external dependency specs. docsite declares the other three of
  that list; recharts was missing, so `pnpm generate` failed and 14 docsite
  test files could not load.
- generate-shadcn-registry.mjs named `@babel/preset-typescript` as a string.
  Babel resolves a string preset from `cwd`, and the registry-contract job runs
  the script from the repo root. It is now imported, the way the StyleX plugin
  beside it already was, so it resolves through docsite's own node_modules.
- generate-shadcn-registry.test.mjs spawned `node_modules/.bin/shadcn` from the
  repo root, at four call sites. shadcn is a docsite dependency, so its bin
  lives beside that package. The test now walks up from apps/docsite to find it.
cixzhang pushed a commit that referenced this pull request Sep 14, 2026
…rts (#5327)

* chore(deps): make node_modules strict, declare what each package imports

Drops `nodeLinker: hoisted` and `shamefullyHoist: true`, both inherited
verbatim from the pre-pnpm-11 .npmrc (#3700). nodeLinker was annotated there
as pnpm's default, which it is not -- the default is `isolated` -- and pairing
it with shamefullyHoist is pnpm/pnpm#6620. shamefullyHoist is
`publicHoistPattern: '*'`, which let eleven packages import modules they never
declared; all eleven are now declared, at the versions the workspace already
resolved. The Babel toolchain and Testing Library move into the catalog, each
having been duplicated across 4-6 packages.

Consolidating them surfaced an incoherent Babel pin: Dependabot had raised
`@babel/cli` (#4067) and `@babel/preset-react` (#3839) to 8.x on their own
while `@babel/core` and `@babel/preset-typescript` stayed on 7.x, and the 8.x
releases peer on `@babel/core: ^8.0.0` -- a set no single core version can
satisfy. All four now sit on ^7.29.7, matching the core that actually runs;
`pnpm peers check` drops from 4 unmet peers to 2 unrelated ones. Moving to
Babel 8 is a migration of its own.

Also fixes a latent `astryx doctor` bug the linker change exposed:
checkPeerDeps resolved peers with `require.resolve(name, {paths: [cwd]})`, but
Node folds NODE_PATH in regardless, so a peer merely reachable from the ambient
environment read as installed and doctor stayed silent about a missing one. It
now walks the project's own node_modules and reads package.json off disk, so
every peer gets range-checked. The existing test caught this unmodified.

One test read a bin the same way. public-artifact-cli.test.mjs spawns tsx by
absolute path out of the repo root's node_modules/.bin, which only ever held
one because shamefullyHoist published every bin there; tsx is declared by
internal/vibe-tests, so it now spawns that package's own bin. Scripts were
never at risk -- pnpm puts both bin directories on PATH -- and the repo's only
other hardcoded root bin, tsc in cli-api-types-verify.mjs, resolves because
typescript is a root devDependency.

Verified on a recreated node_modules: build, test, storybook:build, docsite and
sandbox builds, check:repo, verify-exports, eslint, and every typecheck CI gates
all pass. The local test failures that remain reproduce on main from a clean
worktree -- BSD `cp` has no `--reflink`, and two story titles predate the story
tree's shape rule -- and CI reported none of them.

* chore(changeset): patch @astryxdesign/cli for the doctor peer-resolution fix

The linker change also alters published behavior in `astryx doctor`, so the
fix needs a changeset to reach users in the next release.

* fix(cli): resolve packages through the project's own node_modules chain

Dropping the hoisted layout removes the flat root copy that three
resolutions quietly relied on. Each landed on main after this branch's
previous rebase, so CI met them for the first time here.

- packages/core used @heroicons/react in its Button accessibility
  fixtures without declaring it (#6131). Storybook's typecheck and the
  Button a11y suite could not resolve it.
- build.packed-old-core.test.mjs staged the packed CLI's runtime
  dependencies from the repo root, where only a hoisted node_modules puts
  a package's own dependencies (#5543).
- core-interception's CommonJS probe reached a core through NODE_PATH,
  which is where pnpm's isolated layout exposes every package and where
  Vitest points it. Wrapping that core fails on a require(esm) namespace,
  and the coverage gap it then reported rejected every theme whose
  lineage was unobserved (#5543).

doctor's findInstalledPackage moves to foundation/fs/paths.mjs and is now
the single chain walk all three share. It answers only from the caller's
own node_modules, never from the ambient environment.

* fix(deps): declare what the shadcn registry work reaches for

The shadcn registry (#5973, #6228, #6231) landed against the hoisted layout and
reaches for three things the workspace root only carries when hoisted.

- apps/docsite's generate-data.mjs requires `recharts/package.json` to pin the
  registry's external dependency specs. docsite declares the other three of
  that list; recharts was missing, so `pnpm generate` failed and 14 docsite
  test files could not load.
- generate-shadcn-registry.mjs named `@babel/preset-typescript` as a string.
  Babel resolves a string preset from `cwd`, and the registry-contract job runs
  the script from the repo root. It is now imported, the way the StyleX plugin
  beside it already was, so it resolves through docsite's own node_modules.
- generate-shadcn-registry.test.mjs spawned `node_modules/.bin/shadcn` from the
  repo root, at four call sites. shadcn is a docsite dependency, so its bin
  lives beside that package. The test now walks up from apps/docsite to find it.

* fix(cli): resolve a package through Yarn PnP when there is no chain to walk

Addresses the review on #5327. `findInstalledPackage` walked the node_modules
chain and stopped there, so a Yarn Plug'n'Play project — which has no
node_modules at all — read as missing every Core peer.

It now asks the PnP runtime when the walk comes up empty. PnP resolves from the
project's own dependency graph and ignores NODE_PATH, so the lookup stays
project-local, which is the property the filesystem walk was introduced for.

Verified against a real Yarn 4 PnP project with @astryxdesign/core installed:
declared packages resolve and their versions read off disk, an undeclared one
is still reported missing, and poisoning NODE_PATH changes nothing. That is
strictly better than the previous `require.resolve`, which could confirm a peer
was present under PnP but never read its version, because Core does not export
`./package.json`.

Covers both layouts in paths.test.mjs, including a case pinning that a package
reachable only from NODE_PATH is not accepted.

* fix(deps): cover the shadcn variant work added since the branch base

#6246 landed against the hoisted layout after this branch was last rebased,
and reaches for two things the workspace root only carries when hoisted.

- packages/cli/authoring/shadcn/source-variants.mjs imports `@babel/core`.
  cli declares the runtime package but not its types, so `sync:api-types`
  failed with TS7016 on two lines and took `pnpm build` down with it.
  `@types/babel__core` is now declared beside it, as packages/core already
  does for the same import.
- generate-shadcn-registry.test.mjs gained a fifth call site spawning
  `node_modules/.bin/shadcn` from the repo root. The other four already go
  through shadcnBin(), which walks up from apps/docsite — the package that
  declares shadcn, and so the only place its bin lives. The new one now does
  too, and the suite is back to 24 passing.

* fix(docsite): resolve playground and shadcn dependencies through Node

Two places computed a path into the repo root instead of resolving a package,
which only works when node_modules is hoisted. Node already walks up from the
module doing the asking, so both now let it.

- generate-playground-types.mjs read @heroicons/react and recharts off the
  root. Both degraded in silence — the heroicon loop `continue`d and the
  Recharts builder returned {} — so the playground shipped without the types
  rather than failing. Recharts arrived with #6264 and is covered by
  playground-scope.test.ts, which is how it surfaced; the heroicon path has
  been there since #2535 and nothing asserts on it, so it was quietly
  producing zero variants. Resolving now throws if either is missing.
- generate-shadcn-registry.test.mjs spawned node_modules/.bin/shadcn. shadcn
  does not export ./package.json, but its bin *is* its entry, so resolving
  `shadcn` from apps/docsite and running it through process.execPath needs no
  path assumption and no NODE_PATH.

Net -8 lines in the generator. findInstalledPackage is unchanged: it reads a
consumer project, where there is no module of ours to resolve from and
NODE_PATH must not count as installed.

This branch was successfully deployed

1 active deployment
Preview — 1d5f28f9 Deployed Sep 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants