feat(refinery,boot): add --agent flag for model selection (#469)
* feat(refinery,boot): add --agent flag for model selection (hq-7d5m) Add --agent flag to gt refinery start/attach/restart and gt boot spawn commands for consistent model selection across all agent launch points. Implementation follows the existing pattern from gt deacon start: - Add StringVar flag for agent alias - Pass override to Manager/Boot via SetAgentOverride() - Use BuildAgentStartupCommandWithAgentOverride when override is set Files affected: - cmd/gt/refinery.go: add flags to start/attach/restart commands - internal/refinery/manager.go: add SetAgentOverride and use in Start() - cmd/gt/boot.go: add flag to spawn command - internal/boot/boot.go: add SetAgentOverride and use in spawnTmux() Closes #438 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor(refinery,boot): use parameter-passing pattern for --agent flag Address PR review feedback: 1. ADD TESTS: Add tests for --agent flag existence following witness_test.go pattern - internal/cmd/refinery_test.go: tests for start/attach/restart - internal/cmd/boot_test.go: test for spawn 2. ALIGN PATTERN: Change from setter pattern to parameter-passing pattern - Manager.Start(foreground, agentOverride) instead of SetAgentOverride + Start - Boot.Spawn(agentOverride) instead of SetAgentOverride + Spawn - Matches witness.go style: Start(foreground bool, agentOverride string, ...) Updated all callers to pass empty string for default agent: - internal/daemon/daemon.go - internal/cmd/rig.go - internal/cmd/start.go - internal/cmd/up.go Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: furiosa <will@saults.io> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
45
internal/cmd/refinery_test.go
Normal file
45
internal/cmd/refinery_test.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRefineryStartAgentFlag(t *testing.T) {
|
||||
flag := refineryStartCmd.Flags().Lookup("agent")
|
||||
if flag == nil {
|
||||
t.Fatal("expected refinery start to define --agent flag")
|
||||
}
|
||||
if flag.DefValue != "" {
|
||||
t.Errorf("expected default agent override to be empty, got %q", flag.DefValue)
|
||||
}
|
||||
if !strings.Contains(flag.Usage, "overrides town default") {
|
||||
t.Errorf("expected --agent usage to mention overrides town default, got %q", flag.Usage)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRefineryAttachAgentFlag(t *testing.T) {
|
||||
flag := refineryAttachCmd.Flags().Lookup("agent")
|
||||
if flag == nil {
|
||||
t.Fatal("expected refinery attach to define --agent flag")
|
||||
}
|
||||
if flag.DefValue != "" {
|
||||
t.Errorf("expected default agent override to be empty, got %q", flag.DefValue)
|
||||
}
|
||||
if !strings.Contains(flag.Usage, "overrides town default") {
|
||||
t.Errorf("expected --agent usage to mention overrides town default, got %q", flag.Usage)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRefineryRestartAgentFlag(t *testing.T) {
|
||||
flag := refineryRestartCmd.Flags().Lookup("agent")
|
||||
if flag == nil {
|
||||
t.Fatal("expected refinery restart to define --agent flag")
|
||||
}
|
||||
if flag.DefValue != "" {
|
||||
t.Errorf("expected default agent override to be empty, got %q", flag.DefValue)
|
||||
}
|
||||
if !strings.Contains(flag.Usage, "overrides town default") {
|
||||
t.Errorf("expected --agent usage to mention overrides town default, got %q", flag.Usage)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user