feat(registry): let components declare a description - #71
Conversation
Every published registry item carried a placeholder description, because
build-registry-index.ts falls back to `A ${type} component.` and there was
nowhere to declare anything else. 158 items shared four description strings.
The shadcn CLI ranks search across descriptions as well as titles, so this made
the registry reachable only by exact component name, which is the hardest thing
to guess for visual effects.
Read `description` from the sidecar .json next to each component, the same file
that already carries cssVars and additionalDependencies, following the existing
pattern in generateRegistryItem. The fallback is untouched, so anything without
a description behaves as before.
Adds a description for all 45 components under src/fancy/components, written
from each component's source and its demo. The 99 demo entries keep the
placeholder.
|
@oliver-mee is attempting to deploy a commit to the Fancy Components Team on Vercel. A member of the Team first needs to authorize it. |
|
One thing worth flagging that came out of writing these.
So those two items get identical descriptions in this PR, which otherwise looks like a copy-paste slip on my side. I described what the code does rather than what the filename suggests, since a "carousel" description would send people to a marquee. I left it there rather than fixing it here, since deduplicating a registry item is a separate change and would break anyone who has already installed For what it is worth, |
Summary
Every registry item was published with a placeholder description.
public/r/registry.jsonhad 158 items sharing four distinct strings, becausegenerateRegistryItemhad nowhere to read a description from and the build falls back toA ${type} component.Since the shadcn CLI ranks search across descriptions as well as titles, that made the registry reachable only by exact component name, which is the hardest thing to guess for visual effects.
This reads
descriptionfrom the sidecar.jsonnext to each component, the file that already carriescssVarsandadditionalDependencies, following the existing pattern ingenerateRegistryItem. Two lines of wiring:description: z.string().optional()onregistrySchema...(additionalConfig?.description && { description: additionalConfig.description })The existing fallback is untouched, so anything without a description behaves exactly as before.
Also adds a description for all 45 components under
src/fancy/components. Each was written by reading that component's source and its demo, not its filename, and each names the distinguishing behaviour so search can separate neighbours (the four letter-swap variants, for example).The 99 demo entries keep the placeholder. They could inherit from their parent component, but that felt like a separate change and I did not want to bundle it.
Linked issue
Fixes #70
Type of change
How to test
npm run build:registrycat public/r/registry.json | jq '[.items[].description] | unique | length'goes from 4 to 47.public/and point the CLI at it, then search by behaviour rather than by name:Before this change all three queries return nothing useful.
Checklist
CONTRIBUTING asks for a recording. I have not attached one, since nothing here is visual: no component or demo changes, only registry metadata. The CLI output above is the equivalent evidence. Happy to record something if you would still like it.
Two notes on scope. I deliberately did not run
prettier --writeacross the two source files: the committed versions do not currently passformat:check, so formatting them would have buried a four line change in a few hundred lines of reflow. The only formatting that moved is in two physics sidecars, which gained a trailing newline and 2 space indentation to match the other sidecars.Model used
Claude Opus 5 via Claude Code for the wiring and review. The component descriptions were drafted by Claude Sonnet 5 reading each component's source, then reviewed against the source before committing.
🤖 Generated with Claude Code (Claude Opus 5)
🧑💻 Ideated, directed and reviewed by a human, @oliver-mee