@agentskit/code-review 0.1.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.doc-bridge/capabilities.json +34 -0
- package/.doc-bridge/index.json +94 -0
- package/.pre-commit-hooks.yaml +9 -0
- package/AGENTS.md +20 -0
- package/CHANGELOG.md +91 -0
- package/CONTRIBUTING.md +45 -0
- package/README.md +238 -33
- package/ROADMAP.md +20 -0
- package/SECURITY.md +16 -0
- package/action.yml +120 -0
- package/dist/agents/code-review/agent.js +454 -76
- package/dist/agents/code-review/agent.js.map +1 -1
- package/dist/agents/code-review/lenses.js +17 -1
- package/dist/agents/code-review/lenses.js.map +1 -1
- package/dist/agents/code-review/reporters.js +83 -7
- package/dist/agents/code-review/reporters.js.map +1 -1
- package/dist/agents/code-review/sources.js +324 -73
- package/dist/agents/code-review/sources.js.map +1 -1
- package/dist/src/acp-cli-adapter.js +127 -0
- package/dist/src/acp-cli-adapter.js.map +1 -0
- package/dist/src/batch-coverage.js +111 -0
- package/dist/src/batch-coverage.js.map +1 -0
- package/dist/src/claude-code-adapter.js +44 -60
- package/dist/src/claude-code-adapter.js.map +1 -1
- package/dist/src/cli.js +347 -50
- package/dist/src/cli.js.map +1 -1
- package/dist/src/codex-adapter.js +114 -69
- package/dist/src/codex-adapter.js.map +1 -1
- package/dist/src/github-review-state.js +134 -0
- package/dist/src/github-review-state.js.map +1 -0
- package/dist/src/grok-cli-adapter.js +27 -0
- package/dist/src/grok-cli-adapter.js.map +1 -0
- package/dist/src/headless-cli-adapter.js +78 -0
- package/dist/src/headless-cli-adapter.js.map +1 -0
- package/dist/src/local-cli-process.js +328 -0
- package/dist/src/local-cli-process.js.map +1 -0
- package/dist/src/local-cli-timeout.js +14 -0
- package/dist/src/local-cli-timeout.js.map +1 -0
- package/dist/src/ollama-adapter.js +155 -0
- package/dist/src/ollama-adapter.js.map +1 -0
- package/dist/src/opencode-cli-adapter.js +57 -0
- package/dist/src/opencode-cli-adapter.js.map +1 -0
- package/dist/src/provider-circuit-breaker.js +52 -0
- package/dist/src/provider-circuit-breaker.js.map +1 -0
- package/dist/src/provider-registry.js +168 -0
- package/dist/src/provider-registry.js.map +1 -0
- package/dist/src/review-config.js +145 -0
- package/dist/src/review-config.js.map +1 -0
- package/doc-bridge.config.json +116 -0
- package/docs/OPERATIONS.md +358 -0
- package/docs/assets/agentskit-mark.svg +10 -0
- package/docs/assets/code-review-terminal.png +0 -0
- package/docs/continuous-improvement.md +35 -0
- package/docs/for-agents/code-review-cli.md +70 -0
- package/docs/for-agents/index.md +5 -0
- package/docs/plans/ecosystem-doc-quality-code-review.md +61 -0
- package/docs/provider-compatibility.json +35 -0
- package/ecosystem-claims.json +187 -0
- package/ecosystem.json +277 -0
- package/examples/pull-request.yml +29 -0
- package/llms-full.txt +1055 -0
- package/llms.txt +24 -0
- package/package.json +53 -7
- package/scripts/generate-llms-full.mjs +68 -0
- package/scripts/run-cycle-benchmark.mjs +64 -0
- package/test/cli-smoke.test.mjs +522 -0
- package/test/continuous-improvement.test.mjs +20 -0
- package/test/documentation.test.mjs +238 -0
- package/test/release-workflow.test.mjs +31 -0
- package/dist/agents/code-review/agent.d.ts +0 -115
- package/dist/agents/code-review/lenses.d.ts +0 -10
- package/dist/agents/code-review/reporters.d.ts +0 -31
- package/dist/agents/code-review/sources.d.ts +0 -27
- package/dist/src/claude-code-adapter.d.ts +0 -4
- package/dist/src/cli.d.ts +0 -2
- package/dist/src/codex-adapter.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/agentskit-mark.svg" width="64" height="57" alt="AgentsKit" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# AgentsKit Code Review
|
|
2
6
|
|
|
7
|
+
Profile: <code>top-level-repository</code>
|
|
8
|
+
|
|
3
9
|
**Deep, low-noise AI code review with the model you already use.**
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
It is intended for developers and teams who want focused review feedback without changing their model subscription, and without adopting a separate chat product surface.
|
|
12
|
+
|
|
13
|
+
[](https://github.com/AgentsKit-io/code-review/actions/workflows/ci.yml)
|
|
14
|
+
[](https://www.bestpractices.dev/projects/13866)
|
|
6
15
|
[](LICENSE)
|
|
7
16
|
[](package.json)
|
|
8
17
|
|
|
9
|
-
|
|
18
|
+
**Tags:** `agentskit` · `ai-code-review` · `github-action` · `typescript` · `sarif` · `codex` · `claude` · `ollama`
|
|
19
|
+
|
|
20
|
+
**Topics:** `ai-agents` · `code-review` · `developer-experience`
|
|
21
|
+
|
|
22
|
+
**Ecosystem:** [AgentsKit](https://www.agentskit.io/docs) · [Registry](https://registry.agentskit.io/docs) · [Chat](https://chat.agentskit.io/docs) · [Playbook](https://playbook.agentskit.io/docs) · [Doc Bridge](https://agentskit-io.github.io/doc-bridge/) · **Code Review** · [AKOS](https://akos.agentskit.io/docs)
|
|
23
|
+
|
|
24
|
+
Run code review locally or on every pull request. Bring Claude, Codex, OpenAI, Gemini, Ollama, OpenRouter, or another supported AgentsKit adapter. Seven focused review lenses propose potential problems; adversarial verification filters weak findings before they reach your team.
|
|
25
|
+
|
|
26
|
+
## Verified proof
|
|
27
|
+
|
|
28
|
+
- Offline CLI discovery works without credentials (`--help`, `--list-providers`) — covered by `test/cli-smoke.test.mjs`.
|
|
29
|
+
- A clean local Codex CLI fixture completes an offline stdin review — covered by the same smoke suite.
|
|
30
|
+
- Documentation, Action contract, and Doc Bridge gates run through `npm run check`.
|
|
31
|
+
- Machine-readable public map: [`llms.txt`](llms.txt) and [`docs/for-agents/code-review-cli.md`](docs/for-agents/code-review-cli.md).
|
|
10
32
|
|
|
11
33
|
## Why this exists
|
|
12
34
|
|
|
@@ -18,31 +40,98 @@ AgentsKit Code Review is built around a different contract:
|
|
|
18
40
|
- **Low noise by design.** Findings are challenged by independent verification votes before they survive.
|
|
19
41
|
- **Local first, CI ready.** Review a diff before pushing, inspect complete paths, read stdin, or comment directly on a GitHub PR.
|
|
20
42
|
- **Control cost and policy.** Set file budgets, concurrency, thresholds, project conventions, and blocking severity.
|
|
43
|
+
- **See the cost before execution.** Use `--plan --json` to inspect files, lenses, retries, concurrency, deadline, estimated provider calls, and every `UNREVIEWED` path with its reason without a model request. Estimates are always `best-effort` because primary lens demand is predictable but model output determines how many skeptical verification calls are needed; the runtime counter remains the hard ceiling.
|
|
21
44
|
|
|
22
45
|
## Run your first review
|
|
23
46
|
|
|
24
47
|
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:
|
|
25
48
|
|
|
49
|
+
<!-- readme-example:first-review -->
|
|
26
50
|
```sh
|
|
27
|
-
# Codex CLI — uses your existing login
|
|
28
|
-
npx --yes github:AgentsKit-io/code-review
|
|
51
|
+
# Codex CLI — uses your existing login on a trusted local machine
|
|
52
|
+
npx --yes github:AgentsKit-io/code-review --provider codex-cli --mode trusted-local
|
|
29
53
|
|
|
30
54
|
# Claude CLI — uses your existing login
|
|
31
|
-
npx --yes github:AgentsKit-io/code-review
|
|
55
|
+
npx --yes github:AgentsKit-io/code-review --provider claude-cli
|
|
32
56
|
|
|
33
57
|
# OpenAI API
|
|
34
|
-
OPENAI_API_KEY=... npx --yes github:AgentsKit-io/code-review
|
|
58
|
+
OPENAI_API_KEY=... npx --yes github:AgentsKit-io/code-review \
|
|
35
59
|
--provider openai --model gpt-4o
|
|
36
60
|
```
|
|
37
61
|
|
|
38
62
|
The CLI reviews the current repository's diff against `origin/main` and prints the report in your terminal. Choose another base with `--base main`.
|
|
39
63
|
|
|
64
|
+
For the Grok Build ACP worker, use `XAI_API_KEY` (or `--api-key`) in the default isolated mode. To reuse `grok login`, opt in explicitly with `--mode trusted-local`.
|
|
65
|
+
|
|
66
|
+
Local `codex-cli` subprocesses have a 300-second deadline per model call; `claude-cli` and the other local workers use 120 seconds. Every run also has a global deadline (10 minutes for full, 2 minutes for `fast`) and a bounded Codex smoke check before fan-out. Set `--deadline-ms` for a smaller explicit budget; timed-out calls fail explicitly and cannot turn an unreviewed file into an approval.
|
|
67
|
+
|
|
68
|
+
Terminal provider authentication failures stop the remaining lenses immediately; the review still exits incomplete and never converts a credential failure into approval.
|
|
69
|
+
|
|
70
|
+
The default `isolated` mode does not inherit an interactive CLI login. Use `--mode trusted-local` only on a machine or runner you trust with the provider's local session and environment.
|
|
71
|
+
|
|
72
|
+
`grok-cli` is stable and uses Grok Build's ACP transport (`grok agent stdio`) by default. In the default isolated mode, pass `XAI_API_KEY`/`--api-key`; the key is injected into the isolated worker environment, never into command arguments. Existing `grok login` state is available only with explicit local-only `--mode trusted-local`. Isolated workers grant no filesystem write, terminal, MCP, plugin, or subagent capability and use a temporary working directory. `--transport headless` is available for explicit non-interactive runs, while `--transport auto` is local-only and reports an ACP fallback before trying headless.
|
|
73
|
+
|
|
74
|
+
`opencode-cli` is stable and uses OpenCode's ACP transport (`opencode acp`) by default. In the default isolated mode, pass `OPENCODE_API_KEY`/`--api-key`; the selected key is injected into the isolated worker environment, never into command arguments. Existing OpenCode login/configuration state is available only with explicit local-only `--mode trusted-local`. OpenCode is not installed automatically. `--transport headless` is available for explicit non-interactive runs, while `--transport auto` is local-only and reports an ACP fallback before trying headless.
|
|
75
|
+
|
|
76
|
+
Preflight refuses an over-budget run before the first provider call. For GitHub PR sources, the CLI automatically caps the reviewed files to the safe call budget when `--max-files` is omitted; the remaining files are marked `UNREVIEWED`, so the result stays incomplete and cannot approve the PR. Use `--max-files` to choose a smaller explicit scope. `--dry-run` and `--plan` print the cap and concrete reductions; `--json` makes the plan machine-readable. CLI providers default to concurrency `1`, while API providers retain concurrency `4`. Required-lens or source coverage failures always exit `2`, even with `--no-fail`.
|
|
77
|
+
Use `--profile fast` when latency and provider budget matter more than the optional lenses: correctness, security, and tests run in one structured batch with one verification vote and no retry. The result records provider calls, failures, skips, elapsed time, circuit state, and whether the deadline fired. Any incomplete evidence remains fail-closed.
|
|
78
|
+
|
|
79
|
+
### Complete coverage for large PRs
|
|
80
|
+
|
|
81
|
+
Do not silently cap a large PR and treat the partial result as clean. `--plan --json --batch-size <n>` exposes a stable, alphabetically ordered file manifest. With a GitHub PR, `--batch-manifest <private-file>` writes the immutable state that binds every batch to the exact head SHA and review-policy fingerprint. Run each batch with `--batch-index <n> --result <private-file>`; partial batches reject `--post` and their result files are private (`0600`). `--consolidate-manifest <manifest> --artifacts <comma-list> --result <private-file>` accepts only every planned batch with complete evidence. Its output is the only artifact accepted by `--publish-result <file> --pr owner/repo#N --post`; that command rechecks the current SHA and policy before creating one GitHub review. A new commit or policy change invalidates the artifacts and requires a new manifest.
|
|
82
|
+
|
|
83
|
+

|
|
84
|
+
|
|
40
85
|
The current command runs directly from GitHub. After the first npm release, the shorter form will be:
|
|
41
86
|
|
|
42
87
|
```sh
|
|
43
88
|
npx @agentskit/code-review --provider codex-cli
|
|
44
89
|
```
|
|
45
90
|
|
|
91
|
+
## Run through pre-commit
|
|
92
|
+
|
|
93
|
+
The repository publishes a [`pre-commit`](https://pre-commit.com/) hook for teams that already use that framework. It is manual by default because a full adversarial review is slower and more expensive than a formatter or linter.
|
|
94
|
+
|
|
95
|
+
Add this to `.pre-commit-config.yaml`:
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
repos:
|
|
99
|
+
- repo: https://github.com/AgentsKit-io/code-review
|
|
100
|
+
rev: main # pre-release; pin a release tag when one contains the hook
|
|
101
|
+
hooks:
|
|
102
|
+
- id: agentskit-review
|
|
103
|
+
args: [--provider, codex-cli, --no-fail, --max-files, "20"]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Then run it when a change is ready for review:
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
pre-commit run --hook-stage manual agentskit-review
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The hook reviews the repository diff against `origin/main`; it does not claim to review only staged files. Override `--base` when your integration branch differs. To run on every push, override the hook with `stages: [pre-push]` and install that hook type explicitly, but first choose cost, latency, provider, and blocking policies appropriate for the repository.
|
|
113
|
+
|
|
114
|
+
### Review locally with Ollama
|
|
115
|
+
|
|
116
|
+
Use Ollama when repository policy requires model inference to stay on a machine or self-hosted runner. Pull a tool-capable coding model that fits the available memory, start Ollama, and review a small branch diff first:
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
ollama pull qwen2.5-coder:7b
|
|
120
|
+
|
|
121
|
+
npx --yes github:AgentsKit-io/code-review \
|
|
122
|
+
--provider ollama \
|
|
123
|
+
--model qwen2.5-coder:7b \
|
|
124
|
+
--base main \
|
|
125
|
+
--base-url http://localhost:11434 \
|
|
126
|
+
--max-files 10 \
|
|
127
|
+
--concurrency 1 \
|
|
128
|
+
--no-fail
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
This reviews committed changes between `main` and `HEAD`; it is not a staged-files-only hook. The selected model must support Ollama tool calling because every review lens submits a structured result. Requests have a 30-second default deadline. `--no-fail` keeps findings advisory, but connection, source, and execution errors still exit nonzero. No provider key is required. Local inference reduces code disclosure, but logs, SARIF files, caches, optional gateways, and observability exporters still need their own access and retention policy.
|
|
132
|
+
|
|
133
|
+
See the [operations guide](docs/OPERATIONS.md#local-ollama-review) for model sizing, health checks, failure handling, and self-hosted CI guidance.
|
|
134
|
+
|
|
46
135
|
## Use the GitHub Action
|
|
47
136
|
|
|
48
137
|
Add `.github/workflows/code-review.yml` to any repository:
|
|
@@ -61,29 +150,36 @@ jobs:
|
|
|
61
150
|
review:
|
|
62
151
|
runs-on: ubuntu-latest
|
|
63
152
|
steps:
|
|
64
|
-
- uses: AgentsKit-io/code-review
|
|
153
|
+
- uses: AgentsKit-io/code-review@v0.4.0
|
|
65
154
|
with:
|
|
66
155
|
provider: openai
|
|
67
156
|
model: gpt-4o
|
|
68
157
|
api-key: ${{ secrets.LLM_API_KEY }}
|
|
158
|
+
# max-files: '17'
|
|
159
|
+
# max-calls: '1000'
|
|
160
|
+
# max-findings-per-file: '7'
|
|
161
|
+
# profile: 'full' # or fast for a bounded required-lens batch
|
|
162
|
+
# deadline-ms: '600000'
|
|
69
163
|
# fail-on-block: 'true' # advisory by default
|
|
70
164
|
# block: high
|
|
71
165
|
```
|
|
72
166
|
|
|
73
|
-
The Action fetches the PR diff and posts one batched inline review plus a
|
|
167
|
+
The Action fetches the PR diff and posts one batched inline review plus a compact, persistent walkthrough. The walkthrough reports outcome and review evidence; actionable detail appears only on the relevant diff lines. Its defaults review at most 17 files, 7 findings per file, and 1,000 provider calls. It is advisory by default. Advisory mode affects findings only: source, provider, or execution failures still fail the check, and any reviewable file with zero successful primary lenses prevents approval. `codex-cli` requires a pre-authenticated `trusted-local` self-hosted runner; use an API provider with a secret on GitHub-hosted runners. Enable `fail-on-block` and branch protection when you are ready to use findings as a merge gate.
|
|
74
168
|
|
|
75
|
-
|
|
169
|
+
Building a conversational review experience? Use [AgentsKit Chat](https://chat.agentskit.io/docs) for the cross-framework application layer instead of embedding chat here. Looking for organization-wide orchestration, governance, and production controls? Continue with [AKOS](https://akos.agentskit.io/docs).
|
|
170
|
+
|
|
171
|
+
Pin the Action to an immutable release tag such as `@v0.4.0`; use a full commit SHA when your policy requires the strongest reproducibility.
|
|
76
172
|
|
|
77
173
|
## Choose how to run
|
|
78
174
|
|
|
79
175
|
| Mode | Provider examples | Credentials | Best for |
|
|
80
176
|
|---|---|---|---|
|
|
81
|
-
| Local CLI | `codex-cli`, `claude-cli` | Existing CLI login | Local development or self-hosted runners |
|
|
177
|
+
| Local CLI | `codex-cli`, `claude-cli`, `grok-cli`, `opencode-cli` | Existing CLI login | Local development or self-hosted runners |
|
|
82
178
|
| Hosted API | `openai`, `anthropic`, `gemini`, `mistral`, `groq` | Provider API key | Managed CI |
|
|
83
179
|
| Local model | `ollama` | Usually none | Privacy and predictable cost |
|
|
84
180
|
| Gateway | `openrouter` or a custom `--base-url` | Gateway-specific | Central routing and policy |
|
|
85
181
|
|
|
86
|
-
|
|
182
|
+
`grok` is the xAI API provider; `grok-cli` is the separate Grok Build CLI entry. `opencode-cli` is the OpenCode CLI entry. API providers are discovered from factories exported by [`@agentskit/adapters`](https://www.npmjs.com/package/@agentskit/adapters). Run `npx --yes github:AgentsKit-io/code-review --list-providers` to see IDs, support levels, transports, and model requirements.
|
|
87
183
|
|
|
88
184
|
Credentials resolve in this order:
|
|
89
185
|
|
|
@@ -95,18 +191,14 @@ Secrets passed to the GitHub Action are forwarded through the environment, not i
|
|
|
95
191
|
|
|
96
192
|
## How review works
|
|
97
193
|
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
↓
|
|
107
|
-
thresholds + CI policy
|
|
108
|
-
↓
|
|
109
|
-
Markdown / GitHub / SARIF
|
|
194
|
+
```mermaid
|
|
195
|
+
flowchart LR
|
|
196
|
+
A["Diff · PR · paths · stdin"] --> B["Normalize targets"]
|
|
197
|
+
B --> C["7 focused lenses"]
|
|
198
|
+
C --> D["Adversarial verification"]
|
|
199
|
+
D --> E["Thresholds + CI policy"]
|
|
200
|
+
E --> F["Markdown · GitHub · SARIF"]
|
|
201
|
+
D -. "weak finding" .-> G["Dropped with audit note"]
|
|
110
202
|
```
|
|
111
203
|
|
|
112
204
|
The review agent lives in `agents/code-review/` and is vendored from the [AgentsKit registry](https://github.com/AgentsKit-io/agentskit-registry/tree/main/registry/code-review). The CLI owns provider selection, input sources, policy, and reporting.
|
|
@@ -115,24 +207,36 @@ The review agent lives in `agents/code-review/` and is vendored from the [Agents
|
|
|
115
207
|
|
|
116
208
|
```sh
|
|
117
209
|
# Tune verification and severity
|
|
118
|
-
npx --yes github:AgentsKit-io/code-review
|
|
210
|
+
npx --yes github:AgentsKit-io/code-review --provider codex-cli \
|
|
119
211
|
--base main --votes 5 --min-severity high
|
|
120
212
|
|
|
121
213
|
# Review a GitHub PR and post the result
|
|
122
214
|
GITHUB_TOKEN=... OPENAI_API_KEY=... \
|
|
123
|
-
npx --yes github:AgentsKit-io/code-review
|
|
215
|
+
npx --yes github:AgentsKit-io/code-review --provider openai --model gpt-4o \
|
|
124
216
|
--pr owner/repo#42 --post
|
|
125
217
|
|
|
126
218
|
# Review complete files or directories
|
|
127
|
-
npx --yes github:AgentsKit-io/code-review
|
|
219
|
+
npx --yes github:AgentsKit-io/code-review --provider claude-cli \
|
|
128
220
|
--paths src --max-files 30
|
|
129
221
|
|
|
130
222
|
# Review piped source and also write SARIF
|
|
131
|
-
echo 'const x = a.b' | npx --yes github:AgentsKit-io/code-review
|
|
223
|
+
echo 'const x = a.b' | npx --yes github:AgentsKit-io/code-review \
|
|
132
224
|
--provider ollama --model llama3 \
|
|
133
225
|
--base-url http://localhost:11434 --stdin --lang ts --sarif out.sarif
|
|
226
|
+
|
|
227
|
+
# After fetching the PR base and installing reviewdog, reuse its annotation transport
|
|
228
|
+
REPORT_FILE="$(mktemp)"
|
|
229
|
+
trap 'rm -f "${REPORT_FILE}"' EXIT
|
|
230
|
+
npx --yes github:AgentsKit-io/code-review#3dfd7427640148281454d52846d369e5ddf85b11 \
|
|
231
|
+
--provider openai --model gpt-4o \
|
|
232
|
+
--base "origin/${BASE_REF}" --sarif "${REPORT_FILE}" --no-fail &&
|
|
233
|
+
reviewdog -f=sarif -name=agentskit-review \
|
|
234
|
+
-reporter=github-pr-review -filter-mode=added -fail-level=error \
|
|
235
|
+
< "${REPORT_FILE}"
|
|
134
236
|
```
|
|
135
237
|
|
|
238
|
+
The reviewdog recipe needs no custom converter: Code Review emits SARIF 2.1.0 and reviewdog consumes SARIF natively. See the [complete GitHub Actions job](docs/OPERATIONS.md#route-findings-through-reviewdog) for pinned installation, base-branch checkout, permissions, severity mapping, and CI ownership of the failure threshold.
|
|
239
|
+
|
|
136
240
|
## CLI reference
|
|
137
241
|
|
|
138
242
|
### Providers
|
|
@@ -141,8 +245,10 @@ Run these commands from the repository you want to review:
|
|
|
141
245
|
|
|
142
246
|
| Provider | What you need | Model | Example |
|
|
143
247
|
|---|---|---|---|
|
|
144
|
-
| `codex-cli` | Codex CLI logged in | Optional | `npx --yes github:AgentsKit-io/code-review
|
|
145
|
-
| `claude-cli` | Claude CLI logged in | Optional | `npx --yes github:AgentsKit-io/code-review
|
|
248
|
+
| `codex-cli` | Codex CLI logged in | Optional | `npx --yes github:AgentsKit-io/code-review --provider codex-cli` |
|
|
249
|
+
| `claude-cli` | Claude CLI logged in | Optional | `npx --yes github:AgentsKit-io/code-review --provider claude-cli` |
|
|
250
|
+
| `grok-cli` | Grok Build CLI; stable ACP/headless | Optional | `... --provider grok-cli` |
|
|
251
|
+
| `opencode-cli` | OpenCode CLI; stable ACP/headless | Optional | `... --provider opencode-cli` |
|
|
146
252
|
| `openai` | `OPENAI_API_KEY` | Required | `... --provider openai --model gpt-4o` |
|
|
147
253
|
| `anthropic` | `ANTHROPIC_API_KEY` | Required | `... --provider anthropic --model <model>` |
|
|
148
254
|
| `gemini` | `GEMINI_API_KEY` | Required | `... --provider gemini --model <model>` |
|
|
@@ -150,7 +256,7 @@ Run these commands from the repository you want to review:
|
|
|
150
256
|
| `openrouter` | `OPENROUTER_API_KEY` | Required | `... --provider openrouter --model <model>` |
|
|
151
257
|
| Other adapters | `<PROVIDER>_API_KEY` when applicable | Usually required | `... --provider <name> --model <model>` |
|
|
152
258
|
|
|
153
|
-
In shortened examples, replace `...` with `npx --yes github:AgentsKit-io/code-review
|
|
259
|
+
In shortened examples, replace `...` with `npx --yes github:AgentsKit-io/code-review`.
|
|
154
260
|
|
|
155
261
|
### Options
|
|
156
262
|
|
|
@@ -160,6 +266,7 @@ In shortened examples, replace `...` with `npx --yes github:AgentsKit-io/code-re
|
|
|
160
266
|
| `--model <id>` | Model id; required for API/local-server providers |
|
|
161
267
|
| `--api-key <key>` | Provider key; environment variables are preferred |
|
|
162
268
|
| `--base-url <url>` | Provider endpoint, local server, or gateway |
|
|
269
|
+
| `--transport <name>` | Provider transport: `acp`, `headless`, or local-only `auto` where supported |
|
|
163
270
|
| `--base <ref>` | Git diff base; default `origin/main` |
|
|
164
271
|
| `--pr owner/repo#N` | GitHub PR source; requires `GITHUB_TOKEN` |
|
|
165
272
|
| `--paths <p...>` | Complete files or directories |
|
|
@@ -167,28 +274,126 @@ In shortened examples, replace `...` with `npx --yes github:AgentsKit-io/code-re
|
|
|
167
274
|
| `--post` | Post a batched review when the source is a PR |
|
|
168
275
|
| `--sarif <file>` | Also write SARIF |
|
|
169
276
|
| `--votes <n>` | Adversarial verification votes; default `3` |
|
|
277
|
+
| `--profile <full\|fast>` | Full review or one bounded required-lens batch |
|
|
170
278
|
| `--min-severity <level>` | Minimum reported severity |
|
|
171
279
|
| `--min-confidence <n>` | Minimum reported confidence |
|
|
172
|
-
| `--max-files <n>` |
|
|
173
|
-
| `--
|
|
280
|
+
| `--max-files <n>` | Positive file budget; over-budget runs are refused before the provider |
|
|
281
|
+
| `--max-calls <n>` | Provider-call budget; absolute ceiling `1000` |
|
|
282
|
+
| `--max-findings-per-file <n>` | Maximum verified findings per file; bounds adversarial verification calls |
|
|
283
|
+
| `--concurrency <n>` | Parallel model calls; default `1` for CLI providers, `4` for API providers |
|
|
284
|
+
| `--deadline-ms <n>` | Global run deadline; defaults to `600000` (`120000` for `fast`) |
|
|
285
|
+
| `--health-check <auto\|off>` | Bounded provider smoke check before model fan-out |
|
|
286
|
+
| `--plan`, `--dry-run` | Print provider-free preflight; add `--json` for machine output |
|
|
174
287
|
| `--validate-patch` | Run `git apply --check` on suggested patches |
|
|
175
288
|
| `--block <severity>` | CI gate floor; default `blocker` |
|
|
176
289
|
| `--no-fail` | Keep findings advisory |
|
|
177
290
|
| `--conventions <path>` | Inject project conventions |
|
|
291
|
+
| `--allow-incomplete` | Local-only exception for a config that declares incomplete lens coverage |
|
|
292
|
+
| `--allow-unredacted` | Local-only exception; rejected in CI |
|
|
178
293
|
| `--api` | Back-compatible alias for `--provider anthropic` |
|
|
294
|
+
| `doctor --provider <name>` | Offline provider diagnostics; no model request |
|
|
295
|
+
| `doctor --live` | Explicit provider smoke-test mode |
|
|
296
|
+
| `doctor --json` | Stable machine-readable diagnostics |
|
|
297
|
+
| `--mode <mode>` | `isolated` (default) or explicit local-only `trusted-local` |
|
|
179
298
|
| `--help` | Full command help |
|
|
180
299
|
|
|
181
300
|
When no conventions path is supplied, the CLI looks for `CONVENTIONS.md`, `CONTRIBUTING.md`, `.cursorrules`, or `AGENTS.md`.
|
|
182
301
|
|
|
302
|
+
### Versioned configuration
|
|
303
|
+
|
|
304
|
+
The repository may contain one strict `.agentskit-review.json` file. It must use
|
|
305
|
+
`configVersion: 1`; unknown fields, secrets, unsupported values, and unsafe lens
|
|
306
|
+
policies fail before provider execution with exit `2`. Every built-in lens is
|
|
307
|
+
enabled by default, with `correctness`, `security`, and `tests` required. Flags
|
|
308
|
+
override file values. A required lens may only be disabled in an explicitly
|
|
309
|
+
declared `incompleteProfile`, which requires `--allow-incomplete` locally and is
|
|
310
|
+
never accepted in CI.
|
|
311
|
+
|
|
312
|
+
```json
|
|
313
|
+
{
|
|
314
|
+
"configVersion": 1,
|
|
315
|
+
"profile": "full",
|
|
316
|
+
"lenses": {
|
|
317
|
+
"performance": { "enabled": false, "required": false }
|
|
318
|
+
},
|
|
319
|
+
"votes": 3,
|
|
320
|
+
"budget": { "maxFiles": 20, "maxCalls": 200, "concurrency": 1, "deadlineMs": 600000 },
|
|
321
|
+
"worker": { "timeoutMs": 120000, "maxOutputBytes": 20971520 },
|
|
322
|
+
"thresholds": { "minSeverity": "med", "minConfidence": 0.7 },
|
|
323
|
+
"context": { "mode": "prompt", "patterns": ["src/**"] }
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Provider, model, transport, context trust, redaction, and permissions are
|
|
328
|
+
trusted execution inputs; a project config cannot set them in CI. Put provider
|
|
329
|
+
credentials only in the environment or provider login, never in this file.
|
|
330
|
+
Remote and unknown provider boundaries redact high-confidence credential
|
|
331
|
+
patterns before the model sees source. Unsafe, oversized, binary, or excluded
|
|
332
|
+
paths are reported as `UNREVIEWED`; content is never silently truncated.
|
|
333
|
+
|
|
334
|
+
### Doctor
|
|
335
|
+
|
|
336
|
+
Run `doctor` before a review to check a registered provider’s executable, version, transport, model requirement, configuration mode, and credential presence. It is offline by default; `doctor --live` and normal Codex reviews use a bounded smoke check to catch authentication or hangs before fan-out. API credentials are checked only for presence and values are never printed. Unknown local CLI versions warn locally and fail when `CI=true`. Exit `0` means healthy, `1` means a failed diagnostic, and `2` means invalid CLI usage.
|
|
337
|
+
|
|
338
|
+
```sh
|
|
339
|
+
npx --yes github:AgentsKit-io/code-review doctor --provider codex-cli
|
|
340
|
+
npx --yes github:AgentsKit-io/code-review doctor --provider openai --model gpt-4o --json
|
|
341
|
+
```
|
|
342
|
+
|
|
183
343
|
## Cost and privacy
|
|
184
344
|
|
|
185
|
-
A full review runs seven lenses across selected files and then verifies candidate findings. Control usage with `--max-files`, `--votes`, `--concurrency`, paths, and workflow triggers. For sensitive code, use a local model or an approved private gateway; provider data policies still apply to hosted APIs.
|
|
345
|
+
A full review runs seven lenses across selected files and then verifies candidate findings. Control usage with `--profile fast`, `--max-files`, `--max-calls`, `--votes`, `--deadline-ms`, `--concurrency`, paths, and workflow triggers. For sensitive code, use a local model or an approved private gateway; provider data policies still apply to hosted APIs.
|
|
346
|
+
|
|
347
|
+
## Operations and machine-readable docs
|
|
348
|
+
|
|
349
|
+
- [Operations guide](docs/OPERATIONS.md) — providers, permissions, secrets, cost controls, SARIF, failures, releases, and incident-safe defaults.
|
|
350
|
+
- [Provider compatibility matrix](docs/provider-compatibility.json) — stable CLI transports and their offline fixtures.
|
|
351
|
+
- [Agent handoff](docs/for-agents/code-review-cli.md) — ownership, edit roots, verification commands, and change routes.
|
|
352
|
+
- [`llms.txt`](llms.txt) — compact public source map for LLMs and coding agents.
|
|
353
|
+
- [`llms-full.txt`](llms-full.txt) — complete README, operations, and agent-handoff corpus.
|
|
354
|
+
- [`doc-bridge.config.json`](doc-bridge.config.json) — executable Doc Bridge corpus, ownership, and gate contract.
|
|
355
|
+
|
|
356
|
+
`npm run check` builds the CLI, executes a full credential-free review fixture, validates the composite Action and documentation contract, runs Doc Bridge gates, checks CLI help, and enforces README Standard v1. Prove credential-free discovery with:
|
|
357
|
+
|
|
358
|
+
```sh
|
|
359
|
+
node examples/verify-readme.mjs
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
`npm pack --dry-run` verifies the release payload.
|
|
363
|
+
|
|
364
|
+
## Maturity
|
|
365
|
+
|
|
366
|
+
The repository is **pre-v1 (`0.4.x`)**. The CLI and Action are available for evaluation and advisory CI; use an exact release tag such as `@v0.4.0` or a commit SHA, and treat the future `v1` moving tag as a separate stability milestone. See [ROADMAP.md](ROADMAP.md) and the [release guidance](docs/OPERATIONS.md#releases-and-maturity).
|
|
367
|
+
|
|
368
|
+
## Compatibility
|
|
369
|
+
|
|
370
|
+
- **Node.js 20+** (see `engines` in `package.json`)
|
|
371
|
+
- **TypeScript** source and compiled ESM distribution
|
|
372
|
+
- **GitHub Actions** composite Action at repository root (`action.yml`)
|
|
373
|
+
- Providers via local CLIs or [`@agentskit/adapters`](https://www.npmjs.com/package/@agentskit/adapters)
|
|
374
|
+
|
|
375
|
+
## AgentsKit ecosystem
|
|
376
|
+
|
|
377
|
+
Code Review is the verification step in the broader AgentsKit journey:
|
|
378
|
+
|
|
379
|
+
| Need | Continue with |
|
|
380
|
+
|---|---|
|
|
381
|
+
| Build the agent or custom review adapter | [AgentsKit](https://www.agentskit.io/docs) |
|
|
382
|
+
| Install the vendored review agent or explore ready agents | [Registry](https://registry.agentskit.io/docs) |
|
|
383
|
+
| Deliver review through a conversational application | [AgentsKit Chat](https://chat.agentskit.io/docs) |
|
|
384
|
+
| Apply engineering patterns before review | [Playbook](https://playbook.agentskit.io/docs) |
|
|
385
|
+
| Generate ownership-aware documentation handoffs | [Doc Bridge](https://agentskit-io.github.io/doc-bridge/) ([source](https://github.com/AgentsKit-io/doc-bridge)) |
|
|
386
|
+
| Add enterprise orchestration and production governance | [AKOS](https://akos.agentskit.io/docs) |
|
|
387
|
+
|
|
388
|
+
This repository intentionally has **no Fumadocs application and no embedded AgentsChat**. Its public product surface is the CLI, GitHub Action, repository documentation, and machine-readable handoffs.
|
|
186
389
|
|
|
187
390
|
## Contributing
|
|
188
391
|
|
|
189
392
|
Providers, review lenses, reporters, fixtures, documentation, and false-positive reductions are welcome. Start with [CONTRIBUTING.md](CONTRIBUTING.md), browse issues labeled `good first issue`, or propose a new provider/lens with the issue templates.
|
|
190
393
|
|
|
191
394
|
Please report vulnerabilities privately as described in [SECURITY.md](SECURITY.md).
|
|
395
|
+
Maintainer responsibilities, public decision-making, and the release process are
|
|
396
|
+
documented in [GOVERNANCE.md](GOVERNANCE.md).
|
|
192
397
|
|
|
193
398
|
## Roadmap
|
|
194
399
|
|
package/ROADMAP.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Roadmap
|
|
2
|
+
|
|
3
|
+
This roadmap communicates direction, not a promise of dates.
|
|
4
|
+
|
|
5
|
+
## Toward v1
|
|
6
|
+
|
|
7
|
+
- [ ] Publish the calibrated `0.4.x` line of `@agentskit/code-review` and signed release artifacts.
|
|
8
|
+
- [ ] Publish immutable GitHub Action releases with a moving `v1` tag.
|
|
9
|
+
- [ ] Add credential-free adapter contract tests and opt-in provider smoke tests.
|
|
10
|
+
- [ ] Document measured review cost and latency by configuration.
|
|
11
|
+
- [ ] Expand fixtures for false-positive and multi-language regression testing.
|
|
12
|
+
|
|
13
|
+
## Community tracks
|
|
14
|
+
|
|
15
|
+
- Review lenses with precise evidence and low false-positive rates.
|
|
16
|
+
- Additional local CLI and private-gateway adapters.
|
|
17
|
+
- Reporters for other code-hosting and CI systems.
|
|
18
|
+
- Better SARIF, monorepo, and large-diff workflows.
|
|
19
|
+
|
|
20
|
+
Open an issue before starting a large item so maintainers and contributors can align on scope.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Security fixes are provided for the latest published release. Older releases may
|
|
6
|
+
be asked to upgrade before receiving a fix.
|
|
7
|
+
|
|
8
|
+
## Reporting a vulnerability
|
|
9
|
+
|
|
10
|
+
Do not open a public issue for a suspected vulnerability. Use [GitHub private vulnerability reporting](https://github.com/AgentsKit-io/code-review/security/advisories/new) with the affected version, impact, reproduction steps, and any suggested mitigation.
|
|
11
|
+
|
|
12
|
+
Please do not include secrets or private source code beyond what is necessary to reproduce the issue. We aim to acknowledge a complete report within 14 days, investigate it, and coordinate disclosure and remediation with the reporter. If the report is accepted, we will keep the reporter informed as the fix progresses.
|
|
13
|
+
|
|
14
|
+
## Scope reminders
|
|
15
|
+
|
|
16
|
+
This tool sends selected code to the provider you configure. Review that provider's data handling policy before using a hosted API. Prefer a local model or approved private gateway for repositories whose policy prohibits external processing. Store GitHub tokens and provider keys as secrets; never commit them to workflow files.
|
package/action.yml
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
name: 'AgentsKit Code Review'
|
|
2
|
+
description: 'Deep, low-noise AI code review on a pull request — 7 lenses + adversarial verification. Advisory by default.'
|
|
3
|
+
branding:
|
|
4
|
+
icon: 'check-circle'
|
|
5
|
+
color: 'green'
|
|
6
|
+
|
|
7
|
+
inputs:
|
|
8
|
+
provider:
|
|
9
|
+
description: 'Provider to use: a local CLI (claude-cli, codex-cli) or any @agentskit/adapters provider such as anthropic, openai, gemini, ollama, or openrouter.'
|
|
10
|
+
required: true
|
|
11
|
+
mode:
|
|
12
|
+
description: 'Execution mode: isolated (default) or trusted-local for an explicitly trusted runner with an existing CLI login.'
|
|
13
|
+
required: false
|
|
14
|
+
default: 'isolated'
|
|
15
|
+
api-key:
|
|
16
|
+
description: 'API key for the provider (required unless provider is claude-cli or a keyless local provider). Set as a repo/org secret. Passed via env, never the command line.'
|
|
17
|
+
required: false
|
|
18
|
+
claude-oauth-token:
|
|
19
|
+
description: 'For provider=claude-cli on headless/CI runners: a long-lived token from `claude setup-token` (uses your subscription, no per-call API cost). Set as a secret. Headless `claude -p` cannot use the interactive login session.'
|
|
20
|
+
required: false
|
|
21
|
+
base-url:
|
|
22
|
+
description: 'Override the provider base URL (e.g. ollama / openrouter / a self-hosted gateway).'
|
|
23
|
+
required: false
|
|
24
|
+
default: ''
|
|
25
|
+
github-token:
|
|
26
|
+
description: 'Token used to read the PR diff and post the review.'
|
|
27
|
+
required: false
|
|
28
|
+
default: ${{ github.token }}
|
|
29
|
+
model:
|
|
30
|
+
description: 'Model id. Required for API and local-server providers; optional for CLI providers.'
|
|
31
|
+
required: false
|
|
32
|
+
block:
|
|
33
|
+
description: 'Severity floor for the gate: blocker | high.'
|
|
34
|
+
required: false
|
|
35
|
+
default: 'high'
|
|
36
|
+
fail-on-block:
|
|
37
|
+
description: 'Fail the check when a finding at/above `block` survives. Default false (advisory — posts but never blocks).'
|
|
38
|
+
required: false
|
|
39
|
+
default: 'false'
|
|
40
|
+
votes:
|
|
41
|
+
description: 'Adversarial verify votes per finding.'
|
|
42
|
+
required: false
|
|
43
|
+
default: '3'
|
|
44
|
+
max-files:
|
|
45
|
+
description: 'Max files reviewed per run (budget cap).'
|
|
46
|
+
required: false
|
|
47
|
+
default: '17'
|
|
48
|
+
max-calls:
|
|
49
|
+
description: 'Maximum provider calls per run (absolute ceiling 1000).'
|
|
50
|
+
required: false
|
|
51
|
+
default: '1000'
|
|
52
|
+
max-findings-per-file:
|
|
53
|
+
description: 'Maximum findings verified per file; keeps the provider-call estimate bounded.'
|
|
54
|
+
required: false
|
|
55
|
+
default: '7'
|
|
56
|
+
profile:
|
|
57
|
+
description: 'Review profile: full or fast (one bounded required-lens batch).'
|
|
58
|
+
required: false
|
|
59
|
+
default: 'full'
|
|
60
|
+
deadline-ms:
|
|
61
|
+
description: 'Global review deadline in milliseconds.'
|
|
62
|
+
required: false
|
|
63
|
+
default: '600000'
|
|
64
|
+
health-check:
|
|
65
|
+
description: 'Provider preflight smoke test: auto or off.'
|
|
66
|
+
required: false
|
|
67
|
+
default: 'auto'
|
|
68
|
+
|
|
69
|
+
runs:
|
|
70
|
+
using: 'composite'
|
|
71
|
+
steps:
|
|
72
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
73
|
+
with:
|
|
74
|
+
node-version: '22'
|
|
75
|
+
- name: Install code-review
|
|
76
|
+
shell: bash
|
|
77
|
+
run: cd "$GITHUB_ACTION_PATH" && npm ci
|
|
78
|
+
- name: Review pull request
|
|
79
|
+
shell: bash
|
|
80
|
+
env:
|
|
81
|
+
LLM_API_KEY: ${{ inputs.api-key }}
|
|
82
|
+
CLAUDE_CODE_OAUTH_TOKEN: ${{ inputs.claude-oauth-token }}
|
|
83
|
+
GITHUB_TOKEN: ${{ inputs.github-token }}
|
|
84
|
+
INPUT_PROVIDER: ${{ inputs.provider }}
|
|
85
|
+
INPUT_MODE: ${{ inputs.mode }}
|
|
86
|
+
INPUT_MODEL: ${{ inputs.model }}
|
|
87
|
+
INPUT_BASE_URL: ${{ inputs.base-url }}
|
|
88
|
+
INPUT_VOTES: ${{ inputs.votes }}
|
|
89
|
+
INPUT_MAX_FILES: ${{ inputs.max-files }}
|
|
90
|
+
INPUT_MAX_CALLS: ${{ inputs.max-calls }}
|
|
91
|
+
INPUT_MAX_FINDINGS_PER_FILE: ${{ inputs.max-findings-per-file }}
|
|
92
|
+
INPUT_PROFILE: ${{ inputs.profile }}
|
|
93
|
+
INPUT_DEADLINE_MS: ${{ inputs.deadline-ms }}
|
|
94
|
+
INPUT_HEALTH_CHECK: ${{ inputs.health-check }}
|
|
95
|
+
INPUT_BLOCK: ${{ inputs.block }}
|
|
96
|
+
INPUT_FAIL_ON_BLOCK: ${{ inputs.fail-on-block }}
|
|
97
|
+
run: |
|
|
98
|
+
cd "$GITHUB_ACTION_PATH"
|
|
99
|
+
if [[ "$INPUT_PROVIDER" == "codex-cli" && "$INPUT_MODE" != "trusted-local" ]]; then
|
|
100
|
+
echo "::error::codex-cli requires a pre-authenticated trusted-local runner; use provider openai with api-key on GitHub-hosted runners."
|
|
101
|
+
exit 2
|
|
102
|
+
fi
|
|
103
|
+
args=(
|
|
104
|
+
--pr "${{ github.repository }}#${{ github.event.pull_request.number }}" \
|
|
105
|
+
--post \
|
|
106
|
+
--provider "$INPUT_PROVIDER" \
|
|
107
|
+
--mode "$INPUT_MODE" \
|
|
108
|
+
--votes "$INPUT_VOTES" \
|
|
109
|
+
--max-files "$INPUT_MAX_FILES" \
|
|
110
|
+
--max-calls "$INPUT_MAX_CALLS" \
|
|
111
|
+
--max-findings-per-file "$INPUT_MAX_FINDINGS_PER_FILE" \
|
|
112
|
+
--profile "$INPUT_PROFILE" \
|
|
113
|
+
--deadline-ms "$INPUT_DEADLINE_MS" \
|
|
114
|
+
--health-check "$INPUT_HEALTH_CHECK" \
|
|
115
|
+
--block "$INPUT_BLOCK"
|
|
116
|
+
)
|
|
117
|
+
[[ -n "$INPUT_MODEL" ]] && args+=(--model "$INPUT_MODEL")
|
|
118
|
+
[[ -n "$INPUT_BASE_URL" ]] && args+=(--base-url "$INPUT_BASE_URL")
|
|
119
|
+
[[ "$INPUT_FAIL_ON_BLOCK" == "true" ]] || args+=(--no-fail)
|
|
120
|
+
npm run --silent review -- "${args[@]}"
|