# WP-CLI Commands

HelloPack Client registers the `wp hellopack` command namespace with three subcommand groups: `license`, `plugin`, and `theme`.

## License Management

### Activate

Save and verify an API token.

```bash
wp hellopack license activate <token>
```

**Arguments:**
- `<token>` — HelloPack API token (minimum 20 characters)

**Example:**

```bash
wp hellopack license activate eyJ0eXAiOiJKV1QiLCJhbGci...
```

### Deactivate

Remove the API token and set the license to inactive. Clears all cached data.

```bash
wp hellopack license deactivate
```

### Status

Display the current license status, domain, and masked token.

```bash
wp hellopack license status
```

**Output:**

```
Status: active
Domain: example.com
Token:  abcdef••••••••xyz123
```

## Plugin Management

### List

List all purchased plugins with their installation status.

```bash
wp hellopack plugin list [--format=<format>]
```

**Options:**
- `--format=<format>` — Output format: `table` (default), `csv`, `json`, `yaml`

**Columns:** `id`, `name`, `slug`, `version`, `status`

**Status values:**
- `active` — Installed and activated
- `installed` — Installed but not active
- `available` — Not yet installed

**Examples:**

```bash
wp hellopack plugin list
wp hellopack plugin list --format=json
wp hellopack plugin list --format=csv > plugins.csv
```

### Install

Install a plugin from the HelloPack catalog.

```bash
wp hellopack plugin install <plugin> [--activate]
```

**Arguments:**
- `<plugin>` — Plugin slug or numeric ID from the catalog

**Options:**
- `--activate` — Activate the plugin after installation

**Examples:**

```bash
wp hellopack plugin install elementor-pro
wp hellopack plugin install 12345 --activate
```

### Update

Update an installed HelloPack plugin. Delegates to the built-in `wp plugin update` command, which uses the HelloPack update transient.

```bash
wp hellopack plugin update <plugin>
```

**Arguments:**
- `<plugin>` — Plugin slug

**Example:**

```bash
wp hellopack plugin update elementor-pro
```

## Theme Management

### List

List all purchased themes with their installation status.

```bash
wp hellopack theme list [--format=<format>]
```

**Options:**
- `--format=<format>` — Output format: `table` (default), `csv`, `json`, `yaml`

**Columns:** `id`, `name`, `slug`, `version`, `status`

**Examples:**

```bash
wp hellopack theme list
wp hellopack theme list --format=json
```

### Install

Install a theme from the HelloPack catalog.

```bash
wp hellopack theme install <theme> [--activate]
```

**Arguments:**
- `<theme>` — Theme slug or numeric ID from the catalog

**Options:**
- `--activate` — Switch to the theme after installation

**Examples:**

```bash
wp hellopack theme install bricks
wp hellopack theme install 67890 --activate
```

### Update

Update an installed HelloPack theme. Delegates to the built-in `wp theme update` command.

```bash
wp hellopack theme update <theme>
```

**Arguments:**
- `<theme>` — Theme slug

**Example:**

```bash
wp hellopack theme update bricks
```

## Batch Operations

Combine with standard shell tools for bulk operations:

```bash
# Install all available plugins
wp hellopack plugin list --format=json | jq -r '.[] | select(.status=="available") | .slug' | xargs -I {} wp hellopack plugin install {}

# Update all installed plugins
wp hellopack plugin list --format=json | jq -r '.[] | select(.status!="available") | .slug' | xargs -I {} wp hellopack plugin update {}

# Export catalog to CSV
wp hellopack plugin list --format=csv > hellopack-plugins.csv
wp hellopack theme list --format=csv > hellopack-themes.csv
```

## Docker Usage

When running in the Docker development environment:

```bash
docker compose -f docker/docker-compose.yml exec wordpress wp --allow-root hellopack license status
docker compose -f docker/docker-compose.yml exec wordpress wp --allow-root hellopack plugin list
```
