Public: anyone can read this; the crew can change it.

A global component registry (shadcn registry format): every app installs owned copies, updates arrive as pulls, a gallery with usage, MCP install; the app template rebuilt on it #16959

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

The forge now serves a small component registry in shadcn's format. /r/registry.json lists the items and /r/ .json returns one with its source whole. I did not run bunx shadcn add against it.

Notes

opened this

The forge now serves a small component registry in shadcn's format. /r/registry.json lists the items and /r/<name>.json returns one with its source whole. I did not run bunx shadcn add against it.

Run here: bun test test/registry.test.ts, test/own-source.test.ts, test/feature-orphans.test.ts, test/guide.test.ts and test/mcp-size.test.ts, and bun x tsc --noEmit, all passing. The gate's 32 rules read clean. bun test test/registry.test.ts (it covers the items, the 404 on an unknown or hostile name, and that the button escapes its text). The gate left some checks to the forge: tests that bind a port, and the rest of the suite.

Items. There are three:

  • tokens: the forge's colours and radius as CSS variables, light and dark.
  • button: a button or link-button with escaped text.
  • empty-state: a block that says what the page is and the one thing to do first.

I wrote the button and empty-state as small zero-dependency TS plus CSS, so they work in a template app without React.

Wiring. The route is /r/:name.json, public, with a 5-minute cache, access-control-allow-origin: * and a 404 for anything unknown. The code is in src/registry/items.ts and src/registry/serve.ts, with a route mark and the regenerated src/generated/marks.ts. The how-to is docs/features/component-registry.md. The commit carries No door: for the terminal side: it is a JSON endpoint the shadcn CLI reads, and curl reaches it from a terminal.

Left out (the issue stays open):

  • Private items behind sign-in.
  • Recording which app has which item at which version, and the diff against upstream.
  • Update pulls.
  • The gallery and the "used by N apps" count.
  • The registry_search and registry_install MCP tools, and the drift lint.
  • Rebuilding the app template on the registry.
  • The steward's widgets-in-chat phases.

Try it. Open <preview>/r/registry.json and <preview>/r/button.json, then in a test app run bunx shadcn add <preview>/r/button.json.

Review. The change is a JSON endpoint with no page, so there is no review block.

Closes #6009

8 earlier comments · 1 event
commented

The forge now serves a small component registry in shadcn's format. /r/registry.json lists the items and /r/<name>.json returns one with its source whole. I did not run bunx shadcn add against it.

Run here: bun test test/registry.test.ts, test/own-source.test.ts, test/feature-orphans.test.ts, test/guide.test.ts and test/mcp-size.test.ts, and bun x tsc --noEmit, all passing. The gate's 32 rules read clean. bun test test/registry.test.ts (it covers the items, the 404 on an unknown or hostile name, and that the button escapes its text). The gate left some checks to the forge: tests that bind a port, and the rest of the suite.

Items. There are three:

  • tokens: the forge's colours and radius as CSS variables, light and dark.
  • button: a button or link-button with escaped text.
  • empty-state: a block that says what the page is and the one thing to do first.

I wrote the button and empty-state as small zero-dependency TS plus CSS, so they work in a template app without React.

Wiring. The route is /r/:name.json, public, with a 5-minute cache, access-control-allow-origin: * and a 404 for anything unknown. The code is in src/registry/items.ts and src/registry/serve.ts, with a route mark and the regenerated src/generated/marks.ts. The how-to is docs/features/component-registry.md. The commit carries No door: for the terminal side: it is a JSON endpoint the shadcn CLI reads, and curl reaches it from a terminal.

Left out (the issue stays open):

  • Private items behind sign-in.
  • Recording which app has which item at which version, and the diff against upstream.
  • Update pulls.
  • The gallery and the "used by N apps" count.
  • The registry_search and registry_install MCP tools, and the drift lint.
  • Rebuilding the app template on the registry.
  • The steward's widgets-in-chat phases.

Try it. Open <preview>/r/registry.json and <preview>/r/button.json, then in a test app run bunx shadcn add <preview>/r/button.json.

Review. The change is a JSON endpoint with no page, so there is no review block.

commented

The forge now serves a component registry at /r/<name>.json in shadcn's format, with tokens, button and empty-state as the first items.

The failing check came from src/registry/items.ts naming https://ui.shadcn.com/schema/... as the registry's schema URIs. The egress test counted that as an outside host the app calls. It isn't one. The shadcn CLI reads those URIs and the forge never requests them, so I added ui.shadcn.com to the test's NOT_CALLED list with that reason instead of adding it to forge.json egress.

test/egress-literals.test.ts passes (3 tests) and bun x tsc --noEmit is clean. I did not run the rest of the suite or bun scripts/gate.ts. The forge runs the full check on this push.

To try it, fetch /r/button.json or /r/registry.json from the preview and confirm the item carries its source and the shadcn $schema URL.

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

Two of the seven failures were caused by this pull and are fixed in dee1eb36a; I did not re-run the other five. The tests I re-ran pass except one, noted below. I did not read the final output of bun x tsc --noEmit or gate.ts --fix, so I can't say whether they came back clean.

  • OpenAPI coverage: GET /r/{name}.json had no OpenAPI row, and the not-yet-described list may only shrink. I added the row in src/contract/openapi/routes/getRNameJson.ts and regenerated routes/index.ts.
  • Reserved names: r is now a top-level path and could have collided with a profile name, so I added it to SYSTEM_NAMES in src/core/reserved.ts.
  • One test still fails locally: "NOT_YET_DESCRIBED is sorted, names served routes…" lists three /forges/... routes as not served. They aren't from this pull. That test was not among the seven the check reported, so I left it.
  • Not touched: the three lane tests and the "cold home" test did not look related to this pull. The "infra says it plainly" test is red on main too, per the check log.

The pull description is unchanged: /r/<name>.json serves tokens, button and empty-state in shadcn's registry format, for bunx shadcn add <origin>/r/<name>.json.

commented

I merged main into the branch and pushed it (0b711f4b1). The branch should merge cleanly again.

The only conflict was the generated file src/generated/marks.ts. I took main's version and regenerated it with bun scripts/own-source.ts, which reported it current. src/core/reserved.ts and src/http/server.ts merged without conflicts.

bun x tsc --noEmit printed nothing. The own-source, OpenAPI route/coverage and reserved-names tests pass (557 pass, 0 fail). I did not run the full suite; the forge's check does that on this push.

The pull itself is unchanged. /r/<name>.json serves tokens, button and empty-state in shadcn's registry format, with an OpenAPI row for the route and r reserved as a name.

commented

This adds the missing OpenAPI tag, and the tag test that failed three times now passes.

GET /r/{name}.json produced a tag r that had no description. I added one to TAG_WORDS in src/contract/tags.ts.

I ran the tag, registry, egress, route-marks and unused-exports tests, and they pass. bun x tsc --noEmit printed no errors, and gate.ts --explain and --fix showed no failures.

  • test/hollow.test.ts: it timed out at 60 s in this sandbox, so I couldn't confirm it. The forge's check will run it.
  • Wider test selection: scripts/fast.ts said the change reaches too much to name, so I ran only the named files.
  • Both doors: this changes only a tag description in the API contract, with no page or action change. The commit says No door: …, and it names the issue as (#6009).

What I left out: private items, per-app version tracking, update pulls, the gallery and MCP install. The how-to doc already lists these as not yet built.

To try it: curl $FORGE_URL/contract/openapi.json?tag=r returns a slice for the registry tag. /r/registry.json lists the items.

commented

I merged main into this branch and pushed it. The only conflict was in src/generated/marks.ts.

  • Conflict: I took main's side and regenerated the file with bun scripts/own-source.ts. It's a generated file, so regenerating keeps what both sides added. No conflict markers remain.
  • Checks run: bun x tsc --noEmit is clean. bun scripts/gate.ts --fix changed nothing. test/own-source.test.ts, test/tags.test.ts, test/contract.test.ts and test/contract-openapi-tags.test.ts pass.
  • Not run: the full suite. The forge runs the whole check on this push.

The registry tag in the OpenAPI document is unchanged by the merge.

commented

Still red on current main: refusals carry a hint > every OpenAPI route, called badly, answers a hint on 401/403/404/409/422. Fix it and push.

commented

The forge now serves a shadcn-style component registry at /r/<name>.json, offering tokens, button and empty-state. /r/registry.json is the index. This push fixes two of the four failing tests; the other two I did not fix.

What the fix changed

  • An unknown name on /r/<name>.json now answers 404 with a hint pointing at /r/registry.json (src/registry/serve.ts). The "refusals carry a hint" test required it.
  • test/openapi-drift.test.ts now lists GET /r/{}.json as routed outside /api/v1, with the reason. The route is documented in OpenAPI but registered in src/http/server.ts, so the drift test saw it as described but not routed.

Tests

  • test/api-hints.test.ts, test/openapi-drift.test.ts, test/registry.test.ts and test/fork-follow-history.test.ts pass locally, and bun x tsc --noEmit and the gate are clean.
  • The follow-history test failed in the forge check but passes here and on main, so I took it for ordering-dependent and made no change for it.
  • I did not look at the fourth failure ("a cold home answers from the picture, within a few passes over the runs"). It's a timing test on production's size. This branch touches nothing near it, and the log doesn't show it failing on main.

I did not touch forge.json egress.

🤖 Generated with Claude Code

commented

Everything sentinel asked for is done except running bunx shadcn add. Changes are on the same branch and pushed.

Changed

  • Dependencies as URLs. src/registry/items.ts and serve.ts now serve registryDependencies as absolute URLs built from the request origin, for example <origin>/r/tokens.json. The same goes for the entries in /r/registry.json. ITEMS still holds bare names. The old "dependencies name items that exist" test is replaced. The new one checks that each served dependency is a same-origin /r/<name>.json URL that resolves to a real item. It also checks the index entries.
  • Reserved r. A new test asserts that reservedName(db, "r") returns "system". I could not check whether an account or repository named r already exists, because I can't read the forge's data from here. A person with access should look before this merges.
  • Check rules. The pull still names its issue with (#6009). It adds no new exports, so the dead-code rule isn't touched. The new tests build real inputs, with no as never. It adds no new during jobs.

Not done: bunx shadcn add against the preview

  • shadcn started and loaded the config, but then fetched https://ui.shadcn.com/r/colors/slate.json. The sandbox refuses that host, so it never reached the item.
  • Even with network access, the preview is private and shadcn can't send an authorization header. So the end-to-end install still needs to be run once from a machine with network access, against production or a public preview.

Follow-ups Each is linked as a dependency of #6009, which stays open:

  • #17038: per-app ownership records.
  • #17039: updates arrive as pulls (waits for #17038).
  • #17040: a gallery with usage, with its src/tui side and docs (waits for #17038).
  • #17041: MCP registry_search and registry_install, plus a src/tui listing.
  • #17042: the app template rebuilt on the registry (waits for #17038 and #17039).

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs