file-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

File Review

文件审查

Unified skill for the file-review plugin. Routes to the correct workflow based on user intent.
Note: The
/file-review
and
/process-comments
commands are simple shortcuts for backward compatibility. They trigger the Review and Process workflows below. This skill is the canonical entry point.
这是file-review插件的统一技能,可根据用户意图路由到正确的工作流。
注意:
/file-review
/process-comments
命令是为了向后兼容而设的快捷方式,它们会触发下方的审查和处理工作流。本技能是标准入口点。

Intent Router

意图路由

Match the user's request to one of three workflows:
Intent signalsWorkflow
"install file-review", "set up file-review", "file-review not found"Install
"review this file", "file-review
<path>
", "open for review", "let's review"
Review a File
"I left comments", "process comments", "done reviewing", "address feedback"Process Comments
If the intent is ambiguous, use AskUserQuestion:
QuestionOptions
"What would you like to do with file-review?"1. Review a file (open GUI), 2. Process existing review comments, 3. Install file-review

将用户的请求匹配到以下三个工作流之一:
意图信号工作流
"install file-review"、"set up file-review"、"file-review not found"安装
"review this file"、"file-review
<path>
"、"open for review"、"let's review"
审查文件
"I left comments"、"process comments"、"done reviewing"、"address feedback"处理评论
如果意图不明确,使用AskUserQuestion:
问题选项
"你想使用file-review做什么?"1. 审查文件(打开GUI),2. 处理现有审查意见,3. 安装file-review

Install

安装

Quick Install (Homebrew)

快速安装(Homebrew)

bash
brew tap desplega-ai/tap
brew install file-review
Verify:
which file-review
bash
brew tap desplega-ai/tap
brew install file-review
验证:
which file-review

Manual Install (from source)

手动安装(从源码)

Prerequisites: bun, Rust
bash
git clone https://github.com/desplega-ai/ai-toolbox.git
cd ai-toolbox/file-review
bun install
bun run install:app
This symlinks to
~/.local/bin/file-review
. Ensure that's in PATH.
前置依赖:bunRust
bash
git clone https://github.com/desplega-ai/ai-toolbox.git
cd ai-toolbox/file-review
bun install
bun run install:app
此操作会创建指向
~/.local/bin/file-review
的符号链接,请确保该路径在你的PATH中。

Troubleshooting

故障排除

  • Command not found: Ensure
    ~/.local/bin
    in PATH, restart terminal
  • Rust not found: Restart terminal after installing Rust
  • Build fails on macOS:
    xcode-select --install
  • 命令未找到:确保
    ~/.local/bin
    在PATH中,重启终端
  • 未找到Rust:安装Rust后重启终端
  • macOS上构建失败:执行
    xcode-select --install

Uninstall

卸载

bash
cd ai-toolbox/file-review && bun run uninstall:app

bash
cd ai-toolbox/file-review && bun run uninstall:app

Review a File

审查文件

If no path provided

未提供路径时

Check for recently created or modified files in the current session:
  • Plan files in
    thoughts/<username|shared>/plans/
  • Research documents in
    thoughts/<username|shared>/research/
  • Any markdown files created or updated during the conversation
Propose candidates to the user via AskUserQuestion.
检查当前会话中最近创建或修改的文件:
  • thoughts/<username|shared>/plans/
    下的计划文件
  • thoughts/<username|shared>/research/
    下的研究文档
  • 对话期间创建或更新的所有markdown文件
通过AskUserQuestion向用户推荐候选文件。

If path provided

提供路径时

  1. Verify the file exists and is readable.
  2. Check if file-review is installed:
    bash
    which file-review
    If not found, jump to the Install section above.
  3. Launch the GUI:
    bash
    file-review "<absolute_path>"
    Wait for the process to complete.
    CLI flags:
    --bg
    (background),
    --silent
    (no comment output),
    --json
    (JSON output).
  4. Inform the user:
    I've opened file-review for <filename>.
    
    Shortcuts: Cmd+K (add comment), Cmd+S (save), Cmd+Q (quit), Cmd+/ (help)
  5. After the app closes, it outputs review comments to stdout:
    === Review Comments (N) ===
    
    [abc123] Line 15 (inline):
        "highlighted code"
        -> Comment text here
    Present the output, then proceed to Process Comments below.
  1. 验证文件存在且可读
  2. 检查file-review是否已安装
    bash
    which file-review
    如果未找到,跳转到上方的安装部分。
  3. 启动GUI
    bash
    file-review "<absolute_path>"
    等待进程完成。
    CLI参数:
    --bg
    (后台运行)、
    --silent
    (不输出评论)、
    --json
    (JSON格式输出)。
  4. 通知用户
    我已为<filename>打开file-review。
    
    快捷键:Cmd+K(添加评论)、Cmd+S(保存)、Cmd+Q(退出)、Cmd+/(查看帮助)
  5. 应用关闭后,会将审查意见输出到标准输出:
    === 审查意见(N条) ===
    
    [abc123] 第15行(行内):
        "高亮代码"
        -> 评论内容
    展示输出内容,然后进入下方的处理评论环节。

Keyboard Shortcuts

键盘快捷键

ShortcutAction
Cmd+KAdd comment to selection
Cmd+SSave file
Cmd+QQuit application
Cmd+/Show all shortcuts
Cmd+TToggle theme
Cmd+Shift+VToggle vim mode
Cmd+OOpen file

快捷键操作
Cmd+K为选中内容添加评论
Cmd+S保存文件
Cmd+Q退出应用
Cmd+/查看所有快捷键
Cmd+T切换主题
Cmd+Shift+V切换Vim模式
Cmd+O打开文件

Process Comments

处理评论

Comment Format

评论格式

The file-review tool embeds comments as HTML markers:
Inline comments:
html
<!-- review-start(ID) -->highlighted text<!-- review-end(ID): reviewer feedback -->
Line comments:
html
<!-- review-line-start(ID) -->
content spanning
multiple lines
<!-- review-line-end(ID): reviewer feedback -->
ID
is an 8-character alphanumeric identifier.
file-review工具会将评论嵌入为HTML标记:
行内评论:
html
<!-- review-start(ID) -->高亮文本<!-- review-end(ID): 审查者意见 -->
整行评论:
html
<!-- review-line-start(ID) -->
跨多行的内容
<!-- review-line-end(ID): 审查者意见 -->
ID
是8位字母数字标识符。

Extraction Patterns

提取规则

javascript
// Inline - captures: [full, id, highlighted, feedback]
/<!--\s*review-start\(([a-zA-Z0-9-]+)\)\s*-->([\s\S]*?)<!--\s*review-end\(\1\):\s*([\s\S]*?)\s*-->/g

// Line - captures: [full, id, highlighted, feedback]
/<!--\s*review-line-start\(([a-zA-Z0-9-]+)\)\s*-->\n?([\s\S]*?)\n?<!--\s*review-line-end\(\1\):\s*([\s\S]*?)\s*-->/g
javascript
// 行内 - 捕获:[完整内容, id, 高亮文本, 意见]
/<!--\s*review-start\(([a-zA-Z0-9-]+)\)\s*-->([\s\S]*?)<!--\s*review-end\(\1\):\s*([\s\S]*?)\s*-->/g

// 整行 - 捕获:[完整内容, id, 高亮文本, 意见]
/<!--\s*review-line-start\(([a-zA-Z0-9-]+)\)\s*-->\n?([\s\S]*?)\n?<!--\s*review-line-end\(\1\):\s*([\s\S]*?)\s*-->/g

Workflow

工作流

Step 1: Read and Parse
Read the file, extract all comments, present a summary:
Found 3 review comments in <filename>:

1. [inline] "implement caching" -> "Consider using Redis"
2. [line] "function fetchData()..." -> "Add error handling"
3. [inline] "TODO" -> "Please complete this"
Step 2: Process Each Comment
For each comment, show context and use AskUserQuestion:
QuestionOptions
"Comment N of M: <feedback summary>"1. Apply edit, 2. Acknowledge (remove markers only), 3. Skip
  • Apply edit: Propose changes, apply after confirmation, remove markers.
  • Acknowledge: Remove markers, preserve content. Recommend this for praise/FYI.
  • Skip: Leave as-is, move on.
Step 3: Remove Markers
  • Inline: replace
    <!-- review-start(ID) -->text<!-- review-end(ID): feedback -->
    with
    text
  • Line: replace the full block with just the content lines
Step 4: Final Summary
Processing complete!

- Applied edits: 2
- Acknowledged: 1
- Skipped: 0

File saved.
步骤1:读取与解析
读取文件,提取所有评论,展示摘要:
在<filename>中找到3条审查意见:

1. [行内] "实现缓存" -> "考虑使用Redis"
2. [整行] "function fetchData()..." -> "添加错误处理"
3. [行内] "TODO" -> "请完成此项"
步骤2:处理每条评论
针对每条评论,展示上下文并使用AskUserQuestion:
问题选项
"第N条评论(共M条):<意见摘要>"1. 应用修改,2. 确认(仅移除标记),3. 跳过
  • 应用修改:提出修改建议,确认后应用并移除标记。
  • 确认:移除标记,保留内容。对于表扬/告知类意见推荐此选项。
  • 跳过:保持原样,继续处理下一条。
步骤3:移除标记
  • 行内:将
    <!-- review-start(ID) -->文本<!-- review-end(ID): 意见 -->
    替换为
    文本
  • 整行:将整个块替换为仅保留内容行
步骤4:最终摘要
处理完成!

- 已应用修改:2条
- 已确认:1条
- 已跳过:0条

文件已保存。

Special Cases

特殊情况

  • FYI/Praise ("LGTM", "Nice work"): Recommend Acknowledge as default
  • Empty feedback: Ask if user wants to remove markers
  • Unclear feedback: Use AskUserQuestion to clarify reviewer intent
  • 告知/表扬类意见("LGTM"、"做得好"):默认推荐选择“确认”
  • 空意见:询问用户是否要移除标记
  • 不明确的意见:使用AskUserQuestion明确审查者意图