codex-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCodex Code Review
Codex 代码评审
Overview
概述
Use the OpenAI Codex CLI to perform AI-powered code reviews. Supports reviewing branches, uncommitted changes, specific commits, and custom-scoped reviews. Reviews are read-only and never modify the working tree.
使用OpenAI Codex CLI执行AI驱动的代码评审。支持评审分支、未提交变更、特定提交以及自定义范围的评审。评审为只读操作,绝不会修改工作树。
Prerequisites
前置要求
- Codex CLI installed ()
npm i -g @openai/codex - Authenticated ()
codex login
- 已安装Codex CLI()
npm i -g @openai/codex - 已完成身份认证()
codex login
Workflow
工作流程
Step 1: Determine Review Scope
步骤1:确定评审范围
Ask the user what they want reviewed if not already clear:
| Scope | When to use |
|---|---|
| Branch diff | Before opening or merging a PR |
| Uncommitted changes | During active development |
| Specific commit | Auditing a single changeset |
| Custom | User provides specific review instructions |
如果尚不明确,询问用户需要评审的内容:
| 范围 | 适用场景 |
|---|---|
| 分支差异 | 提交或合并PR之前 |
| 未提交变更 | 活跃开发过程中 |
| 特定提交 | 审计单个变更集 |
| 自定义 | 用户提供特定评审指令 |
Step 2: Run the Review
步骤2:执行评审
Branch review (compare current branch against base):
bash
codex review --base main -c model="gpt-5.3-codex"Uncommitted changes:
bash
codex review --uncommitted -c model="gpt-5.3-codex"Specific commit:
bash
codex review --commit <SHA> -c model="gpt-5.3-codex"Custom review with focused instructions:
bash
codex review -c model="gpt-5.3-codex" "Review the code for accessibility regressions and WCAG compliance."分支评审(将当前分支与基准分支对比):
bash
codex review --base main -c model="gpt-5.3-codex"未提交变更评审:
bash
codex review --uncommitted -c model="gpt-5.3-codex"特定提交评审:
bash
codex review --commit <SHA> -c model="gpt-5.3-codex"带聚焦指令的自定义评审:
bash
codex review -c model="gpt-5.3-codex" "Review the code for accessibility regressions and WCAG compliance."Common Flags
常用参数
| Flag | Description |
|---|---|
| Review changes against a base branch |
| Review staged, unstaged, and untracked changes |
| Review changes introduced by a specific commit |
| Optional commit title for the review summary |
| Override the model (preferred: |
| 参数 | 说明 |
|---|---|
| 基于指定基准分支评审变更 |
| 评审已暂存、未暂存和未追踪的变更 |
| 评审特定提交引入的变更 |
| 评审摘要的可选提交标题 |
| 覆写使用的模型(推荐: |
Rules
使用规则
- Default to reviewing the current branch diff against unless the user specifies otherwise
main - Always pass to use the preferred model
-c model="gpt-5.3-codex" - Use ,
--base, or--uncommittedflags to set the review scope instead of describing it in the prompt--commit - Present findings sorted by priority (highest first)
- Summarize the overall assessment before listing individual findings
- If Codex CLI is not installed, instruct the user to run and
npm i -g @openai/codexcodex login
- 除非用户另有指定,默认基于分支评审当前分支的差异
main - 始终传入以使用推荐模型
-c model="gpt-5.3-codex" - 使用、
--base或--uncommitted参数设置评审范围,不要在提示词中描述范围--commit - 按优先级排序展示发现的问题(优先级最高的在前)
- 在列出单个问题前先汇总整体评估结果
- 如果未安装Codex CLI,指导用户运行和
npm i -g @openai/codexcodex login