Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/cli/src/commands/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
export * from "./login.js"
export * from "./logout.js"
export * from "./status.js"
export * from "./openai-codex-login.js"
export * from "./openai-codex-logout.js"
export * from "./openai-codex-status.js"
9 changes: 9 additions & 0 deletions apps/cli/src/commands/auth/openai-codex-login.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {
loginOpenAiCodex,
type OpenAiCodexLoginOptions,
type OpenAiCodexLoginResult,
} from "@/lib/auth/openai-codex-oauth.js"

export async function openaiCodexLogin(options: OpenAiCodexLoginOptions = {}): Promise<OpenAiCodexLoginResult> {
return loginOpenAiCodex(options)
}
6 changes: 6 additions & 0 deletions apps/cli/src/commands/auth/openai-codex-logout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { logoutOpenAiCodex } from "@/lib/auth/openai-codex-oauth.js"

export async function openaiCodexLogout(): Promise<void> {
await logoutOpenAiCodex()
console.log("✓ Successfully logged out of OpenAI Codex")
}
17 changes: 17 additions & 0 deletions apps/cli/src/commands/auth/openai-codex-status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { isAuthenticatedOpenAiCodex } from "@/lib/auth/openai-codex-oauth.js"
import { loadOpenAiCodexCredentials } from "@/lib/storage/openai-codex-credentials.js"

export async function openaiCodexStatus(): Promise<void> {
const authenticated = await isAuthenticatedOpenAiCodex()

if (authenticated) {
const credentials = await loadOpenAiCodexCredentials()
console.log("✓ Authenticated with OpenAI Codex")
if (credentials?.email) {
console.log(` Email: ${credentials.email}`)
}
} else {
console.log("✗ Not authenticated with OpenAI Codex")
console.log(" Run 'roo-code auth openai-codex:login' to authenticate")
}
}
27 changes: 26 additions & 1 deletion apps/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Command } from "commander"

import { DEFAULT_FLAGS } from "@/types/constants.js"
import { VERSION } from "@/lib/utils/version.js"
import { run, login, logout, status } from "@/commands/index.js"
import { run, login, logout, status, openaiCodexLogin, openaiCodexLogout, openaiCodexStatus } from "@/commands/index.js"

const program = new Command()

Expand Down Expand Up @@ -62,4 +62,29 @@ authCommand
process.exit(result.authenticated ? 0 : 1)
})

authCommand
.command("openai-codex:login")
.description("Authenticate with OpenAI Codex (ChatGPT Plus/Pro)")
.option("-v, --verbose", "Enable verbose output", false)
.action(async (options: { verbose: boolean }) => {
const result = await openaiCodexLogin({ verbose: options.verbose })
process.exit(result.success ? 0 : 1)
})

authCommand
.command("openai-codex:logout")
.description("Log out from OpenAI Codex")
.action(async () => {
await openaiCodexLogout()
process.exit(0)
})

authCommand
.command("openai-codex:status")
.description("Show OpenAI Codex authentication status")
.action(async () => {
await openaiCodexStatus()
process.exit(0)
})

program.parse()
Loading
Loading