Metadata-Version: 2.4
Name: bodhi-cli
Version: 0.1.0
Summary: End-user CLI for Bodhi (the coding assistant). First capability: `bodhi explain <path>`.
License: Apache-2.0
License-File: LICENSE
Requires-Python: <3.13,>=3.12
Requires-Dist: anthropic<1.0,>=0.97
Requires-Dist: pydantic-settings<3,>=2.14
Requires-Dist: pydantic<3,>=2.13
Requires-Dist: rich<16,>=15
Requires-Dist: typer<0.26,>=0.25
Description-Content-Type: text/markdown

# bodhi-cli

End-user CLI for Bodhi — a coding assistant grounded in attestation + modular decomposition.

> **Pre-release.** This README documents commands that ship today; the package is at version `0.0.0` until the v0.1.0 trigger lands per ADR-0050. The empirical defenses of Bodhi's two non-negotiable wedges (modular decomposition + verifiability) are operator-gated and not yet published.

## Commands

- `bodhi explain <path>` — read a local code file, return a Claude-generated explanation rendered in the terminal with the project's design-token theme.
- `bodhi review [diff]` — review a unified diff file (or stdin when omitted) using Claude. Use `bodhi review -` to read from stdin explicitly.
- `bodhi commit-msg [diff]` — generate a Conventional-Commits-style commit message from a unified diff (file or stdin).
- `bodhi upgrade-self` — re-install `bodhi` from the workspace source so the PATH binary tracks `main`. Workspace-only convenience for contributors running from a checkout.
- `bodhi --version` (or `-V`) — print the package version and exit.
- `bodhi --help` — show the top-level help and exit.

## Configuration

`bodhi-cli` resolves required values (`ANTHROPIC_API_KEY`, `BODHI_ANTHROPIC_MODEL`, `BODHI_MAX_INPUT_BYTES`, and per-command `_MAX_TOKENS` caps) from these sources, in order — the first match populates `BodhiCliSettings`. Shell environment variables always win on top.

1. **Explicit override** — `BODHI_CONFIG_PATH=/path/to/config.toml`. Read as TOML.
2. **Workspace `infra/.env`** — relative to the current directory. Used by repo-cloned workflows.
3. **Workspace `.env`** — relative to the current directory. Same shape as `infra/.env`.
4. **User-scoped `~/.config/bodhi/config.toml`** — for pip-installed users with no repo clone. Honors `XDG_CONFIG_HOME` when set (e.g. `$XDG_CONFIG_HOME/bodhi/config.toml`).

The TOML schema uses lowercased env-var names as keys:

```toml
anthropic_api_key = "sk-ant-..."
bodhi_anthropic_model = "claude-haiku-4-5-20251001"
bodhi_max_input_bytes = 200000
bodhi_explain_max_tokens = 1024
bodhi_review_max_tokens = 1024
bodhi_commit_msg_max_tokens = 512
```

Recommended permissions for the user-scoped config: `chmod 600 ~/.config/bodhi/config.toml` (the file holds your Anthropic API key). The CLI does not enforce permissions — your filesystem, your call.

See `packages/bodhi_cli/src/bodhi_cli/settings.py` for the canonical surface.

## Documentation

- Reference: `docs/reference/cli/bodhi.md` — manual reference for each command.
- Decisions: ADRs at `docs/adr/` — the directional calls behind this surface live in ADR-0002 through ADR-0013, with ADR-0050 covering the release cadence and ADR-0060 covering license + open-frontier posture.
- Tutorials: `docs/tutorials/` — end-user learning paths (the v0.1.0 getting-started tutorial lands separately under issue tracking T1-E).

## License

Apache 2.0 — see `LICENSE` at the repository root. The wheel bundles `LICENSE` per Apache 2.0 §4(a) (T1-I per the v0.1.0 readiness spike at `docs/spikes/bodhi-cli-v0.1.0-readiness.md`).
