diffray 0.5.1 β†’ 0.5.3

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.
Files changed (3) hide show
  1. package/README.md +154 -3
  2. package/dist/diffray.cjs +399 -239
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  </tr>
9
9
  </table>
10
10
 
11
- > **What is this?** A CLI tool that runs multiple AI agents to review your code changes. Each agent specializes in different aspects: bugs, security, performance, code style. Works with [Claude Code](https://github.com/anthropics/claude-code) or [Cursor Agent](https://cursor.com).
11
+ > **What is this?** A CLI tool that runs multiple AI agents to review your code changes. Each agent specializes in different aspects: bugs, security, performance, code style. Works with [Claude Code](https://github.com/anthropics/claude-code), [Cursor Agent](https://cursor.com), OpenCode, or Codex CLI.
12
12
  >
13
13
  > **How is it different from [diffray.ai](https://diffray.ai)?** The cloud platform automatically learns from your team's review feedback and generates rules. This CLI version requires manual rule configuration but gives you full control and runs locally.
14
14
 
@@ -132,7 +132,50 @@ diffray config init
132
132
  diffray review --executor cursor-agent-cli
133
133
  ```
134
134
 
135
- Costs depend on your AI provider's pricing. Claude Code uses your Anthropic account or Claude Pro subscription. Cursor Agent uses your Cursor subscription.
135
+ ### OpenCode CLI (alternative)
136
+
137
+ Modern AI CLI with support for multiple model providers:
138
+
139
+ ```bash
140
+ # Install
141
+ curl https://opencode.ai/install -fsS | bash
142
+
143
+ # Authorize (opens browser)
144
+ opencode auth login
145
+ ```
146
+
147
+ Then switch diffray to use it:
148
+
149
+ ```bash
150
+ # Via config
151
+ diffray config init
152
+ # Edit .diffray.json and add: "executor": "opencode-cli"
153
+
154
+ # Or per-run
155
+ diffray review --executor opencode-cli
156
+ ```
157
+
158
+ Costs depend on your AI provider's pricing. Claude Code uses your Anthropic account or Claude Pro subscription. Cursor Agent uses your Cursor subscription. Codex CLI uses your OpenAI account.
159
+
160
+ ### Codex CLI (alternative)
161
+
162
+ OpenAI Codex CLI for local code review:
163
+
164
+ ```bash
165
+ # Install
166
+ npm install -g @openai/codex
167
+ ```
168
+
169
+ Then switch diffray to use it:
170
+
171
+ ```bash
172
+ # Via config
173
+ diffray config init
174
+ # Edit .diffray.json and add: "executor": "codex-cli"
175
+
176
+ # Or per-run
177
+ diffray review --executor codex-cli
178
+ ```
136
179
 
137
180
  **Tips to reduce costs:**
138
181
  - Review smaller changesets more frequently
@@ -220,11 +263,119 @@ diffray works out of the box with sensible defaults. Create `.diffray.json` in y
220
263
  | `extends` | Load agents/rules from git repos (e.g., `["https://github.com/owner/repo#v1.0"]`) |
221
264
  | `excludePatterns` | Glob patterns for files to skip |
222
265
  | `concurrency` | Max parallel agents (1-10, default: **6**). Stage-specific settings override this. |
223
- | `executor` | Which executor to use (`claude-cli`, `cursor-agent-cli`) |
266
+ | `executor` | Which executor to use (`claude-cli`, `cursor-agent-cli`, `opencode-cli`) |
224
267
  | `agents.<name>` | Override agent settings (`enabled`, `model`, `timeout`) |
225
268
  | `rules.<name>` | Override rule settings (`enabled`, `agent`) |
226
269
  | `executors.<name>.<stage>` | Per-executor, per-stage settings (`model`, `timeout`, `concurrency`, `batchSize`) |
227
270
 
271
+ ### Model Override Options
272
+
273
+ #### Available Models by Executor
274
+
275
+ | Executor | Available Models | Examples |
276
+ |----------|------------------|----------|
277
+ | **claude-cli** | `haiku`, `sonnet`, `opus` (aliases) | `sonnet`, `claude-sonnet-4-5-20250929` |
278
+ | **cursor-agent-cli** | `auto`, `gpt-5.2`, `opus-4.5`, `sonnet-4.5`, `gemini-3-pro`, `grok` | `cursor-agent --model opus-4.5` |
279
+ | **opencode-cli** | `opencode/gpt-5-nano`, `opencode/grok-code`, `opencode/glm-4.7-free` | `opencode --model opencode/gpt-5-nano` |
280
+
281
+ #### Override Hierarchy (highest to lowest priority)
282
+
283
+ 1. **CLI flags** - `diffray review --model sonnet`
284
+ 2. **Project config** - `.diffray.json`
285
+ 3. **Global config** - `~/.diffray/config.json`
286
+ 4. **Defaults** - Built-in defaults
287
+
288
+ #### Configuration Examples
289
+
290
+ **Global config** (`~/.diffray/config.json`):
291
+ ```json
292
+ {
293
+ "executor": "claude-cli",
294
+ "executors": {
295
+ "claude-cli": {
296
+ "review": { "model": "sonnet", "concurrency": 6 },
297
+ "validation": { "model": "opus", "timeout": 180 } // Use most powerful model for validation
298
+ },
299
+ "cursor-agent-cli": {
300
+ "review": { "model": "opus-4.5" },
301
+ "validation": { "model": "opus-4.5" } // Use same powerful model for validation
302
+ },
303
+ "opencode-cli": {
304
+ "review": { "model": "opencode/gpt-5-nano" },
305
+ "validation": { "model": "opencode/grok-code" }
306
+ }
307
+ },
308
+ "agents": {
309
+ "security-scan": { "model": "sonnet" },
310
+ "bug-hunter": { "model": "opus" },
311
+ "performance-check": { "model": "haiku" }
312
+ }
313
+ }
314
+ ```
315
+
316
+ **Project config** (`.diffray.json`):
317
+ ```json
318
+ {
319
+ "executors": {
320
+ "claude-cli": {
321
+ "review": { "model": "haiku" },
322
+ "validation": { "model": "sonnet" }
323
+ }
324
+ },
325
+ "agents": {
326
+ "security-scan": { "model": "sonnet", "timeout": 180 },
327
+ "consistency-check": { "enabled": false }
328
+ }
329
+ }
330
+ ```
331
+
332
+ #### CLI Override Examples
333
+
334
+ ```bash
335
+ # Override model for all agents
336
+ diffray review --model sonnet
337
+
338
+ # Use different executor with specific model
339
+ diffray review --executor cursor-agent-cli --model opus-4.5
340
+
341
+ # Fast review with Haiku for all agents
342
+ diffray review --model haiku --skip-validation
343
+
344
+ # Security scan with Opus (most thorough)
345
+ diffray review --agent security-scan --model opus
346
+
347
+ # Mixed: use OpenCode with specific model
348
+ diffray review --executor opencode-cli --model opencode/gpt-5-nano
349
+
350
+ # Override for validation stage only (via config)
351
+ # See configuration examples above
352
+ ```
353
+
354
+ #### Practical Use Cases
355
+
356
+ | Scenario | Recommended Configuration | Reason |
357
+ |----------|-------------------------|--------|
358
+ | **Everyday development** | `haiku` for review, `sonnet` for validation | Fast feedback, reasonable quality |
359
+ | **Security review** | `opus` for security-scan agent | Most thorough analysis for vulnerabilities |
360
+ | **Performance testing** | `sonnet` for performance-check agent | Good balance of speed and accuracy |
361
+ | **Large PR review** | `haiku` + `--skip-validation` | Process large changesets quickly |
362
+ | **Critical production** | `opus` for all agents | Maximum thoroughness for critical code |
363
+ | **Validation phase** | Always use most powerful model | Prevents false positives, ensures quality |
364
+ | **Cost optimization** | `cursor-agent-cli` with `gpt-5.2` | Often more cost-effective than Claude |
365
+ | **Multi-model strategy** | Mix models per agent type | Optimize quality/speed per use case |
366
+
367
+ #### Performance vs Quality Trade-offs
368
+
369
+ | Model | Speed | Quality | Cost | Best For |
370
+ |-------|-------|---------|------|----------|
371
+ | `haiku` | ⚑ Fast | Good | πŸ’° Low | Daily development, large PRs |
372
+ | `sonnet` | πŸš€ Moderate | Excellent | πŸ’ΈπŸ’° Medium | Most use cases, balanced approach |
373
+ | `opus` | πŸš€ Fast | Outstanding | πŸ’ΈπŸ’ΈπŸ’Έ High | **Optimal balance of speed and quality**, security, critical bugs |
374
+ | `gpt-5.2` | πŸš€ Fast | Very Good | πŸ’Έ Medium | General purpose, cost-effective |
375
+ | `opencode/gpt-5-nano` | ⚑ Fast | Good | πŸ’° Low | Quick reviews, prototyping |
376
+
377
+ > **πŸ’‘ Pro Tip:** For the **validation phase**, always use the most powerful model available (e.g., `opus` or `gpt-5.2`). Validation filters false positives and ensures only real issues are reported, making it worth the extra cost.
378
+
228
379
  ### Extends
229
380
 
230
381
  Share agents and rules across projects by loading them from any git repository: