Skip to content

Commit d04ca99

Browse files
committed
Refresh claude oauth on init
1 parent 1c8e260 commit d04ca99

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

cli/src/init/init-app.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import { enableMapSet } from 'immer'
22

3+
import {
4+
getClaudeOAuthCredentials,
5+
getValidClaudeOAuthCredentials,
6+
} from '@codebuff/sdk'
7+
38
import { initializeThemeStore } from '../hooks/use-theme'
49
import { setProjectRoot } from '../project-files'
510
import { initTimestampFormatter } from '../utils/helpers'
611
import { enableManualThemeRefresh } from '../utils/theme-system'
712

8-
export async function initializeApp(params: {
9-
cwd?: string
10-
}): Promise<void> {
13+
export async function initializeApp(params: { cwd?: string }): Promise<void> {
1114
if (params.cwd) {
1215
process.chdir(params.cwd)
1316
}
@@ -18,4 +21,13 @@ export async function initializeApp(params: {
1821
initializeThemeStore()
1922
enableManualThemeRefresh()
2023
initTimestampFormatter()
24+
25+
// Refresh Claude OAuth credentials in the background if they exist
26+
// This ensures the subscription status is up-to-date on startup
27+
const claudeCredentials = getClaudeOAuthCredentials()
28+
if (claudeCredentials) {
29+
void getValidClaudeOAuthCredentials().catch(() => {
30+
// Silently ignore refresh errors - will be retried on next API call
31+
})
32+
}
2133
}

0 commit comments

Comments
 (0)