@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/llms-full.txt
ADDED
|
@@ -0,0 +1,1055 @@
|
|
|
1
|
+
# AgentsKit Code Review — full documentation corpus
|
|
2
|
+
|
|
3
|
+
Generated from the public repository documentation. Prefer llms.txt for concise discovery and this file only when the full operating and ownership context is required.
|
|
4
|
+
|
|
5
|
+
## AgentsKit ecosystem
|
|
6
|
+
|
|
7
|
+
- AgentsKit: https://www.agentskit.io/docs
|
|
8
|
+
- AgentsKit Registry: https://registry.agentskit.io/docs
|
|
9
|
+
- AgentsKit Chat: https://chat.agentskit.io/docs
|
|
10
|
+
- Agents Playbook: https://playbook.agentskit.io/docs
|
|
11
|
+
- Doc Bridge: https://agentskit-io.github.io/doc-bridge/
|
|
12
|
+
- AgentsKit Code Review: https://github.com/AgentsKit-io/code-review#readme
|
|
13
|
+
- AgentsKit OS: https://akos.agentskit.io/docs
|
|
14
|
+
|
|
15
|
+
## Public README
|
|
16
|
+
|
|
17
|
+
Canonical source: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/README.md
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<img src="docs/assets/agentskit-mark.svg" width="64" height="57" alt="AgentsKit" />
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
# AgentsKit Code Review
|
|
24
|
+
|
|
25
|
+
Profile: <code>top-level-repository</code>
|
|
26
|
+
|
|
27
|
+
**Deep, low-noise AI code review with the model you already use.**
|
|
28
|
+
|
|
29
|
+
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.
|
|
30
|
+
|
|
31
|
+
[](https://github.com/AgentsKit-io/code-review/actions/workflows/ci.yml)
|
|
32
|
+
[](https://www.bestpractices.dev/projects/13866)
|
|
33
|
+
[](https://github.com/AgentsKit-io/code-review/blob/main/LICENSE)
|
|
34
|
+
[](https://github.com/AgentsKit-io/code-review/blob/main/package.json)
|
|
35
|
+
|
|
36
|
+
**Tags:** `agentskit` · `ai-code-review` · `github-action` · `typescript` · `sarif` · `codex` · `claude` · `ollama`
|
|
37
|
+
|
|
38
|
+
**Topics:** `ai-agents` · `code-review` · `developer-experience`
|
|
39
|
+
|
|
40
|
+
**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)
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
## Verified proof
|
|
45
|
+
|
|
46
|
+
- Offline CLI discovery works without credentials (`--help`, `--list-providers`) — covered by `test/cli-smoke.test.mjs`.
|
|
47
|
+
- A clean local Codex CLI fixture completes an offline stdin review — covered by the same smoke suite.
|
|
48
|
+
- Documentation, Action contract, and Doc Bridge gates run through `npm run check`.
|
|
49
|
+
- Machine-readable public map: [`llms.txt`](https://github.com/AgentsKit-io/code-review/blob/main/llms.txt) and [`docs/for-agents/code-review-cli.md`](https://github.com/AgentsKit-io/code-review/blob/main/docs/for-agents/code-review-cli.md).
|
|
50
|
+
|
|
51
|
+
## Why this exists
|
|
52
|
+
|
|
53
|
+
Most AI reviewers are easy to start and hard to trust: they produce long lists of stylistic opinions, repeat the same concern, and bury the issue that can actually break production.
|
|
54
|
+
|
|
55
|
+
AgentsKit Code Review is built around a different contract:
|
|
56
|
+
|
|
57
|
+
- **Bring your own model.** Use an existing CLI subscription, an API provider, a local model, or your own gateway.
|
|
58
|
+
- **Low noise by design.** Findings are challenged by independent verification votes before they survive.
|
|
59
|
+
- **Local first, CI ready.** Review a diff before pushing, inspect complete paths, read stdin, or comment directly on a GitHub PR.
|
|
60
|
+
- **Control cost and policy.** Set file budgets, concurrency, thresholds, project conventions, and blocking severity.
|
|
61
|
+
- **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.
|
|
62
|
+
|
|
63
|
+
## Run your first review
|
|
64
|
+
|
|
65
|
+
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:
|
|
66
|
+
|
|
67
|
+
<!-- readme-example:first-review -->
|
|
68
|
+
```sh
|
|
69
|
+
# Codex CLI — uses your existing login on a trusted local machine
|
|
70
|
+
npx --yes github:AgentsKit-io/code-review --provider codex-cli --mode trusted-local
|
|
71
|
+
|
|
72
|
+
# Claude CLI — uses your existing login
|
|
73
|
+
npx --yes github:AgentsKit-io/code-review --provider claude-cli
|
|
74
|
+
|
|
75
|
+
# OpenAI API
|
|
76
|
+
OPENAI_API_KEY=... npx --yes github:AgentsKit-io/code-review \
|
|
77
|
+
--provider openai --model gpt-4o
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The CLI reviews the current repository's diff against `origin/main` and prints the report in your terminal. Choose another base with `--base main`.
|
|
81
|
+
|
|
82
|
+
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`.
|
|
83
|
+
|
|
84
|
+
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.
|
|
85
|
+
|
|
86
|
+
Terminal provider authentication failures stop the remaining lenses immediately; the review still exits incomplete and never converts a credential failure into approval.
|
|
87
|
+
|
|
88
|
+
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.
|
|
89
|
+
|
|
90
|
+
`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.
|
|
91
|
+
|
|
92
|
+
`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.
|
|
93
|
+
|
|
94
|
+
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`.
|
|
95
|
+
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.
|
|
96
|
+
|
|
97
|
+
### Complete coverage for large PRs
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
|
|
101
|
+

|
|
102
|
+
|
|
103
|
+
The current command runs directly from GitHub. After the first npm release, the shorter form will be:
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
npx @agentskit/code-review --provider codex-cli
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Run through pre-commit
|
|
110
|
+
|
|
111
|
+
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.
|
|
112
|
+
|
|
113
|
+
Add this to `.pre-commit-config.yaml`:
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
repos:
|
|
117
|
+
- repo: https://github.com/AgentsKit-io/code-review
|
|
118
|
+
rev: main # pre-release; pin a release tag when one contains the hook
|
|
119
|
+
hooks:
|
|
120
|
+
- id: agentskit-review
|
|
121
|
+
args: [--provider, codex-cli, --no-fail, --max-files, "20"]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Then run it when a change is ready for review:
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
pre-commit run --hook-stage manual agentskit-review
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
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.
|
|
131
|
+
|
|
132
|
+
### Review locally with Ollama
|
|
133
|
+
|
|
134
|
+
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:
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
ollama pull qwen2.5-coder:7b
|
|
138
|
+
|
|
139
|
+
npx --yes github:AgentsKit-io/code-review \
|
|
140
|
+
--provider ollama \
|
|
141
|
+
--model qwen2.5-coder:7b \
|
|
142
|
+
--base main \
|
|
143
|
+
--base-url http://localhost:11434 \
|
|
144
|
+
--max-files 10 \
|
|
145
|
+
--concurrency 1 \
|
|
146
|
+
--no-fail
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
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.
|
|
150
|
+
|
|
151
|
+
See the [operations guide](https://github.com/AgentsKit-io/code-review/blob/main/docs/OPERATIONS.md#local-ollama-review) for model sizing, health checks, failure handling, and self-hosted CI guidance.
|
|
152
|
+
|
|
153
|
+
## Use the GitHub Action
|
|
154
|
+
|
|
155
|
+
Add `.github/workflows/code-review.yml` to any repository:
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
name: Code Review
|
|
159
|
+
on:
|
|
160
|
+
pull_request:
|
|
161
|
+
types: [opened, synchronize, reopened]
|
|
162
|
+
|
|
163
|
+
permissions:
|
|
164
|
+
contents: read
|
|
165
|
+
pull-requests: write
|
|
166
|
+
|
|
167
|
+
jobs:
|
|
168
|
+
review:
|
|
169
|
+
runs-on: ubuntu-latest
|
|
170
|
+
steps:
|
|
171
|
+
- uses: AgentsKit-io/code-review@v0.4.0
|
|
172
|
+
with:
|
|
173
|
+
provider: openai
|
|
174
|
+
model: gpt-4o
|
|
175
|
+
api-key: ${{ secrets.LLM_API_KEY }}
|
|
176
|
+
# max-files: '17'
|
|
177
|
+
# max-calls: '1000'
|
|
178
|
+
# max-findings-per-file: '7'
|
|
179
|
+
# profile: 'full' # or fast for a bounded required-lens batch
|
|
180
|
+
# deadline-ms: '600000'
|
|
181
|
+
# fail-on-block: 'true' # advisory by default
|
|
182
|
+
# block: high
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
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.
|
|
186
|
+
|
|
187
|
+
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).
|
|
188
|
+
|
|
189
|
+
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.
|
|
190
|
+
|
|
191
|
+
## Choose how to run
|
|
192
|
+
|
|
193
|
+
| Mode | Provider examples | Credentials | Best for |
|
|
194
|
+
|---|---|---|---|
|
|
195
|
+
| Local CLI | `codex-cli`, `claude-cli`, `grok-cli`, `opencode-cli` | Existing CLI login | Local development or self-hosted runners |
|
|
196
|
+
| Hosted API | `openai`, `anthropic`, `gemini`, `mistral`, `groq` | Provider API key | Managed CI |
|
|
197
|
+
| Local model | `ollama` | Usually none | Privacy and predictable cost |
|
|
198
|
+
| Gateway | `openrouter` or a custom `--base-url` | Gateway-specific | Central routing and policy |
|
|
199
|
+
|
|
200
|
+
`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.
|
|
201
|
+
|
|
202
|
+
Credentials resolve in this order:
|
|
203
|
+
|
|
204
|
+
1. `--api-key`
|
|
205
|
+
2. `LLM_API_KEY`
|
|
206
|
+
3. `<PROVIDER>_API_KEY`, such as `OPENAI_API_KEY`
|
|
207
|
+
|
|
208
|
+
Secrets passed to the GitHub Action are forwarded through the environment, not included in command-line arguments.
|
|
209
|
+
|
|
210
|
+
## How review works
|
|
211
|
+
|
|
212
|
+
```mermaid
|
|
213
|
+
flowchart LR
|
|
214
|
+
A["Diff · PR · paths · stdin"] --> B["Normalize targets"]
|
|
215
|
+
B --> C["7 focused lenses"]
|
|
216
|
+
C --> D["Adversarial verification"]
|
|
217
|
+
D --> E["Thresholds + CI policy"]
|
|
218
|
+
E --> F["Markdown · GitHub · SARIF"]
|
|
219
|
+
D -. "weak finding" .-> G["Dropped with audit note"]
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
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.
|
|
223
|
+
|
|
224
|
+
## Common commands
|
|
225
|
+
|
|
226
|
+
```sh
|
|
227
|
+
# Tune verification and severity
|
|
228
|
+
npx --yes github:AgentsKit-io/code-review --provider codex-cli \
|
|
229
|
+
--base main --votes 5 --min-severity high
|
|
230
|
+
|
|
231
|
+
# Review a GitHub PR and post the result
|
|
232
|
+
GITHUB_TOKEN=... OPENAI_API_KEY=... \
|
|
233
|
+
npx --yes github:AgentsKit-io/code-review --provider openai --model gpt-4o \
|
|
234
|
+
--pr owner/repo#42 --post
|
|
235
|
+
|
|
236
|
+
# Review complete files or directories
|
|
237
|
+
npx --yes github:AgentsKit-io/code-review --provider claude-cli \
|
|
238
|
+
--paths src --max-files 30
|
|
239
|
+
|
|
240
|
+
# Review piped source and also write SARIF
|
|
241
|
+
echo 'const x = a.b' | npx --yes github:AgentsKit-io/code-review \
|
|
242
|
+
--provider ollama --model llama3 \
|
|
243
|
+
--base-url http://localhost:11434 --stdin --lang ts --sarif out.sarif
|
|
244
|
+
|
|
245
|
+
# After fetching the PR base and installing reviewdog, reuse its annotation transport
|
|
246
|
+
REPORT_FILE="$(mktemp)"
|
|
247
|
+
trap 'rm -f "${REPORT_FILE}"' EXIT
|
|
248
|
+
npx --yes github:AgentsKit-io/code-review#3dfd7427640148281454d52846d369e5ddf85b11 \
|
|
249
|
+
--provider openai --model gpt-4o \
|
|
250
|
+
--base "origin/${BASE_REF}" --sarif "${REPORT_FILE}" --no-fail &&
|
|
251
|
+
reviewdog -f=sarif -name=agentskit-review \
|
|
252
|
+
-reporter=github-pr-review -filter-mode=added -fail-level=error \
|
|
253
|
+
< "${REPORT_FILE}"
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
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](https://github.com/AgentsKit-io/code-review/blob/main/docs/OPERATIONS.md#route-findings-through-reviewdog) for pinned installation, base-branch checkout, permissions, severity mapping, and CI ownership of the failure threshold.
|
|
257
|
+
|
|
258
|
+
## CLI reference
|
|
259
|
+
|
|
260
|
+
### Providers
|
|
261
|
+
|
|
262
|
+
Run these commands from the repository you want to review:
|
|
263
|
+
|
|
264
|
+
| Provider | What you need | Model | Example |
|
|
265
|
+
|---|---|---|---|
|
|
266
|
+
| `codex-cli` | Codex CLI logged in | Optional | `npx --yes github:AgentsKit-io/code-review --provider codex-cli` |
|
|
267
|
+
| `claude-cli` | Claude CLI logged in | Optional | `npx --yes github:AgentsKit-io/code-review --provider claude-cli` |
|
|
268
|
+
| `grok-cli` | Grok Build CLI; stable ACP/headless | Optional | `... --provider grok-cli` |
|
|
269
|
+
| `opencode-cli` | OpenCode CLI; stable ACP/headless | Optional | `... --provider opencode-cli` |
|
|
270
|
+
| `openai` | `OPENAI_API_KEY` | Required | `... --provider openai --model gpt-4o` |
|
|
271
|
+
| `anthropic` | `ANTHROPIC_API_KEY` | Required | `... --provider anthropic --model <model>` |
|
|
272
|
+
| `gemini` | `GEMINI_API_KEY` | Required | `... --provider gemini --model <model>` |
|
|
273
|
+
| `ollama` | Ollama running locally | Required | `... --provider ollama --model llama3 --base-url http://localhost:11434` |
|
|
274
|
+
| `openrouter` | `OPENROUTER_API_KEY` | Required | `... --provider openrouter --model <model>` |
|
|
275
|
+
| Other adapters | `<PROVIDER>_API_KEY` when applicable | Usually required | `... --provider <name> --model <model>` |
|
|
276
|
+
|
|
277
|
+
In shortened examples, replace `...` with `npx --yes github:AgentsKit-io/code-review`.
|
|
278
|
+
|
|
279
|
+
### Options
|
|
280
|
+
|
|
281
|
+
| Flag | Meaning |
|
|
282
|
+
|---|---|
|
|
283
|
+
| `--provider <name>` | Required provider: local CLI or `@agentskit/adapters` factory |
|
|
284
|
+
| `--model <id>` | Model id; required for API/local-server providers |
|
|
285
|
+
| `--api-key <key>` | Provider key; environment variables are preferred |
|
|
286
|
+
| `--base-url <url>` | Provider endpoint, local server, or gateway |
|
|
287
|
+
| `--transport <name>` | Provider transport: `acp`, `headless`, or local-only `auto` where supported |
|
|
288
|
+
| `--base <ref>` | Git diff base; default `origin/main` |
|
|
289
|
+
| `--pr owner/repo#N` | GitHub PR source; requires `GITHUB_TOKEN` |
|
|
290
|
+
| `--paths <p...>` | Complete files or directories |
|
|
291
|
+
| `--stdin [--lang ts]` | Source read from stdin |
|
|
292
|
+
| `--post` | Post a batched review when the source is a PR |
|
|
293
|
+
| `--sarif <file>` | Also write SARIF |
|
|
294
|
+
| `--votes <n>` | Adversarial verification votes; default `3` |
|
|
295
|
+
| `--profile <full\|fast>` | Full review or one bounded required-lens batch |
|
|
296
|
+
| `--min-severity <level>` | Minimum reported severity |
|
|
297
|
+
| `--min-confidence <n>` | Minimum reported confidence |
|
|
298
|
+
| `--max-files <n>` | Positive file budget; over-budget runs are refused before the provider |
|
|
299
|
+
| `--max-calls <n>` | Provider-call budget; absolute ceiling `1000` |
|
|
300
|
+
| `--max-findings-per-file <n>` | Maximum verified findings per file; bounds adversarial verification calls |
|
|
301
|
+
| `--concurrency <n>` | Parallel model calls; default `1` for CLI providers, `4` for API providers |
|
|
302
|
+
| `--deadline-ms <n>` | Global run deadline; defaults to `600000` (`120000` for `fast`) |
|
|
303
|
+
| `--health-check <auto\|off>` | Bounded provider smoke check before model fan-out |
|
|
304
|
+
| `--plan`, `--dry-run` | Print provider-free preflight; add `--json` for machine output |
|
|
305
|
+
| `--validate-patch` | Run `git apply --check` on suggested patches |
|
|
306
|
+
| `--block <severity>` | CI gate floor; default `blocker` |
|
|
307
|
+
| `--no-fail` | Keep findings advisory |
|
|
308
|
+
| `--conventions <path>` | Inject project conventions |
|
|
309
|
+
| `--allow-incomplete` | Local-only exception for a config that declares incomplete lens coverage |
|
|
310
|
+
| `--allow-unredacted` | Local-only exception; rejected in CI |
|
|
311
|
+
| `--api` | Back-compatible alias for `--provider anthropic` |
|
|
312
|
+
| `doctor --provider <name>` | Offline provider diagnostics; no model request |
|
|
313
|
+
| `doctor --live` | Explicit provider smoke-test mode |
|
|
314
|
+
| `doctor --json` | Stable machine-readable diagnostics |
|
|
315
|
+
| `--mode <mode>` | `isolated` (default) or explicit local-only `trusted-local` |
|
|
316
|
+
| `--help` | Full command help |
|
|
317
|
+
|
|
318
|
+
When no conventions path is supplied, the CLI looks for `CONVENTIONS.md`, `CONTRIBUTING.md`, `.cursorrules`, or `AGENTS.md`.
|
|
319
|
+
|
|
320
|
+
### Versioned configuration
|
|
321
|
+
|
|
322
|
+
The repository may contain one strict `.agentskit-review.json` file. It must use
|
|
323
|
+
`configVersion: 1`; unknown fields, secrets, unsupported values, and unsafe lens
|
|
324
|
+
policies fail before provider execution with exit `2`. Every built-in lens is
|
|
325
|
+
enabled by default, with `correctness`, `security`, and `tests` required. Flags
|
|
326
|
+
override file values. A required lens may only be disabled in an explicitly
|
|
327
|
+
declared `incompleteProfile`, which requires `--allow-incomplete` locally and is
|
|
328
|
+
never accepted in CI.
|
|
329
|
+
|
|
330
|
+
```json
|
|
331
|
+
{
|
|
332
|
+
"configVersion": 1,
|
|
333
|
+
"profile": "full",
|
|
334
|
+
"lenses": {
|
|
335
|
+
"performance": { "enabled": false, "required": false }
|
|
336
|
+
},
|
|
337
|
+
"votes": 3,
|
|
338
|
+
"budget": { "maxFiles": 20, "maxCalls": 200, "concurrency": 1, "deadlineMs": 600000 },
|
|
339
|
+
"worker": { "timeoutMs": 120000, "maxOutputBytes": 20971520 },
|
|
340
|
+
"thresholds": { "minSeverity": "med", "minConfidence": 0.7 },
|
|
341
|
+
"context": { "mode": "prompt", "patterns": ["src/**"] }
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Provider, model, transport, context trust, redaction, and permissions are
|
|
346
|
+
trusted execution inputs; a project config cannot set them in CI. Put provider
|
|
347
|
+
credentials only in the environment or provider login, never in this file.
|
|
348
|
+
Remote and unknown provider boundaries redact high-confidence credential
|
|
349
|
+
patterns before the model sees source. Unsafe, oversized, binary, or excluded
|
|
350
|
+
paths are reported as `UNREVIEWED`; content is never silently truncated.
|
|
351
|
+
|
|
352
|
+
### Doctor
|
|
353
|
+
|
|
354
|
+
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.
|
|
355
|
+
|
|
356
|
+
```sh
|
|
357
|
+
npx --yes github:AgentsKit-io/code-review doctor --provider codex-cli
|
|
358
|
+
npx --yes github:AgentsKit-io/code-review doctor --provider openai --model gpt-4o --json
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## Cost and privacy
|
|
362
|
+
|
|
363
|
+
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.
|
|
364
|
+
|
|
365
|
+
## Operations and machine-readable docs
|
|
366
|
+
|
|
367
|
+
- [Operations guide](https://github.com/AgentsKit-io/code-review/blob/main/docs/OPERATIONS.md) — providers, permissions, secrets, cost controls, SARIF, failures, releases, and incident-safe defaults.
|
|
368
|
+
- [Provider compatibility matrix](https://github.com/AgentsKit-io/code-review/blob/main/docs/provider-compatibility.json) — stable CLI transports and their offline fixtures.
|
|
369
|
+
- [Agent handoff](https://github.com/AgentsKit-io/code-review/blob/main/docs/for-agents/code-review-cli.md) — ownership, edit roots, verification commands, and change routes.
|
|
370
|
+
- [`llms.txt`](https://github.com/AgentsKit-io/code-review/blob/main/llms.txt) — compact public source map for LLMs and coding agents.
|
|
371
|
+
- [`llms-full.txt`](https://github.com/AgentsKit-io/code-review/blob/main/llms-full.txt) — complete README, operations, and agent-handoff corpus.
|
|
372
|
+
- [`doc-bridge.config.json`](https://github.com/AgentsKit-io/code-review/blob/main/doc-bridge.config.json) — executable Doc Bridge corpus, ownership, and gate contract.
|
|
373
|
+
|
|
374
|
+
`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:
|
|
375
|
+
|
|
376
|
+
```sh
|
|
377
|
+
node examples/verify-readme.mjs
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
`npm pack --dry-run` verifies the release payload.
|
|
381
|
+
|
|
382
|
+
## Maturity
|
|
383
|
+
|
|
384
|
+
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](https://github.com/AgentsKit-io/code-review/blob/main/ROADMAP.md) and the [release guidance](https://github.com/AgentsKit-io/code-review/blob/main/docs/OPERATIONS.md#releases-and-maturity).
|
|
385
|
+
|
|
386
|
+
## Compatibility
|
|
387
|
+
|
|
388
|
+
- **Node.js 20+** (see `engines` in `package.json`)
|
|
389
|
+
- **TypeScript** source and compiled ESM distribution
|
|
390
|
+
- **GitHub Actions** composite Action at repository root (`action.yml`)
|
|
391
|
+
- Providers via local CLIs or [`@agentskit/adapters`](https://www.npmjs.com/package/@agentskit/adapters)
|
|
392
|
+
|
|
393
|
+
## AgentsKit ecosystem
|
|
394
|
+
|
|
395
|
+
Code Review is the verification step in the broader AgentsKit journey:
|
|
396
|
+
|
|
397
|
+
| Need | Continue with |
|
|
398
|
+
|---|---|
|
|
399
|
+
| Build the agent or custom review adapter | [AgentsKit](https://www.agentskit.io/docs) |
|
|
400
|
+
| Install the vendored review agent or explore ready agents | [Registry](https://registry.agentskit.io/docs) |
|
|
401
|
+
| Deliver review through a conversational application | [AgentsKit Chat](https://chat.agentskit.io/docs) |
|
|
402
|
+
| Apply engineering patterns before review | [Playbook](https://playbook.agentskit.io/docs) |
|
|
403
|
+
| Generate ownership-aware documentation handoffs | [Doc Bridge](https://agentskit-io.github.io/doc-bridge/) ([source](https://github.com/AgentsKit-io/doc-bridge)) |
|
|
404
|
+
| Add enterprise orchestration and production governance | [AKOS](https://akos.agentskit.io/docs) |
|
|
405
|
+
|
|
406
|
+
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.
|
|
407
|
+
|
|
408
|
+
## Contributing
|
|
409
|
+
|
|
410
|
+
Providers, review lenses, reporters, fixtures, documentation, and false-positive reductions are welcome. Start with [CONTRIBUTING.md](https://github.com/AgentsKit-io/code-review/blob/main/CONTRIBUTING.md), browse issues labeled `good first issue`, or propose a new provider/lens with the issue templates.
|
|
411
|
+
|
|
412
|
+
Please report vulnerabilities privately as described in [SECURITY.md](https://github.com/AgentsKit-io/code-review/blob/main/SECURITY.md).
|
|
413
|
+
Maintainer responsibilities, public decision-making, and the release process are
|
|
414
|
+
documented in [GOVERNANCE.md](https://github.com/AgentsKit-io/code-review/blob/main/GOVERNANCE.md).
|
|
415
|
+
|
|
416
|
+
## Roadmap
|
|
417
|
+
|
|
418
|
+
The near-term roadmap focuses on a stable `v1` Action, npm distribution, provider smoke tests, better cost visibility, and more community-owned review lenses. See [ROADMAP.md](https://github.com/AgentsKit-io/code-review/blob/main/ROADMAP.md).
|
|
419
|
+
|
|
420
|
+
## License
|
|
421
|
+
|
|
422
|
+
[MIT](https://github.com/AgentsKit-io/code-review/blob/main/LICENSE) © AgentsKit contributors.
|
|
423
|
+
## Operations guide
|
|
424
|
+
|
|
425
|
+
Canonical source: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/docs/OPERATIONS.md
|
|
426
|
+
|
|
427
|
+
# Code Review operations guide
|
|
428
|
+
|
|
429
|
+
This guide is the repository-native reference for running AgentsKit Code Review locally and in CI. The CLI is the source of truth for flags; run `agentskit-review --help` against the version or commit you use.
|
|
430
|
+
|
|
431
|
+
## Provider and credential choices
|
|
432
|
+
|
|
433
|
+
| Provider class | Examples | Secret or login | Network boundary |
|
|
434
|
+
|---|---|---|---|
|
|
435
|
+
| Logged-in local CLI | `codex-cli`, `claude-cli`, `grok-cli`, `opencode-cli` | Existing local login | Provider CLI policy |
|
|
436
|
+
| Hosted API | `openai`, `anthropic`, `gemini`, `mistral`, `groq` | Repository/org secret | Selected code reaches provider |
|
|
437
|
+
| Local model | `ollama` | Usually none | Host or runner network only |
|
|
438
|
+
| Gateway | `openrouter`, custom `--base-url` | Gateway secret | Gateway policy and routing |
|
|
439
|
+
|
|
440
|
+
Credential precedence is `--api-key`, `LLM_API_KEY`, then `<PROVIDER>_API_KEY`. Prefer environment variables and GitHub secrets: process arguments may be visible to other processes or captured by diagnostics. The composite Action forwards its secret through `LLM_API_KEY` and never adds it to CLI arguments.
|
|
441
|
+
|
|
442
|
+
Do not run hosted review on code whose policy forbids external processing. A local model reduces external disclosure but does not remove the need to secure the runner, logs, cache, and generated SARIF.
|
|
443
|
+
|
|
444
|
+
## Provider registry and doctor
|
|
445
|
+
|
|
446
|
+
Provider IDs are versioned registry entries. `grok` is the xAI API adapter, while `grok-cli` and `opencode-cli` are stable local CLI providers. `--list-providers` prints registry metadata and dynamically discovered API factories, including each support level (`stable`, `experimental`, or `unsupported`), transport, and model requirement.
|
|
447
|
+
|
|
448
|
+
Use the offline doctor before execution:
|
|
449
|
+
|
|
450
|
+
```sh
|
|
451
|
+
npx --yes github:AgentsKit-io/code-review doctor --provider codex-cli
|
|
452
|
+
npx --yes github:AgentsKit-io/code-review doctor --provider openai --model gpt-4o --json
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
It checks the named executable and version, transport, model requirement, configuration mode, and credential presence without making a model request. API keys are represented only as `configured` or `missing`; they are never printed. Local CLI credentials are represented as login-managed because login storage is provider-specific. `doctor --live` is the explicit provider smoke-test path; normal Codex reviews run the same bounded smoke check before fan-out. Unknown local CLI versions warn during local runs and fail in CI. Doctor exits `0` when checks pass, `1` when a provider check fails, and `2` for invalid usage.
|
|
456
|
+
|
|
457
|
+
## First local setup
|
|
458
|
+
|
|
459
|
+
```sh
|
|
460
|
+
git clone https://github.com/AgentsKit-io/code-review.git
|
|
461
|
+
cd code-review
|
|
462
|
+
npm install
|
|
463
|
+
npm run check
|
|
464
|
+
npx --yes github:AgentsKit-io/code-review --provider opencode-cli --transport acp --model openai/gpt-4o --no-fail
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
The last command requires an installed and authenticated OpenCode CLI. For a
|
|
468
|
+
credential-free verification, `npm run check` uses only the committed offline
|
|
469
|
+
fixtures. Precedence is explicit CLI flags, then the repository's
|
|
470
|
+
`.agentskit-review.json` policy, then safe defaults; the project file never
|
|
471
|
+
selects a trusted execution mode or carries credentials.
|
|
472
|
+
|
|
473
|
+
## Grok Build CLI via ACP
|
|
474
|
+
|
|
475
|
+
`grok-cli` is stable and uses `--transport acp` by default. It
|
|
476
|
+
starts `grok agent stdio --no-auto-update`, performs the ACP initialize,
|
|
477
|
+
authentication (when advertised), session, prompt, update, shutdown, and exit
|
|
478
|
+
sequence, then emits one `submit_findings` tool call. The worker accepts only a
|
|
479
|
+
`schemaVersion: 1` envelope with valid findings; malformed output gets one
|
|
480
|
+
bounded retry.
|
|
481
|
+
|
|
482
|
+
In the default `isolated` mode, provide `XAI_API_KEY` through the environment
|
|
483
|
+
or `--api-key`; the selected key is copied only into the temporary worker
|
|
484
|
+
environment. Existing `grok login` state is available only with explicit
|
|
485
|
+
local-only `--mode trusted-local`. Filesystem writes, terminal, MCP, plugin,
|
|
486
|
+
and subagent requests are denied, and the worker never uses the checkout as
|
|
487
|
+
its working directory. `doctor --provider grok-cli` checks executable/version
|
|
488
|
+
availability without making a model request. Headless mode is documented below
|
|
489
|
+
and must be selected explicitly.
|
|
490
|
+
|
|
491
|
+
## OpenCode CLI via ACP
|
|
492
|
+
|
|
493
|
+
`opencode-cli` is stable and uses `--transport acp` by default.
|
|
494
|
+
It starts `opencode acp`, performs the ACP initialize, session, prompt, update,
|
|
495
|
+
shutdown, and exit sequence, then emits one validated `submit_findings` tool
|
|
496
|
+
call. When `--model` is provided it is passed as OpenCode's `--model` option.
|
|
497
|
+
The worker allows no filesystem writes, terminal, MCP, plugin, or subagent
|
|
498
|
+
requests and retries malformed output once.
|
|
499
|
+
|
|
500
|
+
In the default `isolated` mode, provide `OPENCODE_API_KEY` through the
|
|
501
|
+
environment or `--api-key`; the selected key is copied only into the temporary
|
|
502
|
+
worker environment. Existing OpenCode login/configuration state is available
|
|
503
|
+
only with explicit local-only `--mode trusted-local`. The CLI does not install
|
|
504
|
+
OpenCode automatically.
|
|
505
|
+
`doctor --provider opencode-cli` checks executable/version availability without
|
|
506
|
+
making a model request. Headless mode is documented below and must be selected
|
|
507
|
+
explicitly.
|
|
508
|
+
|
|
509
|
+
## Grok and OpenCode headless transport
|
|
510
|
+
|
|
511
|
+
Headless mode is explicit with `--transport headless`. Grok uses
|
|
512
|
+
`grok --no-auto-update -p <prompt> --output-format json`; OpenCode uses
|
|
513
|
+
`opencode run --format json [--model provider/model] <prompt>`. Their output
|
|
514
|
+
framings are parsed separately and normalized to the same strict
|
|
515
|
+
`schemaVersion: 1` envelope. Surrounding logs are bounded and tolerated only
|
|
516
|
+
when the validated envelope can still be recovered.
|
|
517
|
+
|
|
518
|
+
`--transport auto` is a local convenience for these two providers:
|
|
519
|
+
it tries ACP first, reports the reason on stderr, then tries the provider's
|
|
520
|
+
headless command. It is rejected in CI so a pipeline cannot silently change
|
|
521
|
+
transport. Both paths use the same isolated worker timeout, output cap,
|
|
522
|
+
cancellation, temporary working directory, selected-credential injection, and
|
|
523
|
+
redacted diagnostics. Neither path installs a provider CLI automatically.
|
|
524
|
+
|
|
525
|
+
The executable compatibility source of truth is
|
|
526
|
+
[`provider-compatibility.json`](https://github.com/AgentsKit-io/code-review/blob/main/docs/provider-compatibility.json). It lists the
|
|
527
|
+
stable providers, every supported transport, required lenses, minimum version,
|
|
528
|
+
and the offline fixture that proves each cell. A provider remains experimental
|
|
529
|
+
until its registry entry, matrix, fixtures, and doctor checks are all green.
|
|
530
|
+
|
|
531
|
+
## pre-commit integration
|
|
532
|
+
|
|
533
|
+
The root `.pre-commit-hooks.yaml` exposes `agentskit-review` as a Node hook. It uses `pass_filenames: false` because the CLI reviews a Git diff, explicit paths, a pull request, or stdin rather than interpreting positional filenames. It is confined to the `manual` stage by default so cloning the hook does not silently add model calls to every commit.
|
|
534
|
+
|
|
535
|
+
Consumer configuration must select a provider through `args`. Keep credentials in the provider login or environment; never place API keys in `.pre-commit-config.yaml`. Before overriding the hook to `stages: [pre-push]`, decide whether findings are advisory, set a file budget, and confirm that provider latency and data handling are appropriate for every contributor.
|
|
536
|
+
|
|
537
|
+
The default diff base remains `origin/main`. A pre-commit invocation does not mean the input is limited to the Git staging area. Set `--base` explicitly when the repository uses another integration branch.
|
|
538
|
+
|
|
539
|
+
## Versioned review configuration
|
|
540
|
+
|
|
541
|
+
Use a strict `.agentskit-review.json` at the repository root for review policy.
|
|
542
|
+
It requires `configVersion: 1` and supports a `full` or `fast` profile. The
|
|
543
|
+
fast profile reviews correctness, security, and tests in one bounded batch with
|
|
544
|
+
one vote and no retry. The config also supports lens policy (`enabled` and
|
|
545
|
+
`required` per built-in lens), votes, retries, thresholds, file/byte/call,
|
|
546
|
+
concurrency and global-deadline budgets, conventions, and context selection. All built-in lenses
|
|
547
|
+
are enabled by default; correctness, security, and tests are required.
|
|
548
|
+
The shared local worker also accepts bounded `timeoutMs` and `maxOutputBytes`
|
|
549
|
+
settings; absolute ceilings are always enforced.
|
|
550
|
+
|
|
551
|
+
Flags override file values. The file cannot contain credentials or executable
|
|
552
|
+
plugins. Provider, model, transport, trust mode, redaction, permissions, and
|
|
553
|
+
other execution inputs are rejected when supplied by the project config in CI.
|
|
554
|
+
An intentionally incomplete profile must say `incompleteProfile: true` and be
|
|
555
|
+
run locally with `--allow-incomplete`; it is rejected in CI and cannot become an
|
|
556
|
+
approval. Malformed, unknown, or unsafe configuration exits `2` before a model
|
|
557
|
+
request and diagnostics do not print config values.
|
|
558
|
+
|
|
559
|
+
Keep policy-only configuration in the file. Use trusted workflow flags or the
|
|
560
|
+
runner environment for provider selection, credentials, and execution mode.
|
|
561
|
+
|
|
562
|
+
`prompt` is the default context mode. To review an explicit repository snapshot,
|
|
563
|
+
set `context.mode` to `isolated-snapshot` and provide repository-relative
|
|
564
|
+
patterns such as `src/**` or `!src/generated/**`. Sensitive directories/files,
|
|
565
|
+
symlink escapes, binaries, and over-limit inputs are excluded and shown as
|
|
566
|
+
`UNREVIEWED`. The default snapshot ceiling is 100 files/5 MiB; the absolute
|
|
567
|
+
ceiling is 500 files/25 MiB. Prompt files default to 256 KiB with a 1 MiB
|
|
568
|
+
absolute per-file ceiling.
|
|
569
|
+
|
|
570
|
+
Remote and unknown provider boundaries receive high-confidence credential
|
|
571
|
+
redaction while preserving file and line context. `--allow-unredacted` is a
|
|
572
|
+
local-only escape hatch and is rejected in CI; never use it for untrusted code.
|
|
573
|
+
|
|
574
|
+
## Local Ollama review
|
|
575
|
+
|
|
576
|
+
Ollama serves its local API at `http://localhost:11434` by default. Verify the service without sending repository content:
|
|
577
|
+
|
|
578
|
+
```sh
|
|
579
|
+
curl --fail --silent http://localhost:11434/api/tags >/dev/null
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
Choose a tool-capable model that fits the host; tool calling is required because every lens submits a structured result. `qwen2.5-coder:7b` is a practical starting point for machines that cannot run the larger `qwen3-coder:30b`; model quality, context capacity, latency, and memory requirements vary. Pulling a model downloads several gigabytes and does not start a review:
|
|
583
|
+
|
|
584
|
+
```sh
|
|
585
|
+
ollama pull qwen2.5-coder:7b
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
Start with a bounded, advisory branch review:
|
|
589
|
+
|
|
590
|
+
```sh
|
|
591
|
+
npx --yes github:AgentsKit-io/code-review \
|
|
592
|
+
--provider ollama \
|
|
593
|
+
--model qwen2.5-coder:7b \
|
|
594
|
+
--base main \
|
|
595
|
+
--base-url http://localhost:11434 \
|
|
596
|
+
--max-files 10 \
|
|
597
|
+
--concurrency 1 \
|
|
598
|
+
--no-fail
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
The default source is the committed Git diff from `--base` to `HEAD`. It does not mean “only staged files,” even when invoked by a Git hook. Use `--paths` when complete files are the intended source. Avoid piping a unified Git patch through `--stdin`: stdin is treated as one source file rather than parsed into per-file changed ranges.
|
|
602
|
+
|
|
603
|
+
Seven primary lenses plus adversarial votes can be expensive for a local model, and each structured result can require more than one model turn. Begin with `--max-files 10`, `--concurrency 1`, and the default three votes. Reduce the file set before reducing verification depth. `--no-fail` makes surviving findings advisory; it does not hide an unavailable model, malformed response, unreadable source, or failed lens coverage.
|
|
604
|
+
|
|
605
|
+
For a self-hosted runner, bind Ollama only to the network interfaces required by the job, isolate the runner per repository trust boundary, and protect job logs and artifacts. Do not set a hosted gateway as `--base-url` and describe the run as local. Any optional telemetry or observability exporter creates a separate network boundary that must be approved explicitly.
|
|
606
|
+
|
|
607
|
+
Troubleshooting:
|
|
608
|
+
|
|
609
|
+
- **Connection refused:** start Ollama and repeat the `/api/tags` health check.
|
|
610
|
+
- **Model not found:** run `ollama pull <exact-model-id>` and pass the same id to `--model`.
|
|
611
|
+
- **Slow or out-of-memory:** choose a smaller model, reduce `--max-files`, and keep `--concurrency 1`.
|
|
612
|
+
- **Context overflow:** review narrower paths or a smaller branch diff; unreviewed files must remain visibly outside the result.
|
|
613
|
+
- **No findings with exit 0:** inspect the summary and successful/failed lens counts; advisory output is not proof that every file was reviewed.
|
|
614
|
+
|
|
615
|
+
## GitHub Action permissions
|
|
616
|
+
|
|
617
|
+
The copy-ready workflow in [`examples/pull-request.yml`](https://github.com/AgentsKit-io/code-review/blob/main/examples/pull-request.yml) requires:
|
|
618
|
+
|
|
619
|
+
```yaml
|
|
620
|
+
permissions:
|
|
621
|
+
contents: read
|
|
622
|
+
pull-requests: write
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
`contents: read` loads the PR source. `pull-requests: write` posts the batched review. Do not grant repository administration, package write, or workflow write. Fork PRs do not receive normal repository secrets; do not switch to `pull_request_target` merely to expose a model key, because that can execute or process untrusted contributions with privileged context.
|
|
626
|
+
|
|
627
|
+
The composite Action defaults to 17 files, 7 findings per file, 1,000 provider calls, and a 10-minute global deadline. `codex-cli` is accepted only with `mode: trusted-local` on a pre-authenticated self-hosted runner; use an API provider with a secret on GitHub-hosted runners.
|
|
628
|
+
|
|
629
|
+
Use environment protection or organization secrets for sensitive providers. Rotate a secret after suspected exposure and review provider usage plus GitHub audit logs.
|
|
630
|
+
|
|
631
|
+
When `--post` is used with `--pr`, the reviewer stores a hidden SHA and policy
|
|
632
|
+
fingerprint marker in the summary comment. Re-running the same head SHA with
|
|
633
|
+
the same policy skips provider calls and updates no comments. A new SHA uses
|
|
634
|
+
GitHub compare scope only when the previous marked SHA is an ancestor; a
|
|
635
|
+
missing marker, force-push, or changed fingerprint falls back to the full PR
|
|
636
|
+
file list. Fork PRs are reported as `SKIPPED` with exit `2` on this workflow
|
|
637
|
+
boundary; do not switch to `pull_request_target` to expose secrets. Summary
|
|
638
|
+
comments are reconciled by marker, while POST/PATCH failures remain visible for
|
|
639
|
+
manual retry.
|
|
640
|
+
|
|
641
|
+
## Advisory and blocking behavior
|
|
642
|
+
|
|
643
|
+
The Action is advisory by default: `fail-on-block: 'false'` adds `--no-fail`. Findings still post, but surviving blocker/high findings do not fail the job. `--no-fail` never suppresses provider, source, reporter, or review-execution errors. For enforcement:
|
|
644
|
+
|
|
645
|
+
```yaml
|
|
646
|
+
with:
|
|
647
|
+
block: high
|
|
648
|
+
fail-on-block: 'true'
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
Then require the workflow check in branch protection. CLI exit codes are:
|
|
652
|
+
|
|
653
|
+
| Exit | Meaning | Operator action |
|
|
654
|
+
|---:|---|---|
|
|
655
|
+
| `0` | Review completed; no blocking finding, or advisory mode | Inspect posted/report output |
|
|
656
|
+
| `1` | A finding at or above `--block` survived | Fix, dismiss with evidence, or change policy intentionally |
|
|
657
|
+
| `2` | Configuration, provider, source, or reporter failure | Inspect stderr; do not interpret as a clean review |
|
|
658
|
+
|
|
659
|
+
A model response that is malformed may drop one lens while other lenses continue; progress output and the final summary report successful and failed primary-lens counts. If any reviewable file cannot be ingested or has zero successful primary lenses, the pipeline stops before reporters run and exits `2`, including in advisory mode. Treat missing output or exit `2` as unavailable review, not approval.
|
|
660
|
+
|
|
661
|
+
Use `--plan --json` (or `--dry-run`) to run the source and budget preflight without a model request. The plan reports profile, batching, files, bytes, enabled and required lenses, votes, retries, concurrency, deadline, estimated provider calls, every `UNREVIEWED` path with its reason, and concrete reductions when a limit would be exceeded. Estimates are always `best-effort`: primary lens demand is predictable, but model output determines how many skeptical verification calls are needed. The runtime counter remains the hard ceiling and fails closed if demand exceeds it. The preflight refuses before the provider starts when the predictable primary demand already exceeds the budget; `maxCalls` is capped at 1000 and unlimited mode is not supported. A required-lens failure is `INCOMPLETE` and exits `2`, including with `--no-fail`.
|
|
662
|
+
|
|
663
|
+
For a PR that exceeds one review budget, use deterministic coverage batches instead of accepting an incomplete review. Run `--plan --json --batch-size <n> --batch-manifest <private-file>` to create a private manifest keyed by repository, PR, head SHA, and policy fingerprint. Each `--batch-index <n> --result <private-file>` run is deliberately incomplete by itself and rejects `--post`; its result artifact carries the same identity plus its exact file manifest. `--consolidate-manifest <manifest> --artifacts <comma-list> --result <private-file>` rejects a missing, duplicate, stale, mismatched, failed, deadline-exceeded, or required-lens-incomplete artifact. Only that consolidated artifact is accepted by `--publish-result <file> --pr owner/repo#N --post`, which rechecks current SHA and policy before creating the one GitHub review. Delete or replace the private state when the PR SHA or policy changes; never upload it as a CI artifact or commit it.
|
|
664
|
+
|
|
665
|
+
## Cost and latency controls
|
|
666
|
+
|
|
667
|
+
Seven lenses fan out over selected files; candidate findings then receive adversarial votes. The primary controls are:
|
|
668
|
+
|
|
669
|
+
- `--max-files`: positive hard file budget;
|
|
670
|
+
- `--max-calls`: bounded provider-call budget (absolute ceiling 1000);
|
|
671
|
+
- `--max-findings-per-file`: positive verified-finding budget per file;
|
|
672
|
+
- `--votes`: verification depth and cost;
|
|
673
|
+
- `--concurrency`: simultaneous model/subprocess calls (default 1 for CLI providers, 4 for API providers);
|
|
674
|
+
- `--profile fast`: one bounded correctness/security/tests batch per file, one vote, and no retry;
|
|
675
|
+
- `--deadline-ms`: hard global deadline; active local workers receive the abort signal and queued calls do not start;
|
|
676
|
+
- `--health-check`: bounded provider smoke check before fan-out (`auto` or `off`);
|
|
677
|
+
- `--paths` or workflow path filters: narrow scope;
|
|
678
|
+
- `--min-severity` and `--min-confidence`: output noise, not input-token cost.
|
|
679
|
+
|
|
680
|
+
Start advisory with a small file budget, measure provider usage, and raise depth only where it improves signal. Never present an unmeasured cost estimate as a guaranteed price.
|
|
681
|
+
|
|
682
|
+
Every completed report includes provider-call evidence: calls started, failed,
|
|
683
|
+
skipped by the circuit/budget, elapsed time, deadline status, and circuit state.
|
|
684
|
+
The circuit opens immediately for authentication, timeout, or cancellation
|
|
685
|
+
failures and after repeated transient provider failures. Incomplete evidence is
|
|
686
|
+
never an approval.
|
|
687
|
+
|
|
688
|
+
## SARIF
|
|
689
|
+
|
|
690
|
+
`--sarif out.sarif` writes SARIF 2.1.0 alongside Markdown. Each surviving finding includes a `code-review/<category>` rule, severity level, message, file, and line. Uploading SARIF to GitHub code scanning requires the separate `security-events: write` permission and `github/codeql-action/upload-sarif`; the bundled Action does not request that permission or upload automatically.
|
|
691
|
+
|
|
692
|
+
SARIF can contain source paths and model-generated explanations. Apply the same retention and access policy as CI logs.
|
|
693
|
+
|
|
694
|
+
### Route findings through reviewdog
|
|
695
|
+
|
|
696
|
+
[reviewdog](https://github.com/reviewdog/reviewdog) accepts SARIF directly, so no AgentsKit-specific reporter or converter is required. This complete pull-request job installs reviewdog, fetches the base history, generates the report in advisory mode, and lets reviewdog own diff filtering, annotations, and the final CI threshold:
|
|
697
|
+
|
|
698
|
+
```yaml
|
|
699
|
+
name: AgentsKit reviewdog
|
|
700
|
+
on: pull_request
|
|
701
|
+
|
|
702
|
+
permissions:
|
|
703
|
+
contents: read
|
|
704
|
+
pull-requests: write
|
|
705
|
+
|
|
706
|
+
jobs:
|
|
707
|
+
review:
|
|
708
|
+
runs-on: ubuntu-latest
|
|
709
|
+
steps:
|
|
710
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
711
|
+
with:
|
|
712
|
+
fetch-depth: 0
|
|
713
|
+
- uses: reviewdog/action-setup@d8edfce3dd5e1ec6978745e801f9c50b5ef80252 # v1.4.0
|
|
714
|
+
with:
|
|
715
|
+
reviewdog_version: v0.21.0
|
|
716
|
+
- name: Review changed code
|
|
717
|
+
env:
|
|
718
|
+
BASE_REF: ${{ github.base_ref }}
|
|
719
|
+
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
|
720
|
+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
721
|
+
run: |
|
|
722
|
+
REPORT_FILE="$(mktemp)"
|
|
723
|
+
trap 'rm -f "${REPORT_FILE}"' EXIT
|
|
724
|
+
npx --yes github:AgentsKit-io/code-review#3dfd7427640148281454d52846d369e5ddf85b11 \
|
|
725
|
+
--provider openai --model gpt-4o --base "origin/${BASE_REF}" \
|
|
726
|
+
--sarif "${REPORT_FILE}" --no-fail &&
|
|
727
|
+
reviewdog -f=sarif -name=agentskit-review \
|
|
728
|
+
-reporter=github-pr-review -filter-mode=added -fail-level=error \
|
|
729
|
+
< "${REPORT_FILE}"
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
The hosted-runner example uses an API provider because local CLI providers require their executable and an existing authenticated session. Replace the provider and model with your approved adapter. The base comes from the pull-request event rather than assuming `main`, and `fetch-depth: 0` makes its remote-tracking ref available to `git diff`. Pass the provider secret through `LLM_API_KEY`, pass the workflow token through `REVIEWDOG_GITHUB_API_TOKEN`, and grant only `contents: read` plus `pull-requests: write`.
|
|
733
|
+
|
|
734
|
+
The temporary report and `&&` prevent reviewdog from reading stale output when the producer fails. Keep `--no-fail` on the producer so reviewdog receives the complete report when review succeeds; `-fail-level=error` then makes SARIF `error` findings fail the reviewdog step. AgentsKit maps blocker and high findings to SARIF `error`, medium to `warning`, and nit to `note`.
|
|
735
|
+
|
|
736
|
+
The default `added` filter limits inline feedback to changed lines. Choose a broader reviewdog filter deliberately; broader modes can move findings outside the PR diff into checks, annotations, or console output depending on the reporter. Pin both Code Review and reviewdog to reviewed immutable versions in enforcement workflows.
|
|
737
|
+
|
|
738
|
+
## Failure scenarios
|
|
739
|
+
|
|
740
|
+
- **Unknown provider or missing model:** validate with `--list-providers`; API/local-server adapters require `--model`.
|
|
741
|
+
- **Authentication failure:** verify only the provider-specific secret/login and avoid printing its value. A terminal authentication failure stops remaining lenses immediately and the review exits incomplete rather than spending one failed call per lens.
|
|
742
|
+
- **Rate limit or timeout:** Codex calls stop after 300 seconds by default; other local CLI calls use 120 seconds. Set `AGENTSKIT_REVIEW_SUBPROCESS_TIMEOUT_MS` to a positive millisecond value when needed, reduce concurrency/file budget, or use an approved gateway; retry only when provider policy makes the operation safe.
|
|
743
|
+
- **No PR comments:** confirm `pull-requests: write`, token availability, and fork restrictions. The Markdown report still appears in logs.
|
|
744
|
+
- **Inline comment rejected:** the reporter falls back to a non-approving comment for GitHub 422 restrictions.
|
|
745
|
+
- **Large diff:** GitHub PR reviews cap metadata at 500 files, select only the configured file budget before downloading contents, and stop content downloads at the byte budget. Set `--max-files`/`--max-calls` or split review by paths; truncated or unreviewed files must not be described as reviewed.
|
|
746
|
+
- **Ollama timeout:** Requests stop after 30 seconds by default. Use a smaller scope or a responsive local model when the request is aborted; a stalled model must not hold the review indefinitely.
|
|
747
|
+
- **Provider unavailable:** fail or mark the check unavailable according to team policy; never silently convert it to approval.
|
|
748
|
+
|
|
749
|
+
## Releases and maturity
|
|
750
|
+
|
|
751
|
+
The current package is `0.4.0` and the project is pre-v1:
|
|
752
|
+
|
|
753
|
+
- GitHub-source CLI commands can pin a commit SHA after `github:AgentsKit-io/code-review#<sha>`;
|
|
754
|
+
- Actions should pin `@v0.4.0` or a full commit SHA;
|
|
755
|
+
- a moving `@main` reference is suitable only when that mutability is accepted;
|
|
756
|
+
- the future `@v1` Action tag remains a separate stability milestone.
|
|
757
|
+
|
|
758
|
+
Release work updates [`CHANGELOG.md`](https://github.com/AgentsKit-io/code-review/blob/main/CHANGELOG.md), [`ROADMAP.md`](https://github.com/AgentsKit-io/code-review/blob/main/ROADMAP.md), package version, immutable tag guidance, and signed/provenance evidence when available. Run `npm run check` and `npm pack --dry-run` before publishing.
|
|
759
|
+
|
|
760
|
+
### Automated npm publishing
|
|
761
|
+
|
|
762
|
+
Changesets is the release source of truth. A product-affecting pull request adds a small Markdown file in `.changeset/` that names `@agentskit/code-review`, selects `patch`, `minor`, or `major`, and explains the user-visible change. Documentation-only, test-only, and CI-only pull requests add `npx changeset --empty` when they intentionally require no release.
|
|
763
|
+
|
|
764
|
+
Every merge to `main` runs `.github/workflows/release.yml`. When pending non-empty changesets exist, it creates or updates the `chore: version packages` pull request on the trusted `changeset-release/main` branch. That pull request contains the version bump, generated `CHANGELOG.md` entry, and consumed changesets. Merging this version pull request is the only automatic publish trigger. This extra review boundary is intentional: ordinary feature merges collect safely, while the versioned release has a concrete, reviewable diff. A maintainer-authored release PR may use the explicitly allowlisted `codex/release-0.4.1` recovery branch when repository rules prevent the bot PR from receiving required checks.
|
|
765
|
+
|
|
766
|
+
`.github/workflows/publish.yml` runs only after that trusted version pull request is merged. It checks out that exact merge commit, verifies the package version and a clean release payload with `npm run check` and `npm pack --dry-run`, publishes `@agentskit/code-review` using [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/) (OIDC), then creates the immutable `v<version>` GitHub Release. If npm already has the exact version, it skips only the publish step and still creates a missing GitHub release; normal PR-triggered runs cannot publish a duplicate. No long-lived `NPM_TOKEN`, npm access token, or personal GitHub token is stored in this repository. GitHub's built-in workflow token is used only to create the version PR and GitHub release.
|
|
767
|
+
|
|
768
|
+
Before the first release, configure the npm package's Trusted Publisher for GitHub Actions with:
|
|
769
|
+
|
|
770
|
+
- Organization: `AgentsKit-io`
|
|
771
|
+
- Repository: `code-review`
|
|
772
|
+
- Workflow filename: `publish.yml`
|
|
773
|
+
|
|
774
|
+
Enable GitHub Actions permission to create pull requests only when the repository setting requires it for Changesets. Keep branch protection configured to require human review: the workflow never approves or merges its own version PR. This repository-wide setting can also permit workflow approvals, so restrict `pull-requests: write` to the version workflow and do not count workflow approvals toward the required human review. The npm configuration is a one-time external prerequisite; the GitHub workflow cannot create it. Do not run `npm publish` locally.
|
|
775
|
+
|
|
776
|
+
The publish workflow has no manual dispatch path: only a merged, title-matched Changesets version pull request from an explicitly allowlisted release branch can publish. If a release is interrupted, repair it through a new reviewed version PR rather than granting an arbitrary ref publishing authority.
|
|
777
|
+
|
|
778
|
+
## Contribution and security
|
|
779
|
+
|
|
780
|
+
Start with [`CONTRIBUTING.md`](https://github.com/AgentsKit-io/code-review/blob/main/CONTRIBUTING.md). Provider integrations must preserve the AgentsKit adapter contract and keep secrets out of arguments/logs. Review lenses need reproducible evidence and false-positive fixtures. Report vulnerabilities privately through [`SECURITY.md`](https://github.com/AgentsKit-io/code-review/blob/main/SECURITY.md).
|
|
781
|
+
|
|
782
|
+
For adjacent work, use [AgentsKit](https://www.agentskit.io/docs) for runtime and adapters, [Registry](https://registry.agentskit.io/docs) for the vendored agent, [AgentsKit Chat](https://chat.agentskit.io/docs) when review belongs inside a conversational application, [Playbook](https://playbook.agentskit.io/docs) for engineering patterns, [Doc Bridge](https://agentskit-io.github.io/doc-bridge/) for documentation ownership handoffs, and [AKOS](https://akos.agentskit.io/docs) for enterprise orchestration and production governance.
|
|
783
|
+
|
|
784
|
+
Machine readers should start with [`llms.txt`](https://github.com/AgentsKit-io/code-review/blob/main/llms.txt), escalate to [`llms-full.txt`](https://github.com/AgentsKit-io/code-review/blob/main/llms-full.txt) only when the complete corpus is required, and use [`docs/for-agents`](https://github.com/AgentsKit-io/code-review/blob/main/docs/for-agents/index.md) before changing an owned module.
|
|
785
|
+
## Agent documentation index
|
|
786
|
+
|
|
787
|
+
Canonical source: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/docs/for-agents/index.md
|
|
788
|
+
|
|
789
|
+
# Code Review agent docs
|
|
790
|
+
|
|
791
|
+
- Code Review CLI handoff — ownership, change routes, security boundaries, and verification: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/docs/for-agents/code-review-cli.md
|
|
792
|
+
- Concise machine map — discovery, raw sources, and all seven ecosystem products: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/llms.txt
|
|
793
|
+
- Full machine corpus — public, operational, governance, maturity, and agent handoffs: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/llms-full.txt
|
|
794
|
+
## Code Review agent handoff
|
|
795
|
+
|
|
796
|
+
Canonical source: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/docs/for-agents/code-review-cli.md
|
|
797
|
+
|
|
798
|
+
---
|
|
799
|
+
type: package
|
|
800
|
+
package: code-review-cli
|
|
801
|
+
editRoot: .
|
|
802
|
+
checks: [npm run check, npm pack --dry-run]
|
|
803
|
+
---
|
|
804
|
+
|
|
805
|
+
# Code Review CLI handoff
|
|
806
|
+
|
|
807
|
+
## Purpose
|
|
808
|
+
|
|
809
|
+
Provider-neutral, low-noise AI code review for local Git diffs, files/stdin, and GitHub pull requests. Seven focused lenses propose findings; adversarial votes remove weak findings; reporters emit Markdown, GitHub reviews, and SARIF.
|
|
810
|
+
|
|
811
|
+
## Ownership map
|
|
812
|
+
|
|
813
|
+
- `src/cli.ts`: public flags, source selection, provider selection, exit policy.
|
|
814
|
+
- `src/<provider>-adapter.ts`: logged-in local CLI adapters.
|
|
815
|
+
- `agents/code-review/`: review pipeline, lenses, input normalization, reporters.
|
|
816
|
+
- `action.yml`: composite GitHub Action contract.
|
|
817
|
+
- `.github/workflows/release.yml`: Changesets version-pull-request workflow.
|
|
818
|
+
- `.github/workflows/publish.yml`: version-PR-gated npm Trusted Publishing and GitHub Release workflow.
|
|
819
|
+
- `examples/`: copy-ready Action workflows.
|
|
820
|
+
- `README.md` and `docs/OPERATIONS.md`: public adoption and operations guidance.
|
|
821
|
+
- `ecosystem.json`, `llms.txt`, and `llms-full.txt`: canonical product graph and machine-readable discovery/full-corpus surfaces.
|
|
822
|
+
- `test/`: credential-free CLI, Action, and documentation contract proofs.
|
|
823
|
+
|
|
824
|
+
## Boundaries
|
|
825
|
+
|
|
826
|
+
- Depend on AgentsKit adapter/runtime/tool contracts; do not create a second model abstraction.
|
|
827
|
+
- Preserve provider neutrality and advisory-by-default Action behavior.
|
|
828
|
+
- Never expose provider keys in arguments, docs fixtures, logs, or PR output.
|
|
829
|
+
- This product intentionally has no Fumadocs site and no embedded AgentsChat.
|
|
830
|
+
- The vendored review agent tracks the AgentsKit Registry source; keep divergences explicit.
|
|
831
|
+
|
|
832
|
+
## Change routes
|
|
833
|
+
|
|
834
|
+
- CLI flag/provider behavior: start at `src/cli.ts`, then update README, operations docs, and tests.
|
|
835
|
+
- Local CLI subprocess behavior: start at the matching `src/<provider>-adapter.ts` and add an offline fixture.
|
|
836
|
+
- Review logic or noise reduction: start at `agents/code-review/agent.ts` and the relevant lens; prove both survival and rejection behavior.
|
|
837
|
+
- GitHub comments/SARIF: start at `agents/code-review/reporters.ts` and verify permissions/failure docs.
|
|
838
|
+
- Action input: update `action.yml`, `examples/pull-request.yml`, README, and contract tests together.
|
|
839
|
+
- Release automation: update `.github/workflows/release.yml`, `.github/workflows/publish.yml`, Changesets configuration, and the automated publishing section in `docs/OPERATIONS.md` together.
|
|
840
|
+
|
|
841
|
+
## Verification
|
|
842
|
+
|
|
843
|
+
```bash
|
|
844
|
+
npm ci
|
|
845
|
+
npm run check
|
|
846
|
+
npm pack --dry-run
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
`npm run check` includes typecheck, build, an end-to-end offline stdin review, Action/documentation tests, Doc Bridge gates, and CLI help.
|
|
850
|
+
|
|
851
|
+
## Ecosystem routes
|
|
852
|
+
|
|
853
|
+
- AgentsKit — runtime, adapters, and custom review agents: https://www.agentskit.io/docs
|
|
854
|
+
- Registry — ready-made agent source: https://registry.agentskit.io/docs
|
|
855
|
+
- AgentsKit Chat — conversational delivery; do not embed a chat runtime here: https://chat.agentskit.io/docs
|
|
856
|
+
- Playbook — engineering discipline before verification: https://playbook.agentskit.io/docs
|
|
857
|
+
- Doc Bridge — documentation ownership, freshness, and handoff generation: https://agentskit-io.github.io/doc-bridge/
|
|
858
|
+
- AKOS — enterprise orchestration and production governance: https://akos.agentskit.io/docs
|
|
859
|
+
|
|
860
|
+
Use `llms.txt` for discovery and `llms-full.txt` only when the complete public, operational, and agent-handoff context is required.
|
|
861
|
+
|
|
862
|
+
## Human guide
|
|
863
|
+
|
|
864
|
+
- README: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/README.md
|
|
865
|
+
- Operations guide: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/docs/OPERATIONS.md
|
|
866
|
+
- Contributing: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/CONTRIBUTING.md
|
|
867
|
+
- Security: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/SECURITY.md
|
|
868
|
+
## Security policy
|
|
869
|
+
|
|
870
|
+
Canonical source: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/SECURITY.md
|
|
871
|
+
|
|
872
|
+
# Security Policy
|
|
873
|
+
|
|
874
|
+
## Supported versions
|
|
875
|
+
|
|
876
|
+
Security fixes are provided for the latest published release. Older releases may
|
|
877
|
+
be asked to upgrade before receiving a fix.
|
|
878
|
+
|
|
879
|
+
## Reporting a vulnerability
|
|
880
|
+
|
|
881
|
+
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.
|
|
882
|
+
|
|
883
|
+
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.
|
|
884
|
+
|
|
885
|
+
## Scope reminders
|
|
886
|
+
|
|
887
|
+
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.
|
|
888
|
+
## Contributing guide
|
|
889
|
+
|
|
890
|
+
Canonical source: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/CONTRIBUTING.md
|
|
891
|
+
|
|
892
|
+
# Contributing
|
|
893
|
+
|
|
894
|
+
Thanks for helping make AI code review more useful and less noisy.
|
|
895
|
+
|
|
896
|
+
## Start here
|
|
897
|
+
|
|
898
|
+
1. Fork and clone the repository.
|
|
899
|
+
2. Create a focused branch from `main`.
|
|
900
|
+
3. Run `npm install`.
|
|
901
|
+
4. Make the smallest change that solves the issue.
|
|
902
|
+
5. Run `npm run check` before opening a pull request.
|
|
903
|
+
|
|
904
|
+
Node.js 20 or newer is required.
|
|
905
|
+
|
|
906
|
+
## Project map
|
|
907
|
+
|
|
908
|
+
- `src/cli.ts` — arguments, providers, review policy, and reporters.
|
|
909
|
+
- `src/*-adapter.ts` — adapters for logged-in local CLIs.
|
|
910
|
+
- `agents/code-review/` — vendored review agent, lenses, sources, and reporters.
|
|
911
|
+
- `action.yml` — GitHub Action interface.
|
|
912
|
+
- `examples/` — copy-ready workflows.
|
|
913
|
+
|
|
914
|
+
## Good contributions
|
|
915
|
+
|
|
916
|
+
- Reduce a reproducible false positive.
|
|
917
|
+
- Add a provider through the existing adapter contract.
|
|
918
|
+
- Add a focused review lens with clear evidence requirements.
|
|
919
|
+
- Improve a reporter or source without tying it to one model.
|
|
920
|
+
- Add provider-neutral examples and documentation.
|
|
921
|
+
|
|
922
|
+
Please open an issue before a large architectural change. Small fixes and documentation improvements can go straight to a pull request.
|
|
923
|
+
|
|
924
|
+
## Pull requests
|
|
925
|
+
|
|
926
|
+
- Keep one concern per PR.
|
|
927
|
+
- Explain the user-visible behavior and how you tested it.
|
|
928
|
+
- Add or update tests for behavior changes.
|
|
929
|
+
- Preserve provider neutrality: provider-specific behavior belongs in its adapter.
|
|
930
|
+
- Never commit API keys, model output containing private code, or review tokens.
|
|
931
|
+
- Update README or examples when changing the public CLI or Action interface.
|
|
932
|
+
|
|
933
|
+
Project decisions, maintainer responsibilities, and the release process are
|
|
934
|
+
documented in [GOVERNANCE.md](https://github.com/AgentsKit-io/code-review/blob/main/GOVERNANCE.md).
|
|
935
|
+
|
|
936
|
+
By participating, you agree to follow the [Code of Conduct](https://github.com/AgentsKit-io/code-review/blob/main/CODE_OF_CONDUCT.md).
|
|
937
|
+
## Roadmap
|
|
938
|
+
|
|
939
|
+
Canonical source: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/ROADMAP.md
|
|
940
|
+
|
|
941
|
+
# Roadmap
|
|
942
|
+
|
|
943
|
+
This roadmap communicates direction, not a promise of dates.
|
|
944
|
+
|
|
945
|
+
## Toward v1
|
|
946
|
+
|
|
947
|
+
- [ ] Publish the calibrated `0.4.x` line of `@agentskit/code-review` and signed release artifacts.
|
|
948
|
+
- [ ] Publish immutable GitHub Action releases with a moving `v1` tag.
|
|
949
|
+
- [ ] Add credential-free adapter contract tests and opt-in provider smoke tests.
|
|
950
|
+
- [ ] Document measured review cost and latency by configuration.
|
|
951
|
+
- [ ] Expand fixtures for false-positive and multi-language regression testing.
|
|
952
|
+
|
|
953
|
+
## Community tracks
|
|
954
|
+
|
|
955
|
+
- Review lenses with precise evidence and low false-positive rates.
|
|
956
|
+
- Additional local CLI and private-gateway adapters.
|
|
957
|
+
- Reporters for other code-hosting and CI systems.
|
|
958
|
+
- Better SARIF, monorepo, and large-diff workflows.
|
|
959
|
+
|
|
960
|
+
Open an issue before starting a large item so maintainers and contributors can align on scope.
|
|
961
|
+
## Changelog
|
|
962
|
+
|
|
963
|
+
Canonical source: https://raw.githubusercontent.com/AgentsKit-io/code-review/main/CHANGELOG.md
|
|
964
|
+
|
|
965
|
+
# Changelog
|
|
966
|
+
|
|
967
|
+
## 0.4.2
|
|
968
|
+
|
|
969
|
+
### Patch Changes
|
|
970
|
+
|
|
971
|
+
- [#78](https://github.com/AgentsKit-io/code-review/pull/78) [`f50bb3d`](https://github.com/AgentsKit-io/code-review/commit/f50bb3daceb7e48c8cd1401e47352ebd33000a8f) Thanks [@EmersonBraun](https://github.com/EmersonBraun)! - Make provider-call preflight guidance consistent with demand-driven skeptical verification and document the best-effort estimate semantics.
|
|
972
|
+
|
|
973
|
+
## 0.4.1
|
|
974
|
+
|
|
975
|
+
### Patch Changes
|
|
976
|
+
|
|
977
|
+
- [#73](https://github.com/AgentsKit-io/code-review/pull/73) [`f99c9a3`](https://github.com/AgentsKit-io/code-review/commit/f99c9a37478440b7030c33ac480746db4204d0ef) Thanks [@EmersonBraun](https://github.com/EmersonBraun)! - Add a deterministic continuous-improvement benchmark for clean, required-lens-failure, and deadline review behavior.
|
|
978
|
+
|
|
979
|
+
- [#73](https://github.com/AgentsKit-io/code-review/pull/73) [`f99c9a3`](https://github.com/AgentsKit-io/code-review/commit/f99c9a37478440b7030c33ac480746db4204d0ef) Thanks [@EmersonBraun](https://github.com/EmersonBraun)! - Automate version pull requests, GitHub releases, and npm trusted publishing without a long-lived npm token. Stabilize OpenCode ACP protocol fixtures without weakening their timeout coverage.
|
|
980
|
+
|
|
981
|
+
All notable changes will be documented here. This project follows Semantic Versioning.
|
|
982
|
+
|
|
983
|
+
## [Unreleased]
|
|
984
|
+
|
|
985
|
+
## [0.4.0] - 2026-09-05
|
|
986
|
+
|
|
987
|
+
### Added
|
|
988
|
+
|
|
989
|
+
- Added machine-readable preflight manifests for reviewable and unreviewed files, with stable file-batch planning for external orchestration.
|
|
990
|
+
- Added private JSON review-result artifacts and SHA/policy-bound batch-coverage primitives for safe Orca aggregation.
|
|
991
|
+
- Added fail-closed consolidation: every batch artifact must match the immutable PR/SHA/policy/file manifest and have complete lens evidence before a single review can be published.
|
|
992
|
+
- Added CLI consolidation and publication gates so Orca can create exactly one review only from a current, complete consolidated artifact.
|
|
993
|
+
|
|
994
|
+
### Changed
|
|
995
|
+
|
|
996
|
+
- Expanded reviewable product files to include HTML, CSS, Markdown, and MDX.
|
|
997
|
+
- Made GitHub inline findings agent-actionable with correction rationale, required change, acceptance check, and verification confidence.
|
|
998
|
+
- Reworked the persistent PR walkthrough into a compact CodeRabbit-style status card; finding detail now lives only on the relevant inline review comments.
|
|
999
|
+
|
|
1000
|
+
### Security
|
|
1001
|
+
|
|
1002
|
+
- Reject GitHub publication from a partial review batch; only a complete consolidated review may post.
|
|
1003
|
+
- Document the intentionally local, private batch-artifact writes so CodeQL does not misclassify serialized PR metadata as executable file access.
|
|
1004
|
+
|
|
1005
|
+
## [0.3.0] - 2026-08-30
|
|
1006
|
+
|
|
1007
|
+
### Added
|
|
1008
|
+
|
|
1009
|
+
- Added global cancellation deadlines, provider health preflight, a circuit breaker, and bounded execution evidence.
|
|
1010
|
+
- Added the explicit `fast` profile with a single required-lens batch for lower latency and predictable calls.
|
|
1011
|
+
- Added CI Action inputs for profile, deadline, and health-check policy.
|
|
1012
|
+
|
|
1013
|
+
## [0.2.3] - 2026-08-30
|
|
1014
|
+
|
|
1015
|
+
### Fixed
|
|
1016
|
+
|
|
1017
|
+
- Stop issuing additional provider calls after a terminal authentication failure; reviews still fail closed without spending one failed call per lens.
|
|
1018
|
+
|
|
1019
|
+
## [0.2.2] - 2026-08-29
|
|
1020
|
+
|
|
1021
|
+
### Added
|
|
1022
|
+
|
|
1023
|
+
- Added a GitHub Release workflow for tag-verified npm Trusted Publishing with OIDC and provenance.
|
|
1024
|
+
|
|
1025
|
+
### Fixed
|
|
1026
|
+
|
|
1027
|
+
- Prevented Codex authentication, timeout, and process failures from being retried as output-schema compatibility failures.
|
|
1028
|
+
- Documented and exposed explicit trusted-local mode for logged-in Codex/Claude CLI workflows.
|
|
1029
|
+
- Raised the default Codex local-worker deadline to five minutes and made GitHub PR file budgets enforceable and fail-closed.
|
|
1030
|
+
- Bounded GitHub Action calls, propagated Claude OAuth credentials, made review fingerprints version-aware, paginated comment reconciliation with a fail-closed cap, and bounded GitHub API responses.
|
|
1031
|
+
|
|
1032
|
+
## [0.2.1] - 2026-08-29
|
|
1033
|
+
|
|
1034
|
+
### Fixed
|
|
1035
|
+
|
|
1036
|
+
- Applied Codex timeout defaults in direct library usage, bounded GitHub PR metadata/content ingestion, and transient-only GitHub GET retries.
|
|
1037
|
+
- Added Ollama request deadlines and integration coverage for rate limits, posting failures, stalled requests, and large PR limits.
|
|
1038
|
+
|
|
1039
|
+
## [0.2.0] - 2026-08-29
|
|
1040
|
+
|
|
1041
|
+
### Changed
|
|
1042
|
+
|
|
1043
|
+
- Added strict versioned `.agentskit-review.json` policy with lens coverage, budgets, thresholds, context, and safe CI precedence; incomplete profiles require explicit local opt-in.
|
|
1044
|
+
- Hardened the shared local CLI worker with cancellation, process-tree cleanup, isolated temporary environments, bounded output, and redacted diagnostics.
|
|
1045
|
+
- Added bounded source snapshots with infrastructure/configuration file support, denylisted sensitive paths, symlink checks, input limits, and data-boundary-aware secret redaction.
|
|
1046
|
+
- Added provider-free `--plan`/`--dry-run` preflight with explicit file/byte/call budgets, bounded retries, CLI concurrency defaults, and fail-closed required-lens coverage.
|
|
1047
|
+
- Made reviews fail closed when any reviewable file has no successful primary lens or cannot be ingested; advisory mode now suppresses finding-based failures only, never source/provider/execution failures.
|
|
1048
|
+
- Added primary-lens execution coverage to review summaries so partial provider degradation is visible.
|
|
1049
|
+
- Repositioned the CLI and GitHub Action as provider-neutral.
|
|
1050
|
+
- Made provider selection explicit and removed provider-specific model defaults.
|
|
1051
|
+
- Added bounded GitHub review reconciliation with SHA/policy fingerprints, incremental compare scope when the prior SHA is an ancestor, fork-safe skip behavior, and idempotent summary updates.
|
|
1052
|
+
- Added experimental Grok Build CLI ACP support with isolated capability denial, versioned output validation, bounded invalid-output retry, and offline lifecycle fixtures.
|
|
1053
|
+
- Added experimental OpenCode CLI ACP support with the same isolated, versioned, bounded worker contract and offline lifecycle fixtures.
|
|
1054
|
+
- Added provider-specific Grok/OpenCode headless transports with explicit local-only ACP fallback via `--transport auto`.
|
|
1055
|
+
- Added package metadata, CLI help, open-source governance, and contribution guidance.
|