The DeployHQ CLI lets you configure every aspect of your build pipeline, including build commands, configurations, config files, environment variables, SSH commands, and excluded files.

## Build Commands

Build commands run during the build phase of a deployment (e.g., `npm install`, `npm run build`).

```bash
# List build commands
dhq build-commands list -p my-app

# Create a build command
dhq build-commands create -p my-app --command "npm install" --description "Install dependencies"

# Update a build command
dhq build-commands update <id> -p my-app --command "npm ci"

# Delete a build command
dhq build-commands delete <id> -p my-app
```

## Build Configurations

Build configurations control the runtime environment for your builds, including language versions and packages.

```bash
# List build configurations
dhq build-configs list -p my-app

# Show a specific build configuration
dhq build-configs show <id> -p my-app

# Show the default build configuration
dhq build-configs default -p my-app

# Create a build configuration
dhq build-configs create -p my-app --packages '{"node":"18"}'

# Update a build configuration
dhq build-configs update <id> -p my-app --packages '{"node":"20","ruby":"3.2"}'

# Delete a build configuration
dhq build-configs delete <id> -p my-app
```

## Language Versions

View available language versions for the build server:

```bash
dhq language-versions list
```

This shows all supported versions for Node.js, Ruby, PHP, Python, Go, and other languages available on the DeployHQ build server.

## Config Files

Config files are deployed alongside your code but are not stored in your repository. They are commonly used for environment-specific configuration (e.g., `config/database.yml`, `.env`).

```bash
# List config files
dhq config-files list -p my-app

# Show a config file (including contents)
dhq config-files show <id> -p my-app

# Create a config file
dhq config-files create -p my-app --path ".env" --body "DATABASE_URL=postgres://localhost/mydb"

# Update a config file
dhq config-files update <id> -p my-app --body "DATABASE_URL=postgres://prod/mydb"

# Delete a config file
dhq config-files delete <id> -p my-app
```

## Environment Variables

Project-level environment variables are available during builds and deployments.

```bash
# List environment variables
dhq env-vars list -p my-app

# Show a specific variable
dhq env-vars show DATABASE_URL -p my-app

# Create an environment variable
dhq env-vars create -p my-app --name DATABASE_URL --value "postgres://localhost/mydb"

# Update an environment variable
dhq env-vars update <id> -p my-app --value "postgres://prod/mydb"

# Delete an environment variable
dhq env-vars delete <id> -p my-app
```

### Global Environment Variables

Account-wide environment variables are available to all projects.

```bash
# List global environment variables
dhq global-env-vars list

# Create a global variable
dhq global-env-vars create --name DEPLOY_TOKEN --value "secret-token"

# Update a global variable
dhq global-env-vars update <id> --value "new-token"

# Delete a global variable
dhq global-env-vars delete <id>
```

## SSH Commands

SSH commands run on the server before or after file transfer during deployment.

```bash
# List SSH commands
dhq ssh-commands list -p my-app

# Show an SSH command
dhq ssh-commands show <id> -p my-app

# Create an SSH command (runs after deployment)
dhq ssh-commands create -p my-app --command "sudo systemctl restart app" --timing after

# Create a pre-deployment command
dhq ssh-commands create -p my-app --command "sudo systemctl stop app" --timing before

# Update an SSH command
dhq ssh-commands update <id> -p my-app --command "sudo systemctl reload app"

# Delete an SSH command
dhq ssh-commands delete <id> -p my-app
```

## Excluded Files

Excluded file patterns prevent certain files from being deployed to the server.

```bash
# List excluded files
dhq excluded-files list -p my-app

# Show an excluded file pattern
dhq excluded-files show <id> -p my-app

# Create an exclusion pattern
dhq excluded-files create -p my-app --path "node_modules"
dhq excluded-files create -p my-app --path ".git"
dhq excluded-files create -p my-app --path "tests/"

# Update an exclusion pattern
dhq excluded-files update <id> -p my-app --path "test/"

# Delete an exclusion pattern
dhq excluded-files delete <id> -p my-app
```
