Add a shadcn/ui component correctly — fetch canonical source, fix imports, resolve dependencies
The user wants to add a shadcn/ui component. Follow these steps exactly.
components.json — confirm "style": "new-york". If it says "base-nova", STOP and run /shadcn-init first.src/components/ui/{component}.tsx. If it does, read it and check if it imports from @base-ui/react. If so, it needs replacing.Use the mcp__Shadcn_UI__get_component tool to fetch the component:
get_component({ componentName: "<component-name>" })
Read the returned source carefully. Note any imports from @/registry/... paths — these need fixing.
Before writing anything, check what the fetched component imports:
use-mobile) — check if src/hooks/ has themclass-variance-authority, lucide-react) — check package.jsonFetch and prepare ALL missing dependencies first. Do not write partial sets.
Replace all registry paths in the fetched code:
@/registry/new-york-v4/ui/... → @/components/ui/...@/registry/new-york-v4/hooks/... → @/hooks/...@/registry/new-york-v4/lib/... → @/lib/...Write all files (the component + any new dependencies) in parallel.
grep -r "@base-ui/react" src/components/ui/{component}.tsx — must return nothinggrep -r "@/registry" src/components/ui/{component}.tsx — must return nothingnpm run build — zero errorsReport the result to the user.