Skip to content

Commit cd9e53b

Browse files
gmoonclaude
andcommitted
Fix update notification not showing on all commands
Extract command dispatch into run_command() so maybe_notify_update() always runs after command completion, regardless of early returns. Previously, commands like `lattice drift` with no drift would return early and skip the update check. Also move the bare `lattice` update check before Clap's --help (which exits the process). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 179ec1c commit cd9e53b

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lattice"
3-
version = "0.1.11"
3+
version = "0.1.12"
44
edition = "2024"
55
description = "A knowledge coordination protocol for human-agent collaboration"
66
repository = "https://github.com/forkzero/lattice"

src/main.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,15 +1460,22 @@ fn main() {
14601460
let command = match cli.command {
14611461
Some(cmd) => cmd,
14621462
None => {
1463-
// Re-parse with --help to show usage
1464-
Cli::parse_from(["lattice", "--help"]);
1463+
// Show update notification before help (Clap's --help exits the process)
14651464
lattice::update::maybe_notify_update(None);
1465+
Cli::parse_from(["lattice", "--help"]);
14661466
return;
14671467
}
14681468
};
14691469

14701470
let command_name = command_to_name(&command);
14711471

1472+
run_command(command);
1473+
1474+
// Passive update check after command output is complete
1475+
lattice::update::maybe_notify_update(Some(command_name));
1476+
}
1477+
1478+
fn run_command(command: Commands) {
14721479
match command {
14731480
Commands::Init {
14741481
force,
@@ -3409,9 +3416,6 @@ fn main() {
34093416
}
34103417
}
34113418
}
3412-
3413-
// Passive update check after command output is complete
3414-
lattice::update::maybe_notify_update(Some(command_name));
34153419
}
34163420

34173421
#[cfg(test)]

src/update.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,20 +355,13 @@ fn print_update_notice(latest: &Version) {
355355
/// non-TTY stderr, dev builds, and when HOME is unset. Caches the check
356356
/// result for 24 hours to avoid repeated network requests.
357357
pub fn maybe_notify_update(command_name: Option<&str>) {
358-
use std::io::IsTerminal;
359-
360358
// Skip for commands that handle updates themselves or use stdio protocol
361359
if let Some(name) = command_name
362360
&& (name == "update" || name == "mcp")
363361
{
364362
return;
365363
}
366364

367-
// Skip if stderr is not a terminal (piped output)
368-
if !std::io::stderr().is_terminal() {
369-
return;
370-
}
371-
372365
// Skip dev builds
373366
if !is_installed_binary() {
374367
return;

0 commit comments

Comments
 (0)