Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Code review feedback: added centralized version crate with `current…
…_version` function.
  • Loading branch information
etraut-openai committed Sep 5, 2025
commit 695e57d4b4253c1b48fdb637bf82a7604602ae99
2 changes: 1 addition & 1 deletion codex-rs/tui/src/history_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ pub(crate) fn new_status_output(
lines.push("".into());

// 💻 Client
let cli_version = env!("CARGO_PKG_VERSION");
let cli_version = crate::version::current_version();
lines.push(vec![padded_emoji("💻").into(), "Client".bold()].into());
lines.push(vec![" • CLI Version: ".into(), cli_version.into()].into());
lines.push("".into());
Expand Down
1 change: 1 addition & 0 deletions codex-rs/tui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ mod streaming;
mod text_formatting;
mod tui;
mod user_approval_widget;
mod version;
mod wrapping;

// Internal vt100-based replay tests live as a separate source file to keep them
Expand Down
4 changes: 3 additions & 1 deletion codex-rs/tui/src/updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use std::path::PathBuf;
use codex_core::config::Config;
use codex_core::default_client::create_client;

use crate::version::current_version;

pub fn get_upgrade_version(config: &Config) -> Option<String> {
let version_file = version_filepath(config);
let info = read_version_info(&version_file).ok();
Expand All @@ -31,7 +33,7 @@ pub fn get_upgrade_version(config: &Config) -> Option<String> {
}

info.and_then(|info| {
let current_version = env!("CARGO_PKG_VERSION");
let current_version = current_version();
if is_newer(&info.latest_version, current_version).unwrap_or(false) {
Some(info.latest_version)
} else {
Expand Down
14 changes: 14 additions & 0 deletions codex-rs/tui/src/version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/// Returns the current Codex CLI version as embedded at compile time.
pub fn current_version() -> &'static str {
env!("CARGO_PKG_VERSION")
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn current_version_matches_env() {
assert_eq!(current_version(), env!("CARGO_PKG_VERSION"));
}
}
Loading