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

Function setupTokenHandler

src/cli/handlers/util.tsx:20–50  ·  view source on GitHub ↗
(root: Root)

Source from the content-addressed store, hash-verified

18import { onChangeAppState } from '../../state/onChangeAppState.js';
19import { isAnthropicAuthEnabled } from '../../utils/auth.js';
20export async function setupTokenHandler(root: Root): Promise<void> {
21 logEvent('tengu_setup_token_command', {});
22 const showAuthWarning = !isAnthropicAuthEnabled();
23 const {
24 ConsoleOAuthFlow
25 } = await import('../../components/ConsoleOAuthFlow.js');
26 await new Promise<void>(resolve => {
27 root.render(<AppStateProvider onChangeAppState={onChangeAppState}>
28 <KeybindingSetup>
29 <Box flexDirection="column" gap={1}>
30 <WelcomeV2 />
31 {showAuthWarning && <Box flexDirection="column">
32 <Text color="warning">
33 Warning: You already have authentication configured via
34 environment variable or API key helper.
35 </Text>
36 <Text color="warning">
37 The setup-token command will create a new OAuth token which
38 you can use instead.
39 </Text>
40 </Box>}
41 <ConsoleOAuthFlow onDone={() => {
42 void resolve();
43 }} mode="setup-token" startingMessage="This will guide you through long-lived (1-year) auth token setup for your Claude account. Claude subscription required." />
44 </Box>
45 </KeybindingSetup>
46 </AppStateProvider>);
47 });
48 root.unmount();
49 process.exit(0);
50}
51
52// DoctorWithPlugins wrapper + doctor handler
53const DoctorLazy = React.lazy(() => import('../../screens/Doctor.js').then(m => ({

Callers 1

runFunction · 0.85

Calls 5

logEventFunction · 0.85
isAnthropicAuthEnabledFunction · 0.85
unmountMethod · 0.80
resolveFunction · 0.50
renderMethod · 0.45

Tested by

no test coverage detected