# Command Line Interface

Use the CLI to initialize, add, update, and remove components with ease.

## init

Use the `init` command to initialize project configuration, the `starwind.config.json` file, and install dependencies.

```bash
npx starwind@latest init
```

You'll be asked a few questions to configure your project.

```bash
┌   Welcome to the Starwind CLI 
│
◇  What is your components directory?
│  src/components
│
◇  Where would you like to add the Tailwind .css file?
│  src/styles/starwind.css
│
◇  What Tailwind base color would you like to use?
│  Neutral (default)
│
◇  Select your preferred package manager
│  pnpm
│
◇  Install tailwindcss@^4, @tailwindcss/vite@^4, @tailwindcss/forms@^0.5, tw-animate-css@^1, tailwind-variants@^3, tailwind-merge@^3, @tabler/icons@^3 using pnpm?
│  Yes
│
◇  Packages installed successfully
│
◇  Created project structure
│
◇  Astro config setup completed
│
◇  TypeScript path aliases configured
│
◇  Created Tailwind configuration
│
◇  CSS import added to layout
│
◇  Updated project starwind configuration
│
◇  Next steps ─────────────────────────────────────────────────────╮
│                                                                  │
│  Make sure your layout imports the src/styles/starwind.css file  │
│                                                                  │
├──────────────────────────────────────────────────────────────────╯
│
└  Enjoy using Starwind UI 🚀
```

### init options

```bash
Usage: starwind init [options]

Initialize your project with Starwind

Options:
  -d, --defaults  Use default values for all prompts
  -p, --pro       Initialize with Starwind Pro setup
  -h, --help      display help for command
```

## add

Use the `add` command to add components to your project. 

```bash
npx starwind@latest add [components]
```

If you don't specify any components, you will get a list of all available components to choose from.

```bash
┌   Welcome to the Starwind CLI 
│
◆  Select components to add
│  ◻ accordion
│  ◻ alert
│  ◻ badge
│  ◻ button
│  ◻ card
│  ◻ checkbox
│  ◻ dialog
│  ◻ input
│  ◻ label
│  ◻ select
│  ...
└
```

### add options

```bash
Usage: starwind add [options] [components...]

Add Starwind components to your project

Arguments:
  components                  The components to add (space separated)

Options:
  -a, --all                   Add all available components
  -y, --yes                   Skip confirmation prompts
  -m, --package-manager <pm>  Package manager to use (choices: "npm", "pnpm", "yarn")
  -h, --help                  display help for command
```

## update

Use the `update` command to update components in your project.

> **Caution:** This will overwrite any local changes to the component.

```bash
npx starwind@latest update [components]
```

If you don't specify any components, you will get a list of all available components to choose from.

```bash
┌   Welcome to the Starwind CLI 
│
◆  Select components to update
│  ◻ accordion
│  ◻ alert
│  ◻ badge
│  ◻ button
│  ◻ card
│  ◻ checkbox
│  ◻ dialog
│  ◻ input
│  ◻ label
│  ◻ select
│  ...
└
```

### update options

```bash
Usage: starwind update [options] [components...]

Update Starwind components to their latest versions

Arguments:
  components                  The components to update (space separated)

Options:
  -a, --all                   Update all installed components
  -y, --yes                   Skip confirmation prompts
  -m, --package-manager <pm>  Package manager to use (choices: "npm", "pnpm", "yarn")
  -h, --help                  display help for command
```

## search *

<DocsBadge variant="info" text="New" size="md" class="mr-1" /> Use the `search` command to search for component and [Starwind Pro](https://pro.starwind.dev/) blocks.

```bash
npx starwind@latest search [query]
```

```bash
pnpx starwind@latest search hero --plan free --limit 5

┌   Starwind Search 
│
◇  Found 5 Pro blocks
│
│  Pro Blocks
│
●    Hero 1                      [free] npx starwind@latest add @starwind-pro/hero-01 button
│
●    Hero 2                      [free] npx starwind@latest add @starwind-pro/hero-02 button
│
●    Hero 3                      [free] npx starwind@latest add @starwind-pro/hero-03 button aspect-ratio        
│
●    Hero 5                      [free] npx starwind@latest add @starwind-pro/hero-05 button aspect-ratio        
│
●    Background 1 - Simple Grid  [free] npx starwind@latest add @starwind-pro/background-01
│
◇  Pro Tip ────────────────────────────────╮
│                                          │
│  Pro blocks require Starwind Pro setup.  │
│  Run starwind setup to configure.        │
│                                          │
├──────────────────────────────────────────╯
│
└  Found 5 results 🔎
```

### search options

```bash
Usage: starwind search [options] [query]

Search Starwind components and Pro blocks

Arguments:
  query                      Search query string

Options:
  -p, --plan <plan>          Filter Pro blocks by plan type (free or pro)
  -c, --category <category>  Filter Pro blocks by category
  -l, --limit <number>       Maximum number of Pro blocks to display (default: "20")
  -o, --offset <number>      Offset for paginating Pro block results (default: "0")
  --json                     Output as JSON
  -h, --help                 display help for command
```

## docs *

<DocsBadge variant="info" text="New" size="md" class="mr-1" /> Use the `docs` command to fetch documentation references for components.

```bash
npx starwind@latest docs [components]
```

### docs options

```bash
Usage: starwind docs [options] [components...]

Open documentation for Starwind components

Arguments:
  components  The components to look up (space separated)

Options:
  --json      Output as JSON
  -h, --help  display help for command
```

## setup

Use the `setup` command to set up Starwind Pro features in an already initialized Starwind UI project.

```bash
npx starwind@latest setup
```

```bash
┌   Using Starwind Setup 
│
●  Setting up Starwind Pro...
│
◇  Configured Starwind Pro registry in components.json
│
◇  Created .env.local and updated .gitignore
│
◇  Next steps ────────────────────────────────────────────────────────────────────╮
│                                                                                 │
│  Starwind Pro is now configured! You can install pro components using:          │
│  npx starwind@latest add @starwind-pro/component-name                           │
│                                                                                 │
│  Make sure to set your STARWIND_LICENSE_KEY environment variable in .env.local  │
│                                                                                 │
├─────────────────────────────────────────────────────────────────────────────────╯
│
└  Enjoy using Starwind UI with Pro components! 🚀
```

### setup options

```bash
Usage: starwind setup [options]

Setup Starwind Pro in your project

Options:
  -y, --yes                   Skip confirmation prompts
  -m, --package-manager <pm>  Package manager to use (choices: "npm", "pnpm", "yarn")
  -p, --pro                   Setup Starwind Pro (default)
  -h, --help                  display help for command
```

## remove

Use the `remove` command to remove components from your project.

```bash
npx starwind@latest remove [components]
```

If you don't specify any components, you will get a list of all available components to choose from.

```bash
┌   Welcome to the Starwind CLI 
│
◆  Select components to remove
│  ◻ accordion
│  ◻ alert
│  ◻ badge
│  ◻ button
│  ◻ card
│  ◻ checkbox
│  ◻ dialog
│  ◻ input
│  ◻ label
│  ◻ select
│  ...
└
```

### remove options

```bash
Usage: starwind remove [options] [components...]

Remove Starwind components from your project

Arguments:
  components  The components to remove (space separated)

Options:
  -a, --all   Remove all installed components
  -h, --help  display help for command
```