@google/gemini-cli 0.10.0-preview.2 → 0.11.0-nightly.20251020.a96f0659
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/google-gemini-cli-0.11.0-nightly.20251015.203bad7c.tgz +0 -0
- package/dist/package.json +2 -2
- package/dist/src/commands/extensions/examples/mcp-server/example.d.ts +6 -0
- package/dist/src/commands/extensions/examples/mcp-server/example.js +46 -0
- package/dist/src/commands/extensions/examples/mcp-server/example.js.map +1 -0
- package/dist/src/commands/extensions/install.d.ts +1 -0
- package/dist/src/commands/extensions/install.js +15 -2
- package/dist/src/commands/extensions/install.js.map +1 -1
- package/dist/src/commands/extensions/list.js +3 -2
- package/dist/src/commands/extensions/list.js.map +1 -1
- package/dist/src/commands/extensions/update.js +2 -2
- package/dist/src/commands/extensions/update.js.map +1 -1
- package/dist/src/commands/mcp/add.test.d.ts +6 -0
- package/dist/src/commands/mcp/add.test.js +234 -0
- package/dist/src/commands/mcp/add.test.js.map +1 -0
- package/dist/src/commands/mcp/list.js +5 -3
- package/dist/src/commands/mcp/list.js.map +1 -1
- package/dist/src/commands/mcp/list.test.d.ts +6 -0
- package/dist/src/commands/mcp/list.test.js +117 -0
- package/dist/src/commands/mcp/list.test.js.map +1 -0
- package/dist/src/commands/mcp/remove.test.d.ts +6 -0
- package/dist/src/commands/mcp/remove.test.js +175 -0
- package/dist/src/commands/mcp/remove.test.js.map +1 -0
- package/dist/src/commands/mcp.test.d.ts +6 -0
- package/dist/src/commands/mcp.test.js +62 -0
- package/dist/src/commands/mcp.test.js.map +1 -0
- package/dist/src/config/auth.js +3 -1
- package/dist/src/config/auth.js.map +1 -1
- package/dist/src/config/auth.test.js +3 -1
- package/dist/src/config/auth.test.js.map +1 -1
- package/dist/src/config/config.d.ts +0 -11
- package/dist/src/config/config.integration.test.d.ts +6 -0
- package/dist/src/config/config.integration.test.js +351 -0
- package/dist/src/config/config.integration.test.js.map +1 -0
- package/dist/src/config/config.js +17 -74
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.d.ts +6 -0
- package/dist/src/config/config.test.js +2001 -0
- package/dist/src/config/config.test.js.map +1 -0
- package/dist/src/config/extension.d.ts +1 -4
- package/dist/src/config/extension.js +64 -69
- package/dist/src/config/extension.js.map +1 -1
- package/dist/src/config/extension.test.d.ts +6 -0
- package/dist/src/config/extension.test.js +1176 -0
- package/dist/src/config/extension.test.js.map +1 -0
- package/dist/src/config/extensions/extensionEnablement.d.ts +1 -1
- package/dist/src/config/extensions/extensionEnablement.js +4 -3
- package/dist/src/config/extensions/extensionEnablement.js.map +1 -1
- package/dist/src/config/extensions/extensionEnablement.test.js +21 -18
- package/dist/src/config/extensions/extensionEnablement.test.js.map +1 -1
- package/dist/src/config/extensions/github.d.ts +15 -7
- package/dist/src/config/extensions/github.js +95 -21
- package/dist/src/config/extensions/github.js.map +1 -1
- package/dist/src/config/extensions/github.test.js +14 -12
- package/dist/src/config/extensions/github.test.js.map +1 -1
- package/dist/src/config/extensions/update.test.js +9 -9
- package/dist/src/config/extensions/update.test.js.map +1 -1
- package/dist/src/config/keyBindings.d.ts +2 -1
- package/dist/src/config/keyBindings.js +4 -2
- package/dist/src/config/keyBindings.js.map +1 -1
- package/dist/src/config/policy.js +13 -14
- package/dist/src/config/policy.js.map +1 -1
- package/dist/src/config/policy.test.js +3 -3
- package/dist/src/config/policy.test.js.map +1 -1
- package/dist/src/config/sandboxConfig.d.ts +0 -1
- package/dist/src/config/sandboxConfig.js +1 -3
- package/dist/src/config/sandboxConfig.js.map +1 -1
- package/dist/src/config/settings.test.d.ts +6 -0
- package/dist/src/config/settings.test.js +1937 -0
- package/dist/src/config/settings.test.js.map +1 -0
- package/dist/src/gemini.js +12 -10
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.test.js +34 -11
- package/dist/src/gemini.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/nonInteractiveCli.js +91 -3
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/nonInteractiveCli.test.d.ts +6 -0
- package/dist/src/nonInteractiveCli.test.js +711 -0
- package/dist/src/nonInteractiveCli.test.js.map +1 -0
- package/dist/src/services/FileCommandLoader.test.d.ts +6 -0
- package/dist/src/services/FileCommandLoader.test.js +971 -0
- package/dist/src/services/FileCommandLoader.test.js.map +1 -0
- package/dist/src/services/prompt-processors/argumentProcessor.test.d.ts +6 -0
- package/dist/src/services/prompt-processors/argumentProcessor.test.js +40 -0
- package/dist/src/services/prompt-processors/argumentProcessor.test.js.map +1 -0
- package/dist/src/services/prompt-processors/shellProcessor.test.d.ts +6 -0
- package/dist/src/services/prompt-processors/shellProcessor.test.js +482 -0
- package/dist/src/services/prompt-processors/shellProcessor.test.js.map +1 -0
- package/dist/src/test-utils/render.d.ts +2 -1
- package/dist/src/test-utils/render.js +5 -2
- package/dist/src/test-utils/render.js.map +1 -1
- package/dist/src/ui/App.test.d.ts +6 -0
- package/dist/src/ui/App.test.js +110 -0
- package/dist/src/ui/App.test.js.map +1 -0
- package/dist/src/ui/AppContainer.js +39 -26
- package/dist/src/ui/AppContainer.js.map +1 -1
- package/dist/src/ui/AppContainer.test.js +35 -9
- package/dist/src/ui/AppContainer.test.js.map +1 -1
- package/dist/src/ui/auth/AuthDialog.d.ts +1 -1
- package/dist/src/ui/auth/AuthDialog.js +3 -1
- package/dist/src/ui/auth/AuthDialog.js.map +1 -1
- package/dist/src/ui/auth/useAuth.d.ts +1 -1
- package/dist/src/ui/auth/useAuth.js +3 -1
- package/dist/src/ui/auth/useAuth.js.map +1 -1
- package/dist/src/ui/commands/aboutCommand.js +1 -1
- package/dist/src/ui/commands/aboutCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/aboutCommand.test.js +130 -0
- package/dist/src/ui/commands/aboutCommand.test.js.map +1 -0
- package/dist/src/ui/commands/authCommand.js +1 -1
- package/dist/src/ui/commands/authCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/authCommand.test.js +30 -0
- package/dist/src/ui/commands/authCommand.test.js.map +1 -0
- package/dist/src/ui/commands/bugCommand.js +1 -1
- package/dist/src/ui/commands/bugCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/bugCommand.test.js +105 -0
- package/dist/src/ui/commands/bugCommand.test.js.map +1 -0
- package/dist/src/ui/commands/chatCommand.js +1 -1
- package/dist/src/ui/commands/chatCommand.js.map +1 -1
- package/dist/src/ui/commands/chatCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/chatCommand.test.js +555 -0
- package/dist/src/ui/commands/chatCommand.test.js.map +1 -0
- package/dist/src/ui/commands/clearCommand.js +1 -1
- package/dist/src/ui/commands/clearCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/clearCommand.test.js +76 -0
- package/dist/src/ui/commands/clearCommand.test.js.map +1 -0
- package/dist/src/ui/commands/compressCommand.js +1 -1
- package/dist/src/ui/commands/compressCommand.js.map +1 -1
- package/dist/src/ui/commands/compressCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/compressCommand.test.js +98 -0
- package/dist/src/ui/commands/compressCommand.test.js.map +1 -0
- package/dist/src/ui/commands/copyCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/copyCommand.test.js +242 -0
- package/dist/src/ui/commands/copyCommand.test.js.map +1 -0
- package/dist/src/ui/commands/corgiCommand.js +1 -1
- package/dist/src/ui/commands/corgiCommand.js.map +1 -1
- package/dist/src/ui/commands/corgiCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/corgiCommand.test.js +28 -0
- package/dist/src/ui/commands/corgiCommand.test.js.map +1 -0
- package/dist/src/ui/commands/directoryCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/directoryCommand.test.js +145 -0
- package/dist/src/ui/commands/directoryCommand.test.js.map +1 -0
- package/dist/src/ui/commands/docsCommand.js +1 -1
- package/dist/src/ui/commands/docsCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/docsCommand.test.js +72 -0
- package/dist/src/ui/commands/docsCommand.test.js.map +1 -0
- package/dist/src/ui/commands/editorCommand.js +1 -1
- package/dist/src/ui/commands/editorCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/editorCommand.test.js +27 -0
- package/dist/src/ui/commands/editorCommand.test.js.map +1 -0
- package/dist/src/ui/commands/extensionsCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/extensionsCommand.test.js +241 -0
- package/dist/src/ui/commands/extensionsCommand.test.js.map +1 -0
- package/dist/src/ui/commands/helpCommand.js +1 -1
- package/dist/src/ui/commands/helpCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/helpCommand.test.js +42 -0
- package/dist/src/ui/commands/helpCommand.test.js.map +1 -0
- package/dist/src/ui/commands/ideCommand.js +6 -6
- package/dist/src/ui/commands/ideCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/ideCommand.test.js +203 -0
- package/dist/src/ui/commands/ideCommand.test.js.map +1 -0
- package/dist/src/ui/commands/initCommand.js +1 -1
- package/dist/src/ui/commands/initCommand.js.map +1 -1
- package/dist/src/ui/commands/initCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/initCommand.test.js +80 -0
- package/dist/src/ui/commands/initCommand.test.js.map +1 -0
- package/dist/src/ui/commands/mcpCommand.js +98 -88
- package/dist/src/ui/commands/mcpCommand.js.map +1 -1
- package/dist/src/ui/commands/mcpCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/mcpCommand.test.js +148 -0
- package/dist/src/ui/commands/mcpCommand.test.js.map +1 -0
- package/dist/src/ui/commands/memoryCommand.js +5 -5
- package/dist/src/ui/commands/memoryCommand.js.map +1 -1
- package/dist/src/ui/commands/memoryCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/memoryCommand.test.js +266 -0
- package/dist/src/ui/commands/memoryCommand.test.js.map +1 -0
- package/dist/src/ui/commands/privacyCommand.js +1 -1
- package/dist/src/ui/commands/privacyCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/privacyCommand.test.js +32 -0
- package/dist/src/ui/commands/privacyCommand.test.js.map +1 -0
- package/dist/src/ui/commands/quitCommand.js +1 -1
- package/dist/src/ui/commands/quitCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/quitCommand.test.js +50 -0
- package/dist/src/ui/commands/quitCommand.test.js.map +1 -0
- package/dist/src/ui/commands/restoreCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/restoreCommand.test.js +190 -0
- package/dist/src/ui/commands/restoreCommand.test.js.map +1 -0
- package/dist/src/ui/commands/settingsCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/settingsCommand.test.js +30 -0
- package/dist/src/ui/commands/settingsCommand.test.js.map +1 -0
- package/dist/src/ui/commands/setupGithubCommand.test.js +1 -2
- package/dist/src/ui/commands/setupGithubCommand.test.js.map +1 -1
- package/dist/src/ui/commands/statsCommand.js +3 -3
- package/dist/src/ui/commands/statsCommand.js.map +1 -1
- package/dist/src/ui/commands/statsCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/statsCommand.test.js +53 -0
- package/dist/src/ui/commands/statsCommand.test.js.map +1 -0
- package/dist/src/ui/commands/terminalSetupCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/terminalSetupCommand.test.js +66 -0
- package/dist/src/ui/commands/terminalSetupCommand.test.js.map +1 -0
- package/dist/src/ui/commands/themeCommand.js +1 -1
- package/dist/src/ui/commands/themeCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/themeCommand.test.js +32 -0
- package/dist/src/ui/commands/themeCommand.test.js.map +1 -0
- package/dist/src/ui/commands/toolsCommand.js +1 -1
- package/dist/src/ui/commands/toolsCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/toolsCommand.test.js +100 -0
- package/dist/src/ui/commands/toolsCommand.test.js.map +1 -0
- package/dist/src/ui/commands/vimCommand.js +1 -1
- package/dist/src/ui/components/Composer.js +5 -3
- package/dist/src/ui/components/Composer.js.map +1 -1
- package/dist/src/ui/components/Composer.test.js +16 -1
- package/dist/src/ui/components/Composer.test.js.map +1 -1
- package/dist/src/ui/components/ContextSummaryDisplay.d.ts +0 -1
- package/dist/src/ui/components/ContextSummaryDisplay.js +2 -12
- package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/ContextSummaryDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/ContextSummaryDisplay.test.js +66 -0
- package/dist/src/ui/components/ContextSummaryDisplay.test.js.map +1 -0
- package/dist/src/ui/components/DialogManager.js +1 -5
- package/dist/src/ui/components/DialogManager.js.map +1 -1
- package/dist/src/ui/components/EditorSettingsDialog.js +1 -1
- package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -1
- package/dist/src/ui/components/FolderTrustDialog.test.js +7 -3
- package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/Footer.js +1 -1
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/Footer.test.d.ts +6 -0
- package/dist/src/ui/components/Footer.test.js +231 -0
- package/dist/src/ui/components/Footer.test.js.map +1 -0
- package/dist/src/ui/components/InputPrompt.d.ts +4 -0
- package/dist/src/ui/components/InputPrompt.js +53 -4
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.test.d.ts +6 -0
- package/dist/src/ui/components/InputPrompt.test.js +1716 -0
- package/dist/src/ui/components/InputPrompt.test.js.map +1 -0
- package/dist/src/ui/components/ModelStatsDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/ModelStatsDisplay.test.js +285 -0
- package/dist/src/ui/components/ModelStatsDisplay.test.js.map +1 -0
- package/dist/src/ui/components/PermissionsModifyTrustDialog.js +22 -18
- package/dist/src/ui/components/PermissionsModifyTrustDialog.js.map +1 -1
- package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js +10 -2
- package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/QueuedMessageDisplay.js +3 -3
- package/dist/src/ui/components/QueuedMessageDisplay.js.map +1 -1
- package/dist/src/ui/components/QueuedMessageDisplay.test.js +4 -0
- package/dist/src/ui/components/QueuedMessageDisplay.test.js.map +1 -1
- package/dist/src/ui/components/RawMarkdownIndicator.d.ts +7 -0
- package/dist/src/ui/components/RawMarkdownIndicator.js +8 -0
- package/dist/src/ui/components/RawMarkdownIndicator.js.map +1 -0
- package/dist/src/ui/components/SessionSummaryDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/SessionSummaryDisplay.test.js +74 -0
- package/dist/src/ui/components/SessionSummaryDisplay.test.js.map +1 -0
- package/dist/src/ui/components/SettingsDialog.js +8 -8
- package/dist/src/ui/components/SettingsDialog.js.map +1 -1
- package/dist/src/ui/components/SettingsDialog.test.js +188 -56
- package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
- package/dist/src/ui/components/StatsDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/StatsDisplay.test.js +351 -0
- package/dist/src/ui/components/StatsDisplay.test.js.map +1 -0
- package/dist/src/ui/components/ThemeDialog.d.ts +4 -2
- package/dist/src/ui/components/ThemeDialog.js +3 -3
- package/dist/src/ui/components/ThemeDialog.js.map +1 -1
- package/dist/src/ui/components/ThemeDialog.test.js +13 -0
- package/dist/src/ui/components/ThemeDialog.test.js.map +1 -1
- package/dist/src/ui/components/ToolStatsDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/ToolStatsDisplay.test.js +227 -0
- package/dist/src/ui/components/ToolStatsDisplay.test.js.map +1 -0
- package/dist/src/ui/components/messages/GeminiMessage.js +3 -1
- package/dist/src/ui/components/messages/GeminiMessage.js.map +1 -1
- package/dist/src/ui/components/messages/GeminiMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/GeminiMessage.test.js +35 -0
- package/dist/src/ui/components/messages/GeminiMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/GeminiMessageContent.js +3 -1
- package/dist/src/ui/components/messages/GeminiMessageContent.js.map +1 -1
- package/dist/src/ui/components/messages/Todo.d.ts +7 -0
- package/dist/src/ui/components/messages/Todo.js +59 -0
- package/dist/src/ui/components/messages/Todo.js.map +1 -0
- package/dist/src/ui/components/messages/Todo.test.d.ts +6 -0
- package/dist/src/ui/components/messages/Todo.test.js +113 -0
- package/dist/src/ui/components/messages/Todo.test.js.map +1 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.js +1 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolMessage.js +8 -3
- package/dist/src/ui/components/messages/ToolMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolMessage.test.js +2 -2
- package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -1
- package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.d.ts +6 -0
- package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.js +30 -0
- package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.js.map +1 -0
- package/dist/src/ui/components/messages/UserShellMessage.js +1 -1
- package/dist/src/ui/components/messages/UserShellMessage.js.map +1 -1
- package/dist/src/ui/components/shared/BaseSelectionList.test.js +1 -1
- package/dist/src/ui/components/shared/BaseSelectionList.test.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.test.d.ts +6 -0
- package/dist/src/ui/components/shared/text-buffer.test.js +1554 -0
- package/dist/src/ui/components/shared/text-buffer.test.js.map +1 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.test.d.ts +6 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.test.js +951 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.test.js.map +1 -0
- package/dist/src/ui/components/views/McpStatus.d.ts +0 -1
- package/dist/src/ui/components/views/McpStatus.js +2 -2
- package/dist/src/ui/components/views/McpStatus.js.map +1 -1
- package/dist/src/ui/components/views/McpStatus.test.js +0 -5
- package/dist/src/ui/components/views/McpStatus.test.js.map +1 -1
- package/dist/src/ui/components/views/ToolsList.test.js +4 -4
- package/dist/src/ui/components/views/ToolsList.test.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.d.ts +1 -0
- package/dist/src/ui/contexts/KeypressContext.js +176 -50
- package/dist/src/ui/contexts/KeypressContext.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.test.js +413 -14
- package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
- package/dist/src/ui/contexts/SessionContext.test.d.ts +6 -0
- package/dist/src/ui/contexts/SessionContext.test.js +177 -0
- package/dist/src/ui/contexts/SessionContext.test.js.map +1 -0
- package/dist/src/ui/contexts/UIActionsContext.d.ts +5 -4
- package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
- package/dist/src/ui/contexts/UIStateContext.d.ts +3 -3
- package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.test.d.ts +6 -0
- package/dist/src/ui/hooks/slashCommandProcessor.test.js +779 -0
- package/dist/src/ui/hooks/slashCommandProcessor.test.js.map +1 -0
- package/dist/src/ui/hooks/useAtCompletion.js +2 -2
- package/dist/src/ui/hooks/useAtCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useAtCompletion.test.d.ts +6 -0
- package/dist/src/ui/hooks/useAtCompletion.test.js +385 -0
- package/dist/src/ui/hooks/useAtCompletion.test.js.map +1 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +0 -1
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -1
- package/dist/src/ui/hooks/useCommandCompletion.d.ts +1 -1
- package/dist/src/ui/hooks/useCommandCompletion.js +5 -3
- package/dist/src/ui/hooks/useCommandCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useCommandCompletion.test.d.ts +6 -0
- package/dist/src/ui/hooks/useCommandCompletion.test.js +375 -0
- package/dist/src/ui/hooks/useCommandCompletion.test.js.map +1 -0
- package/dist/src/ui/hooks/useConsoleMessages.test.d.ts +6 -0
- package/dist/src/ui/hooks/useConsoleMessages.test.js +110 -0
- package/dist/src/ui/hooks/useConsoleMessages.test.js.map +1 -0
- package/dist/src/ui/hooks/useExtensionUpdates.test.js +3 -3
- package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +1 -1
- package/dist/src/ui/hooks/useFocus.test.d.ts +6 -0
- package/dist/src/ui/hooks/useFocus.test.js +115 -0
- package/dist/src/ui/hooks/useFocus.test.js.map +1 -0
- package/dist/src/ui/hooks/useFolderTrust.test.d.ts +6 -0
- package/dist/src/ui/hooks/useFolderTrust.test.js +164 -0
- package/dist/src/ui/hooks/useFolderTrust.test.js.map +1 -0
- package/dist/src/ui/hooks/useGeminiStream.js +33 -31
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.test.d.ts +6 -0
- package/dist/src/ui/hooks/useGeminiStream.test.js +1936 -0
- package/dist/src/ui/hooks/useGeminiStream.test.js.map +1 -0
- package/dist/src/ui/hooks/useKeypress.test.d.ts +6 -0
- package/dist/src/ui/hooks/useKeypress.test.js +234 -0
- package/dist/src/ui/hooks/useKeypress.test.js.map +1 -0
- package/dist/src/ui/hooks/useLoadingIndicator.test.js +5 -0
- package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -1
- package/dist/src/ui/hooks/useMessageQueue.d.ts +1 -0
- package/dist/src/ui/hooks/useMessageQueue.js +14 -0
- package/dist/src/ui/hooks/useMessageQueue.js.map +1 -1
- package/dist/src/ui/hooks/useMessageQueue.test.js +121 -0
- package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -1
- package/dist/src/ui/hooks/usePhraseCycler.d.ts +1 -0
- package/dist/src/ui/hooks/usePhraseCycler.js +156 -5
- package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -1
- package/dist/src/ui/hooks/usePhraseCycler.test.d.ts +6 -0
- package/dist/src/ui/hooks/usePhraseCycler.test.js +155 -0
- package/dist/src/ui/hooks/usePhraseCycler.test.js.map +1 -0
- package/dist/src/ui/hooks/useThemeCommand.d.ts +2 -1
- package/dist/src/ui/hooks/useThemeCommand.js +6 -0
- package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
- package/dist/src/ui/hooks/useToolScheduler.test.js +3 -0
- package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
- package/dist/src/ui/hooks/vim.test.d.ts +6 -0
- package/dist/src/ui/hooks/vim.test.js +1389 -0
- package/dist/src/ui/hooks/vim.test.js.map +1 -0
- package/dist/src/ui/keyMatchers.test.js +9 -3
- package/dist/src/ui/keyMatchers.test.js.map +1 -1
- package/dist/src/ui/themes/theme.test.d.ts +6 -0
- package/dist/src/ui/themes/theme.test.js +85 -0
- package/dist/src/ui/themes/theme.test.js.map +1 -0
- package/dist/src/ui/types.d.ts +0 -1
- package/dist/src/ui/types.js.map +1 -1
- package/dist/src/ui/utils/CodeColorizer.d.ts +1 -1
- package/dist/src/ui/utils/CodeColorizer.js +4 -2
- package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
- package/dist/src/ui/utils/MarkdownDisplay.d.ts +1 -0
- package/dist/src/ui/utils/MarkdownDisplay.js +8 -1
- package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
- package/dist/src/ui/utils/commandUtils.js +18 -2
- package/dist/src/ui/utils/commandUtils.js.map +1 -1
- package/dist/src/ui/utils/commandUtils.test.js +61 -6
- package/dist/src/ui/utils/commandUtils.test.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.d.ts +2 -1
- package/dist/src/ui/utils/updateCheck.js +4 -1
- package/dist/src/ui/utils/updateCheck.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.test.js +25 -10
- package/dist/src/ui/utils/updateCheck.test.js.map +1 -1
- package/dist/src/utils/errors.d.ts +1 -0
- package/dist/src/utils/errors.js +66 -5
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/validateNonInterActiveAuth.test.d.ts +6 -0
- package/dist/src/validateNonInterActiveAuth.test.js +336 -0
- package/dist/src/validateNonInterActiveAuth.test.js.map +1 -0
- package/dist/src/zed-integration/zedIntegration.js +1 -2
- package/dist/src/zed-integration/zedIntegration.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/google-gemini-cli-0.10.0-preview.1.tgz +0 -0
- package/dist/src/ui/components/WorkspaceMigrationDialog.d.ts +0 -11
- package/dist/src/ui/components/WorkspaceMigrationDialog.js +0 -44
- package/dist/src/ui/components/WorkspaceMigrationDialog.js.map +0 -1
- package/dist/src/ui/hooks/useWorkspaceMigration.d.ts +0 -13
- package/dist/src/ui/hooks/useWorkspaceMigration.js +0 -59
- package/dist/src/ui/hooks/useWorkspaceMigration.js.map +0 -1
|
@@ -103,7 +103,7 @@ export const ideCommand = async () => {
|
|
|
103
103
|
if (!currentIDE) {
|
|
104
104
|
return {
|
|
105
105
|
name: 'ide',
|
|
106
|
-
description: '
|
|
106
|
+
description: 'Manage IDE integration',
|
|
107
107
|
kind: CommandKind.BUILT_IN,
|
|
108
108
|
action: () => ({
|
|
109
109
|
type: 'message',
|
|
@@ -114,13 +114,13 @@ export const ideCommand = async () => {
|
|
|
114
114
|
}
|
|
115
115
|
const ideSlashCommand = {
|
|
116
116
|
name: 'ide',
|
|
117
|
-
description: '
|
|
117
|
+
description: 'Manage IDE integration',
|
|
118
118
|
kind: CommandKind.BUILT_IN,
|
|
119
119
|
subCommands: [],
|
|
120
120
|
};
|
|
121
121
|
const statusCommand = {
|
|
122
122
|
name: 'status',
|
|
123
|
-
description: '
|
|
123
|
+
description: 'Check status of IDE integration',
|
|
124
124
|
kind: CommandKind.BUILT_IN,
|
|
125
125
|
action: async () => {
|
|
126
126
|
const { messageType, content } = await getIdeStatusMessageWithFiles(ideClient);
|
|
@@ -133,7 +133,7 @@ export const ideCommand = async () => {
|
|
|
133
133
|
};
|
|
134
134
|
const installCommand = {
|
|
135
135
|
name: 'install',
|
|
136
|
-
description: `
|
|
136
|
+
description: `Install required IDE companion for ${ideClient.getDetectedIdeDisplayName()}`,
|
|
137
137
|
kind: CommandKind.BUILT_IN,
|
|
138
138
|
action: async (context) => {
|
|
139
139
|
const installer = getIdeInstaller(currentIDE);
|
|
@@ -182,7 +182,7 @@ export const ideCommand = async () => {
|
|
|
182
182
|
};
|
|
183
183
|
const enableCommand = {
|
|
184
184
|
name: 'enable',
|
|
185
|
-
description: '
|
|
185
|
+
description: 'Enable IDE integration',
|
|
186
186
|
kind: CommandKind.BUILT_IN,
|
|
187
187
|
action: async (context) => {
|
|
188
188
|
context.services.settings.setValue(SettingScope.User, 'ide.enabled', true);
|
|
@@ -196,7 +196,7 @@ export const ideCommand = async () => {
|
|
|
196
196
|
};
|
|
197
197
|
const disableCommand = {
|
|
198
198
|
name: 'disable',
|
|
199
|
-
description: '
|
|
199
|
+
description: 'Disable IDE integration',
|
|
200
200
|
kind: CommandKind.BUILT_IN,
|
|
201
201
|
action: async (context) => {
|
|
202
202
|
context.services.settings.setValue(SettingScope.User, 'ide.enabled', false);
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
7
|
+
import { ideCommand } from './ideCommand.js';
|
|
8
|
+
import {} from './types.js';
|
|
9
|
+
import { IDE_DEFINITIONS } from '@google/gemini-cli-core';
|
|
10
|
+
import * as core from '@google/gemini-cli-core';
|
|
11
|
+
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
|
12
|
+
const original = await importOriginal();
|
|
13
|
+
return {
|
|
14
|
+
...original,
|
|
15
|
+
getOauthClient: vi.fn(original.getOauthClient),
|
|
16
|
+
getIdeInstaller: vi.fn(original.getIdeInstaller),
|
|
17
|
+
IdeClient: {
|
|
18
|
+
getInstance: vi.fn(),
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
describe('ideCommand', () => {
|
|
23
|
+
let mockContext;
|
|
24
|
+
let mockIdeClient;
|
|
25
|
+
let platformSpy;
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
vi.resetAllMocks();
|
|
28
|
+
mockIdeClient = {
|
|
29
|
+
reconnect: vi.fn(),
|
|
30
|
+
disconnect: vi.fn(),
|
|
31
|
+
connect: vi.fn(),
|
|
32
|
+
getCurrentIde: vi.fn(),
|
|
33
|
+
getConnectionStatus: vi.fn(),
|
|
34
|
+
getDetectedIdeDisplayName: vi.fn(),
|
|
35
|
+
};
|
|
36
|
+
vi.mocked(core.IdeClient.getInstance).mockResolvedValue(mockIdeClient);
|
|
37
|
+
vi.mocked(mockIdeClient.getDetectedIdeDisplayName).mockReturnValue('VS Code');
|
|
38
|
+
mockContext = {
|
|
39
|
+
ui: {
|
|
40
|
+
addItem: vi.fn(),
|
|
41
|
+
},
|
|
42
|
+
services: {
|
|
43
|
+
settings: {
|
|
44
|
+
setValue: vi.fn(),
|
|
45
|
+
},
|
|
46
|
+
config: {
|
|
47
|
+
getIdeMode: vi.fn(),
|
|
48
|
+
setIdeMode: vi.fn(),
|
|
49
|
+
getUsageStatisticsEnabled: vi.fn().mockReturnValue(false),
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
platformSpy = vi.spyOn(process, 'platform', 'get');
|
|
54
|
+
});
|
|
55
|
+
afterEach(() => {
|
|
56
|
+
vi.restoreAllMocks();
|
|
57
|
+
});
|
|
58
|
+
it('should return the ide command', async () => {
|
|
59
|
+
vi.mocked(mockIdeClient.getCurrentIde).mockReturnValue(IDE_DEFINITIONS.vscode);
|
|
60
|
+
vi.mocked(mockIdeClient.getConnectionStatus).mockReturnValue({
|
|
61
|
+
status: core.IDEConnectionStatus.Disconnected,
|
|
62
|
+
});
|
|
63
|
+
const command = await ideCommand();
|
|
64
|
+
expect(command).not.toBeNull();
|
|
65
|
+
expect(command.name).toBe('ide');
|
|
66
|
+
expect(command.subCommands).toHaveLength(3);
|
|
67
|
+
expect(command.subCommands?.[0].name).toBe('enable');
|
|
68
|
+
expect(command.subCommands?.[1].name).toBe('status');
|
|
69
|
+
expect(command.subCommands?.[2].name).toBe('install');
|
|
70
|
+
});
|
|
71
|
+
it('should show disable command when connected', async () => {
|
|
72
|
+
vi.mocked(mockIdeClient.getCurrentIde).mockReturnValue(IDE_DEFINITIONS.vscode);
|
|
73
|
+
vi.mocked(mockIdeClient.getConnectionStatus).mockReturnValue({
|
|
74
|
+
status: core.IDEConnectionStatus.Connected,
|
|
75
|
+
});
|
|
76
|
+
const command = await ideCommand();
|
|
77
|
+
expect(command).not.toBeNull();
|
|
78
|
+
const subCommandNames = command.subCommands?.map((cmd) => cmd.name);
|
|
79
|
+
expect(subCommandNames).toContain('disable');
|
|
80
|
+
expect(subCommandNames).not.toContain('enable');
|
|
81
|
+
});
|
|
82
|
+
describe('status subcommand', () => {
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
vi.mocked(mockIdeClient.getCurrentIde).mockReturnValue(IDE_DEFINITIONS.vscode);
|
|
85
|
+
});
|
|
86
|
+
it('should show connected status', async () => {
|
|
87
|
+
vi.mocked(mockIdeClient.getConnectionStatus).mockReturnValue({
|
|
88
|
+
status: core.IDEConnectionStatus.Connected,
|
|
89
|
+
});
|
|
90
|
+
const command = await ideCommand();
|
|
91
|
+
const result = await command.subCommands.find((c) => c.name === 'status').action(mockContext, '');
|
|
92
|
+
expect(vi.mocked(mockIdeClient.getConnectionStatus)).toHaveBeenCalled();
|
|
93
|
+
expect(result).toEqual({
|
|
94
|
+
type: 'message',
|
|
95
|
+
messageType: 'info',
|
|
96
|
+
content: '🟢 Connected to VS Code',
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
it('should show connecting status', async () => {
|
|
100
|
+
vi.mocked(mockIdeClient.getConnectionStatus).mockReturnValue({
|
|
101
|
+
status: core.IDEConnectionStatus.Connecting,
|
|
102
|
+
});
|
|
103
|
+
const command = await ideCommand();
|
|
104
|
+
const result = await command.subCommands.find((c) => c.name === 'status').action(mockContext, '');
|
|
105
|
+
expect(vi.mocked(mockIdeClient.getConnectionStatus)).toHaveBeenCalled();
|
|
106
|
+
expect(result).toEqual({
|
|
107
|
+
type: 'message',
|
|
108
|
+
messageType: 'info',
|
|
109
|
+
content: `🟡 Connecting...`,
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
it('should show disconnected status', async () => {
|
|
113
|
+
vi.mocked(mockIdeClient.getConnectionStatus).mockReturnValue({
|
|
114
|
+
status: core.IDEConnectionStatus.Disconnected,
|
|
115
|
+
});
|
|
116
|
+
const command = await ideCommand();
|
|
117
|
+
const result = await command.subCommands.find((c) => c.name === 'status').action(mockContext, '');
|
|
118
|
+
expect(vi.mocked(mockIdeClient.getConnectionStatus)).toHaveBeenCalled();
|
|
119
|
+
expect(result).toEqual({
|
|
120
|
+
type: 'message',
|
|
121
|
+
messageType: 'error',
|
|
122
|
+
content: `🔴 Disconnected`,
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
it('should show disconnected status with details', async () => {
|
|
126
|
+
const details = 'Something went wrong';
|
|
127
|
+
vi.mocked(mockIdeClient.getConnectionStatus).mockReturnValue({
|
|
128
|
+
status: core.IDEConnectionStatus.Disconnected,
|
|
129
|
+
details,
|
|
130
|
+
});
|
|
131
|
+
const command = await ideCommand();
|
|
132
|
+
const result = await command.subCommands.find((c) => c.name === 'status').action(mockContext, '');
|
|
133
|
+
expect(vi.mocked(mockIdeClient.getConnectionStatus)).toHaveBeenCalled();
|
|
134
|
+
expect(result).toEqual({
|
|
135
|
+
type: 'message',
|
|
136
|
+
messageType: 'error',
|
|
137
|
+
content: `🔴 Disconnected: ${details}`,
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
describe('install subcommand', () => {
|
|
142
|
+
const mockInstall = vi.fn();
|
|
143
|
+
beforeEach(() => {
|
|
144
|
+
vi.mocked(mockIdeClient.getCurrentIde).mockReturnValue(IDE_DEFINITIONS.vscode);
|
|
145
|
+
vi.mocked(mockIdeClient.getConnectionStatus).mockReturnValue({
|
|
146
|
+
status: core.IDEConnectionStatus.Disconnected,
|
|
147
|
+
});
|
|
148
|
+
vi.mocked(core.getIdeInstaller).mockReturnValue({
|
|
149
|
+
install: mockInstall,
|
|
150
|
+
});
|
|
151
|
+
platformSpy.mockReturnValue('linux');
|
|
152
|
+
});
|
|
153
|
+
it('should install the extension', async () => {
|
|
154
|
+
vi.useFakeTimers();
|
|
155
|
+
mockInstall.mockResolvedValue({
|
|
156
|
+
success: true,
|
|
157
|
+
message: 'Successfully installed.',
|
|
158
|
+
});
|
|
159
|
+
const command = await ideCommand();
|
|
160
|
+
// For the polling loop inside the action.
|
|
161
|
+
vi.mocked(mockIdeClient.getConnectionStatus).mockReturnValue({
|
|
162
|
+
status: core.IDEConnectionStatus.Connected,
|
|
163
|
+
});
|
|
164
|
+
const actionPromise = command.subCommands.find((c) => c.name === 'install').action(mockContext, '');
|
|
165
|
+
await vi.runAllTimersAsync();
|
|
166
|
+
await actionPromise;
|
|
167
|
+
expect(core.getIdeInstaller).toHaveBeenCalledWith(IDE_DEFINITIONS.vscode);
|
|
168
|
+
expect(mockInstall).toHaveBeenCalled();
|
|
169
|
+
expect(mockContext.ui.addItem).toHaveBeenCalledWith(expect.objectContaining({
|
|
170
|
+
type: 'info',
|
|
171
|
+
text: `Installing IDE companion...`,
|
|
172
|
+
}), expect.any(Number));
|
|
173
|
+
expect(mockContext.ui.addItem).toHaveBeenCalledWith(expect.objectContaining({
|
|
174
|
+
type: 'info',
|
|
175
|
+
text: 'Successfully installed.',
|
|
176
|
+
}), expect.any(Number));
|
|
177
|
+
expect(mockContext.ui.addItem).toHaveBeenCalledWith(expect.objectContaining({
|
|
178
|
+
type: 'info',
|
|
179
|
+
text: '🟢 Connected to VS Code',
|
|
180
|
+
}), expect.any(Number));
|
|
181
|
+
vi.useRealTimers();
|
|
182
|
+
}, 10000);
|
|
183
|
+
it('should show an error if installation fails', async () => {
|
|
184
|
+
mockInstall.mockResolvedValue({
|
|
185
|
+
success: false,
|
|
186
|
+
message: 'Installation failed.',
|
|
187
|
+
});
|
|
188
|
+
const command = await ideCommand();
|
|
189
|
+
await command.subCommands.find((c) => c.name === 'install').action(mockContext, '');
|
|
190
|
+
expect(core.getIdeInstaller).toHaveBeenCalledWith(IDE_DEFINITIONS.vscode);
|
|
191
|
+
expect(mockInstall).toHaveBeenCalled();
|
|
192
|
+
expect(mockContext.ui.addItem).toHaveBeenCalledWith(expect.objectContaining({
|
|
193
|
+
type: 'info',
|
|
194
|
+
text: `Installing IDE companion...`,
|
|
195
|
+
}), expect.any(Number));
|
|
196
|
+
expect(mockContext.ui.addItem).toHaveBeenCalledWith(expect.objectContaining({
|
|
197
|
+
type: 'error',
|
|
198
|
+
text: 'Installation failed.',
|
|
199
|
+
}), expect.any(Number));
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
//# sourceMappingURL=ideCommand.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ideCommand.test.js","sourceRoot":"","sources":["../../../../src/ui/commands/ideCommand.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAuB,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,IAAI,MAAM,yBAAyB,CAAC;AAEhD,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;IAC1D,MAAM,QAAQ,GAAG,MAAM,cAAc,EAAe,CAAC;IACrD,OAAO;QACL,GAAG,QAAQ;QACX,cAAc,EAAE,EAAE,CA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ACX,EAAE,CACH,CAAC;YAEF,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,oBAAoB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC1E,MAAM,CAAC,WAAW,CAAC,CAAC,gBAAgB,EAAE,CAAC;YACvC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,oBAAoB,CACjD,MAAM,CAAC,gBAAgB,CAAC;gBACtB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,6BAA6B;aACpC,CAAC,EACF,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CACnB,CAAC;YACF,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,oBAAoB,CACjD,MAAM,CAAC,gBAAgB,CAAC;gBACtB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,sBAAsB;aAC7B,CAAC,EACF,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CACnB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -8,7 +8,7 @@ import * as path from 'node:path';
|
|
|
8
8
|
import { CommandKind } from './types.js';
|
|
9
9
|
export const initCommand = {
|
|
10
10
|
name: 'init',
|
|
11
|
-
description: 'Analyzes the project and creates a tailored GEMINI.md file
|
|
11
|
+
description: 'Analyzes the project and creates a tailored GEMINI.md file',
|
|
12
12
|
kind: CommandKind.BUILT_IN,
|
|
13
13
|
action: async (context, _args) => {
|
|
14
14
|
if (!context.services.config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initCommand.js","sourceRoot":"","sources":["../../../../src/ui/commands/initCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAMlC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE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QAEF,OAAO;YACL,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCd;SACI,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
7
|
+
import * as fs from 'node:fs';
|
|
8
|
+
import * as path from 'node:path';
|
|
9
|
+
import { initCommand } from './initCommand.js';
|
|
10
|
+
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
|
|
11
|
+
// Mock the 'fs' module
|
|
12
|
+
vi.mock('fs', () => ({
|
|
13
|
+
existsSync: vi.fn(),
|
|
14
|
+
writeFileSync: vi.fn(),
|
|
15
|
+
}));
|
|
16
|
+
describe('initCommand', () => {
|
|
17
|
+
let mockContext;
|
|
18
|
+
const targetDir = '/test/dir';
|
|
19
|
+
const geminiMdPath = path.join(targetDir, 'GEMINI.md');
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
// Create a fresh mock context for each test
|
|
22
|
+
mockContext = createMockCommandContext({
|
|
23
|
+
services: {
|
|
24
|
+
config: {
|
|
25
|
+
getTargetDir: () => targetDir,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
// Clear all mocks after each test
|
|
32
|
+
vi.clearAllMocks();
|
|
33
|
+
});
|
|
34
|
+
it('should inform the user if GEMINI.md already exists', async () => {
|
|
35
|
+
// Arrange: Simulate that the file exists
|
|
36
|
+
vi.mocked(fs.existsSync).mockReturnValue(true);
|
|
37
|
+
// Act: Run the command's action
|
|
38
|
+
const result = await initCommand.action(mockContext, '');
|
|
39
|
+
// Assert: Check for the correct informational message
|
|
40
|
+
expect(result).toEqual({
|
|
41
|
+
type: 'message',
|
|
42
|
+
messageType: 'info',
|
|
43
|
+
content: 'A GEMINI.md file already exists in this directory. No changes were made.',
|
|
44
|
+
});
|
|
45
|
+
// Assert: Ensure no file was written
|
|
46
|
+
expect(fs.writeFileSync).not.toHaveBeenCalled();
|
|
47
|
+
});
|
|
48
|
+
it('should create GEMINI.md and submit a prompt if it does not exist', async () => {
|
|
49
|
+
// Arrange: Simulate that the file does not exist
|
|
50
|
+
vi.mocked(fs.existsSync).mockReturnValue(false);
|
|
51
|
+
// Act: Run the command's action
|
|
52
|
+
const result = (await initCommand.action(mockContext, ''));
|
|
53
|
+
// Assert: Check that writeFileSync was called correctly
|
|
54
|
+
expect(fs.writeFileSync).toHaveBeenCalledWith(geminiMdPath, '', 'utf8');
|
|
55
|
+
// Assert: Check that an informational message was added to the UI
|
|
56
|
+
expect(mockContext.ui.addItem).toHaveBeenCalledWith({
|
|
57
|
+
type: 'info',
|
|
58
|
+
text: 'Empty GEMINI.md created. Now analyzing the project to populate it.',
|
|
59
|
+
}, expect.any(Number));
|
|
60
|
+
// Assert: Check that the correct prompt is submitted
|
|
61
|
+
expect(result.type).toBe('submit_prompt');
|
|
62
|
+
expect(result.content).toContain('You are an AI agent that brings the power of Gemini');
|
|
63
|
+
});
|
|
64
|
+
it('should return an error if config is not available', async () => {
|
|
65
|
+
// Arrange: Create a context without config
|
|
66
|
+
const noConfigContext = createMockCommandContext();
|
|
67
|
+
if (noConfigContext.services) {
|
|
68
|
+
noConfigContext.services.config = null;
|
|
69
|
+
}
|
|
70
|
+
// Act: Run the command's action
|
|
71
|
+
const result = await initCommand.action(noConfigContext, '');
|
|
72
|
+
// Assert: Check for the correct error message
|
|
73
|
+
expect(result).toEqual({
|
|
74
|
+
type: 'message',
|
|
75
|
+
messageType: 'error',
|
|
76
|
+
content: 'Configuration not available.',
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=initCommand.test.js.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EAAE,KAAK,IAAI,EAAE;QACjE,2CAA2C;QAC3C,MAAM,eAAe,GAAG,wBAAwB,EAAE,CAAC;QACnD,IAAI,eAAe,CAAC,QAAQ,EAAE,CAAC;YAC7B,eAAe,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;QACzC,CAAC;QAED,gCAAgC;QAChC,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,MAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QAE9D,8CAA8C;QAC9C,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,OAAO;YACpB,OAAO,EAAE,8BAA8B;SACxC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -113,98 +113,105 @@ const authCommand = {
|
|
|
113
113
|
return Object.keys(mcpServers).filter((name) => name.startsWith(partialArg));
|
|
114
114
|
},
|
|
115
115
|
};
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
.filter((prompt) => 'serverName' in prompt &&
|
|
157
|
-
serverNames.includes(prompt.serverName));
|
|
158
|
-
const authStatus = {};
|
|
159
|
-
const tokenStorage = new MCPOAuthTokenStorage();
|
|
160
|
-
for (const serverName of serverNames) {
|
|
161
|
-
const server = mcpServers[serverName];
|
|
162
|
-
if (server.oauth?.enabled) {
|
|
163
|
-
const creds = await tokenStorage.getCredentials(serverName);
|
|
164
|
-
if (creds) {
|
|
165
|
-
if (creds.token.expiresAt && creds.token.expiresAt < Date.now()) {
|
|
166
|
-
authStatus[serverName] = 'expired';
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
authStatus[serverName] = 'authenticated';
|
|
170
|
-
}
|
|
116
|
+
const listAction = async (context, showDescriptions = false, showSchema = false) => {
|
|
117
|
+
const { config } = context.services;
|
|
118
|
+
if (!config) {
|
|
119
|
+
return {
|
|
120
|
+
type: 'message',
|
|
121
|
+
messageType: 'error',
|
|
122
|
+
content: 'Config not loaded.',
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const toolRegistry = config.getToolRegistry();
|
|
126
|
+
if (!toolRegistry) {
|
|
127
|
+
return {
|
|
128
|
+
type: 'message',
|
|
129
|
+
messageType: 'error',
|
|
130
|
+
content: 'Could not retrieve tool registry.',
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const mcpServers = config.getMcpServers() || {};
|
|
134
|
+
const serverNames = Object.keys(mcpServers);
|
|
135
|
+
const blockedMcpServers = config.getBlockedMcpServers() || [];
|
|
136
|
+
const connectingServers = serverNames.filter((name) => getMCPServerStatus(name) === MCPServerStatus.CONNECTING);
|
|
137
|
+
const discoveryState = getMCPDiscoveryState();
|
|
138
|
+
const discoveryInProgress = discoveryState === MCPDiscoveryState.IN_PROGRESS ||
|
|
139
|
+
connectingServers.length > 0;
|
|
140
|
+
const allTools = toolRegistry.getAllTools();
|
|
141
|
+
const mcpTools = allTools.filter((tool) => tool instanceof DiscoveredMCPTool);
|
|
142
|
+
const promptRegistry = await config.getPromptRegistry();
|
|
143
|
+
const mcpPrompts = promptRegistry
|
|
144
|
+
.getAllPrompts()
|
|
145
|
+
.filter((prompt) => 'serverName' in prompt &&
|
|
146
|
+
serverNames.includes(prompt.serverName));
|
|
147
|
+
const authStatus = {};
|
|
148
|
+
const tokenStorage = new MCPOAuthTokenStorage();
|
|
149
|
+
for (const serverName of serverNames) {
|
|
150
|
+
const server = mcpServers[serverName];
|
|
151
|
+
if (server.oauth?.enabled) {
|
|
152
|
+
const creds = await tokenStorage.getCredentials(serverName);
|
|
153
|
+
if (creds) {
|
|
154
|
+
if (creds.token.expiresAt && creds.token.expiresAt < Date.now()) {
|
|
155
|
+
authStatus[serverName] = 'expired';
|
|
171
156
|
}
|
|
172
157
|
else {
|
|
173
|
-
authStatus[serverName] = '
|
|
158
|
+
authStatus[serverName] = 'authenticated';
|
|
174
159
|
}
|
|
175
160
|
}
|
|
176
161
|
else {
|
|
177
|
-
authStatus[serverName] = '
|
|
162
|
+
authStatus[serverName] = 'unauthenticated';
|
|
178
163
|
}
|
|
179
164
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
165
|
+
else {
|
|
166
|
+
authStatus[serverName] = 'not-configured';
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const mcpStatusItem = {
|
|
170
|
+
type: MessageType.MCP_STATUS,
|
|
171
|
+
servers: mcpServers,
|
|
172
|
+
tools: mcpTools.map((tool) => ({
|
|
173
|
+
serverName: tool.serverName,
|
|
174
|
+
name: tool.name,
|
|
175
|
+
description: tool.description,
|
|
176
|
+
schema: tool.schema,
|
|
177
|
+
})),
|
|
178
|
+
prompts: mcpPrompts.map((prompt) => ({
|
|
179
|
+
serverName: prompt.serverName,
|
|
180
|
+
name: prompt.name,
|
|
181
|
+
description: prompt.description,
|
|
182
|
+
})),
|
|
183
|
+
authStatus,
|
|
184
|
+
blockedServers: blockedMcpServers,
|
|
185
|
+
discoveryInProgress,
|
|
186
|
+
connectingServers,
|
|
187
|
+
showDescriptions,
|
|
188
|
+
showSchema,
|
|
189
|
+
};
|
|
190
|
+
context.ui.addItem(mcpStatusItem, Date.now());
|
|
191
|
+
};
|
|
192
|
+
const listCommand = {
|
|
193
|
+
name: 'list',
|
|
194
|
+
altNames: ['ls', 'nodesc', 'nodescription'],
|
|
195
|
+
description: 'List configured MCP servers and tools',
|
|
196
|
+
kind: CommandKind.BUILT_IN,
|
|
197
|
+
action: (context) => listAction(context),
|
|
198
|
+
};
|
|
199
|
+
const descCommand = {
|
|
200
|
+
name: 'desc',
|
|
201
|
+
altNames: ['description'],
|
|
202
|
+
description: 'List configured MCP servers and tools with descriptions',
|
|
203
|
+
kind: CommandKind.BUILT_IN,
|
|
204
|
+
action: (context) => listAction(context, true),
|
|
205
|
+
};
|
|
206
|
+
const schemaCommand = {
|
|
207
|
+
name: 'schema',
|
|
208
|
+
description: 'List configured MCP servers and tools with descriptions and schemas',
|
|
209
|
+
kind: CommandKind.BUILT_IN,
|
|
210
|
+
action: (context) => listAction(context, true, true),
|
|
204
211
|
};
|
|
205
212
|
const refreshCommand = {
|
|
206
213
|
name: 'refresh',
|
|
207
|
-
description: 'Restarts MCP servers
|
|
214
|
+
description: 'Restarts MCP servers',
|
|
208
215
|
kind: CommandKind.BUILT_IN,
|
|
209
216
|
action: async (context) => {
|
|
210
217
|
const { config } = context.services;
|
|
@@ -240,12 +247,15 @@ const refreshCommand = {
|
|
|
240
247
|
};
|
|
241
248
|
export const mcpCommand = {
|
|
242
249
|
name: 'mcp',
|
|
243
|
-
description: '
|
|
250
|
+
description: 'Manage configured Model Context Protocol (MCP) servers',
|
|
244
251
|
kind: CommandKind.BUILT_IN,
|
|
245
|
-
subCommands: [
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
252
|
+
subCommands: [
|
|
253
|
+
listCommand,
|
|
254
|
+
descCommand,
|
|
255
|
+
schemaCommand,
|
|
256
|
+
authCommand,
|
|
257
|
+
refreshCommand,
|
|
258
|
+
],
|
|
259
|
+
action: async (context) => listAction(context),
|
|
250
260
|
};
|
|
251
261
|
//# sourceMappingURL=mcpCommand.js.map
|