single logout implementation

This commit is contained in:
Nate 2025-07-23 09:56:42 -07:00
parent e933c56f7c
commit 4f8e529d84
3 changed files with 17 additions and 17 deletions

View file

@ -596,6 +596,17 @@ export async function hasMultipleOrganizations(): Promise<boolean> {
* 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(

View file

@ -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();
}

View file

@ -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 <url>", "Connect directly to the specified URL instead of creating a new remote environment")
.option(
"--url <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);
}
}