> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crewship.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Overview

> The Crewship command-line interface for deploying and managing crews

## Installation

<Tabs>
  <Tab title="macOS / Linux">
    Install the CLI with a single command:

    ```bash theme={null}
    curl -fsSL https://www.crewship.dev/install.sh | bash
    ```

    This automatically detects your platform and installs the binary to `~/.local/bin`.
  </Tab>

  <Tab title="Windows">
    Run this command in PowerShell:

    ```powershell theme={null}
    Invoke-WebRequest -Uri "https://api.crewship.dev/cli/releases/latest/download?platform=windows-x64" -OutFile "$env:LOCALAPPDATA\Programs\crewship.exe"
    ```

    Then add the install location to your PATH:

    ```powershell theme={null}
    $path = [Environment]::GetEnvironmentVariable("Path", "User")
    if ($path -notlike "*$env:LOCALAPPDATA\Programs*") {
        [Environment]::SetEnvironmentVariable("Path", "$path;$env:LOCALAPPDATA\Programs", "User")
    }
    ```

    Restart your terminal for the PATH change to take effect.
  </Tab>
</Tabs>

Verify the installation:

```bash theme={null}
crewship --version
```

## Authentication

Before using most commands, authenticate with your Crewship account:

```bash theme={null}
crewship login
```

This opens a browser for authentication. Your credentials are stored securely in `~/.crewship/credentials.json`.

### Authentication commands

| Command           | Description                     |
| ----------------- | ------------------------------- |
| `crewship login`  | Authenticate with Crewship      |
| `crewship logout` | Remove stored credentials       |
| `crewship whoami` | Show current authenticated user |

## Command Reference

### Project Setup

| Command                      | Description                       |
| ---------------------------- | --------------------------------- |
| [`crewship init`](/cli/init) | Initialize a crewship.toml config |

### Deployment

| Command                                         | Description                    |
| ----------------------------------------------- | ------------------------------ |
| [`crewship deploy`](/cli/deploy)                | Deploy your crew to production |
| [`crewship deployment list`](/cli/deployment)   | List all deployments           |
| [`crewship deployment delete`](/cli/deployment) | Delete a deployment            |
| [`crewship version list`](/cli/version)         | List versions for a deployment |
| [`crewship version delete`](/cli/version)       | Delete a version               |

### Environment

| Command                         | Description                    |
| ------------------------------- | ------------------------------ |
| [`crewship env set`](/cli/env)  | Set environment variables      |
| [`crewship env list`](/cli/env) | List all environment variables |
| [`crewship env get`](/cli/env)  | Get a specific variable        |
| [`crewship env rm`](/cli/env)   | Remove environment variables   |

### Execution

| Command                          | Description            |
| -------------------------------- | ---------------------- |
| [`crewship invoke`](/cli/invoke) | Run your deployed crew |

### Updates

| Command                            | Description                           |
| ---------------------------------- | ------------------------------------- |
| [`crewship upgrade`](/cli/upgrade) | Update crewship to the latest version |

## Global Options

These options are available for all commands:

```bash theme={null}
crewship [command] --help     # Show help for a command
crewship [command] --version  # Show CLI version
crewship [command] --debug    # Enable debug output
```

### Multi-Deployment Support

For projects with multiple deployments in a single `crewship.toml`, use `--name` / `-n` to target a specific deployment:

```bash theme={null}
crewship deploy --name research-agent
crewship invoke --name writer-agent --input '{"topic": "AI"}'
crewship env set --name research-agent OPENAI_API_KEY=sk-...
```

See the [crewship.toml reference](/configuration/crewship-toml#multi-deployment) for configuration details.

## Configuration

The CLI looks for configuration in this order:

1. Command-line flags
2. Environment variables (`CREWSHIP_*`)
3. Project config (`crewship.toml`)
4. User config (`~/.crewship/config.json`)

### Environment Variables

| Variable           | Description                                        |
| ------------------ | -------------------------------------------------- |
| `CREWSHIP_API_URL` | Override API endpoint (for development)            |
| `CREWSHIP_TOKEN`   | API token for CI/CD (instead of interactive login) |

## CI/CD Usage

For automated deployments, use an API token instead of interactive login:

```bash theme={null}
# Set token as environment variable
export CREWSHIP_TOKEN=your_api_token

# Deploy (no login required)
crewship deploy
```

Generate API tokens in the [Console](https://console.crewship.dev) under Settings → API Keys.

## Exit Codes

| Code | Meaning                 |
| ---- | ----------------------- |
| `0`  | Success                 |
| `1`  | General error           |
| `2`  | Invalid arguments       |
| `3`  | Authentication required |
| `4`  | Network error           |

## Next Steps

<CardGroup cols={2}>
  <Card title="Initialize" icon="wand-magic-sparkles" href="/cli/init">
    Set up your project
  </Card>

  <Card title="Deploy" icon="rocket" href="/cli/deploy">
    Deploy your crew
  </Card>

  <Card title="Deployments" icon="server" href="/cli/deployment">
    List and delete deployments
  </Card>

  <Card title="Versions" icon="code-branch" href="/cli/version">
    List and delete versions
  </Card>

  <Card title="Environment" icon="key" href="/cli/env">
    Manage secrets
  </Card>

  <Card title="Invoke" icon="play" href="/cli/invoke">
    Run your crew
  </Card>
</CardGroup>
