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

# CLI Overview

> Install and configure the lim CLI, including the private beta package for staging validation.

# CLI Overview

The lim CLI lets you manage your entire accounting workflow from the terminal. Natural language input, financial reports, bank reconciliation, and AI agent integration -- all without opening a browser.

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install -g @lim-labs/lim
  ```

  ```bash pnpm theme={null}
  pnpm add -g @lim-labs/lim
  ```

  ```bash npx (no install) theme={null}
  npx @lim-labs/lim --help
  ```

  ```bash private beta theme={null}
  npm install -g @lim-labs/lim-beta
  lim-beta doctor
  ```
</CodeGroup>

Verify the installation:

```bash theme={null}
lim --version
# => lim/0.1.0
```

For staging validation, use the private beta package instead:

```bash theme={null}
lim-beta --version
lim-beta env
lim-beta auth login
```

## Authentication

lim uses OAuth via WorkOS. Run:

```bash theme={null}
lim auth login
```

This opens your default browser for authentication. Once you authorize, the CLI stores a token locally.

```bash theme={null}
lim auth whoami
# => ✅ tsumi@uselim.com (user_01ABC...)
```

To log out:

```bash theme={null}
lim auth logout
```

<Tip>
  Tokens are stored in `~/.config/lim/credentials.json`. The CLI automatically refreshes expired
  tokens.
</Tip>

## Configuration

The CLI reads configuration from three sources, in order of precedence:

1. **Command-line flags** -- highest priority
2. **Environment variables** -- prefixed with `LIM_`
3. **Config file** -- `~/.config/lim/config.json`

| Environment Variable | Flag        | Description                                      |
| -------------------- | ----------- | ------------------------------------------------ |
| `LIM_API_URL`        | `--api-url` | API base URL (default: `https://api.uselim.com`) |
| `LIM_COMPANY_ID`     | `--company` | Active company ID                                |
| `LIM_FORMAT`         | `--format`  | Output format: `table`, `json`, `csv`            |

### Setting the Active Company

Most commands require a company context. Set it once:

```bash theme={null}
lim companies use my-startup-inc
```

This writes the active company ID to your config file so you don't need to pass `--company` every time.

## Output Formats

All commands support three output formats:

```bash theme={null}
# Human-readable table (default)
lim reports tb --from 2026-01-01 --to 2026-12-31

# JSON for piping to other tools
lim reports tb --from 2026-01-01 --to 2026-12-31 --format json

# CSV for spreadsheets
lim reports tb --from 2026-01-01 --to 2026-12-31 --format csv
```

## Command Groups

| Group                   | Commands                                                                                      | Reference                                                                                                                                                                                                        |
| ----------------------- | --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Access & config         | `auth`, `doctor`, `env`                                                                       | [/cli/auth-and-diagnostics](/cli/auth-and-diagnostics)                                                                                                                                                           |
| Core bookkeeping        | `add`, `journals`, `reports`, `companies`, `accounts`, `dashboard`, `stats`                   | [/cli/add](/cli/add), [/cli/journals](/cli/journals), [/cli/reports](/cli/reports), [/cli/companies](/cli/companies), [/cli/accounts](/cli/accounts), [/cli/dashboard](/cli/dashboard), [/cli/stats](/cli/stats) |
| Cash conversion         | `invoices`, `payments`, `bank`, `docs`                                                        | [/cli/invoices-and-payments](/cli/invoices-and-payments), [/cli/banking](/cli/banking), [/cli/documents](/cli/documents)                                                                                         |
| Migration & filing      | `import`, `export`                                                                            | [/cli/import-and-export](/cli/import-and-export)                                                                                                                                                                 |
| People ops              | `employees`, `worker-contracts`, `payroll`, `expenses`, `approvals`, `members`, `withholding` | [/cli/people-and-payroll](/cli/people-and-payroll)                                                                                                                                                               |
| Dispatch & labor alerts | `dispatch`, `workers`                                                                         | [/cli/dispatch-and-workers](/cli/dispatch-and-workers)                                                                                                                                                           |
| Close & compliance      | `close`, `reopen`, `fx`, `labels`, `tax-codes`, `events`                                      | [/cli/periods-and-compliance](/cli/periods-and-compliance)                                                                                                                                                       |
| Planning & automation   | `contracts`, `assets`, `scenarios`, `accruals`                                                | [/cli/planning-and-automation](/cli/planning-and-automation)                                                                                                                                                     |

## Global Flags

| Flag              | Description                           |
| ----------------- | ------------------------------------- |
| `--help`, `-h`    | Show help for any command             |
| `--version`, `-V` | Show CLI version                      |
| `--company <id>`  | Override active company               |
| `--format <fmt>`  | Output format: `table`, `json`, `csv` |
| `--verbose`       | Show debug output                     |
| `--no-color`      | Disable colored output                |

## Shell Completions

Generate shell completions for your shell:

```bash theme={null}
# Bash
lim completion bash >> ~/.bashrc

# Zsh
lim completion zsh >> ~/.zshrc

# Fish
lim completion fish > ~/.config/fish/completions/lim.fish
```

## Staging validation checklist

For the private beta package, the fastest end-to-end validation flow is:

```bash theme={null}
lim-beta doctor
lim-beta auth login
lim-beta companies list
lim-beta companies use <company-id>
lim-beta accounts list
lim-beta reports tb --from 2026-01-01 --to 2026-12-31
```
