This commit is contained in:
Daniel Edrisian
2025-10-14 10:02:29 -07:00
parent de4cf425df
commit e26d2db1a0
3 changed files with 23 additions and 24 deletions
+3 -1
View File
@@ -480,6 +480,7 @@ fn print_completion(cmd: CompletionCommand) {
}
fn run_update_action(action: UpdateAction) -> anyhow::Result<()> {
println!();
match action {
UpdateAction::NpmGlobalLatest => {
println!("Updating Codex via npm (global latest)…");
@@ -500,7 +501,8 @@ fn run_update_action(action: UpdateAction) -> anyhow::Result<()> {
}
}
}
println!("Update complete.");
println!();
println!("🎉 Update ran successfully! Please restart Codex.");
Ok(())
}
+1 -1
View File
@@ -163,7 +163,7 @@ impl App {
// Show an update approval popup at startup when an update is available.
#[cfg(not(debug_assertions))]
if let Some(latest_version) = crate::updates::get_upgrade_version(&app.config) {
app.chat_widget.open_update_popup(latest_version);
app.chat_widget.open_update_popup();
}
let tui_events = tui.event_stream();
+19 -22
View File
@@ -80,6 +80,7 @@ use crate::history_cell;
use crate::history_cell::AgentMessageCell;
use crate::history_cell::HistoryCell;
use crate::history_cell::McpToolCallCell;
use crate::history_cell::padded_emoji;
use crate::markdown::append_markdown;
use crate::slash_command::SlashCommand;
use crate::status::RateLimitSnapshotDisplay;
@@ -1813,24 +1814,10 @@ impl ChatWidget {
}
/// Open a simple modal asking to update Codex when an update is available.
pub(crate) fn open_update_popup(&mut self, latest_version: String) {
pub(crate) fn open_update_popup(&mut self) {
use ratatui::style::Stylize as _;
use ratatui::text::Line;
let current_version = CODEX_CLI_VERSION;
let title = "Update Approval".to_string();
// Build header lines with the prompt and version info.
let mut header_lines: Vec<Line<'static>> = vec![
Line::from("Should I update Codex?".bold()),
Line::from(""),
Line::from(vec![
"Update available!".bold().cyan(),
" ".into(),
format!("{current_version} -> {latest_version}.").bold(),
]),
];
// Determine the recommended update method.
let exe = std::env::current_exe().unwrap_or_default();
let managed_by_npm = std::env::var_os("CODEX_MANAGED_BY_NPM").is_some();
@@ -1844,16 +1831,26 @@ impl ChatWidget {
None
};
// Don't show the update popup if no update action is available.
if update_action.is_none() {
header_lines.push(Line::from(""));
header_lines.push(Line::from(vec![
"See ".into(),
return;
}
// Build header lines with the prompt and version info.
let header_lines: Vec<Line<'static>> = vec![
Line::from(vec![
padded_emoji("✨").bold().cyan(),
"New version available! Would you like to update?".bold(),
]),
Line::from(""),
Line::from(vec![
"Full release notes: ".dim(),
"https://github.com/openai/codex/releases/latest"
.cyan()
.underlined(),
" for installation options.".into(),
]));
}
]),
Line::from(""),
];
let mut items: Vec<SelectionItem> = Vec::new();
if let Some(action) = update_action {
@@ -1874,7 +1871,7 @@ impl ChatWidget {
});
self.bottom_pane.show_selection_view(SelectionViewParams {
title: Some(title),
title: None,
footer_hint: Some(standard_popup_hint_line()),
items,
header: Box::new(ratatui::widgets::Paragraph::new(header_lines)),