diffray 0.5.0 β 0.5.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/README.md +132 -1
- package/dist/diffray.cjs +457 -240
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -132,6 +132,29 @@ diffray config init
|
|
|
132
132
|
diffray review --executor cursor-agent-cli
|
|
133
133
|
```
|
|
134
134
|
|
|
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
|
+
|
|
135
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.
|
|
136
159
|
|
|
137
160
|
**Tips to reduce costs:**
|
|
@@ -220,11 +243,119 @@ diffray works out of the box with sensible defaults. Create `.diffray.json` in y
|
|
|
220
243
|
| `extends` | Load agents/rules from git repos (e.g., `["https://github.com/owner/repo#v1.0"]`) |
|
|
221
244
|
| `excludePatterns` | Glob patterns for files to skip |
|
|
222
245
|
| `concurrency` | Max parallel agents (1-10, default: **6**). Stage-specific settings override this. |
|
|
223
|
-
| `executor` | Which executor to use (`claude-cli`, `cursor-agent-cli`) |
|
|
246
|
+
| `executor` | Which executor to use (`claude-cli`, `cursor-agent-cli`, `opencode-cli`) |
|
|
224
247
|
| `agents.<name>` | Override agent settings (`enabled`, `model`, `timeout`) |
|
|
225
248
|
| `rules.<name>` | Override rule settings (`enabled`, `agent`) |
|
|
226
249
|
| `executors.<name>.<stage>` | Per-executor, per-stage settings (`model`, `timeout`, `concurrency`, `batchSize`) |
|
|
227
250
|
|
|
251
|
+
### Model Override Options
|
|
252
|
+
|
|
253
|
+
#### Available Models by Executor
|
|
254
|
+
|
|
255
|
+
| Executor | Available Models | Examples |
|
|
256
|
+
|----------|------------------|----------|
|
|
257
|
+
| **claude-cli** | `haiku`, `sonnet`, `opus` (aliases) | `sonnet`, `claude-sonnet-4-5-20250929` |
|
|
258
|
+
| **cursor-agent-cli** | `auto`, `gpt-5.2`, `opus-4.5`, `sonnet-4.5`, `gemini-3-pro`, `grok` | `cursor-agent --model opus-4.5` |
|
|
259
|
+
| **opencode-cli** | `opencode/gpt-5-nano`, `opencode/grok-code`, `opencode/glm-4.7-free` | `opencode --model opencode/gpt-5-nano` |
|
|
260
|
+
|
|
261
|
+
#### Override Hierarchy (highest to lowest priority)
|
|
262
|
+
|
|
263
|
+
1. **CLI flags** - `diffray review --model sonnet`
|
|
264
|
+
2. **Project config** - `.diffray.json`
|
|
265
|
+
3. **Global config** - `~/.diffray/config.json`
|
|
266
|
+
4. **Defaults** - Built-in defaults
|
|
267
|
+
|
|
268
|
+
#### Configuration Examples
|
|
269
|
+
|
|
270
|
+
**Global config** (`~/.diffray/config.json`):
|
|
271
|
+
```json
|
|
272
|
+
{
|
|
273
|
+
"executor": "claude-cli",
|
|
274
|
+
"executors": {
|
|
275
|
+
"claude-cli": {
|
|
276
|
+
"review": { "model": "sonnet", "concurrency": 6 },
|
|
277
|
+
"validation": { "model": "opus", "timeout": 180 } // Use most powerful model for validation
|
|
278
|
+
},
|
|
279
|
+
"cursor-agent-cli": {
|
|
280
|
+
"review": { "model": "opus-4.5" },
|
|
281
|
+
"validation": { "model": "opus-4.5" } // Use same powerful model for validation
|
|
282
|
+
},
|
|
283
|
+
"opencode-cli": {
|
|
284
|
+
"review": { "model": "opencode/gpt-5-nano" },
|
|
285
|
+
"validation": { "model": "opencode/grok-code" }
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"agents": {
|
|
289
|
+
"security-scan": { "model": "sonnet" },
|
|
290
|
+
"bug-hunter": { "model": "opus" },
|
|
291
|
+
"performance-check": { "model": "haiku" }
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Project config** (`.diffray.json`):
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"executors": {
|
|
300
|
+
"claude-cli": {
|
|
301
|
+
"review": { "model": "haiku" },
|
|
302
|
+
"validation": { "model": "sonnet" }
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"agents": {
|
|
306
|
+
"security-scan": { "model": "sonnet", "timeout": 180 },
|
|
307
|
+
"consistency-check": { "enabled": false }
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
#### CLI Override Examples
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
# Override model for all agents
|
|
316
|
+
diffray review --model sonnet
|
|
317
|
+
|
|
318
|
+
# Use different executor with specific model
|
|
319
|
+
diffray review --executor cursor-agent-cli --model opus-4.5
|
|
320
|
+
|
|
321
|
+
# Fast review with Haiku for all agents
|
|
322
|
+
diffray review --model haiku --skip-validation
|
|
323
|
+
|
|
324
|
+
# Security scan with Opus (most thorough)
|
|
325
|
+
diffray review --agent security-scan --model opus
|
|
326
|
+
|
|
327
|
+
# Mixed: use OpenCode with specific model
|
|
328
|
+
diffray review --executor opencode-cli --model opencode/gpt-5-nano
|
|
329
|
+
|
|
330
|
+
# Override for validation stage only (via config)
|
|
331
|
+
# See configuration examples above
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### Practical Use Cases
|
|
335
|
+
|
|
336
|
+
| Scenario | Recommended Configuration | Reason |
|
|
337
|
+
|----------|-------------------------|--------|
|
|
338
|
+
| **Everyday development** | `haiku` for review, `sonnet` for validation | Fast feedback, reasonable quality |
|
|
339
|
+
| **Security review** | `opus` for security-scan agent | Most thorough analysis for vulnerabilities |
|
|
340
|
+
| **Performance testing** | `sonnet` for performance-check agent | Good balance of speed and accuracy |
|
|
341
|
+
| **Large PR review** | `haiku` + `--skip-validation` | Process large changesets quickly |
|
|
342
|
+
| **Critical production** | `opus` for all agents | Maximum thoroughness for critical code |
|
|
343
|
+
| **Validation phase** | Always use most powerful model | Prevents false positives, ensures quality |
|
|
344
|
+
| **Cost optimization** | `cursor-agent-cli` with `gpt-5.2` | Often more cost-effective than Claude |
|
|
345
|
+
| **Multi-model strategy** | Mix models per agent type | Optimize quality/speed per use case |
|
|
346
|
+
|
|
347
|
+
#### Performance vs Quality Trade-offs
|
|
348
|
+
|
|
349
|
+
| Model | Speed | Quality | Cost | Best For |
|
|
350
|
+
|-------|-------|---------|------|----------|
|
|
351
|
+
| `haiku` | β‘ Fast | Good | π° Low | Daily development, large PRs |
|
|
352
|
+
| `sonnet` | π Moderate | Excellent | πΈπ° Medium | Most use cases, balanced approach |
|
|
353
|
+
| `opus` | π Fast | Outstanding | πΈπΈπΈ High | **Optimal balance of speed and quality**, security, critical bugs |
|
|
354
|
+
| `gpt-5.2` | π Fast | Very Good | πΈ Medium | General purpose, cost-effective |
|
|
355
|
+
| `opencode/gpt-5-nano` | β‘ Fast | Good | π° Low | Quick reviews, prototyping |
|
|
356
|
+
|
|
357
|
+
> **π‘ 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.
|
|
358
|
+
|
|
228
359
|
### Extends
|
|
229
360
|
|
|
230
361
|
Share agents and rules across projects by loading them from any git repository:
|