Review local code changes organized into logical chapters with Stage CLI, a code review tool that works with any AI agent
triggers
["review my code changes in chapters","organize my git diff into reviewable sections","show me staged changes with stage cli","create a code review with stage","break down my local changes for review","review code changes by chapter","use stage to review uncommitted work","open stage review interface"]
Stage CLI is a code review tool that organizes local code changes into logical chapters and highlights what to review. It runs entirely on your local machine and works with any AI agent to help you review code before committing or creating pull requests.
Installation
Install globally via npm:
npm install -g stagereview
Or use directly with npx:
npx stagereview
Core Commands
Basic Review
Review your current changes (auto-detects what to review):
stage-chapters
This will:
Analyze your git repository
Detect staged/unstaged/untracked changes
Organize changes into logical chapters
Open a browser UI for review
Review Staged Changes Only
Review only changes that are staged for commit:
stage-chapters --ref staged
Review Unstaged Changes Only
Review only unstaged working directory changes:
stage-chapters --ref unstaged
Review All Working Changes
Review staged + unstaged + untracked files:
stage-chapters --ref work
Diff Against Specific Branch
Compare your changes against a specific base branch:
stage-chapters --base develop
stage-chapters --base feature/authentication
stage-chapters --base origin/main
Common Workflows
Pre-Commit Review
Before committing, review staged changes:
git add .
stage-chapters --ref staged
Feature Branch Review
Review all changes in your feature branch against main:
stage-chapters --base main --ref work
Quick WIP Check
Review what you've changed since last commit:
stage-chapters --ref unstaged
Cross-Branch Comparison
Compare your current branch against another feature branch:
--base main
--base origin/develop
--base abc123f
--base v1.2.0
--ref <mode>
Defines the scope of changes to review.
Options:
work - All local changes (staged + unstaged + untracked)
staged - Only changes in git staging area
unstaged - Only working directory changes not staged
Default: Auto-detects based on repository state
Examples:
--ref work
--ref staged
--ref unstaged
Integration with AI Agents
Stage CLI is designed to work seamlessly with AI coding agents. In your agent's chat interface:
/stage-chapters
Or with options:
/stage-chapters --ref staged --base develop
The agent can help you:
Interpret the review chapters
Identify potential issues
Suggest improvements
Explain complex changes
Programmatic Usage
While Stage CLI is primarily a command-line tool, you can integrate it into scripts:
#!/bin/bash# Review script for CI/local checks# Check if there are staged changesif git diff --cached --quiet; thenecho"No staged changes to review"exit 0
fi# Run Stage review
stage-chapters --ref staged
Stage CLI organizes changes into logical chapters based on:
File proximity - Related files grouped together
Change type - New files, modifications, deletions
Logical boundaries - Module/component boundaries
Change complexity - Similar complexity levels grouped
The browser UI shows:
Chapter overview with file lists
Contextual diff views
Review points and suggestions
Navigation between chapters
Troubleshooting
"Not a git repository" Error
Stage CLI requires a git repository. Initialize one:
git init
No Changes Detected
Verify you have changes:
git status
If using --ref staged, ensure files are staged:
git add <files>
Base Branch Not Found
Ensure the base reference exists:
git branch -a # List all branches
git log --oneline # Check commit history
Use a valid reference:
stage-chapters --base origin/main
Port Already in Use
Stage CLI starts a local web server. If the port is occupied, it will try alternative ports automatically. Close any conflicting applications if issues persist.
Large Diffs Timeout
For very large changesets, consider:
Review in smaller chunks:
stage-chapters --ref staged # Review staged first
stage-chapters --ref unstaged # Then unstaged
Split commits into smaller logical units
Use more specific base branches
Browser Doesn't Open
Manually open the URL shown in terminal output (typically http://localhost:3000 or similar).
Best Practices
1. Review Early and Often
Run Stage reviews before commits, not just before PRs:
# After making changes
git add -p # Interactively stage
stage-chapters --ref staged # Review staged
git commit
2. Use Appropriate Scope
Match the --ref option to your workflow:
Before commit: --ref staged
Checking progress: --ref unstaged
Full feature review: --ref work --base main
3. Leverage Chapter Organization
Use chapters to:
Review related changes together
Spot unintended cross-module coupling
Identify missing changes in related files
4. Combine with AI Agent Review
Let the AI agent analyze Stage's output:
Review the chapters from Stage CLI and identify:
1. Potential bugs or edge cases
2. Missing error handling
3. Inconsistent patterns
5. Pre-PR Workflow
Before creating a pull request:
# Ensure all changes are committed
git add -A
git commit -m "Feature complete"# Review full feature against main
stage-chapters --base main
# Address review findings# Create PR
Advanced Usage
Reviewing Specific File Patterns
Stage reviews all changes, but you can prepare specific changes:
# Review branch A vs main
git checkout feature-a
stage-chapters --base main
# Review branch B vs main
git checkout feature-b
stage-chapters --base main
Integration with Git Hooks
Add to .git/hooks/pre-commit:
#!/bin/bash# Launch Stage review before commit
stage-chapters --ref staged
read -p "Proceed with commit? (y/n) " -n 1 -r
echoif [[ ! $REPLY =~ ^[Yy]$ ]]; thenexit 1
fi
The full Stage experience on the website offers additional features like team collaboration, persistent reviews, and integration with GitHub pull requests.