code-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Review Skill

代码审查Skill

Run the J-Star Reviewer on staged changes, allowing iterative fixing of issues.
对暂存的代码变更运行J-Star审查工具,支持迭代式修复问题。

When to Use

使用场景

  • Before committing code changes
  • When code quality issues are mentioned
  • As a quality gate before merging
  • When user asks to "review this code"
  • 提交代码变更之前
  • 提及代码质量问题时
  • 合并前作为质量关卡
  • 用户要求“审查这段代码”时

Quick Start

快速开始

1. Build the Brain (First Time Only)

1. 构建Brain(仅首次使用)

bash
jstar init
bash
jstar init

2. Stage Changes

2. 暂存变更

bash
git add .
bash
git add .

3. Run Review

3. 运行审查

bash
undefined
bash
undefined

Standard review (staged changes)

标准审查(针对暂存的变更)

jstar review
jstar review

Retroactive (already committed)

回溯审查(针对已提交的变更)

jstar review --last
jstar review --last

Branch/PR review (against main)

分支/PR审查(对比main分支)

jstar review --pr
undefined
jstar review --pr
undefined

Fix Loop Protocol

修复循环流程

  1. Read Output: Check
    .jstar/last-review.md
    or console
  2. Prioritize: Focus on P0_CRITICAL and P1_HIGH only
  3. Loop Strategy:
    • If P0/P1 found → Fix → Stage → Re-review
    • If only P2_MEDIUM → Consider "Good Enough"
    • MAX LOOPS: 3 — If issues persist, stop and ask user
  1. 查看输出:检查
    .jstar/last-review.md
    文件或控制台
  2. 优先级排序:仅关注P0_CRITICALP1_HIGH级问题
  3. 循环策略:
    • 如果发现P0/P1级问题 → 修复 → 暂存 → 重新审查
    • 若仅存在P2_MEDIUM级问题 → 可视为“足够良好”
    • 最大循环次数:3次——若问题仍存在,停止并询问用户

Handling False Positives (Headless Mode)

处理误报(无头模式)

bash
undefined
bash
undefined

Start headless session

启动无头会话

jstar chat --headless
jstar chat --headless

List issues

列出所有问题

echo '{"action": "list"}' | jstar chat --headless
echo '{"action": "list"}' | jstar chat --headless

Debate an issue

对某一问题提出异议

echo '{"action": "debate", "issueId": 0, "argument": "This is correct because..."}' | jstar chat --headless
echo '{"action": "debate", "issueId": 0, "argument": "This is correct because..."}' | jstar chat --headless

Exit

退出会话

echo '{"action": "exit"}' | jstar chat --headless
undefined
echo '{"action": "exit"}' | jstar chat --headless
undefined

AI Fix Cycle

AI修复循环

1. jstar review --json  →  Parse findings
2. Apply code fixes
3. git add .            →  Stage changes
4. jstar init           →  Update brain (if new files added)
5. jstar review --json  →  Verify fixes
6. Repeat until P0/P1 = 0
1. jstar review --json  →  解析审查结果
2. 应用代码修复
3. git add .            →  暂存变更
4. jstar init           →  更新Brain(若添加了新文件)
5. jstar review --json  →  验证修复效果
6. 重复直至P0/P1级问题为0

Headless Commands

无头模式命令

ActionParametersDescription
list
List all current issues
debate
issueId
,
argument
Challenge an issue
ignore
issueId
Mark issue as ignored
exit
End session, get final report
操作参数描述
list
列出当前所有问题
debate
issueId
,
argument
对某一问题提出异议
ignore
issueId
将问题标记为忽略
exit
结束会话,获取最终报告