aKode: comando akode update e avviso di nuova versione

- Nuovo crate akode-update: legge l'ultima release dal repository Gitea
  configurato ([update] repo_url, predefinito git.difonzo.net/andrea/aKode;
  404 = nessun aggiornamento), confronta la semver, scarica
  akode-<versione>-<target>.tar.gz solo dallo stesso host, verifica lo
  SHA-256 e sostituisce il binario in modo atomico tenendo akode.old
  (nel layout a pacchetto aggiorna anche akode-package.json o l'intero
  pacchetto).
- `akode update [--check]` con messaggi in italiano; mai installazioni
  automatiche.
- TUI: controllo in background all'avvio al massimo ogni 24 h
  (update-check.json in AKODE_HOME), avviso su una riga, disattivabile con
  [update] check_on_startup = false.
- Rimossi il prompt di aggiornamento e le azioni npm/brew/installer di
  OpenAI ormai inutilizzati; il doctor mostra sorgente e ultimo controllo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 14:56:25 +01:00
parent 25de1e70dc
commit 9494b768dd
37 changed files with 1485 additions and 1209 deletions

View File

@@ -9,80 +9,39 @@ use crate::wrapping::adaptive_wrap_line_to_width;
#[cfg_attr(not(test), allow(dead_code))]
const RECAP_HEADING: &str = "Conversation recap";
#[cfg_attr(debug_assertions, allow(dead_code))]
/// One-line startup notice for a newer aKode release (`akode update` installs it).
#[derive(Debug)]
pub(crate) struct UpdateAvailableHistoryCell {
latest_version: String,
update_action: Option<UpdateAction>,
}
#[cfg_attr(debug_assertions, allow(dead_code))]
impl UpdateAvailableHistoryCell {
pub(crate) fn new(latest_version: String, update_action: Option<UpdateAction>) -> Self {
Self {
latest_version,
update_action,
}
pub(crate) fn new(latest_version: String) -> Self {
Self { latest_version }
}
}
impl HistoryCell for UpdateAvailableHistoryCell {
fn display_lines(&self, width: u16) -> Vec<Line<'static>> {
use ratatui_macros::line;
use ratatui_macros::text;
let update_instruction = if let Some(update_action) = self.update_action {
line![
"Run ",
update_action.command_str().fg(accent_color()),
" to update."
]
} else {
line![
"See ",
"https://github.com/openai/codex"
.fg(accent_color())
.underlined(),
" for installation options."
]
};
let content = text![
line![
"✨\u{200A}".bold().fg(accent_color()),
"Update available!".bold().fg(accent_color()),
" ",
format!("{AKODE_CLI_VERSION} -> {}", self.latest_version).bold(),
],
update_instruction,
"",
"See full release notes:",
"https://github.com/openai/codex/releases/latest"
.fg(accent_color())
.underlined(),
];
let inner_width = content
.width()
.min(usize::from(width.saturating_sub(4)))
.max(1);
let lines = adaptive_wrap_lines(content.lines, RtOptions::new(inner_width));
with_border_with_inner_width(lines, inner_width)
let line = Line::from(vec![
"È disponibile aKode ".fg(accent_color()),
self.latest_version.clone().bold().fg(accent_color()),
" — esegui ".into(),
"\"akode update\"".bold(),
]);
vec![
crate::line_truncation::truncate_line_with_ellipsis_if_overflow(
line,
usize::from(width),
),
]
}
fn raw_lines(&self) -> Vec<Line<'static>> {
let update_instruction = if let Some(update_action) = self.update_action {
format!("Run {} to update.", update_action.command_str())
} else {
"See https://github.com/openai/codex for installation options.".to_string()
};
vec![
Line::from("Update available!"),
Line::from(format!("{AKODE_CLI_VERSION} -> {}", self.latest_version)),
Line::from(update_instruction),
Line::from(""),
Line::from("See full release notes:"),
Line::from("https://github.com/openai/codex/releases/latest"),
]
vec![Line::from(format!(
"È disponibile aKode {} — esegui \"akode update\"",
self.latest_version
))]
}
fn display_hyperlink_lines(&self, width: u16) -> Vec<HyperlinkLine> {