npm package: @pitcher/cli-scripts
Description: The Pitcher CLI for various tasks in its ecosystem.
Author: Pitcher AG
Latest version: 2.1.2

# @pitcher/cli-scripts

> Pitcher CLI Tools provide a suite of command-line utilities to streamline your workflow. For the best experience, we recommend installing the tools globally using `npm install -g @pitcher/cli-scripts`.

## Help

```bash
p --help
# or for specific command help:
p command --help
```

## To run the `publish-app` command:

```bash
# Basic usage
p publish-app <folder> --url https://pitcher.my.pitcher.com --api-key myapikey

# Publish to current folder and default org (dev)
p publish-app --api-key myapikey

# Publish to a specific organization subdomain (e.g., pitcher.my.pitcher.com)
p publish-app --api-key myapikey --org pitcher

# Dry run with version increment
p publish-app --api-key myapikey --org pitcher --dry-run --increment-version

# Publish and install to specific instances
p publish-app --api-key myapikey --org pitcher --increment-version --install-to 01JB8KQRM3XYZ2P4N5W7T9VHFA,01JB8KR0P6QS4T8X1M9Y3C7ZBE

# Publish and install to all instances with a specific environment name (case-insensitive)
p publish-app --api-key myapikey --org pitcher --increment-version --install-to-env-name Demo

# Combine both: install to specific instances AND all instances in an environment
p publish-app --api-key myapikey --org pitcher --increment-version --install-to 01JB8KS5F2WH9V6D8R3N7JXMQK --install-to-env-name Demo

# Alternative: Set API key via environment variable
export NG_API_KEY=myapikey
p publish-app --org pitcher --increment-version --install-to-env-name Production
```

### Options

- `--api-key <apiKey>`: API Key for authentication (can also use `NG_API_KEY` env variable)
- `--org <organization>`: Organization subdomain (e.g., "pitcher" for pitcher.my.pitcher.com, default: "dev")
- `--increment-version`: Increment version in app.json with timestamp
- `--dry-run`: Perform a dry run without publishing
- `--publish-url <url>`: Explicit publish URL
- `--install-to <instanceIds>`: Comma-separated list of instance IDs to install the app to after publishing
- `--install-to-env-name <envName>`: Environment name to filter instances and install the app to after publishing (case-insensitive)

## To run the `dev-sync` command:

Sync a marketplace app directly to S3 for live development testing without publishing. This is useful for testing app changes in a pre-production environment.

```bash
# One-time sync from dist folder
p dev-sync sync --file-id <pitcher_file_id> --api-key myapikey

# Sync to a specific organization (default: dev)
p dev-sync sync --file-id <pitcher_file_id> --org pitcher

# Watch mode - auto-sync on file changes (reverts on Ctrl+C)
p dev-sync watch --file-id <pitcher_file_id> --api-key myapikey

# Watch with custom debounce (default: 2500ms)
p dev-sync watch --file-id <pitcher_file_id> --debounce 5000

# Manually revert dev override to restore original version
p dev-sync revert --file-id <pitcher_file_id> --api-key myapikey

# Alternative: Set API key via environment variable
export NG_API_KEY=myapikey
p dev-sync watch --file-id <pitcher_file_id> --org pitcher
```

### Options

- `--file-id <id>`: (Required) File ID of the installed app (`pitcher_file.id`) - copy this from the installed apps view
- `--api-key <apiKey>`: API Key for authentication (can also use `NG_API_KEY` env variable)
- `--org <organization>`: Organization subdomain (default: "dev")
- `--debounce <ms>`: Debounce time in milliseconds for watch mode (default: 2500)

### Notes

- Run from your app's project root (with `dist/` folder) or directly from the `dist/` folder
- The `watch` command automatically reverts changes on graceful shutdown (Ctrl+C)
- Apps with dev override show a badge in the installed apps view