Merge polecat/Valkyrie: keepalive signal from gt commands
Adds keepalive.Touch() to signal agent activity during commands. Also ignores state.json in .gitignore. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,8 +3,10 @@ package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/steveyegge/gastown/internal/keepalive"
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
@@ -14,6 +16,12 @@ var rootCmd = &cobra.Command{
|
||||
|
||||
It coordinates agent spawning, work distribution, and communication
|
||||
across distributed teams of AI agents working on shared codebases.`,
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
// Signal agent activity by touching keepalive file
|
||||
// Build command path: gt status, gt mail send, etc.
|
||||
cmdPath := buildCommandPath(cmd)
|
||||
keepalive.TouchWithArgs(cmdPath, args)
|
||||
},
|
||||
}
|
||||
|
||||
// Execute runs the root command
|
||||
@@ -27,3 +35,13 @@ func init() {
|
||||
// Global flags can be added here
|
||||
// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file")
|
||||
}
|
||||
|
||||
// buildCommandPath walks the command hierarchy to build the full command path.
|
||||
// For example: "gt mail send", "gt status", etc.
|
||||
func buildCommandPath(cmd *cobra.Command) string {
|
||||
var parts []string
|
||||
for c := cmd; c != nil; c = c.Parent() {
|
||||
parts = append([]string{c.Name()}, parts...)
|
||||
}
|
||||
return strings.Join(parts, " ")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user