From 0f031a7f89718b15405967728586c342bf037cd6 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 26 Aug 2025 00:04:53 +0200 Subject: [PATCH] Explict imports & exports with `type` modifier (#3774) --- eslint.config.js | 4 ++ packages/cli/src/commands/extensions.tsx | 2 +- .../cli/src/commands/extensions/install.ts | 4 +- packages/cli/src/commands/extensions/list.ts | 2 +- .../cli/src/commands/extensions/uninstall.ts | 2 +- .../cli/src/commands/extensions/update.ts | 2 +- packages/cli/src/commands/mcp/add.ts | 2 +- packages/cli/src/commands/mcp/list.ts | 7 +-- .../cli/src/config/config.integration.test.ts | 4 +- packages/cli/src/config/config.test.ts | 16 +++++-- packages/cli/src/config/config.ts | 13 +++--- packages/cli/src/config/extension.test.ts | 4 +- packages/cli/src/config/extension.ts | 4 +- packages/cli/src/config/keyBindings.test.ts | 7 +-- packages/cli/src/config/sandboxConfig.ts | 4 +- packages/cli/src/config/settings.ts | 2 +- .../cli/src/config/settingsSchema.test.ts | 3 +- packages/cli/src/config/settingsSchema.ts | 4 +- .../cli/src/config/trustedFolders.test.ts | 2 +- packages/cli/src/config/trustedFolders.ts | 2 +- packages/cli/src/gemini.test.tsx | 9 ++-- packages/cli/src/gemini.tsx | 10 ++--- packages/cli/src/nonInteractiveCli.test.ts | 10 +++-- packages/cli/src/nonInteractiveCli.ts | 5 +-- .../src/services/BuiltinCommandLoader.test.ts | 2 +- .../cli/src/services/BuiltinCommandLoader.ts | 6 +-- packages/cli/src/services/CommandService.ts | 4 +- .../src/services/FileCommandLoader.test.ts | 5 ++- .../cli/src/services/FileCommandLoader.ts | 11 ++--- .../cli/src/services/McpPromptLoader.test.ts | 4 +- packages/cli/src/services/McpPromptLoader.ts | 15 +++---- .../prompt-processors/argumentProcessor.ts | 4 +- .../prompt-processors/shellProcessor.test.ts | 5 ++- .../prompt-processors/shellProcessor.ts | 4 +- .../src/services/prompt-processors/types.ts | 2 +- packages/cli/src/services/types.ts | 2 +- packages/cli/src/test-utils/customMatchers.ts | 3 +- .../cli/src/test-utils/mockCommandContext.ts | 8 ++-- packages/cli/src/test-utils/render.tsx | 2 +- packages/cli/src/ui/App.test.tsx | 28 +++++++----- packages/cli/src/ui/App.tsx | 45 +++++++------------ packages/cli/src/ui/IdeIntegrationNudge.tsx | 9 ++-- packages/cli/src/ui/colors.ts | 2 +- packages/cli/src/ui/commands/aboutCommand.ts | 3 +- packages/cli/src/ui/commands/authCommand.ts | 3 +- .../cli/src/ui/commands/chatCommand.test.ts | 23 ++++------ packages/cli/src/ui/commands/chatCommand.ts | 7 +-- .../cli/src/ui/commands/clearCommand.test.ts | 6 ++- packages/cli/src/ui/commands/clearCommand.ts | 3 +- .../src/ui/commands/compressCommand.test.ts | 2 +- .../cli/src/ui/commands/compressCommand.ts | 6 ++- .../cli/src/ui/commands/copyCommand.test.ts | 3 +- packages/cli/src/ui/commands/copyCommand.ts | 7 +-- .../src/ui/commands/directoryCommand.test.tsx | 4 +- .../cli/src/ui/commands/directoryCommand.tsx | 3 +- packages/cli/src/ui/commands/helpCommand.ts | 3 +- .../cli/src/ui/commands/ideCommand.test.ts | 11 +---- packages/cli/src/ui/commands/ideCommand.ts | 12 +++-- packages/cli/src/ui/commands/initCommand.ts | 4 +- .../cli/src/ui/commands/mcpCommand.test.ts | 5 ++- packages/cli/src/ui/commands/mcpCommand.ts | 6 +-- .../cli/src/ui/commands/memoryCommand.test.ts | 7 +-- packages/cli/src/ui/commands/memoryCommand.ts | 7 +-- .../cli/src/ui/commands/privacyCommand.ts | 3 +- .../src/ui/commands/restoreCommand.test.ts | 2 +- .../cli/src/ui/commands/restoreCommand.ts | 2 +- .../cli/src/ui/commands/settingsCommand.ts | 3 +- .../ui/commands/setupGithubCommand.test.ts | 2 +- .../cli/src/ui/commands/setupGithubCommand.ts | 9 ++-- packages/cli/src/ui/commands/statsCommand.ts | 3 +- .../ui/commands/terminalSetupCommand.test.ts | 2 +- .../src/ui/commands/terminalSetupCommand.ts | 3 +- packages/cli/src/ui/commands/themeCommand.ts | 3 +- .../cli/src/ui/commands/toolsCommand.test.ts | 5 ++- packages/cli/src/ui/commands/types.ts | 13 +++--- packages/cli/src/ui/commands/vimCommand.ts | 3 +- packages/cli/src/ui/components/AboutBox.tsx | 4 +- packages/cli/src/ui/components/AuthDialog.tsx | 6 ++- .../cli/src/ui/components/AuthInProgress.tsx | 3 +- .../src/ui/components/AutoAcceptIndicator.tsx | 2 +- .../ui/components/ConsoleSummaryDisplay.tsx | 2 +- .../components/ContextSummaryDisplay.test.tsx | 2 +- .../ui/components/ContextSummaryDisplay.tsx | 2 +- .../ui/components/DetailedMessagesDisplay.tsx | 4 +- .../ui/components/EditorSettingsDialog.tsx | 9 ++-- .../src/ui/components/FolderTrustDialog.tsx | 8 ++-- packages/cli/src/ui/components/Footer.tsx | 2 +- .../ui/components/GeminiRespondingSpinner.tsx | 2 +- packages/cli/src/ui/components/Header.tsx | 2 +- packages/cli/src/ui/components/Help.tsx | 4 +- .../ui/components/HistoryItemDisplay.test.tsx | 3 +- .../src/ui/components/HistoryItemDisplay.tsx | 6 +-- .../src/ui/components/InputPrompt.test.tsx | 30 +++++-------- .../cli/src/ui/components/InputPrompt.tsx | 13 +++--- .../src/ui/components/LoadingIndicator.tsx | 4 +- .../src/ui/components/MemoryUsageDisplay.tsx | 3 +- .../ui/components/ModelStatsDisplay.test.tsx | 2 +- .../src/ui/components/ModelStatsDisplay.tsx | 5 ++- .../cli/src/ui/components/PrepareLabel.tsx | 2 +- .../components/SessionSummaryDisplay.test.tsx | 2 +- .../ui/components/SessionSummaryDisplay.tsx | 2 +- .../cli/src/ui/components/SettingsDialog.tsx | 7 +-- .../ui/components/ShellConfirmationDialog.tsx | 8 ++-- .../src/ui/components/ShellModeIndicator.tsx | 2 +- .../src/ui/components/StatsDisplay.test.tsx | 2 +- .../cli/src/ui/components/StatsDisplay.tsx | 5 ++- .../cli/src/ui/components/ThemeDialog.tsx | 6 ++- packages/cli/src/ui/components/Tips.tsx | 2 +- .../ui/components/ToolStatsDisplay.test.tsx | 2 +- .../src/ui/components/ToolStatsDisplay.tsx | 4 +- .../messages/CompressionMessage.tsx | 4 +- .../ui/components/messages/DiffRenderer.tsx | 2 +- .../ui/components/messages/ErrorMessage.tsx | 2 +- .../ui/components/messages/GeminiMessage.tsx | 2 +- .../messages/GeminiMessageContent.tsx | 2 +- .../ui/components/messages/InfoMessage.tsx | 2 +- .../messages/ToolConfirmationMessage.test.tsx | 2 +- .../messages/ToolConfirmationMessage.tsx | 12 +++-- .../messages/ToolGroupMessage.test.tsx | 7 ++- .../components/messages/ToolGroupMessage.tsx | 8 ++-- .../components/messages/ToolMessage.test.tsx | 3 +- .../ui/components/messages/ToolMessage.tsx | 3 +- .../ui/components/messages/UserMessage.tsx | 2 +- .../components/messages/UserShellMessage.tsx | 2 +- .../components/shared/RadioButtonSelect.tsx | 3 +- .../ui/components/shared/text-buffer.test.ts | 10 +++-- .../src/ui/components/shared/text-buffer.ts | 3 +- .../components/shared/vim-buffer-actions.ts | 3 +- .../src/ui/contexts/KeypressContext.test.tsx | 12 +++-- .../cli/src/ui/contexts/KeypressContext.tsx | 5 ++- .../cli/src/ui/contexts/OverflowContext.tsx | 3 +- .../src/ui/contexts/SessionContext.test.tsx | 7 +-- .../cli/src/ui/contexts/SessionContext.tsx | 11 ++--- .../cli/src/ui/contexts/SettingsContext.tsx | 2 +- .../cli/src/ui/contexts/StreamingContext.tsx | 2 +- .../cli/src/ui/contexts/VimModeContext.tsx | 3 +- .../src/ui/hooks/atCommandProcessor.test.ts | 7 +-- .../cli/src/ui/hooks/atCommandProcessor.ts | 14 +++--- .../cli/src/ui/hooks/shellCommandProcessor.ts | 11 +++-- .../ui/hooks/slashCommandProcessor.test.ts | 6 +-- .../cli/src/ui/hooks/slashCommandProcessor.ts | 10 ++--- .../cli/src/ui/hooks/useAtCompletion.test.ts | 12 +++-- packages/cli/src/ui/hooks/useAtCompletion.ts | 14 ++---- packages/cli/src/ui/hooks/useAuthCommand.ts | 5 +-- .../ui/hooks/useAutoAcceptIndicator.test.ts | 10 ++--- .../src/ui/hooks/useCommandCompletion.test.ts | 15 +++---- .../cli/src/ui/hooks/useCommandCompletion.tsx | 14 +++--- packages/cli/src/ui/hooks/useCompletion.ts | 6 +-- .../cli/src/ui/hooks/useConsoleMessages.ts | 2 +- .../src/ui/hooks/useEditorSettings.test.ts | 3 +- .../cli/src/ui/hooks/useEditorSettings.ts | 4 +- .../cli/src/ui/hooks/useFolderTrust.test.ts | 8 ++-- packages/cli/src/ui/hooks/useFolderTrust.ts | 2 +- .../cli/src/ui/hooks/useGeminiStream.test.tsx | 39 +++++++--------- packages/cli/src/ui/hooks/useGeminiStream.ts | 28 ++++++------ .../cli/src/ui/hooks/useGitBranchName.test.ts | 11 +---- .../src/ui/hooks/useHistoryManager.test.ts | 2 +- .../cli/src/ui/hooks/useHistoryManager.ts | 2 +- packages/cli/src/ui/hooks/useKeypress.test.ts | 3 +- packages/cli/src/ui/hooks/useKeypress.ts | 9 ++-- packages/cli/src/ui/hooks/useLogger.ts | 3 +- .../src/ui/hooks/usePrivacySettings.test.ts | 12 ++--- .../cli/src/ui/hooks/usePrivacySettings.ts | 2 +- .../cli/src/ui/hooks/usePromptCompletion.ts | 6 +-- .../cli/src/ui/hooks/useReactToolScheduler.ts | 8 ++-- .../ui/hooks/useReverseSearchCompletion.tsx | 4 +- .../cli/src/ui/hooks/useShowMemoryCommand.ts | 7 +-- .../src/ui/hooks/useSlashCompletion.test.ts | 4 +- .../cli/src/ui/hooks/useSlashCompletion.ts | 4 +- packages/cli/src/ui/hooks/useThemeCommand.ts | 2 +- .../cli/src/ui/hooks/useToolScheduler.test.ts | 24 +++++----- packages/cli/src/ui/hooks/vim.test.ts | 2 +- packages/cli/src/ui/keyMatchers.test.ts | 3 +- packages/cli/src/ui/keyMatchers.ts | 8 +--- .../src/ui/privacy/CloudFreePrivacyNotice.tsx | 2 +- packages/cli/src/ui/semantic-colors.ts | 2 +- packages/cli/src/ui/themes/no-color.ts | 5 ++- .../cli/src/ui/themes/theme-manager.test.ts | 2 +- packages/cli/src/ui/themes/theme-manager.ts | 11 ++--- packages/cli/src/ui/themes/theme.ts | 2 +- packages/cli/src/ui/types.ts | 2 +- packages/cli/src/ui/utils/CodeColorizer.tsx | 4 +- packages/cli/src/ui/utils/ConsolePatcher.ts | 2 +- .../cli/src/ui/utils/commandUtils.test.ts | 5 ++- packages/cli/src/ui/utils/commandUtils.ts | 3 +- .../cli/src/ui/utils/computeStats.test.ts | 5 ++- packages/cli/src/ui/utils/computeStats.ts | 2 +- packages/cli/src/ui/utils/updateCheck.ts | 3 +- packages/cli/src/utils/dialogScopeUtils.ts | 3 +- .../cli/src/utils/handleAutoUpdate.test.ts | 7 +-- packages/cli/src/utils/handleAutoUpdate.ts | 9 ++-- packages/cli/src/utils/sandbox.ts | 2 +- packages/cli/src/utils/settingsUtils.ts | 10 +++-- .../src/validateNonInterActiveAuth.test.ts | 6 +-- .../cli/src/validateNonInterActiveAuth.ts | 3 +- packages/cli/src/zed-integration/acp.ts | 2 +- .../src/zed-integration/fileSystemService.ts | 4 +- .../cli/src/zed-integration/zedIntegration.ts | 22 +++++---- packages/core/src/code_assist/codeAssist.ts | 8 ++-- .../core/src/code_assist/converter.test.ts | 8 ++-- packages/core/src/code_assist/converter.ts | 4 +- packages/core/src/code_assist/oauth2.test.ts | 5 ++- packages/core/src/code_assist/oauth2.ts | 4 +- packages/core/src/code_assist/server.ts | 14 +++--- packages/core/src/code_assist/setup.test.ts | 5 ++- packages/core/src/code_assist/setup.ts | 6 +-- packages/core/src/config/config.test.ts | 7 +-- packages/core/src/config/config.ts | 14 +++--- packages/core/src/core/client.test.ts | 9 ++-- packages/core/src/core/client.ts | 21 ++++----- .../core/src/core/contentGenerator.test.ts | 4 +- packages/core/src/core/contentGenerator.ts | 8 ++-- .../core/src/core/coreToolScheduler.test.ts | 19 ++++---- packages/core/src/core/coreToolScheduler.ts | 18 ++++---- packages/core/src/core/geminiChat.test.ts | 4 +- packages/core/src/core/geminiChat.ts | 11 ++--- packages/core/src/core/logger.test.ts | 4 +- packages/core/src/core/logger.ts | 4 +- .../core/src/core/loggingContentGenerator.ts | 6 +-- .../core/nonInteractiveToolExecutor.test.ts | 7 ++- .../src/core/nonInteractiveToolExecutor.ts | 6 ++- packages/core/src/core/subagent.test.ts | 22 +++++---- packages/core/src/core/subagent.ts | 8 ++-- packages/core/src/core/turn.test.ts | 9 ++-- packages/core/src/core/turn.ts | 8 ++-- packages/core/src/ide/ide-client.ts | 4 +- packages/core/src/ide/ide-installer.ts | 2 +- packages/core/src/index.ts | 7 +-- .../core/src/mcp/google-auth-provider.test.ts | 5 ++- packages/core/src/mcp/google-auth-provider.ts | 6 +-- packages/core/src/mcp/oauth-provider.test.ts | 7 +-- packages/core/src/mcp/oauth-provider.ts | 3 +- .../core/src/mcp/oauth-token-storage.test.ts | 4 +- packages/core/src/mcp/oauth-utils.test.ts | 4 +- packages/core/src/mcp/oauth-utils.ts | 2 +- packages/core/src/prompts/mcp-prompts.ts | 4 +- packages/core/src/prompts/prompt-registry.ts | 2 +- .../src/services/chatRecordingService.test.ts | 17 +++---- .../core/src/services/chatRecordingService.ts | 2 +- .../core/src/services/fileDiscoveryService.ts | 3 +- packages/core/src/services/gitService.ts | 5 ++- .../src/services/loopDetectionService.test.ts | 8 ++-- .../core/src/services/loopDetectionService.ts | 6 ++- .../services/shellExecutionService.test.ts | 8 ++-- .../src/services/shellExecutionService.ts | 3 +- .../clearcut-logger/clearcut-logger.test.ts | 17 +++---- .../clearcut-logger/clearcut-logger.ts | 4 +- packages/core/src/telemetry/file-exporters.ts | 14 +++--- packages/core/src/telemetry/index.ts | 14 +++--- .../telemetry/integration.test.circular.ts | 2 +- .../src/telemetry/loggers.test.circular.ts | 9 ++-- packages/core/src/telemetry/loggers.test.ts | 12 ++--- packages/core/src/telemetry/loggers.ts | 10 +++-- packages/core/src/telemetry/metrics.test.ts | 2 +- packages/core/src/telemetry/metrics.ts | 14 ++---- packages/core/src/telemetry/sdk.test.ts | 2 +- packages/core/src/telemetry/sdk.ts | 2 +- packages/core/src/telemetry/types.ts | 13 +++--- .../core/src/telemetry/uiTelemetry.test.ts | 5 ++- packages/core/src/telemetry/uiTelemetry.ts | 6 ++- packages/core/src/test-utils/config.ts | 3 +- .../src/test-utils/mockWorkspaceContext.ts | 2 +- packages/core/src/test-utils/tools.ts | 10 +++-- packages/core/src/tools/diffOptions.ts | 2 +- packages/core/src/tools/edit.test.ts | 14 +++--- packages/core/src/tools/edit.ts | 14 +++--- packages/core/src/tools/glob.test.ts | 5 ++- packages/core/src/tools/glob.ts | 11 ++--- packages/core/src/tools/grep.test.ts | 5 ++- packages/core/src/tools/grep.ts | 13 ++---- packages/core/src/tools/ls.test.ts | 6 +-- packages/core/src/tools/ls.ts | 12 ++--- .../core/src/tools/mcp-client-manager.test.ts | 6 +-- packages/core/src/tools/mcp-client-manager.ts | 8 ++-- packages/core/src/tools/mcp-client.test.ts | 6 +-- packages/core/src/tools/mcp-client.ts | 35 ++++++++------- packages/core/src/tools/mcp-tool.test.ts | 16 +++---- packages/core/src/tools/mcp-tool.ts | 14 +++--- packages/core/src/tools/memoryTool.test.ts | 3 +- packages/core/src/tools/memoryTool.ts | 10 +++-- .../core/src/tools/modifiable-tool.test.ts | 8 ++-- packages/core/src/tools/modifiable-tool.ts | 9 +++- packages/core/src/tools/read-file.test.ts | 7 +-- packages/core/src/tools/read-file.ts | 14 ++---- .../core/src/tools/read-many-files.test.ts | 2 +- packages/core/src/tools/read-many-files.ts | 16 +++---- packages/core/src/tools/ripGrep.test.ts | 8 ++-- packages/core/src/tools/ripGrep.ts | 11 ++--- packages/core/src/tools/shell.ts | 16 +++---- packages/core/src/tools/tool-registry.test.ts | 17 +++---- packages/core/src/tools/tool-registry.ts | 10 ++--- packages/core/src/tools/tools.test.ts | 9 +--- packages/core/src/tools/tools.ts | 4 +- packages/core/src/tools/web-fetch.test.ts | 3 +- packages/core/src/tools/web-fetch.ts | 11 +++-- packages/core/src/tools/web-search.test.ts | 8 ++-- packages/core/src/tools/web-search.ts | 13 ++---- packages/core/src/tools/write-file.test.ts | 21 ++++----- packages/core/src/tools/write-file.ts | 20 ++++++--- packages/core/src/utils/bfsFileSearch.ts | 4 +- packages/core/src/utils/editCorrector.test.ts | 11 +---- packages/core/src/utils/editCorrector.ts | 7 +-- .../core/src/utils/environmentContext.test.ts | 2 +- packages/core/src/utils/environmentContext.ts | 4 +- packages/core/src/utils/errorParsing.test.ts | 2 +- packages/core/src/utils/errorReporting.ts | 2 +- packages/core/src/utils/fileUtils.ts | 4 +- .../core/src/utils/filesearch/crawler.test.ts | 3 +- packages/core/src/utils/filesearch/crawler.ts | 2 +- .../core/src/utils/filesearch/fileSearch.ts | 6 ++- .../generateContentResponseUtilities.test.ts | 4 +- .../utils/generateContentResponseUtilities.ts | 6 ++- packages/core/src/utils/getFolderStructure.ts | 6 +-- .../core/src/utils/ignorePatterns.test.ts | 2 +- packages/core/src/utils/ignorePatterns.ts | 2 +- .../src/utils/installationManager.test.ts | 3 +- packages/core/src/utils/memoryDiscovery.ts | 8 ++-- packages/core/src/utils/messageInspectors.ts | 2 +- .../core/src/utils/nextSpeakerChecker.test.ts | 8 ++-- packages/core/src/utils/nextSpeakerChecker.ts | 6 +-- packages/core/src/utils/partUtils.test.ts | 2 +- packages/core/src/utils/partUtils.ts | 6 ++- .../core/src/utils/quotaErrorDetection.ts | 2 +- packages/core/src/utils/retry.test.ts | 3 +- packages/core/src/utils/shell-utils.test.ts | 2 +- packages/core/src/utils/shell-utils.ts | 2 +- packages/core/src/utils/summarizer.test.ts | 5 ++- packages/core/src/utils/summarizer.ts | 6 +-- .../core/src/utils/userAccountManager.test.ts | 3 +- .../src/ide-server.test.ts | 4 +- .../vscode-ide-companion/src/ide-server.ts | 2 +- tsconfig.json | 1 + 332 files changed, 1086 insertions(+), 1105 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 0f072d45..cb601fe7 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -108,6 +108,10 @@ export default tseslint.config( 'error', { ignoreParameters: true, ignoreProperties: true }, ], + '@typescript-eslint/consistent-type-imports': [ + 'error', + { disallowTypeAnnotations: false }, + ], '@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }], '@typescript-eslint/no-unused-vars': [ 'error', diff --git a/packages/cli/src/commands/extensions.tsx b/packages/cli/src/commands/extensions.tsx index fe9cdecb..53116c36 100644 --- a/packages/cli/src/commands/extensions.tsx +++ b/packages/cli/src/commands/extensions.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandModule } from 'yargs'; +import type { CommandModule } from 'yargs'; import { installCommand } from './extensions/install.js'; import { uninstallCommand } from './extensions/uninstall.js'; import { listCommand } from './extensions/list.js'; diff --git a/packages/cli/src/commands/extensions/install.ts b/packages/cli/src/commands/extensions/install.ts index 3ac8f0b9..f6351481 100644 --- a/packages/cli/src/commands/extensions/install.ts +++ b/packages/cli/src/commands/extensions/install.ts @@ -4,10 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandModule } from 'yargs'; +import type { CommandModule } from 'yargs'; import { installExtension, - ExtensionInstallMetadata, + type ExtensionInstallMetadata, } from '../../config/extension.js'; interface InstallArgs { diff --git a/packages/cli/src/commands/extensions/list.ts b/packages/cli/src/commands/extensions/list.ts index 6086587d..e076d347 100644 --- a/packages/cli/src/commands/extensions/list.ts +++ b/packages/cli/src/commands/extensions/list.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandModule } from 'yargs'; +import type { CommandModule } from 'yargs'; import { loadUserExtensions, toOutputString } from '../../config/extension.js'; export async function handleList() { diff --git a/packages/cli/src/commands/extensions/uninstall.ts b/packages/cli/src/commands/extensions/uninstall.ts index a9cab4b9..f34190db 100644 --- a/packages/cli/src/commands/extensions/uninstall.ts +++ b/packages/cli/src/commands/extensions/uninstall.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandModule } from 'yargs'; +import type { CommandModule } from 'yargs'; import { uninstallExtension } from '../../config/extension.js'; interface UninstallArgs { diff --git a/packages/cli/src/commands/extensions/update.ts b/packages/cli/src/commands/extensions/update.ts index 9fdbd838..1a03a763 100644 --- a/packages/cli/src/commands/extensions/update.ts +++ b/packages/cli/src/commands/extensions/update.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandModule } from 'yargs'; +import type { CommandModule } from 'yargs'; import { updateExtension } from '../../config/extension.js'; interface UpdateArgs { diff --git a/packages/cli/src/commands/mcp/add.ts b/packages/cli/src/commands/mcp/add.ts index 304338b0..47c481a2 100644 --- a/packages/cli/src/commands/mcp/add.ts +++ b/packages/cli/src/commands/mcp/add.ts @@ -7,7 +7,7 @@ // File for 'gemini mcp add' command import type { CommandModule } from 'yargs'; import { loadSettings, SettingScope } from '../../config/settings.js'; -import { MCPServerConfig } from '@google/gemini-cli-core'; +import type { MCPServerConfig } from '@google/gemini-cli-core'; async function addMcpServer( name: string, diff --git a/packages/cli/src/commands/mcp/list.ts b/packages/cli/src/commands/mcp/list.ts index 48ea912e..3d0f6e27 100644 --- a/packages/cli/src/commands/mcp/list.ts +++ b/packages/cli/src/commands/mcp/list.ts @@ -7,11 +7,8 @@ // File for 'gemini mcp list' command import type { CommandModule } from 'yargs'; import { loadSettings } from '../../config/settings.js'; -import { - MCPServerConfig, - MCPServerStatus, - createTransport, -} from '@google/gemini-cli-core'; +import type { MCPServerConfig } from '@google/gemini-cli-core'; +import { MCPServerStatus, createTransport } from '@google/gemini-cli-core'; import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { loadExtensions } from '../../config/extension.js'; diff --git a/packages/cli/src/config/config.integration.test.ts b/packages/cli/src/config/config.integration.test.ts index 260b6716..78f69bda 100644 --- a/packages/cli/src/config/config.integration.test.ts +++ b/packages/cli/src/config/config.integration.test.ts @@ -8,11 +8,11 @@ import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest'; import * as fs from 'node:fs'; import * as path from 'node:path'; import { tmpdir } from 'node:os'; -import { - Config, +import type { ConfigParameters, ContentGeneratorConfig, } from '@google/gemini-cli-core'; +import { Config } from '@google/gemini-cli-core'; import { http, HttpResponse } from 'msw'; import { setupServer } from 'msw/node'; diff --git a/packages/cli/src/config/config.test.ts b/packages/cli/src/config/config.test.ts index 5eb0b355..f7a1bfa2 100644 --- a/packages/cli/src/config/config.test.ts +++ b/packages/cli/src/config/config.test.ts @@ -4,13 +4,21 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest'; +import { + describe, + it, + expect, + vi, + beforeEach, + afterEach, + type Mock, +} from 'vitest'; import * as os from 'node:os'; import * as path from 'node:path'; import { ShellTool, EditTool, WriteFileTool } from '@google/gemini-cli-core'; -import { loadCliConfig, parseArguments, CliArgs } from './config.js'; -import { Settings } from './settings.js'; -import { Extension } from './extension.js'; +import { loadCliConfig, parseArguments, type CliArgs } from './config.js'; +import type { Settings } from './settings.js'; +import type { Extension } from './extension.js'; import * as ServerConfig from '@google/gemini-cli-core'; import { isWorkspaceTrusted } from './trustedFolders.js'; diff --git a/packages/cli/src/config/config.ts b/packages/cli/src/config/config.ts index c7975725..a793d373 100755 --- a/packages/cli/src/config/config.ts +++ b/packages/cli/src/config/config.ts @@ -11,6 +11,11 @@ import yargs from 'yargs/yargs'; import { hideBin } from 'yargs/helpers'; import process from 'node:process'; import { mcpCommand } from '../commands/mcp.js'; +import type { + TelemetryTarget, + FileFilteringOptions, + MCPServerConfig, +} from '@google/gemini-cli-core'; import { extensionsCommand } from '../commands/extensions.js'; import { Config, @@ -22,16 +27,14 @@ import { DEFAULT_GEMINI_EMBEDDING_MODEL, DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, FileDiscoveryService, - TelemetryTarget, - FileFilteringOptions, ShellTool, EditTool, WriteFileTool, - MCPServerConfig, } from '@google/gemini-cli-core'; -import { Settings } from './settings.js'; +import type { Settings } from './settings.js'; -import { Extension, annotateActiveExtensions } from './extension.js'; +import type { Extension } from './extension.js'; +import { annotateActiveExtensions } from './extension.js'; import { getCliVersion } from '../utils/version.js'; import { loadSandboxConfig } from './sandboxConfig.js'; import { resolvePath } from '../utils/resolvePath.js'; diff --git a/packages/cli/src/config/extension.test.ts b/packages/cli/src/config/extension.test.ts index 07c6096a..ad6d7d1f 100644 --- a/packages/cli/src/config/extension.test.ts +++ b/packages/cli/src/config/extension.test.ts @@ -18,14 +18,14 @@ import { updateExtension, } from './extension.js'; import { execSync } from 'node:child_process'; -import { SimpleGit, simpleGit } from 'simple-git'; +import { type SimpleGit, simpleGit } from 'simple-git'; vi.mock('simple-git', () => ({ simpleGit: vi.fn(), })); vi.mock('os', async (importOriginal) => { - const os = await importOriginal(); + const os = await importOriginal(); return { ...os, homedir: vi.fn(), diff --git a/packages/cli/src/config/extension.ts b/packages/cli/src/config/extension.ts index 6463da68..b894e7fc 100644 --- a/packages/cli/src/config/extension.ts +++ b/packages/cli/src/config/extension.ts @@ -4,11 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { MCPServerConfig, GeminiCLIExtension, - Storage, } from '@google/gemini-cli-core'; +import { Storage } from '@google/gemini-cli-core'; import * as fs from 'node:fs'; import * as path from 'node:path'; import * as os from 'node:os'; diff --git a/packages/cli/src/config/keyBindings.test.ts b/packages/cli/src/config/keyBindings.test.ts index 2e89e421..1003290b 100644 --- a/packages/cli/src/config/keyBindings.test.ts +++ b/packages/cli/src/config/keyBindings.test.ts @@ -5,11 +5,8 @@ */ import { describe, it, expect } from 'vitest'; -import { - Command, - KeyBindingConfig, - defaultKeyBindings, -} from './keyBindings.js'; +import type { KeyBindingConfig } from './keyBindings.js'; +import { Command, defaultKeyBindings } from './keyBindings.js'; describe('keyBindings config', () => { describe('defaultKeyBindings', () => { diff --git a/packages/cli/src/config/sandboxConfig.ts b/packages/cli/src/config/sandboxConfig.ts index 4311b148..182176bb 100644 --- a/packages/cli/src/config/sandboxConfig.ts +++ b/packages/cli/src/config/sandboxConfig.ts @@ -4,11 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { SandboxConfig } from '@google/gemini-cli-core'; +import type { SandboxConfig } from '@google/gemini-cli-core'; import commandExists from 'command-exists'; import * as os from 'node:os'; import { getPackageJson } from '../utils/package.js'; -import { Settings } from './settings.js'; +import type { Settings } from './settings.js'; // This is a stripped-down version of the CliArgs interface from config.ts // to avoid circular dependencies. diff --git a/packages/cli/src/config/settings.ts b/packages/cli/src/config/settings.ts index 6fbd6820..58664910 100644 --- a/packages/cli/src/config/settings.ts +++ b/packages/cli/src/config/settings.ts @@ -17,7 +17,7 @@ import stripJsonComments from 'strip-json-comments'; import { DefaultLight } from '../ui/themes/default-light.js'; import { DefaultDark } from '../ui/themes/default.js'; import { isWorkspaceTrusted } from './trustedFolders.js'; -import { Settings, MemoryImportFormat } from './settingsSchema.js'; +import type { Settings, MemoryImportFormat } from './settingsSchema.js'; export type { Settings, MemoryImportFormat }; diff --git a/packages/cli/src/config/settingsSchema.test.ts b/packages/cli/src/config/settingsSchema.test.ts index b522be94..c99ead4d 100644 --- a/packages/cli/src/config/settingsSchema.test.ts +++ b/packages/cli/src/config/settingsSchema.test.ts @@ -5,7 +5,8 @@ */ import { describe, it, expect } from 'vitest'; -import { SETTINGS_SCHEMA, Settings } from './settingsSchema.js'; +import type { Settings } from './settingsSchema.js'; +import { SETTINGS_SCHEMA } from './settingsSchema.js'; describe('SettingsSchema', () => { describe('SETTINGS_SCHEMA', () => { diff --git a/packages/cli/src/config/settingsSchema.ts b/packages/cli/src/config/settingsSchema.ts index e23277b1..b7cedb30 100644 --- a/packages/cli/src/config/settingsSchema.ts +++ b/packages/cli/src/config/settingsSchema.ts @@ -4,14 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { MCPServerConfig, BugCommandSettings, TelemetrySettings, AuthType, ChatCompressionSettings, } from '@google/gemini-cli-core'; -import { CustomTheme } from '../ui/themes/theme.js'; +import type { CustomTheme } from '../ui/themes/theme.js'; export interface SettingDefinition { type: 'boolean' | 'string' | 'number' | 'array' | 'object'; diff --git a/packages/cli/src/config/trustedFolders.test.ts b/packages/cli/src/config/trustedFolders.test.ts index 5d6a4d70..6b2be226 100644 --- a/packages/cli/src/config/trustedFolders.test.ts +++ b/packages/cli/src/config/trustedFolders.test.ts @@ -35,7 +35,7 @@ import { TrustLevel, isWorkspaceTrusted, } from './trustedFolders.js'; -import { Settings } from './settings.js'; +import type { Settings } from './settings.js'; vi.mock('fs', async (importOriginal) => { const actualFs = await importOriginal(); diff --git a/packages/cli/src/config/trustedFolders.ts b/packages/cli/src/config/trustedFolders.ts index 24150206..d7a82340 100644 --- a/packages/cli/src/config/trustedFolders.ts +++ b/packages/cli/src/config/trustedFolders.ts @@ -8,7 +8,7 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import { homedir } from 'node:os'; import { getErrorMessage, isWithinRoot } from '@google/gemini-cli-core'; -import { Settings } from './settings.js'; +import type { Settings } from './settings.js'; import stripJsonComments from 'strip-json-comments'; export const TRUSTED_FOLDERS_FILENAME = 'trustedFolders.json'; diff --git a/packages/cli/src/gemini.test.tsx b/packages/cli/src/gemini.test.tsx index 3eddb2ff..b1e3c3b6 100644 --- a/packages/cli/src/gemini.test.tsx +++ b/packages/cli/src/gemini.test.tsx @@ -12,13 +12,10 @@ import { validateDnsResolutionOrder, startInteractiveUI, } from './gemini.js'; -import { - LoadedSettings, - SettingsFile, - loadSettings, -} from './config/settings.js'; +import type { SettingsFile } from './config/settings.js'; +import { LoadedSettings, loadSettings } from './config/settings.js'; import { appEvents, AppEvent } from './utils/events.js'; -import { Config } from '@google/gemini-cli-core'; +import type { Config } from '@google/gemini-cli-core'; // Custom error to identify mock process.exit calls class MockProcessExitError extends Error { diff --git a/packages/cli/src/gemini.tsx b/packages/cli/src/gemini.tsx index aadddaeb..b9b20741 100644 --- a/packages/cli/src/gemini.tsx +++ b/packages/cli/src/gemini.tsx @@ -15,12 +15,8 @@ import os from 'node:os'; import dns from 'node:dns'; import { spawn } from 'node:child_process'; import { start_sandbox } from './utils/sandbox.js'; -import { - DnsResolutionOrder, - LoadedSettings, - loadSettings, - SettingScope, -} from './config/settings.js'; +import type { DnsResolutionOrder, LoadedSettings } from './config/settings.js'; +import { loadSettings, SettingScope } from './config/settings.js'; import { themeManager } from './ui/themes/theme-manager.js'; import { getStartupWarnings } from './utils/startupWarnings.js'; import { getUserStartupWarnings } from './utils/userStartupWarnings.js'; @@ -29,8 +25,8 @@ import { runNonInteractive } from './nonInteractiveCli.js'; import { loadExtensions } from './config/extension.js'; import { cleanupCheckpoints, registerCleanup } from './utils/cleanup.js'; import { getCliVersion } from './utils/version.js'; +import type { Config } from '@google/gemini-cli-core'; import { - Config, sessionId, logUserPrompt, AuthType, diff --git a/packages/cli/src/nonInteractiveCli.test.ts b/packages/cli/src/nonInteractiveCli.test.ts index 8dc8775d..f7fc00e4 100644 --- a/packages/cli/src/nonInteractiveCli.test.ts +++ b/packages/cli/src/nonInteractiveCli.test.ts @@ -4,16 +4,18 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { Config, - executeToolCall, ToolRegistry, + ServerGeminiStreamEvent, +} from '@google/gemini-cli-core'; +import { + executeToolCall, ToolErrorType, shutdownTelemetry, GeminiEventType, - ServerGeminiStreamEvent, } from '@google/gemini-cli-core'; -import { Part } from '@google/genai'; +import type { Part } from '@google/genai'; import { runNonInteractive } from './nonInteractiveCli.js'; import { vi } from 'vitest'; diff --git a/packages/cli/src/nonInteractiveCli.ts b/packages/cli/src/nonInteractiveCli.ts index d02a2a1b..9f9ffd1c 100644 --- a/packages/cli/src/nonInteractiveCli.ts +++ b/packages/cli/src/nonInteractiveCli.ts @@ -4,16 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ +import type { Config, ToolCallRequestInfo } from '@google/gemini-cli-core'; import { - Config, - ToolCallRequestInfo, executeToolCall, shutdownTelemetry, isTelemetrySdkInitialized, GeminiEventType, parseAndFormatApiError, } from '@google/gemini-cli-core'; -import { Content, Part } from '@google/genai'; +import type { Content, Part } from '@google/genai'; import { ConsolePatcher } from './ui/utils/ConsolePatcher.js'; import { handleAtCommand } from './ui/hooks/atCommandProcessor.js'; diff --git a/packages/cli/src/services/BuiltinCommandLoader.test.ts b/packages/cli/src/services/BuiltinCommandLoader.test.ts index cd449dd8..0ae31e10 100644 --- a/packages/cli/src/services/BuiltinCommandLoader.test.ts +++ b/packages/cli/src/services/BuiltinCommandLoader.test.ts @@ -22,7 +22,7 @@ vi.mock('../ui/commands/restoreCommand.js', () => ({ import { describe, it, expect, vi, beforeEach, type Mock } from 'vitest'; import { BuiltinCommandLoader } from './BuiltinCommandLoader.js'; -import { Config } from '@google/gemini-cli-core'; +import type { Config } from '@google/gemini-cli-core'; import { CommandKind } from '../ui/commands/types.js'; import { ideCommand } from '../ui/commands/ideCommand.js'; diff --git a/packages/cli/src/services/BuiltinCommandLoader.ts b/packages/cli/src/services/BuiltinCommandLoader.ts index 7a09cb14..9dafcd20 100644 --- a/packages/cli/src/services/BuiltinCommandLoader.ts +++ b/packages/cli/src/services/BuiltinCommandLoader.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { ICommandLoader } from './types.js'; -import { SlashCommand } from '../ui/commands/types.js'; -import { Config } from '@google/gemini-cli-core'; +import type { ICommandLoader } from './types.js'; +import type { SlashCommand } from '../ui/commands/types.js'; +import type { Config } from '@google/gemini-cli-core'; import { aboutCommand } from '../ui/commands/aboutCommand.js'; import { authCommand } from '../ui/commands/authCommand.js'; import { bugCommand } from '../ui/commands/bugCommand.js'; diff --git a/packages/cli/src/services/CommandService.ts b/packages/cli/src/services/CommandService.ts index 78e4817b..5f1e09d5 100644 --- a/packages/cli/src/services/CommandService.ts +++ b/packages/cli/src/services/CommandService.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { SlashCommand } from '../ui/commands/types.js'; -import { ICommandLoader } from './types.js'; +import type { SlashCommand } from '../ui/commands/types.js'; +import type { ICommandLoader } from './types.js'; /** * Orchestrates the discovery and loading of all slash commands for the CLI. diff --git a/packages/cli/src/services/FileCommandLoader.test.ts b/packages/cli/src/services/FileCommandLoader.test.ts index 9960a632..0b65f6c7 100644 --- a/packages/cli/src/services/FileCommandLoader.test.ts +++ b/packages/cli/src/services/FileCommandLoader.test.ts @@ -5,7 +5,8 @@ */ import * as path from 'node:path'; -import { Config, Storage } from '@google/gemini-cli-core'; +import type { Config } from '@google/gemini-cli-core'; +import { Storage } from '@google/gemini-cli-core'; import mock from 'mock-fs'; import { FileCommandLoader } from './FileCommandLoader.js'; import { assert, vi } from 'vitest'; @@ -19,7 +20,7 @@ import { ShellProcessor, } from './prompt-processors/shellProcessor.js'; import { DefaultArgumentProcessor } from './prompt-processors/argumentProcessor.js'; -import { CommandContext } from '../ui/commands/types.js'; +import type { CommandContext } from '../ui/commands/types.js'; const mockShellProcess = vi.hoisted(() => vi.fn()); vi.mock('./prompt-processors/shellProcessor.js', () => ({ diff --git a/packages/cli/src/services/FileCommandLoader.ts b/packages/cli/src/services/FileCommandLoader.ts index 67d489bf..294d35f9 100644 --- a/packages/cli/src/services/FileCommandLoader.ts +++ b/packages/cli/src/services/FileCommandLoader.ts @@ -9,17 +9,18 @@ import path from 'node:path'; import toml from '@iarna/toml'; import { glob } from 'glob'; import { z } from 'zod'; -import { Config, Storage } from '@google/gemini-cli-core'; -import { ICommandLoader } from './types.js'; -import { +import type { Config } from '@google/gemini-cli-core'; +import { Storage } from '@google/gemini-cli-core'; +import type { ICommandLoader } from './types.js'; +import type { CommandContext, - CommandKind, SlashCommand, SlashCommandActionReturn, } from '../ui/commands/types.js'; +import { CommandKind } from '../ui/commands/types.js'; import { DefaultArgumentProcessor } from './prompt-processors/argumentProcessor.js'; +import type { IPromptProcessor } from './prompt-processors/types.js'; import { - IPromptProcessor, SHORTHAND_ARGS_PLACEHOLDER, SHELL_INJECTION_TRIGGER, } from './prompt-processors/types.js'; diff --git a/packages/cli/src/services/McpPromptLoader.test.ts b/packages/cli/src/services/McpPromptLoader.test.ts index d407d739..609e5533 100644 --- a/packages/cli/src/services/McpPromptLoader.test.ts +++ b/packages/cli/src/services/McpPromptLoader.test.ts @@ -5,8 +5,8 @@ */ import { McpPromptLoader } from './McpPromptLoader.js'; -import { Config } from '@google/gemini-cli-core'; -import { PromptArgument } from '@modelcontextprotocol/sdk/types.js'; +import type { Config } from '@google/gemini-cli-core'; +import type { PromptArgument } from '@modelcontextprotocol/sdk/types.js'; import { describe, it, expect } from 'vitest'; describe('McpPromptLoader', () => { diff --git a/packages/cli/src/services/McpPromptLoader.ts b/packages/cli/src/services/McpPromptLoader.ts index 1ad37b34..c24e7b51 100644 --- a/packages/cli/src/services/McpPromptLoader.ts +++ b/packages/cli/src/services/McpPromptLoader.ts @@ -4,19 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { - Config, - getErrorMessage, - getMCPServerPrompts, -} from '@google/gemini-cli-core'; -import { +import type { Config } from '@google/gemini-cli-core'; +import { getErrorMessage, getMCPServerPrompts } from '@google/gemini-cli-core'; +import type { CommandContext, - CommandKind, SlashCommand, SlashCommandActionReturn, } from '../ui/commands/types.js'; -import { ICommandLoader } from './types.js'; -import { PromptArgument } from '@modelcontextprotocol/sdk/types.js'; +import { CommandKind } from '../ui/commands/types.js'; +import type { ICommandLoader } from './types.js'; +import type { PromptArgument } from '@modelcontextprotocol/sdk/types.js'; /** * Discovers and loads executable slash commands from prompts exposed by diff --git a/packages/cli/src/services/prompt-processors/argumentProcessor.ts b/packages/cli/src/services/prompt-processors/argumentProcessor.ts index 9d5fc369..6fa9b47b 100644 --- a/packages/cli/src/services/prompt-processors/argumentProcessor.ts +++ b/packages/cli/src/services/prompt-processors/argumentProcessor.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { IPromptProcessor } from './types.js'; -import { CommandContext } from '../../ui/commands/types.js'; +import type { IPromptProcessor } from './types.js'; +import type { CommandContext } from '../../ui/commands/types.js'; /** * Appends the user's full command invocation to the prompt if arguments are diff --git a/packages/cli/src/services/prompt-processors/shellProcessor.test.ts b/packages/cli/src/services/prompt-processors/shellProcessor.test.ts index 738168a7..5e33a8a5 100644 --- a/packages/cli/src/services/prompt-processors/shellProcessor.test.ts +++ b/packages/cli/src/services/prompt-processors/shellProcessor.test.ts @@ -7,8 +7,9 @@ import { describe, it, expect, beforeEach, vi, type Mock } from 'vitest'; import { ConfirmationRequiredError, ShellProcessor } from './shellProcessor.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; -import { CommandContext } from '../../ui/commands/types.js'; -import { ApprovalMode, Config } from '@google/gemini-cli-core'; +import type { CommandContext } from '../../ui/commands/types.js'; +import type { Config } from '@google/gemini-cli-core'; +import { ApprovalMode } from '@google/gemini-cli-core'; import os from 'node:os'; import { quote } from 'shell-quote'; diff --git a/packages/cli/src/services/prompt-processors/shellProcessor.ts b/packages/cli/src/services/prompt-processors/shellProcessor.ts index 5242fa7a..cfa72292 100644 --- a/packages/cli/src/services/prompt-processors/shellProcessor.ts +++ b/packages/cli/src/services/prompt-processors/shellProcessor.ts @@ -12,9 +12,9 @@ import { ShellExecutionService, } from '@google/gemini-cli-core'; -import { CommandContext } from '../../ui/commands/types.js'; +import type { CommandContext } from '../../ui/commands/types.js'; +import type { IPromptProcessor } from './types.js'; import { - IPromptProcessor, SHELL_INJECTION_TRIGGER, SHORTHAND_ARGS_PLACEHOLDER, } from './types.js'; diff --git a/packages/cli/src/services/prompt-processors/types.ts b/packages/cli/src/services/prompt-processors/types.ts index 956bb432..94c2e717 100644 --- a/packages/cli/src/services/prompt-processors/types.ts +++ b/packages/cli/src/services/prompt-processors/types.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandContext } from '../../ui/commands/types.js'; +import type { CommandContext } from '../../ui/commands/types.js'; /** * Defines the interface for a prompt processor, a module that can transform diff --git a/packages/cli/src/services/types.ts b/packages/cli/src/services/types.ts index 9d30e791..13a87687 100644 --- a/packages/cli/src/services/types.ts +++ b/packages/cli/src/services/types.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { SlashCommand } from '../ui/commands/types.js'; +import type { SlashCommand } from '../ui/commands/types.js'; /** * Defines the contract for any class that can load and provide slash commands. diff --git a/packages/cli/src/test-utils/customMatchers.ts b/packages/cli/src/test-utils/customMatchers.ts index 26eac07b..2a1b275a 100644 --- a/packages/cli/src/test-utils/customMatchers.ts +++ b/packages/cli/src/test-utils/customMatchers.ts @@ -12,7 +12,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Assertion, expect } from 'vitest'; +import type { Assertion } from 'vitest'; +import { expect } from 'vitest'; import type { TextBuffer } from '../ui/components/shared/text-buffer.js'; // RegExp to detect invalid characters: backspace, and ANSI escape codes diff --git a/packages/cli/src/test-utils/mockCommandContext.ts b/packages/cli/src/test-utils/mockCommandContext.ts index 12b8d096..648e3c8f 100644 --- a/packages/cli/src/test-utils/mockCommandContext.ts +++ b/packages/cli/src/test-utils/mockCommandContext.ts @@ -5,10 +5,10 @@ */ import { vi } from 'vitest'; -import { CommandContext } from '../ui/commands/types.js'; -import { LoadedSettings } from '../config/settings.js'; -import { GitService } from '@google/gemini-cli-core'; -import { SessionStatsState } from '../ui/contexts/SessionContext.js'; +import type { CommandContext } from '../ui/commands/types.js'; +import type { LoadedSettings } from '../config/settings.js'; +import type { GitService } from '@google/gemini-cli-core'; +import type { SessionStatsState } from '../ui/contexts/SessionContext.js'; // A utility type to make all properties of an object, and its nested objects, partial. type DeepPartial = T extends object diff --git a/packages/cli/src/test-utils/render.tsx b/packages/cli/src/test-utils/render.tsx index 05b92532..0aff7c74 100644 --- a/packages/cli/src/test-utils/render.tsx +++ b/packages/cli/src/test-utils/render.tsx @@ -5,7 +5,7 @@ */ import { render } from 'ink-testing-library'; -import React from 'react'; +import type React from 'react'; import { KeypressProvider } from '../ui/contexts/KeypressContext.js'; export const renderWithProviders = ( diff --git a/packages/cli/src/ui/App.test.tsx b/packages/cli/src/ui/App.test.tsx index 355a9d29..5d2bf20c 100644 --- a/packages/cli/src/ui/App.test.tsx +++ b/packages/cli/src/ui/App.test.tsx @@ -4,27 +4,33 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderWithProviders } from '../test-utils/render.js'; import { AppWrapper as App } from './App.js'; -import { - Config as ServerConfig, - MCPServerConfig, - ApprovalMode, - ToolRegistry, +import type { AccessibilitySettings, + MCPServerConfig, + ToolRegistry, SandboxConfig, GeminiClient, - ideContext, - type AuthType, + AuthType, } from '@google/gemini-cli-core'; -import { LoadedSettings, SettingsFile, Settings } from '../config/settings.js'; +import { + ApprovalMode, + ideContext, + Config as ServerConfig, +} from '@google/gemini-cli-core'; +import type { SettingsFile, Settings } from '../config/settings.js'; +import { LoadedSettings } from '../config/settings.js'; import process from 'node:process'; import { useGeminiStream } from './hooks/useGeminiStream.js'; import { useConsoleMessages } from './hooks/useConsoleMessages.js'; -import { StreamingState, ConsoleMessageItem } from './types.js'; +import type { ConsoleMessageItem } from './types.js'; +import { StreamingState } from './types.js'; import { Tips } from './components/Tips.js'; -import { checkForUpdates, UpdateObject } from './utils/updateCheck.js'; +import type { UpdateObject } from './utils/updateCheck.js'; +import { checkForUpdates } from './utils/updateCheck.js'; import { EventEmitter } from 'node:events'; import { updateEventEmitter } from '../utils/updateEventEmitter.js'; import * as auth from '../config/auth.js'; diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index 8c164447..e65114f9 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -5,15 +5,8 @@ */ import { useCallback, useEffect, useMemo, useState, useRef } from 'react'; -import { - Box, - DOMElement, - measureElement, - Static, - Text, - useStdin, - useStdout, -} from 'ink'; +import type { DOMElement } from 'ink'; +import { Box, measureElement, Static, Text, useStdin, useStdout } from 'ink'; import { StreamingState, type HistoryItem, MessageType } from './types.js'; import { useTerminalSize } from './hooks/useTerminalSize.js'; import { useGeminiStream } from './hooks/useGeminiStream.js'; @@ -41,7 +34,8 @@ import { ShellConfirmationDialog } from './components/ShellConfirmationDialog.js import { RadioButtonSelect } from './components/shared/RadioButtonSelect.js'; import { Colors } from './colors.js'; import { loadHierarchicalGeminiMemory } from '../config/config.js'; -import { LoadedSettings, SettingScope } from '../config/settings.js'; +import type { LoadedSettings } from '../config/settings.js'; +import { SettingScope } from '../config/settings.js'; import { Tips } from './components/Tips.js'; import { ConsolePatcher } from './utils/ConsolePatcher.js'; import { registerCleanup } from '../utils/cleanup.js'; @@ -50,23 +44,22 @@ import { HistoryItemDisplay } from './components/HistoryItemDisplay.js'; import { ContextSummaryDisplay } from './components/ContextSummaryDisplay.js'; import { useHistory } from './hooks/useHistoryManager.js'; import process from 'node:process'; +import type { EditorType, Config, IdeContext } from '@google/gemini-cli-core'; import { - getErrorMessage, - type Config, - getAllGeminiMdFilenames, ApprovalMode, + getAllGeminiMdFilenames, isEditorAvailable, - EditorType, - FlashFallbackEvent, - logFlashFallback, + getErrorMessage, AuthType, - type IdeContext, + logFlashFallback, + FlashFallbackEvent, ideContext, + isProQuotaExceededError, + isGenericQuotaExceededError, + UserTierId, } from '@google/gemini-cli-core'; -import { - IdeIntegrationNudge, - IdeIntegrationNudgeResult, -} from './IdeIntegrationNudge.js'; +import type { IdeIntegrationNudgeResult } from './IdeIntegrationNudge.js'; +import { IdeIntegrationNudge } from './IdeIntegrationNudge.js'; import { validateAuthMethod } from '../config/auth.js'; import { useLogger } from './hooks/useLogger.js'; import { StreamingContext } from './contexts/StreamingContext.js'; @@ -80,18 +73,14 @@ import { useBracketedPaste } from './hooks/useBracketedPaste.js'; import { useTextBuffer } from './components/shared/text-buffer.js'; import { useVimMode, VimModeProvider } from './contexts/VimModeContext.js'; import { useVim } from './hooks/vim.js'; -import { useKeypress, Key } from './hooks/useKeypress.js'; +import type { Key } from './hooks/useKeypress.js'; +import { useKeypress } from './hooks/useKeypress.js'; import { KeypressProvider } from './contexts/KeypressContext.js'; import { useKittyKeyboardProtocol } from './hooks/useKittyKeyboardProtocol.js'; import { keyMatchers, Command } from './keyMatchers.js'; import * as fs from 'node:fs'; import { UpdateNotification } from './components/UpdateNotification.js'; -import { - isProQuotaExceededError, - isGenericQuotaExceededError, - UserTierId, -} from '@google/gemini-cli-core'; -import { UpdateObject } from './utils/updateCheck.js'; +import type { UpdateObject } from './utils/updateCheck.js'; import ansiEscapes from 'ansi-escapes'; import { OverflowProvider } from './contexts/OverflowContext.js'; import { ShowMoreLines } from './components/ShowMoreLines.js'; diff --git a/packages/cli/src/ui/IdeIntegrationNudge.tsx b/packages/cli/src/ui/IdeIntegrationNudge.tsx index eae39e8c..d4645d63 100644 --- a/packages/cli/src/ui/IdeIntegrationNudge.tsx +++ b/packages/cli/src/ui/IdeIntegrationNudge.tsx @@ -4,12 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { DetectedIde, getIdeInfo } from '@google/gemini-cli-core'; +import type { DetectedIde } from '@google/gemini-cli-core'; +import { getIdeInfo } from '@google/gemini-cli-core'; import { Box, Text } from 'ink'; -import { - RadioButtonSelect, - RadioSelectItem, -} from './components/shared/RadioButtonSelect.js'; +import type { RadioSelectItem } from './components/shared/RadioButtonSelect.js'; +import { RadioButtonSelect } from './components/shared/RadioButtonSelect.js'; import { useKeypress } from './hooks/useKeypress.js'; export type IdeIntegrationNudgeResult = { diff --git a/packages/cli/src/ui/colors.ts b/packages/cli/src/ui/colors.ts index f87055e4..a20a9909 100644 --- a/packages/cli/src/ui/colors.ts +++ b/packages/cli/src/ui/colors.ts @@ -5,7 +5,7 @@ */ import { themeManager } from './themes/theme-manager.js'; -import { ColorsTheme } from './themes/theme.js'; +import type { ColorsTheme } from './themes/theme.js'; export const Colors: ColorsTheme = { get type() { diff --git a/packages/cli/src/ui/commands/aboutCommand.ts b/packages/cli/src/ui/commands/aboutCommand.ts index 92d250d5..b5aa3e50 100644 --- a/packages/cli/src/ui/commands/aboutCommand.ts +++ b/packages/cli/src/ui/commands/aboutCommand.ts @@ -5,7 +5,8 @@ */ import { getCliVersion } from '../../utils/version.js'; -import { CommandKind, SlashCommand } from './types.js'; +import type { SlashCommand } from './types.js'; +import { CommandKind } from './types.js'; import process from 'node:process'; import { MessageType, type HistoryItemAbout } from '../types.js'; diff --git a/packages/cli/src/ui/commands/authCommand.ts b/packages/cli/src/ui/commands/authCommand.ts index 8e78cf86..5ba3088c 100644 --- a/packages/cli/src/ui/commands/authCommand.ts +++ b/packages/cli/src/ui/commands/authCommand.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandKind, OpenDialogActionReturn, SlashCommand } from './types.js'; +import type { OpenDialogActionReturn, SlashCommand } from './types.js'; +import { CommandKind } from './types.js'; export const authCommand: SlashCommand = { name: 'auth', diff --git a/packages/cli/src/ui/commands/chatCommand.test.ts b/packages/cli/src/ui/commands/chatCommand.test.ts index 2b0c4300..4990946d 100644 --- a/packages/cli/src/ui/commands/chatCommand.test.ts +++ b/packages/cli/src/ui/commands/chatCommand.test.ts @@ -4,29 +4,22 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { - vi, - describe, - it, - expect, - beforeEach, - afterEach, - Mocked, -} from 'vitest'; +import type { Mocked } from 'vitest'; +import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'; -import { - type CommandContext, +import type { MessageActionReturn, SlashCommand, + type CommandContext, } from './types.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; -import { Content } from '@google/genai'; -import { GeminiClient } from '@google/gemini-cli-core'; +import type { Content } from '@google/genai'; +import type { GeminiClient } from '@google/gemini-cli-core'; import * as fsPromises from 'node:fs/promises'; import { chatCommand } from './chatCommand.js'; -import { Stats } from 'node:fs'; -import { HistoryItemWithoutId } from '../types.js'; +import type { Stats } from 'node:fs'; +import type { HistoryItemWithoutId } from '../types.js'; vi.mock('fs/promises', () => ({ stat: vi.fn(), diff --git a/packages/cli/src/ui/commands/chatCommand.ts b/packages/cli/src/ui/commands/chatCommand.ts index ed8dae8d..216baaac 100644 --- a/packages/cli/src/ui/commands/chatCommand.ts +++ b/packages/cli/src/ui/commands/chatCommand.ts @@ -8,16 +8,17 @@ import * as fsPromises from 'node:fs/promises'; import React from 'react'; import { Text } from 'ink'; import { Colors } from '../colors.js'; -import { +import type { CommandContext, SlashCommand, MessageActionReturn, - CommandKind, SlashCommandActionReturn, } from './types.js'; +import { CommandKind } from './types.js'; import { decodeTagName } from '@google/gemini-cli-core'; import path from 'node:path'; -import { HistoryItemWithoutId, MessageType } from '../types.js'; +import type { HistoryItemWithoutId } from '../types.js'; +import { MessageType } from '../types.js'; interface ChatDetail { name: string; diff --git a/packages/cli/src/ui/commands/clearCommand.test.ts b/packages/cli/src/ui/commands/clearCommand.test.ts index 10d54f4b..261763e3 100644 --- a/packages/cli/src/ui/commands/clearCommand.test.ts +++ b/packages/cli/src/ui/commands/clearCommand.test.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { vi, describe, it, expect, beforeEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { vi, describe, it, expect, beforeEach } from 'vitest'; import { clearCommand } from './clearCommand.js'; import { type CommandContext } from './types.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; @@ -20,7 +21,8 @@ vi.mock('@google/gemini-cli-core', async () => { }; }); -import { GeminiClient, uiTelemetryService } from '@google/gemini-cli-core'; +import type { GeminiClient } from '@google/gemini-cli-core'; +import { uiTelemetryService } from '@google/gemini-cli-core'; describe('clearCommand', () => { let mockContext: CommandContext; diff --git a/packages/cli/src/ui/commands/clearCommand.ts b/packages/cli/src/ui/commands/clearCommand.ts index a2a1c13a..222bf666 100644 --- a/packages/cli/src/ui/commands/clearCommand.ts +++ b/packages/cli/src/ui/commands/clearCommand.ts @@ -5,7 +5,8 @@ */ import { uiTelemetryService } from '@google/gemini-cli-core'; -import { CommandKind, SlashCommand } from './types.js'; +import type { SlashCommand } from './types.js'; +import { CommandKind } from './types.js'; export const clearCommand: SlashCommand = { name: 'clear', diff --git a/packages/cli/src/ui/commands/compressCommand.test.ts b/packages/cli/src/ui/commands/compressCommand.test.ts index 95a8bda3..7508bc9f 100644 --- a/packages/cli/src/ui/commands/compressCommand.test.ts +++ b/packages/cli/src/ui/commands/compressCommand.test.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { GeminiClient } from '@google/gemini-cli-core'; +import type { GeminiClient } from '@google/gemini-cli-core'; import { vi, describe, it, expect, beforeEach } from 'vitest'; import { compressCommand } from './compressCommand.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; diff --git a/packages/cli/src/ui/commands/compressCommand.ts b/packages/cli/src/ui/commands/compressCommand.ts index 792e8b5b..78e8fa63 100644 --- a/packages/cli/src/ui/commands/compressCommand.ts +++ b/packages/cli/src/ui/commands/compressCommand.ts @@ -4,8 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { HistoryItemCompression, MessageType } from '../types.js'; -import { CommandKind, SlashCommand } from './types.js'; +import type { HistoryItemCompression } from '../types.js'; +import { MessageType } from '../types.js'; +import type { SlashCommand } from './types.js'; +import { CommandKind } from './types.js'; export const compressCommand: SlashCommand = { name: 'compress', diff --git a/packages/cli/src/ui/commands/copyCommand.test.ts b/packages/cli/src/ui/commands/copyCommand.test.ts index da356965..de750904 100644 --- a/packages/cli/src/ui/commands/copyCommand.test.ts +++ b/packages/cli/src/ui/commands/copyCommand.test.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { vi, describe, it, expect, beforeEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { vi, describe, it, expect, beforeEach } from 'vitest'; import { copyCommand } from './copyCommand.js'; import { type CommandContext } from './types.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; diff --git a/packages/cli/src/ui/commands/copyCommand.ts b/packages/cli/src/ui/commands/copyCommand.ts index 9acbd7e0..99115491 100644 --- a/packages/cli/src/ui/commands/copyCommand.ts +++ b/packages/cli/src/ui/commands/copyCommand.ts @@ -5,11 +5,8 @@ */ import { copyToClipboard } from '../utils/commandUtils.js'; -import { - CommandKind, - SlashCommand, - SlashCommandActionReturn, -} from './types.js'; +import type { SlashCommand, SlashCommandActionReturn } from './types.js'; +import { CommandKind } from './types.js'; export const copyCommand: SlashCommand = { name: 'copy', diff --git a/packages/cli/src/ui/commands/directoryCommand.test.tsx b/packages/cli/src/ui/commands/directoryCommand.test.tsx index 8cfbe488..12e20bff 100644 --- a/packages/cli/src/ui/commands/directoryCommand.test.tsx +++ b/packages/cli/src/ui/commands/directoryCommand.test.tsx @@ -6,8 +6,8 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { directoryCommand, expandHomeDir } from './directoryCommand.js'; -import { Config, WorkspaceContext } from '@google/gemini-cli-core'; -import { CommandContext } from './types.js'; +import type { Config, WorkspaceContext } from '@google/gemini-cli-core'; +import type { CommandContext } from './types.js'; import { MessageType } from '../types.js'; import * as os from 'node:os'; import * as path from 'node:path'; diff --git a/packages/cli/src/ui/commands/directoryCommand.tsx b/packages/cli/src/ui/commands/directoryCommand.tsx index 5264fe6d..42770b40 100644 --- a/packages/cli/src/ui/commands/directoryCommand.tsx +++ b/packages/cli/src/ui/commands/directoryCommand.tsx @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { SlashCommand, CommandContext, CommandKind } from './types.js'; +import type { SlashCommand, CommandContext } from './types.js'; +import { CommandKind } from './types.js'; import { MessageType } from '../types.js'; import * as os from 'node:os'; import * as path from 'node:path'; diff --git a/packages/cli/src/ui/commands/helpCommand.ts b/packages/cli/src/ui/commands/helpCommand.ts index 0b71ce8f..40d17c80 100644 --- a/packages/cli/src/ui/commands/helpCommand.ts +++ b/packages/cli/src/ui/commands/helpCommand.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandKind, SlashCommand } from './types.js'; +import type { SlashCommand } from './types.js'; +import { CommandKind } from './types.js'; import { MessageType, type HistoryItemHelp } from '../types.js'; export const helpCommand: SlashCommand = { diff --git a/packages/cli/src/ui/commands/ideCommand.test.ts b/packages/cli/src/ui/commands/ideCommand.test.ts index 9b73acc9..7de1bd7d 100644 --- a/packages/cli/src/ui/commands/ideCommand.test.ts +++ b/packages/cli/src/ui/commands/ideCommand.test.ts @@ -4,15 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { - MockInstance, - vi, - describe, - it, - expect, - beforeEach, - afterEach, -} from 'vitest'; +import type { MockInstance } from 'vitest'; +import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'; import { ideCommand } from './ideCommand.js'; import { type CommandContext } from './types.js'; import { type Config, DetectedIde } from '@google/gemini-cli-core'; diff --git a/packages/cli/src/ui/commands/ideCommand.ts b/packages/cli/src/ui/commands/ideCommand.ts index 1310e194..5a44b6ca 100644 --- a/packages/cli/src/ui/commands/ideCommand.ts +++ b/packages/cli/src/ui/commands/ideCommand.ts @@ -4,22 +4,20 @@ * SPDX-License-Identifier: Apache-2.0 */ +import type { Config, IdeClient, File } from '@google/gemini-cli-core'; import { - Config, - GEMINI_CLI_COMPANION_EXTENSION_NAME, - IDEConnectionStatus, getIdeInstaller, - IdeClient, - type File, + IDEConnectionStatus, ideContext, + GEMINI_CLI_COMPANION_EXTENSION_NAME, } from '@google/gemini-cli-core'; import path from 'node:path'; -import { +import type { CommandContext, SlashCommand, SlashCommandActionReturn, - CommandKind, } from './types.js'; +import { CommandKind } from './types.js'; import { SettingScope } from '../../config/settings.js'; function getIdeStatusMessage(ideClient: IdeClient): { diff --git a/packages/cli/src/ui/commands/initCommand.ts b/packages/cli/src/ui/commands/initCommand.ts index 16721f62..86340e70 100644 --- a/packages/cli/src/ui/commands/initCommand.ts +++ b/packages/cli/src/ui/commands/initCommand.ts @@ -6,12 +6,12 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; -import { +import type { CommandContext, SlashCommand, SlashCommandActionReturn, - CommandKind, } from './types.js'; +import { CommandKind } from './types.js'; export const initCommand: SlashCommand = { name: 'init', diff --git a/packages/cli/src/ui/commands/mcpCommand.test.ts b/packages/cli/src/ui/commands/mcpCommand.test.ts index 8bf27291..212e6e2a 100644 --- a/packages/cli/src/ui/commands/mcpCommand.test.ts +++ b/packages/cli/src/ui/commands/mcpCommand.test.ts @@ -15,8 +15,9 @@ import { DiscoveredMCPTool, } from '@google/gemini-cli-core'; -import { MessageActionReturn } from './types.js'; -import { Type, CallableTool } from '@google/genai'; +import type { MessageActionReturn } from './types.js'; +import type { CallableTool } from '@google/genai'; +import { Type } from '@google/genai'; vi.mock('@google/gemini-cli-core', async (importOriginal) => { const actual = diff --git a/packages/cli/src/ui/commands/mcpCommand.ts b/packages/cli/src/ui/commands/mcpCommand.ts index 67d66604..50e7ffcf 100644 --- a/packages/cli/src/ui/commands/mcpCommand.ts +++ b/packages/cli/src/ui/commands/mcpCommand.ts @@ -4,15 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { SlashCommand, SlashCommandActionReturn, CommandContext, - CommandKind, MessageActionReturn, } from './types.js'; +import { CommandKind } from './types.js'; +import type { DiscoveredMCPPrompt } from '@google/gemini-cli-core'; import { - DiscoveredMCPPrompt, DiscoveredMCPTool, getMCPDiscoveryState, getMCPServerStatus, diff --git a/packages/cli/src/ui/commands/memoryCommand.test.ts b/packages/cli/src/ui/commands/memoryCommand.test.ts index 670ca796..6b27d23a 100644 --- a/packages/cli/src/ui/commands/memoryCommand.test.ts +++ b/packages/cli/src/ui/commands/memoryCommand.test.ts @@ -4,12 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { vi, describe, it, expect, beforeEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { vi, describe, it, expect, beforeEach } from 'vitest'; import { memoryCommand } from './memoryCommand.js'; -import { type CommandContext, SlashCommand } from './types.js'; +import type { SlashCommand, type CommandContext } from './types.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; import { MessageType } from '../types.js'; -import { LoadedSettings } from '../../config/settings.js'; +import type { LoadedSettings } from '../../config/settings.js'; import { getErrorMessage, loadServerHierarchicalMemory, diff --git a/packages/cli/src/ui/commands/memoryCommand.ts b/packages/cli/src/ui/commands/memoryCommand.ts index b046e7f8..2589389a 100644 --- a/packages/cli/src/ui/commands/memoryCommand.ts +++ b/packages/cli/src/ui/commands/memoryCommand.ts @@ -9,11 +9,8 @@ import { loadServerHierarchicalMemory, } from '@google/gemini-cli-core'; import { MessageType } from '../types.js'; -import { - CommandKind, - SlashCommand, - SlashCommandActionReturn, -} from './types.js'; +import type { SlashCommand, SlashCommandActionReturn } from './types.js'; +import { CommandKind } from './types.js'; export const memoryCommand: SlashCommand = { name: 'memory', diff --git a/packages/cli/src/ui/commands/privacyCommand.ts b/packages/cli/src/ui/commands/privacyCommand.ts index ef9d08a0..c403008e 100644 --- a/packages/cli/src/ui/commands/privacyCommand.ts +++ b/packages/cli/src/ui/commands/privacyCommand.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandKind, OpenDialogActionReturn, SlashCommand } from './types.js'; +import type { OpenDialogActionReturn, SlashCommand } from './types.js'; +import { CommandKind } from './types.js'; export const privacyCommand: SlashCommand = { name: 'privacy', diff --git a/packages/cli/src/ui/commands/restoreCommand.test.ts b/packages/cli/src/ui/commands/restoreCommand.test.ts index a08c2cf3..3e6199f1 100644 --- a/packages/cli/src/ui/commands/restoreCommand.test.ts +++ b/packages/cli/src/ui/commands/restoreCommand.test.ts @@ -11,7 +11,7 @@ import * as path from 'node:path'; import { restoreCommand } from './restoreCommand.js'; import { type CommandContext } from './types.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; -import { Config, GitService } from '@google/gemini-cli-core'; +import type { Config, GitService } from '@google/gemini-cli-core'; describe('restoreCommand', () => { let mockContext: CommandContext; diff --git a/packages/cli/src/ui/commands/restoreCommand.ts b/packages/cli/src/ui/commands/restoreCommand.ts index 7908dc23..e2eb1159 100644 --- a/packages/cli/src/ui/commands/restoreCommand.ts +++ b/packages/cli/src/ui/commands/restoreCommand.ts @@ -12,7 +12,7 @@ import { type SlashCommandActionReturn, CommandKind, } from './types.js'; -import { Config } from '@google/gemini-cli-core'; +import type { Config } from '@google/gemini-cli-core'; async function restoreAction( context: CommandContext, diff --git a/packages/cli/src/ui/commands/settingsCommand.ts b/packages/cli/src/ui/commands/settingsCommand.ts index 26807852..b9baf2f7 100644 --- a/packages/cli/src/ui/commands/settingsCommand.ts +++ b/packages/cli/src/ui/commands/settingsCommand.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandKind, OpenDialogActionReturn, SlashCommand } from './types.js'; +import type { OpenDialogActionReturn, SlashCommand } from './types.js'; +import { CommandKind } from './types.js'; export const settingsCommand: SlashCommand = { name: 'settings', diff --git a/packages/cli/src/ui/commands/setupGithubCommand.test.ts b/packages/cli/src/ui/commands/setupGithubCommand.test.ts index e48bb051..bac02070 100644 --- a/packages/cli/src/ui/commands/setupGithubCommand.test.ts +++ b/packages/cli/src/ui/commands/setupGithubCommand.test.ts @@ -15,7 +15,7 @@ import { updateGitignore, GITHUB_WORKFLOW_PATHS, } from './setupGithubCommand.js'; -import { CommandContext, ToolActionReturn } from './types.js'; +import type { CommandContext, ToolActionReturn } from './types.js'; import * as commandUtils from '../utils/commandUtils.js'; vi.mock('child_process'); diff --git a/packages/cli/src/ui/commands/setupGithubCommand.ts b/packages/cli/src/ui/commands/setupGithubCommand.ts index 7d7a3b00..46b46cba 100644 --- a/packages/cli/src/ui/commands/setupGithubCommand.ts +++ b/packages/cli/src/ui/commands/setupGithubCommand.ts @@ -9,7 +9,7 @@ import * as fs from 'node:fs'; import { Writable } from 'node:stream'; import { ProxyAgent } from 'undici'; -import { CommandContext } from '../../ui/commands/types.js'; +import type { CommandContext } from '../../ui/commands/types.js'; import { getGitRepoRoot, getLatestGitHubRelease, @@ -17,11 +17,8 @@ import { getGitHubRepoInfo, } from '../../utils/gitUtils.js'; -import { - CommandKind, - SlashCommand, - SlashCommandActionReturn, -} from './types.js'; +import type { SlashCommand, SlashCommandActionReturn } from './types.js'; +import { CommandKind } from './types.js'; import { getUrlOpenCommand } from '../../ui/utils/commandUtils.js'; export const GITHUB_WORKFLOW_PATHS = [ diff --git a/packages/cli/src/ui/commands/statsCommand.ts b/packages/cli/src/ui/commands/statsCommand.ts index e9e69756..1fe628ab 100644 --- a/packages/cli/src/ui/commands/statsCommand.ts +++ b/packages/cli/src/ui/commands/statsCommand.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { MessageType, HistoryItemStats } from '../types.js'; +import type { HistoryItemStats } from '../types.js'; +import { MessageType } from '../types.js'; import { formatDuration } from '../utils/formatters.js'; import { type CommandContext, diff --git a/packages/cli/src/ui/commands/terminalSetupCommand.test.ts b/packages/cli/src/ui/commands/terminalSetupCommand.test.ts index 85f8735e..d0d3d6c6 100644 --- a/packages/cli/src/ui/commands/terminalSetupCommand.test.ts +++ b/packages/cli/src/ui/commands/terminalSetupCommand.test.ts @@ -7,7 +7,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { terminalSetupCommand } from './terminalSetupCommand.js'; import * as terminalSetupModule from '../utils/terminalSetup.js'; -import { CommandContext } from './types.js'; +import type { CommandContext } from './types.js'; vi.mock('../utils/terminalSetup.js'); diff --git a/packages/cli/src/ui/commands/terminalSetupCommand.ts b/packages/cli/src/ui/commands/terminalSetupCommand.ts index 11520c0e..09e5240c 100644 --- a/packages/cli/src/ui/commands/terminalSetupCommand.ts +++ b/packages/cli/src/ui/commands/terminalSetupCommand.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { MessageActionReturn, SlashCommand, CommandKind } from './types.js'; +import type { MessageActionReturn, SlashCommand } from './types.js'; +import { CommandKind } from './types.js'; import { terminalSetup } from '../utils/terminalSetup.js'; /** diff --git a/packages/cli/src/ui/commands/themeCommand.ts b/packages/cli/src/ui/commands/themeCommand.ts index 755d59d9..585c84f9 100644 --- a/packages/cli/src/ui/commands/themeCommand.ts +++ b/packages/cli/src/ui/commands/themeCommand.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandKind, OpenDialogActionReturn, SlashCommand } from './types.js'; +import type { OpenDialogActionReturn, SlashCommand } from './types.js'; +import { CommandKind } from './types.js'; export const themeCommand: SlashCommand = { name: 'theme', diff --git a/packages/cli/src/ui/commands/toolsCommand.test.ts b/packages/cli/src/ui/commands/toolsCommand.test.ts index 01399512..32f45023 100644 --- a/packages/cli/src/ui/commands/toolsCommand.test.ts +++ b/packages/cli/src/ui/commands/toolsCommand.test.ts @@ -4,11 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi } from 'vitest'; +import type { vi } from 'vitest'; +import { describe, it, expect } from 'vitest'; import { toolsCommand } from './toolsCommand.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; import { MessageType } from '../types.js'; -import { Tool } from '@google/gemini-cli-core'; +import type { Tool } from '@google/gemini-cli-core'; // Mock tools for testing const mockTools = [ diff --git a/packages/cli/src/ui/commands/types.ts b/packages/cli/src/ui/commands/types.ts index 876409d0..d701419e 100644 --- a/packages/cli/src/ui/commands/types.ts +++ b/packages/cli/src/ui/commands/types.ts @@ -5,13 +5,12 @@ */ import { type ReactNode } from 'react'; -import { Content } from '@google/genai'; -import { HistoryItemWithoutId } from '../types.js'; -import { Config, GitService, Logger } from '@google/gemini-cli-core'; -import { LoadedSettings } from '../../config/settings.js'; -import { UseHistoryManagerReturn } from '../hooks/useHistoryManager.js'; -import type { HistoryItem } from '../types.js'; -import { SessionStatsState } from '../contexts/SessionContext.js'; +import type { Content } from '@google/genai'; +import type { HistoryItemWithoutId, HistoryItem } from '../types.js'; +import type { Config, GitService, Logger } from '@google/gemini-cli-core'; +import type { LoadedSettings } from '../../config/settings.js'; +import type { UseHistoryManagerReturn } from '../hooks/useHistoryManager.js'; +import type { SessionStatsState } from '../contexts/SessionContext.js'; // Grouped dependencies for clarity and easier mocking export interface CommandContext { diff --git a/packages/cli/src/ui/commands/vimCommand.ts b/packages/cli/src/ui/commands/vimCommand.ts index 40e658df..b398cc48 100644 --- a/packages/cli/src/ui/commands/vimCommand.ts +++ b/packages/cli/src/ui/commands/vimCommand.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CommandKind, SlashCommand } from './types.js'; +import type { SlashCommand } from './types.js'; +import { CommandKind } from './types.js'; export const vimCommand: SlashCommand = { name: 'vim', diff --git a/packages/cli/src/ui/components/AboutBox.tsx b/packages/cli/src/ui/components/AboutBox.tsx index 9970ed4d..7f26e082 100644 --- a/packages/cli/src/ui/components/AboutBox.tsx +++ b/packages/cli/src/ui/components/AboutBox.tsx @@ -4,11 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { GIT_COMMIT_INFO } from '../../generated/git-commit.js'; -import { UserTierId } from '@google/gemini-cli-core'; +import type { UserTierId } from '@google/gemini-cli-core'; import { getLicenseDisplay } from '../../utils/license.js'; interface AboutBoxProps { diff --git a/packages/cli/src/ui/components/AuthDialog.tsx b/packages/cli/src/ui/components/AuthDialog.tsx index 483308dc..3a7837a0 100644 --- a/packages/cli/src/ui/components/AuthDialog.tsx +++ b/packages/cli/src/ui/components/AuthDialog.tsx @@ -4,11 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React, { useState } from 'react'; +import type React from 'react'; +import { useState } from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { RadioButtonSelect } from './shared/RadioButtonSelect.js'; -import { LoadedSettings, SettingScope } from '../../config/settings.js'; +import type { LoadedSettings } from '../../config/settings.js'; +import { SettingScope } from '../../config/settings.js'; import { AuthType } from '@google/gemini-cli-core'; import { validateAuthMethod } from '../../config/auth.js'; import { useKeypress } from '../hooks/useKeypress.js'; diff --git a/packages/cli/src/ui/components/AuthInProgress.tsx b/packages/cli/src/ui/components/AuthInProgress.tsx index 53377c7c..ce8b5443 100644 --- a/packages/cli/src/ui/components/AuthInProgress.tsx +++ b/packages/cli/src/ui/components/AuthInProgress.tsx @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React, { useState, useEffect } from 'react'; +import type React from 'react'; +import { useState, useEffect } from 'react'; import { Box, Text } from 'ink'; import Spinner from 'ink-spinner'; import { Colors } from '../colors.js'; diff --git a/packages/cli/src/ui/components/AutoAcceptIndicator.tsx b/packages/cli/src/ui/components/AutoAcceptIndicator.tsx index f8d50fd0..273634de 100644 --- a/packages/cli/src/ui/components/AutoAcceptIndicator.tsx +++ b/packages/cli/src/ui/components/AutoAcceptIndicator.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { ApprovalMode } from '@google/gemini-cli-core'; diff --git a/packages/cli/src/ui/components/ConsoleSummaryDisplay.tsx b/packages/cli/src/ui/components/ConsoleSummaryDisplay.tsx index c79cc096..68700f27 100644 --- a/packages/cli/src/ui/components/ConsoleSummaryDisplay.tsx +++ b/packages/cli/src/ui/components/ConsoleSummaryDisplay.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; diff --git a/packages/cli/src/ui/components/ContextSummaryDisplay.test.tsx b/packages/cli/src/ui/components/ContextSummaryDisplay.test.tsx index b356e796..1c77c2a8 100644 --- a/packages/cli/src/ui/components/ContextSummaryDisplay.test.tsx +++ b/packages/cli/src/ui/components/ContextSummaryDisplay.test.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { render } from 'ink-testing-library'; import { describe, it, expect, vi } from 'vitest'; import { ContextSummaryDisplay } from './ContextSummaryDisplay.js'; diff --git a/packages/cli/src/ui/components/ContextSummaryDisplay.tsx b/packages/cli/src/ui/components/ContextSummaryDisplay.tsx index 0c946385..b3a9286b 100644 --- a/packages/cli/src/ui/components/ContextSummaryDisplay.tsx +++ b/packages/cli/src/ui/components/ContextSummaryDisplay.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { type IdeContext, type MCPServerConfig } from '@google/gemini-cli-core'; diff --git a/packages/cli/src/ui/components/DetailedMessagesDisplay.tsx b/packages/cli/src/ui/components/DetailedMessagesDisplay.tsx index 86492e09..45497722 100644 --- a/packages/cli/src/ui/components/DetailedMessagesDisplay.tsx +++ b/packages/cli/src/ui/components/DetailedMessagesDisplay.tsx @@ -4,10 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; -import { ConsoleMessageItem } from '../types.js'; +import type { ConsoleMessageItem } from '../types.js'; import { MaxSizedBox } from './shared/MaxSizedBox.js'; interface DetailedMessagesDisplayProps { diff --git a/packages/cli/src/ui/components/EditorSettingsDialog.tsx b/packages/cli/src/ui/components/EditorSettingsDialog.tsx index 3c4c518b..77c4e1e2 100644 --- a/packages/cli/src/ui/components/EditorSettingsDialog.tsx +++ b/packages/cli/src/ui/components/EditorSettingsDialog.tsx @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React, { useState } from 'react'; +import type React from 'react'; +import { useState } from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { @@ -13,8 +14,10 @@ import { type EditorDisplay, } from '../editors/editorSettingsManager.js'; import { RadioButtonSelect } from './shared/RadioButtonSelect.js'; -import { LoadedSettings, SettingScope } from '../../config/settings.js'; -import { EditorType, isEditorAvailable } from '@google/gemini-cli-core'; +import type { LoadedSettings } from '../../config/settings.js'; +import { SettingScope } from '../../config/settings.js'; +import type { EditorType } from '@google/gemini-cli-core'; +import { isEditorAvailable } from '@google/gemini-cli-core'; import { useKeypress } from '../hooks/useKeypress.js'; interface EditorDialogProps { diff --git a/packages/cli/src/ui/components/FolderTrustDialog.tsx b/packages/cli/src/ui/components/FolderTrustDialog.tsx index ab141aab..3b827279 100644 --- a/packages/cli/src/ui/components/FolderTrustDialog.tsx +++ b/packages/cli/src/ui/components/FolderTrustDialog.tsx @@ -5,12 +5,10 @@ */ import { Box, Text } from 'ink'; -import React from 'react'; +import type React from 'react'; import { Colors } from '../colors.js'; -import { - RadioButtonSelect, - RadioSelectItem, -} from './shared/RadioButtonSelect.js'; +import type { RadioSelectItem } from './shared/RadioButtonSelect.js'; +import { RadioButtonSelect } from './shared/RadioButtonSelect.js'; import { useKeypress } from '../hooks/useKeypress.js'; import * as process from 'node:process'; diff --git a/packages/cli/src/ui/components/Footer.tsx b/packages/cli/src/ui/components/Footer.tsx index ee644bc5..a46d2f64 100644 --- a/packages/cli/src/ui/components/Footer.tsx +++ b/packages/cli/src/ui/components/Footer.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { theme } from '../semantic-colors.js'; import { shortenPath, tildeifyPath } from '@google/gemini-cli-core'; diff --git a/packages/cli/src/ui/components/GeminiRespondingSpinner.tsx b/packages/cli/src/ui/components/GeminiRespondingSpinner.tsx index 97e10cb3..f4ed235f 100644 --- a/packages/cli/src/ui/components/GeminiRespondingSpinner.tsx +++ b/packages/cli/src/ui/components/GeminiRespondingSpinner.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Text } from 'ink'; import Spinner from 'ink-spinner'; import type { SpinnerName } from 'cli-spinners'; diff --git a/packages/cli/src/ui/components/Header.tsx b/packages/cli/src/ui/components/Header.tsx index 0894ad14..5d09ec3b 100644 --- a/packages/cli/src/ui/components/Header.tsx +++ b/packages/cli/src/ui/components/Header.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import Gradient from 'ink-gradient'; import { Colors } from '../colors.js'; diff --git a/packages/cli/src/ui/components/Help.tsx b/packages/cli/src/ui/components/Help.tsx index 533e814c..6d06a410 100644 --- a/packages/cli/src/ui/components/Help.tsx +++ b/packages/cli/src/ui/components/Help.tsx @@ -4,10 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; -import { SlashCommand } from '../commands/types.js'; +import type { SlashCommand } from '../commands/types.js'; interface Help { commands: readonly SlashCommand[]; diff --git a/packages/cli/src/ui/components/HistoryItemDisplay.test.tsx b/packages/cli/src/ui/components/HistoryItemDisplay.test.tsx index 234ca968..81a84a3b 100644 --- a/packages/cli/src/ui/components/HistoryItemDisplay.test.tsx +++ b/packages/cli/src/ui/components/HistoryItemDisplay.test.tsx @@ -7,7 +7,8 @@ import { render } from 'ink-testing-library'; import { describe, it, expect, vi } from 'vitest'; import { HistoryItemDisplay } from './HistoryItemDisplay.js'; -import { HistoryItem, MessageType } from '../types.js'; +import type { HistoryItem } from '../types.js'; +import { MessageType } from '../types.js'; import { SessionStatsProvider } from '../contexts/SessionContext.js'; // Mock child components diff --git a/packages/cli/src/ui/components/HistoryItemDisplay.tsx b/packages/cli/src/ui/components/HistoryItemDisplay.tsx index 5ccba8b7..ed82aedf 100644 --- a/packages/cli/src/ui/components/HistoryItemDisplay.tsx +++ b/packages/cli/src/ui/components/HistoryItemDisplay.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import type { HistoryItem } from '../types.js'; import { UserMessage } from './messages/UserMessage.js'; import { UserShellMessage } from './messages/UserShellMessage.js'; @@ -20,9 +20,9 @@ import { StatsDisplay } from './StatsDisplay.js'; import { ModelStatsDisplay } from './ModelStatsDisplay.js'; import { ToolStatsDisplay } from './ToolStatsDisplay.js'; import { SessionSummaryDisplay } from './SessionSummaryDisplay.js'; -import { Config } from '@google/gemini-cli-core'; +import type { Config } from '@google/gemini-cli-core'; import { Help } from './Help.js'; -import { SlashCommand } from '../commands/types.js'; +import type { SlashCommand } from '../commands/types.js'; interface HistoryItemDisplayProps { item: HistoryItem; diff --git a/packages/cli/src/ui/components/InputPrompt.test.tsx b/packages/cli/src/ui/components/InputPrompt.test.tsx index 61dc053f..faea0b82 100644 --- a/packages/cli/src/ui/components/InputPrompt.test.tsx +++ b/packages/cli/src/ui/components/InputPrompt.test.tsx @@ -6,28 +6,20 @@ import { renderWithProviders } from '../../test-utils/render.js'; import { waitFor } from '@testing-library/react'; -import { InputPrompt, InputPromptProps } from './InputPrompt.js'; +import type { InputPromptProps } from './InputPrompt.js'; +import { InputPrompt } from './InputPrompt.js'; import type { TextBuffer } from './shared/text-buffer.js'; -import { Config } from '@google/gemini-cli-core'; +import type { Config } from '@google/gemini-cli-core'; import * as path from 'node:path'; -import { - CommandContext, - SlashCommand, - CommandKind, -} from '../commands/types.js'; +import type { CommandContext, SlashCommand } from '../commands/types.js'; +import { CommandKind } from '../commands/types.js'; import { describe, it, expect, beforeEach, vi } from 'vitest'; -import { - useShellHistory, - UseShellHistoryReturn, -} from '../hooks/useShellHistory.js'; -import { - useCommandCompletion, - UseCommandCompletionReturn, -} from '../hooks/useCommandCompletion.js'; -import { - useInputHistory, - UseInputHistoryReturn, -} from '../hooks/useInputHistory.js'; +import type { UseShellHistoryReturn } from '../hooks/useShellHistory.js'; +import { useShellHistory } from '../hooks/useShellHistory.js'; +import type { UseCommandCompletionReturn } from '../hooks/useCommandCompletion.js'; +import { useCommandCompletion } from '../hooks/useCommandCompletion.js'; +import type { UseInputHistoryReturn } from '../hooks/useInputHistory.js'; +import { useInputHistory } from '../hooks/useInputHistory.js'; import * as clipboardUtils from '../utils/clipboardUtils.js'; import { createMockCommandContext } from '../../test-utils/mockCommandContext.js'; diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx index 88193807..09897885 100644 --- a/packages/cli/src/ui/components/InputPrompt.tsx +++ b/packages/cli/src/ui/components/InputPrompt.tsx @@ -4,22 +4,25 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React, { useCallback, useEffect, useState, useRef } from 'react'; +import type React from 'react'; +import { useCallback, useEffect, useState, useRef } from 'react'; import { Box, Text } from 'ink'; import { theme } from '../semantic-colors.js'; import { SuggestionsDisplay } from './SuggestionsDisplay.js'; import { useInputHistory } from '../hooks/useInputHistory.js'; -import { TextBuffer, logicalPosToOffset } from './shared/text-buffer.js'; +import type { TextBuffer } from './shared/text-buffer.js'; +import { logicalPosToOffset } from './shared/text-buffer.js'; import { cpSlice, cpLen, toCodePoints } from '../utils/textUtils.js'; import chalk from 'chalk'; import stringWidth from 'string-width'; import { useShellHistory } from '../hooks/useShellHistory.js'; import { useReverseSearchCompletion } from '../hooks/useReverseSearchCompletion.js'; import { useCommandCompletion } from '../hooks/useCommandCompletion.js'; -import { useKeypress, Key } from '../hooks/useKeypress.js'; +import type { Key } from '../hooks/useKeypress.js'; +import { useKeypress } from '../hooks/useKeypress.js'; import { keyMatchers, Command } from '../keyMatchers.js'; -import { CommandContext, SlashCommand } from '../commands/types.js'; -import { Config } from '@google/gemini-cli-core'; +import type { CommandContext, SlashCommand } from '../commands/types.js'; +import type { Config } from '@google/gemini-cli-core'; import { clipboardHasImage, saveClipboardImage, diff --git a/packages/cli/src/ui/components/LoadingIndicator.tsx b/packages/cli/src/ui/components/LoadingIndicator.tsx index 7ac356dd..b7a88ee4 100644 --- a/packages/cli/src/ui/components/LoadingIndicator.tsx +++ b/packages/cli/src/ui/components/LoadingIndicator.tsx @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { ThoughtSummary } from '@google/gemini-cli-core'; -import React from 'react'; +import type { ThoughtSummary } from '@google/gemini-cli-core'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { useStreamingContext } from '../contexts/StreamingContext.js'; diff --git a/packages/cli/src/ui/components/MemoryUsageDisplay.tsx b/packages/cli/src/ui/components/MemoryUsageDisplay.tsx index d768445c..6356f615 100644 --- a/packages/cli/src/ui/components/MemoryUsageDisplay.tsx +++ b/packages/cli/src/ui/components/MemoryUsageDisplay.tsx @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React, { useEffect, useState } from 'react'; +import type React from 'react'; +import { useEffect, useState } from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import process from 'node:process'; diff --git a/packages/cli/src/ui/components/ModelStatsDisplay.test.tsx b/packages/cli/src/ui/components/ModelStatsDisplay.test.tsx index 6adf2652..591c2a28 100644 --- a/packages/cli/src/ui/components/ModelStatsDisplay.test.tsx +++ b/packages/cli/src/ui/components/ModelStatsDisplay.test.tsx @@ -8,7 +8,7 @@ import { render } from 'ink-testing-library'; import { describe, it, expect, vi, beforeAll, afterAll } from 'vitest'; import { ModelStatsDisplay } from './ModelStatsDisplay.js'; import * as SessionContext from '../contexts/SessionContext.js'; -import { SessionMetrics } from '../contexts/SessionContext.js'; +import type { SessionMetrics } from '../contexts/SessionContext.js'; // Mock the context to provide controlled data for testing vi.mock('../contexts/SessionContext.js', async (importOriginal) => { diff --git a/packages/cli/src/ui/components/ModelStatsDisplay.tsx b/packages/cli/src/ui/components/ModelStatsDisplay.tsx index 1911e757..2316cf8f 100644 --- a/packages/cli/src/ui/components/ModelStatsDisplay.tsx +++ b/packages/cli/src/ui/components/ModelStatsDisplay.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { formatDuration } from '../utils/formatters.js'; @@ -13,7 +13,8 @@ import { calculateCacheHitRate, calculateErrorRate, } from '../utils/computeStats.js'; -import { useSessionStats, ModelMetrics } from '../contexts/SessionContext.js'; +import type { ModelMetrics } from '../contexts/SessionContext.js'; +import { useSessionStats } from '../contexts/SessionContext.js'; const METRIC_COL_WIDTH = 28; const MODEL_COL_WIDTH = 22; diff --git a/packages/cli/src/ui/components/PrepareLabel.tsx b/packages/cli/src/ui/components/PrepareLabel.tsx index 652a77a6..d89c1fe4 100644 --- a/packages/cli/src/ui/components/PrepareLabel.tsx +++ b/packages/cli/src/ui/components/PrepareLabel.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Text } from 'ink'; import { Colors } from '../colors.js'; diff --git a/packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx b/packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx index 816948f2..766e851a 100644 --- a/packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx +++ b/packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx @@ -8,7 +8,7 @@ import { render } from 'ink-testing-library'; import { describe, it, expect, vi } from 'vitest'; import { SessionSummaryDisplay } from './SessionSummaryDisplay.js'; import * as SessionContext from '../contexts/SessionContext.js'; -import { SessionMetrics } from '../contexts/SessionContext.js'; +import type { SessionMetrics } from '../contexts/SessionContext.js'; vi.mock('../contexts/SessionContext.js', async (importOriginal) => { const actual = await importOriginal(); diff --git a/packages/cli/src/ui/components/SessionSummaryDisplay.tsx b/packages/cli/src/ui/components/SessionSummaryDisplay.tsx index 34e3cc72..d4a0a11d 100644 --- a/packages/cli/src/ui/components/SessionSummaryDisplay.tsx +++ b/packages/cli/src/ui/components/SessionSummaryDisplay.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { StatsDisplay } from './StatsDisplay.js'; interface SessionSummaryDisplayProps { diff --git a/packages/cli/src/ui/components/SettingsDialog.tsx b/packages/cli/src/ui/components/SettingsDialog.tsx index c9685cd5..724e45b1 100644 --- a/packages/cli/src/ui/components/SettingsDialog.tsx +++ b/packages/cli/src/ui/components/SettingsDialog.tsx @@ -7,11 +7,8 @@ import React, { useState, useEffect } from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; -import { - LoadedSettings, - SettingScope, - Settings, -} from '../../config/settings.js'; +import type { LoadedSettings, Settings } from '../../config/settings.js'; +import { SettingScope } from '../../config/settings.js'; import { getScopeItems, getScopeMessageForSetting, diff --git a/packages/cli/src/ui/components/ShellConfirmationDialog.tsx b/packages/cli/src/ui/components/ShellConfirmationDialog.tsx index 5a210577..43159956 100644 --- a/packages/cli/src/ui/components/ShellConfirmationDialog.tsx +++ b/packages/cli/src/ui/components/ShellConfirmationDialog.tsx @@ -6,13 +6,11 @@ import { ToolConfirmationOutcome } from '@google/gemini-cli-core'; import { Box, Text } from 'ink'; -import React from 'react'; +import type React from 'react'; import { Colors } from '../colors.js'; import { RenderInline } from '../utils/InlineMarkdownRenderer.js'; -import { - RadioButtonSelect, - RadioSelectItem, -} from './shared/RadioButtonSelect.js'; +import type { RadioSelectItem } from './shared/RadioButtonSelect.js'; +import { RadioButtonSelect } from './shared/RadioButtonSelect.js'; import { useKeypress } from '../hooks/useKeypress.js'; export interface ShellConfirmationRequest { diff --git a/packages/cli/src/ui/components/ShellModeIndicator.tsx b/packages/cli/src/ui/components/ShellModeIndicator.tsx index f5b11b24..23d71740 100644 --- a/packages/cli/src/ui/components/ShellModeIndicator.tsx +++ b/packages/cli/src/ui/components/ShellModeIndicator.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; diff --git a/packages/cli/src/ui/components/StatsDisplay.test.tsx b/packages/cli/src/ui/components/StatsDisplay.test.tsx index 6d6fa809..6820171c 100644 --- a/packages/cli/src/ui/components/StatsDisplay.test.tsx +++ b/packages/cli/src/ui/components/StatsDisplay.test.tsx @@ -8,7 +8,7 @@ import { render } from 'ink-testing-library'; import { describe, it, expect, vi } from 'vitest'; import { StatsDisplay } from './StatsDisplay.js'; import * as SessionContext from '../contexts/SessionContext.js'; -import { SessionMetrics } from '../contexts/SessionContext.js'; +import type { SessionMetrics } from '../contexts/SessionContext.js'; // Mock the context to provide controlled data for testing vi.mock('../contexts/SessionContext.js', async (importOriginal) => { diff --git a/packages/cli/src/ui/components/StatsDisplay.tsx b/packages/cli/src/ui/components/StatsDisplay.tsx index bcf02906..dd9879d7 100644 --- a/packages/cli/src/ui/components/StatsDisplay.tsx +++ b/packages/cli/src/ui/components/StatsDisplay.tsx @@ -4,12 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import Gradient from 'ink-gradient'; import { theme } from '../semantic-colors.js'; import { formatDuration } from '../utils/formatters.js'; -import { useSessionStats, ModelMetrics } from '../contexts/SessionContext.js'; +import type { ModelMetrics } from '../contexts/SessionContext.js'; +import { useSessionStats } from '../contexts/SessionContext.js'; import { getStatusColor, TOOL_SUCCESS_RATE_HIGH, diff --git a/packages/cli/src/ui/components/ThemeDialog.tsx b/packages/cli/src/ui/components/ThemeDialog.tsx index 16ecfc8f..70323d69 100644 --- a/packages/cli/src/ui/components/ThemeDialog.tsx +++ b/packages/cli/src/ui/components/ThemeDialog.tsx @@ -4,14 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React, { useCallback, useState } from 'react'; +import type React from 'react'; +import { useCallback, useState } from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { themeManager, DEFAULT_THEME } from '../themes/theme-manager.js'; import { RadioButtonSelect } from './shared/RadioButtonSelect.js'; import { DiffRenderer } from './messages/DiffRenderer.js'; import { colorizeCode } from '../utils/CodeColorizer.js'; -import { LoadedSettings, SettingScope } from '../../config/settings.js'; +import type { LoadedSettings } from '../../config/settings.js'; +import { SettingScope } from '../../config/settings.js'; import { getScopeItems, getScopeMessageForSetting, diff --git a/packages/cli/src/ui/components/Tips.tsx b/packages/cli/src/ui/components/Tips.tsx index 4aa6c112..7fb9431c 100644 --- a/packages/cli/src/ui/components/Tips.tsx +++ b/packages/cli/src/ui/components/Tips.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { type Config } from '@google/gemini-cli-core'; diff --git a/packages/cli/src/ui/components/ToolStatsDisplay.test.tsx b/packages/cli/src/ui/components/ToolStatsDisplay.test.tsx index e48fcc83..cf2d7f13 100644 --- a/packages/cli/src/ui/components/ToolStatsDisplay.test.tsx +++ b/packages/cli/src/ui/components/ToolStatsDisplay.test.tsx @@ -8,7 +8,7 @@ import { render } from 'ink-testing-library'; import { describe, it, expect, vi } from 'vitest'; import { ToolStatsDisplay } from './ToolStatsDisplay.js'; import * as SessionContext from '../contexts/SessionContext.js'; -import { SessionMetrics } from '../contexts/SessionContext.js'; +import type { SessionMetrics } from '../contexts/SessionContext.js'; // Mock the context to provide controlled data for testing vi.mock('../contexts/SessionContext.js', async (importOriginal) => { diff --git a/packages/cli/src/ui/components/ToolStatsDisplay.tsx b/packages/cli/src/ui/components/ToolStatsDisplay.tsx index f2335d9e..e77e191c 100644 --- a/packages/cli/src/ui/components/ToolStatsDisplay.tsx +++ b/packages/cli/src/ui/components/ToolStatsDisplay.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { formatDuration } from '../utils/formatters.js'; @@ -16,7 +16,7 @@ import { USER_AGREEMENT_RATE_MEDIUM, } from '../utils/displayUtils.js'; import { useSessionStats } from '../contexts/SessionContext.js'; -import { ToolCallStats } from '@google/gemini-cli-core'; +import type { ToolCallStats } from '@google/gemini-cli-core'; const TOOL_NAME_COL_WIDTH = 25; const CALLS_COL_WIDTH = 8; diff --git a/packages/cli/src/ui/components/messages/CompressionMessage.tsx b/packages/cli/src/ui/components/messages/CompressionMessage.tsx index 6aededbb..993ec303 100644 --- a/packages/cli/src/ui/components/messages/CompressionMessage.tsx +++ b/packages/cli/src/ui/components/messages/CompressionMessage.tsx @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; -import { CompressionProps } from '../../types.js'; +import type { CompressionProps } from '../../types.js'; import Spinner from 'ink-spinner'; import { Colors } from '../../colors.js'; import { SCREEN_READER_MODEL_PREFIX } from '../../constants.js'; diff --git a/packages/cli/src/ui/components/messages/DiffRenderer.tsx b/packages/cli/src/ui/components/messages/DiffRenderer.tsx index b6f2aac3..08a775d2 100644 --- a/packages/cli/src/ui/components/messages/DiffRenderer.tsx +++ b/packages/cli/src/ui/components/messages/DiffRenderer.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { EOL } from 'node:os'; import { Colors } from '../../colors.js'; diff --git a/packages/cli/src/ui/components/messages/ErrorMessage.tsx b/packages/cli/src/ui/components/messages/ErrorMessage.tsx index edbea435..52a03a89 100644 --- a/packages/cli/src/ui/components/messages/ErrorMessage.tsx +++ b/packages/cli/src/ui/components/messages/ErrorMessage.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Text, Box } from 'ink'; import { Colors } from '../../colors.js'; diff --git a/packages/cli/src/ui/components/messages/GeminiMessage.tsx b/packages/cli/src/ui/components/messages/GeminiMessage.tsx index cfc3a297..3476a44d 100644 --- a/packages/cli/src/ui/components/messages/GeminiMessage.tsx +++ b/packages/cli/src/ui/components/messages/GeminiMessage.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Text, Box } from 'ink'; import { MarkdownDisplay } from '../../utils/MarkdownDisplay.js'; import { Colors } from '../../colors.js'; diff --git a/packages/cli/src/ui/components/messages/GeminiMessageContent.tsx b/packages/cli/src/ui/components/messages/GeminiMessageContent.tsx index b5f01599..05bdb75c 100644 --- a/packages/cli/src/ui/components/messages/GeminiMessageContent.tsx +++ b/packages/cli/src/ui/components/messages/GeminiMessageContent.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box } from 'ink'; import { MarkdownDisplay } from '../../utils/MarkdownDisplay.js'; diff --git a/packages/cli/src/ui/components/messages/InfoMessage.tsx b/packages/cli/src/ui/components/messages/InfoMessage.tsx index 18175875..3d7866be 100644 --- a/packages/cli/src/ui/components/messages/InfoMessage.tsx +++ b/packages/cli/src/ui/components/messages/InfoMessage.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Text, Box } from 'ink'; import { Colors } from '../../colors.js'; import { RenderInline } from '../../utils/InlineMarkdownRenderer.js'; diff --git a/packages/cli/src/ui/components/messages/ToolConfirmationMessage.test.tsx b/packages/cli/src/ui/components/messages/ToolConfirmationMessage.test.tsx index 6950b02e..6e54e7a4 100644 --- a/packages/cli/src/ui/components/messages/ToolConfirmationMessage.test.tsx +++ b/packages/cli/src/ui/components/messages/ToolConfirmationMessage.test.tsx @@ -6,7 +6,7 @@ import { describe, it, expect, vi } from 'vitest'; import { ToolConfirmationMessage } from './ToolConfirmationMessage.js'; -import { ToolCallConfirmationDetails } from '@google/gemini-cli-core'; +import type { ToolCallConfirmationDetails } from '@google/gemini-cli-core'; import { renderWithProviders } from '../../../test-utils/render.js'; describe('ToolConfirmationMessage', () => { diff --git a/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx b/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx index 690da7e5..6dee3d74 100644 --- a/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx +++ b/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx @@ -4,22 +4,20 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { DiffRenderer } from './DiffRenderer.js'; import { Colors } from '../../colors.js'; import { RenderInline } from '../../utils/InlineMarkdownRenderer.js'; -import { +import type { ToolCallConfirmationDetails, - ToolConfirmationOutcome, ToolExecuteConfirmationDetails, ToolMcpConfirmationDetails, Config, } from '@google/gemini-cli-core'; -import { - RadioButtonSelect, - RadioSelectItem, -} from '../shared/RadioButtonSelect.js'; +import { ToolConfirmationOutcome } from '@google/gemini-cli-core'; +import type { RadioSelectItem } from '../shared/RadioButtonSelect.js'; +import { RadioButtonSelect } from '../shared/RadioButtonSelect.js'; import { MaxSizedBox } from '../shared/MaxSizedBox.js'; import { useKeypress } from '../../hooks/useKeypress.js'; diff --git a/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx b/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx index 8e5961e9..ca6e9f76 100644 --- a/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx +++ b/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx @@ -8,8 +8,11 @@ import { render } from 'ink-testing-library'; import { describe, it, expect, vi } from 'vitest'; import { Text } from 'ink'; import { ToolGroupMessage } from './ToolGroupMessage.js'; -import { IndividualToolCallDisplay, ToolCallStatus } from '../../types.js'; -import { Config, ToolCallConfirmationDetails } from '@google/gemini-cli-core'; +import { type IndividualToolCallDisplay, ToolCallStatus } from '../../types.js'; +import type { + Config, + ToolCallConfirmationDetails, +} from '@google/gemini-cli-core'; // Mock child components to isolate ToolGroupMessage behavior vi.mock('./ToolMessage.js', () => ({ diff --git a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx index a320194b..a200f98d 100644 --- a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx +++ b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx @@ -4,13 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React, { useMemo } from 'react'; +import type React from 'react'; +import { useMemo } from 'react'; import { Box } from 'ink'; -import { IndividualToolCallDisplay, ToolCallStatus } from '../../types.js'; +import type { IndividualToolCallDisplay } from '../../types.js'; +import { ToolCallStatus } from '../../types.js'; import { ToolMessage } from './ToolMessage.js'; import { ToolConfirmationMessage } from './ToolConfirmationMessage.js'; import { Colors } from '../../colors.js'; -import { Config } from '@google/gemini-cli-core'; +import type { Config } from '@google/gemini-cli-core'; import { SHELL_COMMAND_NAME } from '../../constants.js'; interface ToolGroupMessageProps { diff --git a/packages/cli/src/ui/components/messages/ToolMessage.test.tsx b/packages/cli/src/ui/components/messages/ToolMessage.test.tsx index fab8aeba..d6872dba 100644 --- a/packages/cli/src/ui/components/messages/ToolMessage.test.tsx +++ b/packages/cli/src/ui/components/messages/ToolMessage.test.tsx @@ -6,7 +6,8 @@ import React from 'react'; import { render } from 'ink-testing-library'; -import { ToolMessage, ToolMessageProps } from './ToolMessage.js'; +import type { ToolMessageProps } from './ToolMessage.js'; +import { ToolMessage } from './ToolMessage.js'; import { StreamingState, ToolCallStatus } from '../../types.js'; import { Text } from 'ink'; import { StreamingContext } from '../../contexts/StreamingContext.js'; diff --git a/packages/cli/src/ui/components/messages/ToolMessage.tsx b/packages/cli/src/ui/components/messages/ToolMessage.tsx index d6ddb4f1..1a578f37 100644 --- a/packages/cli/src/ui/components/messages/ToolMessage.tsx +++ b/packages/cli/src/ui/components/messages/ToolMessage.tsx @@ -6,7 +6,8 @@ import React from 'react'; import { Box, Text } from 'ink'; -import { IndividualToolCallDisplay, ToolCallStatus } from '../../types.js'; +import type { IndividualToolCallDisplay } from '../../types.js'; +import { ToolCallStatus } from '../../types.js'; import { DiffRenderer } from './DiffRenderer.js'; import { Colors } from '../../colors.js'; import { MarkdownDisplay } from '../../utils/MarkdownDisplay.js'; diff --git a/packages/cli/src/ui/components/messages/UserMessage.tsx b/packages/cli/src/ui/components/messages/UserMessage.tsx index 1be41be9..1fd3b3bd 100644 --- a/packages/cli/src/ui/components/messages/UserMessage.tsx +++ b/packages/cli/src/ui/components/messages/UserMessage.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Text, Box } from 'ink'; import { Colors } from '../../colors.js'; import { SCREEN_READER_USER_PREFIX } from '../../constants.js'; diff --git a/packages/cli/src/ui/components/messages/UserShellMessage.tsx b/packages/cli/src/ui/components/messages/UserShellMessage.tsx index 946ca7e7..2e6cfa25 100644 --- a/packages/cli/src/ui/components/messages/UserShellMessage.tsx +++ b/packages/cli/src/ui/components/messages/UserShellMessage.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../../colors.js'; diff --git a/packages/cli/src/ui/components/shared/RadioButtonSelect.tsx b/packages/cli/src/ui/components/shared/RadioButtonSelect.tsx index 746744e5..921c954a 100644 --- a/packages/cli/src/ui/components/shared/RadioButtonSelect.tsx +++ b/packages/cli/src/ui/components/shared/RadioButtonSelect.tsx @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React, { useEffect, useState, useRef } from 'react'; +import type React from 'react'; +import { useEffect, useState, useRef } from 'react'; import { Text, Box } from 'ink'; import { Colors } from '../../colors.js'; import { useKeypress } from '../../hooks/useKeypress.js'; diff --git a/packages/cli/src/ui/components/shared/text-buffer.test.ts b/packages/cli/src/ui/components/shared/text-buffer.test.ts index 61d335c6..9caf269a 100644 --- a/packages/cli/src/ui/components/shared/text-buffer.test.ts +++ b/packages/cli/src/ui/components/shared/text-buffer.test.ts @@ -7,15 +7,17 @@ import { describe, it, expect, beforeEach } from 'vitest'; import stripAnsi from 'strip-ansi'; import { renderHook, act } from '@testing-library/react'; -import { - useTextBuffer, +import type { Viewport, TextBuffer, + TextBufferState, + TextBufferAction, +} from './text-buffer.js'; +import { + useTextBuffer, offsetToLogicalPos, logicalPosToOffset, textBufferReducer, - TextBufferState, - TextBufferAction, findWordEndInLine, findNextWordStartInLine, isWordCharStrict, diff --git a/packages/cli/src/ui/components/shared/text-buffer.ts b/packages/cli/src/ui/components/shared/text-buffer.ts index fb1223f6..0fef248a 100644 --- a/packages/cli/src/ui/components/shared/text-buffer.ts +++ b/packages/cli/src/ui/components/shared/text-buffer.ts @@ -17,7 +17,8 @@ import { cpSlice, stripUnsafeCharacters, } from '../../utils/textUtils.js'; -import { handleVimAction, VimAction } from './vim-buffer-actions.js'; +import type { VimAction } from './vim-buffer-actions.js'; +import { handleVimAction } from './vim-buffer-actions.js'; export type Direction = | 'left' diff --git a/packages/cli/src/ui/components/shared/vim-buffer-actions.ts b/packages/cli/src/ui/components/shared/vim-buffer-actions.ts index bf04716f..8243aeab 100644 --- a/packages/cli/src/ui/components/shared/vim-buffer-actions.ts +++ b/packages/cli/src/ui/components/shared/vim-buffer-actions.ts @@ -4,9 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import type { TextBufferState, TextBufferAction } from './text-buffer.js'; import { - TextBufferState, - TextBufferAction, getLineRangeOffsets, getPositionFromOffsets, replaceRangeInternal, diff --git a/packages/cli/src/ui/contexts/KeypressContext.test.tsx b/packages/cli/src/ui/contexts/KeypressContext.test.tsx index e60f6db2..7b1c5a17 100644 --- a/packages/cli/src/ui/contexts/KeypressContext.test.tsx +++ b/packages/cli/src/ui/contexts/KeypressContext.test.tsx @@ -4,14 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React from 'react'; +import type React from 'react'; import { renderHook, act, waitFor } from '@testing-library/react'; -import { vi, Mock } from 'vitest'; -import { - KeypressProvider, - useKeypressContext, - Key, -} from './KeypressContext.js'; +import type { Mock } from 'vitest'; +import { vi } from 'vitest'; +import type { Key } from './KeypressContext.js'; +import { KeypressProvider, useKeypressContext } from './KeypressContext.js'; import { useStdin } from 'ink'; import { EventEmitter } from 'node:events'; diff --git a/packages/cli/src/ui/contexts/KeypressContext.tsx b/packages/cli/src/ui/contexts/KeypressContext.tsx index d898f781..a7af64a9 100644 --- a/packages/cli/src/ui/contexts/KeypressContext.tsx +++ b/packages/cli/src/ui/contexts/KeypressContext.tsx @@ -4,13 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ +import type { Config } from '@google/gemini-cli-core'; import { - Config, KittySequenceOverflowEvent, logKittySequenceOverflow, } from '@google/gemini-cli-core'; import { useStdin } from 'ink'; -import React, { +import type React from 'react'; +import { createContext, useCallback, useContext, diff --git a/packages/cli/src/ui/contexts/OverflowContext.tsx b/packages/cli/src/ui/contexts/OverflowContext.tsx index f21a4e0f..9d8b78d4 100644 --- a/packages/cli/src/ui/contexts/OverflowContext.tsx +++ b/packages/cli/src/ui/contexts/OverflowContext.tsx @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React, { +import type React from 'react'; +import { createContext, useContext, useState, diff --git a/packages/cli/src/ui/contexts/SessionContext.test.tsx b/packages/cli/src/ui/contexts/SessionContext.test.tsx index 5b05c284..7e462869 100644 --- a/packages/cli/src/ui/contexts/SessionContext.test.tsx +++ b/packages/cli/src/ui/contexts/SessionContext.test.tsx @@ -8,11 +8,8 @@ import { type MutableRefObject } from 'react'; import { render } from 'ink-testing-library'; import { renderHook } from '@testing-library/react'; import { act } from 'react-dom/test-utils'; -import { - SessionStatsProvider, - useSessionStats, - SessionMetrics, -} from './SessionContext.js'; +import type { SessionMetrics } from './SessionContext.js'; +import { SessionStatsProvider, useSessionStats } from './SessionContext.js'; import { describe, it, expect, vi } from 'vitest'; import { uiTelemetryService } from '@google/gemini-cli-core'; diff --git a/packages/cli/src/ui/contexts/SessionContext.tsx b/packages/cli/src/ui/contexts/SessionContext.tsx index 6c48c60b..676a12fc 100644 --- a/packages/cli/src/ui/contexts/SessionContext.tsx +++ b/packages/cli/src/ui/contexts/SessionContext.tsx @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React, { +import type React from 'react'; +import { createContext, useCallback, useContext, @@ -13,12 +14,8 @@ import React, { useEffect, } from 'react'; -import { - uiTelemetryService, - SessionMetrics, - ModelMetrics, - sessionId, -} from '@google/gemini-cli-core'; +import type { SessionMetrics, ModelMetrics } from '@google/gemini-cli-core'; +import { uiTelemetryService, sessionId } from '@google/gemini-cli-core'; // --- Interface Definitions --- diff --git a/packages/cli/src/ui/contexts/SettingsContext.tsx b/packages/cli/src/ui/contexts/SettingsContext.tsx index 130ba66e..144e1a28 100644 --- a/packages/cli/src/ui/contexts/SettingsContext.tsx +++ b/packages/cli/src/ui/contexts/SettingsContext.tsx @@ -5,7 +5,7 @@ */ import React, { useContext } from 'react'; -import { LoadedSettings } from '../../config/settings.js'; +import type { LoadedSettings } from '../../config/settings.js'; export const SettingsContext = React.createContext( undefined, diff --git a/packages/cli/src/ui/contexts/StreamingContext.tsx b/packages/cli/src/ui/contexts/StreamingContext.tsx index 8944d682..7195e21d 100644 --- a/packages/cli/src/ui/contexts/StreamingContext.tsx +++ b/packages/cli/src/ui/contexts/StreamingContext.tsx @@ -5,7 +5,7 @@ */ import React, { createContext } from 'react'; -import { StreamingState } from '../types.js'; +import type { StreamingState } from '../types.js'; export const StreamingContext = createContext( undefined, diff --git a/packages/cli/src/ui/contexts/VimModeContext.tsx b/packages/cli/src/ui/contexts/VimModeContext.tsx index b27034ef..d0951a83 100644 --- a/packages/cli/src/ui/contexts/VimModeContext.tsx +++ b/packages/cli/src/ui/contexts/VimModeContext.tsx @@ -11,7 +11,8 @@ import { useEffect, useState, } from 'react'; -import { LoadedSettings, SettingScope } from '../../config/settings.js'; +import type { LoadedSettings } from '../../config/settings.js'; +import { SettingScope } from '../../config/settings.js'; export type VimMode = 'NORMAL' | 'INSERT'; diff --git a/packages/cli/src/ui/hooks/atCommandProcessor.test.ts b/packages/cli/src/ui/hooks/atCommandProcessor.test.ts index c9610398..3061ec9b 100644 --- a/packages/cli/src/ui/hooks/atCommandProcessor.test.ts +++ b/packages/cli/src/ui/hooks/atCommandProcessor.test.ts @@ -4,10 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { handleAtCommand } from './atCommandProcessor.js'; +import type { Config } from '@google/gemini-cli-core'; import { - Config, FileDiscoveryService, GlobTool, ReadManyFilesTool, @@ -18,7 +19,7 @@ import { } from '@google/gemini-cli-core'; import * as os from 'node:os'; import { ToolCallStatus } from '../types.js'; -import { UseHistoryManagerReturn } from './useHistoryManager.js'; +import type { UseHistoryManagerReturn } from './useHistoryManager.js'; import * as fsPromises from 'node:fs/promises'; import * as path from 'node:path'; diff --git a/packages/cli/src/ui/hooks/atCommandProcessor.ts b/packages/cli/src/ui/hooks/atCommandProcessor.ts index 050bea73..6583be55 100644 --- a/packages/cli/src/ui/hooks/atCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/atCommandProcessor.ts @@ -6,20 +6,16 @@ import * as fs from 'node:fs/promises'; import * as path from 'node:path'; -import { PartListUnion, PartUnion } from '@google/genai'; +import type { PartListUnion, PartUnion } from '@google/genai'; +import type { AnyToolInvocation, Config } from '@google/gemini-cli-core'; import { - AnyToolInvocation, - Config, getErrorMessage, isNodeError, unescapePath, } from '@google/gemini-cli-core'; -import { - HistoryItem, - IndividualToolCallDisplay, - ToolCallStatus, -} from '../types.js'; -import { UseHistoryManagerReturn } from './useHistoryManager.js'; +import type { HistoryItem, IndividualToolCallDisplay } from '../types.js'; +import { ToolCallStatus } from '../types.js'; +import type { UseHistoryManagerReturn } from './useHistoryManager.js'; interface HandleAtCommandParams { query: string; diff --git a/packages/cli/src/ui/hooks/shellCommandProcessor.ts b/packages/cli/src/ui/hooks/shellCommandProcessor.ts index 73505895..d668cc40 100644 --- a/packages/cli/src/ui/hooks/shellCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/shellCommandProcessor.ts @@ -4,21 +4,20 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { HistoryItemWithoutId, IndividualToolCallDisplay, - ToolCallStatus, } from '../types.js'; +import { ToolCallStatus } from '../types.js'; import { useCallback } from 'react'; -import { +import type { Config, GeminiClient, - isBinary, ShellExecutionResult, - ShellExecutionService, } from '@google/gemini-cli-core'; +import { isBinary, ShellExecutionService } from '@google/gemini-cli-core'; import { type PartListUnion } from '@google/genai'; -import { UseHistoryManagerReturn } from './useHistoryManager.js'; +import type { UseHistoryManagerReturn } from './useHistoryManager.js'; import { SHELL_COMMAND_NAME } from '../constants.js'; import { formatMemoryUsage } from '../utils/formatters.js'; import crypto from 'node:crypto'; diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts index 7a7445d2..d04ded3d 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts @@ -71,14 +71,14 @@ vi.mock('../../utils/cleanup.js', () => ({ import { act, renderHook, waitFor } from '@testing-library/react'; import { vi, describe, it, expect, beforeEach, type Mock } from 'vitest'; import { useSlashCommandProcessor } from './slashCommandProcessor.js'; -import { +import type { CommandContext, - CommandKind, ConfirmShellCommandsActionReturn, SlashCommand, } from '../commands/types.js'; +import { CommandKind } from '../commands/types.js'; import { ToolConfirmationOutcome } from '@google/gemini-cli-core'; -import { LoadedSettings } from '../../config/settings.js'; +import type { LoadedSettings } from '../../config/settings.js'; import { MessageType } from '../types.js'; import { BuiltinCommandLoader } from '../../services/BuiltinCommandLoader.js'; import { FileCommandLoader } from '../../services/FileCommandLoader.js'; diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts index 44a3c2fa..c36340db 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts @@ -7,9 +7,9 @@ import { useCallback, useMemo, useEffect, useState } from 'react'; import { type PartListUnion } from '@google/genai'; import process from 'node:process'; -import { UseHistoryManagerReturn } from './useHistoryManager.js'; +import type { UseHistoryManagerReturn } from './useHistoryManager.js'; +import type { Config } from '@google/gemini-cli-core'; import { - Config, GitService, Logger, logSlashCommand, @@ -20,14 +20,14 @@ import { } from '@google/gemini-cli-core'; import { useSessionStats } from '../contexts/SessionContext.js'; import { runExitCleanup } from '../../utils/cleanup.js'; -import { +import type { Message, - MessageType, HistoryItemWithoutId, HistoryItem, SlashCommandProcessorResult, } from '../types.js'; -import { LoadedSettings } from '../../config/settings.js'; +import { MessageType } from '../types.js'; +import type { LoadedSettings } from '../../config/settings.js'; import { type CommandContext, type SlashCommand } from '../commands/types.js'; import { CommandService } from '../../services/CommandService.js'; import { BuiltinCommandLoader } from '../../services/BuiltinCommandLoader.js'; diff --git a/packages/cli/src/ui/hooks/useAtCompletion.test.ts b/packages/cli/src/ui/hooks/useAtCompletion.test.ts index 4a1b6379..c64eeb68 100644 --- a/packages/cli/src/ui/hooks/useAtCompletion.test.ts +++ b/packages/cli/src/ui/hooks/useAtCompletion.test.ts @@ -9,14 +9,12 @@ import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest'; import { renderHook, waitFor, act } from '@testing-library/react'; import { useAtCompletion } from './useAtCompletion.js'; -import { Config, FileSearch, FileSearchFactory } from '@google/gemini-cli-core'; -import { - createTmpDir, - cleanupTmpDir, - FileSystemStructure, -} from '@google/gemini-cli-test-utils'; +import type { Config, FileSearch } from '@google/gemini-cli-core'; +import { FileSearchFactory } from '@google/gemini-cli-core'; +import type { FileSystemStructure } from '@google/gemini-cli-test-utils'; +import { createTmpDir, cleanupTmpDir } from '@google/gemini-cli-test-utils'; import { useState } from 'react'; -import { Suggestion } from '../components/SuggestionsDisplay.js'; +import type { Suggestion } from '../components/SuggestionsDisplay.js'; // Test harness to capture the state from the hook's callbacks. function useTestHarnessForAtCompletion( diff --git a/packages/cli/src/ui/hooks/useAtCompletion.ts b/packages/cli/src/ui/hooks/useAtCompletion.ts index a0131503..6406835f 100644 --- a/packages/cli/src/ui/hooks/useAtCompletion.ts +++ b/packages/cli/src/ui/hooks/useAtCompletion.ts @@ -5,16 +5,10 @@ */ import { useEffect, useReducer, useRef } from 'react'; -import { - Config, - FileSearch, - FileSearchFactory, - escapePath, -} from '@google/gemini-cli-core'; -import { - Suggestion, - MAX_SUGGESTIONS_TO_SHOW, -} from '../components/SuggestionsDisplay.js'; +import type { Config, FileSearch } from '@google/gemini-cli-core'; +import { FileSearchFactory, escapePath } from '@google/gemini-cli-core'; +import type { Suggestion } from '../components/SuggestionsDisplay.js'; +import { MAX_SUGGESTIONS_TO_SHOW } from '../components/SuggestionsDisplay.js'; export enum AtCompletionStatus { IDLE = 'idle', diff --git a/packages/cli/src/ui/hooks/useAuthCommand.ts b/packages/cli/src/ui/hooks/useAuthCommand.ts index e57a11af..7b95742c 100644 --- a/packages/cli/src/ui/hooks/useAuthCommand.ts +++ b/packages/cli/src/ui/hooks/useAuthCommand.ts @@ -5,10 +5,9 @@ */ import { useState, useCallback, useEffect } from 'react'; -import { LoadedSettings, SettingScope } from '../../config/settings.js'; +import type { LoadedSettings, SettingScope } from '../../config/settings.js'; +import { AuthType, type Config } from '@google/gemini-cli-core'; import { - AuthType, - Config, clearCachedCredentialFile, getErrorMessage, } from '@google/gemini-cli-core'; diff --git a/packages/cli/src/ui/hooks/useAutoAcceptIndicator.test.ts b/packages/cli/src/ui/hooks/useAutoAcceptIndicator.test.ts index 657d792b..ab85dd83 100644 --- a/packages/cli/src/ui/hooks/useAutoAcceptIndicator.test.ts +++ b/packages/cli/src/ui/hooks/useAutoAcceptIndicator.test.ts @@ -16,12 +16,10 @@ import { import { renderHook, act } from '@testing-library/react'; import { useAutoAcceptIndicator } from './useAutoAcceptIndicator.js'; -import { - Config, - Config as ActualConfigType, - ApprovalMode, -} from '@google/gemini-cli-core'; -import { useKeypress, Key } from './useKeypress.js'; +import type { Config as ActualConfigType } from '@google/gemini-cli-core'; +import { Config, ApprovalMode } from '@google/gemini-cli-core'; +import type { Key } from './useKeypress.js'; +import { useKeypress } from './useKeypress.js'; vi.mock('./useKeypress.js'); diff --git a/packages/cli/src/ui/hooks/useCommandCompletion.test.ts b/packages/cli/src/ui/hooks/useCommandCompletion.test.ts index 00bc8ac3..543de584 100644 --- a/packages/cli/src/ui/hooks/useCommandCompletion.test.ts +++ b/packages/cli/src/ui/hooks/useCommandCompletion.test.ts @@ -9,16 +9,15 @@ import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest'; import { renderHook, act, waitFor } from '@testing-library/react'; import { useCommandCompletion } from './useCommandCompletion.js'; -import { CommandContext } from '../commands/types.js'; -import { Config } from '@google/gemini-cli-core'; +import type { CommandContext } from '../commands/types.js'; +import type { Config } from '@google/gemini-cli-core'; import { useTextBuffer } from '../components/shared/text-buffer.js'; import { useEffect } from 'react'; -import { Suggestion } from '../components/SuggestionsDisplay.js'; -import { UseAtCompletionProps, useAtCompletion } from './useAtCompletion.js'; -import { - UseSlashCompletionProps, - useSlashCompletion, -} from './useSlashCompletion.js'; +import type { Suggestion } from '../components/SuggestionsDisplay.js'; +import type { UseAtCompletionProps } from './useAtCompletion.js'; +import { useAtCompletion } from './useAtCompletion.js'; +import type { UseSlashCompletionProps } from './useSlashCompletion.js'; +import { useSlashCompletion } from './useSlashCompletion.js'; vi.mock('./useAtCompletion', () => ({ useAtCompletion: vi.fn(), diff --git a/packages/cli/src/ui/hooks/useCommandCompletion.tsx b/packages/cli/src/ui/hooks/useCommandCompletion.tsx index 166f03c5..e29a8860 100644 --- a/packages/cli/src/ui/hooks/useCommandCompletion.tsx +++ b/packages/cli/src/ui/hooks/useCommandCompletion.tsx @@ -5,22 +5,20 @@ */ import { useCallback, useMemo, useEffect } from 'react'; -import { Suggestion } from '../components/SuggestionsDisplay.js'; -import { CommandContext, SlashCommand } from '../commands/types.js'; -import { - logicalPosToOffset, - TextBuffer, -} from '../components/shared/text-buffer.js'; +import type { Suggestion } from '../components/SuggestionsDisplay.js'; +import type { CommandContext, SlashCommand } from '../commands/types.js'; +import type { TextBuffer } from '../components/shared/text-buffer.js'; +import { logicalPosToOffset } from '../components/shared/text-buffer.js'; import { isSlashCommand } from '../utils/commandUtils.js'; import { toCodePoints } from '../utils/textUtils.js'; import { useAtCompletion } from './useAtCompletion.js'; import { useSlashCompletion } from './useSlashCompletion.js'; +import type { PromptCompletion } from './usePromptCompletion.js'; import { usePromptCompletion, - PromptCompletion, PROMPT_COMPLETION_MIN_LENGTH, } from './usePromptCompletion.js'; -import { Config } from '@google/gemini-cli-core'; +import type { Config } from '@google/gemini-cli-core'; import { useCompletion } from './useCompletion.js'; export enum CompletionMode { diff --git a/packages/cli/src/ui/hooks/useCompletion.ts b/packages/cli/src/ui/hooks/useCompletion.ts index 242b4528..8d3d4c2f 100644 --- a/packages/cli/src/ui/hooks/useCompletion.ts +++ b/packages/cli/src/ui/hooks/useCompletion.ts @@ -6,10 +6,8 @@ import { useState, useCallback } from 'react'; -import { - MAX_SUGGESTIONS_TO_SHOW, - Suggestion, -} from '../components/SuggestionsDisplay.js'; +import type { Suggestion } from '../components/SuggestionsDisplay.js'; +import { MAX_SUGGESTIONS_TO_SHOW } from '../components/SuggestionsDisplay.js'; export interface UseCompletionReturn { suggestions: Suggestion[]; diff --git a/packages/cli/src/ui/hooks/useConsoleMessages.ts b/packages/cli/src/ui/hooks/useConsoleMessages.ts index 3b71560e..af48fc5d 100644 --- a/packages/cli/src/ui/hooks/useConsoleMessages.ts +++ b/packages/cli/src/ui/hooks/useConsoleMessages.ts @@ -11,7 +11,7 @@ import { useRef, useTransition, } from 'react'; -import { ConsoleMessageItem } from '../types.js'; +import type { ConsoleMessageItem } from '../types.js'; export interface UseConsoleMessagesReturn { consoleMessages: ConsoleMessageItem[]; diff --git a/packages/cli/src/ui/hooks/useEditorSettings.test.ts b/packages/cli/src/ui/hooks/useEditorSettings.test.ts index 7b056c2a..3cc4136f 100644 --- a/packages/cli/src/ui/hooks/useEditorSettings.test.ts +++ b/packages/cli/src/ui/hooks/useEditorSettings.test.ts @@ -16,7 +16,8 @@ import { import { act } from 'react'; import { renderHook } from '@testing-library/react'; import { useEditorSettings } from './useEditorSettings.js'; -import { LoadedSettings, SettingScope } from '../../config/settings.js'; +import type { LoadedSettings } from '../../config/settings.js'; +import { SettingScope } from '../../config/settings.js'; import { MessageType, type HistoryItem } from '../types.js'; import { type EditorType, diff --git a/packages/cli/src/ui/hooks/useEditorSettings.ts b/packages/cli/src/ui/hooks/useEditorSettings.ts index 60c16798..7c0e35c2 100644 --- a/packages/cli/src/ui/hooks/useEditorSettings.ts +++ b/packages/cli/src/ui/hooks/useEditorSettings.ts @@ -5,12 +5,12 @@ */ import { useState, useCallback } from 'react'; -import { LoadedSettings, SettingScope } from '../../config/settings.js'; +import type { LoadedSettings, SettingScope } from '../../config/settings.js'; import { type HistoryItem, MessageType } from '../types.js'; +import type { EditorType } from '@google/gemini-cli-core'; import { allowEditorTypeInSandbox, checkHasEditorType, - EditorType, } from '@google/gemini-cli-core'; interface UseEditorSettingsReturn { diff --git a/packages/cli/src/ui/hooks/useFolderTrust.test.ts b/packages/cli/src/ui/hooks/useFolderTrust.test.ts index 1581ae00..daa1264f 100644 --- a/packages/cli/src/ui/hooks/useFolderTrust.test.ts +++ b/packages/cli/src/ui/hooks/useFolderTrust.test.ts @@ -7,12 +7,10 @@ import { vi } from 'vitest'; import { renderHook, act } from '@testing-library/react'; import { useFolderTrust } from './useFolderTrust.js'; -import { LoadedSettings } from '../../config/settings.js'; +import type { LoadedSettings } from '../../config/settings.js'; import { FolderTrustChoice } from '../components/FolderTrustDialog.js'; -import { - LoadedTrustedFolders, - TrustLevel, -} from '../../config/trustedFolders.js'; +import type { LoadedTrustedFolders } from '../../config/trustedFolders.js'; +import { TrustLevel } from '../../config/trustedFolders.js'; import * as process from 'node:process'; import * as trustedFolders from '../../config/trustedFolders.js'; diff --git a/packages/cli/src/ui/hooks/useFolderTrust.ts b/packages/cli/src/ui/hooks/useFolderTrust.ts index 97551784..0e5699da 100644 --- a/packages/cli/src/ui/hooks/useFolderTrust.ts +++ b/packages/cli/src/ui/hooks/useFolderTrust.ts @@ -5,7 +5,7 @@ */ import { useState, useCallback, useEffect } from 'react'; -import { Settings, LoadedSettings } from '../../config/settings.js'; +import type { Settings, LoadedSettings } from '../../config/settings.js'; import { FolderTrustChoice } from '../components/FolderTrustDialog.js'; import { loadTrustedFolders, diff --git a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx index 5f4438f0..4ddb413b 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx +++ b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx @@ -5,45 +5,36 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { - describe, - it, - expect, - vi, - beforeEach, - Mock, - MockInstance, -} from 'vitest'; +import type { Mock, MockInstance } from 'vitest'; +import { describe, it, expect, vi, beforeEach } from 'vitest'; import { renderHook, act, waitFor } from '@testing-library/react'; import { useGeminiStream } from './useGeminiStream.js'; import { useKeypress } from './useKeypress.js'; import * as atCommandProcessor from './atCommandProcessor.js'; -import { - useReactToolScheduler, +import type { TrackedToolCall, TrackedCompletedToolCall, TrackedExecutingToolCall, TrackedCancelledToolCall, } from './useReactToolScheduler.js'; -import { - ApprovalMode, +import { useReactToolScheduler } from './useReactToolScheduler.js'; +import type { Config, EditorType, - AuthType, GeminiClient, - GeminiEventType as ServerGeminiEventType, AnyToolInvocation, - ToolErrorType, // <-- Import ToolErrorType } from '@google/gemini-cli-core'; -import { Part, PartListUnion } from '@google/genai'; -import { UseHistoryManagerReturn } from './useHistoryManager.js'; import { - HistoryItem, - MessageType, - SlashCommandProcessorResult, - StreamingState, -} from '../types.js'; -import { LoadedSettings } from '../../config/settings.js'; + ApprovalMode, + AuthType, + GeminiEventType as ServerGeminiEventType, + ToolErrorType, +} from '@google/gemini-cli-core'; +import type { Part, PartListUnion } from '@google/genai'; +import type { UseHistoryManagerReturn } from './useHistoryManager.js'; +import type { HistoryItem, SlashCommandProcessorResult } from '../types.js'; +import { MessageType, StreamingState } from '../types.js'; +import type { LoadedSettings } from '../../config/settings.js'; // --- MOCKS --- const mockSendMessageStream = vi diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts index cf624782..757396b7 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.ts +++ b/packages/cli/src/ui/hooks/useGeminiStream.ts @@ -5,23 +5,25 @@ */ import { useState, useRef, useCallback, useEffect, useMemo } from 'react'; -import { +import type { Config, GeminiClient, - GeminiEventType as ServerGeminiEventType, ServerGeminiStreamEvent as GeminiEvent, ServerGeminiContentEvent as ContentEvent, ServerGeminiErrorEvent as ErrorEvent, ServerGeminiChatCompressedEvent, ServerGeminiFinishedEvent, + ToolCallRequestInfo, + EditorType, + ThoughtSummary, +} from '@google/gemini-cli-core'; +import { + GeminiEventType as ServerGeminiEventType, getErrorMessage, isNodeError, MessageSenderType, - ToolCallRequestInfo, logUserPrompt, GitService, - EditorType, - ThoughtSummary, UnauthorizedError, UserPromptEvent, DEFAULT_GEMINI_FLASH_MODEL, @@ -31,30 +33,30 @@ import { parseAndFormatApiError, } from '@google/gemini-cli-core'; import { type Part, type PartListUnion, FinishReason } from '@google/genai'; -import { - StreamingState, +import type { HistoryItem, HistoryItemWithoutId, HistoryItemToolGroup, - MessageType, SlashCommandProcessorResult, - ToolCallStatus, } from '../types.js'; +import { StreamingState, MessageType, ToolCallStatus } from '../types.js'; import { isAtCommand } from '../utils/commandUtils.js'; import { useShellCommandProcessor } from './shellCommandProcessor.js'; import { handleAtCommand } from './atCommandProcessor.js'; import { findLastSafeSplitPoint } from '../utils/markdownUtilities.js'; import { useStateAndRef } from './useStateAndRef.js'; -import { UseHistoryManagerReturn } from './useHistoryManager.js'; +import type { UseHistoryManagerReturn } from './useHistoryManager.js'; import { useLogger } from './useLogger.js'; +import type { + TrackedToolCall, + TrackedCompletedToolCall, + TrackedCancelledToolCall, +} from './useReactToolScheduler.js'; import { promises as fs } from 'node:fs'; import path from 'node:path'; import { useReactToolScheduler, mapToDisplay as mapTrackedToolCallsToDisplay, - TrackedToolCall, - TrackedCompletedToolCall, - TrackedCancelledToolCall, } from './useReactToolScheduler.js'; import { useSessionStats } from '../contexts/SessionContext.js'; import { useKeypress } from './useKeypress.js'; diff --git a/packages/cli/src/ui/hooks/useGitBranchName.test.ts b/packages/cli/src/ui/hooks/useGitBranchName.test.ts index a749d64d..9b1319ce 100644 --- a/packages/cli/src/ui/hooks/useGitBranchName.test.ts +++ b/packages/cli/src/ui/hooks/useGitBranchName.test.ts @@ -4,15 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { - afterEach, - beforeEach, - describe, - expect, - it, - vi, - MockedFunction, -} from 'vitest'; +import type { MockedFunction } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { act } from 'react'; import { renderHook } from '@testing-library/react'; import { useGitBranchName } from './useGitBranchName.js'; diff --git a/packages/cli/src/ui/hooks/useHistoryManager.test.ts b/packages/cli/src/ui/hooks/useHistoryManager.test.ts index b3245eb0..c6f60032 100644 --- a/packages/cli/src/ui/hooks/useHistoryManager.test.ts +++ b/packages/cli/src/ui/hooks/useHistoryManager.test.ts @@ -7,7 +7,7 @@ import { describe, it, expect } from 'vitest'; import { renderHook, act } from '@testing-library/react'; import { useHistory } from './useHistoryManager.js'; -import { HistoryItem } from '../types.js'; +import type { HistoryItem } from '../types.js'; describe('useHistoryManager', () => { it('should initialize with an empty history', () => { diff --git a/packages/cli/src/ui/hooks/useHistoryManager.ts b/packages/cli/src/ui/hooks/useHistoryManager.ts index c45ac8d3..cc7ed557 100644 --- a/packages/cli/src/ui/hooks/useHistoryManager.ts +++ b/packages/cli/src/ui/hooks/useHistoryManager.ts @@ -5,7 +5,7 @@ */ import { useState, useRef, useCallback } from 'react'; -import { HistoryItem } from '../types.js'; +import type { HistoryItem } from '../types.js'; // Type for the updater function passed to updateHistoryItem type HistoryItemUpdater = ( diff --git a/packages/cli/src/ui/hooks/useKeypress.test.ts b/packages/cli/src/ui/hooks/useKeypress.test.ts index 683603de..07129c4f 100644 --- a/packages/cli/src/ui/hooks/useKeypress.test.ts +++ b/packages/cli/src/ui/hooks/useKeypress.test.ts @@ -6,7 +6,8 @@ import React from 'react'; import { renderHook, act } from '@testing-library/react'; -import { useKeypress, Key } from './useKeypress.js'; +import type { Key } from './useKeypress.js'; +import { useKeypress } from './useKeypress.js'; import { KeypressProvider } from '../contexts/KeypressContext.js'; import { useStdin } from 'ink'; import { EventEmitter } from 'node:events'; diff --git a/packages/cli/src/ui/hooks/useKeypress.ts b/packages/cli/src/ui/hooks/useKeypress.ts index bead50e6..1ff3ae27 100644 --- a/packages/cli/src/ui/hooks/useKeypress.ts +++ b/packages/cli/src/ui/hooks/useKeypress.ts @@ -5,13 +5,10 @@ */ import { useEffect } from 'react'; -import { - useKeypressContext, - KeypressHandler, - Key, -} from '../contexts/KeypressContext.js'; +import type { KeypressHandler, Key } from '../contexts/KeypressContext.js'; +import { useKeypressContext } from '../contexts/KeypressContext.js'; -export { Key }; +export type { Key }; /** * A hook that listens for keypress events from stdin. diff --git a/packages/cli/src/ui/hooks/useLogger.ts b/packages/cli/src/ui/hooks/useLogger.ts index 8833b642..23373426 100644 --- a/packages/cli/src/ui/hooks/useLogger.ts +++ b/packages/cli/src/ui/hooks/useLogger.ts @@ -5,7 +5,8 @@ */ import { useState, useEffect } from 'react'; -import { sessionId, Logger, Storage } from '@google/gemini-cli-core'; +import type { Storage } from '@google/gemini-cli-core'; +import { sessionId, Logger } from '@google/gemini-cli-core'; /** * Hook to manage the logger instance. diff --git a/packages/cli/src/ui/hooks/usePrivacySettings.test.ts b/packages/cli/src/ui/hooks/usePrivacySettings.test.ts index 9b2a7c2c..8f81391f 100644 --- a/packages/cli/src/ui/hooks/usePrivacySettings.test.ts +++ b/packages/cli/src/ui/hooks/usePrivacySettings.test.ts @@ -6,15 +6,17 @@ import { describe, it, expect, beforeEach, vi } from 'vitest'; import { renderHook, waitFor } from '@testing-library/react'; -import { +import type { Config, - CodeAssistServer, - LoggingContentGenerator, - UserTierId, GeminiClient, ContentGenerator, } from '@google/gemini-cli-core'; -import { OAuth2Client } from 'google-auth-library'; +import { + CodeAssistServer, + LoggingContentGenerator, + UserTierId, +} from '@google/gemini-cli-core'; +import type { OAuth2Client } from 'google-auth-library'; import { usePrivacySettings } from './usePrivacySettings.js'; // Mock the dependencies diff --git a/packages/cli/src/ui/hooks/usePrivacySettings.ts b/packages/cli/src/ui/hooks/usePrivacySettings.ts index 47a62588..e6aed967 100644 --- a/packages/cli/src/ui/hooks/usePrivacySettings.ts +++ b/packages/cli/src/ui/hooks/usePrivacySettings.ts @@ -5,8 +5,8 @@ */ import { useState, useEffect, useCallback } from 'react'; +import type { Config } from '@google/gemini-cli-core'; import { - Config, CodeAssistServer, UserTierId, LoggingContentGenerator, diff --git a/packages/cli/src/ui/hooks/usePromptCompletion.ts b/packages/cli/src/ui/hooks/usePromptCompletion.ts index 466d020b..e7076a73 100644 --- a/packages/cli/src/ui/hooks/usePromptCompletion.ts +++ b/packages/cli/src/ui/hooks/usePromptCompletion.ts @@ -5,13 +5,13 @@ */ import { useState, useCallback, useRef, useEffect, useMemo } from 'react'; +import type { Config } from '@google/gemini-cli-core'; import { - Config, DEFAULT_GEMINI_FLASH_LITE_MODEL, getResponseText, } from '@google/gemini-cli-core'; -import { Content, GenerateContentConfig } from '@google/genai'; -import { TextBuffer } from '../components/shared/text-buffer.js'; +import type { Content, GenerateContentConfig } from '@google/genai'; +import type { TextBuffer } from '../components/shared/text-buffer.js'; export const PROMPT_COMPLETION_MIN_LENGTH = 5; export const PROMPT_COMPLETION_DEBOUNCE_MS = 250; diff --git a/packages/cli/src/ui/hooks/useReactToolScheduler.ts b/packages/cli/src/ui/hooks/useReactToolScheduler.ts index e4238f99..1bfbc427 100644 --- a/packages/cli/src/ui/hooks/useReactToolScheduler.ts +++ b/packages/cli/src/ui/hooks/useReactToolScheduler.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { Config, ToolCallRequestInfo, ExecutingToolCall, @@ -13,7 +13,6 @@ import { WaitingToolCall, CompletedToolCall, CancelledToolCall, - CoreToolScheduler, OutputUpdateHandler, AllToolCallsCompleteHandler, ToolCallsUpdateHandler, @@ -21,13 +20,14 @@ import { Status as CoreStatus, EditorType, } from '@google/gemini-cli-core'; +import { CoreToolScheduler } from '@google/gemini-cli-core'; import { useCallback, useState, useMemo } from 'react'; -import { +import type { HistoryItemToolGroup, IndividualToolCallDisplay, - ToolCallStatus, HistoryItemWithoutId, } from '../types.js'; +import { ToolCallStatus } from '../types.js'; export type ScheduleFn = ( request: ToolCallRequestInfo | ToolCallRequestInfo[], diff --git a/packages/cli/src/ui/hooks/useReverseSearchCompletion.tsx b/packages/cli/src/ui/hooks/useReverseSearchCompletion.tsx index 3fb9217e..1e333deb 100644 --- a/packages/cli/src/ui/hooks/useReverseSearchCompletion.tsx +++ b/packages/cli/src/ui/hooks/useReverseSearchCompletion.tsx @@ -6,8 +6,8 @@ import { useEffect, useCallback } from 'react'; import { useCompletion } from './useCompletion.js'; -import { TextBuffer } from '../components/shared/text-buffer.js'; -import { Suggestion } from '../components/SuggestionsDisplay.js'; +import type { TextBuffer } from '../components/shared/text-buffer.js'; +import type { Suggestion } from '../components/SuggestionsDisplay.js'; export interface UseReverseSearchCompletionReturn { suggestions: Suggestion[]; diff --git a/packages/cli/src/ui/hooks/useShowMemoryCommand.ts b/packages/cli/src/ui/hooks/useShowMemoryCommand.ts index c1811507..d85d154b 100644 --- a/packages/cli/src/ui/hooks/useShowMemoryCommand.ts +++ b/packages/cli/src/ui/hooks/useShowMemoryCommand.ts @@ -4,9 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Message, MessageType } from '../types.js'; -import { Config } from '@google/gemini-cli-core'; -import { LoadedSettings } from '../../config/settings.js'; +import type { Message } from '../types.js'; +import { MessageType } from '../types.js'; +import type { Config } from '@google/gemini-cli-core'; +import type { LoadedSettings } from '../../config/settings.js'; export function createShowMemoryAction( config: Config | null, diff --git a/packages/cli/src/ui/hooks/useSlashCompletion.test.ts b/packages/cli/src/ui/hooks/useSlashCompletion.test.ts index ba26f2d2..e7033f04 100644 --- a/packages/cli/src/ui/hooks/useSlashCompletion.test.ts +++ b/packages/cli/src/ui/hooks/useSlashCompletion.test.ts @@ -9,9 +9,9 @@ import { describe, it, expect, vi } from 'vitest'; import { renderHook, waitFor } from '@testing-library/react'; import { useSlashCompletion } from './useSlashCompletion.js'; -import { CommandContext, SlashCommand } from '../commands/types.js'; +import type { CommandContext, SlashCommand } from '../commands/types.js'; import { useState } from 'react'; -import { Suggestion } from '../components/SuggestionsDisplay.js'; +import type { Suggestion } from '../components/SuggestionsDisplay.js'; // Test harness to capture the state from the hook's callbacks. function useTestHarnessForSlashCompletion( diff --git a/packages/cli/src/ui/hooks/useSlashCompletion.ts b/packages/cli/src/ui/hooks/useSlashCompletion.ts index 9836362f..ebd42658 100644 --- a/packages/cli/src/ui/hooks/useSlashCompletion.ts +++ b/packages/cli/src/ui/hooks/useSlashCompletion.ts @@ -5,8 +5,8 @@ */ import { useState, useEffect } from 'react'; -import { Suggestion } from '../components/SuggestionsDisplay.js'; -import { CommandContext, SlashCommand } from '../commands/types.js'; +import type { Suggestion } from '../components/SuggestionsDisplay.js'; +import type { CommandContext, SlashCommand } from '../commands/types.js'; export interface UseSlashCompletionProps { enabled: boolean; diff --git a/packages/cli/src/ui/hooks/useThemeCommand.ts b/packages/cli/src/ui/hooks/useThemeCommand.ts index cf881f53..6fed50c4 100644 --- a/packages/cli/src/ui/hooks/useThemeCommand.ts +++ b/packages/cli/src/ui/hooks/useThemeCommand.ts @@ -6,7 +6,7 @@ import { useState, useCallback, useEffect } from 'react'; import { themeManager } from '../themes/theme-manager.js'; -import { LoadedSettings, SettingScope } from '../../config/settings.js'; // Import LoadedSettings, AppSettings, MergedSetting +import type { LoadedSettings, SettingScope } from '../../config/settings.js'; // Import LoadedSettings, AppSettings, MergedSetting import { type HistoryItem, MessageType } from '../types.js'; import process from 'node:process'; diff --git a/packages/cli/src/ui/hooks/useToolScheduler.test.ts b/packages/cli/src/ui/hooks/useToolScheduler.test.ts index 67230e84..f3817764 100644 --- a/packages/cli/src/ui/hooks/useToolScheduler.test.ts +++ b/packages/cli/src/ui/hooks/useToolScheduler.test.ts @@ -5,36 +5,36 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; import { useReactToolScheduler, mapToDisplay, } from './useReactToolScheduler.js'; -import { PartUnion, FunctionResponse } from '@google/genai'; -import { +import type { PartUnion, FunctionResponse } from '@google/genai'; +import type { Config, ToolCallRequestInfo, ToolRegistry, ToolResult, ToolCallConfirmationDetails, - ToolConfirmationOutcome, ToolCallResponseInfo, ToolCall, // Import from core Status as ToolCallStatusType, - ApprovalMode, - Kind, - BaseDeclarativeTool, - BaseToolInvocation, ToolInvocation, AnyDeclarativeTool, AnyToolInvocation, } from '@google/gemini-cli-core'; import { - HistoryItemWithoutId, - ToolCallStatus, - HistoryItemToolGroup, -} from '../types.js'; + ToolConfirmationOutcome, + ApprovalMode, + Kind, + BaseDeclarativeTool, + BaseToolInvocation, +} from '@google/gemini-cli-core'; +import type { HistoryItemWithoutId, HistoryItemToolGroup } from '../types.js'; +import { ToolCallStatus } from '../types.js'; // Mocks vi.mock('@google/gemini-cli-core', async () => { diff --git a/packages/cli/src/ui/hooks/vim.test.ts b/packages/cli/src/ui/hooks/vim.test.ts index 0139119e..c7af5426 100644 --- a/packages/cli/src/ui/hooks/vim.test.ts +++ b/packages/cli/src/ui/hooks/vim.test.ts @@ -6,7 +6,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { renderHook, act } from '@testing-library/react'; -import React from 'react'; +import type React from 'react'; import { useVim } from './vim.js'; import type { TextBuffer } from '../components/shared/text-buffer.js'; import { textBufferReducer } from '../components/shared/text-buffer.js'; diff --git a/packages/cli/src/ui/keyMatchers.test.ts b/packages/cli/src/ui/keyMatchers.test.ts index 9e2963b9..8db1a897 100644 --- a/packages/cli/src/ui/keyMatchers.test.ts +++ b/packages/cli/src/ui/keyMatchers.test.ts @@ -6,7 +6,8 @@ import { describe, it, expect } from 'vitest'; import { keyMatchers, Command, createKeyMatchers } from './keyMatchers.js'; -import { KeyBindingConfig, defaultKeyBindings } from '../config/keyBindings.js'; +import type { KeyBindingConfig } from '../config/keyBindings.js'; +import { defaultKeyBindings } from '../config/keyBindings.js'; import type { Key } from './hooks/useKeypress.js'; describe('keyMatchers', () => { diff --git a/packages/cli/src/ui/keyMatchers.ts b/packages/cli/src/ui/keyMatchers.ts index 651343af..103c5710 100644 --- a/packages/cli/src/ui/keyMatchers.ts +++ b/packages/cli/src/ui/keyMatchers.ts @@ -5,12 +5,8 @@ */ import type { Key } from './hooks/useKeypress.js'; -import { - Command, - KeyBinding, - KeyBindingConfig, - defaultKeyBindings, -} from '../config/keyBindings.js'; +import type { KeyBinding, KeyBindingConfig } from '../config/keyBindings.js'; +import { Command, defaultKeyBindings } from '../config/keyBindings.js'; /** * Matches a KeyBinding against an actual Key press diff --git a/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx b/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx index d4c13097..a1c27930 100644 --- a/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx +++ b/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx @@ -8,7 +8,7 @@ import { Box, Newline, Text } from 'ink'; import { RadioButtonSelect } from '../components/shared/RadioButtonSelect.js'; import { usePrivacySettings } from '../hooks/usePrivacySettings.js'; import { CloudPaidPrivacyNotice } from './CloudPaidPrivacyNotice.js'; -import { Config } from '@google/gemini-cli-core'; +import type { Config } from '@google/gemini-cli-core'; import { Colors } from '../colors.js'; import { useKeypress } from '../hooks/useKeypress.js'; diff --git a/packages/cli/src/ui/semantic-colors.ts b/packages/cli/src/ui/semantic-colors.ts index 98fba0fe..88e75833 100644 --- a/packages/cli/src/ui/semantic-colors.ts +++ b/packages/cli/src/ui/semantic-colors.ts @@ -5,7 +5,7 @@ */ import { themeManager } from './themes/theme-manager.js'; -import { SemanticColors } from './themes/semantic-tokens.js'; +import type { SemanticColors } from './themes/semantic-tokens.js'; export const theme: SemanticColors = { get text() { diff --git a/packages/cli/src/ui/themes/no-color.ts b/packages/cli/src/ui/themes/no-color.ts index 161b407e..3e5efb5f 100644 --- a/packages/cli/src/ui/themes/no-color.ts +++ b/packages/cli/src/ui/themes/no-color.ts @@ -4,8 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Theme, ColorsTheme } from './theme.js'; -import { SemanticColors } from './semantic-tokens.js'; +import type { ColorsTheme } from './theme.js'; +import { Theme } from './theme.js'; +import type { SemanticColors } from './semantic-tokens.js'; const noColorColorsTheme: ColorsTheme = { type: 'ansi', diff --git a/packages/cli/src/ui/themes/theme-manager.test.ts b/packages/cli/src/ui/themes/theme-manager.test.ts index 183b203c..52e03b01 100644 --- a/packages/cli/src/ui/themes/theme-manager.test.ts +++ b/packages/cli/src/ui/themes/theme-manager.test.ts @@ -11,7 +11,7 @@ if (process.env['NO_COLOR'] !== undefined) { import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; import { themeManager, DEFAULT_THEME } from './theme-manager.js'; -import { CustomTheme } from './theme.js'; +import type { CustomTheme } from './theme.js'; import * as fs from 'node:fs'; import * as os from 'node:os'; import type * as osActual from 'node:os'; diff --git a/packages/cli/src/ui/themes/theme-manager.ts b/packages/cli/src/ui/themes/theme-manager.ts index 26b0fd3b..e6ad4745 100644 --- a/packages/cli/src/ui/themes/theme-manager.ts +++ b/packages/cli/src/ui/themes/theme-manager.ts @@ -18,14 +18,9 @@ import { XCode } from './xcode.js'; import * as fs from 'node:fs'; import * as path from 'node:path'; import * as os from 'node:os'; -import { - Theme, - ThemeType, - CustomTheme, - createCustomTheme, - validateCustomTheme, -} from './theme.js'; -import { SemanticColors } from './semantic-tokens.js'; +import type { Theme, ThemeType, CustomTheme } from './theme.js'; +import { createCustomTheme, validateCustomTheme } from './theme.js'; +import type { SemanticColors } from './semantic-tokens.js'; import { ANSI } from './ansi.js'; import { ANSILight } from './ansi-light.js'; import { NoColorTheme } from './no-color.js'; diff --git a/packages/cli/src/ui/themes/theme.ts b/packages/cli/src/ui/themes/theme.ts index e46c7f48..82f2da89 100644 --- a/packages/cli/src/ui/themes/theme.ts +++ b/packages/cli/src/ui/themes/theme.ts @@ -5,7 +5,7 @@ */ import type { CSSProperties } from 'react'; -import { SemanticColors } from './semantic-tokens.js'; +import type { SemanticColors } from './semantic-tokens.js'; import { resolveColor } from './color-utils.js'; export type ThemeType = 'light' | 'dark' | 'ansi' | 'custom'; diff --git a/packages/cli/src/ui/types.ts b/packages/cli/src/ui/types.ts index bc4406c4..304e1c80 100644 --- a/packages/cli/src/ui/types.ts +++ b/packages/cli/src/ui/types.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { ToolCallConfirmationDetails, ToolResultDisplay, UserTierId, diff --git a/packages/cli/src/ui/utils/CodeColorizer.tsx b/packages/cli/src/ui/utils/CodeColorizer.tsx index 775ffadc..c470a520 100644 --- a/packages/cli/src/ui/utils/CodeColorizer.tsx +++ b/packages/cli/src/ui/utils/CodeColorizer.tsx @@ -15,12 +15,12 @@ import type { RootContent, } from 'hast'; import { themeManager } from '../themes/theme-manager.js'; -import { Theme } from '../themes/theme.js'; +import type { Theme } from '../themes/theme.js'; import { MaxSizedBox, MINIMUM_MAX_HEIGHT, } from '../components/shared/MaxSizedBox.js'; -import { LoadedSettings } from '../../config/settings.js'; +import type { LoadedSettings } from '../../config/settings.js'; // Configure theming and parsing utilities. const lowlight = createLowlight(common); diff --git a/packages/cli/src/ui/utils/ConsolePatcher.ts b/packages/cli/src/ui/utils/ConsolePatcher.ts index 0481fd43..b0dd048e 100644 --- a/packages/cli/src/ui/utils/ConsolePatcher.ts +++ b/packages/cli/src/ui/utils/ConsolePatcher.ts @@ -5,7 +5,7 @@ */ import util from 'node:util'; -import { ConsoleMessageItem } from '../types.js'; +import type { ConsoleMessageItem } from '../types.js'; interface ConsolePatcherParams { onNewMessage?: (message: Omit) => void; diff --git a/packages/cli/src/ui/utils/commandUtils.test.ts b/packages/cli/src/ui/utils/commandUtils.test.ts index 9a6d02f7..5e5be00e 100644 --- a/packages/cli/src/ui/utils/commandUtils.test.ts +++ b/packages/cli/src/ui/utils/commandUtils.test.ts @@ -4,8 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { vi, describe, it, expect, beforeEach, Mock } from 'vitest'; -import { spawn, SpawnOptions } from 'node:child_process'; +import type { Mock } from 'vitest'; +import { vi, describe, it, expect, beforeEach } from 'vitest'; +import type { spawn, SpawnOptions } from 'node:child_process'; import { EventEmitter } from 'node:events'; import { isAtCommand, diff --git a/packages/cli/src/ui/utils/commandUtils.ts b/packages/cli/src/ui/utils/commandUtils.ts index 7d3a31d4..2912899e 100644 --- a/packages/cli/src/ui/utils/commandUtils.ts +++ b/packages/cli/src/ui/utils/commandUtils.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { spawn, SpawnOptions } from 'node:child_process'; +import type { SpawnOptions } from 'node:child_process'; +import { spawn } from 'node:child_process'; /** * Checks if a query string potentially represents an '@' command. diff --git a/packages/cli/src/ui/utils/computeStats.test.ts b/packages/cli/src/ui/utils/computeStats.test.ts index e9085fb3..db8d4cc9 100644 --- a/packages/cli/src/ui/utils/computeStats.test.ts +++ b/packages/cli/src/ui/utils/computeStats.test.ts @@ -11,7 +11,10 @@ import { calculateErrorRate, computeSessionStats, } from './computeStats.js'; -import { ModelMetrics, SessionMetrics } from '../contexts/SessionContext.js'; +import type { + ModelMetrics, + SessionMetrics, +} from '../contexts/SessionContext.js'; describe('calculateErrorRate', () => { it('should return 0 if totalRequests is 0', () => { diff --git a/packages/cli/src/ui/utils/computeStats.ts b/packages/cli/src/ui/utils/computeStats.ts index ec7c49fa..cc0d870e 100644 --- a/packages/cli/src/ui/utils/computeStats.ts +++ b/packages/cli/src/ui/utils/computeStats.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { SessionMetrics, ComputedSessionStats, ModelMetrics, diff --git a/packages/cli/src/ui/utils/updateCheck.ts b/packages/cli/src/ui/utils/updateCheck.ts index bb6c507c..ef45cd49 100644 --- a/packages/cli/src/ui/utils/updateCheck.ts +++ b/packages/cli/src/ui/utils/updateCheck.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import updateNotifier, { UpdateInfo } from 'update-notifier'; +import type { UpdateInfo } from 'update-notifier'; +import updateNotifier from 'update-notifier'; import semver from 'semver'; import { getPackageJson } from '../../utils/package.js'; diff --git a/packages/cli/src/utils/dialogScopeUtils.ts b/packages/cli/src/utils/dialogScopeUtils.ts index c175f9c8..fd4cbbd4 100644 --- a/packages/cli/src/utils/dialogScopeUtils.ts +++ b/packages/cli/src/utils/dialogScopeUtils.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { SettingScope, LoadedSettings } from '../config/settings.js'; +import type { LoadedSettings } from '../config/settings.js'; +import { SettingScope } from '../config/settings.js'; import { settingExistsInScope } from './settingsUtils.js'; /** diff --git a/packages/cli/src/utils/handleAutoUpdate.test.ts b/packages/cli/src/utils/handleAutoUpdate.test.ts index c7c3da67..837ba83b 100644 --- a/packages/cli/src/utils/handleAutoUpdate.test.ts +++ b/packages/cli/src/utils/handleAutoUpdate.test.ts @@ -4,11 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { getInstallationInfo, PackageManager } from './installationInfo.js'; import { updateEventEmitter } from './updateEventEmitter.js'; -import { UpdateObject } from '../ui/utils/updateCheck.js'; -import { LoadedSettings } from '../config/settings.js'; +import type { UpdateObject } from '../ui/utils/updateCheck.js'; +import type { LoadedSettings } from '../config/settings.js'; import EventEmitter from 'node:events'; import { handleAutoUpdate } from './handleAutoUpdate.js'; diff --git a/packages/cli/src/utils/handleAutoUpdate.ts b/packages/cli/src/utils/handleAutoUpdate.ts index 8b19e450..84060641 100644 --- a/packages/cli/src/utils/handleAutoUpdate.ts +++ b/packages/cli/src/utils/handleAutoUpdate.ts @@ -4,13 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { UpdateObject } from '../ui/utils/updateCheck.js'; -import { LoadedSettings } from '../config/settings.js'; +import type { UpdateObject } from '../ui/utils/updateCheck.js'; +import type { LoadedSettings } from '../config/settings.js'; import { getInstallationInfo } from './installationInfo.js'; import { updateEventEmitter } from './updateEventEmitter.js'; -import { HistoryItem, MessageType } from '../ui/types.js'; +import type { HistoryItem } from '../ui/types.js'; +import { MessageType } from '../ui/types.js'; import { spawnWrapper } from './spawnWrapper.js'; -import { spawn } from 'node:child_process'; +import type { spawn } from 'node:child_process'; export function handleAutoUpdate( info: UpdateObject | null, diff --git a/packages/cli/src/utils/sandbox.ts b/packages/cli/src/utils/sandbox.ts index 61c26997..3b328e4b 100644 --- a/packages/cli/src/utils/sandbox.ts +++ b/packages/cli/src/utils/sandbox.ts @@ -16,7 +16,7 @@ import { SETTINGS_DIRECTORY_NAME, } from '../config/settings.js'; import { promisify } from 'node:util'; -import { Config, SandboxConfig } from '@google/gemini-cli-core'; +import type { Config, SandboxConfig } from '@google/gemini-cli-core'; import { ConsolePatcher } from '../ui/utils/ConsolePatcher.js'; const execAsync = promisify(exec); diff --git a/packages/cli/src/utils/settingsUtils.ts b/packages/cli/src/utils/settingsUtils.ts index 6b5a55c1..bc34d554 100644 --- a/packages/cli/src/utils/settingsUtils.ts +++ b/packages/cli/src/utils/settingsUtils.ts @@ -4,12 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Settings, SettingScope, LoadedSettings } from '../config/settings.js'; -import { - SETTINGS_SCHEMA, +import type { + Settings, + SettingScope, + LoadedSettings, +} from '../config/settings.js'; +import type { SettingDefinition, SettingsSchema, } from '../config/settingsSchema.js'; +import { SETTINGS_SCHEMA } from '../config/settingsSchema.js'; // The schema is now nested, but many parts of the UI and logic work better // with a flattened structure and dot-notation keys. This section flattens the diff --git a/packages/cli/src/validateNonInterActiveAuth.test.ts b/packages/cli/src/validateNonInterActiveAuth.test.ts index 2cf4a260..e0a36d7b 100644 --- a/packages/cli/src/validateNonInterActiveAuth.test.ts +++ b/packages/cli/src/validateNonInterActiveAuth.test.ts @@ -5,10 +5,8 @@ */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { - validateNonInteractiveAuth, - NonInteractiveConfig, -} from './validateNonInterActiveAuth.js'; +import type { NonInteractiveConfig } from './validateNonInterActiveAuth.js'; +import { validateNonInteractiveAuth } from './validateNonInterActiveAuth.js'; import { AuthType } from '@google/gemini-cli-core'; import * as auth from './config/auth.js'; diff --git a/packages/cli/src/validateNonInterActiveAuth.ts b/packages/cli/src/validateNonInterActiveAuth.ts index 33b965b7..1a15c0fa 100644 --- a/packages/cli/src/validateNonInterActiveAuth.ts +++ b/packages/cli/src/validateNonInterActiveAuth.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { AuthType, Config } from '@google/gemini-cli-core'; +import type { Config } from '@google/gemini-cli-core'; +import { AuthType } from '@google/gemini-cli-core'; import { USER_SETTINGS_PATH } from './config/settings.js'; import { validateAuthMethod } from './config/auth.js'; diff --git a/packages/cli/src/zed-integration/acp.ts b/packages/cli/src/zed-integration/acp.ts index 8c607b42..74f97cc6 100644 --- a/packages/cli/src/zed-integration/acp.ts +++ b/packages/cli/src/zed-integration/acp.ts @@ -11,7 +11,7 @@ import { EOL } from 'node:os'; import * as schema from './schema.js'; export * from './schema.js'; -import { WritableStream, ReadableStream } from 'node:stream/web'; +import type { WritableStream, ReadableStream } from 'node:stream/web'; export class AgentSideConnection implements Client { #connection: Connection; diff --git a/packages/cli/src/zed-integration/fileSystemService.ts b/packages/cli/src/zed-integration/fileSystemService.ts index deb9857f..a56593f8 100644 --- a/packages/cli/src/zed-integration/fileSystemService.ts +++ b/packages/cli/src/zed-integration/fileSystemService.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { FileSystemService } from '@google/gemini-cli-core'; -import * as acp from './acp.js'; +import type { FileSystemService } from '@google/gemini-cli-core'; +import type * as acp from './acp.js'; /** * ACP client-based implementation of FileSystemService diff --git a/packages/cli/src/zed-integration/zedIntegration.ts b/packages/cli/src/zed-integration/zedIntegration.ts index f86fcbff..7a4814aa 100644 --- a/packages/cli/src/zed-integration/zedIntegration.ts +++ b/packages/cli/src/zed-integration/zedIntegration.ts @@ -4,16 +4,18 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { WritableStream, ReadableStream } from 'node:stream/web'; +import type { WritableStream, ReadableStream } from 'node:stream/web'; -import { - AuthType, +import type { Config, GeminiChat, - logToolCall, ToolResult, - convertToFunctionResponse, ToolCallConfirmationDetails, +} from '@google/gemini-cli-core'; +import { + AuthType, + logToolCall, + convertToFunctionResponse, ToolConfirmationOutcome, clearCachedCredentialFile, isNodeError, @@ -26,15 +28,17 @@ import { import * as acp from './acp.js'; import { AcpFileSystemService } from './fileSystemService.js'; import { Readable, Writable } from 'node:stream'; -import { Content, Part, FunctionCall } from '@google/genai'; -import { LoadedSettings, SettingScope } from '../config/settings.js'; +import type { Content, Part, FunctionCall } from '@google/genai'; +import type { LoadedSettings } from '../config/settings.js'; +import { SettingScope } from '../config/settings.js'; import * as fs from 'node:fs/promises'; import * as path from 'node:path'; import { z } from 'zod'; import { randomUUID } from 'node:crypto'; -import { Extension } from '../config/extension.js'; -import { CliArgs, loadCliConfig } from '../config/config.js'; +import type { Extension } from '../config/extension.js'; +import type { CliArgs } from '../config/config.js'; +import { loadCliConfig } from '../config/config.js'; export async function runZedIntegration( config: Config, diff --git a/packages/core/src/code_assist/codeAssist.ts b/packages/core/src/code_assist/codeAssist.ts index b5838209..f4c542c5 100644 --- a/packages/core/src/code_assist/codeAssist.ts +++ b/packages/core/src/code_assist/codeAssist.ts @@ -4,11 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { AuthType, ContentGenerator } from '../core/contentGenerator.js'; +import type { ContentGenerator } from '../core/contentGenerator.js'; +import { AuthType } from '../core/contentGenerator.js'; import { getOauthClient } from './oauth2.js'; import { setupUser } from './setup.js'; -import { CodeAssistServer, HttpOptions } from './server.js'; -import { Config } from '../config/config.js'; +import type { HttpOptions } from './server.js'; +import { CodeAssistServer } from './server.js'; +import type { Config } from '../config/config.js'; export async function createCodeAssistContentGenerator( httpOptions: HttpOptions, diff --git a/packages/core/src/code_assist/converter.test.ts b/packages/core/src/code_assist/converter.test.ts index 0b71e33f..83dd418a 100644 --- a/packages/core/src/code_assist/converter.test.ts +++ b/packages/core/src/code_assist/converter.test.ts @@ -5,19 +5,21 @@ */ import { describe, it, expect } from 'vitest'; +import type { CaGenerateContentResponse } from './converter.js'; import { toGenerateContentRequest, fromGenerateContentResponse, - CaGenerateContentResponse, toContents, } from './converter.js'; -import { +import type { ContentListUnion, GenerateContentParameters, +} from '@google/genai'; +import { GenerateContentResponse, FinishReason, BlockedReason, - Part, + type Part, } from '@google/genai'; describe('converter', () => { diff --git a/packages/core/src/code_assist/converter.ts b/packages/core/src/code_assist/converter.ts index 89f5b525..09a36314 100644 --- a/packages/core/src/code_assist/converter.ts +++ b/packages/core/src/code_assist/converter.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { Content, ContentListUnion, ContentUnion, @@ -12,7 +12,6 @@ import { GenerateContentParameters, CountTokensParameters, CountTokensResponse, - GenerateContentResponse, GenerationConfigRoutingConfig, MediaResolution, Candidate, @@ -27,6 +26,7 @@ import { ToolListUnion, ToolConfig, } from '@google/genai'; +import { GenerateContentResponse } from '@google/genai'; export interface CAGenerateContentRequest { model: string; diff --git a/packages/core/src/code_assist/oauth2.test.ts b/packages/core/src/code_assist/oauth2.test.ts index fc4c03f6..f7d19977 100644 --- a/packages/core/src/code_assist/oauth2.test.ts +++ b/packages/core/src/code_assist/oauth2.test.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { getOauthClient, resetOauthClientForTesting, @@ -20,7 +21,7 @@ import open from 'open'; import crypto from 'node:crypto'; import * as os from 'node:os'; import { AuthType } from '../core/contentGenerator.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import readline from 'node:readline'; vi.mock('os', async (importOriginal) => { diff --git a/packages/core/src/code_assist/oauth2.ts b/packages/core/src/code_assist/oauth2.ts index 9edd11f9..fc401655 100644 --- a/packages/core/src/code_assist/oauth2.ts +++ b/packages/core/src/code_assist/oauth2.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +import type { Credentials } from 'google-auth-library'; import { OAuth2Client, - Credentials, Compute, CodeChallengeMethod, } from 'google-auth-library'; @@ -17,7 +17,7 @@ import * as net from 'node:net'; import open from 'open'; import path from 'node:path'; import { promises as fs } from 'node:fs'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { getErrorMessage } from '../utils/errors.js'; import { UserAccountManager } from '../utils/userAccountManager.js'; import { AuthType } from '../core/contentGenerator.js'; diff --git a/packages/core/src/code_assist/server.ts b/packages/core/src/code_assist/server.ts index 61e7a090..cf40fc1a 100644 --- a/packages/core/src/code_assist/server.ts +++ b/packages/core/src/code_assist/server.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { OAuth2Client } from 'google-auth-library'; -import { +import type { OAuth2Client } from 'google-auth-library'; +import type { CodeAssistGlobalUserSettingResponse, LoadCodeAssistRequest, LoadCodeAssistResponse, @@ -13,7 +13,7 @@ import { OnboardUserRequest, SetCodeAssistGlobalUserSettingRequest, } from './types.js'; -import { +import type { CountTokensParameters, CountTokensResponse, EmbedContentParameters, @@ -22,11 +22,13 @@ import { GenerateContentResponse, } from '@google/genai'; import * as readline from 'node:readline'; -import { ContentGenerator } from '../core/contentGenerator.js'; -import { UserTierId } from './types.js'; -import { +import type { ContentGenerator } from '../core/contentGenerator.js'; +import type { UserTierId } from './types.js'; +import type { CaCountTokenResponse, CaGenerateContentResponse, +} from './converter.js'; +import { fromCountTokenResponse, fromGenerateContentResponse, toCountTokenRequest, diff --git a/packages/core/src/code_assist/setup.test.ts b/packages/core/src/code_assist/setup.test.ts index a069686c..e18c38f0 100644 --- a/packages/core/src/code_assist/setup.test.ts +++ b/packages/core/src/code_assist/setup.test.ts @@ -11,8 +11,9 @@ import { ProjectAccessError, } from './setup.js'; import { CodeAssistServer } from '../code_assist/server.js'; -import { OAuth2Client } from 'google-auth-library'; -import { GeminiUserTier, UserTierId } from './types.js'; +import type { OAuth2Client } from 'google-auth-library'; +import type { GeminiUserTier } from './types.js'; +import { UserTierId } from './types.js'; import { AuthType } from '../core/contentGenerator.js'; vi.mock('../code_assist/server.js'); diff --git a/packages/core/src/code_assist/setup.ts b/packages/core/src/code_assist/setup.ts index 32415274..9d89d6b1 100644 --- a/packages/core/src/code_assist/setup.ts +++ b/packages/core/src/code_assist/setup.ts @@ -4,15 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { ClientMetadata, GeminiUserTier, LoadCodeAssistResponse, OnboardUserRequest, - UserTierId, } from './types.js'; +import { UserTierId } from './types.js'; import { CodeAssistServer } from './server.js'; -import { OAuth2Client } from 'google-auth-library'; +import type { OAuth2Client } from 'google-auth-library'; import { AuthType } from '../core/contentGenerator.js'; export class ProjectIdRequiredError extends Error { diff --git a/packages/core/src/config/config.test.ts b/packages/core/src/config/config.test.ts index f6e86c79..e5d15d76 100644 --- a/packages/core/src/config/config.test.ts +++ b/packages/core/src/config/config.test.ts @@ -5,17 +5,18 @@ */ import { describe, it, expect, vi, beforeEach } from 'vitest'; -import { Mock } from 'vitest'; -import { Config, ConfigParameters, SandboxConfig } from './config.js'; +import type { Mock } from 'vitest'; +import type { ConfigParameters, SandboxConfig } from './config.js'; +import { Config } from './config.js'; import * as path from 'node:path'; import { setGeminiMdFilename as mockSetGeminiMdFilename } from '../tools/memoryTool.js'; import { DEFAULT_TELEMETRY_TARGET, DEFAULT_OTLP_ENDPOINT, } from '../telemetry/index.js'; +import type { ContentGeneratorConfig } from '../core/contentGenerator.js'; import { AuthType, - ContentGeneratorConfig, createContentGeneratorConfig, } from '../core/contentGenerator.js'; import { GeminiClient } from '../core/client.js'; diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index e3d323da..41759afc 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -6,9 +6,9 @@ import * as path from 'node:path'; import process from 'node:process'; +import type { ContentGeneratorConfig } from '../core/contentGenerator.js'; import { AuthType, - ContentGeneratorConfig, createContentGeneratorConfig, } from '../core/contentGenerator.js'; import { PromptRegistry } from '../prompts/prompt-registry.js'; @@ -28,25 +28,23 @@ import { WebSearchTool } from '../tools/web-search.js'; import { GeminiClient } from '../core/client.js'; import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; import { GitService } from '../services/gitService.js'; +import type { TelemetryTarget } from '../telemetry/index.js'; import { initializeTelemetry, DEFAULT_TELEMETRY_TARGET, DEFAULT_OTLP_ENDPOINT, - TelemetryTarget, - StartSessionEvent, } from '../telemetry/index.js'; +import { StartSessionEvent } from '../telemetry/index.js'; import { DEFAULT_GEMINI_EMBEDDING_MODEL, DEFAULT_GEMINI_FLASH_MODEL, } from './models.js'; import { shouldAttemptBrowserLaunch } from '../utils/browser.js'; -import { MCPOAuthConfig } from '../mcp/oauth-provider.js'; +import type { MCPOAuthConfig } from '../mcp/oauth-provider.js'; import { IdeClient } from '../ide/ide-client.js'; import type { Content } from '@google/genai'; -import { - FileSystemService, - StandardFileSystemService, -} from '../services/fileSystemService.js'; +import type { FileSystemService } from '../services/fileSystemService.js'; +import { StandardFileSystemService } from '../services/fileSystemService.js'; import { logCliConfiguration, logIdeConnection } from '../telemetry/loggers.js'; import { IdeConnectionEvent, IdeConnectionType } from '../telemetry/types.js'; diff --git a/packages/core/src/core/client.test.ts b/packages/core/src/core/client.test.ts index f6dfa8ec..9fdd7e06 100644 --- a/packages/core/src/core/client.test.ts +++ b/packages/core/src/core/client.test.ts @@ -6,16 +6,17 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { +import type { Chat, Content, EmbedContentResponse, GenerateContentResponse, - GoogleGenAI, } from '@google/genai'; +import { GoogleGenAI } from '@google/genai'; import { findIndexAfterFraction, GeminiClient } from './client.js'; -import { AuthType, ContentGenerator } from './contentGenerator.js'; -import { GeminiChat } from './geminiChat.js'; +import type { ContentGenerator } from './contentGenerator.js'; +import { AuthType } from './contentGenerator.js'; +import type { GeminiChat } from './geminiChat.js'; import { Config } from '../config/config.js'; import { GeminiEventType, Turn } from './turn.js'; import { getCoreSystemPrompt } from './prompts.js'; diff --git a/packages/core/src/core/client.ts b/packages/core/src/core/client.ts index 64b6511d..afddb2df 100644 --- a/packages/core/src/core/client.ts +++ b/packages/core/src/core/client.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { EmbedContentParameters, GenerateContentConfig, PartListUnion, @@ -16,14 +16,10 @@ import { getDirectoryContextString, getEnvironmentContext, } from '../utils/environmentContext.js'; -import { - Turn, - ServerGeminiStreamEvent, - GeminiEventType, - ChatCompressionInfo, -} from './turn.js'; -import { Config } from '../config/config.js'; -import { UserTierId } from '../code_assist/types.js'; +import type { ServerGeminiStreamEvent, ChatCompressionInfo } from './turn.js'; +import { Turn, GeminiEventType } from './turn.js'; +import type { Config } from '../config/config.js'; +import type { UserTierId } from '../code_assist/types.js'; import { getCoreSystemPrompt, getCompressionPrompt } from './prompts.js'; import { getResponseText } from '../utils/generateContentResponseUtilities.js'; import { checkNextSpeaker } from '../utils/nextSpeakerChecker.js'; @@ -33,12 +29,11 @@ import { retryWithBackoff } from '../utils/retry.js'; import { getErrorMessage } from '../utils/errors.js'; import { isFunctionResponse } from '../utils/messageInspectors.js'; import { tokenLimit } from './tokenLimits.js'; -import { - AuthType, +import type { ContentGenerator, ContentGeneratorConfig, - createContentGenerator, } from './contentGenerator.js'; +import { AuthType, createContentGenerator } from './contentGenerator.js'; import { ProxyAgent, setGlobalDispatcher } from 'undici'; import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js'; import { LoopDetectionService } from '../services/loopDetectionService.js'; @@ -53,7 +48,7 @@ import { MalformedJsonResponseEvent, NextSpeakerCheckEvent, } from '../telemetry/types.js'; -import { IdeContext, File } from '../ide/ideContext.js'; +import type { IdeContext, File } from '../ide/ideContext.js'; function isThinkingSupported(model: string) { if (model.startsWith('gemini-2.5')) return true; diff --git a/packages/core/src/core/contentGenerator.test.ts b/packages/core/src/core/contentGenerator.test.ts index 5a857121..acbc0481 100644 --- a/packages/core/src/core/contentGenerator.test.ts +++ b/packages/core/src/core/contentGenerator.test.ts @@ -5,15 +5,15 @@ */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +import type { ContentGenerator } from './contentGenerator.js'; import { createContentGenerator, AuthType, createContentGeneratorConfig, - ContentGenerator, } from './contentGenerator.js'; import { createCodeAssistContentGenerator } from '../code_assist/codeAssist.js'; import { GoogleGenAI } from '@google/genai'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { LoggingContentGenerator } from './loggingContentGenerator.js'; vi.mock('../code_assist/codeAssist.js'); diff --git a/packages/core/src/core/contentGenerator.ts b/packages/core/src/core/contentGenerator.ts index cfbff84e..1f742205 100644 --- a/packages/core/src/core/contentGenerator.ts +++ b/packages/core/src/core/contentGenerator.ts @@ -4,20 +4,20 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { CountTokensResponse, GenerateContentResponse, GenerateContentParameters, CountTokensParameters, EmbedContentResponse, EmbedContentParameters, - GoogleGenAI, } from '@google/genai'; +import { GoogleGenAI } from '@google/genai'; import { createCodeAssistContentGenerator } from '../code_assist/codeAssist.js'; import { DEFAULT_GEMINI_MODEL } from '../config/models.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; -import { UserTierId } from '../code_assist/types.js'; +import type { UserTierId } from '../code_assist/types.js'; import { LoggingContentGenerator } from './loggingContentGenerator.js'; import { InstallationManager } from '../utils/installationManager.js'; diff --git a/packages/core/src/core/coreToolScheduler.test.ts b/packages/core/src/core/coreToolScheduler.test.ts index 4b5962d9..ee3692f6 100644 --- a/packages/core/src/core/coreToolScheduler.test.ts +++ b/packages/core/src/core/coreToolScheduler.test.ts @@ -5,26 +5,27 @@ */ import { describe, it, expect, vi } from 'vitest'; +import type { ToolCall, WaitingToolCall } from './coreToolScheduler.js'; import { CoreToolScheduler, - ToolCall, - WaitingToolCall, convertToFunctionResponse, } from './coreToolScheduler.js'; -import { - BaseDeclarativeTool, - BaseToolInvocation, +import type { ToolCallConfirmationDetails, - ToolConfirmationOutcome, ToolConfirmationPayload, ToolInvocation, ToolResult, Config, - Kind, - ApprovalMode, ToolRegistry, } from '../index.js'; -import { Part, PartListUnion } from '@google/genai'; +import { + BaseDeclarativeTool, + BaseToolInvocation, + ToolConfirmationOutcome, + Kind, + ApprovalMode, +} from '../index.js'; +import type { Part, PartListUnion } from '@google/genai'; import { MockModifiableTool, MockTool } from '../test-utils/tools.js'; class TestApprovalTool extends BaseDeclarativeTool<{ id: string }, ToolResult> { diff --git a/packages/core/src/core/coreToolScheduler.ts b/packages/core/src/core/coreToolScheduler.ts index e2997c3b..8c175094 100644 --- a/packages/core/src/core/coreToolScheduler.ts +++ b/packages/core/src/core/coreToolScheduler.ts @@ -4,29 +4,31 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { ToolCallRequestInfo, ToolCallResponseInfo, - ToolConfirmationOutcome, ToolCallConfirmationDetails, ToolResult, ToolResultDisplay, ToolRegistry, - ApprovalMode, EditorType, Config, - logToolCall, - ToolCallEvent, ToolConfirmationPayload, - ToolErrorType, AnyDeclarativeTool, AnyToolInvocation, } from '../index.js'; -import { Part, PartListUnion } from '@google/genai'; +import { + ToolConfirmationOutcome, + ApprovalMode, + logToolCall, + ToolErrorType, + ToolCallEvent, +} from '../index.js'; +import type { Part, PartListUnion } from '@google/genai'; import { getResponseTextFromParts } from '../utils/generateContentResponseUtilities.js'; +import type { ModifyContext } from '../tools/modifiable-tool.js'; import { isModifiableDeclarativeTool, - ModifyContext, modifyWithEditor, } from '../tools/modifiable-tool.js'; import * as Diff from 'diff'; diff --git a/packages/core/src/core/geminiChat.test.ts b/packages/core/src/core/geminiChat.test.ts index 0bb4059d..2923fbfa 100644 --- a/packages/core/src/core/geminiChat.test.ts +++ b/packages/core/src/core/geminiChat.test.ts @@ -5,7 +5,7 @@ */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { +import type { Content, Models, GenerateContentConfig, @@ -13,7 +13,7 @@ import { GenerateContentResponse, } from '@google/genai'; import { GeminiChat, EmptyStreamError } from './geminiChat.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { setSimulate429 } from '../utils/testUtils.js'; // Mocks diff --git a/packages/core/src/core/geminiChat.ts b/packages/core/src/core/geminiChat.ts index 52833f82..37739899 100644 --- a/packages/core/src/core/geminiChat.ts +++ b/packages/core/src/core/geminiChat.ts @@ -7,22 +7,23 @@ // DISCLAIMER: This is a copied version of https://github.com/googleapis/js-genai/blob/main/src/chats.ts with the intention of working around a key bug // where function responses are not treated as "valid" responses: https://b.corp.google.com/issues/420354090 -import { +import type { GenerateContentResponse, Content, GenerateContentConfig, SendMessageParameters, - createUserContent, Part, Tool, } from '@google/genai'; +import { createUserContent } from '@google/genai'; import { retryWithBackoff } from '../utils/retry.js'; import { isFunctionResponse } from '../utils/messageInspectors.js'; -import { ContentGenerator, AuthType } from './contentGenerator.js'; -import { Config } from '../config/config.js'; +import type { ContentGenerator } from './contentGenerator.js'; +import { AuthType } from './contentGenerator.js'; +import type { Config } from '../config/config.js'; import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js'; import { hasCycleInSchema } from '../tools/tools.js'; -import { StructuredError } from './turn.js'; +import type { StructuredError } from './turn.js'; import { recordContentRetry, recordContentRetryFailure, diff --git a/packages/core/src/core/logger.test.ts b/packages/core/src/core/logger.test.ts index 41ff38f5..a7acf878 100644 --- a/packages/core/src/core/logger.test.ts +++ b/packages/core/src/core/logger.test.ts @@ -13,17 +13,17 @@ import { afterEach, afterAll, } from 'vitest'; +import type { LogEntry } from './logger.js'; import { Logger, MessageSenderType, - LogEntry, encodeTagName, decodeTagName, } from './logger.js'; import { Storage } from '../config/storage.js'; import { promises as fs, existsSync } from 'node:fs'; import path from 'node:path'; -import { Content } from '@google/genai'; +import type { Content } from '@google/genai'; import crypto from 'node:crypto'; import os from 'node:os'; diff --git a/packages/core/src/core/logger.ts b/packages/core/src/core/logger.ts index 562b14bf..1f4e6700 100644 --- a/packages/core/src/core/logger.ts +++ b/packages/core/src/core/logger.ts @@ -6,8 +6,8 @@ import path from 'node:path'; import { promises as fs } from 'node:fs'; -import { Content } from '@google/genai'; -import { Storage } from '../config/storage.js'; +import type { Content } from '@google/genai'; +import type { Storage } from '../config/storage.js'; const LOG_FILE_NAME = 'logs.json'; diff --git a/packages/core/src/core/loggingContentGenerator.ts b/packages/core/src/core/loggingContentGenerator.ts index 6d7a29b9..58565625 100644 --- a/packages/core/src/core/loggingContentGenerator.ts +++ b/packages/core/src/core/loggingContentGenerator.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { Content, CountTokensParameters, CountTokensResponse, @@ -19,13 +19,13 @@ import { ApiResponseEvent, ApiErrorEvent, } from '../telemetry/types.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { logApiError, logApiRequest, logApiResponse, } from '../telemetry/loggers.js'; -import { ContentGenerator } from './contentGenerator.js'; +import type { ContentGenerator } from './contentGenerator.js'; import { toContents } from '../code_assist/converter.js'; import { isStructuredError } from '../utils/quotaErrorDetection.js'; diff --git a/packages/core/src/core/nonInteractiveToolExecutor.test.ts b/packages/core/src/core/nonInteractiveToolExecutor.test.ts index bf56009f..c5e71239 100644 --- a/packages/core/src/core/nonInteractiveToolExecutor.test.ts +++ b/packages/core/src/core/nonInteractiveToolExecutor.test.ts @@ -6,15 +6,14 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { executeToolCall } from './nonInteractiveToolExecutor.js'; -import { +import type { ToolRegistry, ToolCallRequestInfo, ToolResult, Config, - ToolErrorType, - ApprovalMode, } from '../index.js'; -import { Part } from '@google/genai'; +import { ToolErrorType, ApprovalMode } from '../index.js'; +import type { Part } from '@google/genai'; import { MockTool } from '../test-utils/tools.js'; describe('executeToolCall', () => { diff --git a/packages/core/src/core/nonInteractiveToolExecutor.ts b/packages/core/src/core/nonInteractiveToolExecutor.ts index 46ca71d2..67407230 100644 --- a/packages/core/src/core/nonInteractiveToolExecutor.ts +++ b/packages/core/src/core/nonInteractiveToolExecutor.ts @@ -4,7 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { ToolCallRequestInfo, ToolCallResponseInfo, Config } from '../index.js'; +import type { + ToolCallRequestInfo, + ToolCallResponseInfo, + Config, +} from '../index.js'; import { CoreToolScheduler } from './coreToolScheduler.js'; /** diff --git a/packages/core/src/core/subagent.test.ts b/packages/core/src/core/subagent.test.ts index e4c66c86..2dc240a9 100644 --- a/packages/core/src/core/subagent.test.ts +++ b/packages/core/src/core/subagent.test.ts @@ -4,31 +4,35 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { vi, describe, it, expect, beforeEach, Mock, afterEach } from 'vitest'; -import { - ContextState, - SubAgentScope, - SubagentTerminateMode, +import type { Mock } from 'vitest'; +import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'; +import type { PromptConfig, ModelConfig, RunConfig, OutputConfig, ToolConfig, } from './subagent.js'; -import { Config, ConfigParameters } from '../config/config.js'; +import { + ContextState, + SubAgentScope, + SubagentTerminateMode, +} from './subagent.js'; +import type { ConfigParameters } from '../config/config.js'; +import { Config } from '../config/config.js'; import { GeminiChat } from './geminiChat.js'; import { createContentGenerator } from './contentGenerator.js'; import { getEnvironmentContext } from '../utils/environmentContext.js'; import { executeToolCall } from './nonInteractiveToolExecutor.js'; -import { ToolRegistry } from '../tools/tool-registry.js'; +import type { ToolRegistry } from '../tools/tool-registry.js'; import { DEFAULT_GEMINI_MODEL } from '../config/models.js'; -import { +import type { Content, FunctionCall, FunctionDeclaration, GenerateContentConfig, - Type, } from '@google/genai'; +import { Type } from '@google/genai'; import { ToolErrorType } from '../tools/tool-error.js'; vi.mock('./geminiChat.js'); diff --git a/packages/core/src/core/subagent.ts b/packages/core/src/core/subagent.ts index 63769d64..780c722f 100644 --- a/packages/core/src/core/subagent.ts +++ b/packages/core/src/core/subagent.ts @@ -5,19 +5,19 @@ */ import { reportError } from '../utils/errorReporting.js'; -import { Config } from '../config/config.js'; -import { ToolCallRequestInfo } from './turn.js'; +import type { Config } from '../config/config.js'; +import type { ToolCallRequestInfo } from './turn.js'; import { executeToolCall } from './nonInteractiveToolExecutor.js'; import { createContentGenerator } from './contentGenerator.js'; import { getEnvironmentContext } from '../utils/environmentContext.js'; -import { +import type { Content, Part, FunctionCall, GenerateContentConfig, FunctionDeclaration, - Type, } from '@google/genai'; +import { Type } from '@google/genai'; import { GeminiChat } from './geminiChat.js'; /** diff --git a/packages/core/src/core/turn.test.ts b/packages/core/src/core/turn.test.ts index 595de151..c749baba 100644 --- a/packages/core/src/core/turn.test.ts +++ b/packages/core/src/core/turn.test.ts @@ -5,15 +5,14 @@ */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { - Turn, - GeminiEventType, +import type { ServerGeminiToolCallRequestEvent, ServerGeminiErrorEvent, } from './turn.js'; -import { GenerateContentResponse, Part, Content } from '@google/genai'; +import { Turn, GeminiEventType } from './turn.js'; +import type { GenerateContentResponse, Part, Content } from '@google/genai'; import { reportError } from '../utils/errorReporting.js'; -import { GeminiChat } from './geminiChat.js'; +import type { GeminiChat } from './geminiChat.js'; const mockSendMessageStream = vi.fn(); const mockGetHistory = vi.fn(); diff --git a/packages/core/src/core/turn.ts b/packages/core/src/core/turn.ts index a2fed38a..6d1aa294 100644 --- a/packages/core/src/core/turn.ts +++ b/packages/core/src/core/turn.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { Part, PartListUnion, GenerateContentResponse, @@ -12,12 +12,12 @@ import { FunctionDeclaration, FinishReason, } from '@google/genai'; -import { +import type { ToolCallConfirmationDetails, ToolResult, ToolResultDisplay, } from '../tools/tools.js'; -import { ToolErrorType } from '../tools/tool-error.js'; +import type { ToolErrorType } from '../tools/tool-error.js'; import { getResponseText } from '../utils/generateContentResponseUtilities.js'; import { reportError } from '../utils/errorReporting.js'; import { @@ -25,7 +25,7 @@ import { UnauthorizedError, toFriendlyError, } from '../utils/errors.js'; -import { GeminiChat } from './geminiChat.js'; +import type { GeminiChat } from './geminiChat.js'; // Define a structure for tools passed to the server export interface ServerTool { diff --git a/packages/core/src/ide/ide-client.ts b/packages/core/src/ide/ide-client.ts index 868b9583..90e2ee3b 100644 --- a/packages/core/src/ide/ide-client.ts +++ b/packages/core/src/ide/ide-client.ts @@ -6,14 +6,14 @@ import * as fs from 'node:fs'; import { isSubpath } from '../utils/paths.js'; -import { detectIde, DetectedIde, getIdeInfo } from '../ide/detect-ide.js'; +import { detectIde, type DetectedIde, getIdeInfo } from '../ide/detect-ide.js'; +import type { DiffUpdateResult } from '../ide/ideContext.js'; import { ideContext, IdeContextNotificationSchema, IdeDiffAcceptedNotificationSchema, IdeDiffClosedNotificationSchema, CloseDiffResponseSchema, - DiffUpdateResult, } from '../ide/ideContext.js'; import { getIdeProcessInfo } from './process-utils.js'; import { Client } from '@modelcontextprotocol/sdk/client/index.js'; diff --git a/packages/core/src/ide/ide-installer.ts b/packages/core/src/ide/ide-installer.ts index e82ac69c..aabb4131 100644 --- a/packages/core/src/ide/ide-installer.ts +++ b/packages/core/src/ide/ide-installer.ts @@ -9,7 +9,7 @@ import * as process from 'node:process'; import * as path from 'node:path'; import * as fs from 'node:fs'; import * as os from 'node:os'; -import { DetectedIde, getIdeInfo, IdeInfo } from './detect-ide.js'; +import { DetectedIde, getIdeInfo, type IdeInfo } from './detect-ide.js'; import { GEMINI_CLI_COMPANION_EXTENSION_NAME } from './constants.js'; function getVsCodeCommand(platform: NodeJS.Platform = process.platform) { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 40e6b6e0..eb4b9b52 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -56,7 +56,8 @@ export * from './services/fileSystemService.js'; export * from './ide/ide-client.js'; export * from './ide/ideContext.js'; export * from './ide/ide-installer.js'; -export { getIdeInfo, DetectedIde, IdeInfo } from './ide/detect-ide.js'; +export { getIdeInfo, DetectedIde } from './ide/detect-ide.js'; +export { type IdeInfo } from './ide/detect-ide.js'; export * from './ide/constants.js'; // Export Shell Execution Service @@ -88,11 +89,11 @@ export * from './tools/mcp-tool.js'; // MCP OAuth export { MCPOAuthProvider } from './mcp/oauth-provider.js'; -export { +export type { MCPOAuthToken, MCPOAuthCredentials, - MCPOAuthTokenStorage, } from './mcp/oauth-token-storage.js'; +export { MCPOAuthTokenStorage } from './mcp/oauth-token-storage.js'; export type { MCPOAuthConfig } from './mcp/oauth-provider.js'; export type { OAuthAuthorizationServerMetadata, diff --git a/packages/core/src/mcp/google-auth-provider.test.ts b/packages/core/src/mcp/google-auth-provider.test.ts index 65daa74f..b568fa2c 100644 --- a/packages/core/src/mcp/google-auth-provider.test.ts +++ b/packages/core/src/mcp/google-auth-provider.test.ts @@ -6,8 +6,9 @@ import { GoogleAuth } from 'google-auth-library'; import { GoogleCredentialProvider } from './google-auth-provider.js'; -import { vi, describe, beforeEach, it, expect, Mock } from 'vitest'; -import { MCPServerConfig } from '../config/config.js'; +import type { Mock } from 'vitest'; +import { vi, describe, beforeEach, it, expect } from 'vitest'; +import type { MCPServerConfig } from '../config/config.js'; vi.mock('google-auth-library'); diff --git a/packages/core/src/mcp/google-auth-provider.ts b/packages/core/src/mcp/google-auth-provider.ts index 2b52f734..d7611562 100644 --- a/packages/core/src/mcp/google-auth-provider.ts +++ b/packages/core/src/mcp/google-auth-provider.ts @@ -4,15 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js'; -import { +import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js'; +import type { OAuthClientInformation, OAuthClientInformationFull, OAuthClientMetadata, OAuthTokens, } from '@modelcontextprotocol/sdk/shared/auth.js'; import { GoogleAuth } from 'google-auth-library'; -import { MCPServerConfig } from '../config/config.js'; +import type { MCPServerConfig } from '../config/config.js'; const ALLOWED_HOSTS = [/^.+\.googleapis\.com$/, /^(.*\.)?luci\.app$/]; diff --git a/packages/core/src/mcp/oauth-provider.test.ts b/packages/core/src/mcp/oauth-provider.test.ts index 2163d6bc..0ca099de 100644 --- a/packages/core/src/mcp/oauth-provider.test.ts +++ b/packages/core/src/mcp/oauth-provider.test.ts @@ -17,13 +17,14 @@ vi.mock('./oauth-token-storage.js'); import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import * as http from 'node:http'; import * as crypto from 'node:crypto'; -import { - MCPOAuthProvider, +import type { MCPOAuthConfig, OAuthTokenResponse, OAuthClientRegistrationResponse, } from './oauth-provider.js'; -import { MCPOAuthTokenStorage, MCPOAuthToken } from './oauth-token-storage.js'; +import { MCPOAuthProvider } from './oauth-provider.js'; +import type { MCPOAuthToken } from './oauth-token-storage.js'; +import { MCPOAuthTokenStorage } from './oauth-token-storage.js'; // Mock fetch globally const mockFetch = vi.fn(); diff --git a/packages/core/src/mcp/oauth-provider.ts b/packages/core/src/mcp/oauth-provider.ts index c2579d1a..c3cb2011 100644 --- a/packages/core/src/mcp/oauth-provider.ts +++ b/packages/core/src/mcp/oauth-provider.ts @@ -8,7 +8,8 @@ import * as http from 'node:http'; import * as crypto from 'node:crypto'; import { URL } from 'node:url'; import { openBrowserSecurely } from '../utils/secure-browser-launcher.js'; -import { MCPOAuthToken, MCPOAuthTokenStorage } from './oauth-token-storage.js'; +import type { MCPOAuthToken } from './oauth-token-storage.js'; +import { MCPOAuthTokenStorage } from './oauth-token-storage.js'; import { getErrorMessage } from '../utils/errors.js'; import { OAuthUtils } from './oauth-utils.js'; diff --git a/packages/core/src/mcp/oauth-token-storage.test.ts b/packages/core/src/mcp/oauth-token-storage.test.ts index f1dc644e..bf8ca2e6 100644 --- a/packages/core/src/mcp/oauth-token-storage.test.ts +++ b/packages/core/src/mcp/oauth-token-storage.test.ts @@ -7,11 +7,11 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { promises as fs } from 'node:fs'; import * as path from 'node:path'; -import { - MCPOAuthTokenStorage, +import type { MCPOAuthToken, MCPOAuthCredentials, } from './oauth-token-storage.js'; +import { MCPOAuthTokenStorage } from './oauth-token-storage.js'; // Mock file system operations vi.mock('node:fs', () => ({ diff --git a/packages/core/src/mcp/oauth-utils.test.ts b/packages/core/src/mcp/oauth-utils.test.ts index 47bfb9ae..8ac51697 100644 --- a/packages/core/src/mcp/oauth-utils.test.ts +++ b/packages/core/src/mcp/oauth-utils.test.ts @@ -5,11 +5,11 @@ */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { - OAuthUtils, +import type { OAuthAuthorizationServerMetadata, OAuthProtectedResourceMetadata, } from './oauth-utils.js'; +import { OAuthUtils } from './oauth-utils.js'; // Mock fetch globally const mockFetch = vi.fn(); diff --git a/packages/core/src/mcp/oauth-utils.ts b/packages/core/src/mcp/oauth-utils.ts index b926ce0b..d6c589a6 100644 --- a/packages/core/src/mcp/oauth-utils.ts +++ b/packages/core/src/mcp/oauth-utils.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { MCPOAuthConfig } from './oauth-provider.js'; +import type { MCPOAuthConfig } from './oauth-provider.js'; import { getErrorMessage } from '../utils/errors.js'; /** diff --git a/packages/core/src/prompts/mcp-prompts.ts b/packages/core/src/prompts/mcp-prompts.ts index 7265a023..01096cf0 100644 --- a/packages/core/src/prompts/mcp-prompts.ts +++ b/packages/core/src/prompts/mcp-prompts.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Config } from '../config/config.js'; -import { DiscoveredMCPPrompt } from '../tools/mcp-client.js'; +import type { Config } from '../config/config.js'; +import type { DiscoveredMCPPrompt } from '../tools/mcp-client.js'; export function getMCPServerPrompts( config: Config, diff --git a/packages/core/src/prompts/prompt-registry.ts b/packages/core/src/prompts/prompt-registry.ts index a94183ac..aac761ab 100644 --- a/packages/core/src/prompts/prompt-registry.ts +++ b/packages/core/src/prompts/prompt-registry.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { DiscoveredMCPPrompt } from '../tools/mcp-client.js'; +import type { DiscoveredMCPPrompt } from '../tools/mcp-client.js'; export class PromptRegistry { private prompts: Map = new Map(); diff --git a/packages/core/src/services/chatRecordingService.test.ts b/packages/core/src/services/chatRecordingService.test.ts index fddd3caf..82de5f0e 100644 --- a/packages/core/src/services/chatRecordingService.test.ts +++ b/packages/core/src/services/chatRecordingService.test.ts @@ -4,24 +4,17 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { - expect, - it, - describe, - vi, - beforeEach, - afterEach, - MockInstance, -} from 'vitest'; +import type { MockInstance } from 'vitest'; +import { expect, it, describe, vi, beforeEach, afterEach } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import { randomUUID } from 'node:crypto'; -import { - ChatRecordingService, +import type { ConversationRecord, ToolCallRecord, } from './chatRecordingService.js'; -import { Config } from '../config/config.js'; +import { ChatRecordingService } from './chatRecordingService.js'; +import type { Config } from '../config/config.js'; import { getProjectHash } from '../utils/paths.js'; vi.mock('node:fs'); diff --git a/packages/core/src/services/chatRecordingService.ts b/packages/core/src/services/chatRecordingService.ts index bca469de..138c2d81 100644 --- a/packages/core/src/services/chatRecordingService.ts +++ b/packages/core/src/services/chatRecordingService.ts @@ -11,7 +11,7 @@ import { getProjectHash } from '../utils/paths.js'; import path from 'node:path'; import fs from 'node:fs'; import { randomUUID } from 'node:crypto'; -import { PartListUnion } from '@google/genai'; +import type { PartListUnion } from '@google/genai'; /** * Token usage summary for a message or conversation. diff --git a/packages/core/src/services/fileDiscoveryService.ts b/packages/core/src/services/fileDiscoveryService.ts index 09c590ff..0a309f8f 100644 --- a/packages/core/src/services/fileDiscoveryService.ts +++ b/packages/core/src/services/fileDiscoveryService.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { GitIgnoreParser, GitIgnoreFilter } from '../utils/gitIgnoreParser.js'; +import type { GitIgnoreFilter } from '../utils/gitIgnoreParser.js'; +import { GitIgnoreParser } from '../utils/gitIgnoreParser.js'; import { isGitRepository } from '../utils/gitUtils.js'; import * as path from 'node:path'; diff --git a/packages/core/src/services/gitService.ts b/packages/core/src/services/gitService.ts index de0910d2..374be81e 100644 --- a/packages/core/src/services/gitService.ts +++ b/packages/core/src/services/gitService.ts @@ -8,8 +8,9 @@ import * as fs from 'node:fs/promises'; import * as path from 'node:path'; import { isNodeError } from '../utils/errors.js'; import { exec } from 'node:child_process'; -import { simpleGit, SimpleGit, CheckRepoActions } from 'simple-git'; -import { Storage } from '../config/storage.js'; +import type { SimpleGit } from 'simple-git'; +import { simpleGit, CheckRepoActions } from 'simple-git'; +import type { Storage } from '../config/storage.js'; export class GitService { private projectRoot: string; diff --git a/packages/core/src/services/loopDetectionService.test.ts b/packages/core/src/services/loopDetectionService.test.ts index 27a9d4e9..542ea6ce 100644 --- a/packages/core/src/services/loopDetectionService.test.ts +++ b/packages/core/src/services/loopDetectionService.test.ts @@ -5,14 +5,14 @@ */ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { Config } from '../config/config.js'; -import { GeminiClient } from '../core/client.js'; -import { - GeminiEventType, +import type { Config } from '../config/config.js'; +import type { GeminiClient } from '../core/client.js'; +import type { ServerGeminiContentEvent, ServerGeminiStreamEvent, ServerGeminiToolCallRequestEvent, } from '../core/turn.js'; +import { GeminiEventType } from '../core/turn.js'; import * as loggers from '../telemetry/loggers.js'; import { LoopType } from '../telemetry/types.js'; import { LoopDetectionService } from './loopDetectionService.js'; diff --git a/packages/core/src/services/loopDetectionService.ts b/packages/core/src/services/loopDetectionService.ts index c14e5df0..36f3169f 100644 --- a/packages/core/src/services/loopDetectionService.ts +++ b/packages/core/src/services/loopDetectionService.ts @@ -5,10 +5,12 @@ */ import { createHash } from 'node:crypto'; -import { GeminiEventType, ServerGeminiStreamEvent } from '../core/turn.js'; +import type { ServerGeminiStreamEvent } from '../core/turn.js'; +import { GeminiEventType } from '../core/turn.js'; import { logLoopDetected } from '../telemetry/loggers.js'; import { LoopDetectedEvent, LoopType } from '../telemetry/types.js'; -import { Config, DEFAULT_GEMINI_FLASH_MODEL } from '../config/config.js'; +import type { Config } from '../config/config.js'; +import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/config.js'; const TOOL_CALL_LOOP_THRESHOLD = 5; const CONTENT_LOOP_THRESHOLD = 10; diff --git a/packages/core/src/services/shellExecutionService.test.ts b/packages/core/src/services/shellExecutionService.test.ts index 877327ff..6c35a32b 100644 --- a/packages/core/src/services/shellExecutionService.test.ts +++ b/packages/core/src/services/shellExecutionService.test.ts @@ -6,12 +6,10 @@ import { vi, describe, it, expect, beforeEach, type Mock } from 'vitest'; import EventEmitter from 'node:events'; -import { Readable } from 'node:stream'; +import type { Readable } from 'node:stream'; import { type ChildProcess } from 'node:child_process'; -import { - ShellExecutionService, - ShellOutputEvent, -} from './shellExecutionService.js'; +import type { ShellOutputEvent } from './shellExecutionService.js'; +import { ShellExecutionService } from './shellExecutionService.js'; // Hoisted Mocks const mockPtySpawn = vi.hoisted(() => vi.fn()); diff --git a/packages/core/src/services/shellExecutionService.ts b/packages/core/src/services/shellExecutionService.ts index 358ae287..41c22d0e 100644 --- a/packages/core/src/services/shellExecutionService.ts +++ b/packages/core/src/services/shellExecutionService.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { getPty, PtyImplementation } from '../utils/getPty.js'; +import type { PtyImplementation } from '../utils/getPty.js'; +import { getPty } from '../utils/getPty.js'; import { spawn as cpSpawn } from 'node:child_process'; import { TextDecoder } from 'node:util'; import os from 'node:os'; diff --git a/packages/core/src/telemetry/clearcut-logger/clearcut-logger.test.ts b/packages/core/src/telemetry/clearcut-logger/clearcut-logger.test.ts index b2636408..42ccf1e4 100644 --- a/packages/core/src/telemetry/clearcut-logger/clearcut-logger.test.ts +++ b/packages/core/src/telemetry/clearcut-logger/clearcut-logger.test.ts @@ -14,18 +14,11 @@ import { beforeAll, afterAll, } from 'vitest'; -import { - ClearcutLogger, - LogEvent, - LogEventEntry, - EventNames, - TEST_ONLY, -} from './clearcut-logger.js'; -import { - AuthType, - ContentGeneratorConfig, -} from '../../core/contentGenerator.js'; -import { ConfigParameters } from '../../config/config.js'; +import type { LogEvent, LogEventEntry } from './clearcut-logger.js'; +import { ClearcutLogger, EventNames, TEST_ONLY } from './clearcut-logger.js'; +import type { ContentGeneratorConfig } from '../../core/contentGenerator.js'; +import { AuthType } from '../../core/contentGenerator.js'; +import type { ConfigParameters } from '../../config/config.js'; import { EventMetadataKey } from './event-metadata-key.js'; import { makeFakeConfig } from '../../test-utils/config.js'; import { http, HttpResponse } from 'msw'; diff --git a/packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts b/packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts index 9b51b13d..a58753eb 100644 --- a/packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts +++ b/packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts @@ -5,7 +5,7 @@ */ import { HttpsProxyAgent } from 'https-proxy-agent'; -import { +import type { StartSessionEvent, UserPromptEvent, ToolCallEvent, @@ -23,7 +23,7 @@ import { FileOperationEvent, } from '../types.js'; import { EventMetadataKey } from './event-metadata-key.js'; -import { Config } from '../../config/config.js'; +import type { Config } from '../../config/config.js'; import { InstallationManager } from '../../utils/installationManager.js'; import { UserAccountManager } from '../../utils/userAccountManager.js'; import { safeJsonStringify } from '../../utils/safeJsonStringify.js'; diff --git a/packages/core/src/telemetry/file-exporters.ts b/packages/core/src/telemetry/file-exporters.ts index aee3dfd6..55fe6410 100644 --- a/packages/core/src/telemetry/file-exporters.ts +++ b/packages/core/src/telemetry/file-exporters.ts @@ -5,14 +5,18 @@ */ import * as fs from 'node:fs'; -import { ExportResult, ExportResultCode } from '@opentelemetry/core'; -import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base'; -import { ReadableLogRecord, LogRecordExporter } from '@opentelemetry/sdk-logs'; -import { +import type { ExportResult } from '@opentelemetry/core'; +import { ExportResultCode } from '@opentelemetry/core'; +import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base'; +import type { + ReadableLogRecord, + LogRecordExporter, +} from '@opentelemetry/sdk-logs'; +import type { ResourceMetrics, PushMetricExporter, - AggregationTemporality, } from '@opentelemetry/sdk-metrics'; +import { AggregationTemporality } from '@opentelemetry/sdk-metrics'; class FileExporter { protected writeStream: fs.WriteStream; diff --git a/packages/core/src/telemetry/index.ts b/packages/core/src/telemetry/index.ts index a0b78add..a5d33cc3 100644 --- a/packages/core/src/telemetry/index.ts +++ b/packages/core/src/telemetry/index.ts @@ -31,24 +31,22 @@ export { logKittySequenceOverflow, logChatCompression, } from './loggers.js'; +export type { SlashCommandEvent, ChatCompressionEvent } from './types.js'; export { - StartSessionEvent, + SlashCommandStatus, EndSessionEvent, UserPromptEvent, - ToolCallEvent, ApiRequestEvent, ApiErrorEvent, ApiResponseEvent, - TelemetryEvent, FlashFallbackEvent, + StartSessionEvent, + ToolCallEvent, ConversationFinishedEvent, KittySequenceOverflowEvent, - SlashCommandEvent, - makeSlashCommandEvent, - SlashCommandStatus, - ChatCompressionEvent, - makeChatCompressionEvent, } from './types.js'; +export { makeSlashCommandEvent, makeChatCompressionEvent } from './types.js'; +export type { TelemetryEvent } from './types.js'; export { SpanStatusCode, ValueType } from '@opentelemetry/api'; export { SemanticAttributes } from '@opentelemetry/semantic-conventions'; export * from './uiTelemetry.js'; diff --git a/packages/core/src/telemetry/integration.test.circular.ts b/packages/core/src/telemetry/integration.test.circular.ts index acfb513e..9ff8a58e 100644 --- a/packages/core/src/telemetry/integration.test.circular.ts +++ b/packages/core/src/telemetry/integration.test.circular.ts @@ -10,7 +10,7 @@ import { describe, it, expect } from 'vitest'; import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; describe('Circular Reference Integration Test', () => { it('should handle HttpsProxyAgent-like circular references in clearcut logging', () => { diff --git a/packages/core/src/telemetry/loggers.test.circular.ts b/packages/core/src/telemetry/loggers.test.circular.ts index 3cf85e46..240604bf 100644 --- a/packages/core/src/telemetry/loggers.test.circular.ts +++ b/packages/core/src/telemetry/loggers.test.circular.ts @@ -11,9 +11,12 @@ import { describe, it, expect } from 'vitest'; import { logToolCall } from './loggers.js'; import { ToolCallEvent } from './types.js'; -import { Config } from '../config/config.js'; -import { CompletedToolCall } from '../core/coreToolScheduler.js'; -import { ToolCallRequestInfo, ToolCallResponseInfo } from '../core/turn.js'; +import type { Config } from '../config/config.js'; +import type { CompletedToolCall } from '../core/coreToolScheduler.js'; +import type { + ToolCallRequestInfo, + ToolCallResponseInfo, +} from '../core/turn.js'; import { MockTool } from '../test-utils/tools.js'; describe('Circular Reference Handling', () => { diff --git a/packages/core/src/telemetry/loggers.test.ts b/packages/core/src/telemetry/loggers.test.ts index 44df1045..eba9ca3b 100644 --- a/packages/core/src/telemetry/loggers.test.ts +++ b/packages/core/src/telemetry/loggers.test.ts @@ -4,13 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { +import type { AnyToolInvocation, - AuthType, CompletedToolCall, ContentGeneratorConfig, - EditTool, ErroredToolCall, +} from '../index.js'; +import { + AuthType, + EditTool, GeminiClient, ToolConfirmationOutcome, ToolErrorType, @@ -18,7 +20,7 @@ import { } from '../index.js'; import { logs } from '@opentelemetry/api-logs'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { EVENT_API_REQUEST, EVENT_API_RESPONSE, @@ -52,7 +54,7 @@ import { import * as metrics from './metrics.js'; import * as sdk from './sdk.js'; import { vi, describe, beforeEach, it, expect } from 'vitest'; -import { GenerateContentResponseUsageMetadata } from '@google/genai'; +import type { GenerateContentResponseUsageMetadata } from '@google/genai'; import * as uiTelemetry from './uiTelemetry.js'; import { makeFakeConfig } from '../test-utils/config.js'; import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js'; diff --git a/packages/core/src/telemetry/loggers.ts b/packages/core/src/telemetry/loggers.ts index 60088748..b8c680d9 100644 --- a/packages/core/src/telemetry/loggers.ts +++ b/packages/core/src/telemetry/loggers.ts @@ -4,9 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { logs, LogRecord, LogAttributes } from '@opentelemetry/api-logs'; +import type { LogRecord, LogAttributes } from '@opentelemetry/api-logs'; +import { logs } from '@opentelemetry/api-logs'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { EVENT_API_ERROR, EVENT_API_REQUEST, @@ -23,7 +24,7 @@ import { EVENT_CHAT_COMPRESSION, EVENT_MALFORMED_JSON_RESPONSE, } from './constants.js'; -import { +import type { ApiErrorEvent, ApiRequestEvent, ApiResponseEvent, @@ -50,7 +51,8 @@ import { recordFileOperationMetric, } from './metrics.js'; import { isTelemetrySdkInitialized } from './sdk.js'; -import { uiTelemetryService, UiEvent } from './uiTelemetry.js'; +import type { UiEvent } from './uiTelemetry.js'; +import { uiTelemetryService } from './uiTelemetry.js'; import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js'; import { safeJsonStringify } from '../utils/safeJsonStringify.js'; import { UserAccountManager } from '../utils/userAccountManager.js'; diff --git a/packages/core/src/telemetry/metrics.test.ts b/packages/core/src/telemetry/metrics.test.ts index 84c069cf..444c3db8 100644 --- a/packages/core/src/telemetry/metrics.test.ts +++ b/packages/core/src/telemetry/metrics.test.ts @@ -12,7 +12,7 @@ import type { Context, Histogram, } from '@opentelemetry/api'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { FileOperation } from './metrics.js'; import { makeFakeConfig } from '../test-utils/config.js'; diff --git a/packages/core/src/telemetry/metrics.ts b/packages/core/src/telemetry/metrics.ts index 5dd04682..59ffc529 100644 --- a/packages/core/src/telemetry/metrics.ts +++ b/packages/core/src/telemetry/metrics.ts @@ -4,14 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { - metrics, - Attributes, - ValueType, - Meter, - Counter, - Histogram, -} from '@opentelemetry/api'; +import type { Attributes, Meter, Counter, Histogram } from '@opentelemetry/api'; +import { metrics, ValueType } from '@opentelemetry/api'; import { SERVICE_NAME, METRIC_TOOL_CALL_COUNT, @@ -26,8 +20,8 @@ import { METRIC_CONTENT_RETRY_COUNT, METRIC_CONTENT_RETRY_FAILURE_COUNT, } from './constants.js'; -import { Config } from '../config/config.js'; -import { DiffStat } from '../tools/tools.js'; +import type { Config } from '../config/config.js'; +import type { DiffStat } from '../tools/tools.js'; export enum FileOperation { CREATE = 'create', diff --git a/packages/core/src/telemetry/sdk.test.ts b/packages/core/src/telemetry/sdk.test.ts index a583bc38..4eefb620 100644 --- a/packages/core/src/telemetry/sdk.test.ts +++ b/packages/core/src/telemetry/sdk.test.ts @@ -5,7 +5,7 @@ */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { initializeTelemetry, shutdownTelemetry } from './sdk.js'; import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc'; import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-grpc'; diff --git a/packages/core/src/telemetry/sdk.ts b/packages/core/src/telemetry/sdk.ts index f1f67835..3db41c67 100644 --- a/packages/core/src/telemetry/sdk.ts +++ b/packages/core/src/telemetry/sdk.ts @@ -28,7 +28,7 @@ import { PeriodicExportingMetricReader, } from '@opentelemetry/sdk-metrics'; import { HttpInstrumentation } from '@opentelemetry/instrumentation-http'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { SERVICE_NAME } from './constants.js'; import { initializeMetrics } from './metrics.js'; import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js'; diff --git a/packages/core/src/telemetry/types.ts b/packages/core/src/telemetry/types.ts index 176bbf88..e7d1017f 100644 --- a/packages/core/src/telemetry/types.ts +++ b/packages/core/src/telemetry/types.ts @@ -4,19 +4,20 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { GenerateContentResponseUsageMetadata } from '@google/genai'; -import { ApprovalMode, Config } from '../config/config.js'; -import { CompletedToolCall } from '../core/coreToolScheduler.js'; +import type { GenerateContentResponseUsageMetadata } from '@google/genai'; +import type { Config } from '../config/config.js'; +import type { ApprovalMode } from '../config/config.js'; +import type { CompletedToolCall } from '../core/coreToolScheduler.js'; import { DiscoveredMCPTool } from '../tools/mcp-tool.js'; -import { DiffStat, FileDiff } from '../tools/tools.js'; +import type { DiffStat, FileDiff } from '../tools/tools.js'; import { AuthType } from '../core/contentGenerator.js'; import { getDecisionFromOutcome, ToolCallDecision, } from './tool-call-decision.js'; -import { FileOperation } from './metrics.js'; +import type { FileOperation } from './metrics.js'; export { ToolCallDecision }; -import { ToolRegistry } from '../tools/tool-registry.js'; +import type { ToolRegistry } from '../tools/tool-registry.js'; export interface BaseTelemetryEvent { 'event.name': string; diff --git a/packages/core/src/telemetry/uiTelemetry.test.ts b/packages/core/src/telemetry/uiTelemetry.test.ts index a8d22cea..86682a95 100644 --- a/packages/core/src/telemetry/uiTelemetry.test.ts +++ b/packages/core/src/telemetry/uiTelemetry.test.ts @@ -7,13 +7,14 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { UiTelemetryService } from './uiTelemetry.js'; import { ToolCallDecision } from './tool-call-decision.js'; -import { ApiErrorEvent, ApiResponseEvent, ToolCallEvent } from './types.js'; +import type { ApiErrorEvent, ApiResponseEvent } from './types.js'; +import { ToolCallEvent } from './types.js'; import { EVENT_API_ERROR, EVENT_API_RESPONSE, EVENT_TOOL_CALL, } from './constants.js'; -import { +import type { CompletedToolCall, ErroredToolCall, SuccessfulToolCall, diff --git a/packages/core/src/telemetry/uiTelemetry.ts b/packages/core/src/telemetry/uiTelemetry.ts index 03c03b1f..265a975b 100644 --- a/packages/core/src/telemetry/uiTelemetry.ts +++ b/packages/core/src/telemetry/uiTelemetry.ts @@ -12,7 +12,11 @@ import { } from './constants.js'; import { ToolCallDecision } from './tool-call-decision.js'; -import { ApiErrorEvent, ApiResponseEvent, ToolCallEvent } from './types.js'; +import type { + ApiErrorEvent, + ApiResponseEvent, + ToolCallEvent, +} from './types.js'; export type UiEvent = | (ApiResponseEvent & { 'event.name': typeof EVENT_API_RESPONSE }) diff --git a/packages/core/src/test-utils/config.ts b/packages/core/src/test-utils/config.ts index 08faf8c3..9f72d4b0 100644 --- a/packages/core/src/test-utils/config.ts +++ b/packages/core/src/test-utils/config.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Config, ConfigParameters } from '../config/config.js'; +import type { ConfigParameters } from '../config/config.js'; +import { Config } from '../config/config.js'; /** * Default parameters used for {@link FAKE_CONFIG} diff --git a/packages/core/src/test-utils/mockWorkspaceContext.ts b/packages/core/src/test-utils/mockWorkspaceContext.ts index 61497b3e..67c614e9 100644 --- a/packages/core/src/test-utils/mockWorkspaceContext.ts +++ b/packages/core/src/test-utils/mockWorkspaceContext.ts @@ -5,7 +5,7 @@ */ import { vi } from 'vitest'; -import { WorkspaceContext } from '../utils/workspaceContext.js'; +import type { WorkspaceContext } from '../utils/workspaceContext.js'; /** * Creates a mock WorkspaceContext for testing diff --git a/packages/core/src/test-utils/tools.ts b/packages/core/src/test-utils/tools.ts index 7c45f24e..fca72b53 100644 --- a/packages/core/src/test-utils/tools.ts +++ b/packages/core/src/test-utils/tools.ts @@ -5,15 +5,17 @@ */ import { vi } from 'vitest'; -import { - BaseDeclarativeTool, - BaseToolInvocation, +import type { ToolCallConfirmationDetails, ToolInvocation, ToolResult, - Kind, } from '../tools/tools.js'; import { + BaseDeclarativeTool, + BaseToolInvocation, + Kind, +} from '../tools/tools.js'; +import type { ModifiableDeclarativeTool, ModifyContext, } from '../tools/modifiable-tool.js'; diff --git a/packages/core/src/tools/diffOptions.ts b/packages/core/src/tools/diffOptions.ts index 50574226..f49ca611 100644 --- a/packages/core/src/tools/diffOptions.ts +++ b/packages/core/src/tools/diffOptions.ts @@ -5,7 +5,7 @@ */ import * as Diff from 'diff'; -import { DiffStat } from './tools.js'; +import type { DiffStat } from './tools.js'; export const DEFAULT_DIFF_OPTIONS: Diff.PatchOptions = { context: 3, diff --git a/packages/core/src/tools/edit.test.ts b/packages/core/src/tools/edit.test.ts index b77416fd..bf003dc2 100644 --- a/packages/core/src/tools/edit.test.ts +++ b/packages/core/src/tools/edit.test.ts @@ -30,15 +30,19 @@ vi.mock('../telemetry/loggers.js', () => ({ logFileOperation: vi.fn(), })); -import { describe, it, expect, beforeEach, afterEach, vi, Mock } from 'vitest'; -import { applyReplacement, EditTool, EditToolParams } from './edit.js'; -import { FileDiff, ToolConfirmationOutcome } from './tools.js'; +import type { Mock } from 'vitest'; +import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; +import type { EditToolParams } from './edit.js'; +import { applyReplacement, EditTool } from './edit.js'; +import type { FileDiff } from './tools.js'; +import { ToolConfirmationOutcome } from './tools.js'; import { ToolErrorType } from './tool-error.js'; import path from 'node:path'; import fs from 'node:fs'; import os from 'node:os'; -import { ApprovalMode, Config } from '../config/config.js'; -import { Content, Part, SchemaUnion } from '@google/genai'; +import type { Config } from '../config/config.js'; +import { ApprovalMode } from '../config/config.js'; +import type { Content, Part, SchemaUnion } from '@google/genai'; import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js'; import { StandardFileSystemService } from '../services/fileSystemService.js'; diff --git a/packages/core/src/tools/edit.ts b/packages/core/src/tools/edit.ts index 36467d90..cd98ed00 100644 --- a/packages/core/src/tools/edit.ts +++ b/packages/core/src/tools/edit.ts @@ -7,25 +7,27 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import * as Diff from 'diff'; -import { - BaseDeclarativeTool, - Kind, +import type { ToolCallConfirmationDetails, - ToolConfirmationOutcome, ToolEditConfirmationDetails, ToolInvocation, ToolLocation, ToolResult, ToolResultDisplay, } from './tools.js'; +import { BaseDeclarativeTool, Kind, ToolConfirmationOutcome } from './tools.js'; import { ToolErrorType } from './tool-error.js'; import { makeRelative, shortenPath } from '../utils/paths.js'; import { isNodeError } from '../utils/errors.js'; -import { Config, ApprovalMode } from '../config/config.js'; +import type { Config } from '../config/config.js'; +import { ApprovalMode } from '../config/config.js'; import { ensureCorrectEdit } from '../utils/editCorrector.js'; import { DEFAULT_DIFF_OPTIONS, getDiffStat } from './diffOptions.js'; import { ReadFileTool } from './read-file.js'; -import { ModifiableDeclarativeTool, ModifyContext } from './modifiable-tool.js'; +import type { + ModifiableDeclarativeTool, + ModifyContext, +} from './modifiable-tool.js'; import { IDEConnectionStatus } from '../ide/ide-client.js'; import { FileOperation } from '../telemetry/metrics.js'; import { logFileOperation } from '../telemetry/loggers.js'; diff --git a/packages/core/src/tools/glob.test.ts b/packages/core/src/tools/glob.test.ts index ab791498..3a911a57 100644 --- a/packages/core/src/tools/glob.test.ts +++ b/packages/core/src/tools/glob.test.ts @@ -4,14 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { GlobTool, GlobToolParams, GlobPath, sortFileEntries } from './glob.js'; +import type { GlobToolParams, GlobPath } from './glob.js'; +import { GlobTool, sortFileEntries } from './glob.js'; import { partListUnionToString } from '../core/geminiRequest.js'; import path from 'node:path'; import fs from 'node:fs/promises'; import os from 'node:os'; import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js'; import { ToolErrorType } from './tool-error.js'; import * as glob from 'glob'; diff --git a/packages/core/src/tools/glob.ts b/packages/core/src/tools/glob.ts index 014a0fe6..7efae2ba 100644 --- a/packages/core/src/tools/glob.ts +++ b/packages/core/src/tools/glob.ts @@ -7,15 +7,10 @@ import fs from 'node:fs'; import path from 'node:path'; import { glob, escape } from 'glob'; -import { - BaseDeclarativeTool, - BaseToolInvocation, - Kind, - ToolInvocation, - ToolResult, -} from './tools.js'; +import type { ToolInvocation, ToolResult } from './tools.js'; +import { BaseDeclarativeTool, BaseToolInvocation, Kind } from './tools.js'; import { shortenPath, makeRelative } from '../utils/paths.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { ToolErrorType } from './tool-error.js'; // Subset of 'Path' interface provided by 'glob' that we can implement for testing diff --git a/packages/core/src/tools/grep.test.ts b/packages/core/src/tools/grep.test.ts index 4ef28867..a447f152 100644 --- a/packages/core/src/tools/grep.test.ts +++ b/packages/core/src/tools/grep.test.ts @@ -5,11 +5,12 @@ */ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; -import { GrepTool, GrepToolParams } from './grep.js'; +import type { GrepToolParams } from './grep.js'; +import { GrepTool } from './grep.js'; import path from 'node:path'; import fs from 'node:fs/promises'; import os from 'node:os'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js'; import { ToolErrorType } from './tool-error.js'; import * as glob from 'glob'; diff --git a/packages/core/src/tools/grep.ts b/packages/core/src/tools/grep.ts index 47ddbd57..679e920d 100644 --- a/packages/core/src/tools/grep.ts +++ b/packages/core/src/tools/grep.ts @@ -10,18 +10,13 @@ import path from 'node:path'; import { EOL } from 'node:os'; import { spawn } from 'node:child_process'; import { globStream } from 'glob'; -import { - BaseDeclarativeTool, - BaseToolInvocation, - Kind, - ToolInvocation, - ToolResult, -} from './tools.js'; +import type { ToolInvocation, ToolResult } from './tools.js'; +import { BaseDeclarativeTool, BaseToolInvocation, Kind } from './tools.js'; import { makeRelative, shortenPath } from '../utils/paths.js'; import { getErrorMessage, isNodeError } from '../utils/errors.js'; import { isGitRepository } from '../utils/gitUtils.js'; -import { Config } from '../config/config.js'; -import { FileExclusions } from '../utils/ignorePatterns.js'; +import type { Config } from '../config/config.js'; +import type { FileExclusions } from '../utils/ignorePatterns.js'; import { ToolErrorType } from './tool-error.js'; // --- Interfaces --- diff --git a/packages/core/src/tools/ls.test.ts b/packages/core/src/tools/ls.test.ts index 62d81f77..9b2797b5 100644 --- a/packages/core/src/tools/ls.test.ts +++ b/packages/core/src/tools/ls.test.ts @@ -20,9 +20,9 @@ vi.mock('fs', () => ({ mkdirSync: vi.fn(), })); import { LSTool } from './ls.js'; -import { Config } from '../config/config.js'; -import { WorkspaceContext } from '../utils/workspaceContext.js'; -import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; +import type { Config } from '../config/config.js'; +import type { WorkspaceContext } from '../utils/workspaceContext.js'; +import type { FileDiscoveryService } from '../services/fileDiscoveryService.js'; import { ToolErrorType } from './tool-error.js'; describe('LSTool', () => { diff --git a/packages/core/src/tools/ls.ts b/packages/core/src/tools/ls.ts index fa43674a..4a597306 100644 --- a/packages/core/src/tools/ls.ts +++ b/packages/core/src/tools/ls.ts @@ -6,15 +6,11 @@ import fs from 'node:fs'; import path from 'node:path'; -import { - BaseDeclarativeTool, - BaseToolInvocation, - Kind, - ToolInvocation, - ToolResult, -} from './tools.js'; +import type { ToolInvocation, ToolResult } from './tools.js'; +import { BaseDeclarativeTool, BaseToolInvocation, Kind } from './tools.js'; import { makeRelative, shortenPath } from '../utils/paths.js'; -import { Config, DEFAULT_FILE_FILTERING_OPTIONS } from '../config/config.js'; +import type { Config } from '../config/config.js'; +import { DEFAULT_FILE_FILTERING_OPTIONS } from '../config/config.js'; import { ToolErrorType } from './tool-error.js'; /** diff --git a/packages/core/src/tools/mcp-client-manager.test.ts b/packages/core/src/tools/mcp-client-manager.test.ts index 3dba197f..b30425c8 100644 --- a/packages/core/src/tools/mcp-client-manager.test.ts +++ b/packages/core/src/tools/mcp-client-manager.test.ts @@ -7,9 +7,9 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; import { McpClientManager } from './mcp-client-manager.js'; import { McpClient } from './mcp-client.js'; -import { ToolRegistry } from './tool-registry.js'; -import { PromptRegistry } from '../prompts/prompt-registry.js'; -import { WorkspaceContext } from '../utils/workspaceContext.js'; +import type { ToolRegistry } from './tool-registry.js'; +import type { PromptRegistry } from '../prompts/prompt-registry.js'; +import type { WorkspaceContext } from '../utils/workspaceContext.js'; vi.mock('./mcp-client.js', async () => { const originalModule = await vi.importActual('./mcp-client.js'); diff --git a/packages/core/src/tools/mcp-client-manager.ts b/packages/core/src/tools/mcp-client-manager.ts index c22afb8f..0468fff4 100644 --- a/packages/core/src/tools/mcp-client-manager.ts +++ b/packages/core/src/tools/mcp-client-manager.ts @@ -4,16 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { MCPServerConfig } from '../config/config.js'; -import { ToolRegistry } from './tool-registry.js'; -import { PromptRegistry } from '../prompts/prompt-registry.js'; +import type { MCPServerConfig } from '../config/config.js'; +import type { ToolRegistry } from './tool-registry.js'; +import type { PromptRegistry } from '../prompts/prompt-registry.js'; import { McpClient, MCPDiscoveryState, populateMcpServerCommand, } from './mcp-client.js'; import { getErrorMessage } from '../utils/errors.js'; -import { WorkspaceContext } from '../utils/workspaceContext.js'; +import type { WorkspaceContext } from '../utils/workspaceContext.js'; /** * Manages the lifecycle of multiple MCP clients, including local child processes. diff --git a/packages/core/src/tools/mcp-client.test.ts b/packages/core/src/tools/mcp-client.test.ts index 32cffae1..d97686de 100644 --- a/packages/core/src/tools/mcp-client.test.ts +++ b/packages/core/src/tools/mcp-client.test.ts @@ -20,9 +20,9 @@ import * as ClientLib from '@modelcontextprotocol/sdk/client/index.js'; import * as GenAiLib from '@google/genai'; import { GoogleCredentialProvider } from '../mcp/google-auth-provider.js'; import { AuthProviderType } from '../config/config.js'; -import { PromptRegistry } from '../prompts/prompt-registry.js'; -import { ToolRegistry } from './tool-registry.js'; -import { WorkspaceContext } from '../utils/workspaceContext.js'; +import type { PromptRegistry } from '../prompts/prompt-registry.js'; +import type { ToolRegistry } from './tool-registry.js'; +import type { WorkspaceContext } from '../utils/workspaceContext.js'; vi.mock('@modelcontextprotocol/sdk/client/stdio.js'); vi.mock('@modelcontextprotocol/sdk/client/index.js'); diff --git a/packages/core/src/tools/mcp-client.ts b/packages/core/src/tools/mcp-client.ts index 51634b98..67010e92 100644 --- a/packages/core/src/tools/mcp-client.ts +++ b/packages/core/src/tools/mcp-client.ts @@ -5,38 +5,41 @@ */ import { Client } from '@modelcontextprotocol/sdk/client/index.js'; -import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'; +import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'; import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; -import { - SSEClientTransport, - SSEClientTransportOptions, -} from '@modelcontextprotocol/sdk/client/sse.js'; -import { - StreamableHTTPClientTransport, - StreamableHTTPClientTransportOptions, -} from '@modelcontextprotocol/sdk/client/streamableHttp.js'; -import { +import type { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js'; +import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'; +import type { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; +import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; +import type { Prompt, - ListPromptsResultSchema, GetPromptResult, +} from '@modelcontextprotocol/sdk/types.js'; +import { + ListPromptsResultSchema, GetPromptResultSchema, ListRootsRequestSchema, } from '@modelcontextprotocol/sdk/types.js'; import { parse } from 'shell-quote'; -import { AuthProviderType, MCPServerConfig } from '../config/config.js'; +import type { MCPServerConfig } from '../config/config.js'; +import { AuthProviderType } from '../config/config.js'; import { GoogleCredentialProvider } from '../mcp/google-auth-provider.js'; import { DiscoveredMCPTool } from './mcp-tool.js'; -import { FunctionDeclaration, mcpToTool } from '@google/genai'; -import { ToolRegistry } from './tool-registry.js'; -import { PromptRegistry } from '../prompts/prompt-registry.js'; +import type { FunctionDeclaration } from '@google/genai'; +import { mcpToTool } from '@google/genai'; +import type { ToolRegistry } from './tool-registry.js'; +import type { PromptRegistry } from '../prompts/prompt-registry.js'; import { MCPOAuthProvider } from '../mcp/oauth-provider.js'; import { OAuthUtils } from '../mcp/oauth-utils.js'; import { MCPOAuthTokenStorage } from '../mcp/oauth-token-storage.js'; import { getErrorMessage } from '../utils/errors.js'; import { basename } from 'node:path'; import { pathToFileURL } from 'node:url'; -import { Unsubscribe, WorkspaceContext } from '../utils/workspaceContext.js'; +import type { + Unsubscribe, + WorkspaceContext, +} from '../utils/workspaceContext.js'; export const MCP_DEFAULT_TIMEOUT_MSEC = 10 * 60 * 1000; // default to 10 minutes diff --git a/packages/core/src/tools/mcp-tool.test.ts b/packages/core/src/tools/mcp-tool.test.ts index 02c74214..b9d7ddc3 100644 --- a/packages/core/src/tools/mcp-tool.test.ts +++ b/packages/core/src/tools/mcp-tool.test.ts @@ -5,19 +5,13 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { - describe, - it, - expect, - vi, - beforeEach, - afterEach, - Mocked, -} from 'vitest'; +import type { Mocked } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { safeJsonStringify } from '../utils/safeJsonStringify.js'; import { DiscoveredMCPTool, generateValidName } from './mcp-tool.js'; // Added getStringifiedResultForDisplay -import { ToolResult, ToolConfirmationOutcome } from './tools.js'; // Added ToolConfirmationOutcome -import { CallableTool, Part } from '@google/genai'; +import type { ToolResult } from './tools.js'; +import { ToolConfirmationOutcome } from './tools.js'; // Added ToolConfirmationOutcome +import type { CallableTool, Part } from '@google/genai'; import { ToolErrorType } from './tool-error.js'; // Mock @google/genai mcpToTool and CallableTool diff --git a/packages/core/src/tools/mcp-tool.ts b/packages/core/src/tools/mcp-tool.ts index c16bc7a1..ede885d8 100644 --- a/packages/core/src/tools/mcp-tool.ts +++ b/packages/core/src/tools/mcp-tool.ts @@ -5,17 +5,19 @@ */ import { safeJsonStringify } from '../utils/safeJsonStringify.js'; -import { - BaseDeclarativeTool, - BaseToolInvocation, - Kind, +import type { ToolCallConfirmationDetails, - ToolConfirmationOutcome, ToolInvocation, ToolMcpConfirmationDetails, ToolResult, } from './tools.js'; -import { CallableTool, FunctionCall, Part } from '@google/genai'; +import { + BaseDeclarativeTool, + BaseToolInvocation, + Kind, + ToolConfirmationOutcome, +} from './tools.js'; +import type { CallableTool, FunctionCall, Part } from '@google/genai'; import { ToolErrorType } from './tool-error.js'; type ToolParams = Record; diff --git a/packages/core/src/tools/memoryTool.test.ts b/packages/core/src/tools/memoryTool.test.ts index 7553cdc5..9751ad64 100644 --- a/packages/core/src/tools/memoryTool.test.ts +++ b/packages/core/src/tools/memoryTool.test.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { vi, describe, it, expect, beforeEach, afterEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'; import { MemoryTool, setGeminiMdFilename, diff --git a/packages/core/src/tools/memoryTool.ts b/packages/core/src/tools/memoryTool.ts index c7aead4c..9d8a070c 100644 --- a/packages/core/src/tools/memoryTool.ts +++ b/packages/core/src/tools/memoryTool.ts @@ -4,22 +4,24 @@ * SPDX-License-Identifier: Apache-2.0 */ +import type { ToolEditConfirmationDetails, ToolResult } from './tools.js'; import { BaseDeclarativeTool, BaseToolInvocation, Kind, - ToolEditConfirmationDetails, ToolConfirmationOutcome, - ToolResult, } from './tools.js'; -import { FunctionDeclaration } from '@google/genai'; +import type { FunctionDeclaration } from '@google/genai'; import * as fs from 'node:fs/promises'; import * as path from 'node:path'; import { Storage } from '../config/storage.js'; import * as Diff from 'diff'; import { DEFAULT_DIFF_OPTIONS } from './diffOptions.js'; import { tildeifyPath } from '../utils/paths.js'; -import { ModifiableDeclarativeTool, ModifyContext } from './modifiable-tool.js'; +import type { + ModifiableDeclarativeTool, + ModifyContext, +} from './modifiable-tool.js'; import { ToolErrorType } from './tool-error.js'; const memoryToolSchemaData: FunctionDeclaration = { diff --git a/packages/core/src/tools/modifiable-tool.test.ts b/packages/core/src/tools/modifiable-tool.test.ts index 38d95061..1290fc7f 100644 --- a/packages/core/src/tools/modifiable-tool.test.ts +++ b/packages/core/src/tools/modifiable-tool.test.ts @@ -5,13 +5,15 @@ */ import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'; -import { - modifyWithEditor, +import type { ModifyContext, ModifiableDeclarativeTool, +} from './modifiable-tool.js'; +import { + modifyWithEditor, isModifiableDeclarativeTool, } from './modifiable-tool.js'; -import { EditorType } from '../utils/editor.js'; +import type { EditorType } from '../utils/editor.js'; import fs from 'node:fs'; import fsp from 'node:fs/promises'; import os from 'node:os'; diff --git a/packages/core/src/tools/modifiable-tool.ts b/packages/core/src/tools/modifiable-tool.ts index 413a0712..3dcf6408 100644 --- a/packages/core/src/tools/modifiable-tool.ts +++ b/packages/core/src/tools/modifiable-tool.ts @@ -4,14 +4,19 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { EditorType, openDiff } from '../utils/editor.js'; +import type { EditorType } from '../utils/editor.js'; +import { openDiff } from '../utils/editor.js'; import os from 'node:os'; import path from 'node:path'; import fs from 'node:fs'; import * as Diff from 'diff'; import { DEFAULT_DIFF_OPTIONS } from './diffOptions.js'; import { isNodeError } from '../utils/errors.js'; -import { AnyDeclarativeTool, DeclarativeTool, ToolResult } from './tools.js'; +import type { + AnyDeclarativeTool, + DeclarativeTool, + ToolResult, +} from './tools.js'; /** * A declarative tool that supports a modify operation. diff --git a/packages/core/src/tools/read-file.test.ts b/packages/core/src/tools/read-file.test.ts index efe0cd24..18bfc7e9 100644 --- a/packages/core/src/tools/read-file.test.ts +++ b/packages/core/src/tools/read-file.test.ts @@ -5,17 +5,18 @@ */ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; -import { ReadFileTool, ReadFileToolParams } from './read-file.js'; +import type { ReadFileToolParams } from './read-file.js'; +import { ReadFileTool } from './read-file.js'; import { ToolErrorType } from './tool-error.js'; import path from 'node:path'; import os from 'node:os'; import fs from 'node:fs'; import fsp from 'node:fs/promises'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; import { StandardFileSystemService } from '../services/fileSystemService.js'; import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js'; -import { ToolInvocation, ToolResult } from './tools.js'; +import type { ToolInvocation, ToolResult } from './tools.js'; vi.mock('../telemetry/loggers.js', () => ({ logFileOperation: vi.fn(), diff --git a/packages/core/src/tools/read-file.ts b/packages/core/src/tools/read-file.ts index 60612d7f..413747bc 100644 --- a/packages/core/src/tools/read-file.ts +++ b/packages/core/src/tools/read-file.ts @@ -6,21 +6,15 @@ import path from 'node:path'; import { makeRelative, shortenPath } from '../utils/paths.js'; -import { - BaseDeclarativeTool, - BaseToolInvocation, - Kind, - ToolInvocation, - ToolLocation, - ToolResult, -} from './tools.js'; +import type { ToolInvocation, ToolLocation, ToolResult } from './tools.js'; +import { BaseDeclarativeTool, BaseToolInvocation, Kind } from './tools.js'; -import { PartUnion } from '@google/genai'; +import type { PartUnion } from '@google/genai'; import { processSingleFileContent, getSpecificMimeType, } from '../utils/fileUtils.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { FileOperation } from '../telemetry/metrics.js'; import { getProgrammingLanguage } from '../telemetry/telemetry-utils.js'; import { logFileOperation } from '../telemetry/loggers.js'; diff --git a/packages/core/src/tools/read-many-files.test.ts b/packages/core/src/tools/read-many-files.test.ts index 7c88cfd7..2059f0d4 100644 --- a/packages/core/src/tools/read-many-files.test.ts +++ b/packages/core/src/tools/read-many-files.test.ts @@ -12,7 +12,7 @@ import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; import path from 'node:path'; import fs from 'node:fs'; // Actual fs for setup import os from 'node:os'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { WorkspaceContext } from '../utils/workspaceContext.js'; import { StandardFileSystemService } from '../services/fileSystemService.js'; import { ToolErrorType } from './tool-error.js'; diff --git a/packages/core/src/tools/read-many-files.ts b/packages/core/src/tools/read-many-files.ts index af85232e..a115d9f4 100644 --- a/packages/core/src/tools/read-many-files.ts +++ b/packages/core/src/tools/read-many-files.ts @@ -4,26 +4,22 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { - BaseDeclarativeTool, - BaseToolInvocation, - Kind, - ToolInvocation, - ToolResult, -} from './tools.js'; +import type { ToolInvocation, ToolResult } from './tools.js'; +import { BaseDeclarativeTool, BaseToolInvocation, Kind } from './tools.js'; import { getErrorMessage } from '../utils/errors.js'; import * as fs from 'node:fs'; import * as path from 'node:path'; import { glob, escape } from 'glob'; +import type { ProcessedFileReadResult } from '../utils/fileUtils.js'; import { detectFileType, processSingleFileContent, DEFAULT_ENCODING, getSpecificMimeType, - ProcessedFileReadResult, } from '../utils/fileUtils.js'; -import { PartListUnion } from '@google/genai'; -import { Config, DEFAULT_FILE_FILTERING_OPTIONS } from '../config/config.js'; +import type { PartListUnion } from '@google/genai'; +import type { Config } from '../config/config.js'; +import { DEFAULT_FILE_FILTERING_OPTIONS } from '../config/config.js'; import { FileOperation } from '../telemetry/metrics.js'; import { getProgrammingLanguage } from '../telemetry/telemetry-utils.js'; import { logFileOperation } from '../telemetry/loggers.js'; diff --git a/packages/core/src/tools/ripGrep.test.ts b/packages/core/src/tools/ripGrep.test.ts index defccd3c..06cc4ccc 100644 --- a/packages/core/src/tools/ripGrep.test.ts +++ b/packages/core/src/tools/ripGrep.test.ts @@ -5,13 +5,15 @@ */ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; -import { RipGrepTool, RipGrepToolParams } from './ripGrep.js'; +import type { RipGrepToolParams } from './ripGrep.js'; +import { RipGrepTool } from './ripGrep.js'; import path from 'node:path'; import fs from 'node:fs/promises'; import os, { EOL } from 'node:os'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js'; -import { spawn, ChildProcess } from 'node:child_process'; +import type { ChildProcess } from 'node:child_process'; +import { spawn } from 'node:child_process'; // Mock @lvce-editor/ripgrep for testing vi.mock('@lvce-editor/ripgrep', () => ({ diff --git a/packages/core/src/tools/ripGrep.ts b/packages/core/src/tools/ripGrep.ts index bcafd97e..b851c2cd 100644 --- a/packages/core/src/tools/ripGrep.ts +++ b/packages/core/src/tools/ripGrep.ts @@ -9,17 +9,12 @@ import path from 'node:path'; import { EOL } from 'node:os'; import { spawn } from 'node:child_process'; import { rgPath } from '@lvce-editor/ripgrep'; -import { - BaseDeclarativeTool, - BaseToolInvocation, - Kind, - ToolInvocation, - ToolResult, -} from './tools.js'; +import type { ToolInvocation, ToolResult } from './tools.js'; +import { BaseDeclarativeTool, BaseToolInvocation, Kind } from './tools.js'; import { SchemaValidator } from '../utils/schemaValidator.js'; import { makeRelative, shortenPath } from '../utils/paths.js'; import { getErrorMessage, isNodeError } from '../utils/errors.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; const DEFAULT_TOTAL_MAX_MATCHES = 20000; diff --git a/packages/core/src/tools/shell.ts b/packages/core/src/tools/shell.ts index c8863be7..e7502fab 100644 --- a/packages/core/src/tools/shell.ts +++ b/packages/core/src/tools/shell.ts @@ -8,23 +8,23 @@ import fs from 'node:fs'; import path from 'node:path'; import os, { EOL } from 'node:os'; import crypto from 'node:crypto'; -import { Config } from '../config/config.js'; -import { - BaseDeclarativeTool, - BaseToolInvocation, +import type { Config } from '../config/config.js'; +import type { ToolInvocation, ToolResult, ToolCallConfirmationDetails, ToolExecuteConfirmationDetails, +} from './tools.js'; +import { + BaseDeclarativeTool, + BaseToolInvocation, ToolConfirmationOutcome, Kind, } from './tools.js'; import { getErrorMessage } from '../utils/errors.js'; import { summarizeToolOutput } from '../utils/summarizer.js'; -import { - ShellExecutionService, - ShellOutputEvent, -} from '../services/shellExecutionService.js'; +import type { ShellOutputEvent } from '../services/shellExecutionService.js'; +import { ShellExecutionService } from '../services/shellExecutionService.js'; import { formatMemoryUsage } from '../utils/formatters.js'; import { getCommandRoots, diff --git a/packages/core/src/tools/tool-registry.test.ts b/packages/core/src/tools/tool-registry.test.ts index 0084ddff..1bcded76 100644 --- a/packages/core/src/tools/tool-registry.test.ts +++ b/packages/core/src/tools/tool-registry.test.ts @@ -5,19 +5,14 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { - describe, - it, - expect, - vi, - beforeEach, - afterEach, - Mocked, -} from 'vitest'; -import { Config, ConfigParameters, ApprovalMode } from '../config/config.js'; +import type { Mocked } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +import type { ConfigParameters } from '../config/config.js'; +import { Config, ApprovalMode } from '../config/config.js'; import { ToolRegistry, DiscoveredTool } from './tool-registry.js'; import { DiscoveredMCPTool } from './mcp-tool.js'; -import { FunctionDeclaration, CallableTool, mcpToTool } from '@google/genai'; +import type { FunctionDeclaration, CallableTool } from '@google/genai'; +import { mcpToTool } from '@google/genai'; import { spawn } from 'node:child_process'; import fs from 'node:fs'; diff --git a/packages/core/src/tools/tool-registry.ts b/packages/core/src/tools/tool-registry.ts index 60c9977d..ff1c8498 100644 --- a/packages/core/src/tools/tool-registry.ts +++ b/packages/core/src/tools/tool-registry.ts @@ -4,16 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { FunctionDeclaration } from '@google/genai'; -import { +import type { FunctionDeclaration } from '@google/genai'; +import type { AnyDeclarativeTool, - Kind, ToolResult, - BaseDeclarativeTool, - BaseToolInvocation, ToolInvocation, } from './tools.js'; -import { Config } from '../config/config.js'; +import { Kind, BaseDeclarativeTool, BaseToolInvocation } from './tools.js'; +import type { Config } from '../config/config.js'; import { spawn } from 'node:child_process'; import { StringDecoder } from 'node:string_decoder'; import { connectAndDiscover } from './mcp-client.js'; diff --git a/packages/core/src/tools/tools.test.ts b/packages/core/src/tools/tools.test.ts index f9828010..38827268 100644 --- a/packages/core/src/tools/tools.test.ts +++ b/packages/core/src/tools/tools.test.ts @@ -5,13 +5,8 @@ */ import { describe, it, expect, vi } from 'vitest'; -import { - DeclarativeTool, - hasCycleInSchema, - Kind, - ToolInvocation, - ToolResult, -} from './tools.js'; +import type { ToolInvocation, ToolResult } from './tools.js'; +import { DeclarativeTool, hasCycleInSchema, Kind } from './tools.js'; import { ToolErrorType } from './tool-error.js'; class TestToolInvocation implements ToolInvocation { diff --git a/packages/core/src/tools/tools.ts b/packages/core/src/tools/tools.ts index 58773d25..432fdc18 100644 --- a/packages/core/src/tools/tools.ts +++ b/packages/core/src/tools/tools.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { FunctionDeclaration, PartListUnion } from '@google/genai'; +import type { FunctionDeclaration, PartListUnion } from '@google/genai'; import { ToolErrorType } from './tool-error.js'; -import { DiffUpdateResult } from '../ide/ideContext.js'; +import type { DiffUpdateResult } from '../ide/ideContext.js'; import { SchemaValidator } from '../utils/schemaValidator.js'; /** diff --git a/packages/core/src/tools/web-fetch.test.ts b/packages/core/src/tools/web-fetch.test.ts index a42b3851..585f662c 100644 --- a/packages/core/src/tools/web-fetch.test.ts +++ b/packages/core/src/tools/web-fetch.test.ts @@ -6,7 +6,8 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { WebFetchTool } from './web-fetch.js'; -import { Config, ApprovalMode } from '../config/config.js'; +import type { Config } from '../config/config.js'; +import { ApprovalMode } from '../config/config.js'; import { ToolConfirmationOutcome } from './tools.js'; import { ToolErrorType } from './tool-error.js'; import * as fetchUtils from '../utils/fetch.js'; diff --git a/packages/core/src/tools/web-fetch.ts b/packages/core/src/tools/web-fetch.ts index dfefae3d..f4d83410 100644 --- a/packages/core/src/tools/web-fetch.ts +++ b/packages/core/src/tools/web-fetch.ts @@ -4,18 +4,21 @@ * SPDX-License-Identifier: Apache-2.0 */ +import type { + ToolCallConfirmationDetails, + ToolInvocation, + ToolResult, +} from './tools.js'; import { BaseDeclarativeTool, BaseToolInvocation, Kind, - ToolCallConfirmationDetails, ToolConfirmationOutcome, - ToolInvocation, - ToolResult, } from './tools.js'; import { ToolErrorType } from './tool-error.js'; import { getErrorMessage } from '../utils/errors.js'; -import { ApprovalMode, Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; +import { ApprovalMode } from '../config/config.js'; import { getResponseText } from '../utils/generateContentResponseUtilities.js'; import { fetchWithTimeout, isPrivateIp } from '../utils/fetch.js'; import { convert } from 'html-to-text'; diff --git a/packages/core/src/tools/web-search.test.ts b/packages/core/src/tools/web-search.test.ts index 54c4b4b3..507a230b 100644 --- a/packages/core/src/tools/web-search.test.ts +++ b/packages/core/src/tools/web-search.test.ts @@ -4,9 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest'; -import { WebSearchTool, WebSearchToolParams } from './web-search.js'; -import { Config } from '../config/config.js'; +import type { Mock } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +import type { WebSearchToolParams } from './web-search.js'; +import { WebSearchTool } from './web-search.js'; +import type { Config } from '../config/config.js'; import { GeminiClient } from '../core/client.js'; import { ToolErrorType } from './tool-error.js'; diff --git a/packages/core/src/tools/web-search.ts b/packages/core/src/tools/web-search.ts index 03404e0a..24bc40bf 100644 --- a/packages/core/src/tools/web-search.ts +++ b/packages/core/src/tools/web-search.ts @@ -4,18 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { GroundingMetadata } from '@google/genai'; -import { - BaseDeclarativeTool, - BaseToolInvocation, - Kind, - ToolInvocation, - ToolResult, -} from './tools.js'; +import type { GroundingMetadata } from '@google/genai'; +import type { ToolInvocation, ToolResult } from './tools.js'; +import { BaseDeclarativeTool, BaseToolInvocation, Kind } from './tools.js'; import { ToolErrorType } from './tool-error.js'; import { getErrorMessage } from '../utils/errors.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { getResponseText } from '../utils/generateContentResponseUtilities.js'; interface GroundingChunkWeb { diff --git a/packages/core/src/tools/write-file.test.ts b/packages/core/src/tools/write-file.test.ts index bda78008..bb0aa6d8 100644 --- a/packages/core/src/tools/write-file.test.ts +++ b/packages/core/src/tools/write-file.test.ts @@ -13,28 +13,23 @@ import { vi, type Mocked, } from 'vitest'; -import { - getCorrectedFileContent, - WriteFileTool, - WriteFileToolParams, -} from './write-file.js'; +import type { WriteFileToolParams } from './write-file.js'; +import { getCorrectedFileContent, WriteFileTool } from './write-file.js'; import { ToolErrorType } from './tool-error.js'; -import { - FileDiff, - ToolConfirmationOutcome, - ToolEditConfirmationDetails, -} from './tools.js'; +import type { FileDiff, ToolEditConfirmationDetails } from './tools.js'; +import { ToolConfirmationOutcome } from './tools.js'; import { type EditToolParams } from './edit.js'; -import { ApprovalMode, Config } from '../config/config.js'; -import { ToolRegistry } from './tool-registry.js'; +import type { Config } from '../config/config.js'; +import { ApprovalMode } from '../config/config.js'; +import type { ToolRegistry } from './tool-registry.js'; import path from 'node:path'; import fs from 'node:fs'; import os from 'node:os'; import { GeminiClient } from '../core/client.js'; +import type { CorrectedEditResult } from '../utils/editCorrector.js'; import { ensureCorrectEdit, ensureCorrectFileContent, - CorrectedEditResult, } from '../utils/editCorrector.js'; import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js'; import { StandardFileSystemService } from '../services/fileSystemService.js'; diff --git a/packages/core/src/tools/write-file.ts b/packages/core/src/tools/write-file.ts index 3594a166..ecaad35f 100644 --- a/packages/core/src/tools/write-file.ts +++ b/packages/core/src/tools/write-file.ts @@ -7,19 +7,22 @@ import fs from 'node:fs'; import path from 'node:path'; import * as Diff from 'diff'; -import { Config, ApprovalMode } from '../config/config.js'; -import { - BaseDeclarativeTool, - BaseToolInvocation, +import type { Config } from '../config/config.js'; +import { ApprovalMode } from '../config/config.js'; +import type { FileDiff, - Kind, ToolCallConfirmationDetails, - ToolConfirmationOutcome, ToolEditConfirmationDetails, ToolInvocation, ToolLocation, ToolResult, } from './tools.js'; +import { + BaseDeclarativeTool, + BaseToolInvocation, + Kind, + ToolConfirmationOutcome, +} from './tools.js'; import { ToolErrorType } from './tool-error.js'; import { makeRelative, shortenPath } from '../utils/paths.js'; import { getErrorMessage, isNodeError } from '../utils/errors.js'; @@ -28,7 +31,10 @@ import { ensureCorrectFileContent, } from '../utils/editCorrector.js'; import { DEFAULT_DIFF_OPTIONS, getDiffStat } from './diffOptions.js'; -import { ModifiableDeclarativeTool, ModifyContext } from './modifiable-tool.js'; +import type { + ModifiableDeclarativeTool, + ModifyContext, +} from './modifiable-tool.js'; import { getSpecificMimeType } from '../utils/fileUtils.js'; import { FileOperation } from '../telemetry/metrics.js'; import { IDEConnectionStatus } from '../ide/ide-client.js'; diff --git a/packages/core/src/utils/bfsFileSearch.ts b/packages/core/src/utils/bfsFileSearch.ts index 0ed58a1e..cb2f3872 100644 --- a/packages/core/src/utils/bfsFileSearch.ts +++ b/packages/core/src/utils/bfsFileSearch.ts @@ -6,8 +6,8 @@ import * as fs from 'node:fs/promises'; import * as path from 'node:path'; -import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; -import { FileFilteringOptions } from '../config/config.js'; +import type { FileDiscoveryService } from '../services/fileDiscoveryService.js'; +import type { FileFilteringOptions } from '../config/config.js'; // Simple console logger for now. // TODO: Integrate with a more robust server-side logger. const logger = { diff --git a/packages/core/src/utils/editCorrector.test.ts b/packages/core/src/utils/editCorrector.test.ts index 95a01cd9..7f76bed4 100644 --- a/packages/core/src/utils/editCorrector.test.ts +++ b/packages/core/src/utils/editCorrector.test.ts @@ -5,15 +5,8 @@ */ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { - vi, - describe, - it, - expect, - beforeEach, - Mock, - type Mocked, -} from 'vitest'; +import type { Mock } from 'vitest'; +import { vi, describe, it, expect, beforeEach, type Mocked } from 'vitest'; import * as fs from 'node:fs'; import { EditTool } from '../tools/edit.js'; diff --git a/packages/core/src/utils/editCorrector.ts b/packages/core/src/utils/editCorrector.ts index 0a1bdeb9..81c1aec7 100644 --- a/packages/core/src/utils/editCorrector.ts +++ b/packages/core/src/utils/editCorrector.ts @@ -4,9 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Content, GenerateContentConfig } from '@google/genai'; -import { GeminiClient } from '../core/client.js'; -import { EditToolParams, EditTool } from '../tools/edit.js'; +import type { Content, GenerateContentConfig } from '@google/genai'; +import type { GeminiClient } from '../core/client.js'; +import type { EditToolParams } from '../tools/edit.js'; +import { EditTool } from '../tools/edit.js'; import { WriteFileTool } from '../tools/write-file.js'; import { ReadFileTool } from '../tools/read-file.js'; import { ReadManyFilesTool } from '../tools/read-many-files.js'; diff --git a/packages/core/src/utils/environmentContext.test.ts b/packages/core/src/utils/environmentContext.test.ts index c81b7457..868e3653 100644 --- a/packages/core/src/utils/environmentContext.test.ts +++ b/packages/core/src/utils/environmentContext.test.ts @@ -17,7 +17,7 @@ import { getEnvironmentContext, getDirectoryContextString, } from './environmentContext.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { getFolderStructure } from './getFolderStructure.js'; vi.mock('../config/config.js'); diff --git a/packages/core/src/utils/environmentContext.ts b/packages/core/src/utils/environmentContext.ts index a06c1800..b3b682e6 100644 --- a/packages/core/src/utils/environmentContext.ts +++ b/packages/core/src/utils/environmentContext.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Part } from '@google/genai'; -import { Config } from '../config/config.js'; +import type { Part } from '@google/genai'; +import type { Config } from '../config/config.js'; import { getFolderStructure } from './getFolderStructure.js'; /** diff --git a/packages/core/src/utils/errorParsing.test.ts b/packages/core/src/utils/errorParsing.test.ts index 72a84d82..071ac58e 100644 --- a/packages/core/src/utils/errorParsing.test.ts +++ b/packages/core/src/utils/errorParsing.test.ts @@ -10,7 +10,7 @@ import { isProQuotaExceededError } from './quotaErrorDetection.js'; import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js'; import { UserTierId } from '../code_assist/types.js'; import { AuthType } from '../core/contentGenerator.js'; -import { StructuredError } from '../core/turn.js'; +import type { StructuredError } from '../core/turn.js'; describe('parseAndFormatApiError', () => { const vertexMessage = 'request a quota increase through Vertex'; diff --git a/packages/core/src/utils/errorReporting.ts b/packages/core/src/utils/errorReporting.ts index e7aa3469..9743d324 100644 --- a/packages/core/src/utils/errorReporting.ts +++ b/packages/core/src/utils/errorReporting.ts @@ -7,7 +7,7 @@ import fs from 'node:fs/promises'; import os from 'node:os'; import path from 'node:path'; -import { Content } from '@google/genai'; +import type { Content } from '@google/genai'; interface ErrorReportData { error: { message: string; stack?: string } | { message: string }; diff --git a/packages/core/src/utils/fileUtils.ts b/packages/core/src/utils/fileUtils.ts index 07aa2b67..dd81942e 100644 --- a/packages/core/src/utils/fileUtils.ts +++ b/packages/core/src/utils/fileUtils.ts @@ -6,9 +6,9 @@ import fs from 'node:fs'; import path from 'node:path'; -import { PartUnion } from '@google/genai'; +import type { PartUnion } from '@google/genai'; import mime from 'mime-types'; -import { FileSystemService } from '../services/fileSystemService.js'; +import type { FileSystemService } from '../services/fileSystemService.js'; import { ToolErrorType } from '../tools/tool-error.js'; import { BINARY_EXTENSIONS } from './ignorePatterns.js'; diff --git a/packages/core/src/utils/filesearch/crawler.test.ts b/packages/core/src/utils/filesearch/crawler.test.ts index e22e5a3c..c2865f44 100644 --- a/packages/core/src/utils/filesearch/crawler.test.ts +++ b/packages/core/src/utils/filesearch/crawler.test.ts @@ -10,7 +10,8 @@ import * as path from 'node:path'; import * as cache from './crawlCache.js'; import { crawl } from './crawler.js'; import { createTmpDir, cleanupTmpDir } from '@google/gemini-cli-test-utils'; -import { Ignore, loadIgnoreRules } from './ignore.js'; +import type { Ignore } from './ignore.js'; +import { loadIgnoreRules } from './ignore.js'; describe('crawler', () => { let tmpDir: string; diff --git a/packages/core/src/utils/filesearch/crawler.ts b/packages/core/src/utils/filesearch/crawler.ts index 7e422b06..9184ba32 100644 --- a/packages/core/src/utils/filesearch/crawler.ts +++ b/packages/core/src/utils/filesearch/crawler.ts @@ -6,7 +6,7 @@ import path from 'node:path'; import { fdir } from 'fdir'; -import { Ignore } from './ignore.js'; +import type { Ignore } from './ignore.js'; import * as cache from './crawlCache.js'; export interface CrawlOptions { diff --git a/packages/core/src/utils/filesearch/fileSearch.ts b/packages/core/src/utils/filesearch/fileSearch.ts index d0180062..661c5f6d 100644 --- a/packages/core/src/utils/filesearch/fileSearch.ts +++ b/packages/core/src/utils/filesearch/fileSearch.ts @@ -6,10 +6,12 @@ import path from 'node:path'; import picomatch from 'picomatch'; -import { Ignore, loadIgnoreRules } from './ignore.js'; +import type { Ignore } from './ignore.js'; +import { loadIgnoreRules } from './ignore.js'; import { ResultCache } from './result-cache.js'; import { crawl } from './crawler.js'; -import { AsyncFzf, FzfResultItem } from 'fzf'; +import type { FzfResultItem } from 'fzf'; +import { AsyncFzf } from 'fzf'; import { unescapePath } from '../paths.js'; export interface FileSearchOptions { diff --git a/packages/core/src/utils/generateContentResponseUtilities.test.ts b/packages/core/src/utils/generateContentResponseUtilities.test.ts index 5dadab25..f081e38c 100644 --- a/packages/core/src/utils/generateContentResponseUtilities.test.ts +++ b/packages/core/src/utils/generateContentResponseUtilities.test.ts @@ -15,12 +15,12 @@ import { getStructuredResponse, getStructuredResponseFromParts, } from './generateContentResponseUtilities.js'; -import { +import type { GenerateContentResponse, Part, - FinishReason, SafetyRating, } from '@google/genai'; +import { FinishReason } from '@google/genai'; const mockTextPart = (text: string): Part => ({ text }); const mockFunctionCallPart = ( diff --git a/packages/core/src/utils/generateContentResponseUtilities.ts b/packages/core/src/utils/generateContentResponseUtilities.ts index c5125753..136b35ed 100644 --- a/packages/core/src/utils/generateContentResponseUtilities.ts +++ b/packages/core/src/utils/generateContentResponseUtilities.ts @@ -4,7 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { GenerateContentResponse, Part, FunctionCall } from '@google/genai'; +import type { + GenerateContentResponse, + Part, + FunctionCall, +} from '@google/genai'; export function getResponseText( response: GenerateContentResponse, diff --git a/packages/core/src/utils/getFolderStructure.ts b/packages/core/src/utils/getFolderStructure.ts index 03f28660..fd80e438 100644 --- a/packages/core/src/utils/getFolderStructure.ts +++ b/packages/core/src/utils/getFolderStructure.ts @@ -5,11 +5,11 @@ */ import * as fs from 'node:fs/promises'; -import { Dirent } from 'node:fs'; +import type { Dirent } from 'node:fs'; import * as path from 'node:path'; import { getErrorMessage, isNodeError } from './errors.js'; -import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; -import { FileFilteringOptions } from '../config/config.js'; +import type { FileDiscoveryService } from '../services/fileDiscoveryService.js'; +import type { FileFilteringOptions } from '../config/config.js'; import { DEFAULT_FILE_FILTERING_OPTIONS } from '../config/config.js'; const MAX_ITEMS = 200; diff --git a/packages/core/src/utils/ignorePatterns.test.ts b/packages/core/src/utils/ignorePatterns.test.ts index 96822379..646c4b6b 100644 --- a/packages/core/src/utils/ignorePatterns.test.ts +++ b/packages/core/src/utils/ignorePatterns.test.ts @@ -10,7 +10,7 @@ import { BINARY_EXTENSIONS, extractExtensionsFromPatterns, } from './ignorePatterns.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; // Mock the memoryTool module vi.mock('../tools/memoryTool.js', () => ({ diff --git a/packages/core/src/utils/ignorePatterns.ts b/packages/core/src/utils/ignorePatterns.ts index 0e1669d8..9f9776db 100644 --- a/packages/core/src/utils/ignorePatterns.ts +++ b/packages/core/src/utils/ignorePatterns.ts @@ -5,7 +5,7 @@ */ import path from 'node:path'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import { getCurrentGeminiMdFilename } from '../tools/memoryTool.js'; /** diff --git a/packages/core/src/utils/installationManager.test.ts b/packages/core/src/utils/installationManager.test.ts index 4aeb53f4..acdf339e 100644 --- a/packages/core/src/utils/installationManager.test.ts +++ b/packages/core/src/utils/installationManager.test.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { vi, describe, it, expect, beforeEach, afterEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'; import { InstallationManager } from './installationManager.js'; import * as fs from 'node:fs'; import * as os from 'node:os'; diff --git a/packages/core/src/utils/memoryDiscovery.ts b/packages/core/src/utils/memoryDiscovery.ts index bae53ce4..c76dd70e 100644 --- a/packages/core/src/utils/memoryDiscovery.ts +++ b/packages/core/src/utils/memoryDiscovery.ts @@ -13,12 +13,10 @@ import { GEMINI_CONFIG_DIR, getAllGeminiMdFilenames, } from '../tools/memoryTool.js'; -import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; +import type { FileDiscoveryService } from '../services/fileDiscoveryService.js'; import { processImports } from './memoryImportProcessor.js'; -import { - DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, - FileFilteringOptions, -} from '../config/config.js'; +import type { FileFilteringOptions } from '../config/config.js'; +import { DEFAULT_MEMORY_FILE_FILTERING_OPTIONS } from '../config/config.js'; // Simple console logger, similar to the one previously in CLI's config.ts // TODO: Integrate with a more robust server-side logger if available/appropriate. diff --git a/packages/core/src/utils/messageInspectors.ts b/packages/core/src/utils/messageInspectors.ts index 5ef06d79..9a770946 100644 --- a/packages/core/src/utils/messageInspectors.ts +++ b/packages/core/src/utils/messageInspectors.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Content } from '@google/genai'; +import type { Content } from '@google/genai'; export function isFunctionResponse(content: Content): boolean { return ( diff --git a/packages/core/src/utils/nextSpeakerChecker.test.ts b/packages/core/src/utils/nextSpeakerChecker.test.ts index 9141105f..3314ca3c 100644 --- a/packages/core/src/utils/nextSpeakerChecker.test.ts +++ b/packages/core/src/utils/nextSpeakerChecker.test.ts @@ -4,12 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi, beforeEach, Mock, afterEach } from 'vitest'; -import { Content, GoogleGenAI, Models } from '@google/genai'; +import type { Mock } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +import type { Content, GoogleGenAI, Models } from '@google/genai'; import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js'; import { GeminiClient } from '../core/client.js'; import { Config } from '../config/config.js'; -import { checkNextSpeaker, NextSpeakerResponse } from './nextSpeakerChecker.js'; +import type { NextSpeakerResponse } from './nextSpeakerChecker.js'; +import { checkNextSpeaker } from './nextSpeakerChecker.js'; import { GeminiChat } from '../core/geminiChat.js'; // Mock GeminiClient and Config constructor diff --git a/packages/core/src/utils/nextSpeakerChecker.ts b/packages/core/src/utils/nextSpeakerChecker.ts index 4ae8f437..5a4e6876 100644 --- a/packages/core/src/utils/nextSpeakerChecker.ts +++ b/packages/core/src/utils/nextSpeakerChecker.ts @@ -4,10 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Content } from '@google/genai'; +import type { Content } from '@google/genai'; import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js'; -import { GeminiClient } from '../core/client.js'; -import { GeminiChat } from '../core/geminiChat.js'; +import type { GeminiClient } from '../core/client.js'; +import type { GeminiChat } from '../core/geminiChat.js'; import { isFunctionResponse } from './messageInspectors.js'; const CHECK_PROMPT = `Analyze *only* the content and structure of your immediately preceding response (your last turn in the conversation history). Based *strictly* on that response, determine who should logically speak next: the 'user' or the 'model' (you). diff --git a/packages/core/src/utils/partUtils.test.ts b/packages/core/src/utils/partUtils.test.ts index eda85df2..5504f85c 100644 --- a/packages/core/src/utils/partUtils.test.ts +++ b/packages/core/src/utils/partUtils.test.ts @@ -6,7 +6,7 @@ import { describe, it, expect } from 'vitest'; import { partToString, getResponseText } from './partUtils.js'; -import { GenerateContentResponse, Part } from '@google/genai'; +import type { GenerateContentResponse, Part } from '@google/genai'; const mockResponse = ( parts?: Array<{ text?: string; functionCall?: unknown }>, diff --git a/packages/core/src/utils/partUtils.ts b/packages/core/src/utils/partUtils.ts index c6bf098d..ce42d3b0 100644 --- a/packages/core/src/utils/partUtils.ts +++ b/packages/core/src/utils/partUtils.ts @@ -4,7 +4,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { GenerateContentResponse, PartListUnion, Part } from '@google/genai'; +import type { + GenerateContentResponse, + PartListUnion, + Part, +} from '@google/genai'; /** * Converts a PartListUnion into a string. diff --git a/packages/core/src/utils/quotaErrorDetection.ts b/packages/core/src/utils/quotaErrorDetection.ts index 1377b4fa..6417e0db 100644 --- a/packages/core/src/utils/quotaErrorDetection.ts +++ b/packages/core/src/utils/quotaErrorDetection.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { StructuredError } from '../core/turn.js'; +import type { StructuredError } from '../core/turn.js'; export interface ApiError { error: { diff --git a/packages/core/src/utils/retry.test.ts b/packages/core/src/utils/retry.test.ts index 98992af3..180fe218 100644 --- a/packages/core/src/utils/retry.test.ts +++ b/packages/core/src/utils/retry.test.ts @@ -6,7 +6,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { retryWithBackoff, HttpError } from './retry.js'; +import type { HttpError } from './retry.js'; +import { retryWithBackoff } from './retry.js'; import { setSimulate429 } from './testUtils.js'; // Helper to create a mock function that fails a certain number of times diff --git a/packages/core/src/utils/shell-utils.test.ts b/packages/core/src/utils/shell-utils.test.ts index 18f88e11..71f33dbf 100644 --- a/packages/core/src/utils/shell-utils.test.ts +++ b/packages/core/src/utils/shell-utils.test.ts @@ -13,7 +13,7 @@ import { isCommandAllowed, stripShellWrapper, } from './shell-utils.js'; -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; const mockPlatform = vi.hoisted(() => vi.fn()); vi.mock('os', () => ({ diff --git a/packages/core/src/utils/shell-utils.ts b/packages/core/src/utils/shell-utils.ts index 5c187c88..3af4959b 100644 --- a/packages/core/src/utils/shell-utils.ts +++ b/packages/core/src/utils/shell-utils.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Config } from '../config/config.js'; +import type { Config } from '../config/config.js'; import os from 'node:os'; import { quote } from 'shell-quote'; diff --git a/packages/core/src/utils/summarizer.test.ts b/packages/core/src/utils/summarizer.test.ts index c3a521b7..33fa9bc0 100644 --- a/packages/core/src/utils/summarizer.test.ts +++ b/packages/core/src/utils/summarizer.test.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { GeminiClient } from '../core/client.js'; import { Config } from '../config/config.js'; import { @@ -12,7 +13,7 @@ import { llmSummarizer, defaultSummarizer, } from './summarizer.js'; -import { ToolResult } from '../tools/tools.js'; +import type { ToolResult } from '../tools/tools.js'; // Mock GeminiClient and Config constructor vi.mock('../core/client.js'); diff --git a/packages/core/src/utils/summarizer.ts b/packages/core/src/utils/summarizer.ts index b6e4f543..14076b5c 100644 --- a/packages/core/src/utils/summarizer.ts +++ b/packages/core/src/utils/summarizer.ts @@ -4,13 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { ToolResult } from '../tools/tools.js'; -import { +import type { ToolResult } from '../tools/tools.js'; +import type { Content, GenerateContentConfig, GenerateContentResponse, } from '@google/genai'; -import { GeminiClient } from '../core/client.js'; +import type { GeminiClient } from '../core/client.js'; import { DEFAULT_GEMINI_FLASH_LITE_MODEL } from '../config/models.js'; import { getResponseText, partToString } from './partUtils.js'; diff --git a/packages/core/src/utils/userAccountManager.test.ts b/packages/core/src/utils/userAccountManager.test.ts index 1e7e05aa..434a3239 100644 --- a/packages/core/src/utils/userAccountManager.test.ts +++ b/packages/core/src/utils/userAccountManager.test.ts @@ -4,7 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { vi, describe, it, expect, beforeEach, afterEach, Mock } from 'vitest'; +import type { Mock } from 'vitest'; +import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'; import { UserAccountManager } from './userAccountManager.js'; import * as fs from 'node:fs'; import * as os from 'node:os'; diff --git a/packages/vscode-ide-companion/src/ide-server.test.ts b/packages/vscode-ide-companion/src/ide-server.test.ts index 726259e4..881bd1d8 100644 --- a/packages/vscode-ide-companion/src/ide-server.test.ts +++ b/packages/vscode-ide-companion/src/ide-server.test.ts @@ -7,10 +7,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import type * as vscode from 'vscode'; import * as fs from 'node:fs/promises'; -import * as os from 'node:os'; +import type * as os from 'node:os'; import * as path from 'node:path'; import { IDEServer } from './ide-server.js'; -import { DiffManager } from './diff-manager.js'; +import type { DiffManager } from './diff-manager.js'; const mocks = vi.hoisted(() => ({ diffManager: { diff --git a/packages/vscode-ide-companion/src/ide-server.ts b/packages/vscode-ide-companion/src/ide-server.ts index 2a49e74c..798fdeed 100644 --- a/packages/vscode-ide-companion/src/ide-server.ts +++ b/packages/vscode-ide-companion/src/ide-server.ts @@ -16,7 +16,7 @@ import * as path from 'node:path'; import * as fs from 'node:fs/promises'; import * as os from 'node:os'; import { z } from 'zod'; -import { DiffManager } from './diff-manager.js'; +import type { DiffManager } from './diff-manager.js'; import { OpenFilesManager } from './open-files-manager.js'; const MCP_SESSION_ID_HEADER = 'mcp-session-id'; diff --git a/tsconfig.json b/tsconfig.json index e46eff1d..c4542cc8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,6 +20,7 @@ "incremental": true, "declaration": true, "allowSyntheticDefaultImports": true, + "verbatimModuleSyntax": true, "lib": ["ES2023"], "module": "NodeNext", "moduleResolution": "nodenext",