# lig-cloud — LiG Cloud operator CLI

An agent-first command-line tool for LiG Cloud operators: it administers
`cloud-web` against the `backend-api` v2 API from a terminal. It is an internal
operator tool for LiG staff and agent runtimes — it is not shipped to SDK
consumers.

- Command syntax and schemas: `lig-cloud --help` is the single source of truth.
- Session: `lig-cloud login`; credentials are kept in `~/.lig-cloud/env` (mode 0600).
- Output: JSON on stdout for agents; `--pretty` for human-readable tables.

## Install

One command installs the binary and the agent skill, on Linux (x86_64) and
macOS (x86_64 + arm64), for Claude Code, Codex and pi:

```
curl -fsSL https://developer.lig.com.tw/tools/lig-cloud/install.sh | sh
```

The script draws the matching platform binary from `dl.lig.com.tw`, verifies it
against `SHASUMS.txt`, installs it to `~/.local/bin/lig-cloud`, and drops
`SKILL.md` into `~/.claude/skills/`, `~/.agents/skills/` (and pi's skill tree).
Nothing runs with sudo and nothing is written outside `$HOME`. Re-running the
same command upgrades. Manual install (any version, per-file):

```
curl -fL https://dl.lig.com.tw/lig-cloud/<version>/lig-cloud-<target>
curl -fL https://dl.lig.com.tw/lig-cloud/<version>/SHASUMS.txt
shasum -a 256 -c SHASUMS.txt
```

`<target>`: `aarch64-apple-darwin` (Apple Silicon) · `x86_64-apple-darwin`
(Intel Mac) · `x86_64-unknown-linux-musl` (Linux).

Maintainers: bump `VER` in `install.sh` and refresh `SKILL.md` (from
`cloud-web` `cli/lig-cloud/SKILL.md`) in the same MR that appends a release
below.

## Staging for agents

Every core-family fixture farm seeds agent accounts (api `rake staging:seed_agents`):
`qa+agent-member@lig.com.tw` (LiG member) and `qa+agent-client@lig.com.tw`
(client admin). The shared fixture password is `StagingAgentAccounts::PASSWORD`
in the api repo; farms hold no real data. Root on a farm is the legacy seed
`rd@lig.com.tw`.

```sh
lig-cloud login --email qa+agent-member@lig.com.tw --password "$PW" \
  --base https://farm1-api.farms.lig.com.tw/api --env-file ~/.lig-cloud/farm1.env
lig-cloud whoami --base https://farm1-api.farms.lig.com.tw/api --env-file ~/.lig-cloud/farm1.env
```

Use a separate `--env-file` per base so farm and production sessions never
share a file. Production logins use a human's credentials, supplied by the
human; `login` never prompts when stdin is not a terminal. The full recipe is
in `SKILL.md` ("Agent recipe").

## Releases

One short list per version, appended as each release lands.

- `0.1.0`
  - macOS x86_64 — `https://dl.lig.com.tw/lig-cloud/0.1.0/lig-cloud-x86_64-apple-darwin`
  - checksums — `https://dl.lig.com.tw/lig-cloud/0.1.0/SHASUMS.txt`

- `0.1.1`
  - macOS x86_64 — `https://dl.lig.com.tw/lig-cloud/0.1.1/lig-cloud-x86_64-apple-darwin`
  - Linux x86_64 — `https://dl.lig.com.tw/lig-cloud/0.1.1/lig-cloud-x86_64-unknown-linux-musl`
  - checksums — `https://dl.lig.com.tw/lig-cloud/0.1.1/SHASUMS.txt`

- `0.2.0`
  - macOS arm64 — `https://dl.lig.com.tw/lig-cloud/0.2.0/lig-cloud-aarch64-apple-darwin`
  - macOS x86_64 — `https://dl.lig.com.tw/lig-cloud/0.2.0/lig-cloud-x86_64-apple-darwin`
  - Linux x86_64 — `https://dl.lig.com.tw/lig-cloud/0.2.0/lig-cloud-x86_64-unknown-linux-musl`
  - checksums — `https://dl.lig.com.tw/lig-cloud/0.2.0/SHASUMS.txt`

- `0.2.1` — first release that can log in: JSON bodies now carry
  `Content-Type` (0.1.x and 0.2.0 answered 401 for correct credentials);
  `login` fails fast without a terminal; 401 `detail` names the endpoint;
  `whoami` shows `env_file`; every release is gated by a login smoke against
  farm1.
  - macOS arm64 — `https://dl.lig.com.tw/lig-cloud/0.2.1/lig-cloud-aarch64-apple-darwin`
  - macOS x86_64 — `https://dl.lig.com.tw/lig-cloud/0.2.1/lig-cloud-x86_64-apple-darwin`
  - Linux x86_64 — `https://dl.lig.com.tw/lig-cloud/0.2.1/lig-cloud-x86_64-unknown-linux-musl`
  - checksums — `https://dl.lig.com.tw/lig-cloud/0.2.1/SHASUMS.txt`

- `0.2.2` — `ar-object create` and `update` actually write: create posts to
  `/api/v2/scenes/<id>/ar_objects`, the body is the same top-level shape
  `show` returns (0.2.1 wrapped it and the backend ignored it: create 404,
  update a silent no-op); `--location` is the `{x,y,z,rotate_*}` object,
  `--zoom` a number or `{x,y,z}`, new `--events` takes the JSON array from
  `show`. The farm1 release gate now round-trips a write.
  - macOS arm64 — `https://dl.lig.com.tw/lig-cloud/0.2.2/lig-cloud-aarch64-apple-darwin`
  - macOS x86_64 — `https://dl.lig.com.tw/lig-cloud/0.2.2/lig-cloud-x86_64-apple-darwin`
  - Linux x86_64 — `https://dl.lig.com.tw/lig-cloud/0.2.2/lig-cloud-x86_64-unknown-linux-musl`
  - checksums — `https://dl.lig.com.tw/lig-cloud/0.2.2/SHASUMS.txt`

## Version layout on dl.lig.com.tw

```
/lig-cloud/<version>/lig-cloud-aarch64-apple-darwin
/lig-cloud/<version>/lig-cloud-x86_64-apple-darwin
/lig-cloud/<version>/lig-cloud-x86_64-unknown-linux-musl
/lig-cloud/<version>/SHASUMS.txt
```

Binary releases are published to `dl.lig.com.tw` on semver tags; the download
layout is versioned and per-target, with a `SHASUMS.txt` per version.
