diff --git a/codex-rs/core/src/lib.rs b/codex-rs/core/src/lib.rs index c728bd3125..185bdead8a 100644 --- a/codex-rs/core/src/lib.rs +++ b/codex-rs/core/src/lib.rs @@ -15,7 +15,7 @@ pub use codex::Codex; pub use codex::CodexSpawnOk; pub mod codex_wrapper; pub mod config; -pub mod config_profile; +mod config_profile; pub mod config_types; mod conversation_history; pub mod error; @@ -33,7 +33,7 @@ pub use model_provider_info::ModelProviderInfo; pub use model_provider_info::WireApi; pub use model_provider_info::built_in_model_providers; pub use model_provider_info::create_oss_provider_with_base_url; -pub mod model_family; +mod model_family; mod models; mod openai_model_info; mod openai_tools; @@ -43,9 +43,9 @@ pub mod protocol; mod rollout; pub(crate) mod safety; pub mod seatbelt; -pub mod shell; +mod shell; pub mod spawn; -pub mod turn_diff_tracker; +mod turn_diff_tracker; mod user_notification; pub mod util; pub use apply_patch::CODEX_APPLY_PATCH_ARG1; diff --git a/codex-rs/core/src/shell.rs b/codex-rs/core/src/shell.rs index de0764f75e..4fc48a3f67 100644 --- a/codex-rs/core/src/shell.rs +++ b/codex-rs/core/src/shell.rs @@ -1,13 +1,13 @@ -use shlex; - +#[cfg(target_os = "macos")] #[derive(Debug, PartialEq, Eq)] -pub struct ZshShell { +pub(crate) struct ZshShell { shell_path: String, zshrc_path: String, } #[derive(Debug, PartialEq, Eq)] -pub enum Shell { +pub(crate) enum Shell { + #[cfg(target_os = "macos")] Zsh(ZshShell), Unknown, } @@ -15,6 +15,7 @@ pub enum Shell { impl Shell { pub fn format_default_shell_invocation(&self, command: Vec) -> Option> { match self { + #[cfg(target_os = "macos")] Shell::Zsh(zsh) => { if !std::path::Path::new(&zsh.zshrc_path).exists() { return None; diff --git a/codex-rs/tui/src/lib.rs b/codex-rs/tui/src/lib.rs index 50535e5967..d8808d212f 100644 --- a/codex-rs/tui/src/lib.rs +++ b/codex-rs/tui/src/lib.rs @@ -27,14 +27,23 @@ mod bottom_pane; mod chatwidget; mod citation_regex; mod cli; +#[cfg(feature = "vt100-tests")] pub mod custom_terminal; +#[cfg(not(feature = "vt100-tests"))] +mod custom_terminal; mod exec_command; mod file_search; mod get_git_diff; mod git_warning_screen; mod history_cell; +#[cfg(feature = "vt100-tests")] pub mod insert_history; +#[cfg(not(feature = "vt100-tests"))] +mod insert_history; +#[cfg(feature = "vt100-tests")] pub mod live_wrap; +#[cfg(not(feature = "vt100-tests"))] +mod live_wrap; mod log_layer; mod markdown; mod slash_command; diff --git a/codex-rs/tui/src/live_wrap.rs b/codex-rs/tui/src/live_wrap.rs index e78710dc6c..ec4ccfdede 100644 --- a/codex-rs/tui/src/live_wrap.rs +++ b/codex-rs/tui/src/live_wrap.rs @@ -1,5 +1,4 @@ use unicode_width::UnicodeWidthChar; -use unicode_width::UnicodeWidthStr; /// A single visual row produced by RowBuilder. #[derive(Debug, Clone, PartialEq, Eq)] @@ -10,7 +9,9 @@ pub struct Row { } impl Row { + #[cfg(test)] pub fn width(&self) -> usize { + use unicode_width::UnicodeWidthStr; self.text.width() } } @@ -39,6 +40,7 @@ impl RowBuilder { self.target_width } + #[cfg(test)] pub fn set_width(&mut self, width: usize) { self.target_width = width.max(1); // Rewrap everything we have (simple approach for Step 1). @@ -87,6 +89,7 @@ impl RowBuilder { } /// Return a snapshot of produced rows (non-draining). + #[cfg(test)] pub fn rows(&self) -> &[Row] { &self.rows }