Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions codex-rs/core/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub(crate) use legacy::LegacyFeatureToggles;
pub enum Stage {
Experimental,
Beta {
name: &'static str,
menu_description: &'static str,
announcement: &'static str,
},
Expand All @@ -28,6 +29,13 @@ pub enum Stage {
}

impl Stage {
pub fn beta_menu_name(self) -> Option<&'static str> {
match self {
Stage::Beta { name, .. } => Some(name),
_ => None,
}
}

pub fn beta_menu_description(self) -> Option<&'static str> {
match self {
Stage::Beta {
Expand Down Expand Up @@ -324,6 +332,7 @@ pub const FEATURES: &[FeatureSpec] = &[
id: Feature::UnifiedExec,
key: "unified_exec",
stage: Stage::Beta {
name: "Background terminal",
menu_description: "Run long-running terminal commands in the background.",
announcement: "NEW! Try Background terminals for long running processes. Enable in /experimental!",
},
Expand All @@ -333,6 +342,7 @@ pub const FEATURES: &[FeatureSpec] = &[
id: Feature::ShellSnapshot,
key: "shell_snapshot",
stage: Stage::Beta {
name: "Shell snapshot",
menu_description: "Snapshot your shell environment to avoid re-running login scripts for every command.",
announcement: "NEW! Try shell snapshotting to make your Codex faster. Enable in /experimental!",
},
Expand Down
20 changes: 2 additions & 18 deletions codex-rs/tui/src/chatwidget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2730,10 +2730,11 @@ impl ChatWidget {
let features: Vec<BetaFeatureItem> = FEATURES
.iter()
.filter_map(|spec| {
let name = spec.stage.beta_menu_name()?;
let description = spec.stage.beta_menu_description()?;
Some(BetaFeatureItem {
feature: spec.id,
name: feature_label_from_key(spec.key),
name: name.to_string(),
description: description.to_string(),
enabled: self.config.features.enabled(spec.id),
})
Expand Down Expand Up @@ -3427,23 +3428,6 @@ impl ChatWidget {
}
}

fn feature_label_from_key(key: &str) -> String {
let mut out = String::with_capacity(key.len());
let mut capitalize = true;
for ch in key.chars() {
if ch == '_' || ch == '-' {
out.push(' ');
capitalize = true;
} else if capitalize {
out.push(ch.to_ascii_uppercase());
capitalize = false;
} else {
out.push(ch);
}
}
out
}

impl Drop for ChatWidget {
fn drop(&mut self) {
self.stop_rate_limit_poller();
Expand Down
Loading