9.3 KiB
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | must_haves | |||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 38-telegram-bridge | 03 | execute | 1 |
|
true |
|
|
Purpose: Makes Telegram bridge setup accessible to non-technical users during first-run onboarding.
Output: TelegramStep.tsx component, updated NexusOnboardingWizard.tsx
<execution_context> @$HOME/.claude/get-shit-done/workflows/execute-plan.md @$HOME/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/phases/38-telegram-bridge/38-CONTEXT.md @.planning/phases/38-telegram-bridge/38-RESEARCH.md @.planning/REQUIREMENTS.mdFrom ui/src/components/NexusOnboardingWizard.tsx:
// Current 6-step flow:
// Step 1: Hardware detection (HardwareSummaryStep)
// Step 2: Mode selection
// Step 3: Provider selection (ProviderSelectionStep)
// Step 4: Voice (VoiceStep)
// Step 5: Root directory
// Step 6: Summary (OnboardingSummaryStep)
//
// Step indicator shows "Step N of 5" (summary is step 6 but not counted)
// Each step has Next/Back/Skip buttons using <Button> from @/components/ui/button
From ui/src/components/onboarding/VoiceStep.tsx (pattern reference):
// VoiceStep receives props for onNext, onBack, onSkip
// Uses same Button/Input/cn imports as other steps
Token validation endpoint (from Plan 01):
// POST /api/telegram/token { token: string }
// Returns: { ok: true, botUsername: string } on success
// Returns: 400 { error: string } on invalid token
Task 1: Create TelegramStep onboarding component
ui/src/components/onboarding/TelegramStep.tsx
- ui/src/components/onboarding/VoiceStep.tsx (pattern reference for step component structure, props, styling)
- ui/src/components/onboarding/HardwareSummaryStep.tsx (alternative pattern reference)
- ui/src/components/ui/button.tsx (Button component API)
- ui/src/components/ui/input.tsx (Input component API)
Create `ui/src/components/onboarding/TelegramStep.tsx`:
-
Props interface:
{ onNext: () => void; onBack: () => void; }— match the pattern from VoiceStep or HardwareSummaryStep. -
State:
token: string— the bot token inputvalidating: boolean— loading state during validationbotUsername: string | null— set after successful validationerror: string | null— validation error message
-
handleValidatefunction:- POST to
/api/telegram/tokenwith{ token }body - On success: set
botUsernamefrom response, clear error - On failure: set error from response or generic "Invalid token"
- Always clear
validatingin finally block
- POST to
-
Render structure (follow existing step styling patterns):
- Title: "Telegram Bridge" or "Connect Telegram" with a brief subtitle
- BotFather instructions section — numbered steps:
- "Open Telegram and search for @BotFather"
- "Send /newbot and follow the prompts to create a bot"
- "Copy the bot token (looks like 123456:ABC-DEF...)"
- "Paste the token below"
- Token input field:
<Input type="text" placeholder="Paste bot token here" value={token} onChange={...} /> - Validate button:
<Button onClick={handleValidate} disabled={!token.trim() || validating}>Validate Token</Button> - Success state: when
botUsernameis set, show green checkmark/text: "Connected to @{botUsername}" and enable Next button - Error state: show red error text below input
- Navigation buttons: Back (always), Skip (always, calls onNext without saving), Next/Continue (enabled only when botUsername is set, calls onNext)
-
Style with Tailwind classes matching existing onboarding steps — use
cn()from../lib/utilsfor conditional classes. Look at VoiceStep for the exact layout pattern (padding, spacing, button alignment). cd /opt/nexus/.claude/worktrees/agent-a61d32dc && pnpm --filter @paperclipai/ui exec tsc --noEmit 2>&1 | head -30 <acceptance_criteria>- grep -q "export.*TelegramStep|export function TelegramStep" ui/src/components/onboarding/TelegramStep.tsx
- grep -q "telegram/token" ui/src/components/onboarding/TelegramStep.tsx
- grep -q "botUsername|bot_username" ui/src/components/onboarding/TelegramStep.tsx
- grep -q "BotFather|@BotFather" ui/src/components/onboarding/TelegramStep.tsx
- grep -q "onNext|onBack" ui/src/components/onboarding/TelegramStep.tsx
- grep -q "Skip" ui/src/components/onboarding/TelegramStep.tsx </acceptance_criteria> TelegramStep component exists with BotFather instructions, token input, live validation via POST /api/telegram/token, success/error states, and Skip/Back/Next navigation.
-
Add import:
import { TelegramStep } from "./onboarding/TelegramStep"; -
Update step comment to reflect 7-step flow:
// Step 1: hardware detection, 2: mode selection, 3: provider selection, 4: voice, 5: telegram, 6: root directory, 7: summary -
Update step indicator text:
- Change
"Step ${step} of 5"to"Step ${step} of 6"(telegram is now step 5, summary at 7 doesn't count) - Change
step === 6 ? "Summary"tostep === 7 ? "Summary"
- Change
-
Insert Telegram step block between step 4 (Voice) and what was step 5 (Root directory):
{step === 5 && ( <TelegramStep onNext={() => setStep(6)} onBack={() => setStep(4)} /> )} -
Shift existing step numbers:
- What was
step === 5(root directory) becomesstep === 6 - What was
step === 6(summary) becomesstep === 7 - Update ALL
setStep(5)calls that navigate TO root directory tosetStep(6) - Update ALL
setStep(6)calls that navigate TO summary tosetStep(7) - Update the back button in root directory step from
setStep(4)tosetStep(5) - Update the back button in summary step (if any) accordingly
- What was
-
IMPORTANT: Be thorough — search for EVERY occurrence of
setStep(5)andsetStep(6)in the file and update them. Missing one will cause navigation bugs. -
Update the error message that references "step 5" for root directory — change to "step 6". cd /opt/nexus/.claude/worktrees/agent-a61d32dc && pnpm --filter @paperclipai/ui exec tsc --noEmit 2>&1 | head -30 <acceptance_criteria>
- grep -q "TelegramStep" ui/src/components/NexusOnboardingWizard.tsx
- grep -q "step === 5" ui/src/components/NexusOnboardingWizard.tsx
- grep -q "Step.*of 6" ui/src/components/NexusOnboardingWizard.tsx
- grep -q "step === 7.*Summary|step === 7" ui/src/components/NexusOnboardingWizard.tsx </acceptance_criteria> NexusOnboardingWizard has 7 steps. TelegramStep is step 5. Root directory shifted to step 6, summary to step 7. All navigation callbacks updated. TypeScript compiles clean.
<success_criteria>
- TelegramStep component renders BotFather instructions and validates token via API
- Step is skippable without blocking onboarding
- Wizard flow is now 7 steps with telegram at position 5
- TypeScript compiles without errors </success_criteria>