npm package: @iga-pages/cli
Description: A CLI tool for IGA Pages
Latest version: 1.0.1

<br/>

<div align="center">
  <h3 align="center">IGA Pages CLI</h3>
</div>

<br/>

## Overview

IGA Pages is a full-stack development and deployment platform powered by Volcengine IGA/DCDN. It supports static sites, server-side rendering, and serverless functions, delivering projects to a global edge network with zero infrastructure management.

`@iga-pages/cli` is the official command-line interface for IGA Pages, helping you manage projects, develop locally, and debug Functions from your terminal.

<br/>

## Prerequisites

To get started, create an account with [Volcengine](https://console.volcengine.com).

<br/>

## Installation

```bash
npm install -g @iga-pages/cli
```

Verify the installation:

```bash
iga -v
iga -h
```

<br/>

## Commands

### `iga login`

Authenticate with Volcengine using Access Key / Secret Key credentials. Credentials can be provided via flags or interactive prompts. Once validated, they are saved to `~/.iga/auth.json`.

```bash
iga login                                          # interactive prompt
iga login --accessKey <AK> --secretKey <SK>        # non-interactive
```

| Flag          | Description           |
| ------------- | --------------------- |
| `--accessKey` | Volcengine Access Key |
| `--secretKey` | Volcengine Secret Key |

---

### `iga logout`

Remove saved credentials from `~/.iga/auth.json`.

```bash
iga logout
```

---

### `iga pages link`

Link the current directory to an IGA Pages project. The CLI auto-detects a matching project by directory name, or lets you pick from your existing projects. If no project exists yet, it can create one (including GitHub-connected projects when a Git remote is detected).

```bash
iga pages link
```

Project configuration is saved to `.iga/project.json` (automatically added to `.gitignore`).

---

### `iga pages deploy`

Build and deploy the current project to the IGA Pages edge network. The CLI supports two deployment modes:

- **Git-based** — If a GitHub remote is detected and authorized, the platform pulls source code directly from the repository.
- **Direct upload** — Source files are zipped and uploaded when no Git provider is available.

For linked projects (see `iga pages link`), re-deployment is triggered automatically. For new projects, the CLI walks you through creation first.

```bash
iga pages deploy                        # deploy current project
iga pages deploy --name my-app          # specify project name (new projects)
iga pages deploy --scope overseas       # set deployment scope
```

| Flag      | Description                                          |
| --------- | ---------------------------------------------------- |
| `--name`  | Project name (defaults to directory name)            |
| `--scope` | Deployment scope: `domestic` (default) or `overseas` |

---

### `iga pages dev`

Start a local development server. The CLI reads the `dev` or `start` script from your `package.json`, injects the port automatically if the framework supports it, and falls back to framework defaults when no script is found.

```bash
iga pages dev  # start on http://localhost:3000
```

---

## License

MIT © Beijing Volcano Engine Technology Co., Ltd.