MCPcopy
hub / github.com/codeaashu/claude-code / showSetupScreens

Function showSetupScreens

src/interactiveHelpers.tsx:104–298  ·  view source on GitHub ↗
(root: Root, permissionMode: PermissionMode, allowDangerouslySkipPermissions: boolean, commands?: Command[], claudeInChrome?: boolean, devChannels?: ChannelEntry[])

Source from the content-addressed store, hash-verified

102 await gracefulShutdown(0);
103}
104export async function showSetupScreens(root: Root, permissionMode: PermissionMode, allowDangerouslySkipPermissions: boolean, commands?: Command[], claudeInChrome?: boolean, devChannels?: ChannelEntry[]): Promise<boolean> {
105 if ("production" === 'test' || isEnvTruthy(false) || process.env.IS_DEMO // Skip onboarding in demo mode
106 ) {
107 return false;
108 }
109 const config = getGlobalConfig();
110 let onboardingShown = false;
111 if (!config.theme || !config.hasCompletedOnboarding // always show onboarding at least once
112 ) {
113 onboardingShown = true;
114 const {
115 Onboarding
116 } = await import('./components/Onboarding.js');
117 await showSetupDialog(root, done => <Onboarding onDone={() => {
118 completeOnboarding();
119 void done();
120 }} />, {
121 onChangeAppState
122 });
123 }
124
125 // Always show the trust dialog in interactive sessions, regardless of permission mode.
126 // The trust dialog is the workspace trust boundary — it warns about untrusted repos
127 // and checks CLAUDE.md external includes. bypassPermissions mode
128 // only affects tool execution permissions, not workspace trust.
129 // Note: non-interactive sessions (CI/CD with -p) never reach showSetupScreens at all.
130 // Skip permission checks in claubbit
131 if (!isEnvTruthy(process.env.CLAUBBIT)) {
132 // Fast-path: skip TrustDialog import+render when CWD is already trusted.
133 // If it returns true, the TrustDialog would auto-resolve regardless of
134 // security features, so we can skip the dynamic import and render cycle.
135 if (!checkHasTrustDialogAccepted()) {
136 const {
137 TrustDialog
138 } = await import('./components/TrustDialog/TrustDialog.js');
139 await showSetupDialog(root, done => <TrustDialog commands={commands} onDone={done} />);
140 }
141
142 // Signal that trust has been verified for this session.
143 // GrowthBook checks this to decide whether to include auth headers.
144 setSessionTrustAccepted(true);
145
146 // Reset and reinitialize GrowthBook after trust is established.
147 // Defense for login/logout: clears any prior client so the next init
148 // picks up fresh auth headers.
149 resetGrowthBook();
150 void initializeGrowthBook();
151
152 // Now that trust is established, prefetch system context if it wasn't already
153 void getSystemContext();
154
155 // If settings are valid, check for any mcp.json servers that need approval
156 const {
157 errors: allErrors
158 } = getSettingsWithAllErrors();
159 if (allErrors.length === 0) {
160 await handleMcpjsonServerApprovals(root);
161 }

Callers 1

runFunction · 0.85

Calls 15

isEnvTruthyFunction · 0.85
getGlobalConfigFunction · 0.85
showSetupDialogFunction · 0.85
completeOnboardingFunction · 0.85
setSessionTrustAcceptedFunction · 0.85
resetGrowthBookFunction · 0.85
getSettingsWithAllErrorsFunction · 0.85

Tested by

no test coverage detected