A code review CLI tool with a terminal UI, built with Bun and OpenTUI (the same TUI stack OpenCode uses: a Zig-native renderer + SolidJS components).
Local git state in the current directory — no network needed:
- working-tree changes vs
HEAD(staged + unstaged, combined): added / modified / deleted - untracked files (respects
.gitignore), shown as synthesized all-added diffs
bun install # install deps
bun dev # open the review TUI (needs a real terminal)
bun dev [path] # open the review TUI for a path/repo
bun dev --help # CLI help
bun run check # typecheck + unit tests + headless TUI smoke testYou can also run chert [path] to open the TUI directly in a specific project (or a subfolder inside a git repo; chert opens the repo root).
Keys inside the TUI:
No modes: if the prompt box is empty, keys control the screen; if it has text, typing and Enter go to the text.
Review screen (the files and diff fill the top; the agent's answer band, the prompt and a single hint line with the action buttons sit at the bottom):
| key | action |
|---|---|
Up / Down |
previous / next file |
Left / Right |
move across the action bar: Back · Next (Finish on the last file) |
Enter |
run the highlighted action |
Space |
approve or unapprove this file; approving moves to the next unapproved one |
| drag (mouse) | copy the lines you drag over to the clipboard, ready to paste into the prompt |
PgUp / PgDn |
scroll the answer pane |
Esc |
open or close the menu; dismiss a message; leave the done screen |
Ctrl+C |
quit |
A drag over the diff copies the lines (with their file and line numbers) and says
so; paste them into the prompt and the agent sees exactly what you highlighted.
The answer band scrolls with the mouse wheel or PgUp/PgDn, and dragging its
top edge makes it taller or shorter.
Home screen / recent projects (the start screen when you launch outside a git repo,
and Esc → Recent projects): the purple chert wordmark, then your recent projects.
The highlighted row is bold and accented; Up/Down moves it, Enter opens it.
| key | action |
|---|---|
Up / Down |
choose a project |
Enter |
open the highlighted project (or a typed path) |
Delete |
remove a recent project from the list (files untouched) |
Esc |
go back (only if a project is already open) |
Ctrl+C |
quit |
Done screen and menus: Up/Down choose, Enter go, Esc close.
Other:
Enterin the tree — open the selected file's diff in the review view/cd <name or path>— switch to a saved or new project/cd— list saved projects/cd -— return to the previous project/projects— list saved projects/forget <name or path>— remove a saved project (files untouched)Ctrl+C— quit (/quitalso works)
The > row at the bottom is the universal entry point (Claude Code-style):
/ runs commands, plain text talks to the opencode agent
in the current project directory. opencode must be installed; chert needs no API
keys. Pin a model once with /connect opencode <model> (or let opencode use its
own default).
By default chert calls the opencode CLI and lets it use its own background
service, so there is nothing to start. To use a server you run yourself (one
process owning sessions and tool state), start it with a known password and point
chert at it:
OPENCODE_PASSWORD=chert-dev opencode serve --port 4096
# in the terminal that runs chert:
export OPENCODE_PASSWORD=chert-dev
export CHERT_OPENCODE_SERVER=http://127.0.0.1:4096
bun dev
An explicit server needs OPENCODE_PASSWORD in chert's environment because a
standalone opencode serve prints a password on startup and refuses clients that
do not present it. CHERT_OPENCODE_SERVER accepts a URL or a bare host:port.
See docs/opencode.md for the session and server details.
<!-- commands:start -->
| command | what it does |
| --------------------------------------------------------------| ---------------------------------------------|
| /help | show this list |
| /home | open the menu |
| /refresh | re-scan the working tree |
| /open <query> | jump to a file (path match) |
| /run <command> | run a shell command in the current project |
| /cd <name or path> | switch project directory |
| /projects | list saved projects |
| /forget <name or path> | remove a saved project |
| /cwd | show the current project |
| /tree | show the whole project tree |
| /log | show this session's log |
| /highlights [clear [yes]] | list or clear highlights |
| /export | export review notes to markdown |
| /review [working\|staged\|branch [base]\|last\|commit <ref>] | what to review |
| /walk [fresh\|session-id] | guided review: an agent walks you through each file|
| /connect [connector [key\|model]] | connector status / save a key / pin an opencode model|
| /disconnect <connector> | remove a saved key or an opencode model pin |
| /use <connector> [model] | route plain-text prompts (opencode or a provider)|
| /models [connector] [filter] | list a provider's or opencode's models |
| /themes [name] | list or switch color theme |
| /quit | exit chert (Ctrl+C also works) |
<!-- commands:end -->
chert never writes to the repository it reviews; everything it saves is outside the working tree:
| path | contents |
|---|---|
~/.chert/projects.json |
recent projects |
~/.chert/theme.json |
the last theme you picked |
~/.chert/review-sources.json |
last review source per project |
~/.chert/connectors.json |
active connector and saved keys (mode 0600) |
<gitdir>/chert/highlights.json |
highlights per commit |
All of them honour CHERT_CONFIG_DIR for the ~/.chert directory, which is how
the tests stay hermetic.
Writes are atomic (temp file + rename), so a crash cannot leave a truncated file.
Plain-text prompts go to the opencode agent by default. /connect lists it with
the direct API providers, which all use OpenAI-compatible APIs:
opencode— the local CLI, no key./connect opencode <model>makes one real call with that model and saves it only if it answers;/connect opencodethen switches back to it with the saved pin./models opencodelists the built-inopencode/*models first./connect <id> <key>— save a provider key to~/.chert/connectors.json(chmod 600), or just export the env var/use <id> [model]— route plain-text prompts to a provider;/use opencodeswitches back to the local CLI with its saved model/models <id> [filter]— list a provider's or opencode's models/themes [name]— list or switch color theme (default, dark-contrast, whiteout, github)/home— open the menu/disconnect <id>— remove a saved key or opencode's model pin
| provider | id | key env var | default model |
|---|---|---|---|
| OpenRouter | openrouter |
OPENROUTER_API_KEY |
openai/gpt-4o-mini |
| Google Gemini | gemini |
GEMINI_API_KEY |
gemini-2.5-flash |
| Groq | groq |
GROQ_API_KEY |
llama-3.3-70b-versatile |
| NVIDIA NIM | nim (alias nvidia) |
NVIDIA_API_KEY |
meta/llama-3.3-70b-instruct |
bun run build # -> dist/chert (dist/chert.exe on Windows)The build uses @opentui/solid/bun-plugin to transform Solid TSX (see scripts/build.ts).
bun link # exposes `chert` on your PATH@opentui/core0.9 — renderer,<select>,<diff>,<code>,<scrollbox>…@opentui/solid0.9 +solid-js1.9 — component layerweb-tree-sitter0.25.10 — required peer dep for syntax highlightingtypescriptpinned to 5.8.3: newer TS (5.9.x) stack-overflows on this JSX type graphsrc/git.ts(the data layer) is synchronous (Bun.spawnSync): git calls are fast, and sync state updates render deterministically regardless of the renderer's event loopbunfig.tomlwas removed on purpose: compiled executables break on bunfig preloads, so the Solid TSX transform is registered programmatically insrc/index.tsinstead (ensureSolidTransformPlugin())tsconfig.jsonsetsjsxImportSource: "@opentui/solid"
bun run smoke # headless end-to-end test: seeds a temp git repo, mounts the
# TUI, drives it with mock keys, asserts rendered frames
bun test # unit tests (git layer, highlights, config, dial rows, projects)
bun run typecheck # tsc --noEmitFormatting is Prettier (bun run format); .git-blame-ignore-revs keeps the
formatting commit out of git blame.