MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / initializeApp

Function initializeApp

cli/src/init/init-app.ts:16–52  ·  view source on GitHub ↗
(params: { cwd?: string })

Source from the content-addressed store, hash-verified

14import { initializeDirenv } from './init-direnv'
15
16export async function initializeApp(params: { cwd?: string }): Promise<void> {
17 if (params.cwd) {
18 process.chdir(params.cwd)
19 }
20 const baseCwd = process.cwd()
21 setProjectRoot(baseCwd)
22
23 // Initialize analytics before direnv, because direnv uses the logger
24 // which calls trackEvent — analytics must be ready first.
25 try {
26 initAnalytics()
27 } catch (error) {
28 console.debug('Failed to initialize analytics:', error)
29 }
30
31 // Initialize direnv environment before anything else
32 initializeDirenv()
33
34 enableMapSet()
35 initializeThemeStore()
36 enableManualThemeRefresh()
37 initTimestampFormatter()
38
39 // Compute the hardware-based fingerprint in the background so it's ready
40 // by the time the user finishes reading the login prompt.
41 void getFingerprintId()
42
43 // Refresh ChatGPT OAuth credentials in the background if they exist
44 if (CHATGPT_OAUTH_ENABLED) {
45 const chatGptCredentials = getChatGptOAuthCredentials()
46 if (chatGptCredentials) {
47 getValidChatGptOAuthCredentials().catch(() => {
48 // Best-effort background refresh.
49 })
50 }
51 }
52}

Callers 1

mainFunction · 0.90

Calls 9

setProjectRootFunction · 0.90
initAnalyticsFunction · 0.90
initializeDirenvFunction · 0.90
initializeThemeStoreFunction · 0.90
enableManualThemeRefreshFunction · 0.90
initTimestampFormatterFunction · 0.90
getFingerprintIdFunction · 0.90

Tested by

no test coverage detected