Skip to content

Commit fbecf8e

Browse files
committed
Remove unused claude oauth
1 parent 4933404 commit fbecf8e

26 files changed

Lines changed: 87 additions & 3006 deletions

cli/src/commands/command-registry.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { CHATGPT_OAUTH_ENABLED } from '@codebuff/common/constants/chatgpt-oauth'
2-
import { CLAUDE_OAUTH_ENABLED } from '@codebuff/common/constants/claude-oauth'
32
import { safeOpen } from '../utils/open-url'
43

54
import { handleAdsEnable, handleAdsDisable } from './ads'
@@ -173,7 +172,6 @@ const FREEBUFF_REMOVED_COMMANDS = new Set([
173172
'image',
174173
'publish',
175174
'gpt-5-agent',
176-
'connect:claude',
177175
])
178176

179177
const FREEBUFF_ONLY_COMMANDS = new Set([
@@ -454,27 +452,6 @@ const ALL_COMMANDS: CommandDefinition[] = [
454452
// Don't save to history - this is just a UI shortcut
455453
},
456454
}),
457-
defineCommand({
458-
name: 'connect:claude',
459-
aliases: ['claude'],
460-
handler: (params) => {
461-
if (!CLAUDE_OAUTH_ENABLED) {
462-
params.setMessages((prev) => [
463-
...prev,
464-
getUserMessage(params.inputValue.trim()),
465-
getSystemMessage(
466-
'Claude OAuth connection has been disabled. Use /subscribe for usage across all models.',
467-
),
468-
])
469-
clearInput(params)
470-
return
471-
}
472-
// Enter connect:claude mode to show the OAuth banner
473-
useChatStore.getState().setInputMode('connect:claude')
474-
params.saveToHistory(params.inputValue.trim())
475-
clearInput(params)
476-
},
477-
}),
478455
...(CHATGPT_OAUTH_ENABLED
479456
? [
480457
defineCommand({

cli/src/commands/router.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { AnalyticsEvent } from '@codebuff/common/constants/analytics-events'
22
import { CHATGPT_OAUTH_ENABLED } from '@codebuff/common/constants/chatgpt-oauth'
3-
import { CLAUDE_OAUTH_ENABLED } from '@codebuff/common/constants/claude-oauth'
43
import { runTerminalCommand } from '@codebuff/sdk'
54

65

@@ -13,7 +12,6 @@ import {
1312
isSlashCommand,
1413
parseCommandInput,
1514
} from './router-utils'
16-
import { handleClaudeAuthCode } from '../components/claude-connect-banner'
1715
import { handleChatGptAuthCode } from '../components/chatgpt-connect-banner'
1816
import { buildInterviewPrompt, buildPlanPrompt, buildReviewPrompt } from './prompt-builders'
1917
import { getProjectRoot } from '../project-files'
@@ -388,27 +386,7 @@ export async function routeUserPrompt(
388386
return
389387
}
390388

391-
// Handle connect:claude mode input (authorization code)
392-
if (inputMode === 'connect:claude') {
393-
if (!CLAUDE_OAUTH_ENABLED) {
394-
setInputMode('default')
395-
return
396-
}
397-
const code = trimmed
398-
if (code) {
399-
const result = await handleClaudeAuthCode(code)
400-
setMessages((prev) => [
401-
...prev,
402-
getUserMessage(trimmed),
403-
getSystemMessage(result.message),
404-
])
405-
}
406-
saveToHistory(trimmed)
407-
setInputValue({ text: '', cursorPosition: 0, lastEditDueToNav: false })
408-
setInputMode('default')
409-
return
410-
}
411-
389+
// Handle connect:chatgpt mode input (authorization code)
412390
if (inputMode === 'connect:chatgpt') {
413391
if (!CHATGPT_OAUTH_ENABLED) {
414392
setInputMode('default')

cli/src/components/claude-connect-banner.tsx

Lines changed: 0 additions & 188 deletions
This file was deleted.

cli/src/components/input-mode-banner.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { CHATGPT_OAUTH_ENABLED } from '@codebuff/common/constants/chatgpt-oauth'
2-
import { CLAUDE_OAUTH_ENABLED } from '@codebuff/common/constants/claude-oauth'
32
import React from 'react'
43
import { IS_FREEBUFF } from '../utils/constants'
54

65
import { ChatGptConnectBanner } from './chatgpt-connect-banner'
7-
import { ClaudeConnectBanner } from './claude-connect-banner'
86
import { HelpBanner } from './help-banner'
97
import { PendingAttachmentsBanner } from './pending-attachments-banner'
108
import { SubscriptionLimitBanner } from './subscription-limit-banner'
@@ -28,9 +26,6 @@ const BANNER_REGISTRY: Record<
2826
image: () => <PendingAttachmentsBanner />,
2927
...(IS_FREEBUFF ? {} : { usage: ({ showTime }: { showTime: number }) => <UsageBanner showTime={showTime} /> }),
3028
help: () => <HelpBanner />,
31-
...(CLAUDE_OAUTH_ENABLED && !IS_FREEBUFF
32-
? { 'connect:claude': () => <ClaudeConnectBanner /> }
33-
: {}),
3429
...(IS_FREEBUFF ? {} : { subscriptionLimit: () => <SubscriptionLimitBanner /> }),
3530
...(CHATGPT_OAUTH_ENABLED
3631
? { 'connect:chatgpt': () => <ChatGptConnectBanner /> }

cli/src/components/usage-banner.tsx

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { CHATGPT_OAUTH_ENABLED } from '@codebuff/common/constants/chatgpt-oauth'
2-
import { CLAUDE_OAUTH_ENABLED } from '@codebuff/common/constants/claude-oauth'
32
import { IS_FREEBUFF } from '../utils/constants'
4-
import { isChatGptOAuthValid, isClaudeOAuthValid } from '@codebuff/sdk'
3+
import { isChatGptOAuthValid } from '@codebuff/sdk'
54
import { TextAttributes } from '@opentui/core'
65
import { safeOpen } from '../utils/open-url'
76
import React, { useEffect, useMemo } from 'react'
@@ -10,7 +9,6 @@ import { BottomBanner } from './bottom-banner'
109
import { Button } from './button'
1110
import { ProgressBar } from './progress-bar'
1211
import { getActivityQueryData } from '../hooks/use-activity-query'
13-
import { useClaudeQuotaQuery } from '../hooks/use-claude-quota-query'
1412
import { useSubscriptionQuery } from '../hooks/use-subscription-query'
1513
import { useTheme } from '../hooks/use-theme'
1614
import { useUpdatePreference } from '../hooks/use-update-preference'
@@ -52,16 +50,9 @@ export const UsageBanner = ({ showTime }: { showTime: number }) => {
5250
const sessionCreditsUsed = useChatStore((state) => state.sessionCreditsUsed)
5351
const setInputMode = useChatStore((state) => state.setInputMode)
5452

55-
// Check if Claude OAuth is connected (only when feature is enabled)
56-
const isClaudeConnected = CLAUDE_OAUTH_ENABLED && isClaudeOAuthValid()
53+
// Check if ChatGPT OAuth is connected
5754
const isChatGptConnected = CHATGPT_OAUTH_ENABLED && isChatGptOAuthValid()
5855

59-
// Fetch Claude quota data if connected
60-
const { data: claudeQuota, isLoading: isClaudeLoading } = useClaudeQuotaQuery({
61-
enabled: isClaudeConnected,
62-
refetchInterval: 30 * 1000, // Refresh every 30 seconds when banner is open
63-
})
64-
6556
// Fetch subscription data
6657
const { data: subscriptionData, isLoading: isSubscriptionLoading } = useSubscriptionQuery({
6758
refetchInterval: 30 * 1000,
@@ -164,40 +155,6 @@ export const UsageBanner = ({ showTime }: { showTime: number }) => {
164155
</box>
165156
</Button>
166157

167-
{/* Claude subscription section - only show if connected */}
168-
{isClaudeConnected && (
169-
<box style={{ flexDirection: 'column', marginTop: 1 }}>
170-
<text style={{ fg: theme.muted }}>Claude subscription</text>
171-
{isClaudeLoading ? (
172-
<text style={{ fg: theme.muted }}>Loading quota...</text>
173-
) : claudeQuota ? (
174-
<box style={{ flexDirection: 'column', gap: 0 }}>
175-
<box style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>
176-
<text style={{ fg: theme.muted }}>5-hour:</text>
177-
<ProgressBar value={claudeQuota.fiveHourRemaining} width={15} />
178-
{claudeQuota.fiveHourResetsAt && (
179-
<text style={{ fg: theme.muted }}>
180-
(resets in {formatResetTime(claudeQuota.fiveHourResetsAt)})
181-
</text>
182-
)}
183-
</box>
184-
{/* Only show 7-day bar if the user has a 7-day limit */}
185-
{claudeQuota.sevenDayResetsAt && (
186-
<box style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>
187-
<text style={{ fg: theme.muted }}>7-day: </text>
188-
<ProgressBar value={claudeQuota.sevenDayRemaining} width={15} />
189-
<text style={{ fg: theme.muted }}>
190-
(resets in {formatResetTime(claudeQuota.sevenDayResetsAt)})
191-
</text>
192-
</box>
193-
)}
194-
</box>
195-
) : (
196-
<text style={{ fg: theme.muted }}>Unable to fetch quota</text>
197-
)}
198-
</box>
199-
)}
200-
201158
{isChatGptConnected && (
202159
<box style={{ flexDirection: 'column', marginTop: 1 }}>
203160
<text style={{ fg: theme.muted }}>ChatGPT subscription</text>

0 commit comments

Comments
 (0)