This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
crev is an interactive TUI code review tool written in Go. It displays git diffs in a two-pane interface (file tree sidebar + diff view) where users can add inline comments with severity levels, then submit structured JSON reviews. It integrates with Claude Code as a skill (/review) and command (/crev).
make build— compile thecrevbinarymake run— build and run locallymake install— build, codesign (macOS), and install to~/.claude/skills/review/with symlinks in~/.local/bin/make test— run all tests (go test -v ./...)make fmt— format code (go fmt ./...)make lint— lint withgolangci-lint runmake build-all— cross-compile for darwin/linux (amd64 + arm64)
Run a single test: go test -v -run TestName ./internal/diff/
cmd/crev/main.go — Entry point, CLI flags, git operations (status + diff)
internal/
diff/
types.go — Data structures: DiffResult, File, Hunk, Line
parser.go — Unified diff parser using regex
review/
types.go — Review, Comment, Severity types
output.go — JSON serialization of review output
tui/
app.go — Main bubbletea Model: state, Update(), View()
diff_view.go — Diff pane rendering (line numbers, +/- prefixes)
sidebar.go — File tree sidebar rendering
tree.go — Tree data structure & flat-list navigation
keys.go — Keybinding definitions
styles.go — lipgloss terminal styling/colors
- Bubbletea (Elm architecture): Model holds all state,
Update()handles messages,View()renders. View functions are pure and never modify state. - Mode-based input handling: The TUI has modes (Normal, Commenting, Help, Summary, QuitConfirm) that determine which keys are active in
Update(). - Focus system: Input routing switches between Sidebar and Main area focus.
- Tree → flat list: The file tree is converted to a flat list for keyboard navigation with
j/k. - Git integration: Uses
os/execto shell out togit statusandgit diff. Handles staged, unstaged, and untracked files.
-o output file, -d directory, -staged staged only, -json raw JSON output, -version