MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / resolveLaunchSelection

Function resolveLaunchSelection

internal/cli/launch.go:138–161  ·  view source on GitHub ↗

resolveLaunchSelection produces the concrete tool/endpoint/model triple by either invoking the interactive wizard (TTY + any field unpinned) or by auto-resolving from the SQLite provider store (non-TTY).

(
	out io.Writer,
	stderr io.Writer,
	file providers.File,
	registry *tools.Registry,
	pinned launchSelection,
)

Source from the content-addressed store, hash-verified

136// triple by either invoking the interactive wizard (TTY + any field
137// unpinned) or by auto-resolving from the SQLite provider store (non-TTY).
138func resolveLaunchSelection(
139 out io.Writer,
140 stderr io.Writer,
141 file providers.File,
142 registry *tools.Registry,
143 pinned launchSelection,
144) (launchSelection, bool, error) {
145 in := wizardInput{
146 Pinned: pinned,
147 Providers: file,
148 Registry: registry,
149 ResolveModels: func(ep providers.Endpoint, epName string) ([]string, error) {
150 return providers.ResolveModels(ep, epName, cacheTTLFromCommon(file.Common), "", os.Getenv)
151 },
152 }
153
154 if outIsTTY(out) && (pinned.Tool.Name == "" || pinned.EndpointName == "" || pinned.Model == "") {
155 return runLaunchWizard(out, in)
156 }
157
158 // Non-TTY (or fully pinned): auto-resolve any missing pieces.
159 sel, err := autoResolve(in, stderr)
160 return sel, false, err
161}
162
163// outIsTTY reports whether the provided writer is a *os.File backed by
164// a terminal. Tests pass *bytes.Buffer, which returns false; the live

Callers 2

applyCommandMethod · 0.85
launchCommandMethod · 0.85

Calls 5

ResolveModelsFunction · 0.92
cacheTTLFromCommonFunction · 0.85
outIsTTYFunction · 0.85
runLaunchWizardFunction · 0.85
autoResolveFunction · 0.85

Tested by

no test coverage detected