ci: add GitHub Actions workflows with semantic-release auto-versioning
chore: fix all 702 clippy warnings across codebase - auto-fix 475 via cargo clippy --fix - fix remaining 227 manually: uninlined_format_args, redundant_closure, match_same_arms, underscore_binding, format_push_string, items_after_statements, needless_pass_by_value, clone_on_copy, case_sensitive_extension, single_match/let-else, write_with_newline, and other clippy lints
This commit is contained in:
+8
-7
@@ -1,3 +1,4 @@
|
||||
#![allow(clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::cast_precision_loss, clippy::cast_possible_wrap)]
|
||||
//! Status bar rendering for the TUI — modern segmented bar design.
|
||||
//!
|
||||
//! Flow: `draw_status_bar` reads live connection/turn state off
|
||||
@@ -20,14 +21,15 @@ use super::theme::Theme;
|
||||
/// Layout (left-to-right, space-filling):
|
||||
/// LEFT: [zesdex] + status indicator (READY/PROG/NOAPI)
|
||||
/// CENTER: spinner + optional contextual info
|
||||
/// RIGHT: provider · model · ↑tokens_in ↓tokens_out
|
||||
/// RIGHT: provider · model · ↑`tokens_in` ↓`tokens_out`
|
||||
pub fn draw_status_bar(frame: &mut Frame, area: Rect, state: &crate::app::state::rest::AppStateRest) {
|
||||
use ratatui::layout::{Constraint, Direction, Layout};
|
||||
let spinner_frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
||||
|
||||
// ── Agent status badge ────────────────────────────────────────────────
|
||||
let (status_text, badge_bg, status_fg) = if state.turn_in_flight() {
|
||||
let f = spinner_frames[(state.misc.tick_count as usize / 2) % spinner_frames.len()];
|
||||
(format!(" {} PROG ", f), Theme::MODE_YOLO, Theme::BG)
|
||||
(format!(" {f} PROG "), Theme::MODE_YOLO, Theme::BG)
|
||||
} else if state.misc.api_connected {
|
||||
(" READY ".to_string(), Theme::MODE_AUTO, Theme::BG)
|
||||
} else {
|
||||
@@ -61,7 +63,7 @@ pub fn draw_status_bar(frame: &mut Frame, area: Rect, state: &crate::app::state:
|
||||
|
||||
let total_chars: usize = rt.messages.iter()
|
||||
.filter_map(|m| m.content.as_deref())
|
||||
.map(|c| c.len())
|
||||
.map(str::len)
|
||||
.sum();
|
||||
let current_tokens = total_chars / 4;
|
||||
|
||||
@@ -69,8 +71,8 @@ pub fn draw_status_bar(frame: &mut Frame, area: Rect, state: &crate::app::state:
|
||||
if rt.usage.last_tokens_in > 0 || rt.usage.last_tokens_out > 0 {
|
||||
parts.push(format!("↑{} ↓{}", rt.usage.last_tokens_in, rt.usage.last_tokens_out));
|
||||
}
|
||||
let max_str = max_tokens.map(|v| v.to_string()).unwrap_or_else(|| "?".to_string());
|
||||
parts.push(format!("{}/{}", current_tokens, max_str));
|
||||
let max_str = max_tokens.map_or_else(|| "?".to_string(), |v| v.to_string());
|
||||
parts.push(format!("{current_tokens}/{max_str}"));
|
||||
parts.push(state.settings.provider.clone());
|
||||
parts.push(state.settings.model.clone());
|
||||
|
||||
@@ -79,7 +81,7 @@ pub fn draw_status_bar(frame: &mut Frame, area: Rect, state: &crate::app::state:
|
||||
let max_tokens = state.app_config.model_roles.values()
|
||||
.find(|role| role.provider == state.settings.provider && role.model == state.settings.model)
|
||||
.and_then(|role| role.context_window);
|
||||
let max_str = max_tokens.map(|v| v.to_string()).unwrap_or_else(|| "?".to_string());
|
||||
let max_str = max_tokens.map_or_else(|| "?".to_string(), |v| v.to_string());
|
||||
format!(" 0/{} · {} · {} ", max_str, state.settings.provider, state.settings.model)
|
||||
};
|
||||
|
||||
@@ -92,7 +94,6 @@ pub fn draw_status_bar(frame: &mut Frame, area: Rect, state: &crate::app::state:
|
||||
));
|
||||
|
||||
// Render the bar using two columns
|
||||
use ratatui::layout::{Constraint, Direction, Layout};
|
||||
let chunks = Layout::default()
|
||||
.direction(Direction::Horizontal)
|
||||
.constraints([
|
||||
|
||||
Reference in New Issue
Block a user