mirror of
https://github.com/openai/codex.git
synced 2026-05-03 10:56:37 +00:00
## Why Addresses #9274 Running `codex update` currently starts an interactive Codex session with `update` as the prompt. That is a rough edge for users who expect a direct self-update command after seeing the existing update notice, and it forces them to copy the suggested package-manager command manually. ## What changed - Added a top-level `codex update` subcommand. - Reused the existing install-channel detection and update command runner that the TUI already uses for update prompts. - Exposed the update-action lookup from `codex-tui` so the CLI can invoke the same behavior. - Added CLI coverage to ensure `codex update` is parsed as a subcommand instead of becoming an interactive prompt. ## Verification - `cargo test -p codex-cli` - `cargo test -p codex-tui update_action::tests`
37 lines
965 B
Rust
37 lines
965 B
Rust
use anyhow::Result;
|
|
use predicates::str::contains;
|
|
use std::path::Path;
|
|
use tempfile::TempDir;
|
|
|
|
fn codex_command(codex_home: &Path) -> Result<assert_cmd::Command> {
|
|
let mut cmd = assert_cmd::Command::new(codex_utils_cargo_bin::cargo_bin("codex")?);
|
|
cmd.env("CODEX_HOME", codex_home);
|
|
Ok(cmd)
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn marketplace_upgrade_runs_under_plugin() -> Result<()> {
|
|
let codex_home = TempDir::new()?;
|
|
|
|
codex_command(codex_home.path())?
|
|
.args(["plugin", "marketplace", "upgrade"])
|
|
.assert()
|
|
.success()
|
|
.stdout(contains("No configured Git marketplaces to upgrade."));
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn marketplace_upgrade_no_longer_runs_at_top_level() -> Result<()> {
|
|
let codex_home = TempDir::new()?;
|
|
|
|
codex_command(codex_home.path())?
|
|
.args(["marketplace", "upgrade"])
|
|
.assert()
|
|
.failure()
|
|
.stderr(contains("unrecognized subcommand 'upgrade'"));
|
|
|
|
Ok(())
|
|
}
|