Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 43 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,29 @@ AgentsKit Code Review is built around a different contract:
- **Local first, CI ready.** Review a diff before pushing, inspect complete paths, read stdin, or comment directly on a GitHub PR.
- **Control cost and policy.** Set file budgets, concurrency, thresholds, project conventions, and blocking severity.

## Quickstart
## Run your first review

Clone the repository and choose the provider you already have:
Open a terminal inside any Git repository and choose a provider you already use. You do not need to clone or install AgentsKit Code Review:

```sh
npm install
# Codex CLI — uses your existing login
npx --yes github:AgentsKit-io/code-review-cli --provider codex-cli

# Use a logged-in local CLI — no API key
npm run review -- --provider codex-cli
npm run review -- --provider claude-cli
# Claude CLI — uses your existing login
npx --yes github:AgentsKit-io/code-review-cli --provider claude-cli

# Use an API provider
OPENAI_API_KEY=... npm run review -- --provider openai --model gpt-4o

# Keep code on your machine with Ollama
npm run review -- --provider ollama --model llama3 --base-url http://localhost:11434
# OpenAI API
OPENAI_API_KEY=... npx --yes github:AgentsKit-io/code-review-cli \
--provider openai --model gpt-4o
```

By default, the CLI reviews your local diff against `origin/main`, prints Markdown, and exits with `1` only when a surviving finding reaches the configured blocking severity.
The CLI reviews the current repository's diff against `origin/main` and prints the report in your terminal. Choose another base with `--base main`.

The current command runs directly from GitHub. After the first npm release, the shorter form will be:

> The npm package metadata is ready for `@agentskit/code-review`, but the package is not available until the first release is published. Until then, use the cloned repository or the GitHub Action.
```sh
npx @agentskit/code-review --provider codex-cli
```

## Use the GitHub Action

Expand Down Expand Up @@ -81,7 +83,7 @@ Use `@main` while the project is pre-release. After the first stable release, pi
| Local model | `ollama` | Usually none | Privacy and predictable cost |
| Gateway | `openrouter` or a custom `--base-url` | Gateway-specific | Central routing and policy |

Provider names other than the two local CLIs resolve to factories exported by [`@agentskit/adapters`](https://www.npmjs.com/package/@agentskit/adapters). Run `npm run review -- --list-providers` for common choices.
Provider names other than the two local CLIs resolve to factories exported by [`@agentskit/adapters`](https://www.npmjs.com/package/@agentskit/adapters). Run `npx --yes github:AgentsKit-io/code-review-cli --list-providers` for common choices.

Credentials resolve in this order:

Expand Down Expand Up @@ -113,22 +115,45 @@ The review agent lives in `agents/code-review/` and is vendored from the [Agents

```sh
# Tune verification and severity
npm run review -- --provider codex-cli --base main --votes 5 --min-severity high
npx --yes github:AgentsKit-io/code-review-cli --provider codex-cli \
--base main --votes 5 --min-severity high

# Review a GitHub PR and post the result
GITHUB_TOKEN=... npm run review -- --provider openai --model gpt-4o \
GITHUB_TOKEN=... OPENAI_API_KEY=... \
npx --yes github:AgentsKit-io/code-review-cli --provider openai --model gpt-4o \
--pr owner/repo#42 --post

# Review complete files or directories
npm run review -- --provider claude-cli --paths src --max-files 30
npx --yes github:AgentsKit-io/code-review-cli --provider claude-cli \
--paths src --max-files 30

# Review piped source and also write SARIF
echo 'const x = a.b' | npm run review -- --provider ollama --model llama3 \
echo 'const x = a.b' | npx --yes github:AgentsKit-io/code-review-cli \
--provider ollama --model llama3 \
--base-url http://localhost:11434 --stdin --lang ts --sarif out.sarif
```

## CLI reference

### Providers

Run these commands from the repository you want to review:

| Provider | What you need | Model | Example |
|---|---|---|---|
| `codex-cli` | Codex CLI logged in | Optional | `npx --yes github:AgentsKit-io/code-review-cli --provider codex-cli` |
| `claude-cli` | Claude CLI logged in | Optional | `npx --yes github:AgentsKit-io/code-review-cli --provider claude-cli` |
| `openai` | `OPENAI_API_KEY` | Required | `... --provider openai --model gpt-4o` |
| `anthropic` | `ANTHROPIC_API_KEY` | Required | `... --provider anthropic --model <model>` |
| `gemini` | `GEMINI_API_KEY` | Required | `... --provider gemini --model <model>` |
| `ollama` | Ollama running locally | Required | `... --provider ollama --model llama3 --base-url http://localhost:11434` |
| `openrouter` | `OPENROUTER_API_KEY` | Required | `... --provider openrouter --model <model>` |
| Other adapters | `<PROVIDER>_API_KEY` when applicable | Usually required | `... --provider <name> --model <model>` |

In shortened examples, replace `...` with `npx --yes github:AgentsKit-io/code-review-cli`.

### Options

| Flag | Meaning |
|---|---|
| `--provider <name>` | Required provider: local CLI or `@agentskit/adapters` factory |
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"build": "tsc -p tsconfig.build.json",
"typecheck": "tsc --noEmit",
"check": "npm run typecheck && npm run build && node dist/src/cli.js --help",
"prepare": "npm run build",
"prepack": "npm run build"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ async function main() {
function buildAdapter(): AdapterFactory {
const provider = flag('provider') ?? (has('api') ? 'anthropic' : undefined)
if (!provider) throw new Error('choose a provider with --provider <name> (run --list-providers for common options)')
const model = flag('model') ?? (provider === 'anthropic' ? 'claude-opus-4-8' : undefined)
const model = flag('model') ?? (has('api') ? 'claude-opus-4-8' : undefined)
if (provider === 'claude-cli') return claudeCode({ model })
if (provider === 'codex-cli') return codexCli({ model })

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"noEmit": false,
"outDir": "dist",
"rootDir": ".",
"declaration": true,
"declaration": false,
"sourceMap": true
}
}
Loading