codex-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Codex 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:
ScopeWhen to use
Branch diffBefore opening or merging a PR
Uncommitted changesDuring active development
Specific commitAuditing a single changeset
CustomUser 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

常用参数

FlagDescription
--base <BRANCH>
Review changes against a base branch
--uncommitted
Review staged, unstaged, and untracked changes
--commit <SHA>
Review changes introduced by a specific commit
--title <TITLE>
Optional commit title for the review summary
-c model="gpt-5.3-codex"
Override the model (preferred:
gpt-5.3-codex
)
参数说明
--base <BRANCH>
基于指定基准分支评审变更
--uncommitted
评审已暂存、未暂存和未追踪的变更
--commit <SHA>
评审特定提交引入的变更
--title <TITLE>
评审摘要的可选提交标题
-c model="gpt-5.3-codex"
覆写使用的模型(推荐:
gpt-5.3-codex

Rules

使用规则

  • Default to reviewing the current branch diff against
    main
    unless the user specifies otherwise
  • Always pass
    -c model="gpt-5.3-codex"
    to use the preferred model
  • Use
    --base
    ,
    --uncommitted
    , or
    --commit
    flags to set the review scope instead of describing it in the prompt
  • 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
    npm i -g @openai/codex
    and
    codex login
  • 除非用户另有指定,默认基于
    main
    分支评审当前分支的差异
  • 始终传入
    -c model="gpt-5.3-codex"
    以使用推荐模型
  • 使用
    --base
    --uncommitted
    --commit
    参数设置评审范围,不要在提示词中描述范围
  • 按优先级排序展示发现的问题(优先级最高的在前)
  • 在列出单个问题前先汇总整体评估结果
  • 如果未安装Codex CLI,指导用户运行
    npm i -g @openai/codex
    codex login