open-index/open-npm huggingface dataset:
npm package: @reduck-ai/cli
Description: CLI for Reduck — run browser automations from your terminal.
Author: Reduck AI
Latest version: 1.1.1

<p align="center">
  <img src="https://cdn.reduck.ai/logo-full-dark.png" alt="Reduck" width="300" />
</p>

# @reduck-ai/cli

Command-line interface for [Reduck](https://reduck.ai) — run browser automations from your terminal.

Built on top of [`@reduck-ai/sdk`](https://www.npmjs.com/package/@reduck-ai/sdk).

## Installation

```bash
npm install -g @reduck-ai/cli
```

## Authentication

```bash
# OAuth login (opens browser)
reduck login

# Or use an API key
export REDUCK_API_KEY=rk_...
```

Generate an API key from your [Reduck dashboard](https://reduck.ai).

## Usage

```bash
# Select a device to run automations on
reduck devices

# Run an automation
reduck -q "Go to google.com and search for 'reduck ai'"

# With file uploads
reduck -q "Fill the form with my resume" --mount ./resume.pdf

# Multiple file uploads
reduck -q "Compare these two documents" --mount ./doc1.pdf --mount ./doc2.pdf

# Interrupt a running automation
reduck interrupt <run-id>

# Logout
reduck logout
```

Press `Ctrl+C` during a run to cancel it gracefully.

## Commands

| Command | Description |
|---|---|
| `reduck login` | Authenticate via OAuth (opens browser) |
| `reduck logout` | Clear stored credentials |
| `reduck devices` | List and select a device |
| `reduck -q "..."` | Run an automation |
| `reduck interrupt <id>` | Cancel a running automation |

## Options

| Flag | Environment Variable | Description |
|---|---|---|
| `-q` | — | Automation prompt (required for runs) |
| `--mount` | — | File path to upload (repeatable) |
| `--api-key` | `REDUCK_API_KEY` | API key authentication |
| `--device-id` | `REDUCK_DEVICE_ID` | Target device ID |

## Configuration

Credentials are stored in `~/.config/reduck/config.json` after `reduck login`. The CLI uses OAuth with PKCE for secure authentication.

Priority order for authentication:
1. `--api-key` flag
2. `REDUCK_API_KEY` environment variable
3. Stored OAuth token from `reduck login`

Priority order for device selection:
1. `--device-id` flag
2. `REDUCK_DEVICE_ID` environment variable
3. Device saved via `reduck devices`

## License

Apache-2.0