MCPcopy
hub / github.com/upstash/context7 / resolveCliAuth

Function resolveCliAuth

packages/cli/src/commands/setup.ts:170–186  ·  view source on GitHub ↗
(apiKey?: string)

Source from the content-addressed store, hash-verified

168}
169
170async function resolveCliAuth(apiKey?: string): Promise<void> {
171 if (apiKey) {
172 saveTokens({ access_token: apiKey, token_type: "bearer" });
173 log.blank();
174 log.plain(`${pc.green("✔")} Authenticated`);
175 return;
176 }
177
178 const validToken = await getValidAccessToken();
179 if (validToken) {
180 log.blank();
181 log.plain(`${pc.green("✔")} Authenticated`);
182 return;
183 }
184
185 await performLogin();
186}
187
188async function promptAgents(): Promise<SetupAgent[] | null> {
189 const choices = ALL_AGENT_NAMES.map((name) => ({

Callers 1

setupCliFunction · 0.85

Calls 3

saveTokensFunction · 0.85
getValidAccessTokenFunction · 0.85
performLoginFunction · 0.85

Tested by

no test coverage detected