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

Function loginCommand

packages/cli/src/commands/auth.ts:192–208  ·  view source on GitHub ↗
(options: { browser: boolean })

Source from the content-addressed store, hash-verified

190}
191
192async function loginCommand(options: { browser: boolean }): Promise<void> {
193 trackEvent("command", { name: "login" });
194 const existingToken = await getValidAccessToken();
195 if (existingToken) {
196 console.log(pc.yellow("You are already logged in."));
197 console.log(pc.dim("Run 'ctx7 logout' first if you want to log in with a different account."));
198 return;
199 }
200 clearTokens();
201
202 const token = await performLogin(options.browser);
203 if (!token) {
204 process.exit(1);
205 }
206 console.log("");
207 console.log(pc.dim("You can now use authenticated Context7 features."));
208}
209
210function logoutCommand(): void {
211 trackEvent("command", { name: "logout" });

Callers 1

registerAuthCommandsFunction · 0.85

Calls 4

trackEventFunction · 0.85
getValidAccessTokenFunction · 0.85
clearTokensFunction · 0.85
performLoginFunction · 0.85

Tested by

no test coverage detected