({
onDone
}: Props)
| 28 | onDone(): void; |
| 29 | }; |
| 30 | export function Onboarding({ |
| 31 | onDone |
| 32 | }: Props): React.ReactNode { |
| 33 | const [currentStepIndex, setCurrentStepIndex] = useState(0); |
| 34 | const [skipOAuth, setSkipOAuth] = useState(false); |
| 35 | const [oauthEnabled] = useState(() => isAnthropicAuthEnabled()); |
| 36 | const [theme, setTheme] = useTheme(); |
| 37 | useEffect(() => { |
| 38 | logEvent('tengu_began_setup', { |
| 39 | oauthEnabled |
| 40 | }); |
| 41 | }, [oauthEnabled]); |
| 42 | function goToNextStep() { |
| 43 | if (currentStepIndex < steps.length - 1) { |
| 44 | const nextIndex = currentStepIndex + 1; |
| 45 | setCurrentStepIndex(nextIndex); |
| 46 | logEvent('tengu_onboarding_step', { |
| 47 | oauthEnabled, |
| 48 | stepId: steps[nextIndex]?.id as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 49 | }); |
| 50 | } else { |
| 51 | onDone(); |
| 52 | } |
| 53 | } |
| 54 | function handleThemeSelection(newTheme: ThemeSetting) { |
| 55 | setTheme(newTheme); |
| 56 | goToNextStep(); |
| 57 | } |
| 58 | const exitState = useExitOnCtrlCDWithKeybindings(); |
| 59 | |
| 60 | // Define all onboarding steps |
| 61 | const themeStep = <Box marginX={1}> |
| 62 | <ThemePicker onThemeSelect={handleThemeSelection} showIntroText={true} helpText="To change this later, run /theme" hideEscToCancel={true} skipExitHandling={true} // Skip exit handling as Onboarding already handles it |
| 63 | /> |
| 64 | </Box>; |
| 65 | const securityStep = <Box flexDirection="column" gap={1} paddingLeft={1}> |
| 66 | <Text bold>Security notes:</Text> |
| 67 | <Box flexDirection="column" width={70}> |
| 68 | {/** |
| 69 | * OrderedList misnumbers items when rendering conditionally, |
| 70 | * so put all items in the if/else |
| 71 | */} |
| 72 | <OrderedList> |
| 73 | <OrderedList.Item> |
| 74 | <Text>Claude can make mistakes</Text> |
| 75 | <Text dimColor wrap="wrap"> |
| 76 | You should always review Claude's responses, especially when |
| 77 | <Newline /> |
| 78 | running code. |
| 79 | <Newline /> |
| 80 | </Text> |
| 81 | </OrderedList.Item> |
| 82 | <OrderedList.Item> |
| 83 | <Text> |
| 84 | Due to prompt injection risks, only use it with code you trust |
| 85 | </Text> |
| 86 | <Text dimColor wrap="wrap"> |
| 87 | For more details see: |
nothing calls this directly
no test coverage detected