@machina.ai/cell-cli 1.11.0-rc1 → 1.13.0-rc2
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/dist/package.json +16 -10
- package/dist/src/commands/extensions/disable.d.ts +1 -1
- package/dist/src/commands/extensions/disable.js +15 -7
- package/dist/src/commands/extensions/disable.js.map +1 -1
- package/dist/src/commands/extensions/enable.d.ts +1 -1
- package/dist/src/commands/extensions/enable.js +15 -7
- package/dist/src/commands/extensions/enable.js.map +1 -1
- package/dist/src/commands/extensions/install.js +14 -3
- package/dist/src/commands/extensions/install.js.map +1 -1
- package/dist/src/commands/extensions/install.test.js +39 -19
- package/dist/src/commands/extensions/install.test.js.map +1 -1
- package/dist/src/commands/extensions/link.js +14 -3
- package/dist/src/commands/extensions/link.js.map +1 -1
- package/dist/src/commands/extensions/list.js +13 -4
- package/dist/src/commands/extensions/list.js.map +1 -1
- package/dist/src/commands/extensions/uninstall.js +13 -2
- package/dist/src/commands/extensions/uninstall.js.map +1 -1
- package/dist/src/commands/extensions/update.js +18 -13
- package/dist/src/commands/extensions/update.js.map +1 -1
- package/dist/src/commands/extensions/validate.d.ts +12 -0
- package/dist/src/commands/extensions/validate.js +83 -0
- package/dist/src/commands/extensions/validate.js.map +1 -0
- package/dist/src/commands/extensions/validate.test.js +93 -0
- package/dist/src/commands/extensions/validate.test.js.map +1 -0
- package/dist/src/commands/extensions.js +3 -0
- package/dist/src/commands/extensions.js.map +1 -1
- package/dist/src/commands/mcp/add.test.js +3 -0
- package/dist/src/commands/mcp/add.test.js.map +1 -1
- package/dist/src/commands/mcp/list.js +10 -3
- package/dist/src/commands/mcp/list.js.map +1 -1
- package/dist/src/commands/mcp/list.test.js +37 -27
- package/dist/src/commands/mcp/list.test.js.map +1 -1
- package/dist/src/config/auth.js +0 -5
- package/dist/src/config/auth.js.map +1 -1
- package/dist/src/config/config.d.ts +6 -3
- package/dist/src/config/config.js +65 -80
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +235 -212
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/extension-manager.d.ts +63 -0
- package/dist/src/config/extension-manager.js +450 -0
- package/dist/src/config/extension-manager.js.map +1 -0
- package/dist/src/config/extension.d.ts +4 -51
- package/dist/src/config/extension.js +1 -535
- package/dist/src/config/extension.js.map +1 -1
- package/dist/src/config/extension.test.js +525 -201
- package/dist/src/config/extension.test.js.map +1 -1
- package/dist/src/config/extensions/consent.d.ts +38 -0
- package/dist/src/config/extensions/consent.js +123 -0
- package/dist/src/config/extensions/consent.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 +10 -10
- package/dist/src/config/extensions/extensionEnablement.test.js.map +1 -1
- package/dist/src/config/extensions/extensionSettings.d.ts +15 -0
- package/dist/src/config/extensions/extensionSettings.js +113 -0
- package/dist/src/config/extensions/extensionSettings.js.map +1 -0
- package/dist/src/config/extensions/extensionSettings.test.d.ts +6 -0
- package/dist/src/config/extensions/extensionSettings.test.js +254 -0
- package/dist/src/config/extensions/extensionSettings.test.js.map +1 -0
- package/dist/src/config/extensions/github.d.ts +2 -2
- package/dist/src/config/extensions/github.js +5 -10
- package/dist/src/config/extensions/github.js.map +1 -1
- package/dist/src/config/extensions/github.test.js +153 -167
- package/dist/src/config/extensions/github.test.js.map +1 -1
- package/dist/src/config/extensions/github_fetch.d.ts +1 -1
- package/dist/src/config/extensions/github_fetch.js +13 -1
- package/dist/src/config/extensions/github_fetch.js.map +1 -1
- package/dist/src/config/extensions/github_fetch.test.d.ts +6 -0
- package/dist/src/config/extensions/github_fetch.test.js +169 -0
- package/dist/src/config/extensions/github_fetch.test.js.map +1 -0
- package/dist/src/config/extensions/storage.d.ts +14 -0
- package/dist/src/config/extensions/storage.js +32 -0
- package/dist/src/config/extensions/storage.js.map +1 -0
- package/dist/src/config/extensions/update.d.ts +4 -4
- package/dist/src/config/extensions/update.js +39 -39
- package/dist/src/config/extensions/update.js.map +1 -1
- package/dist/src/config/extensions/update.test.js +72 -74
- package/dist/src/config/extensions/update.test.js.map +1 -1
- package/dist/src/config/extensions/variableSchema.d.ts +0 -6
- package/dist/src/config/extensions/variableSchema.js.map +1 -1
- package/dist/src/config/extensions/variables.d.ts +4 -0
- package/dist/src/config/extensions/variables.js +6 -0
- package/dist/src/config/extensions/variables.js.map +1 -1
- package/dist/src/config/keyBindings.d.ts +3 -0
- package/dist/src/config/keyBindings.js +30 -8
- package/dist/src/config/keyBindings.js.map +1 -1
- package/dist/src/config/keyBindings.test.js +17 -0
- package/dist/src/config/keyBindings.test.js.map +1 -1
- package/dist/src/config/policies/read-only.toml +56 -0
- package/dist/src/config/policies/write.toml +63 -0
- package/dist/src/config/policies/yolo.toml +31 -0
- package/dist/src/config/policy-engine.integration.test.js +41 -38
- package/dist/src/config/policy-engine.integration.test.js.map +1 -1
- package/dist/src/config/policy.d.ts +2 -2
- package/dist/src/config/policy.js +10 -148
- package/dist/src/config/policy.js.map +1 -1
- package/dist/src/config/sandboxConfig.d.ts +1 -1
- package/dist/src/config/sandboxConfig.js +6 -3
- package/dist/src/config/sandboxConfig.js.map +1 -1
- package/dist/src/config/settings.d.ts +2 -1
- package/dist/src/config/settings.js +58 -18
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/config/settings.test.js +128 -69
- package/dist/src/config/settings.test.js.map +1 -1
- package/dist/src/config/settingsSchema.d.ts +170 -28
- package/dist/src/config/settingsSchema.js +418 -27
- package/dist/src/config/settingsSchema.js.map +1 -1
- package/dist/src/config/settingsSchema.test.js +42 -1
- package/dist/src/config/settingsSchema.test.js.map +1 -1
- package/dist/src/config/trustedFolders.d.ts +1 -1
- package/dist/src/config/trustedFolders.js +4 -2
- package/dist/src/config/trustedFolders.js.map +1 -1
- package/dist/src/core/initializer.js +2 -1
- package/dist/src/core/initializer.js.map +1 -1
- package/dist/src/gemini.d.ts +1 -1
- package/dist/src/gemini.js +46 -16
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.test.js +88 -30
- 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/nonInteractiveCli.d.ts +9 -1
- package/dist/src/nonInteractiveCli.js +114 -7
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/nonInteractiveCli.test.js +355 -112
- package/dist/src/nonInteractiveCli.test.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.js +4 -0
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.test.js +22 -0
- package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -1
- package/dist/src/services/FeedbackService.js +2 -2
- package/dist/src/services/FeedbackService.js.map +1 -1
- package/dist/src/services/McpPromptLoader.js +2 -2
- package/dist/src/services/McpPromptLoader.js.map +1 -1
- package/dist/src/services/McpPromptLoader.test.js +4 -2
- package/dist/src/services/McpPromptLoader.test.js.map +1 -1
- package/dist/src/test-utils/async.d.ts +9 -0
- package/dist/src/test-utils/async.js +29 -0
- package/dist/src/test-utils/async.js.map +1 -0
- package/dist/src/test-utils/createExtension.d.ts +3 -1
- package/dist/src/test-utils/createExtension.js +3 -3
- package/dist/src/test-utils/createExtension.js.map +1 -1
- package/dist/src/test-utils/render.d.ts +16 -2
- package/dist/src/test-utils/render.js +66 -4
- package/dist/src/test-utils/render.js.map +1 -1
- package/dist/src/test-utils/render.test.d.ts +6 -0
- package/dist/src/test-utils/render.test.js +79 -0
- package/dist/src/test-utils/render.test.js.map +1 -0
- package/dist/src/ui/App.test.js +1 -1
- package/dist/src/ui/App.test.js.map +1 -1
- package/dist/src/ui/AppContainer.js +181 -65
- package/dist/src/ui/AppContainer.js.map +1 -1
- package/dist/src/ui/AppContainer.test.js +505 -147
- package/dist/src/ui/AppContainer.test.js.map +1 -1
- package/dist/src/ui/IdeIntegrationNudge.js +1 -1
- package/dist/src/ui/IdeIntegrationNudge.js.map +1 -1
- package/dist/src/ui/auth/ApiAuthDialog.d.ts +14 -0
- package/dist/src/ui/auth/ApiAuthDialog.js +26 -0
- package/dist/src/ui/auth/ApiAuthDialog.js.map +1 -0
- package/dist/src/ui/auth/ApiAuthDialog.test.d.ts +6 -0
- package/dist/src/ui/auth/ApiAuthDialog.test.js +91 -0
- package/dist/src/ui/auth/ApiAuthDialog.test.js.map +1 -0
- package/dist/src/ui/auth/AuthDialog.js +7 -3
- package/dist/src/ui/auth/AuthDialog.js.map +1 -1
- package/dist/src/ui/auth/useAuth.d.ts +2 -0
- package/dist/src/ui/auth/useAuth.js +31 -2
- package/dist/src/ui/auth/useAuth.js.map +1 -1
- package/dist/src/ui/colors.js +3 -0
- package/dist/src/ui/colors.js.map +1 -1
- package/dist/src/ui/commands/directoryCommand.js +1 -1
- package/dist/src/ui/commands/directoryCommand.js.map +1 -1
- package/dist/src/ui/commands/extensionsCommand.js +64 -11
- package/dist/src/ui/commands/extensionsCommand.js.map +1 -1
- package/dist/src/ui/commands/extensionsCommand.test.js +72 -1
- package/dist/src/ui/commands/extensionsCommand.test.js.map +1 -1
- package/dist/src/ui/commands/mcpCommand.js +14 -14
- package/dist/src/ui/commands/mcpCommand.js.map +1 -1
- package/dist/src/ui/commands/mcpCommand.test.js +4 -0
- package/dist/src/ui/commands/mcpCommand.test.js.map +1 -1
- package/dist/src/ui/commands/memoryCommand.js +1 -1
- package/dist/src/ui/commands/memoryCommand.js.map +1 -1
- package/dist/src/ui/commands/memoryCommand.test.js +3 -1
- package/dist/src/ui/commands/memoryCommand.test.js.map +1 -1
- package/dist/src/ui/commands/policiesCommand.d.ts +7 -0
- package/dist/src/ui/commands/policiesCommand.js +59 -0
- package/dist/src/ui/commands/policiesCommand.js.map +1 -0
- package/dist/src/ui/commands/policiesCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/policiesCommand.test.js +83 -0
- package/dist/src/ui/commands/policiesCommand.test.js.map +1 -0
- package/dist/src/ui/components/AnsiOutput.test.js +1 -1
- package/dist/src/ui/components/AnsiOutput.test.js.map +1 -1
- package/dist/src/ui/components/AsciiArt.d.ts +3 -3
- package/dist/src/ui/components/AsciiArt.js +3 -3
- package/dist/src/ui/components/Composer.js +1 -1
- package/dist/src/ui/components/Composer.js.map +1 -1
- package/dist/src/ui/components/Composer.test.js +5 -2
- package/dist/src/ui/components/Composer.test.js.map +1 -1
- package/dist/src/ui/components/ConfigInitDisplay.js +4 -6
- package/dist/src/ui/components/ConfigInitDisplay.js.map +1 -1
- package/dist/src/ui/components/ConsentPrompt.test.js +18 -8
- package/dist/src/ui/components/ConsentPrompt.test.js.map +1 -1
- package/dist/src/ui/components/ConsoleSummaryDisplay.js +1 -1
- package/dist/src/ui/components/ConsoleSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/ContextSummaryDisplay.test.js +11 -6
- package/dist/src/ui/components/ContextSummaryDisplay.test.js.map +1 -1
- package/dist/src/ui/components/DetailedMessagesDisplay.js +1 -1
- package/dist/src/ui/components/DetailedMessagesDisplay.js.map +1 -1
- package/dist/src/ui/components/DialogManager.js +4 -0
- package/dist/src/ui/components/DialogManager.js.map +1 -1
- package/dist/src/ui/components/FolderTrustDialog.test.js +2 -1
- package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/Footer.js +4 -3
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/Footer.test.js +83 -0
- package/dist/src/ui/components/Footer.test.js.map +1 -1
- package/dist/src/ui/components/Header.test.js +13 -5
- package/dist/src/ui/components/Header.test.js.map +1 -1
- package/dist/src/ui/components/Help.test.js +5 -4
- package/dist/src/ui/components/Help.test.js.map +1 -1
- package/dist/src/ui/components/HistoryItemDisplay.js +1 -1
- package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.js +27 -8
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.test.js +776 -727
- package/dist/src/ui/components/InputPrompt.test.js.map +1 -1
- package/dist/src/ui/components/LoadingIndicator.js +2 -2
- package/dist/src/ui/components/LoadingIndicator.js.map +1 -1
- package/dist/src/ui/components/LoadingIndicator.test.js +28 -15
- package/dist/src/ui/components/LoadingIndicator.test.js.map +1 -1
- package/dist/src/ui/components/LoopDetectionConfirmation.js +1 -1
- package/dist/src/ui/components/LoopDetectionConfirmation.js.map +1 -1
- package/dist/src/ui/components/LoopDetectionConfirmation.test.js +2 -2
- package/dist/src/ui/components/LoopDetectionConfirmation.test.js.map +1 -1
- package/dist/src/ui/components/MainContent.js +15 -4
- package/dist/src/ui/components/MainContent.js.map +1 -1
- package/dist/src/ui/components/ModelDialog.js +1 -1
- package/dist/src/ui/components/ModelDialog.js.map +1 -1
- package/dist/src/ui/components/ModelDialog.test.js +23 -13
- package/dist/src/ui/components/ModelDialog.test.js.map +1 -1
- package/dist/src/ui/components/ModelStatsDisplay.test.js +1 -1
- package/dist/src/ui/components/ModelStatsDisplay.test.js.map +1 -1
- package/dist/src/ui/components/Notifications.js +38 -5
- package/dist/src/ui/components/Notifications.js.map +1 -1
- package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js +2 -2
- package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/PrepareLabel.test.js +14 -8
- package/dist/src/ui/components/PrepareLabel.test.js.map +1 -1
- package/dist/src/ui/components/ProQuotaDialog.test.js +14 -6
- package/dist/src/ui/components/ProQuotaDialog.test.js.map +1 -1
- package/dist/src/ui/components/QueuedMessageDisplay.test.js +11 -6
- package/dist/src/ui/components/QueuedMessageDisplay.test.js.map +1 -1
- package/dist/src/ui/components/SessionSummaryDisplay.test.js +1 -1
- package/dist/src/ui/components/SessionSummaryDisplay.test.js.map +1 -1
- package/dist/src/ui/components/SettingsDialog.js +32 -25
- package/dist/src/ui/components/SettingsDialog.js.map +1 -1
- package/dist/src/ui/components/SettingsDialog.test.js +428 -532
- package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
- package/dist/src/ui/components/ShellConfirmationDialog.js +1 -1
- package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -1
- package/dist/src/ui/components/ShellConfirmationDialog.test.js +2 -2
- package/dist/src/ui/components/ShellConfirmationDialog.test.js.map +1 -1
- package/dist/src/ui/components/StatsDisplay.test.js +1 -1
- package/dist/src/ui/components/StatsDisplay.test.js.map +1 -1
- package/dist/src/ui/components/SuggestionsDisplay.js +1 -1
- package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
- package/dist/src/ui/components/ThemeDialog.test.js +2 -2
- package/dist/src/ui/components/ThemeDialog.test.js.map +1 -1
- package/dist/src/ui/components/ToolStatsDisplay.test.js +1 -1
- package/dist/src/ui/components/ToolStatsDisplay.test.js.map +1 -1
- package/dist/src/ui/components/messages/CompressionMessage.test.js +25 -17
- package/dist/src/ui/components/messages/CompressionMessage.test.js.map +1 -1
- package/dist/src/ui/components/messages/DiffRenderer.test.js +1 -1
- package/dist/src/ui/components/messages/DiffRenderer.test.js.map +1 -1
- package/dist/src/ui/components/messages/InfoMessage.js +1 -1
- package/dist/src/ui/components/messages/InfoMessage.js.map +1 -1
- package/dist/src/ui/components/messages/Todo.js +27 -5
- package/dist/src/ui/components/messages/Todo.js.map +1 -1
- package/dist/src/ui/components/messages/Todo.test.js +20 -8
- package/dist/src/ui/components/messages/Todo.test.js.map +1 -1
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js +1 -1
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js +29 -15
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -1
- package/dist/src/ui/components/messages/WarningMessage.js +2 -2
- package/dist/src/ui/components/messages/WarningMessage.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/MaxSizedBox.test.js +43 -22
- package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +1 -1
- package/dist/src/ui/components/shared/TextInput.d.ts +15 -0
- package/dist/src/ui/components/shared/TextInput.js +38 -0
- package/dist/src/ui/components/shared/TextInput.js.map +1 -0
- package/dist/src/ui/components/shared/TextInput.test.d.ts +6 -0
- package/dist/src/ui/components/shared/TextInput.test.js +242 -0
- package/dist/src/ui/components/shared/TextInput.test.js.map +1 -0
- package/dist/src/ui/components/shared/text-buffer.d.ts +9 -2
- package/dist/src/ui/components/shared/text-buffer.js +51 -13
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.test.js +385 -202
- package/dist/src/ui/components/shared/text-buffer.test.js.map +1 -1
- package/dist/src/ui/components/views/ChatList.test.js +7 -4
- package/dist/src/ui/components/views/ChatList.test.js.map +1 -1
- package/dist/src/ui/components/views/ExtensionsList.d.ts +7 -1
- package/dist/src/ui/components/views/ExtensionsList.js +9 -11
- package/dist/src/ui/components/views/ExtensionsList.js.map +1 -1
- package/dist/src/ui/components/views/ExtensionsList.test.js +43 -22
- package/dist/src/ui/components/views/ExtensionsList.test.js.map +1 -1
- package/dist/src/ui/components/views/McpStatus.test.js +23 -12
- package/dist/src/ui/components/views/McpStatus.test.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.d.ts +3 -2
- package/dist/src/ui/contexts/KeypressContext.js +610 -540
- package/dist/src/ui/contexts/KeypressContext.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.test.js +438 -718
- package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
- package/dist/src/ui/contexts/MouseContext.d.ts +21 -0
- package/dist/src/ui/contexts/MouseContext.js +89 -0
- package/dist/src/ui/contexts/MouseContext.js.map +1 -0
- package/dist/src/ui/contexts/MouseContext.test.d.ts +6 -0
- package/dist/src/ui/contexts/MouseContext.test.js +164 -0
- package/dist/src/ui/contexts/MouseContext.test.js.map +1 -0
- package/dist/src/ui/contexts/SessionContext.test.js +35 -17
- package/dist/src/ui/contexts/SessionContext.test.js.map +1 -1
- package/dist/src/ui/contexts/UIActionsContext.d.ts +2 -0
- package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
- package/dist/src/ui/contexts/UIStateContext.d.ts +2 -0
- package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
- package/dist/src/ui/hooks/atCommandProcessor.js +31 -9
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/atCommandProcessor.test.js +163 -64
- package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/shellCommandProcessor.test.js +64 -35
- package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.test.js +193 -165
- package/dist/src/ui/hooks/slashCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/useAtCompletion.test.js +16 -5
- package/dist/src/ui/hooks/useAtCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useAutoAcceptIndicator.js +10 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -1
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +32 -1
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -1
- package/dist/src/ui/hooks/useCommandCompletion.test.js +66 -64
- package/dist/src/ui/hooks/useCommandCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useConsoleMessages.test.js +26 -9
- package/dist/src/ui/hooks/useConsoleMessages.test.js.map +1 -1
- package/dist/src/ui/hooks/useEditorSettings.test.js +40 -34
- package/dist/src/ui/hooks/useEditorSettings.test.js.map +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.d.ts +14 -5
- package/dist/src/ui/hooks/useExtensionUpdates.js +18 -13
- package/dist/src/ui/hooks/useExtensionUpdates.js.map +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.test.js +49 -44
- package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +1 -1
- package/dist/src/ui/hooks/useFlickerDetector.test.js +9 -5
- package/dist/src/ui/hooks/useFlickerDetector.test.js.map +1 -1
- package/dist/src/ui/hooks/useFocus.test.js +25 -9
- package/dist/src/ui/hooks/useFocus.test.js.map +1 -1
- package/dist/src/ui/hooks/useFolderTrust.test.js +46 -22
- package/dist/src/ui/hooks/useFolderTrust.test.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.js +56 -19
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.test.js +260 -411
- package/dist/src/ui/hooks/useGeminiStream.test.js.map +1 -1
- package/dist/src/ui/hooks/useGitBranchName.js +4 -0
- package/dist/src/ui/hooks/useGitBranchName.js.map +1 -1
- package/dist/src/ui/hooks/useGitBranchName.test.js +46 -34
- package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -1
- package/dist/src/ui/hooks/useHistoryManager.test.js +2 -1
- package/dist/src/ui/hooks/useHistoryManager.test.js.map +1 -1
- package/dist/src/ui/hooks/useIdeTrustListener.test.js +40 -9
- package/dist/src/ui/hooks/useIdeTrustListener.test.js.map +1 -1
- package/dist/src/ui/hooks/useInputHistory.test.js +2 -1
- package/dist/src/ui/hooks/useInputHistory.test.js.map +1 -1
- package/dist/src/ui/hooks/useInputHistoryStore.test.js +2 -1
- package/dist/src/ui/hooks/useInputHistoryStore.test.js.map +1 -1
- package/dist/src/ui/hooks/useKeypress.test.js +103 -114
- package/dist/src/ui/hooks/useKeypress.test.js.map +1 -1
- package/dist/src/ui/hooks/useLoadingIndicator.test.js +24 -6
- package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -1
- package/dist/src/ui/hooks/useMemoryMonitor.test.js +10 -5
- package/dist/src/ui/hooks/useMemoryMonitor.test.js.map +1 -1
- package/dist/src/ui/hooks/useMessageQueue.test.js +62 -45
- package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -1
- package/dist/src/ui/hooks/useModelCommand.test.js +21 -11
- package/dist/src/ui/hooks/useModelCommand.test.js.map +1 -1
- package/dist/src/ui/hooks/useMouse.d.ts +17 -0
- package/dist/src/ui/hooks/useMouse.js +27 -0
- package/dist/src/ui/hooks/useMouse.js.map +1 -0
- package/dist/src/ui/hooks/useMouse.test.d.ts +6 -0
- package/dist/src/ui/hooks/useMouse.test.js +57 -0
- package/dist/src/ui/hooks/useMouse.test.js.map +1 -0
- package/dist/src/ui/hooks/usePermissionsModifyTrust.test.js +2 -2
- package/dist/src/ui/hooks/usePermissionsModifyTrust.test.js.map +1 -1
- package/dist/src/ui/hooks/usePhraseCycler.js +1 -1
- package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -1
- package/dist/src/ui/hooks/usePhraseCycler.test.js +109 -106
- package/dist/src/ui/hooks/usePhraseCycler.test.js.map +1 -1
- package/dist/src/ui/hooks/usePrivacySettings.test.js +26 -6
- package/dist/src/ui/hooks/usePrivacySettings.test.js.map +1 -1
- package/dist/src/ui/hooks/usePromptCompletion.js +2 -2
- package/dist/src/ui/hooks/usePromptCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useQuotaAndFallback.js +13 -14
- package/dist/src/ui/hooks/useQuotaAndFallback.js.map +1 -1
- package/dist/src/ui/hooks/useQuotaAndFallback.test.js +55 -48
- package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +1 -1
- package/dist/src/ui/hooks/useReactToolScheduler.d.ts +8 -1
- package/dist/src/ui/hooks/useReactToolScheduler.js +59 -34
- package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
- package/dist/src/ui/hooks/useReactToolScheduler.test.d.ts +6 -0
- package/dist/src/ui/hooks/useReactToolScheduler.test.js +65 -0
- package/dist/src/ui/hooks/useReactToolScheduler.test.js.map +1 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.test.js +2 -2
- package/dist/src/ui/hooks/useReverseSearchCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useSelectionList.js +5 -4
- package/dist/src/ui/hooks/useSelectionList.js.map +1 -1
- package/dist/src/ui/hooks/useSelectionList.test.js +272 -183
- package/dist/src/ui/hooks/useSelectionList.test.js.map +1 -1
- package/dist/src/ui/hooks/useShellHistory.test.js +52 -20
- package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.js +18 -7
- package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.test.js +275 -137
- package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useTimer.test.js +43 -14
- package/dist/src/ui/hooks/useTimer.test.js.map +1 -1
- package/dist/src/ui/hooks/useToolScheduler.test.js +226 -242
- package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
- package/dist/src/ui/hooks/vim.test.js +235 -355
- package/dist/src/ui/hooks/vim.test.js.map +1 -1
- package/dist/src/ui/keyMatchers.test.js +30 -3
- package/dist/src/ui/keyMatchers.test.js.map +1 -1
- package/dist/src/ui/state/extensions.d.ts +1 -0
- package/dist/src/ui/state/extensions.js +1 -0
- package/dist/src/ui/state/extensions.js.map +1 -1
- package/dist/src/ui/themes/ansi-light.js +1 -0
- package/dist/src/ui/themes/ansi-light.js.map +1 -1
- package/dist/src/ui/themes/ansi.js +1 -0
- package/dist/src/ui/themes/ansi.js.map +1 -1
- package/dist/src/ui/themes/atom-one-dark.js +2 -0
- package/dist/src/ui/themes/atom-one-dark.js.map +1 -1
- package/dist/src/ui/themes/ayu-light.js +2 -0
- package/dist/src/ui/themes/ayu-light.js.map +1 -1
- package/dist/src/ui/themes/ayu.js +2 -0
- package/dist/src/ui/themes/ayu.js.map +1 -1
- package/dist/src/ui/themes/color-utils.d.ts +1 -0
- package/dist/src/ui/themes/color-utils.js +6 -0
- package/dist/src/ui/themes/color-utils.js.map +1 -1
- package/dist/src/ui/themes/color-utils.test.js +13 -1
- package/dist/src/ui/themes/color-utils.test.js.map +1 -1
- package/dist/src/ui/themes/dracula.js +2 -0
- package/dist/src/ui/themes/dracula.js.map +1 -1
- package/dist/src/ui/themes/github-dark.js +2 -0
- package/dist/src/ui/themes/github-dark.js.map +1 -1
- package/dist/src/ui/themes/github-light.js +2 -0
- package/dist/src/ui/themes/github-light.js.map +1 -1
- package/dist/src/ui/themes/googlecode.js +2 -0
- package/dist/src/ui/themes/googlecode.js.map +1 -1
- package/dist/src/ui/themes/no-color.js +3 -0
- package/dist/src/ui/themes/no-color.js.map +1 -1
- package/dist/src/ui/themes/semantic-tokens.d.ts +2 -0
- package/dist/src/ui/themes/semantic-tokens.js +6 -0
- package/dist/src/ui/themes/semantic-tokens.js.map +1 -1
- package/dist/src/ui/themes/shades-of-purple.js +2 -0
- package/dist/src/ui/themes/shades-of-purple.js.map +1 -1
- package/dist/src/ui/themes/theme.d.ts +3 -0
- package/dist/src/ui/themes/theme.js +14 -3
- package/dist/src/ui/themes/theme.js.map +1 -1
- package/dist/src/ui/themes/theme.test.js +67 -1
- package/dist/src/ui/themes/theme.test.js.map +1 -1
- package/dist/src/ui/themes/xcode.js +2 -0
- package/dist/src/ui/themes/xcode.js.map +1 -1
- package/dist/src/ui/types.d.ts +3 -1
- package/dist/src/ui/types.js +2 -0
- package/dist/src/ui/types.js.map +1 -1
- package/dist/src/ui/utils/CodeColorizer.js +2 -1
- package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
- package/dist/src/ui/utils/InlineMarkdownRenderer.d.ts +1 -0
- package/dist/src/ui/utils/InlineMarkdownRenderer.js +11 -10
- package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -1
- package/dist/src/ui/utils/MarkdownDisplay.js +11 -9
- package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
- package/dist/src/ui/utils/clipboardUtils.js +2 -2
- package/dist/src/ui/utils/clipboardUtils.js.map +1 -1
- package/dist/src/ui/utils/input.d.ts +17 -0
- package/dist/src/ui/utils/input.js +51 -0
- package/dist/src/ui/utils/input.js.map +1 -0
- package/dist/src/ui/utils/input.test.d.ts +6 -0
- package/dist/src/ui/utils/input.test.js +44 -0
- package/dist/src/ui/utils/input.test.js.map +1 -0
- package/dist/src/ui/utils/kittyProtocolDetector.js +13 -4
- package/dist/src/ui/utils/kittyProtocolDetector.js.map +1 -1
- package/dist/src/ui/utils/mouse.d.ts +31 -0
- package/dist/src/ui/utils/mouse.js +164 -0
- package/dist/src/ui/utils/mouse.js.map +1 -0
- package/dist/src/ui/utils/mouse.test.d.ts +6 -0
- package/dist/src/ui/utils/mouse.test.js +131 -0
- package/dist/src/ui/utils/mouse.test.js.map +1 -0
- package/dist/src/ui/utils/textOutput.d.ts +25 -0
- package/dist/src/ui/utils/textOutput.js +49 -0
- package/dist/src/ui/utils/textOutput.js.map +1 -0
- package/dist/src/ui/utils/textOutput.test.d.ts +6 -0
- package/dist/src/ui/utils/textOutput.test.js +79 -0
- package/dist/src/ui/utils/textOutput.test.js.map +1 -0
- package/dist/src/ui/utils/updateCheck.d.ts +7 -1
- package/dist/src/ui/utils/updateCheck.js +33 -29
- package/dist/src/ui/utils/updateCheck.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.test.js +24 -50
- package/dist/src/ui/utils/updateCheck.test.js.map +1 -1
- package/dist/src/utils/commentJson.js +2 -2
- package/dist/src/utils/commentJson.js.map +1 -1
- package/dist/src/utils/commentJson.test.js +7 -6
- package/dist/src/utils/commentJson.test.js.map +1 -1
- package/dist/src/utils/envVarResolver.d.ts +2 -2
- package/dist/src/utils/envVarResolver.js +10 -7
- package/dist/src/utils/envVarResolver.js.map +1 -1
- package/dist/src/utils/events.d.ts +11 -2
- package/dist/src/utils/events.js +1 -0
- package/dist/src/utils/events.js.map +1 -1
- package/dist/src/utils/handleAutoUpdate.js +9 -3
- package/dist/src/utils/handleAutoUpdate.js.map +1 -1
- package/dist/src/utils/sandbox.js +16 -18
- package/dist/src/utils/sandbox.js.map +1 -1
- package/dist/src/utils/version.js +6 -2
- package/dist/src/utils/version.js.map +1 -1
- package/dist/src/zed-integration/acp.js +2 -1
- package/dist/src/zed-integration/acp.js.map +1 -1
- package/dist/src/zed-integration/schema.d.ts +4 -4
- package/dist/src/zed-integration/zedIntegration.d.ts +2 -2
- package/dist/src/zed-integration/zedIntegration.js +12 -19
- package/dist/src/zed-integration/zedIntegration.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -14
- package/dist/src/config/policy.test.js +0 -360
- package/dist/src/config/policy.test.js.map +0 -1
- package/dist/src/utils/package.d.ts +0 -12
- package/dist/src/utils/package.js +0 -24
- package/dist/src/utils/package.js.map +0 -1
- /package/dist/src/{config/policy.test.d.ts → commands/extensions/validate.test.d.ts} +0 -0
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
7
|
+
import { act } from 'react';
|
|
8
|
+
import { renderHook } from '../../test-utils/render.js';
|
|
9
|
+
import { waitFor } from '../../test-utils/async.js';
|
|
8
10
|
import { useSlashCommandProcessor } from './slashCommandProcessor.js';
|
|
9
11
|
import { CommandKind } from '../commands/types.js';
|
|
10
12
|
import { MessageType } from '../types.js';
|
|
@@ -21,6 +23,12 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
|
|
21
23
|
...original,
|
|
22
24
|
logSlashCommand,
|
|
23
25
|
getIdeInstaller: vi.fn().mockReturnValue(null),
|
|
26
|
+
IdeClient: {
|
|
27
|
+
getInstance: vi.fn().mockResolvedValue({
|
|
28
|
+
addStatusChangeListener: vi.fn(),
|
|
29
|
+
removeStatusChangeListener: vi.fn(),
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
24
32
|
};
|
|
25
33
|
});
|
|
26
34
|
const { mockProcessExit } = vi.hoisted(() => ({
|
|
@@ -82,6 +90,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
82
90
|
const mockSetQuittingMessages = vi.fn();
|
|
83
91
|
const mockConfig = makeFakeConfig({});
|
|
84
92
|
const mockSettings = {};
|
|
93
|
+
let unmountHook;
|
|
85
94
|
beforeEach(() => {
|
|
86
95
|
vi.clearAllMocks();
|
|
87
96
|
vi.mocked(BuiltinCommandLoader).mockClear();
|
|
@@ -89,41 +98,67 @@ describe('useSlashCommandProcessor', () => {
|
|
|
89
98
|
mockFileLoadCommands.mockResolvedValue([]);
|
|
90
99
|
mockMcpLoadCommands.mockResolvedValue([]);
|
|
91
100
|
});
|
|
92
|
-
|
|
101
|
+
afterEach(async () => {
|
|
102
|
+
if (unmountHook) {
|
|
103
|
+
await unmountHook();
|
|
104
|
+
unmountHook = undefined;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const setupProcessorHook = async (builtinCommands = [], fileCommands = [], mcpCommands = [], setIsProcessing = vi.fn()) => {
|
|
93
108
|
mockBuiltinLoadCommands.mockResolvedValue(Object.freeze(builtinCommands));
|
|
94
109
|
mockFileLoadCommands.mockResolvedValue(Object.freeze(fileCommands));
|
|
95
110
|
mockMcpLoadCommands.mockResolvedValue(Object.freeze(mcpCommands));
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
let result;
|
|
112
|
+
let unmount;
|
|
113
|
+
let rerender;
|
|
114
|
+
await act(async () => {
|
|
115
|
+
const hook = renderHook(() => useSlashCommandProcessor(mockConfig, mockSettings, mockAddItem, mockClearItems, mockLoadHistory, vi.fn(), // refreshStatic
|
|
116
|
+
vi.fn(), // toggleVimEnabled
|
|
117
|
+
setIsProcessing, vi.fn(), // setGeminiMdFileCount
|
|
118
|
+
{
|
|
119
|
+
openAuthDialog: mockOpenAuthDialog,
|
|
120
|
+
openThemeDialog: mockOpenThemeDialog,
|
|
121
|
+
openEditorDialog: vi.fn(),
|
|
122
|
+
openPrivacyNotice: vi.fn(),
|
|
123
|
+
openSettingsDialog: vi.fn(),
|
|
124
|
+
openModelDialog: mockOpenModelDialog,
|
|
125
|
+
openPermissionsDialog: vi.fn(),
|
|
126
|
+
quit: mockSetQuittingMessages,
|
|
127
|
+
setDebugMessage: vi.fn(),
|
|
128
|
+
toggleCorgiMode: vi.fn(),
|
|
129
|
+
toggleDebugProfiler: vi.fn(),
|
|
130
|
+
dispatchExtensionStateUpdate: vi.fn(),
|
|
131
|
+
addConfirmUpdateExtensionRequest: vi.fn(),
|
|
132
|
+
}, new Map(), // extensionsUpdateState
|
|
133
|
+
true));
|
|
134
|
+
result = hook.result;
|
|
135
|
+
unmount = hook.unmount;
|
|
136
|
+
rerender = hook.rerender;
|
|
137
|
+
});
|
|
138
|
+
unmountHook = async () => unmount();
|
|
139
|
+
await waitFor(() => {
|
|
140
|
+
expect(result.current.slashCommands).toBeDefined();
|
|
141
|
+
});
|
|
142
|
+
return {
|
|
143
|
+
get current() {
|
|
144
|
+
return result.current;
|
|
145
|
+
},
|
|
146
|
+
unmount,
|
|
147
|
+
rerender: async () => {
|
|
148
|
+
rerender();
|
|
149
|
+
},
|
|
150
|
+
};
|
|
116
151
|
};
|
|
117
152
|
describe('Initialization and Command Loading', () => {
|
|
118
|
-
it('should initialize CommandService with all required loaders', () => {
|
|
119
|
-
setupProcessorHook();
|
|
153
|
+
it('should initialize CommandService with all required loaders', async () => {
|
|
154
|
+
await setupProcessorHook();
|
|
120
155
|
expect(BuiltinCommandLoader).toHaveBeenCalledWith(mockConfig);
|
|
121
156
|
expect(FileCommandLoader).toHaveBeenCalledWith(mockConfig);
|
|
122
157
|
expect(McpPromptLoader).toHaveBeenCalledWith(mockConfig);
|
|
123
158
|
});
|
|
124
159
|
it('should call loadCommands and populate state after mounting', async () => {
|
|
125
160
|
const testCommand = createTestCommand({ name: 'test' });
|
|
126
|
-
const result = setupProcessorHook([testCommand]);
|
|
161
|
+
const result = await setupProcessorHook([testCommand]);
|
|
127
162
|
await waitFor(() => {
|
|
128
163
|
expect(result.current.slashCommands).toHaveLength(1);
|
|
129
164
|
});
|
|
@@ -134,7 +169,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
134
169
|
});
|
|
135
170
|
it('should provide an immutable array of commands to consumers', async () => {
|
|
136
171
|
const testCommand = createTestCommand({ name: 'test' });
|
|
137
|
-
const result = setupProcessorHook([testCommand]);
|
|
172
|
+
const result = await setupProcessorHook([testCommand]);
|
|
138
173
|
await waitFor(() => {
|
|
139
174
|
expect(result.current.slashCommands).toHaveLength(1);
|
|
140
175
|
});
|
|
@@ -153,7 +188,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
153
188
|
action: builtinAction,
|
|
154
189
|
});
|
|
155
190
|
const fileCommand = createTestCommand({ name: 'override', description: 'file', action: fileAction }, CommandKind.FILE);
|
|
156
|
-
const result = setupProcessorHook([builtinCommand], [fileCommand]);
|
|
191
|
+
const result = await setupProcessorHook([builtinCommand], [fileCommand]);
|
|
157
192
|
await waitFor(() => {
|
|
158
193
|
// The service should only return one command with the name 'override'
|
|
159
194
|
expect(result.current.slashCommands).toHaveLength(1);
|
|
@@ -168,7 +203,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
168
203
|
});
|
|
169
204
|
describe('Command Execution Logic', () => {
|
|
170
205
|
it('should display an error for an unknown command', async () => {
|
|
171
|
-
const result = setupProcessorHook();
|
|
206
|
+
const result = await setupProcessorHook();
|
|
172
207
|
await waitFor(() => expect(result.current.slashCommands).toBeDefined());
|
|
173
208
|
await act(async () => {
|
|
174
209
|
await result.current.handleSlashCommand('/nonexistent');
|
|
@@ -193,7 +228,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
193
228
|
},
|
|
194
229
|
],
|
|
195
230
|
};
|
|
196
|
-
const result = setupProcessorHook([parentCommand]);
|
|
231
|
+
const result = await setupProcessorHook([parentCommand]);
|
|
197
232
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
198
233
|
await act(async () => {
|
|
199
234
|
await result.current.handleSlashCommand('/parent');
|
|
@@ -219,7 +254,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
219
254
|
},
|
|
220
255
|
],
|
|
221
256
|
};
|
|
222
|
-
const result = setupProcessorHook([parentCommand]);
|
|
257
|
+
const result = await setupProcessorHook([parentCommand]);
|
|
223
258
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
224
259
|
await act(async () => {
|
|
225
260
|
await result.current.handleSlashCommand('/parent child with args');
|
|
@@ -236,7 +271,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
236
271
|
});
|
|
237
272
|
it('sets isProcessing to false if the the input is not a command', async () => {
|
|
238
273
|
const setMockIsProcessing = vi.fn();
|
|
239
|
-
const result = setupProcessorHook([], [], [], setMockIsProcessing);
|
|
274
|
+
const result = await setupProcessorHook([], [], [], setMockIsProcessing);
|
|
240
275
|
await act(async () => {
|
|
241
276
|
await result.current.handleSlashCommand('imnotacommand');
|
|
242
277
|
});
|
|
@@ -248,7 +283,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
248
283
|
name: 'fail',
|
|
249
284
|
action: vi.fn().mockRejectedValue(new Error('oh no!')),
|
|
250
285
|
});
|
|
251
|
-
const result = setupProcessorHook([failCommand], [], [], setMockIsProcessing);
|
|
286
|
+
const result = await setupProcessorHook([failCommand], [], [], setMockIsProcessing);
|
|
252
287
|
await waitFor(() => expect(result.current.slashCommands).toBeDefined());
|
|
253
288
|
await act(async () => {
|
|
254
289
|
await result.current.handleSlashCommand('/fail');
|
|
@@ -262,7 +297,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
262
297
|
name: 'long-running',
|
|
263
298
|
action: () => new Promise((resolve) => setTimeout(resolve, 50)),
|
|
264
299
|
});
|
|
265
|
-
const result = setupProcessorHook([command], [], [], mockSetIsProcessing);
|
|
300
|
+
const result = await setupProcessorHook([command], [], [], mockSetIsProcessing);
|
|
266
301
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
267
302
|
const executionPromise = act(async () => {
|
|
268
303
|
await result.current.handleSlashCommand('/long-running');
|
|
@@ -278,29 +313,32 @@ describe('useSlashCommandProcessor', () => {
|
|
|
278
313
|
});
|
|
279
314
|
});
|
|
280
315
|
describe('Action Result Handling', () => {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
await result.current.
|
|
316
|
+
describe('Dialog actions', () => {
|
|
317
|
+
it.each([
|
|
318
|
+
{
|
|
319
|
+
dialogType: 'theme',
|
|
320
|
+
commandName: 'themecmd',
|
|
321
|
+
mockFn: mockOpenThemeDialog,
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
dialogType: 'model',
|
|
325
|
+
commandName: 'modelcmd',
|
|
326
|
+
mockFn: mockOpenModelDialog,
|
|
327
|
+
},
|
|
328
|
+
])('should handle "dialog: $dialogType" action', async ({ dialogType, commandName, mockFn }) => {
|
|
329
|
+
const command = createTestCommand({
|
|
330
|
+
name: commandName,
|
|
331
|
+
action: vi
|
|
332
|
+
.fn()
|
|
333
|
+
.mockResolvedValue({ type: 'dialog', dialog: dialogType }),
|
|
334
|
+
});
|
|
335
|
+
const result = await setupProcessorHook([command]);
|
|
336
|
+
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
337
|
+
await act(async () => {
|
|
338
|
+
await result.current.handleSlashCommand(`/${commandName}`);
|
|
339
|
+
});
|
|
340
|
+
expect(mockFn).toHaveBeenCalled();
|
|
302
341
|
});
|
|
303
|
-
expect(mockOpenModelDialog).toHaveBeenCalled();
|
|
304
342
|
});
|
|
305
343
|
it('should handle "load_history" action', async () => {
|
|
306
344
|
const mockClient = {
|
|
@@ -316,7 +354,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
316
354
|
clientHistory: [{ role: 'user', parts: [{ text: 'old prompt' }] }],
|
|
317
355
|
}),
|
|
318
356
|
});
|
|
319
|
-
const result = setupProcessorHook([command]);
|
|
357
|
+
const result = await setupProcessorHook([command]);
|
|
320
358
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
321
359
|
await act(async () => {
|
|
322
360
|
await result.current.handleSlashCommand('/load');
|
|
@@ -344,7 +382,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
344
382
|
clientHistory: historyWithThoughts,
|
|
345
383
|
}),
|
|
346
384
|
});
|
|
347
|
-
const result = setupProcessorHook([command]);
|
|
385
|
+
const result = await setupProcessorHook([command]);
|
|
348
386
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
349
387
|
await act(async () => {
|
|
350
388
|
await result.current.handleSlashCommand('/loadwiththoughts');
|
|
@@ -360,7 +398,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
360
398
|
name: 'exit',
|
|
361
399
|
action: quitAction,
|
|
362
400
|
});
|
|
363
|
-
const result = setupProcessorHook([command]);
|
|
401
|
+
const result = await setupProcessorHook([command]);
|
|
364
402
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
365
403
|
await act(async () => {
|
|
366
404
|
await result.current.handleSlashCommand('/exit');
|
|
@@ -376,7 +414,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
376
414
|
content: [{ text: 'The actual prompt from the TOML file.' }],
|
|
377
415
|
}),
|
|
378
416
|
}, CommandKind.FILE);
|
|
379
|
-
const result = setupProcessorHook([], [fileCommand]);
|
|
417
|
+
const result = await setupProcessorHook([], [fileCommand]);
|
|
380
418
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
381
419
|
let actionResult;
|
|
382
420
|
await act(async () => {
|
|
@@ -397,7 +435,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
397
435
|
content: [{ text: 'The actual prompt from the mcp command.' }],
|
|
398
436
|
}),
|
|
399
437
|
}, CommandKind.MCP_PROMPT);
|
|
400
|
-
const result = setupProcessorHook([], [], [mcpCommand]);
|
|
438
|
+
const result = await setupProcessorHook([], [], [mcpCommand]);
|
|
401
439
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
402
440
|
let actionResult;
|
|
403
441
|
await act(async () => {
|
|
@@ -428,30 +466,33 @@ describe('useSlashCommandProcessor', () => {
|
|
|
428
466
|
});
|
|
429
467
|
});
|
|
430
468
|
it('should set confirmation request when action returns confirm_shell_commands', async () => {
|
|
431
|
-
const result = setupProcessorHook([shellCommand]);
|
|
469
|
+
const result = await setupProcessorHook([shellCommand]);
|
|
432
470
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
433
|
-
//
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
result.current.handleSlashCommand('/shellcmd');
|
|
471
|
+
// Trigger command, don't await it yet as it suspends for confirmation
|
|
472
|
+
await act(async () => {
|
|
473
|
+
void result.current.handleSlashCommand('/shellcmd');
|
|
437
474
|
});
|
|
438
475
|
// We now wait for the state to be updated with the request.
|
|
439
|
-
await
|
|
440
|
-
|
|
476
|
+
await act(async () => {
|
|
477
|
+
await waitFor(() => {
|
|
478
|
+
expect(result.current.shellConfirmationRequest).not.toBeNull();
|
|
479
|
+
});
|
|
441
480
|
});
|
|
442
481
|
expect(result.current.shellConfirmationRequest?.commands).toEqual([
|
|
443
482
|
'rm -rf /',
|
|
444
483
|
]);
|
|
445
484
|
});
|
|
446
485
|
it('should do nothing if user cancels confirmation', async () => {
|
|
447
|
-
const result = setupProcessorHook([shellCommand]);
|
|
486
|
+
const result = await setupProcessorHook([shellCommand]);
|
|
448
487
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
449
|
-
act(() => {
|
|
450
|
-
result.current.handleSlashCommand('/shellcmd');
|
|
488
|
+
await act(async () => {
|
|
489
|
+
void result.current.handleSlashCommand('/shellcmd');
|
|
451
490
|
});
|
|
452
491
|
// Wait for the confirmation dialog to be set
|
|
453
|
-
await
|
|
454
|
-
|
|
492
|
+
await act(async () => {
|
|
493
|
+
await waitFor(() => {
|
|
494
|
+
expect(result.current.shellConfirmationRequest).not.toBeNull();
|
|
495
|
+
});
|
|
455
496
|
});
|
|
456
497
|
const onConfirm = result.current.shellConfirmationRequest?.onConfirm;
|
|
457
498
|
expect(onConfirm).toBeDefined();
|
|
@@ -470,13 +511,16 @@ describe('useSlashCommandProcessor', () => {
|
|
|
470
511
|
expect(mockCommandAction).toHaveBeenCalledTimes(1);
|
|
471
512
|
});
|
|
472
513
|
it('should re-run command with one-time allowlist on "Proceed Once"', async () => {
|
|
473
|
-
const result = setupProcessorHook([shellCommand]);
|
|
514
|
+
const result = await setupProcessorHook([shellCommand]);
|
|
474
515
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
475
|
-
|
|
476
|
-
|
|
516
|
+
let commandPromise;
|
|
517
|
+
await act(async () => {
|
|
518
|
+
commandPromise = result.current.handleSlashCommand('/shellcmd');
|
|
477
519
|
});
|
|
478
|
-
await
|
|
479
|
-
|
|
520
|
+
await act(async () => {
|
|
521
|
+
await waitFor(() => {
|
|
522
|
+
expect(result.current.shellConfirmationRequest).not.toBeNull();
|
|
523
|
+
});
|
|
480
524
|
});
|
|
481
525
|
const onConfirm = result.current.shellConfirmationRequest?.onConfirm;
|
|
482
526
|
// **Change the mock's behavior for the SECOND run.**
|
|
@@ -489,6 +533,9 @@ describe('useSlashCommandProcessor', () => {
|
|
|
489
533
|
await act(async () => {
|
|
490
534
|
onConfirm(ToolConfirmationOutcome.ProceedOnce, ['rm -rf /']);
|
|
491
535
|
});
|
|
536
|
+
await act(async () => {
|
|
537
|
+
await commandPromise;
|
|
538
|
+
});
|
|
492
539
|
expect(result.current.shellConfirmationRequest).toBeNull();
|
|
493
540
|
// The action should have been called twice (initial + re-run).
|
|
494
541
|
await waitFor(() => {
|
|
@@ -503,19 +550,22 @@ describe('useSlashCommandProcessor', () => {
|
|
|
503
550
|
// Verify the session-wide allowlist was NOT permanently updated.
|
|
504
551
|
// Re-render the hook by calling a no-op command to get the latest context.
|
|
505
552
|
await act(async () => {
|
|
506
|
-
result.current.handleSlashCommand('/no-op');
|
|
553
|
+
await result.current.handleSlashCommand('/no-op');
|
|
507
554
|
});
|
|
508
555
|
const finalContext = result.current.commandContext;
|
|
509
556
|
expect(finalContext.session.sessionShellAllowlist.size).toBe(0);
|
|
510
557
|
});
|
|
511
558
|
it('should re-run command and update session allowlist on "Proceed Always"', async () => {
|
|
512
|
-
const result = setupProcessorHook([shellCommand]);
|
|
559
|
+
const result = await setupProcessorHook([shellCommand]);
|
|
513
560
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
514
|
-
|
|
515
|
-
|
|
561
|
+
let commandPromise;
|
|
562
|
+
await act(async () => {
|
|
563
|
+
commandPromise = result.current.handleSlashCommand('/shellcmd');
|
|
516
564
|
});
|
|
517
|
-
await
|
|
518
|
-
|
|
565
|
+
await act(async () => {
|
|
566
|
+
await waitFor(() => {
|
|
567
|
+
expect(result.current.shellConfirmationRequest).not.toBeNull();
|
|
568
|
+
});
|
|
519
569
|
});
|
|
520
570
|
const onConfirm = result.current.shellConfirmationRequest?.onConfirm;
|
|
521
571
|
mockCommandAction.mockResolvedValue({
|
|
@@ -526,6 +576,9 @@ describe('useSlashCommandProcessor', () => {
|
|
|
526
576
|
await act(async () => {
|
|
527
577
|
onConfirm(ToolConfirmationOutcome.ProceedAlways, ['rm -rf /']);
|
|
528
578
|
});
|
|
579
|
+
await act(async () => {
|
|
580
|
+
await commandPromise;
|
|
581
|
+
});
|
|
529
582
|
expect(result.current.shellConfirmationRequest).toBeNull();
|
|
530
583
|
await waitFor(() => {
|
|
531
584
|
expect(mockCommandAction).toHaveBeenCalledTimes(2);
|
|
@@ -541,7 +594,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
541
594
|
describe('Command Parsing and Matching', () => {
|
|
542
595
|
it('should be case-sensitive', async () => {
|
|
543
596
|
const command = createTestCommand({ name: 'test' });
|
|
544
|
-
const result = setupProcessorHook([command]);
|
|
597
|
+
const result = await setupProcessorHook([command]);
|
|
545
598
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
546
599
|
await act(async () => {
|
|
547
600
|
// Use uppercase when command is lowercase
|
|
@@ -561,7 +614,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
561
614
|
description: 'a command with an alias',
|
|
562
615
|
action,
|
|
563
616
|
});
|
|
564
|
-
const result = setupProcessorHook([command]);
|
|
617
|
+
const result = await setupProcessorHook([command]);
|
|
565
618
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
566
619
|
await act(async () => {
|
|
567
620
|
await result.current.handleSlashCommand('/alias');
|
|
@@ -572,7 +625,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
572
625
|
it('should handle extra whitespace around the command', async () => {
|
|
573
626
|
const action = vi.fn();
|
|
574
627
|
const command = createTestCommand({ name: 'test', action });
|
|
575
|
-
const result = setupProcessorHook([command]);
|
|
628
|
+
const result = await setupProcessorHook([command]);
|
|
576
629
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
577
630
|
await act(async () => {
|
|
578
631
|
await result.current.handleSlashCommand(' /test with-args ');
|
|
@@ -582,7 +635,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
582
635
|
it('should handle `?` as a command prefix', async () => {
|
|
583
636
|
const action = vi.fn();
|
|
584
637
|
const command = createTestCommand({ name: 'help', action });
|
|
585
|
-
const result = setupProcessorHook([command]);
|
|
638
|
+
const result = await setupProcessorHook([command]);
|
|
586
639
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
|
|
587
640
|
await act(async () => {
|
|
588
641
|
await result.current.handleSlashCommand('?help');
|
|
@@ -600,7 +653,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
600
653
|
action: mcpAction,
|
|
601
654
|
}, CommandKind.MCP_PROMPT);
|
|
602
655
|
const fileCommand = createTestCommand({ name: 'override', description: 'file', action: fileAction }, CommandKind.FILE);
|
|
603
|
-
const result = setupProcessorHook([], [fileCommand], [mcpCommand]);
|
|
656
|
+
const result = await setupProcessorHook([], [fileCommand], [mcpCommand]);
|
|
604
657
|
await waitFor(() => {
|
|
605
658
|
// The service should only return one command with the name 'override'
|
|
606
659
|
expect(result.current.slashCommands).toHaveLength(1);
|
|
@@ -626,7 +679,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
626
679
|
}, CommandKind.FILE);
|
|
627
680
|
// The order of commands in the final loaded array is not guaranteed,
|
|
628
681
|
// so the test must work regardless of which comes first.
|
|
629
|
-
const result = setupProcessorHook([quitCommand], [exitCommand]);
|
|
682
|
+
const result = await setupProcessorHook([quitCommand], [exitCommand]);
|
|
630
683
|
await waitFor(() => {
|
|
631
684
|
expect(result.current.slashCommands).toHaveLength(2);
|
|
632
685
|
});
|
|
@@ -645,7 +698,7 @@ describe('useSlashCommandProcessor', () => {
|
|
|
645
698
|
action: vi.fn(),
|
|
646
699
|
});
|
|
647
700
|
const exitCommand = createTestCommand({ name: 'exit', action: vi.fn() }, CommandKind.FILE);
|
|
648
|
-
const result = setupProcessorHook([quitCommand], [exitCommand]);
|
|
701
|
+
const result = await setupProcessorHook([quitCommand], [exitCommand]);
|
|
649
702
|
await waitFor(() => expect(result.current.slashCommands).toHaveLength(2));
|
|
650
703
|
await act(async () => {
|
|
651
704
|
await result.current.handleSlashCommand('/exit');
|
|
@@ -655,28 +708,9 @@ describe('useSlashCommandProcessor', () => {
|
|
|
655
708
|
});
|
|
656
709
|
});
|
|
657
710
|
describe('Lifecycle', () => {
|
|
658
|
-
it('should abort command loading when the hook unmounts', () => {
|
|
711
|
+
it('should abort command loading when the hook unmounts', async () => {
|
|
659
712
|
const abortSpy = vi.spyOn(AbortController.prototype, 'abort');
|
|
660
|
-
const { unmount } =
|
|
661
|
-
vi.fn().mockResolvedValue(false), // toggleVimEnabled
|
|
662
|
-
vi.fn(), // setIsProcessing
|
|
663
|
-
vi.fn(), // setGeminiMdFileCount
|
|
664
|
-
{
|
|
665
|
-
openAuthDialog: vi.fn(),
|
|
666
|
-
openThemeDialog: vi.fn(),
|
|
667
|
-
openEditorDialog: vi.fn(),
|
|
668
|
-
openPrivacyNotice: vi.fn(),
|
|
669
|
-
openSettingsDialog: vi.fn(),
|
|
670
|
-
openModelDialog: vi.fn(),
|
|
671
|
-
openPermissionsDialog: vi.fn(),
|
|
672
|
-
quit: vi.fn(),
|
|
673
|
-
setDebugMessage: vi.fn(),
|
|
674
|
-
toggleCorgiMode: vi.fn(),
|
|
675
|
-
toggleDebugProfiler: vi.fn(),
|
|
676
|
-
dispatchExtensionStateUpdate: vi.fn(),
|
|
677
|
-
addConfirmUpdateExtensionRequest: vi.fn(),
|
|
678
|
-
}, new Map(), // extensionsUpdateState
|
|
679
|
-
true));
|
|
713
|
+
const { unmount } = await setupProcessorHook();
|
|
680
714
|
unmount();
|
|
681
715
|
expect(abortSpy).toHaveBeenCalledTimes(1);
|
|
682
716
|
});
|
|
@@ -713,64 +747,58 @@ describe('useSlashCommandProcessor', () => {
|
|
|
713
747
|
mockCommandAction.mockClear();
|
|
714
748
|
vi.mocked(logSlashCommand).mockClear();
|
|
715
749
|
});
|
|
716
|
-
it(
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
750
|
+
it.each([
|
|
751
|
+
{
|
|
752
|
+
command: '/logtest',
|
|
753
|
+
expectedLog: {
|
|
754
|
+
command: 'logtest',
|
|
755
|
+
subcommand: undefined,
|
|
756
|
+
status: SlashCommandStatus.SUCCESS,
|
|
757
|
+
},
|
|
758
|
+
desc: 'simple slash command',
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
command: '/fail',
|
|
762
|
+
expectedLog: {
|
|
763
|
+
command: 'fail',
|
|
764
|
+
status: 'error',
|
|
765
|
+
subcommand: undefined,
|
|
766
|
+
},
|
|
767
|
+
desc: 'failure event for failed command',
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
command: '/logwithsub sub',
|
|
771
|
+
expectedLog: {
|
|
772
|
+
command: 'logwithsub',
|
|
773
|
+
subcommand: 'sub',
|
|
774
|
+
},
|
|
775
|
+
desc: 'slash command with subcommand',
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
command: '/la',
|
|
779
|
+
expectedLog: {
|
|
780
|
+
command: 'logalias',
|
|
781
|
+
},
|
|
782
|
+
desc: 'command path when alias is used',
|
|
783
|
+
},
|
|
784
|
+
])('should log $desc', async ({ command, expectedLog }) => {
|
|
785
|
+
const result = await setupProcessorHook(loggingTestCommands);
|
|
786
|
+
await waitFor(() => expect(result.current.slashCommands).toBeDefined());
|
|
751
787
|
await act(async () => {
|
|
752
|
-
await result.current.handleSlashCommand(
|
|
788
|
+
await result.current.handleSlashCommand(command);
|
|
753
789
|
});
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
subcommand: 'sub',
|
|
757
|
-
}));
|
|
758
|
-
});
|
|
759
|
-
it('should log the command path when an alias is used', async () => {
|
|
760
|
-
const result = setupProcessorHook(loggingTestCommands);
|
|
761
|
-
await waitFor(() => expect(result.current.slashCommands?.length).toBeGreaterThan(0));
|
|
762
|
-
await act(async () => {
|
|
763
|
-
await result.current.handleSlashCommand('/la');
|
|
790
|
+
await waitFor(() => {
|
|
791
|
+
expect(logSlashCommand).toHaveBeenCalledWith(mockConfig, expect.objectContaining(expectedLog));
|
|
764
792
|
});
|
|
765
|
-
expect(logSlashCommand).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
|
|
766
|
-
command: 'logalias',
|
|
767
|
-
}));
|
|
768
793
|
});
|
|
769
|
-
it(
|
|
770
|
-
|
|
771
|
-
|
|
794
|
+
it.each([
|
|
795
|
+
{ command: '/bogusbogusbogus', desc: 'bogus command' },
|
|
796
|
+
{ command: '/unknown', desc: 'unknown command' },
|
|
797
|
+
])('should not log for $desc', async ({ command }) => {
|
|
798
|
+
const result = await setupProcessorHook(loggingTestCommands);
|
|
799
|
+
await waitFor(() => expect(result.current.slashCommands).toBeDefined());
|
|
772
800
|
await act(async () => {
|
|
773
|
-
await result.current.handleSlashCommand(
|
|
801
|
+
await result.current.handleSlashCommand(command);
|
|
774
802
|
});
|
|
775
803
|
expect(logSlashCommand).not.toHaveBeenCalled();
|
|
776
804
|
});
|