Extract SupportedShells constant to constants package (gt-4u682)
- Added constants.SupportedShells for consistent shell list - Updated 7 usages across start.go, crew_lifecycle.go, crew_helpers.go, tmux.go - All tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/steveyegge/gastown/internal/constants"
|
||||||
"github.com/steveyegge/gastown/internal/crew"
|
"github.com/steveyegge/gastown/internal/crew"
|
||||||
"github.com/steveyegge/gastown/internal/git"
|
"github.com/steveyegge/gastown/internal/git"
|
||||||
"github.com/steveyegge/gastown/internal/rig"
|
"github.com/steveyegge/gastown/internal/rig"
|
||||||
@@ -137,7 +138,7 @@ func detectCrewFromCwd() (*crewDetection, error) {
|
|||||||
|
|
||||||
// isShellCommand checks if the command is a shell (meaning Claude has exited).
|
// isShellCommand checks if the command is a shell (meaning Claude has exited).
|
||||||
func isShellCommand(cmd string) bool {
|
func isShellCommand(cmd string) bool {
|
||||||
shells := []string{"bash", "zsh", "sh", "fish", "tcsh", "ksh"}
|
shells := constants.SupportedShells
|
||||||
for _, shell := range shells {
|
for _, shell := range shells {
|
||||||
if cmd == shell {
|
if cmd == shell {
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/steveyegge/gastown/internal/constants"
|
||||||
"github.com/steveyegge/gastown/internal/crew"
|
"github.com/steveyegge/gastown/internal/crew"
|
||||||
"github.com/steveyegge/gastown/internal/mail"
|
"github.com/steveyegge/gastown/internal/mail"
|
||||||
"github.com/steveyegge/gastown/internal/style"
|
"github.com/steveyegge/gastown/internal/style"
|
||||||
@@ -248,7 +249,7 @@ func runCrewRestart(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wait for Claude to start, then prime it
|
// Wait for Claude to start, then prime it
|
||||||
shells := []string{"bash", "zsh", "sh", "fish", "tcsh", "ksh"}
|
shells := constants.SupportedShells
|
||||||
if err := t.WaitForCommand(sessionID, shells, 15*time.Second); err != nil {
|
if err := t.WaitForCommand(sessionID, shells, 15*time.Second); err != nil {
|
||||||
style.PrintWarning("Timeout waiting for Claude to start: %v", err)
|
style.PrintWarning("Timeout waiting for Claude to start: %v", err)
|
||||||
}
|
}
|
||||||
@@ -413,7 +414,7 @@ func restartCrewSession(rigName, crewName, clonePath string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wait for Claude to start, then prime it
|
// Wait for Claude to start, then prime it
|
||||||
shells := []string{"bash", "zsh", "sh", "fish", "tcsh", "ksh"}
|
shells := constants.SupportedShells
|
||||||
if err := t.WaitForCommand(sessionID, shells, 15*time.Second); err != nil {
|
if err := t.WaitForCommand(sessionID, shells, 15*time.Second); err != nil {
|
||||||
// Non-fatal warning
|
// Non-fatal warning
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ const (
|
|||||||
RoleDeacon = "deacon"
|
RoleDeacon = "deacon"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SupportedShells lists shell binaries that Gas Town can detect and work with.
|
||||||
|
// Used to identify if a tmux pane is at a shell prompt vs running a command.
|
||||||
|
var SupportedShells = []string{"bash", "zsh", "sh", "fish", "tcsh", "ksh"}
|
||||||
|
|
||||||
// Path helpers construct common paths.
|
// Path helpers construct common paths.
|
||||||
|
|
||||||
// MayorRigsPath returns the path to rigs.json within a town root.
|
// MayorRigsPath returns the path to rigs.json within a town root.
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/steveyegge/gastown/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Common errors
|
// Common errors
|
||||||
@@ -433,7 +435,7 @@ func (t *Tmux) WaitForCommand(session string, excludeCommands []string, timeout
|
|||||||
// WaitForShellReady polls until the pane is running a shell command.
|
// WaitForShellReady polls until the pane is running a shell command.
|
||||||
// Useful for waiting until a process has exited and returned to shell.
|
// Useful for waiting until a process has exited and returned to shell.
|
||||||
func (t *Tmux) WaitForShellReady(session string, timeout time.Duration) error {
|
func (t *Tmux) WaitForShellReady(session string, timeout time.Duration) error {
|
||||||
shells := []string{"bash", "zsh", "sh", "fish", "tcsh", "ksh"}
|
shells := constants.SupportedShells
|
||||||
deadline := time.Now().Add(timeout)
|
deadline := time.Now().Add(timeout)
|
||||||
for time.Now().Before(deadline) {
|
for time.Now().Before(deadline) {
|
||||||
cmd, err := t.GetPaneCommand(session)
|
cmd, err := t.GetPaneCommand(session)
|
||||||
|
|||||||
Reference in New Issue
Block a user