Refactor startup paths to use RuntimeConfig (gt-j0546)

Replaced all hardcoded 'claude --dangerously-skip-permissions' invocations
with configurable helpers from internal/config:

- GetRuntimeCommand(rigPath) - simple command string
- GetRuntimeCommandWithPrompt(rigPath, prompt) - with initial prompt
- BuildAgentStartupCommand(role, bdActor, rigPath, prompt) - generic agent
- BuildPolecatStartupCommand(rigName, polecatName, rigPath, prompt) - polecat
- BuildCrewStartupCommand(rigName, crewName, rigPath, prompt) - crew
- BuildStartupCommand(envVars, rigPath, prompt) - custom env vars

Files updated:
- internal/cmd/start.go (4 locations)
- internal/cmd/crew_lifecycle.go (2 locations)
- internal/cmd/crew_at.go (2 locations)
- internal/cmd/deacon.go
- internal/cmd/witness.go
- internal/cmd/up.go (2 locations)
- internal/cmd/handoff.go (2 locations)
- internal/daemon/daemon.go (3 locations)
- internal/daemon/lifecycle.go
- internal/session/manager.go
- internal/refinery/manager.go
- internal/boot/boot.go

This enables future support for alternative LLM runtimes (aider, etc.)
via rig/town settings configuration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/gus
2025-12-30 23:48:16 -08:00
committed by Steve Yegge
parent 0c75088727
commit 626a24e013
12 changed files with 42 additions and 36 deletions

View File

@@ -341,7 +341,8 @@ func ensureRefinerySession(rigName string, r *rig.Rig) (bool, error) {
// Launch Claude in a respawn loop
// Export GT_ROLE and BD_ACTOR in the command since tmux SetEnvironment only affects new panes
loopCmd := `export GT_ROLE=refinery BD_ACTOR=` + bdActor + ` GIT_AUTHOR_NAME=` + bdActor + ` && while true; do echo "🛢️ Starting Refinery for ` + rigName + `..."; claude --dangerously-skip-permissions; echo ""; echo "Refinery exited. Restarting in 2s... (Ctrl-C to stop)"; sleep 2; done`
runtimeCmd := config.GetRuntimeCommand(r.Path)
loopCmd := `export GT_ROLE=refinery BD_ACTOR=` + bdActor + ` GIT_AUTHOR_NAME=` + bdActor + ` && while true; do echo "🛢️ Starting Refinery for ` + rigName + `..."; ` + runtimeCmd + `; echo ""; echo "Refinery exited. Restarting in 2s... (Ctrl-C to stop)"; sleep 2; done`
if err := t.SendKeysDelayed(sessionName, loopCmd, 200); err != nil {
return false, fmt.Errorf("sending command: %w", err)
}
@@ -744,7 +745,7 @@ func runStartCrew(cmd *cobra.Command, args []string) error {
if !t.IsClaudeRunning(sessionID) {
// Claude has exited, restart it
fmt.Printf("Session exists, restarting Claude...\n")
if err := t.SendKeys(sessionID, "claude --dangerously-skip-permissions"); err != nil {
if err := t.SendKeys(sessionID, config.GetRuntimeCommand(r.Path)); err != nil {
return fmt.Errorf("restarting claude: %w", err)
}
// Wait for Claude to start, then prime
@@ -785,7 +786,7 @@ func runStartCrew(cmd *cobra.Command, args []string) error {
}
// Start claude with skip permissions
if err := t.SendKeys(sessionID, "claude --dangerously-skip-permissions"); err != nil {
if err := t.SendKeys(sessionID, config.GetRuntimeCommand(r.Path)); err != nil {
return fmt.Errorf("starting claude: %w", err)
}
@@ -926,7 +927,7 @@ func startCrewMember(rigName, crewName, townRoot string) error {
}
// Start claude
if err := t.SendKeys(sessionID, "claude --dangerously-skip-permissions"); err != nil {
if err := t.SendKeys(sessionID, config.GetRuntimeCommand(r.Path)); err != nil {
return fmt.Errorf("starting claude: %w", err)
}