critiq-cli
v0.1.1
Published
Critiq — Zero-noise AI Code Review Agent for developers. CLI-first. Pipe `git diff` and get AI-powered reviews in Chinese.
Downloads
201
Maintainers
Readme
Critiq — Zero-noise AI Code Review Agent
Critiq brings AI-powered code review to your terminal — focused, low-noise, and language-agnostic.
One principle: catch real bugs, security flaws, and performance issues. Skip the style nitpicks.
Quick Start
# via npm (recommended)
npx critiq-cli < diff.patch
# via install script
curl -fsSL https://raw.githubusercontent.com/DrfterX/critiq/main/scripts/install.sh | bash
# review current changes
git diff HEAD | critiqSet CRITIQ_API_KEY (any OpenAI/Anthropic-compatible API) and you're ready.
Why Critiq?
Critiq is not just "an AI wrapper around DeepSeek". It's a carefully designed code review tool that solves real problems:
vs. Just asking an AI ("review this code")
| | Direct AI Prompt | Critiq |
|---|:---:|:---:|
| Noise control | None — AI lists everything it notices | Hard cap at 3 comments, silence when nothing is wrong |
| Consistency | Depends on how you phrase the prompt | Stable prompt engineering, same rules every time |
| Structured output | Random format, needs manual parsing | Standardized JSON: severity + confidence + score |
| Severity/Confidence | You judge yourself | high/medium/low + critical/warning/info on every comment |
| Ready to use | Need to write prompt, parse result, integrate | git diff HEAD \| critiq — done |
In short: Critiq is what you get when you take a generic AI and tune it specifically for code review — noise-cancelled, structured, and ready to use.
vs. Other Code Review Tools
| Feature | Critiq | CodeRabbit | PR-Agent | |---------|--------|------------|----------| | Noisiness | ≤3 comments, real issues only | 10+ comments, noisy | Configurable | | Pricing | Free + CLI / $9 mo SaaS | $12/mo+ | $29/mo+ | | Model | DeepSeek V4 Flash | Proprietary | GPT-4 | | Confidence Tag | ✅ high/medium/low | ❌ | ❌ | | Local / Offline | ✅ CLI runs anywhere | ❌ SaaS only | ❌ SaaS only | | Language | Chinese-first reviews | English | English |
Installation
npm (recommended)
npm install -g critiq-cliOne-line install (no npm account needed)
curl -fsSL https://raw.githubusercontent.com/DrfterX/critiq/main/scripts/install.sh | bashWhat the script does:
- ✅ Checks Node.js >= 18
- ✅ Clones Critiq to
~/.critiq/ - ✅ Installs dependencies & builds
- ✅ Registers
critiqglobally - ✅ Adds to
~/.bashrc/~/.zshrcPATH
Manual
git clone --depth 1 https://github.com/DrfterX/critiq.git ~/.critiq-source
cd ~/.critiq-source
npm install --silent && npm run build && npm linkCLI Usage
# review current uncommitted changes
git diff HEAD | critiq
# review a specific commit
git show <commit> | critiq --pr-title "Commit message"
# review a PR diff
curl -L https://github.com/owner/repo/pull/123.diff | critiq --pr-title "Fix bug" --repo owner/repo --pr-number 123
# JSON output for CI integration
git diff main HEAD | critiq --json | jq '.comments'
# review from a file
critiq --file changes.diff --pr-title "My PR"GitHub Action (one-minute setup)
Create .github/workflows/critiq-review.yml in your repo:
name: Critiq Code Review
on: [pull_request]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
critiq-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Critiq Review
uses: DrfterX/critiq/.github/actions/critiq-review@main
with:
api-key: ${{ secrets.CRITIQ_API_KEY }}
github-token: ${{ secrets.GITHUB_TOKEN }}Then add CRITIQ_API_KEY to your repo's Secrets.
Features
✅ Current
- [x] CLI review:
git diff | critiq— review local code changes - [x] GitHub Action: zero-config CI integration, posts inline comments on PRs
- [x] Confidence scoring: every comment tagged high/medium/low
- [x] Chinese-first output: reviews in Chinese, code stays in English
- [x] JSON mode:
--jsonfor CI/script integration
🚧 Roadmap
- [ ] GitHub App: auto-review via Cloudflare Workers
- [ ] Web Dashboard: review history in the browser
- [ ] VS Code Extension: in-editor instant review
- [ ] GitLab / Bitbucket support
Options
USAGE:
critiq [options] # read diff from stdin
critiq --file <path> # read diff from file
cat diff.diff | critiq # pipe
OPTIONS:
-f, --file <path> Read diff from file
-t, --pr-title <text> PR title (default: "Local Code Review")
-b, --pr-body <text> PR description (optional)
-r, --repo <name> Repo name (default: "local/repo")
-n, --pr-number <num> PR number (default: 0)
-j, --json Raw JSON output only
--max-diff <bytes> Max diff size (default: 40000)
-h, --help Show help
ENVIRONMENT:
CRITIQ_API_KEY Required. API key for any compatible provider.
CRITIQ_API_BASE API base URL (default: https://api.deepseek.com/v1)
CRITIQ_MODEL Model name (default: deepseek-chat)How It Works
- Read diff (stdin or file)
- Build review prompt with
buildReviewPrompt()— diff context + review rules - Call AI API (DeepSeek / any compatible provider)
- Parse JSON response, apply safety limits (≤3 comments, score 1-10)
- Output review (pretty or JSON)
Cost
DeepSeek V4 Flash costs ~$0.01/million tokens:
- 200-line diff → ~2K tokens
- Per review cost: ~$0.00002
- 1000 reviews/month: ~$0.02
Development
git clone https://github.com/DrfterX/critiq.git
npm install
npm run typecheck
npm test
# local use
export CRITIQ_API_KEY=sk-xxx
git diff HEAD | npx tsx src/cli.tsProject Structure
critiq/
├── src/
│ ├── cli.ts # CLI entry point
│ ├── review.ts # API calling logic
│ ├── prompt.ts # Review prompt engineering
│ ├── github.ts # GitHub App auth (Worker)
│ ├── db.ts # D1 database layer (Worker)
│ ├── index.ts # Cloudflare Worker entry
│ └── types.ts # Shared types
├── frontend/ # Landing page
├── migrations/ # D1 database migrations
├── sample/ # E2E tests
├── scripts/
│ ├── install.sh # One-line install script
│ └── deploy-critiq.sh # Deployment script
├── action/ # GitHub Action
└── wrangler.toml # Cloudflare Workers configLicense
MIT © DrfterX
