openairev 0.3.4 → 0.3.5
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 +3 -4
- package/bin/openairev.js +6 -0
- package/package.json +1 -1
- package/src/cli/init.js +2 -4
- package/src/cli/wait.js +68 -0
- package/src/mcp/mcp-server.js +5 -5
package/README.md
CHANGED
|
@@ -213,7 +213,7 @@ Restart your agent CLI after adding.
|
|
|
213
213
|
| Tool | Description |
|
|
214
214
|
|------|-------------|
|
|
215
215
|
| `openairev_review` | Start a review in the background. Returns immediately. |
|
|
216
|
-
| `openairev_status` | Check review progress
|
|
216
|
+
| `openairev_status` | Check review progress (prefer `openairev wait` instead). |
|
|
217
217
|
| `openairev_run_tests` | Run project test suite |
|
|
218
218
|
| `openairev_run_lint` | Run linter |
|
|
219
219
|
| `openairev_get_diff` | Get current git diff |
|
|
@@ -223,10 +223,9 @@ Restart your agent CLI after adding.
|
|
|
223
223
|
The review runs asynchronously so you can see progress:
|
|
224
224
|
|
|
225
225
|
1. Call `openairev_review` → starts review in background, returns immediately
|
|
226
|
-
2.
|
|
227
|
-
3. When `status` is `"completed"`, the verdict and feedback are in the same file
|
|
226
|
+
2. Run `openairev wait` via Bash → streams progress (files read, commands run, tokens) and outputs the verdict when done
|
|
228
227
|
|
|
229
|
-
|
|
228
|
+
One MCP call + one Bash call. No polling, no sleep loops. The AI can also launch the review in a sub-agent and continue other work while it runs.
|
|
230
229
|
|
|
231
230
|
## Config
|
|
232
231
|
|
package/bin/openairev.js
CHANGED
|
@@ -7,6 +7,7 @@ import { reviewCommand } from '../src/cli/review.js';
|
|
|
7
7
|
import { resumeCommand } from '../src/cli/resume.js';
|
|
8
8
|
import { statusCommand } from '../src/cli/status.js';
|
|
9
9
|
import { historyCommand } from '../src/cli/history.js';
|
|
10
|
+
import { waitCommand } from '../src/cli/wait.js';
|
|
10
11
|
|
|
11
12
|
const program = new Command();
|
|
12
13
|
|
|
@@ -54,4 +55,9 @@ program
|
|
|
54
55
|
.option('--chains', 'Show chains instead of sessions')
|
|
55
56
|
.action(historyCommand);
|
|
56
57
|
|
|
58
|
+
program
|
|
59
|
+
.command('wait')
|
|
60
|
+
.description('Wait for a background review to finish, streaming progress')
|
|
61
|
+
.action(waitCommand);
|
|
62
|
+
|
|
57
63
|
program.parse();
|
package/package.json
CHANGED
package/src/cli/init.js
CHANGED
|
@@ -258,8 +258,7 @@ ${marker}
|
|
|
258
258
|
This project uses OpenAIRev for independent AI code review. When the user asks to "review", "get a review", or "check my changes":
|
|
259
259
|
|
|
260
260
|
1. Call \`openairev_review\` with \`executor: "claude_code"\` and \`diff_cmd\` scoped to the files you changed (e.g. \`"git diff HEAD -- src/auth.ts src/routes.ts"\`). The review starts in the background and returns immediately.
|
|
261
|
-
2.
|
|
262
|
-
3. When \`progress.json\` shows \`"status": "completed"\`, the verdict and feedback are in the same file.
|
|
261
|
+
2. Run \`openairev wait\` via Bash to stream progress and get the verdict when done. This is a single blocking call — no polling needed.
|
|
263
262
|
|
|
264
263
|
**Tips**:
|
|
265
264
|
- Always use \`diff_cmd\` to scope the diff to your changed files. Do NOT let it auto-detect — the full repo diff may be too large.
|
|
@@ -313,8 +312,7 @@ ${marker}
|
|
|
313
312
|
This project uses OpenAIRev for independent AI code review. When the user asks to "review", "get a review", or "check my changes":
|
|
314
313
|
|
|
315
314
|
1. Call \`openairev_review\` with \`executor: "codex"\` and \`diff_cmd\` scoped to the files you changed (e.g. \`"git diff HEAD -- src/auth.ts src/routes.ts"\`). The review starts in the background and returns immediately.
|
|
316
|
-
2.
|
|
317
|
-
3. When \`progress.json\` shows \`"status": "completed"\`, the verdict and feedback are in the same file.
|
|
315
|
+
2. Run \`openairev wait\` to stream progress and get the verdict when done. This is a single blocking call — no polling needed.
|
|
318
316
|
|
|
319
317
|
**Tips**:
|
|
320
318
|
- Always use \`diff_cmd\` to scope the diff to your changed files. Do NOT let it auto-detect — the full repo diff may be too large.
|
package/src/cli/wait.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { readFileSync, existsSync, watchFile, unwatchFile } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
|
|
4
|
+
export async function waitCommand() {
|
|
5
|
+
const cwd = process.cwd();
|
|
6
|
+
const progressFile = join(cwd, '.openairev', 'progress.json');
|
|
7
|
+
|
|
8
|
+
if (!existsSync(progressFile)) {
|
|
9
|
+
console.log('No review in progress. Call openairev_review first.');
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Check if already done
|
|
14
|
+
const initial = readProgress(progressFile);
|
|
15
|
+
if (initial?.status === 'completed' || initial?.status === 'error') {
|
|
16
|
+
printResult(initial);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Watch for changes
|
|
21
|
+
let lastLen = 0;
|
|
22
|
+
return new Promise((resolve) => {
|
|
23
|
+
const check = () => {
|
|
24
|
+
const data = readProgress(progressFile);
|
|
25
|
+
if (!data) return;
|
|
26
|
+
|
|
27
|
+
// Print new progress lines
|
|
28
|
+
const lines = data.progress || [];
|
|
29
|
+
if (lines.length > lastLen) {
|
|
30
|
+
for (let i = lastLen; i < lines.length; i++) {
|
|
31
|
+
console.log(` ${lines[i]}`);
|
|
32
|
+
}
|
|
33
|
+
lastLen = lines.length;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (data.status === 'completed' || data.status === 'error') {
|
|
37
|
+
unwatchFile(progressFile);
|
|
38
|
+
printResult(data);
|
|
39
|
+
resolve();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
watchFile(progressFile, { interval: 1000 }, check);
|
|
44
|
+
check(); // initial check
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function readProgress(path) {
|
|
49
|
+
try {
|
|
50
|
+
return JSON.parse(readFileSync(path, 'utf-8'));
|
|
51
|
+
} catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function printResult(data) {
|
|
57
|
+
if (data.status === 'error') {
|
|
58
|
+
console.log(`\nReview failed: ${data.error}`);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log('');
|
|
63
|
+
if (data.executor_feedback) {
|
|
64
|
+
console.log(data.executor_feedback);
|
|
65
|
+
} else if (data.verdict) {
|
|
66
|
+
console.log(JSON.stringify(data.verdict, null, 2));
|
|
67
|
+
}
|
|
68
|
+
}
|
package/src/mcp/mcp-server.js
CHANGED
|
@@ -25,7 +25,7 @@ const server = new McpServer({
|
|
|
25
25
|
|
|
26
26
|
server.tool(
|
|
27
27
|
'openairev_review',
|
|
28
|
-
'TRIGGER: Use this tool when the user says "review", "review my code", "get a review", "check my changes", "openairev", or asks for independent/cross-model code review. Sends current code changes to a DIFFERENT AI model for independent review. The review
|
|
28
|
+
'TRIGGER: Use this tool when the user says "review", "review my code", "get a review", "check my changes", "openairev", or asks for independent/cross-model code review. Sends current code changes to a DIFFERENT AI model for independent review. The review starts in the background and returns immediately. After calling this, run `openairev wait` via Bash to stream progress and get the verdict — one blocking call, no polling needed.',
|
|
29
29
|
{
|
|
30
30
|
executor: z.string().optional().describe('Which agent wrote the code (claude_code or codex). If you are Claude Code, set this to "claude_code". If you are Codex, set this to "codex".'),
|
|
31
31
|
diff: z.string().optional().describe('The diff to review. IMPORTANT: Pass only the diff for files YOU changed, not the entire repo. Use `git diff HEAD -- file1 file2` to scope it. If omitted, auto-detects from git which may be too large.'),
|
|
@@ -90,7 +90,7 @@ server.tool(
|
|
|
90
90
|
return {
|
|
91
91
|
content: [{
|
|
92
92
|
type: 'text',
|
|
93
|
-
text: `Review started. Reviewer: ${reviewerName}\n\
|
|
93
|
+
text: `Review started. Reviewer: ${reviewerName}\n\nRun \`openairev wait\` via Bash to stream progress and get the verdict when done.`,
|
|
94
94
|
}],
|
|
95
95
|
};
|
|
96
96
|
}
|
|
@@ -98,7 +98,7 @@ server.tool(
|
|
|
98
98
|
|
|
99
99
|
server.tool(
|
|
100
100
|
'openairev_status',
|
|
101
|
-
'Check the progress and result of the current or most recent OpenAIRev review.
|
|
101
|
+
'Check the progress and result of the current or most recent OpenAIRev review. Prefer running `openairev wait` via Bash instead — it streams progress and blocks until done.',
|
|
102
102
|
{},
|
|
103
103
|
async () => {
|
|
104
104
|
const progress = readProgress();
|
|
@@ -109,8 +109,8 @@ server.tool(
|
|
|
109
109
|
if (progress.status === 'running') {
|
|
110
110
|
const lines = progress.progress || [];
|
|
111
111
|
const text = lines.length > 0
|
|
112
|
-
? `Review in progress (reviewer: ${progress.reviewer}):\n${lines.map(l => ` ${l}`).join('\n')}\n\nStill running
|
|
113
|
-
: `Review in progress (reviewer: ${progress.reviewer}). Started: ${progress.started}\n\
|
|
112
|
+
? `Review in progress (reviewer: ${progress.reviewer}):\n${lines.map(l => ` ${l}`).join('\n')}\n\nStill running. Run \`openairev wait\` via Bash to stream progress until done.`
|
|
113
|
+
: `Review in progress (reviewer: ${progress.reviewer}). Started: ${progress.started}\n\nRun \`openairev wait\` via Bash to stream progress until done.`;
|
|
114
114
|
return { content: [{ type: 'text', text }] };
|
|
115
115
|
}
|
|
116
116
|
|