# MORZAI CLI Skill

Use the public `morzai` CLI to run MORZAI image workflows from a terminal-first agent.

## Install

```bash
npm install -g morzai-cli
```

## Recommended Auth Flow

Use browser device login first. This flow opens the MORZAI web login page, creates a fresh AK/SK for the current CLI session, and saves it to `~/.morzai/config.json`.

```bash
morzai auth device-login
morzai auth verify --json
```

If automatic browser launch fails, open the printed URL manually and finish login there.

Switch to the manual fallback flow when:

1. the browser does not open automatically
2. device login times out
3. the web page finishes login but the CLI still does not receive credentials
4. an operator already gave you an AK/SK pair

## Manual Auth Fallback

If the operator already has an AK/SK pair, they can still configure it manually:

```bash
morzai config set --access-key <your-access-key> --secret-key <your-secret-key>
morzai auth verify --json
```

## Public Commands

```bash
morzai apparel-recolor --input <file-or-url> --target-color "#B8B8B8" --output <file> --json
morzai garment-retouch --input <file-or-url> --correction-intensity high --output <file> --json
morzai clothing-adjustment --input <file-or-url> --preset-direction balanced_cleanup --output <file> --json
morzai ecommerce-product-kit --input <file-or-url> --product-info "Portable blender with leak-proof lid" --output-type listing_set --download-dir ./artifacts --json
```

## Agent Rules

1. Prefer `morzai auth device-login` over manual key setup.
2. After login succeeds, always run `morzai auth verify --json` before the first workflow command.
3. Keep output paths explicit so the final file location is deterministic.
4. If the CLI reports auth failure, rerun device login before retrying the workflow.

## Example

```bash
npm install -g morzai-cli
morzai auth device-login
morzai auth verify --json
morzai garment-retouch --input ./demo.jpg --output ./result.jpg --json
```
