MCPcopy Create free account
hub / github.com/codehamr/codehamr / SetActive

Method SetActive

internal/config/config.go:355–366  ·  view source on GitHub ↗

SetActive switches the active profile and persists. Fails on an unknown name, no silent coercion. On Save failure it reverts in-memory Active so the live model and config.yaml stay in lockstep; otherwise the switch would stick this session but vanish on the next Bootstrap.

(name string)

Source from the content-addressed store, hash-verified

353// no silent coercion. On Save failure it reverts in-memory Active so the live
354// model and config.yaml stay in lockstep; otherwise the switch would stick this
355// session but vanish on the next Bootstrap.
356func (c *Config) SetActive(name string) error {
357 if _, ok := c.Models[name]; !ok {
358 return fmt.Errorf("unknown model: %s", name)
359 }
360 prev := c.Active
361 c.Active = name
362 if err := c.Save(); err != nil {
363 c.Active = prev
364 return err
365 }
366 return nil
367}

Callers 5

cmdModelMethod · 0.80
activateHamrpassMethod · 0.80
TestSetActivePersistsFunction · 0.80

Calls 1

SaveMethod · 0.95

Tested by 3

TestSetActivePersistsFunction · 0.64