MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / resolveProvider

Function resolveProvider

cmd/chief/main.go:333–354  ·  view source on GitHub ↗

resolveProvider loads config and resolves the agent provider, exiting on error.

(flagAgent, flagPath string)

Source from the content-addressed store, hash-verified

331
332// resolveProvider loads config and resolves the agent provider, exiting on error.
333func resolveProvider(flagAgent, flagPath string) loop.Provider {
334 cwd, err := os.Getwd()
335 if err != nil {
336 fmt.Fprintf(os.Stderr, "Error: %v\n", err)
337 os.Exit(1)
338 }
339 cfg, err := config.Load(cwd)
340 if err != nil {
341 fmt.Fprintf(os.Stderr, "Error: failed to load .chief/config.yaml: %v\n", err)
342 os.Exit(1)
343 }
344 provider, err := agent.Resolve(flagAgent, flagPath, cfg)
345 if err != nil {
346 fmt.Fprintf(os.Stderr, "Error: %v\n", err)
347 os.Exit(1)
348 }
349 if err := agent.CheckInstalled(provider); err != nil {
350 fmt.Fprintf(os.Stderr, "Error: %v\n", err)
351 os.Exit(1)
352 }
353 return provider
354}
355
356func runTUIWithOptions(opts *TUIOptions) {
357 provider := resolveProvider(opts.Agent, opts.AgentPath)

Callers 3

runNewFunction · 0.85
runEditFunction · 0.85
runTUIWithOptionsFunction · 0.85

Calls 3

LoadFunction · 0.92
ResolveFunction · 0.92
CheckInstalledFunction · 0.92

Tested by

no test coverage detected