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

Function newProviderWizardModel

internal/cli/provider_wizard.go:71–191  ·  view source on GitHub ↗

newProviderWizardModel constructs the wizard. For update mode, pass the existing endpoint and name. existingNames is used for duplicate checking on add.

(
	mode wizardMode,
	existing *providers.Endpoint,
	existingName string,
	existingNamesList []string,
)

Source from the content-addressed store, hash-verified

69// existing endpoint and name. existingNames is used for duplicate checking
70// on add.
71func newProviderWizardModel(
72 mode wizardMode,
73 existing *providers.Endpoint,
74 existingName string,
75 existingNamesList []string,
76) providerWizardModel {
77 m := providerWizardModel{
78 mode: mode,
79 existingName: existingName,
80 }
81
82 m.existingNames = map[string]bool{}
83 for _, n := range existingNamesList {
84 m.existingNames[n] = true
85 }
86
87 var ep providers.Endpoint
88 if existing != nil {
89 ep = *existing
90 }
91
92 m.nameStep = newTextInputStep(
93 "Provider Name",
94 "Name:",
95 "",
96 true,
97 "Enter a unique name for this provider. Press Enter to continue, Esc to cancel.",
98 )
99
100 m.endpointStep = newTextInputStep(
101 "Endpoint URL",
102 "URL:",
103 ep.Endpoint,
104 true,
105 "The base URL for this provider's API. Press Enter to continue, Esc to go back.",
106 )
107
108 m.apiKeyEnvStep = newTextInputStep(
109 "API Key Environment Variable",
110 "Env var:",
111 ep.APIKeyEnv,
112 false,
113 "Name of the env var holding the API key (leave empty to skip). Enter to continue, Esc back.",
114 )
115
116 m.clientsStep = newTextInputStep(
117 "Supported Clients",
118 "Clients:",
119 ep.SupportedClient,
120 false,
121 "Comma-separated client names (e.g. claude,aider,codex). Enter to continue, Esc back.",
122 )
123
124 modelsPlaceholder := strings.Join(ep.Models, ",")
125 m.modelsStep = newTextInputStep(
126 "Models",
127 "Models:",
128 modelsPlaceholder,

Calls 3

IsEnabledMethod · 0.95
newTextInputStepFunction · 0.85
newPickerStepFunction · 0.85