feat(daemon): Add binary age detection to status command
Shows binary modification time in gt daemon status and warns when the binary is newer than the running process, suggesting a restart. This helps detect when bug fixes or new features aren't active because the daemon is running old code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -181,6 +181,16 @@ func runDaemonStatus(cmd *cobra.Command, args []string) error {
|
||||
state.LastHeartbeat.Format("15:04:05"),
|
||||
state.HeartbeatCount)
|
||||
}
|
||||
|
||||
// Check if binary is newer than process
|
||||
if binaryModTime, err := getBinaryModTime(); err == nil {
|
||||
fmt.Printf(" Binary: %s\n", binaryModTime.Format("2006-01-02 15:04:05"))
|
||||
if binaryModTime.After(state.StartedAt) {
|
||||
fmt.Printf(" %s Binary is newer than process - consider '%s'\n",
|
||||
style.Bold.Render("⚠"),
|
||||
style.Dim.Render("gt daemon stop && gt daemon start"))
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("%s Daemon is %s\n",
|
||||
@@ -192,6 +202,19 @@ func runDaemonStatus(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// getBinaryModTime returns the modification time of the current executable
|
||||
func getBinaryModTime() (time.Time, error) {
|
||||
exePath, err := os.Executable()
|
||||
if err != nil {
|
||||
return time.Time{}, err
|
||||
}
|
||||
info, err := os.Stat(exePath)
|
||||
if err != nil {
|
||||
return time.Time{}, err
|
||||
}
|
||||
return info.ModTime(), nil
|
||||
}
|
||||
|
||||
func runDaemonLogs(cmd *cobra.Command, args []string) error {
|
||||
townRoot, err := workspace.FindFromCwdOrError()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user