Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)

Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
  nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-17 12:37:52 +01:00
parent e37a0deba9
commit 7c1c6dfa8d
10306 changed files with 748026 additions and 748088 deletions

View File

@@ -0,0 +1,57 @@
//! Independent status effects and master-switch precedence.
use super::*;
use crate::app_event::AppEvent;
use crate::terminal_palette::with_test_default_colors;
use crate::terminal_probe::DefaultColors;
#[test]
fn shimmer_and_progress_are_independent_and_obey_master_switch() {
with_test_default_colors(
DefaultColors {
fg: (240, 240, 240),
bg: (16, 16, 16),
},
|| {
let mut snapshots = Vec::new();
for (animations, shimmer, progress) in [
(true, false, false),
(true, false, true),
(true, true, false),
(false, true, true),
] {
let (tx, _rx) = tokio::sync::mpsc::unbounded_channel::<AppEvent>();
let mut row = StatusIndicatorWidget::new(
AppEventSender::new(tx),
FrameRequester::test_dummy(),
animations,
akode_config::types::TuiEffects {
shimmer,
progress,
..Default::default()
},
);
// Pin the label timing and fallback bullet glyph to the first frame.
let start = Instant::now() + Duration::from_secs(/*secs*/ 3600);
row.header_started_at = start;
let timer = StatusTimer {
last_resume_at: start,
..Default::default()
};
let lines = StatusIndicator {
row: &row,
timer: &timer,
}
.lines(/*width*/ 80);
let header = &lines[0];
// Omit the bullet's process-clock-driven styling from the snapshot.
let label_start = if animations && progress { 2 } else { 0 };
let label = &header.spans[label_start..];
snapshots.push(format!(
"animations={animations}, shimmer={shimmer}, progress={progress}\n{header}\n{label:?}"
));
}
insta::assert_snapshot!(snapshots.join("\n\n"));
},
);
}

View File

@@ -0,0 +1,19 @@
---
source: tui/src/status_indicator_widget/effects_tests.rs
expression: "snapshots.join(\"\\n\\n\")"
---
animations=true, shimmer=false, progress=false
Working (0s • esc to interrupt)
[Span::from("Working"), Span::from(" "), Span::from("(0s • ").dim(), Span::from("esc").fg(Color::Rgb(240, 240, 240)).bold().not_dim(), Span::from(" to interrupt)").dim()]
animations=true, shimmer=false, progress=true
• Working (0s • esc to interrupt)
[Span::from("Working"), Span::from(" "), Span::from("(0s • ").dim(), Span::from("esc").fg(Color::Rgb(240, 240, 240)).bold().not_dim(), Span::from(" to interrupt)").dim()]
animations=true, shimmer=true, progress=false
Working (0s • esc to interrupt)
[Span::from("W").fg(Color::Rgb(128, 128, 128)), Span::from("o").fg(Color::Rgb(128, 128, 128)), Span::from("r").fg(Color::Rgb(128, 128, 128)), Span::from("k").fg(Color::Rgb(128, 128, 128)), Span::from("i").fg(Color::Rgb(128, 128, 128)), Span::from("n").fg(Color::Rgb(128, 128, 128)), Span::from("g").fg(Color::Rgb(128, 128, 128)), Span::from(" "), Span::from("(0s • ").dim(), Span::from("esc").fg(Color::Rgb(240, 240, 240)).bold().not_dim(), Span::from(" to interrupt)").dim()]
animations=false, shimmer=true, progress=true
Working (0s • esc to interrupt)
[Span::from("Working"), Span::from(" "), Span::from("(0s • ").dim(), Span::from("esc").fg(Color::Rgb(240, 240, 240)).bold().not_dim(), Span::from(" to interrupt)").dim()]

View File

@@ -0,0 +1,61 @@
//! Pause-aware status time owned independently of the optional status row.
//! A phase can override the displayed clock without changing turn accounting.
use std::time::Duration;
use std::time::Instant;
#[derive(Debug)]
pub(crate) struct StatusTimer {
/// Optional wall-clock origin for the displayed phase, without resetting turn accounting.
pub(crate) display_started_at: Option<Instant>,
pub(super) elapsed_running: Duration,
pub(super) last_resume_at: Instant,
pub(super) is_paused: bool,
}
impl Default for StatusTimer {
fn default() -> Self {
Self {
display_started_at: None,
elapsed_running: Duration::ZERO,
last_resume_at: Instant::now(),
is_paused: false,
}
}
}
impl StatusTimer {
pub(crate) fn reset(&mut self, elapsed: Duration) {
self.elapsed_running = elapsed;
self.last_resume_at = Instant::now();
// A turn can start while an MCP elicitation or approval is still open.
// Reset elapsed time without changing that modal's pause state.
}
pub(crate) fn pause_at(&mut self, now: Instant) {
if !self.is_paused {
self.elapsed_running += now.saturating_duration_since(self.last_resume_at);
self.is_paused = true;
}
}
pub(crate) fn resume_at(&mut self, now: Instant) {
if self.is_paused {
self.last_resume_at = now;
self.is_paused = false;
}
}
pub(crate) fn elapsed_at(&self, now: Instant) -> Duration {
self.elapsed_running
+ if self.is_paused {
Duration::ZERO
} else {
now.saturating_duration_since(self.last_resume_at)
}
}
}
#[cfg(test)]
#[path = "timer_tests.rs"]
mod tests;

View File

@@ -0,0 +1,34 @@
use super::*;
use pretty_assertions::assert_eq;
#[test]
fn pauses_and_resumes_without_counting_wait_time() {
let baseline = Instant::now();
let mut timer = StatusTimer {
last_resume_at: baseline,
..StatusTimer::default()
};
timer.pause_at(baseline + Duration::from_secs(5));
timer.pause_at(baseline + Duration::from_secs(8));
assert_eq!(
timer.elapsed_at(baseline + Duration::from_secs(10)),
Duration::from_secs(5)
);
timer.resume_at(baseline + Duration::from_secs(10));
timer.resume_at(baseline + Duration::from_secs(12));
assert_eq!(
timer.elapsed_at(baseline + Duration::from_secs(13)),
Duration::from_secs(8)
);
timer.reset(Duration::from_secs(24));
assert_eq!(
timer.elapsed_at(timer.last_resume_at),
Duration::from_secs(24)
);
timer.pause_at(timer.last_resume_at);
timer.reset(Duration::ZERO);
assert_eq!(
timer.elapsed_at(timer.last_resume_at + Duration::from_secs(/*secs*/ 120)),
Duration::ZERO
);
}