({
entries,
onConfirm,
onCancel,
}: McpMigrationPickerProps)
| 24 | * real `applyMigration` and reports the skipped count from conflicts. |
| 25 | */ |
| 26 | export function McpMigrationPicker({ |
| 27 | entries, |
| 28 | onConfirm, |
| 29 | onCancel, |
| 30 | }: McpMigrationPickerProps) { |
| 31 | const [selected, setSelected] = useState(0); |
| 32 | const [checked, setChecked] = useState<Set<string>>( |
| 33 | () => new Set(entries.map((e) => e.key)), |
| 34 | ); |
| 35 | |
| 36 | useInput((input, key) => { |
| 37 | if (key.escape) { |
| 38 | onCancel(); |
| 39 | return; |
| 40 | } |
| 41 | if (key.upArrow) { |
| 42 | setSelected((s) => (s - 1 + entries.length) % entries.length); |
| 43 | return; |
| 44 | } |
| 45 | if (key.downArrow || key.tab) { |
| 46 | setSelected((s) => (s + 1) % entries.length); |
| 47 | return; |
| 48 | } |
| 49 | if (key.return) { |
| 50 | const picked: MigrationEntry[] = []; |
| 51 | for (const entry of entries) { |
| 52 | if (checked.has(entry.key)) picked.push(entry); |
| 53 | } |
| 54 | onConfirm(picked); |
| 55 | return; |
| 56 | } |
| 57 | if (input === " ") { |
| 58 | const entry = entries[selected]; |
| 59 | if (!entry) return; |
| 60 | setChecked((prev) => { |
| 61 | const next = new Set(prev); |
| 62 | if (next.has(entry.key)) next.delete(entry.key); |
| 63 | else next.add(entry.key); |
| 64 | return next; |
| 65 | }); |
| 66 | } |
| 67 | }); |
| 68 | |
| 69 | if (entries.length === 0) { |
| 70 | return ( |
| 71 | <Box |
| 72 | flexDirection="column" |
| 73 | borderStyle="round" |
| 74 | borderColor={COLORS.primary} |
| 75 | paddingX={1} |
| 76 | > |
| 77 | <Text bold color={COLORS.primary}> |
| 78 | Migrate MCP servers |
| 79 | </Text> |
| 80 | <Text dimColor>No MCP servers found on this machine to migrate.</Text> |
| 81 | <Text dimColor> |
| 82 | Install Claude Code or Claude Desktop, or add servers with `orbcode |
| 83 | mcp add`. |
nothing calls this directly
no test coverage detected