# Other commands

One-shot repowise utilities including costs, next, overlap, dead-code, security scan, doctor, whats-new, export, telemetry, login, publish and delete.

## `repowise costs`

LLM cost history. Aggregates calls made during `init` and `update`.

```bash
repowise costs [PATH] [OPTIONS]
```

| Name | Type | Default | Description |
|---|---|---|---|
| `--since` | string |  | Only show costs since this date (ISO format, e.g. 2026-01-01). |
| `--by` | string | `operation` | Group by: operation, model, day |
| `--repo-path` | string |  | Repository path. Defaults to the current directory. |
| `--repo` | string |  | Workspace repo alias to query (implies workspace mode). |
| `--all` | boolean | `false` | In workspace mode, sum costs across every repo instead of just the primary. |
| `--no-workspace` | boolean | `false` | Force single-repo mode even when invoked from a workspace. |
| `--format` | string | `table` | Output format. |

```bash
repowise costs
repowise costs --since 2026-01-01 --by model
repowise costs --by day
repowise costs --repo backend --format json
repowise costs --all
```

---

## `repowise next`

The few things worth doing next, ranked from what the index already
stores: health, fix history, performance, security, doc drift, dead code,
decisions and coverage. Each row has its reason, effort, what done looks
like, and a command when one applies. It is the same list as the
dashboard's **Do next** and `get_overview`'s `next_actions`.

```bash
repowise next [PATH] [OPTIONS]
```

| Name | Type | Default | Description |
|---|---|---|---|
| `--horizon` | string |  | week or quarter. Default: the week, or the quarter when the week holds no work. |
| `--all` | boolean | `false` | Show up to 20 rows, not 5. |
| `--format` | string | `table` | table or json (the whole stored view). |
| `--repo` | string |  | In workspace mode, target one repo. |
| `--no-workspace` | boolean | `false` | Force single-repo mode. |

`repowise status` ends with a short **Next** block pointing here.

---

## `repowise overlap`

Which other branches edit the files this change edits. Git alone answers
it, so it works in a fresh clone with no index; an index orders the shared
files and adds co-change partners. Each row says its basis in words
(`same file` or `co-change pair, N of M commits`). There is no score.

```bash
repowise overlap                           # who else is editing what you are editing
repowise overlap --base main --limit 100   # a wider scan
```

| Name | Type | Default | Description |
|---|---|---|---|
| `--base` | string |  | Base ref. Default: the repository's trunk. |
| `--branch` | string | `HEAD` | The change to compare. |
| `--limit` | number | `50` | How many branches to diff, newest committer date first. |
| `--path` | string |  | Repo path (defaults to cwd). |
| `--format` | string | `table` | table or json |

---

## `repowise dead-code`

Detect unused code via the dependency graph. No LLM calls. With an index at
HEAD it reads the findings the last `init` or `update` stored, in the same
order as MCP and the web UI; with no index, an index behind HEAD, or a lower
confidence floor than the stored run used, it analyzes the working tree live.
On a language whose dead-code layer is still in preview, the output ends with
one line naming the measurement behind it. Confidence starts from git age (see
[the ladder](https://docs.repowise.dev/intelligence/dead-code#the-git-age-confidence-ladder)), and Apex
findings are review-only.

```bash
repowise dead-code [PATH] [OPTIONS]
```

| Name | Type | Default | Description |
|---|---|---|---|
| `--min-confidence` | number | `0.4` | Minimum confidence threshold. |
| `--safe-only` | boolean | `false` | Only show deletion-ready findings (high confidence, no runtime-load risk). |
| `--kind` | string |  | unreachable_file, unused_export, unused_internal, zombie_package |
| `--format` | string | `table` | Output format: table, json, md |
| `--include-internals` | boolean | `false` | Detect unused private/internal symbols. |
| `--include-zombie-packages` | boolean | `true` | Detect monorepo packages with no importers. |
| `--no-unreachable` | boolean | `false` | Skip detection of unreachable files. |
| `--no-unused-exports` | boolean | `false` | Skip detection of unused exports. |
| `--repo` | string |  | Workspace repo alias to analyze (implies workspace mode). |
| `--no-workspace` | boolean | `false` | Force single-repo mode even when invoked from a workspace. |

```bash
repowise dead-code
repowise dead-code --safe-only
repowise dead-code --kind unused_export --format json
repowise dead-code --include-internals --min-confidence 0.8
```

The agent-facing equivalent is [`get_dead_code`](https://docs.repowise.dev/mcp/get-dead-code).

---

## `repowise security scan`

Scan for security signals (secrets, risky patterns) and persist findings to
the local store.

```bash
repowise security scan [OPTIONS]
```

| Name | Type | Default | Description |
|---|---|---|---|
| `--history` | boolean | `false` | Scan the full git history, not just the current working tree. |
| `--since` | string |  | Lower git revision bound (exclusive). Defaults to all history. |
| `--to` | string |  | Upper git revision bound (inclusive). Defaults to all history/HEAD. |
| `--path` | string |  | Repo path (defaults to cwd / workspace primary). |
| `--all-patterns` | boolean | `false` | History mode: also report code-smell patterns (eval, os.system, weak hashes, ...). By default history mode reports only leaked-secret patterns. |
| `--format` | string | `table` | Output format. json is the machine-readable summary. |

```bash
repowise security scan --history                       # walk the whole history
repowise security scan --history --since v1.0 --to HEAD
repowise security scan --history --all-patterns --format json
```

To gate a pull request on the findings it adds, use
[`repowise security check`](https://docs.repowise.dev/cli/gates#repowise-security-check).

> **Note**
>
> Without `--history` this is a no-op stub: working-tree scanning already runs
> automatically during `repowise init`/`repowise update`. `--history` is what
> finds secrets that were committed and later deleted, something the
> working-tree scan cannot see. Findings land in the `security_findings` table
> and show up in `repowise server`'s security API and UI. Re-running is
> idempotent.

---

## `repowise doctor`

Health check. Validates: git repo, `.repowise/` directory, database,
`state.json`, provider config, stale pages, and store consistency
(SQL/vector/FTS sync).

```bash
repowise doctor [PATH] [OPTIONS]
```

| Name | Type | Default | Description |
|---|---|---|---|
| `--repair` | boolean | `false` | Attempt to fix detected mismatches. |
| `--workspace / -w` | boolean | `auto-detect` | Run the checks against every repo in the workspace. |
| `--no-workspace` | boolean | `false` | Force single-repo mode from a workspace root. |
| `--format` | string | `table` | table or json. json is read-only (not with --repair) and exits 1 when any check fails. |

```bash
repowise doctor
repowise doctor --repair
repowise doctor --format json
```

`--format json` prints `{"ok": bool, "checks": [...]}`. Each check carries a
stable `id` (such as `post-commit-hook` or `mcp-responds`), a display `name`, a
`level` (`ok`, `warn` or `fail`), a `detail` and a `fix`: the exact command that
resolves it, or `null`. Match on `id`, since names can change; a `warn` never
changes the exit code.

> **Note**
>
> **First port of call when something looks wrong.** `--repair` fixes
> the common mismatches automatically.

### CLI version check

`doctor` also prints a best-effort `CLI version` row that compares your
installed CLI against the latest release on [PyPI](https://pypi.org/project/repowise/).
When an update is available it shows the right upgrade command for your
install method (`uv tool upgrade repowise`, `pipx upgrade repowise`, or
`python -m pip install -U repowise`). It surfaces both the `repowise` resolved
on your `PATH` and the command that launched the current process, since these
can differ, which is useful when an MCP client is running a stale executable.

This row is **advisory only**: it never updates anything automatically, never
fails `doctor` when PyPI is unreachable, and an unparsable latest version is
reported as "unknown" rather than a false "up to date".

> **Note**
>
> After upgrading, **restart Claude/Codex/Cursor or any MCP client** so it picks
> up the new executable.

---

## `repowise grammars fetch`

Download the grammars that otherwise download on first use (COBOL, Apex) into
a directory, for a machine with no network. Copy the directory over and set
`REPOWISE_GRAMMAR_DIR` to it. Exits 1 if any grammar fails.

```bash
repowise grammars fetch ./grammars
```

---

## `repowise whats-new`

Show release notes for repowise versions you haven't seen yet. By default it
lists releases newer than the last one you viewed, then records the current
version as seen. Works **offline** from the changelog bundled with the install.

```bash
repowise whats-new [OPTIONS]
```

Each release leads with its highlights and a one-line "By the numbers" (pull
requests, contributors, files and lines changed). After a minor upgrade the
web dashboard opens the same notes once.

| Name | Type | Default | Description |
|---|---|---|---|
| `--version` | string |  | Show notes for a single release (e.g. 0.59.0). |
| `--all` | boolean | `false` | Show the full changelog history. |
| `--format` | string | `table` | table or json. JSON carries each selected release with its summary, highlights and stats. |

```bash
repowise whats-new                       # what changed since you last looked
repowise whats-new --version 0.59.0      # one specific release
repowise whats-new --all                 # full history
```

> **Note**
>
> `repowise update` shows a short "what's new" panel automatically after you
> upgrade to a newer version, and both `update` and `serve` print a one-line,
> non-blocking notice when a newer release is available. See
> [Upgrading](https://docs.repowise.dev/upgrading) for the full upgrade flow.

---

## `repowise plugins`

List the plugins repowise loaded, from `repowise.plugins` entry points and
the `REPOWISE_PLUGINS` variable, whether each loaded or why it failed, the
seams each registered, and the implementation chosen for each named seam.

```bash
repowise plugins [--format table|json]
```

A plugin can add commands but never replaces a built-in one. A seam switches
implementation through `REPOWISE_SEAM_<NAME>` (see
[Environment variables](https://docs.repowise.dev/installation/env-vars#plugins-and-seams)). A
repository's `.repowise/.env` cannot select plugins or seams.

---

## `repowise export`

Export wiki pages to files.

```bash
repowise export [PATH] [OPTIONS]
```

| Name | Type | Default | Description |
|---|---|---|---|
| `--format` | string | `markdown` | Output format: markdown, html, json, structurizr. structurizr writes one Structurizr DSL file describing the architecture instead of a directory of wiki pages. |
| `--output / -o` | string | `.repowise/export` | Output directory. For --format structurizr, a path ending in .dsl names the file itself. |
| `--full` | boolean | `false` | Include decisions, dead code, git metadata, and provenance in the JSON export. |
| `--standalone` | boolean | `false` | structurizr only: emit a complete workspace with default views instead of a model fragment to include from your own workspace.dsl. |
| `--components` | boolean | `false` | structurizr only: include the component level (one box per directory). |
| `--no-externals` | boolean | `true (externals included)` | structurizr only: leave third-party dependencies out of the model. |
| `--force` | boolean | `false` | structurizr only: overwrite the output file even if repowise did not write it. --standalone targets workspace.dsl, which may be your own. |

```bash
repowise export
repowise export --format html -o ./docs/wiki
repowise export --format json --full -o /tmp/backup
repowise export --format structurizr -o architecture.dsl
repowise export --format structurizr --standalone --components -o workspace.dsl
```

---

## `repowise generate-claude-md`

Regenerate `CLAUDE.md` from the index. Your own content outside the
repowise markers is never modified; the managed block between them is
rewritten. The block is lean by default, and `editor_files.sections` in
`config.yaml` adds or drops sections; see
[The `editor_files:` block](https://docs.repowise.dev/installation/configuration#the-editor_files-block).

```bash
repowise generate-claude-md [PATH] [OPTIONS]
```

| Name | Type | Default | Description |
|---|---|---|---|
| `--output` | string |  | Write to a custom path. Default: .claude/CLAUDE.md |
| `--stdout` | boolean | `false` | Print to stdout instead of writing a file. |
| `--workspace / -w` | boolean | `false` | Generate workspace-level CLAUDE.md at the workspace root. |

```bash
repowise generate-claude-md
repowise generate-claude-md --workspace
repowise generate-claude-md --stdout > preview.md
```

---

## `repowise telemetry`

Inspect and control anonymous, opt-out usage telemetry.

```bash
repowise telemetry status                # show whether telemetry is enabled, and why
repowise telemetry enable
repowise telemetry disable
```

## `repowise config hints`

Now and then, at a moment where it would help (a finished `init`, a slow
`update`, `ask` with no LLM key), the CLI prints one dim line on stderr about
what repowise.dev adds, with a link. At most one per run, each at most once a
week. Never under `--format json`, in CI, when stderr is not a terminal, when
you are signed in, or from `mcp`, `serve`, `watch` and hooks.

```bash
repowise config hints off       # also: REPOWISE_NO_HINTS=1 or DO_NOT_TRACK=1
repowise config hints on
```

---

## `repowise login`

Sign in to your hosted repowise.dev account. Unrelated to LLM provider keys
(`--provider`/`--model` elsewhere). This adds the hosted layer: indexed
repos on repowise.dev, reindex from local tools, and account status in
`doctor`. Every local feature works without signing in.

Sign-in is browser-based OAuth with PKCE by default: the command opens the
hosted consent page and stores tokens at `~/.repowise/credentials.json`.

| Name | Type | Default | Description |
|---|---|---|---|
| `--with-token` | boolean | `false` | Paste a personal API key (rw_live_...) instead of using the browser. For SSH/headless machines. |
| `--device-name` | string |  | Label this machine in your connected apps (default: hostname). |

```bash
repowise login                           # browser sign-in
repowise login --with-token              # headless, paste an API key
repowise login --device-name "build-box"
```

## `repowise logout`

Sign out of your Repowise account on this machine (best-effort server-side
revocation, local credentials always removed).

```bash
repowise logout
```

## `repowise whoami`

Show the Repowise 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**; local uncommitted or unpushed changes are not. A hosted index
usually takes about 10 minutes, longer for big repos.

Signed out, it runs the `repowise login` browser sign-in first (a free account
is enough for 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 can't index it 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 starts the Pro trial (10 days free, card required), then the GitHub App install, then the index |
| Private repo on Pro or Teams without the GitHub App | The GitHub App install |
| Free plan's 2-repo limit | The Pro trial checkout (5 repos, private ones too) |
| Repo too big for the plan | The size limit and the Pro limit |
| 10 index requests a day, or a job already running | When to try again |
| No GitHub remote | Nothing is published: push the repo to GitHub first |

| Name | Type | Default | Description |
|---|---|---|---|
| `--ref` | string |  | Branch or tag on GitHub to publish (default: the branch you are on if it is pushed, else the default branch). |
| `--no-open` | boolean | `false` | Don't 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. |

```bash
repowise publish                 # publish the repo in this directory
repowise publish --ref release   # publish another pushed branch
repowise publish --no-open
```

[What repowise.dev adds over the CLI](https://repowise.dev/hosted)

---

## `repowise augment`

Internal hook command. Runs as a Claude Code `PreToolUse` /
`PostToolUse` hook to enrich `Grep` and `Glob` calls with related
files, top symbols, importers, and dependencies. Detects git commits
and notifies when the wiki is stale.

```bash
repowise augment        # stdin hook mode
```

> **Warning**
>
> Don't invoke `augment` directly. `repowise init` wires it into
> `~/.claude/settings.json` automatically.

---

## `repowise delete`

Delete a repository's stored index and generated data (not the source
files). Interactive picker when `REPO_ID` is omitted.

```bash
repowise delete [REPO_ID] [OPTIONS]
```

| Name | Type | Default | Description |
|---|---|---|---|
| `--path / -p` | string |  | Path to the repository directory. |
| `--force / -f` | boolean | `false` | Skip the confirmation prompt. |

```bash
repowise delete                     # pick from a list
repowise delete abc123def456        # delete by repo id
repowise delete --path ../backend --force
```

> **Note**
>
> This only removes what's in `.repowise/wiki.db` (pages, FTS index) for the
> chosen repo. For a full cleanup of everything repowise has written for a
> repo, including agent wiring and machine-wide state, see
> [`repowise uninstall`](https://docs.repowise.dev/cli/uninstall).
