pub struct ReviewCommand { /* private fields */ }Expand description
Run a code review non-interactively (codex exec review).
§Why not codex review
codex-cli exposes review at two paths, codex review and
codex exec review. They are the same command: same [PROMPT] positional,
same non-interactive behavior, and a byte-identical error when no review
scope is given.
They are not equally capable. As of 0.145.0, top-level codex review
accepts a strict subset of the flags, missing ten that codex exec review
has:
--dangerously-bypass-approvals-and-sandbox --json
--dangerously-bypass-hook-trust --output-schema <FILE>
--ephemeral --skip-git-repo-check
--ignore-rules -m, --model <MODEL>
--ignore-user-config -o, --output-last-message <FILE>Nothing is available on codex review that is not also on
codex exec review, and the missing flags are rejected outright rather
than silently ignored.
--json is the decisive one:
execute_json_lines depends on it, so a
builder targeting the top-level path could not offer structured output at
all. This wrapper therefore targets codex exec review only. Use
RawCommand if you need the literal codex review
invocation.
tests/contract.rs asserts the subset relationship still holds, so if the
two surfaces ever diverge the other way, CI reports it.
Implementations§
Source§impl ReviewCommand
impl ReviewCommand
pub fn new() -> Self
pub fn prompt(self, prompt: impl Into<String>) -> Self
Sourcepub fn config(self, key_value: impl Into<String>) -> Self
pub fn config(self, key_value: impl Into<String>) -> Self
Override a config key (-c key=value).
Because -c is last-wins, a key set here overrides the same key set by
approval_policy,
search_mode, or full_auto.
Sourcepub fn approval_policy(self, policy: impl Into<ApprovalPolicyConfig>) -> Self
pub fn approval_policy(self, policy: impl Into<ApprovalPolicyConfig>) -> Self
Set when the model asks for approval (-c approval_policy="<value>").
codex-cli 0.145.0 removed --ask-for-approval from the exec family;
the config key is the supported equivalent. Accepts an
ApprovalPolicy directly, or an
ApprovalPolicyConfig for the two values the flag never took.
Sourcepub fn search(self) -> Self
pub fn search(self) -> Self
Enable live web search.
Shorthand for search_mode(WebSearchMode::Live), which is what the
removed --search flag meant.
Sourcepub fn search_mode(self, mode: WebSearchMode) -> Self
pub fn search_mode(self, mode: WebSearchMode) -> Self
Set the web search mode (-c web_search="<value>").
codex-cli 0.145.0 removed --search from the exec family; the config
key is the supported equivalent, and it is an enum rather than the
flag’s boolean.
pub fn enable(self, feature: impl Into<String>) -> Self
pub fn disable(self, feature: impl Into<String>) -> Self
pub fn uncommitted(self) -> Self
pub fn base(self, branch: impl Into<String>) -> Self
pub fn commit(self, sha: impl Into<String>) -> Self
pub fn model(self, model: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
Sourcepub fn strict_config(self) -> Self
pub fn strict_config(self) -> Self
Error on unrecognized config keys (--strict-config).
Sourcepub fn full_auto(self) -> Self
pub fn full_auto(self) -> Self
Run in full-auto mode, emitted as -c sandbox_mode="workspace-write".
--full-auto is deprecated upstream; codex-cli 0.145.0 hides it and
warns to use --sandbox workspace-write instead. codex exec review
has no --sandbox flag, so this sets the equivalent config key.
pub fn skip_git_repo_check(self) -> Self
pub fn ephemeral(self) -> Self
Sourcepub fn ignore_user_config(self) -> Self
pub fn ignore_user_config(self) -> Self
Ignore the user-level config file (--ignore-user-config).
Sourcepub fn ignore_rules(self) -> Self
pub fn ignore_rules(self) -> Self
Ignore project rules files (--ignore-rules).
Sourcepub fn output_schema(self, path: impl Into<String>) -> Self
pub fn output_schema(self, path: impl Into<String>) -> Self
Require output to conform to a JSON schema (--output-schema <path>).
pub fn json(self) -> Self
pub fn output_last_message(self, path: impl Into<String>) -> Self
pub fn retry(self, policy: RetryPolicy) -> Self
pub async fn execute_json_lines( &self, codex: &Codex, ) -> Result<Vec<JsonLineEvent>>
Sourcepub async fn execute_json(&self, codex: &Codex) -> Result<QueryResult>
pub async fn execute_json(&self, codex: &Codex) -> Result<QueryResult>
Execute the review and return a typed
QueryResult.
Review emits the same event vocabulary as codex exec, so the review
comments arrive as the agent_message item that
result is assembled from. Use
execute_json_lines for the raw stream.
Requires the json feature.
One difference from exec, observed on codex-cli 0.145.0: the
turn.completed event of a review reports a usage object of all
zeros, so usage is present but
carries no counts.
Trait Implementations§
Source§impl Clone for ReviewCommand
impl Clone for ReviewCommand
Source§fn clone(&self) -> ReviewCommand
fn clone(&self) -> ReviewCommand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl CodexCommand for ReviewCommand
impl CodexCommand for ReviewCommand
Source§impl Dangerous for ReviewCommand
impl Dangerous for ReviewCommand
Source§fn bypass_approvals_and_sandbox(self, _allow: &DangerousClient) -> Result<Self>
fn bypass_approvals_and_sandbox(self, _allow: &DangerousClient) -> Result<Self>
--dangerously-bypass-approvals-and-sandbox). Read moreSource§fn bypass_hook_trust(self, _allow: &DangerousClient) -> Result<Self>
fn bypass_hook_trust(self, _allow: &DangerousClient) -> Result<Self>
--dangerously-bypass-hook-trust). Read more