/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { Box, Text } from 'ink'; import { type Extension, performWorkspaceExtensionMigration, } from '../../config/extension.js'; import { RadioButtonSelect } from './shared/RadioButtonSelect.js'; import { theme } from '../semantic-colors.js'; import { useState } from 'react'; import { useKeypress } from '../hooks/useKeypress.js'; export function WorkspaceMigrationDialog(props: { workspaceExtensions: Extension[]; onOpen: () => void; onClose: () => void; }) { const { workspaceExtensions, onOpen, onClose } = props; const [migrationComplete, setMigrationComplete] = useState(false); const [failedExtensions, setFailedExtensions] = useState([]); onOpen(); const onMigrate = async () => { const failed = await performWorkspaceExtensionMigration( workspaceExtensions, // We aren't updating extensions, just moving them around, don't need to ask for consent. async (_) => true, ); setFailedExtensions(failed); setMigrationComplete(true); }; useKeypress( (key) => { if (migrationComplete && key.sequence === 'q') { process.exit(0); } }, { isActive: true }, ); if (migrationComplete) { return ( {failedExtensions.length > 0 ? ( <> The following extensions failed to migrate. Please try installing them manually. To see other changes, Qwen Code must be restarted. Press 'q' to quit. {failedExtensions.map((failed) => ( - {failed} ))} ) : ( Migration complete. To see changes, Qwen Code must be restarted. Press 'q' to quit. )} ); } return ( Workspace-level extensions are deprecated{'\n'} Would you like to install them at the user level? The extension definition will remain in your workspace directory. If you opt to skip, you can install them manually using the extensions install command. {workspaceExtensions.map((extension) => ( - {extension.config.name} ))} { if (value === 'migrate') { onMigrate(); } else { onClose(); } }} /> ); }