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

# CLI

> Install, authenticate, and operate Akua from a terminal or coding agent

`akua` is Akua's public command-line interface for people, automation, and
coding agents. Browser/device authentication handles interactive sign-in. The
generated resource commands stay aligned with the public OpenAPI contract.

The command catalog includes APIs beyond the soft launch. Hosted sandboxes and
dedicated OpenCode Servers are not available in the soft launch; see
[API availability](https://docs.akua.dev/apis/introduction#soft-launch-availability). Use your own
coding agent and follow the [Quickstart](https://docs.akua.dev/quickstart.md) for the supported paths.

## Install

Install the supported Homebrew formula on macOS or Linux:

```bash
brew install akua-dev/tap/akua
akua --version
akua --help
```

GitHub Release archives are the alternative distribution channel. Each archive
holds the single `akua` executable and has a SHA-256 file beside it. See the
[manual install](https://github.com/akua-dev/akua/blob/main/packages/cli/docs/install.md)
for the exact commands for your operating system and architecture.

## Update

Check for a newer release, then install it:

```bash
akua update --check
akua update
```

`akua update` runs `brew upgrade akua-dev/tap/akua` for a Homebrew install. A
release binary from a manual install is replaced in place: the CLI downloads the
latest archive for your operating system and architecture, checks its SHA-256,
and swaps the executable, leaving the old one when any step fails. For an `akua`
that another package manager owns, such as one in `/usr/bin`, the CLI changes
nothing and prints the commands to run.

On an interactive terminal, the CLI checks for a newer release at most every 20
hours and prints one line on stderr while one is available. Agent, JSON, quiet,
and CI runs never check. Set `AKUA_NO_UPDATE_CHECK=1` to turn the check off.

## Authenticate

Start browser/device sign-in:

```bash
akua auth login
akua auth status --json
```

`akua auth login` opens the device page and waits for you to approve the
displayed code. On a remote terminal, use `akua auth login --no-browser` and
open the displayed URL yourself. The CLI saves the resulting credential only
after approval.

For noninteractive automation, set `AKUA_API_TOKEN` to a workspace API token.
The environment variable takes precedence over the locally stored credential.

## Choose a workspace

Browser-approved credentials can access more than one workspace. List your
workspaces, then save the one later commands should run in:

```bash
akua workspaces list
akua workspaces use my-team
```

Replace `my-team` with the workspace's slug, name, or `ws_...` ID from the list.
`akua workspaces use` saves the choice in `~/.config/akua/config.json`, and every
workspace-scoped command sends it as the `Akua-Context` header for you.
`akua workspace switch` is the same command. Run it without a name on a
terminal to choose from a list of your active workspaces with the arrow keys.
Check which workspace is active, and where the choice comes from:

```bash
akua workspaces current
```

To run one command in another workspace, pass `--workspace` (short form `-w`).
For a whole shell session or a CI job, set `AKUA_WORKSPACE`:

```bash
akua clusters list --workspace other-team
AKUA_WORKSPACE=ws_j572abc123def4 akua clusters list
```

The CLI picks the workspace in this order: the `--workspace` flag, then
`AKUA_WORKSPACE`, then the saved workspace. A workspace-owned API token already
implies its workspace, so it needs none of them. An `Akua-Context` value that
conflicts with a token's scope is rejected. Run `akua workspaces use --clear` to
forget the saved workspace.

## Run commands

Every public API operation is a command: an OpenAPI `operationId` such as
`clusters.create` becomes `akua clusters create`. Path parameters are
arguments, and request fields are flags generated from the API schema, so
`--help` always matches the API:

```bash
akua regions list
akua clusters create --kind hosted --name demo --region-id REGION_ID
akua clusters get CLUSTER_ID
akua installs get INSTALL_ID
```

Replace `REGION_ID`, `CLUSTER_ID`, and `INSTALL_ID` with IDs from the matching
`list` command. On a terminal, lists print as tables and objects as aligned
fields. Add `--json` for the full API response; pipe it to
[jq](https://jqlang.org) to pick out fields:

```bash
akua clusters list --json | jq -r '.data.data[].id'
```

The CLI validates the request against the public API contract before sending
it. A missing or invalid value names the flag or argument to fix, and the error
lists the command's `--help` and an example. Flags that take objects or lists,
such as `--initial-values`, take a JSON value.

When a command returns an Operation, the CLI prints the command that waits for
it, for example `akua operations wait OPERATION_ID`. That command returns as
soon as the Operation finishes, or after at most 60 seconds, so run it again
until `done` is `true`. Continue only for `state: SUCCEEDED`, and stop for
`state: FAILED` or `state: CANCELLED`. Don't repeat the mutation.

## Pass secret values

Fields that carry secret material, such as an invitation `token`, also take a
`--<flag>-file` form. It reads the value from a file, or from standard input
with `-`, so the secret never appears in your shell history or the process list:

```bash
akua organizations accept-invitation-token --token-file -
```

Paste or pipe the value in, then press Ctrl-D. Typing the secret as a plain
flag, for example `--token`, still works, but the CLI prints a warning on
stderr.

## Send a JSON request

Scripts and agents can send the whole request as one JSON object from stdin or
a file through `--input`. The object's possible partitions are `path`, `query`,
`headers`, and `body`; arguments and flags on the same command override its
fields:

```bash
printf '%s' '{"query":{"limit":5}}' | akua workspaces list --input - --json
akua clusters create --input cluster.json --json
```

The CLI rejects unknown fields and returns a structured error
that names each invalid field, so an agent can correct the input without
guessing. Mutating operations accept an `idempotency-key` header, also as the
`--idempotency-key` flag. Reuse the same key only when retrying the same
intended change.

Inspect the operation catalog before constructing a request:

```bash
akua commands --resource clusters --json
akua commands --operation-id clusters.create --json
```

`akua commands` reports each operation's ID, method, path, summary, the human
usage line, and the JSON request shape.

## Use the CLI with a coding agent

When stdout isn't an interactive terminal, or when a known coding-agent
environment is present, the CLI uses compact agent-oriented output. `--json`
makes the output mode explicit. An agent should fetch
[the agent setup prompt](https://docs.akua.dev/agent-setup/prompt.md), ask for your goal, consult
`https://docs.akua.dev/llms.txt`, confirm the workspace with you, and request
approval before consequential actions.

Start that flow with the prompt on the [Quickstart](https://docs.akua.dev/quickstart.md).

## Author Packages

`akua pkg` provides Package authoring, validation, rendering, publishing, and
inspection commands through the same installed CLI:

```bash
akua pkg --help
akua pkg version --json
```

Package commands operate on local Package files. Generated `akua packages ...`
commands manage Package resources through the Akua API; the two namespaces have
different roles. See the [`akua pkg` command reference](https://docs.akua.dev/akua/cli.md) for every
Package command and its flags.

## Send feedback

Tell the Akua team what happened or what you would like to see:

```bash
akua feedback create --message "akua clusters list is slow"
```

The message goes to a private channel the team reads. It comes from the account
you are signed in with and arrives with that account's user ID and email and the
CLI's `User-Agent`, which names the CLI version, your operating system and
architecture, and the Bun version. Nothing else is attached: no token,
workspace, or file path. The command prints a receipt with exactly what was
sent. A message holds up to 1,500 characters, and each person can send a few per
minute.

To send the message from a file or a script, pass the JSON request, for
example `{"body":{"message":"..."}}`, with `--input`:

```bash
akua feedback create --input feedback.json
```

## Related topics

> [card] [Quickstart](https://docs.akua.dev/quickstart.md)
>
> Start from one prompt and choose a supported route.

> [card] [Agent setup](https://docs.akua.dev/agent-setup.md)
>
> Give a coding agent its CLI operating instructions.

> [card] [API reference](https://docs.akua.dev/apis/introduction.md)
>
> Review REST conventions, pagination, and errors.

> [card] [Authentication](https://docs.akua.dev/apis/authentication.md)
>
> Compare device sessions and workspace API tokens.
