MCPcopy Index your code
hub / github.com/codehamr/codehamr / reloadConfigFromDisk

Method reloadConfigFromDisk

internal/tui/slash.go:107–126  ·  view source on GitHub ↗

reloadConfigFromDisk re-runs config.Bootstrap and replaces m.cfg so hand-edits to config.yaml between slash commands take effect immediately. URLOverride (from CODEHAMR_URL) is carried across the swap so the env var keeps applying. Returns the Bootstrap error verbatim; callers decide whether to sur

()

Source from the content-addressed store, hash-verified

105// Rebuilds the llm.Client when the active profile's resolved (URL, model, key)
106// triple changed: covers both within-profile edits and a moved active.
107func (m *Model) reloadConfigFromDisk() error {
108 projectRoot := filepath.Dir(m.cfg.Dir)
109 fresh, _, err := config.Bootstrap(projectRoot)
110 if err != nil {
111 return err
112 }
113 fresh.URLOverride = m.cfg.URLOverride
114
115 prevURL := m.cfg.ActiveURL()
116 prevProfile := m.cfg.ActiveProfile()
117 prevLLM, prevKey := prevProfile.LLM, prevProfile.ResolvedKey()
118
119 m.cfg = fresh
120
121 newProfile := m.cfg.ActiveProfile()
122 if prevURL != m.cfg.ActiveURL() || prevLLM != newProfile.LLM || prevKey != newProfile.ResolvedKey() {
123 m.rebuildClient()
124 }
125 return nil
126}
127
128// PrintHelp writes the canonical human-readable command list. Used by --help.
129func PrintHelp(out io.Writer) {

Callers 2

runSlashMethod · 0.95
refreshSuggestMethod · 0.95

Calls 5

rebuildClientMethod · 0.95
BootstrapFunction · 0.92
ActiveURLMethod · 0.80
ActiveProfileMethod · 0.80
ResolvedKeyMethod · 0.80

Tested by

no test coverage detected