lrc is a command-line tool for submitting local code diffs to LiveReview for AI-powered code review.
Only the staged diff bundle required for review is sent to LiveReview APIs. No full repository context is uploaded.
git-lrc now uses explicit boundaries for data handling:
storage/*: local file/DB persistence only (config, hook metadata, attestation DB/files, review outputs, self-update state files)network/*: outbound HTTP calls only (review submit/poll, connector APIs, auth refresh, provisioning, self-update manifest/binary fetch)
Transmission behavior:
- Review submission sends a zip/base64 of the selected diff (
/api/v1/diff-review) - Optional telemetry sends CLI usage ping (
/api/v1/diff-review/cli-used) - Connector setup/validation calls go to connector/auth endpoints when you run setup/UI flows
Local persistence behavior:
- Credentials and connector state are written to
~/.lrc.toml - Hook/attestation artifacts are written under
.git/lrc/... - Optional review artifacts are written only when you pass
--save-*flags
Retention and deletion:
- Local files are user-controlled and can be deleted directly from
~/.lrc.toml,~/.lrc/update/*, and.git/lrc/* - Server-side retention/training policy is governed by LiveReview backend policy; the CLI does not independently retain uploaded diff payloads after submission
To make confidentiality behavior explicit, the CLI uses two boundary packages:
storage/*: all local persistence (config files, hook/attestation files, sqlite mutations, output artifacts, self-update state)network/*: all outbound HTTP traffic (setup/provisioning, review submit/poll, connector proxy/auth refresh, self-update fetches)
This gives one place to audit what is written locally vs what leaves the machine.
Build the binary:
make build-localOr build directly:
go build -o lrc .Review staged changes:
lrc --api-key YOUR_API_KEYInstall pre-commit hooks for automatic code review:
# Install hooks
lrc hooks install
# Uninstall hooks
lrc hooks uninstall
# Force update existing lrc hooks
lrc hooks install --forceThe hooks will:
- Run
lrc review --stagedbefore each commit - Never block commits (always exits 0)
- Can be skipped with Ctrl-C
- Can be bypassed with
git commit --no-verify - Add a commit trailer:
LiveReview Pre-Commit Check: [ran|skipped]
-
Staged changes (default):
lrc --api-key YOUR_API_KEY --diff-source staged
-
Working tree changes:
lrc --api-key YOUR_API_KEY --diff-source working
-
Git range:
lrc --api-key YOUR_API_KEY --diff-source range --range HEAD~1..HEAD
-
From file:
lrc --api-key YOUR_API_KEY --diff-source file --diff-file my-changes.diff
You can provide configuration in three ways (in order of precedence):
- Command-line flags:
--api-key YOUR_API_KEY --api-url https://your-instance.com - Environment variables:
export LRC_API_KEY="your-api-key" LRC_API_URL="https://your-instance.com" - Config file: Create
~/.lrc.tomlwith:# Your LiveReview API key
api_key = "lr_example_token"
api_url = "https://manual-talent.apps.hexmos.com"
#### Setting Up Your Config File
```bash
# Copy the sample config
cp cmd/lrc/.lrc.toml.sample ~/.lrc.toml
# Edit with your credentials
vim ~/.lrc.toml
# Protect your API key
chmod 600 ~/.lrc.toml
# Now you can run lrc without any flags
lrc
All other flags can be set via environment variables or command-line flags.
| Flag | Environment Variable | Default | Description |
|---|---|---|---|
--repo-name |
LRC_REPO_NAME |
current dir basename | Repository name |
--diff-source |
LRC_DIFF_SOURCE |
staged |
Diff source: staged, working, range, or file |
--range |
LRC_RANGE |
Git range (e.g., HEAD~1..HEAD) for range mode |
|
--diff-file |
LRC_DIFF_FILE |
Path to diff file for file mode |
|
--api-url |
LRC_API_URL |
http://localhost:8888 |
LiveReview API base URL |
--api-key |
LRC_API_KEY |
(from config) | API key for authentication |
--poll-interval |
LRC_POLL_INTERVAL |
2s |
Interval between status polls |
--timeout |
LRC_TIMEOUT |
5m |
Maximum wait time for review |
--output |
LRC_OUTPUT |
pretty |
Output format: pretty or json |
--save-bundle |
LRC_SAVE_BUNDLE |
Save bundle to file for inspection before sending | |
--save-json |
LRC_SAVE_JSON |
Save JSON response to file after completion | |
--save-text |
LRC_SAVE_TEXT |
Save formatted text with comment markers to file | |
--save-html |
LRC_SAVE_HTML |
Save GitHub-style HTML review to file | |
--verbose, -v |
LRC_VERBOSE |
false |
Enable verbose output |
# Create config file with your API key and endpoint
cat > ~/.lrc.toml << EOF
# Your LiveReview API key
api_key = "lr_example_token"
# Your LiveReview API endpoint
api_url = "https://manual-talent.apps.hexmos.com"
EOF
# Protect your config file
chmod 600 ~/.lrc.toml
# Now you can run lrc without specifying the key or URL
lrc# Save the bundle for inspection before submitting
lrc --save-bundle bundle.txt
# Review the bundle file to see what will be sent
less bundle.txt# Save both JSON and formatted text output
lrc --save-json review.json --save-text review.txt
# Save HTML output for viewing in browser
lrc --save-html review.html
# Save all formats
lrc --save-json review.json --save-text review.txt --save-html review.html
# Search for comments in the text file
grep -n ">>>COMMENT<<<" review.txt
# Or use your editor's search function to jump between comments
vim review.txt # then search for: />>>COMMENT<<<
# Open HTML review in browser
xdg-open review.html # Linux
open review.html # macOS
start review.html # Windows# Run review with all inspection/output options
lrc \
--save-bundle bundle.txt \
--save-json review.json \
--save-text review.txt \
--save-html review.html \
--verbose
# Review the bundle that was sent
cat bundle.txt
# Check the raw JSON response
jq . review.json
# Navigate through comments in text file
# Search for ">>>COMMENT<<<" to jump between comments
vim review.txt
# Open HTML review in browser (best for visual inspection)
xdg-open review.html# Review all staged changes
git add .
lrc --api-key YOUR_API_KEY
# Review working directory changes (unstaged)
lrc --api-key YOUR_API_KEY --diff-source workinglrc --api-key YOUR_API_KEY --diff-source range --range HEAD~1..HEADgit diff main..feature-branch > changes.diff
lrc --api-key YOUR_API_KEY --diff-source file --diff-file changes.difflrc --api-key YOUR_API_KEY --output json > review-results.jsonlrc --api-key YOUR_API_KEY --verboseHuman-readable output with file sections and colored severity levels:
================================================================================
LIVEREVIEW RESULTS
================================================================================
Summary:
The code looks good overall. Minor suggestions below.
2 file(s) with comments:
--------------------------------------------------------------------------------
FILE: src/main.go
--------------------------------------------------------------------------------
[WARNING] Line 42 (best-practices)
Consider using context.WithTimeout instead of time.Sleep
[INFO] Line 89 (style)
Variable name could be more descriptive
================================================================================
Review complete: 2 total comment(s)
================================================================================
Machine-readable JSON output for automation:
{
"status": "completed",
"summary": "The code looks good overall. Minor suggestions below.",
"files": [
{
"file_path": "src/main.go",
"hunks": [...],
"comments": [
{
"line": 42,
"content": "Consider using context.WithTimeout instead of time.Sleep",
"severity": "warning",
"category": "best-practices"
}
]
}
]
}The lrc tool requires:
- A running LiveReview API server (default:
http://localhost:8888) - A valid API key (obtain from your LiveReview account settings)
The tool communicates with these endpoints:
POST /api/v1/diff-review- Submit diff for reviewGET /api/v1/diff-review/:id- Poll for review status/results
0- Success1- Error (network failure, invalid input, review failed, timeout, etc.)
You can provide the API key in three ways:
# Option 1: Config file (recommended)
echo 'api_key = "your-key"' > ~/.lrc.toml
# Option 2: Environment variable
export LRC_API_KEY="your-key"
# Option 3: Command-line flag
lrc --api-key your-keyUse --save-bundle to see exactly what will be transmitted:
lrc --save-bundle bundle.txt --verbose
# The bundle file contains:
# - Original diff content
# - Zip archive info
# - Base64 encoded payload (what the API receives)Use --save-text to get a searchable text file with markers:
lrc --save-text review.txt
# Search for comments:
grep ">>>COMMENT<<<" review.txt
# Or use editor search to jump between comments:
vim review.txt # then: />>>COMMENT<<<
code review.txt # then: Ctrl+F ">>>COMMENT<<<"Make sure you have uncommitted changes:
git status
git diff --staged # Check if there are staged changesCheck your API key:
echo $LRC_API_KEY
# or
lrc --api-key YOUR_API_KEY --verboseIncrease the timeout:
lrc --api-key YOUR_API_KEY --timeout 10mEnsure the LiveReview API server is running:
# Start the API server
./livereview api
# Or check if it's already running
curl http://localhost:8888/health