luxe update and /update, editable question answers, and a version bump owed once per release

- luxe update and /update update Luxe with the command for however it was installed (cargo or
  Homebrew), run one program at a time with the terminal attached, then check that the luxe on
  PATH is the new version. Luxe never downloads or replaces its own binary. The start screen says
  "Update available · /update".
- A question's typed answer edits at its caret: arrows, word jumps, Home, End and Delete work,
  and up and down move through a wrapped answer before leaving it.
- The version check owes a bump once per release: the version on main is the next release, and
  only a released one (a v-tag) has to move.
- Dependency updates arrive through the sync, so Dependabot and the weekly jobs no longer run here.
This commit is contained in:
Evan Whittaker
2026-10-17 14:14:27 -05:00
parent 0e84deb59c
commit bf86df5098
41 changed files with 794 additions and 355 deletions

View File

@@ -5,11 +5,15 @@ use super::worktree::{
check_out_pull_request, enter_session_worktree, remove_worktree, take_up_issue_in_worktree,
};
/// The one line under the dashboard, or nothing.
/// The one line under the dashboard, or nothing: that an update exists, and how to take it. The
/// versions and the command wait for `/update`, where the reader decides.
fn footer_note(repo_root: &std::path::Path) -> Option<String> {
crate::update_check::cached_notice(repo_root).map(|notice| notice.line())
crate::update_check::cached_notice(repo_root).map(|_| UPDATE_HINT.to_string())
}
/// What the dashboard says when a newer Luxe exists.
const UPDATE_HINT: &str = "Update available · /update";
/// Whether the startup dashboard should be shown.
///
/// Suppressed when resuming, when the session already has its work — `--issue` or `--pr` said
@@ -151,6 +155,12 @@ impl Next<'_> {
remove_worktree(&self.settings.state_root, &path).await;
return Ok(Flow::Leave);
}
TuiExit::Update => {
// The terminal is the reader's again, so the package manager's output reaches them
shutdown_workspace_services().await;
super::update_command::run(false).await?;
return Ok(Flow::Leave);
}
TuiExit::TakeUpIssue(number) => {
// A new session on the issue, in its worktree; the one left stays as it was
shutdown_workspace_services().await;
@@ -342,3 +352,28 @@ pub(super) async fn shutdown_workspace_services() {
tracing::warn!("workspace service shutdown timed out; relying on kill-on-drop reaping");
}
}
#[cfg(test)]
mod tests {
use luxe_core::update::UpdateState;
/// The start screen says only that an update exists and how to take it, and nothing when it
/// does not; the versions and the command wait for `/update`.
///
/// Mutates the environment, which nextest makes safe by giving each test its own process.
#[test]
fn the_footer_says_an_update_is_available_and_how() {
let dir = tempfile::tempdir().expect("tempdir");
let cache = dir.path().join("update.json");
std::env::set_var("LUXE_UPDATE_PATH", &cache);
std::env::set_var("LUXE_UPDATE_CHECK", "1");
let now = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap();
for (latest, footer) in [("99.0.0", Some("Update available · /update")), ("0.0.1", None)] {
let state = UpdateState { latest: Some(latest.into()), checked_at: now.as_secs() };
state.store(&cache).expect("store");
assert_eq!(super::footer_note(dir.path()).as_deref(), footer, "{latest}");
}
std::env::remove_var("LUXE_UPDATE_PATH");
std::env::remove_var("LUXE_UPDATE_CHECK");
}
}