feat: 0.1.0
Some checks failed
distribution-gate / distribution-gate (push) Failing after 1m56s

This commit is contained in:
eric
2026-04-04 18:41:34 +02:00
parent 32147d4552
commit ebb6b488fe
48 changed files with 2541 additions and 139 deletions

View File

@@ -34,6 +34,14 @@ pub(crate) const CREATE_MODELS: [&str; 4] = [
"gpt-5.3-codex",
"gpt-5.3-codex-spark",
];
pub(crate) const CREATE_MENU_ROWS: usize = 3;
pub(crate) const PICKER_MENU_ROWS: usize = 3;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum PickerFocus {
List,
Settings,
}
#[derive(Debug, Clone)]
#[allow(clippy::large_enum_variant)]
@@ -91,8 +99,14 @@ pub struct App {
pub screen: Screen,
pub picker_items: Vec<crate::model::ControllerSummary>,
pub picker_selected: usize,
pub picker_focus: PickerFocus,
pub picker_menu_selected: usize,
pub picker_model_index: usize,
pub picker_fast_mode: bool,
pub picker_allow_branching: bool,
pub create_input: String,
pub create_model_index: usize,
pub create_menu_selected: usize,
pub create_fast_mode: bool,
pub create_allow_branching: bool,
pub create_error: Option<String>,
@@ -108,8 +122,14 @@ impl App {
screen: Screen::ControllerPicker,
picker_items: Vec::new(),
picker_selected: 0,
picker_focus: PickerFocus::List,
picker_menu_selected: 0,
picker_model_index: 0,
picker_fast_mode: false,
picker_allow_branching: false,
create_input: String::new(),
create_model_index: 0,
create_menu_selected: 0,
create_fast_mode: false,
create_allow_branching: false,
create_error: None,
@@ -177,18 +197,97 @@ impl App {
.unwrap_or(CREATE_MODELS[0])
}
pub(crate) fn cycle_create_model(&mut self) {
self.create_model_index = (self.create_model_index + 1) % CREATE_MODELS.len();
pub(crate) fn picker_model(&self) -> &'static str {
CREATE_MODELS
.get(self.picker_model_index)
.copied()
.unwrap_or(CREATE_MODELS[0])
}
pub(crate) fn selected_picker_controller_id(&self) -> Option<&str> {
self.picker_items
.get(self.picker_selected)
.map(|controller| controller.id.as_str())
}
pub(crate) fn shift_create_model(&mut self, delta: isize) {
let len = CREATE_MODELS.len() as isize;
let next = (self.create_model_index as isize + delta).rem_euclid(len);
self.create_model_index = next as usize;
}
pub(crate) fn toggle_create_fast_mode(&mut self) {
self.create_fast_mode = !self.create_fast_mode;
}
pub(crate) fn toggle_create_allow_branching(&mut self) {
self.create_allow_branching = !self.create_allow_branching;
}
pub(crate) fn move_create_menu_selection(&mut self, delta: isize) {
let next = (self.create_menu_selected as isize + delta)
.clamp(0, (CREATE_MENU_ROWS.saturating_sub(1)) as isize);
self.create_menu_selected = next as usize;
}
pub(crate) fn shift_picker_model(&mut self, delta: isize) {
let len = CREATE_MODELS.len() as isize;
let next = (self.picker_model_index as isize + delta).rem_euclid(len);
self.picker_model_index = next as usize;
}
pub(crate) fn toggle_picker_fast_mode(&mut self) {
self.picker_fast_mode = !self.picker_fast_mode;
}
pub(crate) fn toggle_picker_allow_branching(&mut self) {
self.picker_allow_branching = !self.picker_allow_branching;
}
pub(crate) fn move_picker_menu_selection(&mut self, delta: isize) {
let next = (self.picker_menu_selected as isize + delta)
.clamp(0, (PICKER_MENU_ROWS.saturating_sub(1)) as isize);
self.picker_menu_selected = next as usize;
}
pub(crate) fn reset_picker_menu(&mut self) {
self.picker_focus = PickerFocus::List;
self.picker_menu_selected = 0;
}
pub(crate) fn reset_create_form(&mut self) {
self.create_input.clear();
self.create_model_index = 0;
self.create_menu_selected = 0;
self.create_fast_mode = false;
self.create_allow_branching = false;
self.create_error = None;
}
pub(crate) fn reset_picker_form(&mut self) {
self.picker_focus = PickerFocus::List;
self.picker_menu_selected = 0;
self.picker_model_index = 0;
self.picker_fast_mode = false;
self.picker_allow_branching = false;
}
pub(crate) fn sync_picker_settings_from_selected_controller(&mut self) {
let Some(controller) = self.picker_items.get(self.picker_selected) else {
self.reset_picker_form();
return;
};
self.picker_model_index = CREATE_MODELS
.iter()
.position(|model| *model == controller.run_model)
.unwrap_or(0);
self.picker_fast_mode = controller.fast_mode;
self.picker_allow_branching = controller.allow_branching;
self.picker_menu_selected = 0;
self.picker_focus = PickerFocus::List;
}
pub(crate) fn workspace(&self) -> Option<&WorkspaceRuntime> {
self.workspace.as_ref()
}