# CLI

The easerix command line — tasks and links from your terminal, with device-code sign-in or an API key for CI.

Canonical: https://easerix.com/docs/developers/cli

<Answer label="What the CLI is">
`easerix` is a command-line client for your Easerix workspace: sign in once
with a device code, then list and create tasks and short links from the
terminal, with JSON output for scripting. In CI and other headless
environments, set `EASERIX_API_KEY` instead of signing in.
</Answer>

## Availability

The CLI currently ships to teams through GitHub releases on the private
Easerix repository — there's no public Homebrew tap or npm package yet. If
your team has repository access, install with an authenticated
[GitHub CLI](https://cli.github.com):

```bash
bash <(gh api repos/perizerlabs/easerix/contents/cli/install.sh --jq '.content' | base64 -d)
```

This downloads the latest release binary for your OS/architecture and installs
it to `/usr/local/bin` (override with `EASERIX_INSTALL_DIR`).

## Sign in

```bash
easerix login
```

The CLI uses a device-code flow — the same experience as `gh auth login`, so
it works over SSH and inside containers. It prints a code like
`ESRX-XXXX-XXXX`, opens the approval page in your browser (use `--no-browser`
to just print the URL), and finishes once you approve. Approval grants the CLI
**one workspace**; to switch workspaces, run `easerix login` again.

`easerix logout` signs out on this machine only. To revoke the connection
entirely: **account.easerix.com → Connected apps**.

Credentials are stored in your OS keychain when available, otherwise in
`~/.config/easerix/` (set `EASERIX_NO_KEYRING=1` to force file storage —
`easerix context` shows which backend is active).

## Commands

| Command | What it does |
|---|---|
| `easerix login [--no-browser]` | Sign in with a device code |
| `easerix logout` | Sign out on this machine |
| `easerix whoami` | Who you're signed in as, workspace, role, tools |
| `easerix context` | Active configuration and where each value came from |
| `easerix orgs list` | List every workspace you belong to |
| `easerix tasks teams` | List the workspace's teams |
| `easerix tasks issues [--team <key>]` | List issues, optionally one team's |
| `easerix tasks create <title> [--team <key>]` | Create an issue |
| `easerix links list` | List your short links |
| `easerix links create <url> [--title <t>]` | Create a tracked short link |

Every listing command takes `-o table` (default), `-o json`, or `-o plain`.
Exit codes: `0` success, `1` error, `2` cancelled, `4` authentication needed.

## Headless use: `EASERIX_API_KEY`

Set `EASERIX_API_KEY` to an [API key](/developers/overview#api-keys) and the
CLI skips the stored session entirely — it exchanges the key for a short-lived
access token automatically and re-exchanges as needed. Nothing is written to
disk, which makes it the right mode for CI:

```bash
EASERIX_API_KEY=esrx_o_... easerix links create https://example.com/launch -o json
```

Other environment variables:

| Variable | Purpose |
|---|---|
| `EASERIX_API_KEY` | Headless credential — takes precedence over any stored session |
| `EASERIX_NO_KEYRING` | Store tokens in files instead of the OS keychain |
| `EASERIX_AUTH_URL` | Override the auth server (defaults to `https://auth.easerix.com`) |

## Frequently asked questions

### Can I use the CLI in a container or over SSH?

Yes — that's what the device-code login is for. Run `easerix login
--no-browser`, open the printed URL on any machine, and enter the code. Or
skip login entirely with `EASERIX_API_KEY`.

### How do I script against the output?

Pass `-o json` and pipe to `jq`. `-o plain` gives tab-separated values for
shell tools.

### Which tools does the CLI cover?

Tasks and Links today, plus account commands (`whoami`, `orgs`, `context`).
For everything else, use the [REST APIs](/developers/api) directly.
