# Longplay CLI

Install, sign in, management commands, local document validation, code-reference scanning and exit codes.

Last updated: 2026-11-15

[Web version](https://www.longplayai.com/docs/cli)

<a id="install"></a>

## Install and update

**terminal**

```bash
npm install -g @tinkerlandai/longplay-cli@0.3.23
longplay --version
longplay update --check
longplay update
```

Current npm release 0.3.23, Node.js 22+. On macOS and Linux, the install page also offers curl with its own website version. Updates preserve configuration and credentials. Interactive commands check for updates at most once every 24 hours; set `INDIANA_NO_UPDATE_CHECK=1` to disable (the CLI reads this exact name, so it keeps the `INDIANA_` prefix).

- [Install page](https://www.longplayai.com/docs/install.md#cli)

<a id="login"></a>

## Sign in and context

**terminal**

```bash
longplay doctor --server https://console.longplayai.com --json
longplay login --server https://console.longplayai.com
longplay whoami --json
longplay context use --org <ORG_UUID> --app <APP_UUID> --env sandbox
longplay projects list --json
longplay logout
```

Sign-in uses browser approval (Authorization Code + PKCE) with your Console member account; each login is an independent session, and logging out of the CLI does not sign you out of Console. During login you select the Apps, environments and access level this device may use in the browser; one login can cover several Apps, and `longplay context use` switches between them. One login holds at most 300 permissions, about 25 App environments at one access level. To add or remove an App, run `longplay login --replace`, which starts from your previous selection. Scripts can request exact permissions with `longplay login --permissions project.read,customers.write`. Credentials default to the system keychain.

<a id="manage"></a>

## Management commands

**terminal**

```bash
longplay capabilities --json
longplay operations list --available --json
longplay operations describe console.customers.post --json
longplay customers list --json
longplay customers create --file customer-create.json --json
longplay features list --json
longplay products apply --file product-operation.json --json
longplay offerings list --json
longplay paywalls apply --file paywall-operation.json --json
longplay funnels apply --file funnel-operation.json --json
longplay coupons --help
```

Management commands use the same handlers as Console and check member role, App access and grants. Use `operations describe` for each operation's required permissions; `longplay call <operationId> --input envelope.json` invokes one catalogued operation. `--out <new-file>` saves results privately without overwriting; the CLI never replays writes automatically.

<a id="documents"></a>

## Local document validation

**terminal**

```bash
longplay funnels validate --file funnel.json --mode publish --json
longplay paywalls validate --file paywall.json --mode draft --json
longplay offerings validate --file offering.json --mode publish --json
longplay offerings diff --against before.json --file after.json --json
```

Local validation needs no login or network and reports `validation: local` and `serverChecks: not_run`; Product existence, caller permissions and document publication requirements are still checked by the server.

<a id="code-references"></a>

## Code-reference scanning

**terminal**

```bash
longplay code-references scan --server https://console.longplayai.com \
  --app <APP_UUID> --env sandbox --repository-id <REPOSITORY_UUID> \
  --branch main --workflow .github/workflows/indiana-code-references.yml \
  --run-number 12 --run-attempt 1 --root . --out ./code-references-report.json --upload --json
```

Configure the repository in a Feature's Code references tab and create a Key with only `code-references:read` and `code-references:write`, stored as the repository secret `INDIANA_CODE_REFERENCES_KEY` (the workflow the Console generates reads this exact name, so it keeps the `INDIANA_` prefix). Scans report files and line numbers without uploading source snippets; after an uncertain upload, replay the saved report with `longplay code-references upload --file`.

<a id="output"></a>

## Output and exit codes

`--json` prints one JSON result on stdout: `{ data }` on success, `{ error: { code, message, retryable, details? } }` on failure.

**Exit codes**

| Exit | Meaning |
| --- | --- |
| 0 | Success |
| 2 | Invalid arguments, configuration, input or document |
| 3 | Missing or expired login, or authorization failure |
| 4 | Origin, permission or redirect constraint |
| 5 | Conflict or occupied write lock |
| 6 | Network, response protocol, service or rate-limit failure |
| 7 | Runtime capability or authorization unavailable |
