diff --git a/src/auth/workos.ts b/src/auth/workos.ts index f465c1a1b..2cfda8ea7 100644 --- a/src/auth/workos.ts +++ b/src/auth/workos.ts @@ -596,6 +596,17 @@ export async function hasMultipleOrganizations(): Promise { * Logs the user out by clearing saved credentials */ export function logout(): void { + const onboardingFlagPath = path.join( + os.homedir(), + ".continue", + ".onboarding_complete" + ); + + // Remove onboarding completion flag so user will go through onboarding again + if (fs.existsSync(onboardingFlagPath)) { + fs.unlinkSync(onboardingFlagPath); + } + if (process.env.CONTINUE_API_KEY) { console.info( chalk.yellow( diff --git a/src/commands/logout.ts b/src/commands/logout.ts index b6b40c62f..bd520191a 100644 --- a/src/commands/logout.ts +++ b/src/commands/logout.ts @@ -1,19 +1,5 @@ -import * as fs from "fs"; -import * as os from "os"; -import * as path from "path"; import { logout as workosLogout } from "../auth/workos.js"; export async function logout() { - const onboardingFlagPath = path.join( - os.homedir(), - ".continue", - ".onboarding_complete" - ); - - // Remove onboarding completion flag so user will go through onboarding again - if (fs.existsSync(onboardingFlagPath)) { - fs.unlinkSync(onboardingFlagPath); - } - workosLogout(); } diff --git a/src/index.ts b/src/index.ts index 15b553db5..89596b5ce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,8 +8,8 @@ import { remoteTest } from "./commands/remote-test.js"; import { remote } from "./commands/remote.js"; import { serve } from "./commands/serve.js"; import { configureConsoleForHeadless } from "./util/consoleOverride.js"; -import { readStdinSync } from "./util/stdin.js"; import logger from "./util/logger.js"; +import { readStdinSync } from "./util/stdin.js"; import { getVersion } from "./version.js"; // Add global error handlers to prevent uncaught errors from crashing the process @@ -105,7 +105,10 @@ program program .command("remote [prompt]") .description("Launch a remote instance of the cn agent") - .option("--url ", "Connect directly to the specified URL instead of creating a new remote environment") + .option( + "--url ", + "Connect directly to the specified URL instead of creating a new remote environment" + ) .action(async (prompt: string | undefined, options) => { await remote(prompt, options); }); @@ -164,4 +167,4 @@ try { } catch (error) { console.error(error); process.exit(1); -} \ No newline at end of file +}