feat: add --agent override for sling
This commit is contained in:
@@ -39,6 +39,7 @@ type SlingSpawnOptions struct {
|
||||
Account string // Claude Code account handle to use
|
||||
Create bool // Create polecat if it doesn't exist (currently always true for sling)
|
||||
HookBead string // Bead ID to set as hook_bead at spawn time (atomic assignment)
|
||||
Agent string // Agent override for this spawn (e.g., "gemini", "codex", "claude-haiku")
|
||||
}
|
||||
|
||||
// SpawnPolecatForSling creates a fresh polecat and optionally starts its session.
|
||||
@@ -122,8 +123,11 @@ func SpawnPolecatForSling(rigName string, opts SlingSpawnOptions) (*SpawnedPolec
|
||||
fmt.Printf("Polecat created. Agent must be started manually.\n\n")
|
||||
fmt.Printf("To start the agent:\n")
|
||||
fmt.Printf(" cd %s\n", polecatObj.ClonePath)
|
||||
// Use rig's configured agent command
|
||||
agentCmd := config.ResolveAgentConfig(townRoot, r.Path).BuildCommand()
|
||||
// Use rig's configured agent command, unless overridden.
|
||||
agentCmd, err := config.GetRuntimeCommandWithAgentOverride(r.Path, opts.Agent)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fmt.Printf(" %s\n\n", agentCmd)
|
||||
fmt.Printf("Agent will discover work via gt prime on startup.\n")
|
||||
|
||||
@@ -157,6 +161,13 @@ func SpawnPolecatForSling(rigName string, opts SlingSpawnOptions) (*SpawnedPolec
|
||||
startOpts := session.StartOptions{
|
||||
ClaudeConfigDir: claudeConfigDir,
|
||||
}
|
||||
if opts.Agent != "" {
|
||||
cmd, err := config.BuildPolecatStartupCommandWithAgentOverride(rigName, polecatName, r.Path, "", opts.Agent)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
startOpts.Command = cmd
|
||||
}
|
||||
if err := sessMgr.Start(polecatName, startOpts); err != nil {
|
||||
return nil, fmt.Errorf("starting session: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user