Add `--preview` flag as alias for `-a untrusted` to improve discoverability
What feature would you like to see?
Problem
The -a untrusted (or --ask-for-approval=untrusted) flag enables a valuable diff preview + approval workflow, but users don't easily discover it because:
- The flag name doesn't clearly communicate "show me what will change before applying"
- Users coming from tools like Aider/Cursor expect a --preview or --diff flag
- Documentation doesn't prominently feature this as a safety/review workflow
Proposed Solution
Add a --preview flag as a CLI alias that internally sets approval_policy = untrusted.
Implementation location (based on codebase inspection):
// In tui/src/cli.rs (alongside existing flags)
#[arg(long = "preview", conflicts_with = "approval_policy")]
pub preview: bool,
Then map it during config resolution in tui/src/lib.rs (similar to how --full-auto works around line 96).
Benefits
- Makes existing functionality discoverable through intuitive naming
- Zero new behavior—just a clearer entry point
- ~10 lines of code
- Aligns with user expectations from similar tools
Alternative
If adding an alias isn't desirable, a documentation PR highlighting the "preview before apply" workflow with -a untrusted would also help.
Example Usage
Current (works but not obvious):
codex -a untrusted
Proposed (clearer intent):
codex --preview
Are you interested in implementing this feature?
Yes, I can submit a PR if this approach is approved. I've already inspected the codebase and identified the integration points in tui/src/cli.rs and tui/src/lib.rs.
Additional information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗