Loading...
Loading...
Compare original and translation side by side
npm install -g agent-reviewnpm install -g agent-reviewundefinedundefinedBash({
command: "npx agent-review",
description: "Start code review session",
timeout: 600000, // 10 minutes - user needs time to review
})run_in_background: trueBash({
command: "npx agent-review",
description: "启动代码审查会话",
timeout: 600000, // 10分钟 - 用户需要足够的审查时间
})run_in_background: trueRead({
file_path: "/path/to/project/.agent-review/latest-review.json"
})Read({
file_path: "/path/to/project/.agent-review/latest-review.json"
})// 1. Run code review (inline, long timeout)
const result = await Bash({
command: "npx agent-review",
description: "Request code review from user",
timeout: 600000, // 10 min
});
// 2. Read structured feedback
const reviewData = await Read({
file_path: ".agent-review/latest-review.json"
});
// 3. Parse and process
const review = JSON.parse(reviewData);
// 4. Address feedback
for (const comment of review.feedback.lineComments) {
console.log(`${comment.file}:${comment.line} - ${comment.comment}`);
// Make changes based on comment
}
// 5. Report back to user
"I've addressed your feedback:
- Fixed the issue in src/app.ts:42 (using const instead of let)
- Updated error handling as suggested
..."// 1. 运行代码审查(内联模式,长超时)
const result = await Bash({
command: "npx agent-review",
description: "向用户发起代码审查请求",
timeout: 600000, // 10分钟
});
// 2. 读取结构化反馈
const reviewData = await Read({
file_path: ".agent-review/latest-review.json"
});
// 3. 解析并处理
const review = JSON.parse(reviewData);
// 4. 处理反馈
for (const comment of review.feedback.lineComments) {
console.log(`${comment.file}:${comment.line} - ${comment.comment}`);
// 根据评论修改代码
}
// 5. 向用户反馈处理结果
"我已处理你的反馈:
- 修复了src/app.ts:42的问题(将let改为const)
- 按照建议更新了错误处理逻辑
...".agent-review/latest-review.json{
"id": "review-1234567890",
"timestamp": "2026-02-03T17:23:33.377Z",
"diff": { /* full git diff data */ },
"feedback": {
"timestamp": "2026-02-03T17:23:33.377Z",
"lineComments": [
{
"file": "src/app.ts",
"line": 42,
"oldLine": 41,
"comment": "Consider using const instead of let",
"context": "let x = calculateTotal();"
}
],
"generalFeedback": "Overall looks good!",
"stats": {
"filesReviewed": 5,
"commentsAdded": 3
}
}
}.agent-review/latest-review.json{
"id": "review-1234567890",
"timestamp": "2026-02-03T17:23:33.377Z",
"diff": { /* 完整的git diff数据 */ },
"feedback": {
"timestamp": "2026-02-03T17:23:33.377Z",
"lineComments": [
{
"file": "src/app.ts",
"line": 42,
"oldLine": 41,
"comment": "Consider using const instead of let",
"context": "let x = calculateTotal();"
}
],
"generalFeedback": "Overall looks good!",
"stats": {
"filesReviewed": 5,
"commentsAdded": 3
}
}
}// WRONG - you won't get the output automatically
Bash({
command: "npx agent-review",
run_in_background: true
})// WRONG - will timeout before user finishes
Bash({
command: "npx agent-review",
timeout: 120000 // 2 min too short
})// WRONG - feedback is already in the JSON file!
"What feedback do you have?"// RIGHT - inline, long timeout, auto-read
await Bash({
command: "npx agent-review",
timeout: 600000
});
const review = await Read({
file_path: ".agent-review/latest-review.json"
});// 错误 - 无法自动获取输出
Bash({
command: "npx agent-review",
run_in_background: true
})// 错误 - 用户完成前就会超时
Bash({
command: "npx agent-review",
timeout: 120000 // 2分钟过短
})// 错误 - 反馈已在JSON文件中!
"你有什么反馈?"// 正确 - 内联运行、长超时、自动读取
await Bash({
command: "npx agent-review",
timeout: 600000
});
const review = await Read({
file_path: ".agent-review/latest-review.json"
});