add
Install components from the registry. Source files copied directly into your project, with no runtime dependency.
Usage
npx @gentleduck/cli add [components...]
npx @gentleduck/cli add [components...]
Components are copied as source files into your project. You own the code afterward: patch, restyle, extend without forking.
Options
| Flag | Description |
|---|---|
-y, --yes | Skip confirmation prompts |
-f, --force | Overwrite existing files |
-c, --cwd <cwd> | Working directory |
-w, --workspace <path> | Target workspace |
-a, --all | Install all components |
Examples
# Add specific components
npx @gentleduck/cli add button dialog calendar
# Add all components
npx @gentleduck/cli add --all
# Add to a specific workspace
npx @gentleduck/cli add sidebar --workspace apps/dashboard
# Force overwrite of an existing copy
npx @gentleduck/cli add button --force
How it works
- Resolves the component from the configured registry (
https://gentleduck.org/rby default; override withCOMPONENTS_REGISTRY_URL). - Walks dependency graph: installs registry-level dependencies (e.g.
dialogpulls inbutton). - Installs npm dependencies: runs
bun add/npm installfor any external packages declared by the component. - Writes files to the configured aliases (
<alias>/ui,<alias>/hooks,<alias>/libs, ... - seeinit). - Imports stylesheets: when a component ships a
.cssfile (liketypeset), the CLI adds an@importfor it to yourtailwind.cssfile, after the Tailwind import. Runningaddagain never duplicates it.
If a target file already exists, the CLI asks before overwriting unless --force or --yes is set.
Only gentleduck.org is trusted by default. An https registry outside that host is refused unless you opt in with COMPONENTS_ALLOW_REGISTRY=<host>; overriding via COMPONENTS_REGISTRY_URL implicitly trusts that host too (with a one-time warning), but plain http is still refused except for a localhost override.