# Account and hosted: login, publish, hosted, bot

Sign in to repowise.dev from the terminal, publish a repo, read what is set up on the hosted side, and turn on the PR bot's reviews and coverage PR.

These commands connect the CLI to your repowise.dev account. Every local
feature works without signing in; signing in adds hosted indexing, the PR bot
and account status in `repowise doctor`. Provider keys for models are
separate (`--provider` and `--model` on the indexing commands).

## `repowise login`

Sign in to your repowise.dev account. By default it opens the hosted consent
page (OAuth with PKCE) and stores tokens at `~/.repowise/credentials.json`.

```bash
repowise login [OPTIONS]
```

| Name | Type | Default | Description |
|---|---|---|---|
| `--with-token` | boolean | `false` | Paste a personal API key (rw_live_...) instead of using the browser. Reads stdin when piped, otherwise prompts. For SSH and headless machines. |
| `--device` | boolean | `false` | Sign in without a browser on this machine: prints a code to approve at repowise.dev/device from any other device. |
| `--device-name` | string | `hostname` | Label for this machine in your connected apps. |

```bash
repowise login                                   # browser sign-in
repowise login --device                          # approve from another device
echo "$REPOWISE_API_KEY" | repowise login --with-token
repowise login --device-name "build-box"
```

## `repowise logout`

Sign out on this machine. Local credentials are always removed; the server
side revocation is best effort.

```bash
repowise logout
```

## `repowise whoami`

Show the account this machine is signed in to.

```bash
repowise whoami
```

## `repowise publish`

Put the repo you indexed locally on repowise.dev in one command. It reads the
GitHub `origin` remote and asks repowise.dev to index that repo there. Nothing
is uploaded from your machine, so only what you have pushed to GitHub is
published. A hosted index usually takes about 10 minutes, longer for big repos.

```bash
repowise publish [PATH] [OPTIONS]
```

| Name | Type | Default | Description |
|---|---|---|---|
| `PATH` | string | `.` | The repository directory. |
| `--ref` | string |  | Branch or tag on GitHub to publish. Default: the branch you are on if it is pushed, else the repo's default branch. |
| `--no-open` | boolean | `false` | Do not open the indexing page in the browser. |
| `--format` | table \| json | `table` | json prints the result as one object and never starts a browser sign-in (signed out reads as outcome signed_out). |

```bash
repowise publish                 # publish the repo in this directory
repowise publish --ref release   # publish another pushed branch
repowise publish --format json   # for an agent
```

Signed out, the table form runs the `repowise login` browser sign-in first (a
free account covers public repos). On success it opens the indexing page and
prints the repo page and the MCP address to add in Claude.ai or ChatGPT.

When repowise.dev cannot index the repo yet, the command says why and links
the next step:

| Situation | What the command links |
|---|---|
| Private repo on a free account | The repo's page, which offers Pro, then the GitHub App install, then the index |
| Private repo on a paid plan without the GitHub App | The GitHub App install |
| Free plan's repo limit reached | The Pro checkout |
| Repo too big for the plan | The size limit and the Pro limit |
| Daily index request limit, or a job already running | When to try again |
| No GitHub remote | Nothing is published: push the repo to GitHub first |

Plans and limits: [repowise.dev/pricing](https://repowise.dev/pricing).

## `repowise hosted`

Your repowise.dev account from this terminal: what is set up for a repo, and
the two PR bot steps an agent can finish once a person has installed the bot.
All three use the stored `repowise login` and never print a token.

| Subcommand | What it does |
|---|---|
| `status` | What is set up on repowise.dev for a repo (index, agent connection, PR bot, coverage) and what is left, with who does each step and its link. Changes nothing |
| `reviews on` | Turns on PR reviews for a repo the bot is installed on |
| `coverage-pr` | Has the bot open a draft PR that sets up coverage uploads for the repo. Merging it is yours to do |

### `repowise hosted status`

```bash
repowise hosted status [--repo OWNER/NAME] [--format table|json]
```

| Name | Type | Default | Description |
|---|---|---|---|
| `--repo` | OWNER/NAME |  | The repo to report on. Default: this checkout's GitHub origin, else the account's most recently active repo. |
| `--format` | table \| json | `table` | table prints for a person; json prints the platform's payload as it came. |

```bash
repowise hosted status --format json
```

An agent can run it as often as it likes to decide what to do next. Signed
out is a state, not a failure: the JSON is
`{"account": {"signed_in": false, "user": null}, "error": "signed_out", "message": "..."}`
and the exit code is `0`.

### `repowise hosted reviews on`

```bash
repowise hosted reviews on [--repo OWNER/NAME] [--format table|json]
```

### `repowise hosted coverage-pr`

```bash
repowise hosted coverage-pr [--repo OWNER/NAME] [--format table|json]
```

Both take `--repo` (default: this checkout's GitHub origin; with no origin,
pass `--repo`) and `--format`. The JSON is
`{"ok": true, "repo", "repo_id", "result"}` on success, or
`{"ok": false, "repo", "error", "message"}` when refused.

| `error` | Meaning and fix |
|---|---|
| `signed_out` | Run `repowise login` (or `repowise login --device`) |
| `not_installed` | The PR bot does not cover this repo. A person installs it at https://github.com/apps/repowise-bot/installations/new, then run the command again |
| `needs_plan` | AI review, or reviews on a private repo, need a paid plan. A person upgrades at https://repowise.dev/settings?tab=billing |
| `locked` | The organization's bot policy locks this setting. An admin changes it at https://repowise.dev/settings/bot |
| `forbidden` | This sign-in can read but not change settings. Run `repowise logout`, then `repowise login` with write access |
| `permission_needed` | The bot needs more GitHub permissions to open the PR. A person approves them on GitHub; `card` says which |
| `pending` | The bot did not finish in time and may still open the PR. Run the command again in a minute |
| `offline`, `unsupported`, `http_<status>` | repowise.dev was unreachable, does not offer this route, or refused the request |

### Exit codes

| Code | Meaning |
|---|---|
| `0` | Success, or (`status` only) signed out |
| `1` | Any `error` above other than a signed-out `status` |
| `2` | Usage error, such as a malformed `--repo` |

## `repowise bot`

The [PR bot](https://docs.repowise.dev/hosted/bot) on a GitHub repo: its state, and AI review on
or off. Needs `repowise login`. Built for agents: run `status`; when
`next.who` is `agent`, run its `action`; when it is `human`, hand the person
its `action` text and `url`, then run `status` again.

```bash
repowise bot status --format json
repowise bot ai on --depth deep --repo acme/api
repowise bot ai off
```

| Subcommand | What it does |
|---|---|
| `status` | The bot's state on the repo and the one next step. Reads only |
| `ai on` / `ai off` | AI review on, or only the free signal checks. AI review needs a paid plan and the bot's install claimed by you. Prints the new state and anything still in the way |

| Name | Type | Default | Description |
|---|---|---|---|
| `--repo` | OWNER/NAME |  | The repo. Default: this checkout's GitHub origin. |
| `--depth` | light \| auto \| deep |  | With ai on: how deep each AI review reads. Default: leave it as set (auto). |
| `--format` | table \| json | `table` | table for a person, json for an agent: every outcome is one JSON object. |

`status --format json` keys:

| Key | Contents |
|---|---|
| `bot` | `installed`, `enabled`, `unclaimed`, `code`, `claim_url`, `install_url`, `ai {on, code, mode, depth}`, `credit`, `last_review {pr_number, status, tier, reason, check_url}`, `coverage_received` |
| `plan`, `effective_tier`, `coverage` | The account plan and what it allows on this repo |
| `steps` | The bot and coverage setup steps |
| `next` | `{code, who, action, url, optional}`, or `null` when nothing is left |
| `complete` | `true` once PR reviews are on |

`ai --format json` carries `status`: the same object as `bot status` after
the change, or `null` when it cannot be read.

Exit codes: `0` nothing waits on a person; `3` a person's step is next (sign
in, install, claim, approve or pay: `next` says who, what and where); `1` an
error (offline, refused, or repowise.dev does not offer this yet); `2` `ai`
made the change but could not read the state after it.

## Next

- [Hosted quickstart](https://docs.repowise.dev/getting-started/quickstart-hosted) adds a repo and connects your agent.
- [PR bot quickstart](https://docs.repowise.dev/getting-started/quickstart-bot) installs the bot and turns on reviews.
- [Hosted overview](https://docs.repowise.dev/hosted/overview) explains what repowise.dev runs for you.
