> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appstack.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> Automate the Appstack SDK lifecycle — install, audit, and upgrade — with your coding agent.

<Note>
  **Beta.** The CLI is published on npm as `appstack-cli`. `review`, `--dry-run`, `--json`, and `--skill` never modify files, so they are safe to run against any project. `integrate` and `upgrade` always ask for confirmation before writing.
</Note>

The Appstack CLI does what the Mobile SDK pages describe, without you doing it by
hand. It detects your project, runs deterministic checks first, then hands a
framework-specific playbook to a coding agent — Claude Code or Codex — running
headlessly.

It is deliberately scoped to the SDK lifecycle. It never creates Appstack
organizations, apps, campaigns, links, or dashboard resources — do those in the
dashboard.

## Requirements

* **Node.js 20** or newer.
* **Claude Code or Codex**, installed and authenticated. Only the agent-backed
  runs need one — `--json`, `--skill`, and `--dry-run` work without any agent.
* A **Swift/iOS**, **Kotlin/Android**, **React Native**, **Flutter**, or **Unity**
  project.

## Install

Run it once, without installing anything:

```bash theme={null}
npx appstack-cli review
```

Or install it globally, which gives you the shorter `appstack` command:

```bash theme={null}
npm install -g appstack-cli
appstack review
```

## Interactive mode

Run `appstack` with no arguments in an interactive terminal to open the guided
walkthrough. It detects the apps in your repository, lets you pick a workflow and
an execution mode, masks API keys as you type them, and asks for confirmation
before anything is written to disk.

```bash theme={null}
appstack
```

## Commands

<CardGroup cols={3}>
  <Card title="integrate" icon="download">
    Installs and configures the SDK using your app's existing package manager and startup architecture.
  </Card>

  <Card title="review" icon="magnifying-glass">
    Audits an existing integration. Deterministic checks plus a read-only semantic pass. Never writes.
  </Card>

  <Card title="upgrade" icon="arrow-up">
    Resolves the latest stable release, reads the migration surface, updates dependencies and lockfiles, then verifies the app.
  </Card>
</CardGroup>

### integrate

Installs the SDK and wires up the `configure` call in the right place for your
project's architecture.

```bash theme={null}
appstack integrate
```

Pass the API key for a single-platform app with `--api-key`, or set
`APPSTACK_API_KEY`. See [API keys](#api-keys) for cross-platform apps.

### review

The one to reach for first. It reports what is actually wired up versus what the
docs expect, and it cannot change your files.

```bash theme={null}
appstack review
```

### upgrade

Targets the latest stable release from the official registry by default. Pin a
specific version with `--to`:

```bash theme={null}
appstack upgrade
appstack upgrade --to 2.6.0 --dry-run
```

## Flags

| Flag                       | What it does                                                               |
| -------------------------- | -------------------------------------------------------------------------- |
| `--skill`                  | Print the composed, project-specific playbook instead of running an agent. |
| `--dry-run`                | Inspect and show the plan without changing any files.                      |
| `--json`                   | Print the deterministic inspection as JSON. Useful in CI.                  |
| `--framework <name>`       | Select one app in a repository where more than one is detected.            |
| `--install-dir <path>`     | Inspect a directory other than the current one.                            |
| `--driver <claude\|codex>` | Force a coding-agent backend instead of the auto-detected one.             |
| `--to <version>`           | `upgrade` only. Target SDK version. Defaults to the latest stable.         |

## API keys

The CLI never creates keys, and it instructs the agent not to print key values.
Grab the key for each app from its project settings in the Appstack dashboard.

For a single-platform app:

```bash theme={null}
appstack integrate --api-key <YOUR_API_KEY>
```

For a cross-platform app, pass both keys as flags or as environment variables:

```bash theme={null}
APPSTACK_IOS_API_KEY=... APPSTACK_ANDROID_API_KEY=... appstack integrate
```

```bash theme={null}
appstack integrate --ios-api-key <IOS_KEY> --android-api-key <ANDROID_KEY>
```

## Continuous integration

`--json` gives you the deterministic inspection with no agent involved, so it
runs anywhere Node does:

```bash theme={null}
npx appstack-cli review --json
```

## No coding agent installed?

Use `--skill` to print the full playbook for your specific project and paste it
into whichever assistant you already use:

```bash theme={null}
appstack integrate --skill
```

This is the same content as the copyable prompt at the top of each SDK page, but
resolved against your actual project rather than generic.

## How it works

The CLI is a thin, deterministic harness — project detection, version
resolution, safety boundaries, and verification contracts. The Appstack
integration expertise lives in a bundled skill, sourced from
[`appstack-tech/appstack-skills`](https://github.com/appstack-tech/appstack-skills),
with one reference per platform. Claude Code is preferred when both agents are
available.

## Troubleshooting

**"No coding agent found."**
Install Claude Code or Codex, or run the command with `--skill` and paste the
playbook into your agent.

**"`codex` is not available."**
You passed `--driver codex` but only Claude Code was detected, or neither was.
Drop the flag to use whatever is installed.

**"No installed Appstack SDK version was detected. Run `appstack integrate` instead."**
You ran `upgrade` on a project that has no Appstack SDK yet.

**More than one app detected.**
Pass `--framework` to pick one, or `--install-dir` to point at a single app's
directory.

## Source

The CLI is open source at
[`appstack-tech/appstack-cli`](https://github.com/appstack-tech/appstack-cli).
