Files
codex/codex-rs/cli/src/app_cmd.rs
Eric Traut 50b8213385 Support ChatGPT-branded Desktop app builds (#33901)
## Why

The Desktop app can use Codex or ChatGPT branding while retaining stable platform identities. CLI discovery and TUI handoff should not depend on a single display name or hardcoded executable path.

## What changed

- On macOS, search for both `ChatGPT.app` and `Codex.app`, and accept only bundles with the `com.openai.codex` identifier.
- On Windows, detect installs by their package app ID and resolve the `codex` protocol executable from the AppX manifest before handing off a TUI session.
- Use “Desktop app” consistently in CLI and TUI user-facing text.

## Testing

Add coverage for selecting a ChatGPT-named Codex bundle and rejecting the classic ChatGPT bundle.

GitOrigin-RevId: b84a56eb6e960712152e1a9b023ab530ec9a354a
2026-07-17 20:46:18 +00:00

26 lines
784 B
Rust

use clap::Parser;
use std::path::PathBuf;
#[derive(Debug, Parser)]
pub struct AppCommand {
/// Workspace path to open in the Desktop app.
#[arg(value_name = "PATH", default_value = ".")]
pub path: PathBuf,
/// Override the app installer download URL (advanced).
#[arg(long = "download-url")]
pub download_url_override: Option<String>,
}
pub async fn run_app(cmd: AppCommand) -> anyhow::Result<()> {
let workspace = std::fs::canonicalize(&cmd.path).unwrap_or(cmd.path);
#[cfg(target_os = "macos")]
{
crate::desktop_app::run_app_open_or_install(workspace, cmd.download_url_override).await
}
#[cfg(target_os = "windows")]
{
crate::desktop_app::run_app_open_or_install(workspace, cmd.download_url_override).await
}
}