feat(version): add stale binary detection with startup warning

Add detection for when the installed gt binary is out of date with the
source repository. This helps catch issues where commands fail mysteriously
because the installed binary doesn't have recent fixes.

Changes:
- Add internal/version package with stale binary detection logic
- Add startup warning in PersistentPreRunE when binary is stale
- Add gt doctor check for stale-binary
- Use prefix matching for commit comparison (handles short vs full hash)

The warning is non-blocking and only shows once per shell session via
the GT_STALE_WARNED environment variable.

Resolves: gt-ud912

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
slit
2026-01-09 15:35:25 -08:00
committed by beads/crew/giles
parent b8075a5e06
commit be35b3eaab
6 changed files with 302 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ import (
"strings"
"github.com/spf13/cobra"
"github.com/steveyegge/gastown/internal/version"
)
var infoCmd = &cobra.Command{
@@ -39,7 +40,7 @@ Examples:
}
if commit := resolveCommitHash(); commit != "" {
info["commit"] = shortCommit(commit)
info["commit"] = version.ShortCommit(commit)
}
if branch := resolveBranch(); branch != "" {
info["branch"] = branch