The DeployHQ CLI includes several utility commands for managing SSH keys, templates, deployment zones, shell completions, and more.

## SSH Keys

Manage account-level SSH keys used for server authentication.

### Listing SSH Keys

```bash
dhq ssh-keys list
```

### Creating an SSH Key

```bash
# Create an ED25519 key (default)
dhq ssh-keys create --title "Production Key"

# Create an RSA key
dhq ssh-keys create --title "Legacy Key" --key-type rsa
```

Keys are generated on the server. The CLI displays the public key, which you should add to your server's `authorized_keys` file.

### Deleting an SSH Key

```bash
dhq ssh-keys delete <id>
```

## Templates

Templates are reusable project configurations.

### Listing Templates

```bash
# List your templates
dhq templates list

# List public templates
dhq templates public

# Filter public templates by framework
dhq templates public --framework rails
```

### Creating a Template

```bash
dhq templates create --name "My Rails Template"
```

### Updating a Template

```bash
dhq templates update <id> --name "Updated Template"
```

### Deleting a Template

```bash
dhq templates delete <id>
```

## Deployment Zones

View available deployment zones:

```bash
dhq zones list
```

Zones determine the geographic location of your deployment infrastructure.

## Shell Completions

The CLI supports tab completion for bash, zsh, fish, and PowerShell. Completions include dynamic suggestions for project names, server names, and other resource identifiers when using flags like `--project`, `--server`, `show`, and `open`.

### Zsh

Add to your `~/.zshrc`:

```bash
source <(dhq completion zsh)
```

### Bash

Add to your `~/.bashrc`:

```bash
source <(dhq completion bash)
```

### Fish

```bash
dhq completion fish | source
```

To make it persistent, save to the Fish completions directory:

```bash
dhq completion fish > ~/.config/fish/completions/dhq.fish
```

### PowerShell

```powershell
dhq completion powershell | Out-String | Invoke-Expression
```

## Health Check

Run a diagnostic check to verify your CLI setup:

```bash
dhq doctor
```

This checks:
- CLI version and available updates
- Authentication status
- API connectivity
- Configuration file validity

## Self-Update

Update the CLI to the latest version:

```bash
dhq update
```

If you installed via Homebrew, this runs `brew upgrade dhq`. Otherwise, it downloads the latest release from GitHub.

## Account Signup

Create a new DeployHQ account from the terminal:

```bash
dhq signup
```

## Account Activity

View recent account activity:

```bash
# List activity events
dhq activity list

# View deployment statistics
dhq activity stats
```

## Quick Dashboard

View a summary of deployments across all projects:

```bash
dhq status
```

This shows deployments this week, success rate, average duration, active servers, and recent activity.

## Feedback

Send feedback or report issues:

```bash
dhq feedback
```

## Opening DeployHQ in the Browser

Open the DeployHQ dashboard, or a specific project:

```bash
# Open dashboard
dhq open

# Open a specific project
dhq open my-app
```

## Telemetry

The CLI collects anonymous usage telemetry (via Mixpanel) to help improve the product. No personally identifiable information is collected -- only command names and high-level usage patterns.

To opt out of telemetry:

```bash
dhq config set telemetry false
```

To opt back in:

```bash
dhq config set telemetry true
```

## Version

Check the installed CLI version:

```bash
dhq --version
```
