Skip to content

teotomic/ai-review

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Review

A browser-based code and document review tool. Point it at a local git repository, annotate diffs or source files with comments, then export the annotated output to paste into an AI agent.

Purpose

When working with an AI agent on a codebase, you often need to give targeted, structured feedback — "this function is wrong for this reason", "this section needs to be rewritten", "keep this part but change that". AI Review makes that workflow concrete:

  1. Open the tool against your repo
  2. Browse diffs between commits, or explore the current working tree
  3. Select lines and attach comments
  4. Export everything as a formatted block ready to paste back to the agent

Usage

Start

REPO_PATH=/path/to/your/repo docker compose up --build

Then open http://localhost:8080.

REPO_PATH is the only required variable. The repo is mounted read-write. The tool writes review files to .ai-review/ but never modifies source files.

Tabs

Diff

Compare any two refs. The header has two dropdowns:

[base commit]  →  [target commit or Working Directory]

The default is HEAD → Working Directory, which shows all uncommitted changes.

  • Click a line to start a selection; shift-click to extend it
  • Click + Add comment below the selection to attach a note
  • Comments are saved to localStorage keyed by the base/target pair, so they survive page reloads

Comments

A flat list of all comments on the current diff, grouped by file. Each card shows the diff context and the comment text, with edit and delete actions.

Files

A working-tree explorer. The left sidebar shows the full file tree (tracked files from git ls-files) with collapsible directories.

  • Click any file to open it with syntax highlighting
  • Selection and commenting work the same way as in the Diff tab
  • For Markdown files, a Preview button toggles a split-pane view

Markdown split pane

When a .md file is open and Preview is active, the pane splits:

  • Left: annotatable source with line numbers
  • Right: rendered Markdown, including syntax-highlighted code blocks and Mermaid diagrams

Selecting text in the preview maps back to the source. A tooltip shows which source lines correspond to your selection, and those lines are highlighted in the left pane so you can attach a comment directly.

Export

Click Export in the header to open a modal with all comments formatted for an AI prompt. Click Copy to copy to clipboard.

Each diff comment renders as:

### src/foo.ts

```diff
@@ -40,6 +40,7 @@
 context line
-removed
+added

your comment here


Each file comment renders as:

docs/design.md (lines 12–18)

the selected source lines

your comment here


Paste the exported block into your AI conversation as review feedback.

### Review Files

Click **Save Review** in the Export modal to write comments to `.ai-review/YYYY-MM-DD-<hash>.md` in the repo. The file includes YAML frontmatter with the target git hash.

To integrate with Claude Code, add this to your project's `CLAUDE.md`:

When starting work, check .ai-review/ for pending review feedback. Each review file targets a specific git hash (in the frontmatter). Address open comments, then delete the review file when done.


The Export modal also shows existing review files and indicates whether commented files have changed since the review was written.

## Architecture

docker compose up | FastAPI (port 8080) /api/info branch, HEAD hash and message /api/commits last 50 commits for the dropdowns /api/diff git diff [] /api/tree git ls-files (for the file explorer) /api/file raw file contents /* Vite-built React app (static)

React frontend parseDiff.ts unified diff → typed file/hunk/line tree storage.ts localStorage helpers (diff comments keyed by base:target, file comments keyed by headHash)


The repo is mounted at `/repo` inside the container. All git operations run against that path. Review files are written to `.ai-review/` inside the repo.

## Development

Run the backend and frontend separately for a faster iteration loop:

```bash
# Backend
cd backend
pip install -r requirements.txt
REPO_PATH=/path/to/repo uvicorn main:app --reload --port 8080

# Frontend (in a separate terminal)
cd frontend
npm install
npm run dev   # proxies /api/* to localhost:8080

About

Diff utility for reviewing output of AI tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors