docs(www): add cli command to docs

This commit is contained in:
shadcn
2025-08-13 18:15:40 +04:00
parent cc564974c6
commit fd44aead8e
2 changed files with 77 additions and 1 deletions

View File

@@ -46,7 +46,10 @@ export function DocsSidebar({
isActive={item.url === pathname}
className="data-[active=true]:bg-accent data-[active=true]:border-accent 3xl:fixed:w-full 3xl:fixed:max-w-48 relative h-[30px] w-fit overflow-visible border border-transparent text-[0.8rem] font-medium after:absolute after:inset-x-0 after:-inset-y-1 after:z-0 after:rounded-md"
>
<Link href={item.url}>{item.name}</Link>
<Link href={item.url}>
<span className="absolute inset-0 flex w-(--sidebar-width) bg-transparent" />
{item.name}
</Link>
</SidebarMenuButton>
</SidebarMenuItem>
)

View File

@@ -21,6 +21,7 @@ Namespaced registries let you configure multiple resource sources in one project
- [Versioning](#versioning)
- [Dependency Resolution](#dependency-resolution)
- [Built-in Registries](#built-in-registries)
- [CLI Commands](#cli-commands)
- [Error Handling](#error-handling)
- [Creating Your Own Registry](#creating-your-own-registry)
- [Example Configurations](#example-configurations)
@@ -741,6 +742,78 @@ Implement semantic versioning with range support:
5. **Implement version discovery** endpoints (e.g., `/versions/{name}`)
6. **Cache versioned resources** appropriately with proper cache headers
## CLI Commands
The shadcn CLI provides several commands for working with namespaced registries:
### Adding Resources
Install resources from any configured registry:
```bash
# Install from a specific registry
npx shadcn@beta add @v0/dashboard
# Install multiple resources
npx shadcn@beta add @acme/button @lib/utils @ai/prompt
# Install from URL directly
npx shadcn@beta add https://registry.example.com/button.json
# Install from local file
npx shadcn@beta add ./local-registry/button.json
```
### Viewing Resources
Inspect registry items before installation:
```bash
# View a resource from a registry
npx shadcn@beta view @acme/button
# View multiple resources
npx shadcn@beta view @v0/dashboard @shadcn/card
# View from URL
npx shadcn@beta view https://registry.example.com/button.json
```
The `view` command displays:
- Resource metadata (name, type, description)
- Dependencies and registry dependencies
- File contents that will be installed
- CSS variables and Tailwind configuration
- Required environment variables
### Searching Registries
Search for available resources in registries:
```bash
# Search a specific registry
npx shadcn@beta search @v0
# Search with query
npx shadcn@beta search @acme --query "auth"
# Search multiple registries
npx shadcn@beta search @v0 @acme @lib
# Limit results
npx shadcn@beta search @v0 --limit 10 --offset 20
# List all items (alias for search)
npx shadcn@beta list @acme
```
Search results include:
- Resource name and type
- Description
- Registry source
## Error Handling
### Registry Not Configured