# Account

Commands that sign this computer in to minicut.ai, sign it out, and show which account it uses.

Most commands need this computer signed in to minicut.ai. Signed out, they print `You are not signed in. Ask your agent to run minicut login.` and exit with code 10. Flags every command takes, and every exit code, are on [Global options](/docs/cli/global-options).

These commands run signed out: `minicut` with no command, `open`, `login`, `logout`, `status`, `lang`, `doctor`, `setup`, `update`, `network`, `uninstall`, `install-skill` and `agent-rules`.

The CLI confirms the sign-in with minicut.ai at most once a day. Offline, a confirmed sign-in keeps working for 7 days. Each command then prints one line on stderr, such as:

```text Output
Offline: minicut.ai was last reached 2 days ago. Minicut keeps working offline for 5 more days.
```

After 7 days offline, commands stop with exit code 7 until minicut.ai answers again.

## minicut login

Signs this computer in to minicut.ai and saves its key.

### Usage

```text Usage
minicut login [--lang {en|zh}] [--device] [--json]
minicut login --complete [--json]
```

### Details

`minicut login` opens minicut.ai in your browser and waits up to 10 minutes while you sign in. When you are back, it saves the key for this computer and prints your account.

With `--device`, nothing has to open on this computer. The command prints an address and a code, then returns. Open the address on any computer or phone, sign in, and confirm the code. Then run `minicut login --complete` to finish. In an SSH session, or on Linux with no display, `minicut login` uses this code sign-in by itself.

`minicut login --complete` checks for up to 7 seconds. If you have not confirmed the code yet, it prints `Waiting for you to confirm on minicut.ai.` and the line to run again. Your agent runs it every 10 seconds until it says signed in. If you type `minicut login --device` in your own terminal, it waits for the code itself, with no second command.

A computer that is already signed in prints `Already signed in.` and the account, and changes nothing. The sign-in records this computer's name, its system and the CLI version. You see them on the **Devices** page of your account on minicut.ai.

On macOS the key goes in the Keychain. On Windows and Linux it goes in `auth.json` in your MiniCut home folder, readable only by you.

### Options

| Flag | Type | Default | Description |
|---|---|---|---|
| `--lang` | `en` or `zh` | the saved language, else `en` | The language of the sign-in page and the MiniCut app. Saved in `settings.json`, also on a computer that is already signed in |
| `--device` | switch | off | Sign in with an address and a code instead of opening a browser here |
| `--complete` | switch | off | Finish a `--device` sign-in after you confirm the code |
| `--json` | switch | off | Print one JSON line for each state |

### Examples

#### Sign in from your agent's shell

```bash Terminal
minicut login --device --lang en
```

It prints `Open this address in your browser:` (or `Opened minicut.ai in your browser.`), the address, `Code:` with the code, and the line to run when you have confirmed it.

#### Finish a code sign-in

```bash Terminal
minicut login --complete
```

When you have confirmed the code, it prints `Signed in.` and your account. Before that, it prints `Waiting for you to confirm on minicut.ai.`

### Output

With `--json`, each state is one line on stdout with a `state` field:

| `state` | When | Other fields |
|---|---|---|
| `waiting` | The browser sign-in started | `url`, `browser_opened`, `expires_in` (seconds) |
| `code_sent` | `--device` printed a code | `user_code`, `verification_uri`, `verification_uri_complete`, `expires_in`, `browser_opened`, `next_step` |
| `pending` | `--complete` found the code not yet confirmed | `next_step`, the command to run again |
| `signed_in` | The key is saved | `key_store` (`keychain` or `file`), `account`, and `already: true` when it was signed in before |

Exit code 0 means signed in, or waiting as planned. A refusal prints the error and exits with code 10:

| Message | What to do |
|---|---|
| `Sign-in was cancelled on minicut.ai.` | Run `minicut login` again and confirm on minicut.ai |
| `This sign-in code expired. Run minicut login again.` | Run `minicut login --device` again for a new code |
| `This computer was signed out on minicut.ai.` | Run `minicut login` again |

Exit code 7 means MiniCut could not reach minicut.ai. Connect to the internet and run the same command again.

## minicut logout

Signs this computer out and deletes its key.

### Usage

```text Usage
minicut logout [--json]
```

### Details

`minicut logout` asks minicut.ai to remove this computer's key, then deletes the key here, whatever the answer. Your projects, library and settings stay on this computer. If minicut.ai does not answer, this computer stays on the **Devices** page until you remove it there.

### Examples

#### Sign out

```bash Terminal
minicut logout
```

On a computer that is not signed in:

```text Output
Not signed in.
```

Signed in, it prints `Signed out.`

#### Sign out with JSON

```bash Terminal
minicut logout --json
```

```json Output
{"state":"signed_out","revoked":false,"was_signed_in":false}
```

### Output

`revoked` is `true` when minicut.ai removed the key. `was_signed_in` is `true` when this computer had a key. The exit code is always 0.

## minicut status

Shows the account, where the key is kept, the CLI version and whether the MiniCut app is running.

### Usage

```text Usage
minicut status [--json]
```

### Details

`minicut status` runs signed out. Signed in, it asks minicut.ai for the account each time. It also shows the last line of the install log, the MiniCut app's address on this computer, and whether automatic updates are on.

### Examples

#### Show the status

```bash Terminal
minicut status
```

It prints one line for each item in Details. Signed in, the first lines show your account.

#### Show the status as JSON

```bash Terminal
minicut status --json
```

It prints one JSON object with the fields below.

### Output

| Field | Description |
|---|---|
| `signed_in` | `true` when minicut.ai accepted this computer's key |
| `account` | The account, the same object `minicut me --json` prints, or `null` |
| `key_store` | `keychain`, `file`, or `null` when there is no key |
| `cli_version` | The installed CLI version |
| `install_log` | The last line of the install log, or `null` |
| `overrides` | Settings that change where the CLI connects. `[]` on a normal install |
| `app_address` | The address of the MiniCut app on this computer |
| `app_running` | `true` when the MiniCut app answers at that address |
| `auto_update` | `on`, the reason it is off when it is off, and the last and next update check |
| `error` | Only when minicut.ai refused the key or could not be reached |

Exit code 0, or 7 when this computer is signed in and minicut.ai could not be reached.

## minicut me

Shows the signed-in account.

### Usage

```text Usage
minicut me [--json]
```

### Details

`minicut me` asks minicut.ai every time, so it shows the account as it is now. It prints your account and this computer's name. A value minicut.ai did not send prints as `unknown`.

### Examples

#### Show the account

```bash Terminal
minicut me
```

On a computer that is not signed in:

```text Output
You are not signed in. Ask your agent to run minicut login.
```

#### Show the account as JSON

```bash Terminal
minicut me --json
```

On a computer that is not signed in:

```json Output
{"error":{"code":"signed_out","message":"You are not signed in. Ask your agent to run minicut login.","url":null,"request_id":null}}
```

### Output

Signed in, `--json` prints the account object. Exit code 0 when signed in, 10 when not, 7 when minicut.ai could not be reached.

## See also

[Setup](/docs/cli/setup) [Global options](/docs/cli/global-options) [Quickstart](/docs/cli/quickstart)
