@marizmelo/llm-cli 0.0.1
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/.last_build +0 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/package.json +107 -0
- package/dist/src/commands/extensions/disable.d.ts +14 -0
- package/dist/src/commands/extensions/disable.js +42 -0
- package/dist/src/commands/extensions/disable.js.map +1 -0
- package/dist/src/commands/extensions/enable.d.ts +14 -0
- package/dist/src/commands/extensions/enable.js +48 -0
- package/dist/src/commands/extensions/enable.js.map +1 -0
- package/dist/src/commands/extensions/install.d.ts +13 -0
- package/dist/src/commands/extensions/install.js +48 -0
- package/dist/src/commands/extensions/install.js.map +1 -0
- package/dist/src/commands/extensions/install.test.d.ts +6 -0
- package/dist/src/commands/extensions/install.test.js +19 -0
- package/dist/src/commands/extensions/install.test.js.map +1 -0
- package/dist/src/commands/extensions/list.d.ts +8 -0
- package/dist/src/commands/extensions/list.js +32 -0
- package/dist/src/commands/extensions/list.js.map +1 -0
- package/dist/src/commands/extensions/uninstall.d.ts +12 -0
- package/dist/src/commands/extensions/uninstall.js +38 -0
- package/dist/src/commands/extensions/uninstall.js.map +1 -0
- package/dist/src/commands/extensions/uninstall.test.d.ts +6 -0
- package/dist/src/commands/extensions/uninstall.test.js +15 -0
- package/dist/src/commands/extensions/uninstall.test.js.map +1 -0
- package/dist/src/commands/extensions/update.d.ts +13 -0
- package/dist/src/commands/extensions/update.js +60 -0
- package/dist/src/commands/extensions/update.js.map +1 -0
- package/dist/src/commands/extensions.d.ts +7 -0
- package/dist/src/commands/extensions.js +29 -0
- package/dist/src/commands/extensions.js.map +1 -0
- package/dist/src/commands/mcp/add.d.ts +7 -0
- package/dist/src/commands/mcp/add.js +166 -0
- package/dist/src/commands/mcp/add.js.map +1 -0
- package/dist/src/commands/mcp/list.d.ts +8 -0
- package/dist/src/commands/mcp/list.js +110 -0
- package/dist/src/commands/mcp/list.js.map +1 -0
- package/dist/src/commands/mcp/remove.d.ts +7 -0
- package/dist/src/commands/mcp/remove.js +44 -0
- package/dist/src/commands/mcp/remove.js.map +1 -0
- package/dist/src/commands/mcp.d.ts +7 -0
- package/dist/src/commands/mcp.js +23 -0
- package/dist/src/commands/mcp.js.map +1 -0
- package/dist/src/config/auth.d.ts +6 -0
- package/dist/src/config/auth.js +51 -0
- package/dist/src/config/auth.js.map +1 -0
- package/dist/src/config/auth.test.d.ts +6 -0
- package/dist/src/config/auth.test.js +59 -0
- package/dist/src/config/auth.test.js.map +1 -0
- package/dist/src/config/config.d.ts +44 -0
- package/dist/src/config/config.js +464 -0
- package/dist/src/config/config.js.map +1 -0
- package/dist/src/config/extension.d.ts +62 -0
- package/dist/src/config/extension.js +388 -0
- package/dist/src/config/extension.js.map +1 -0
- package/dist/src/config/extensions/variableSchema.d.ts +28 -0
- package/dist/src/config/extensions/variableSchema.js +18 -0
- package/dist/src/config/extensions/variableSchema.js.map +1 -0
- package/dist/src/config/extensions/variables.d.ts +17 -0
- package/dist/src/config/extensions/variables.js +40 -0
- package/dist/src/config/extensions/variables.js.map +1 -0
- package/dist/src/config/extensions/variables.test.d.ts +6 -0
- package/dist/src/config/extensions/variables.test.js +17 -0
- package/dist/src/config/extensions/variables.test.js.map +1 -0
- package/dist/src/config/keyBindings.d.ts +66 -0
- package/dist/src/config/keyBindings.js +141 -0
- package/dist/src/config/keyBindings.js.map +1 -0
- package/dist/src/config/keyBindings.test.d.ts +6 -0
- package/dist/src/config/keyBindings.test.js +51 -0
- package/dist/src/config/keyBindings.test.js.map +1 -0
- package/dist/src/config/modelDiscovery.d.ts +65 -0
- package/dist/src/config/modelDiscovery.js +290 -0
- package/dist/src/config/modelDiscovery.js.map +1 -0
- package/dist/src/config/providerManager.d.ts +64 -0
- package/dist/src/config/providerManager.js +277 -0
- package/dist/src/config/providerManager.js.map +1 -0
- package/dist/src/config/sandboxConfig.d.ts +13 -0
- package/dist/src/config/sandboxConfig.js +73 -0
- package/dist/src/config/sandboxConfig.js.map +1 -0
- package/dist/src/config/settings.d.ts +62 -0
- package/dist/src/config/settings.js +583 -0
- package/dist/src/config/settings.js.map +1 -0
- package/dist/src/config/settingsSchema.d.ts +795 -0
- package/dist/src/config/settingsSchema.js +768 -0
- package/dist/src/config/settingsSchema.js.map +1 -0
- package/dist/src/config/settingsSchema.test.d.ts +6 -0
- package/dist/src/config/settingsSchema.test.js +193 -0
- package/dist/src/config/settingsSchema.test.js.map +1 -0
- package/dist/src/config/trustedFolders.d.ts +47 -0
- package/dist/src/config/trustedFolders.js +130 -0
- package/dist/src/config/trustedFolders.js.map +1 -0
- package/dist/src/config/trustedFolders.test.d.ts +6 -0
- package/dist/src/config/trustedFolders.test.js +198 -0
- package/dist/src/config/trustedFolders.test.js.map +1 -0
- package/dist/src/gemini.d.ts +11 -0
- package/dist/src/gemini.js +331 -0
- package/dist/src/gemini.js.map +1 -0
- package/dist/src/gemini.test.d.ts +6 -0
- package/dist/src/gemini.test.js +247 -0
- package/dist/src/gemini.test.js.map +1 -0
- package/dist/src/generated/git-commit.d.ts +7 -0
- package/dist/src/generated/git-commit.js +10 -0
- package/dist/src/generated/git-commit.js.map +1 -0
- package/dist/src/nonInteractiveCli.d.ts +7 -0
- package/dist/src/nonInteractiveCli.js +92 -0
- package/dist/src/nonInteractiveCli.js.map +1 -0
- package/dist/src/patches/is-in-ci.d.ts +7 -0
- package/dist/src/patches/is-in-ci.js +15 -0
- package/dist/src/patches/is-in-ci.js.map +1 -0
- package/dist/src/services/BuiltinCommandLoader.d.ts +24 -0
- package/dist/src/services/BuiltinCommandLoader.js +84 -0
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -0
- package/dist/src/services/BuiltinCommandLoader.test.d.ts +6 -0
- package/dist/src/services/BuiltinCommandLoader.test.js +108 -0
- package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -0
- package/dist/src/services/CommandService.d.ts +55 -0
- package/dist/src/services/CommandService.js +90 -0
- package/dist/src/services/CommandService.js.map +1 -0
- package/dist/src/services/CommandService.test.d.ts +6 -0
- package/dist/src/services/CommandService.test.js +233 -0
- package/dist/src/services/CommandService.test.js.map +1 -0
- package/dist/src/services/FileCommandLoader.d.ts +51 -0
- package/dist/src/services/FileCommandLoader.js +227 -0
- package/dist/src/services/FileCommandLoader.js.map +1 -0
- package/dist/src/services/McpPromptLoader.d.ts +35 -0
- package/dist/src/services/McpPromptLoader.js +218 -0
- package/dist/src/services/McpPromptLoader.js.map +1 -0
- package/dist/src/services/McpPromptLoader.test.d.ts +6 -0
- package/dist/src/services/McpPromptLoader.test.js +114 -0
- package/dist/src/services/McpPromptLoader.test.js.map +1 -0
- package/dist/src/services/prompt-processors/argumentProcessor.d.ts +16 -0
- package/dist/src/services/prompt-processors/argumentProcessor.js +21 -0
- package/dist/src/services/prompt-processors/argumentProcessor.js.map +1 -0
- package/dist/src/services/prompt-processors/atFileProcessor.d.ts +12 -0
- package/dist/src/services/prompt-processors/atFileProcessor.js +62 -0
- package/dist/src/services/prompt-processors/atFileProcessor.js.map +1 -0
- package/dist/src/services/prompt-processors/atFileProcessor.test.d.ts +6 -0
- package/dist/src/services/prompt-processors/atFileProcessor.test.js +174 -0
- package/dist/src/services/prompt-processors/atFileProcessor.test.js.map +1 -0
- package/dist/src/services/prompt-processors/injectionParser.d.ts +29 -0
- package/dist/src/services/prompt-processors/injectionParser.js +60 -0
- package/dist/src/services/prompt-processors/injectionParser.js.map +1 -0
- package/dist/src/services/prompt-processors/injectionParser.test.d.ts +6 -0
- package/dist/src/services/prompt-processors/injectionParser.test.js +189 -0
- package/dist/src/services/prompt-processors/injectionParser.test.js.map +1 -0
- package/dist/src/services/prompt-processors/shellProcessor.d.ts +27 -0
- package/dist/src/services/prompt-processors/shellProcessor.js +121 -0
- package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -0
- package/dist/src/services/prompt-processors/types.d.ts +45 -0
- package/dist/src/services/prompt-processors/types.js +20 -0
- package/dist/src/services/prompt-processors/types.js.map +1 -0
- package/dist/src/services/types.d.ts +22 -0
- package/dist/src/services/types.js +7 -0
- package/dist/src/services/types.js.map +1 -0
- package/dist/src/test-utils/customMatchers.d.ts +14 -0
- package/dist/src/test-utils/customMatchers.js +40 -0
- package/dist/src/test-utils/customMatchers.js.map +1 -0
- package/dist/src/test-utils/mockCommandContext.d.ts +18 -0
- package/dist/src/test-utils/mockCommandContext.js +86 -0
- package/dist/src/test-utils/mockCommandContext.js.map +1 -0
- package/dist/src/test-utils/mockCommandContext.test.d.ts +6 -0
- package/dist/src/test-utils/mockCommandContext.test.js +51 -0
- package/dist/src/test-utils/mockCommandContext.test.js.map +1 -0
- package/dist/src/test-utils/render.d.ts +8 -0
- package/dist/src/test-utils/render.js +10 -0
- package/dist/src/test-utils/render.js.map +1 -0
- package/dist/src/ui/App.d.ts +15 -0
- package/dist/src/ui/App.js +708 -0
- package/dist/src/ui/App.js.map +1 -0
- package/dist/src/ui/IdeIntegrationNudge.d.ts +16 -0
- package/dist/src/ui/IdeIntegrationNudge.js +47 -0
- package/dist/src/ui/IdeIntegrationNudge.js.map +1 -0
- package/dist/src/ui/colors.d.ts +7 -0
- package/dist/src/ui/colors.js +54 -0
- package/dist/src/ui/colors.js.map +1 -0
- package/dist/src/ui/commands/aboutCommand.d.ts +7 -0
- package/dist/src/ui/commands/aboutCommand.js +43 -0
- package/dist/src/ui/commands/aboutCommand.js.map +1 -0
- package/dist/src/ui/commands/authCommand.d.ts +7 -0
- package/dist/src/ui/commands/authCommand.js +16 -0
- package/dist/src/ui/commands/authCommand.js.map +1 -0
- package/dist/src/ui/commands/bugCommand.d.ts +7 -0
- package/dist/src/ui/commands/bugCommand.js +71 -0
- package/dist/src/ui/commands/bugCommand.js.map +1 -0
- package/dist/src/ui/commands/chatCommand.d.ts +7 -0
- package/dist/src/ui/commands/chatCommand.js +235 -0
- package/dist/src/ui/commands/chatCommand.js.map +1 -0
- package/dist/src/ui/commands/clearCommand.d.ts +7 -0
- package/dist/src/ui/commands/clearCommand.js +27 -0
- package/dist/src/ui/commands/clearCommand.js.map +1 -0
- package/dist/src/ui/commands/compressCommand.d.ts +7 -0
- package/dist/src/ui/commands/compressCommand.js +66 -0
- package/dist/src/ui/commands/compressCommand.js.map +1 -0
- package/dist/src/ui/commands/copyCommand.d.ts +7 -0
- package/dist/src/ui/commands/copyCommand.js +59 -0
- package/dist/src/ui/commands/copyCommand.js.map +1 -0
- package/dist/src/ui/commands/corgiCommand.d.ts +7 -0
- package/dist/src/ui/commands/corgiCommand.js +15 -0
- package/dist/src/ui/commands/corgiCommand.js.map +1 -0
- package/dist/src/ui/commands/directoryCommand.d.ts +8 -0
- package/dist/src/ui/commands/directoryCommand.js +135 -0
- package/dist/src/ui/commands/directoryCommand.js.map +1 -0
- package/dist/src/ui/commands/docsCommand.d.ts +7 -0
- package/dist/src/ui/commands/docsCommand.js +31 -0
- package/dist/src/ui/commands/docsCommand.js.map +1 -0
- package/dist/src/ui/commands/editorCommand.d.ts +7 -0
- package/dist/src/ui/commands/editorCommand.js +16 -0
- package/dist/src/ui/commands/editorCommand.js.map +1 -0
- package/dist/src/ui/commands/extensionsCommand.d.ts +7 -0
- package/dist/src/ui/commands/extensionsCommand.js +31 -0
- package/dist/src/ui/commands/extensionsCommand.js.map +1 -0
- package/dist/src/ui/commands/helpCommand.d.ts +7 -0
- package/dist/src/ui/commands/helpCommand.js +21 -0
- package/dist/src/ui/commands/helpCommand.js.map +1 -0
- package/dist/src/ui/commands/ideCommand.d.ts +8 -0
- package/dist/src/ui/commands/ideCommand.js +216 -0
- package/dist/src/ui/commands/ideCommand.js.map +1 -0
- package/dist/src/ui/commands/initCommand.d.ts +7 -0
- package/dist/src/ui/commands/initCommand.js +76 -0
- package/dist/src/ui/commands/initCommand.js.map +1 -0
- package/dist/src/ui/commands/mcpCommand.d.ts +7 -0
- package/dist/src/ui/commands/mcpCommand.js +424 -0
- package/dist/src/ui/commands/mcpCommand.js.map +1 -0
- package/dist/src/ui/commands/memoryCommand.d.ts +7 -0
- package/dist/src/ui/commands/memoryCommand.js +92 -0
- package/dist/src/ui/commands/memoryCommand.js.map +1 -0
- package/dist/src/ui/commands/privacyCommand.d.ts +7 -0
- package/dist/src/ui/commands/privacyCommand.js +16 -0
- package/dist/src/ui/commands/privacyCommand.js.map +1 -0
- package/dist/src/ui/commands/providerCommand.d.ts +7 -0
- package/dist/src/ui/commands/providerCommand.js +599 -0
- package/dist/src/ui/commands/providerCommand.js.map +1 -0
- package/dist/src/ui/commands/quitCommand.d.ts +7 -0
- package/dist/src/ui/commands/quitCommand.js +34 -0
- package/dist/src/ui/commands/quitCommand.js.map +1 -0
- package/dist/src/ui/commands/restoreCommand.d.ts +8 -0
- package/dist/src/ui/commands/restoreCommand.js +124 -0
- package/dist/src/ui/commands/restoreCommand.js.map +1 -0
- package/dist/src/ui/commands/settingsCommand.d.ts +7 -0
- package/dist/src/ui/commands/settingsCommand.js +16 -0
- package/dist/src/ui/commands/settingsCommand.js.map +1 -0
- package/dist/src/ui/commands/setupGithubCommand.d.ts +9 -0
- package/dist/src/ui/commands/setupGithubCommand.js +154 -0
- package/dist/src/ui/commands/setupGithubCommand.js.map +1 -0
- package/dist/src/ui/commands/setupGithubCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/setupGithubCommand.test.js +167 -0
- package/dist/src/ui/commands/setupGithubCommand.test.js.map +1 -0
- package/dist/src/ui/commands/statsCommand.d.ts +7 -0
- package/dist/src/ui/commands/statsCommand.js +54 -0
- package/dist/src/ui/commands/statsCommand.js.map +1 -0
- package/dist/src/ui/commands/terminalSetupCommand.d.ts +13 -0
- package/dist/src/ui/commands/terminalSetupCommand.js +41 -0
- package/dist/src/ui/commands/terminalSetupCommand.js.map +1 -0
- package/dist/src/ui/commands/themeCommand.d.ts +7 -0
- package/dist/src/ui/commands/themeCommand.js +16 -0
- package/dist/src/ui/commands/themeCommand.js.map +1 -0
- package/dist/src/ui/commands/toolsCommand.d.ts +7 -0
- package/dist/src/ui/commands/toolsCommand.js +56 -0
- package/dist/src/ui/commands/toolsCommand.js.map +1 -0
- package/dist/src/ui/commands/types.d.ts +148 -0
- package/dist/src/ui/commands/types.js +13 -0
- package/dist/src/ui/commands/types.js.map +1 -0
- package/dist/src/ui/commands/vimCommand.d.ts +7 -0
- package/dist/src/ui/commands/vimCommand.js +23 -0
- package/dist/src/ui/commands/vimCommand.js.map +1 -0
- package/dist/src/ui/components/AboutBox.d.ts +17 -0
- package/dist/src/ui/components/AboutBox.js +6 -0
- package/dist/src/ui/components/AboutBox.js.map +1 -0
- package/dist/src/ui/components/AsciiArt.d.ts +8 -0
- package/dist/src/ui/components/AsciiArt.js +33 -0
- package/dist/src/ui/components/AsciiArt.js.map +1 -0
- package/dist/src/ui/components/AuthDialog.d.ts +16 -0
- package/dist/src/ui/components/AuthDialog.js +104 -0
- package/dist/src/ui/components/AuthDialog.js.map +1 -0
- package/dist/src/ui/components/AuthDialog.test.d.ts +6 -0
- package/dist/src/ui/components/AuthDialog.test.js +276 -0
- package/dist/src/ui/components/AuthDialog.test.js.map +1 -0
- package/dist/src/ui/components/AuthInProgress.d.ts +11 -0
- package/dist/src/ui/components/AuthInProgress.js +23 -0
- package/dist/src/ui/components/AuthInProgress.js.map +1 -0
- package/dist/src/ui/components/AutoAcceptIndicator.d.ts +12 -0
- package/dist/src/ui/components/AutoAcceptIndicator.js +26 -0
- package/dist/src/ui/components/AutoAcceptIndicator.js.map +1 -0
- package/dist/src/ui/components/ConsoleSummaryDisplay.d.ts +11 -0
- package/dist/src/ui/components/ConsoleSummaryDisplay.js +11 -0
- package/dist/src/ui/components/ConsoleSummaryDisplay.js.map +1 -0
- package/dist/src/ui/components/ContextSummaryDisplay.d.ts +20 -0
- package/dist/src/ui/components/ContextSummaryDisplay.js +66 -0
- package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -0
- package/dist/src/ui/components/ContextUsageDisplay.d.ts +9 -0
- package/dist/src/ui/components/ContextUsageDisplay.js +14 -0
- package/dist/src/ui/components/ContextUsageDisplay.js.map +1 -0
- package/dist/src/ui/components/DebugProfiler.d.ts +6 -0
- package/dist/src/ui/components/DebugProfiler.js +27 -0
- package/dist/src/ui/components/DebugProfiler.js.map +1 -0
- package/dist/src/ui/components/DetailedMessagesDisplay.d.ts +14 -0
- package/dist/src/ui/components/DetailedMessagesDisplay.js +34 -0
- package/dist/src/ui/components/DetailedMessagesDisplay.js.map +1 -0
- package/dist/src/ui/components/EditorSettingsDialog.d.ts +16 -0
- package/dist/src/ui/components/EditorSettingsDialog.js +71 -0
- package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -0
- package/dist/src/ui/components/FolderTrustDialog.d.ts +17 -0
- package/dist/src/ui/components/FolderTrustDialog.js +47 -0
- package/dist/src/ui/components/FolderTrustDialog.js.map +1 -0
- package/dist/src/ui/components/FolderTrustDialog.test.d.ts +6 -0
- package/dist/src/ui/components/FolderTrustDialog.test.js +78 -0
- package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -0
- package/dist/src/ui/components/Footer.d.ts +23 -0
- package/dist/src/ui/components/Footer.js +25 -0
- package/dist/src/ui/components/Footer.js.map +1 -0
- package/dist/src/ui/components/GeminiRespondingSpinner.d.ts +17 -0
- package/dist/src/ui/components/GeminiRespondingSpinner.js +18 -0
- package/dist/src/ui/components/GeminiRespondingSpinner.js.map +1 -0
- package/dist/src/ui/components/Header.d.ts +13 -0
- package/dist/src/ui/components/Header.js +28 -0
- package/dist/src/ui/components/Header.js.map +1 -0
- package/dist/src/ui/components/Header.test.d.ts +6 -0
- package/dist/src/ui/components/Header.test.js +37 -0
- package/dist/src/ui/components/Header.test.js.map +1 -0
- package/dist/src/ui/components/Help.d.ts +12 -0
- package/dist/src/ui/components/Help.js +10 -0
- package/dist/src/ui/components/Help.js.map +1 -0
- package/dist/src/ui/components/HistoryItemDisplay.d.ts +20 -0
- package/dist/src/ui/components/HistoryItemDisplay.js +18 -0
- package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -0
- package/dist/src/ui/components/HistoryItemDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/HistoryItemDisplay.test.js +93 -0
- package/dist/src/ui/components/HistoryItemDisplay.test.js.map +1 -0
- package/dist/src/ui/components/InputPrompt.d.ts +28 -0
- package/dist/src/ui/components/InputPrompt.js +562 -0
- package/dist/src/ui/components/InputPrompt.js.map +1 -0
- package/dist/src/ui/components/LoadingIndicator.d.ts +15 -0
- package/dist/src/ui/components/LoadingIndicator.js +25 -0
- package/dist/src/ui/components/LoadingIndicator.js.map +1 -0
- package/dist/src/ui/components/LoadingIndicator.test.d.ts +6 -0
- package/dist/src/ui/components/LoadingIndicator.test.js +190 -0
- package/dist/src/ui/components/LoadingIndicator.test.js.map +1 -0
- package/dist/src/ui/components/MemoryUsageDisplay.d.ts +7 -0
- package/dist/src/ui/components/MemoryUsageDisplay.js +22 -0
- package/dist/src/ui/components/MemoryUsageDisplay.js.map +1 -0
- package/dist/src/ui/components/ModelStatsDisplay.d.ts +7 -0
- package/dist/src/ui/components/ModelStatsDisplay.js +33 -0
- package/dist/src/ui/components/ModelStatsDisplay.js.map +1 -0
- package/dist/src/ui/components/PrepareLabel.d.ts +15 -0
- package/dist/src/ui/components/PrepareLabel.js +16 -0
- package/dist/src/ui/components/PrepareLabel.js.map +1 -0
- package/dist/src/ui/components/ProQuotaDialog.d.ts +13 -0
- package/dist/src/ui/components/ProQuotaDialog.js +21 -0
- package/dist/src/ui/components/ProQuotaDialog.js.map +1 -0
- package/dist/src/ui/components/ProQuotaDialog.test.d.ts +6 -0
- package/dist/src/ui/components/ProQuotaDialog.test.js +56 -0
- package/dist/src/ui/components/ProQuotaDialog.test.js.map +1 -0
- package/dist/src/ui/components/SessionSummaryDisplay.d.ts +11 -0
- package/dist/src/ui/components/SessionSummaryDisplay.js +4 -0
- package/dist/src/ui/components/SessionSummaryDisplay.js.map +1 -0
- package/dist/src/ui/components/SettingsDialog.d.ts +15 -0
- package/dist/src/ui/components/SettingsDialog.js +550 -0
- package/dist/src/ui/components/SettingsDialog.js.map +1 -0
- package/dist/src/ui/components/SettingsDialog.test.d.ts +6 -0
- package/dist/src/ui/components/SettingsDialog.test.js +646 -0
- package/dist/src/ui/components/SettingsDialog.test.js.map +1 -0
- package/dist/src/ui/components/ShellConfirmationDialog.d.ts +15 -0
- package/dist/src/ui/components/ShellConfirmationDialog.js +46 -0
- package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -0
- package/dist/src/ui/components/ShellConfirmationDialog.test.d.ts +6 -0
- package/dist/src/ui/components/ShellConfirmationDialog.test.js +40 -0
- package/dist/src/ui/components/ShellConfirmationDialog.test.js.map +1 -0
- package/dist/src/ui/components/ShellModeIndicator.d.ts +7 -0
- package/dist/src/ui/components/ShellModeIndicator.js +5 -0
- package/dist/src/ui/components/ShellModeIndicator.js.map +1 -0
- package/dist/src/ui/components/ShowMoreLines.d.ts +10 -0
- package/dist/src/ui/components/ShowMoreLines.js +24 -0
- package/dist/src/ui/components/ShowMoreLines.js.map +1 -0
- package/dist/src/ui/components/StatsDisplay.d.ts +12 -0
- package/dist/src/ui/components/StatsDisplay.js +43 -0
- package/dist/src/ui/components/StatsDisplay.js.map +1 -0
- package/dist/src/ui/components/SuggestionsDisplay.d.ts +22 -0
- package/dist/src/ui/components/SuggestionsDisplay.js +40 -0
- package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -0
- package/dist/src/ui/components/ThemeDialog.d.ts +20 -0
- package/dist/src/ui/components/ThemeDialog.js +138 -0
- package/dist/src/ui/components/ThemeDialog.js.map +1 -0
- package/dist/src/ui/components/Tips.d.ts +12 -0
- package/dist/src/ui/components/Tips.js +9 -0
- package/dist/src/ui/components/Tips.js.map +1 -0
- package/dist/src/ui/components/ToolStatsDisplay.d.ts +7 -0
- package/dist/src/ui/components/ToolStatsDisplay.js +41 -0
- package/dist/src/ui/components/ToolStatsDisplay.js.map +1 -0
- package/dist/src/ui/components/UpdateNotification.d.ts +10 -0
- package/dist/src/ui/components/UpdateNotification.js +10 -0
- package/dist/src/ui/components/UpdateNotification.js.map +1 -0
- package/dist/src/ui/components/WorkspaceMigrationDialog.d.ts +11 -0
- package/dist/src/ui/components/WorkspaceMigrationDialog.js +42 -0
- package/dist/src/ui/components/WorkspaceMigrationDialog.js.map +1 -0
- package/dist/src/ui/components/messages/CompressionMessage.d.ts +11 -0
- package/dist/src/ui/components/messages/CompressionMessage.js +17 -0
- package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -0
- package/dist/src/ui/components/messages/DiffRenderer.d.ts +16 -0
- package/dist/src/ui/components/messages/DiffRenderer.js +226 -0
- package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -0
- package/dist/src/ui/components/messages/DiffRenderer.test.d.ts +6 -0
- package/dist/src/ui/components/messages/DiffRenderer.test.js +239 -0
- package/dist/src/ui/components/messages/DiffRenderer.test.js.map +1 -0
- package/dist/src/ui/components/messages/ErrorMessage.d.ts +11 -0
- package/dist/src/ui/components/messages/ErrorMessage.js +9 -0
- package/dist/src/ui/components/messages/ErrorMessage.js.map +1 -0
- package/dist/src/ui/components/messages/GeminiMessage.d.ts +14 -0
- package/dist/src/ui/components/messages/GeminiMessage.js +11 -0
- package/dist/src/ui/components/messages/GeminiMessage.js.map +1 -0
- package/dist/src/ui/components/messages/GeminiMessageContent.d.ts +14 -0
- package/dist/src/ui/components/messages/GeminiMessageContent.js +15 -0
- package/dist/src/ui/components/messages/GeminiMessageContent.js.map +1 -0
- package/dist/src/ui/components/messages/InfoMessage.d.ts +11 -0
- package/dist/src/ui/components/messages/InfoMessage.js +10 -0
- package/dist/src/ui/components/messages/InfoMessage.js.map +1 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.d.ts +15 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js +162 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +114 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +18 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.js +50 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js +259 -0
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/ToolMessage.d.ts +15 -0
- package/dist/src/ui/components/messages/ToolMessage.js +62 -0
- package/dist/src/ui/components/messages/ToolMessage.js.map +1 -0
- package/dist/src/ui/components/messages/ToolMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/ToolMessage.test.js +118 -0
- package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/UserMessage.d.ts +11 -0
- package/dist/src/ui/components/messages/UserMessage.js +14 -0
- package/dist/src/ui/components/messages/UserMessage.js.map +1 -0
- package/dist/src/ui/components/messages/UserShellMessage.d.ts +11 -0
- package/dist/src/ui/components/messages/UserShellMessage.js +9 -0
- package/dist/src/ui/components/messages/UserShellMessage.js.map +1 -0
- package/dist/src/ui/components/shared/MaxSizedBox.d.ts +61 -0
- package/dist/src/ui/components/shared/MaxSizedBox.js +451 -0
- package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -0
- package/dist/src/ui/components/shared/MaxSizedBox.test.d.ts +6 -0
- package/dist/src/ui/components/shared/MaxSizedBox.test.js +154 -0
- package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +1 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +46 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.js +116 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.test.d.ts +6 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.test.js +111 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.test.js.map +1 -0
- package/dist/src/ui/components/shared/text-buffer.d.ts +467 -0
- package/dist/src/ui/components/shared/text-buffer.js +1489 -0
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.d.ts +72 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.js +552 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.js.map +1 -0
- package/dist/src/ui/constants.d.ts +17 -0
- package/dist/src/ui/constants.js +22 -0
- package/dist/src/ui/constants.js.map +1 -0
- package/dist/src/ui/contexts/KeypressContext.d.ts +31 -0
- package/dist/src/ui/contexts/KeypressContext.js +318 -0
- package/dist/src/ui/contexts/KeypressContext.js.map +1 -0
- package/dist/src/ui/contexts/KeypressContext.test.d.ts +6 -0
- package/dist/src/ui/contexts/KeypressContext.test.js +385 -0
- package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -0
- package/dist/src/ui/contexts/OverflowContext.d.ts +19 -0
- package/dist/src/ui/contexts/OverflowContext.js +38 -0
- package/dist/src/ui/contexts/OverflowContext.js.map +1 -0
- package/dist/src/ui/contexts/SessionContext.d.ts +39 -0
- package/dist/src/ui/contexts/SessionContext.js +55 -0
- package/dist/src/ui/contexts/SessionContext.js.map +1 -0
- package/dist/src/ui/contexts/SettingsContext.d.ts +9 -0
- package/dist/src/ui/contexts/SettingsContext.js +15 -0
- package/dist/src/ui/contexts/SettingsContext.js.map +1 -0
- package/dist/src/ui/contexts/StreamingContext.d.ts +9 -0
- package/dist/src/ui/contexts/StreamingContext.js +15 -0
- package/dist/src/ui/contexts/StreamingContext.js.map +1 -0
- package/dist/src/ui/contexts/VimModeContext.d.ts +19 -0
- package/dist/src/ui/contexts/VimModeContext.js +48 -0
- package/dist/src/ui/contexts/VimModeContext.js.map +1 -0
- package/dist/src/ui/editors/editorSettingsManager.d.ts +19 -0
- package/dist/src/ui/editors/editorSettingsManager.js +47 -0
- package/dist/src/ui/editors/editorSettingsManager.js.map +1 -0
- package/dist/src/ui/hooks/atCommandProcessor.d.ts +31 -0
- package/dist/src/ui/hooks/atCommandProcessor.js +364 -0
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -0
- package/dist/src/ui/hooks/atCommandProcessor.test.d.ts +6 -0
- package/dist/src/ui/hooks/atCommandProcessor.test.js +832 -0
- package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -0
- package/dist/src/ui/hooks/shellCommandProcessor.d.ts +17 -0
- package/dist/src/ui/hooks/shellCommandProcessor.js +234 -0
- package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -0
- package/dist/src/ui/hooks/shellCommandProcessor.test.d.ts +6 -0
- package/dist/src/ui/hooks/shellCommandProcessor.test.js +325 -0
- package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -0
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +29 -0
- package/dist/src/ui/hooks/slashCommandProcessor.js +443 -0
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -0
- package/dist/src/ui/hooks/useAtCompletion.d.ts +23 -0
- package/dist/src/ui/hooks/useAtCompletion.js +179 -0
- package/dist/src/ui/hooks/useAtCompletion.js.map +1 -0
- package/dist/src/ui/hooks/useAuthCommand.d.ts +15 -0
- package/dist/src/ui/hooks/useAuthCommand.js +66 -0
- package/dist/src/ui/hooks/useAuthCommand.js.map +1 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.d.ts +12 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.js +46 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.d.ts +6 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +311 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -0
- package/dist/src/ui/hooks/useBracketedPaste.d.ts +12 -0
- package/dist/src/ui/hooks/useBracketedPaste.js +32 -0
- package/dist/src/ui/hooks/useBracketedPaste.js.map +1 -0
- package/dist/src/ui/hooks/useCommandCompletion.d.ts +32 -0
- package/dist/src/ui/hooks/useCommandCompletion.js +186 -0
- package/dist/src/ui/hooks/useCommandCompletion.js.map +1 -0
- package/dist/src/ui/hooks/useCompletion.d.ts +24 -0
- package/dist/src/ui/hooks/useCompletion.js +88 -0
- package/dist/src/ui/hooks/useCompletion.js.map +1 -0
- package/dist/src/ui/hooks/useConsoleMessages.d.ts +12 -0
- package/dist/src/ui/hooks/useConsoleMessages.js +76 -0
- package/dist/src/ui/hooks/useConsoleMessages.js.map +1 -0
- package/dist/src/ui/hooks/useEditorSettings.d.ts +16 -0
- package/dist/src/ui/hooks/useEditorSettings.js +43 -0
- package/dist/src/ui/hooks/useEditorSettings.js.map +1 -0
- package/dist/src/ui/hooks/useEditorSettings.test.d.ts +6 -0
- package/dist/src/ui/hooks/useEditorSettings.test.js +164 -0
- package/dist/src/ui/hooks/useEditorSettings.test.js.map +1 -0
- package/dist/src/ui/hooks/useFocus.d.ts +10 -0
- package/dist/src/ui/hooks/useFocus.js +41 -0
- package/dist/src/ui/hooks/useFocus.js.map +1 -0
- package/dist/src/ui/hooks/useFolderTrust.d.ts +13 -0
- package/dist/src/ui/hooks/useFolderTrust.js +68 -0
- package/dist/src/ui/hooks/useFolderTrust.js.map +1 -0
- package/dist/src/ui/hooks/useGeminiStream.d.ts +25 -0
- package/dist/src/ui/hooks/useGeminiStream.js +648 -0
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -0
- package/dist/src/ui/hooks/useGitBranchName.d.ts +6 -0
- package/dist/src/ui/hooks/useGitBranchName.js +61 -0
- package/dist/src/ui/hooks/useGitBranchName.js.map +1 -0
- package/dist/src/ui/hooks/useGitBranchName.test.d.ts +6 -0
- package/dist/src/ui/hooks/useGitBranchName.test.js +175 -0
- package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -0
- package/dist/src/ui/hooks/useHistoryManager.d.ts +22 -0
- package/dist/src/ui/hooks/useHistoryManager.js +72 -0
- package/dist/src/ui/hooks/useHistoryManager.js.map +1 -0
- package/dist/src/ui/hooks/useHistoryManager.test.d.ts +6 -0
- package/dist/src/ui/hooks/useHistoryManager.test.js +171 -0
- package/dist/src/ui/hooks/useHistoryManager.test.js.map +1 -0
- package/dist/src/ui/hooks/useInputHistory.d.ts +19 -0
- package/dist/src/ui/hooks/useInputHistory.js +84 -0
- package/dist/src/ui/hooks/useInputHistory.js.map +1 -0
- package/dist/src/ui/hooks/useInputHistory.test.d.ts +6 -0
- package/dist/src/ui/hooks/useInputHistory.test.js +207 -0
- package/dist/src/ui/hooks/useInputHistory.test.js.map +1 -0
- package/dist/src/ui/hooks/useInputHistoryStore.d.ts +19 -0
- package/dist/src/ui/hooks/useInputHistoryStore.js +81 -0
- package/dist/src/ui/hooks/useInputHistoryStore.js.map +1 -0
- package/dist/src/ui/hooks/useInputHistoryStore.test.d.ts +6 -0
- package/dist/src/ui/hooks/useInputHistoryStore.test.js +234 -0
- package/dist/src/ui/hooks/useInputHistoryStore.test.js.map +1 -0
- package/dist/src/ui/hooks/useKeypress.d.ts +17 -0
- package/dist/src/ui/hooks/useKeypress.js +27 -0
- package/dist/src/ui/hooks/useKeypress.js.map +1 -0
- package/dist/src/ui/hooks/useKittyKeyboardProtocol.d.ts +15 -0
- package/dist/src/ui/hooks/useKittyKeyboardProtocol.js +20 -0
- package/dist/src/ui/hooks/useKittyKeyboardProtocol.js.map +1 -0
- package/dist/src/ui/hooks/useLoadingIndicator.d.ts +10 -0
- package/dist/src/ui/hooks/useLoadingIndicator.js +44 -0
- package/dist/src/ui/hooks/useLoadingIndicator.js.map +1 -0
- package/dist/src/ui/hooks/useLoadingIndicator.test.d.ts +6 -0
- package/dist/src/ui/hooks/useLoadingIndicator.test.js +91 -0
- package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -0
- package/dist/src/ui/hooks/useLogger.d.ts +11 -0
- package/dist/src/ui/hooks/useLogger.js +29 -0
- package/dist/src/ui/hooks/useLogger.js.map +1 -0
- package/dist/src/ui/hooks/useMessageQueue.d.ts +22 -0
- package/dist/src/ui/hooks/useMessageQueue.js +49 -0
- package/dist/src/ui/hooks/useMessageQueue.js.map +1 -0
- package/dist/src/ui/hooks/useMessageQueue.test.d.ts +6 -0
- package/dist/src/ui/hooks/useMessageQueue.test.js +158 -0
- package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -0
- package/dist/src/ui/hooks/usePhraseCycler.d.ts +14 -0
- package/dist/src/ui/hooks/usePhraseCycler.js +187 -0
- package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -0
- package/dist/src/ui/hooks/usePrivacySettings.d.ts +16 -0
- package/dist/src/ui/hooks/usePrivacySettings.js +119 -0
- package/dist/src/ui/hooks/usePrivacySettings.js.map +1 -0
- package/dist/src/ui/hooks/usePrivacySettings.test.d.ts +6 -0
- package/dist/src/ui/hooks/usePrivacySettings.test.js +154 -0
- package/dist/src/ui/hooks/usePrivacySettings.test.js.map +1 -0
- package/dist/src/ui/hooks/usePromptCompletion.d.ts +23 -0
- package/dist/src/ui/hooks/usePromptCompletion.js +177 -0
- package/dist/src/ui/hooks/usePromptCompletion.js.map +1 -0
- package/dist/src/ui/hooks/useReactToolScheduler.d.ts +33 -0
- package/dist/src/ui/hooks/useReactToolScheduler.js +186 -0
- package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -0
- package/dist/src/ui/hooks/useRefreshMemoryCommand.d.ts +6 -0
- package/dist/src/ui/hooks/useRefreshMemoryCommand.js +7 -0
- package/dist/src/ui/hooks/useRefreshMemoryCommand.js.map +1 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.d.ts +19 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.js +56 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.js.map +1 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.test.d.ts +6 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.test.js +163 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.test.js.map +1 -0
- package/dist/src/ui/hooks/useSettingsCommand.d.ts +10 -0
- package/dist/src/ui/hooks/useSettingsCommand.js +21 -0
- package/dist/src/ui/hooks/useSettingsCommand.js.map +1 -0
- package/dist/src/ui/hooks/useShellHistory.d.ts +14 -0
- package/dist/src/ui/hooks/useShellHistory.js +111 -0
- package/dist/src/ui/hooks/useShellHistory.js.map +1 -0
- package/dist/src/ui/hooks/useShellHistory.test.d.ts +6 -0
- package/dist/src/ui/hooks/useShellHistory.test.js +187 -0
- package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -0
- package/dist/src/ui/hooks/useShowMemoryCommand.d.ts +9 -0
- package/dist/src/ui/hooks/useShowMemoryCommand.js +58 -0
- package/dist/src/ui/hooks/useShowMemoryCommand.js.map +1 -0
- package/dist/src/ui/hooks/useSlashCompletion.d.ts +20 -0
- package/dist/src/ui/hooks/useSlashCompletion.js +331 -0
- package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -0
- package/dist/src/ui/hooks/useSlashCompletion.test.d.ts +9 -0
- package/dist/src/ui/hooks/useSlashCompletion.test.js +665 -0
- package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -0
- package/dist/src/ui/hooks/useStateAndRef.d.ts +7 -0
- package/dist/src/ui/hooks/useStateAndRef.js +26 -0
- package/dist/src/ui/hooks/useStateAndRef.js.map +1 -0
- package/dist/src/ui/hooks/useTerminalSize.d.ts +9 -0
- package/dist/src/ui/hooks/useTerminalSize.js +27 -0
- package/dist/src/ui/hooks/useTerminalSize.js.map +1 -0
- package/dist/src/ui/hooks/useThemeCommand.d.ts +15 -0
- package/dist/src/ui/hooks/useThemeCommand.js +79 -0
- package/dist/src/ui/hooks/useThemeCommand.js.map +1 -0
- package/dist/src/ui/hooks/useTimer.d.ts +12 -0
- package/dist/src/ui/hooks/useTimer.js +58 -0
- package/dist/src/ui/hooks/useTimer.js.map +1 -0
- package/dist/src/ui/hooks/useTimer.test.d.ts +6 -0
- package/dist/src/ui/hooks/useTimer.test.js +90 -0
- package/dist/src/ui/hooks/useTimer.test.js.map +1 -0
- package/dist/src/ui/hooks/useToolScheduler.test.d.ts +6 -0
- package/dist/src/ui/hooks/useToolScheduler.test.js +846 -0
- package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -0
- package/dist/src/ui/hooks/useWorkspaceMigration.d.ts +13 -0
- package/dist/src/ui/hooks/useWorkspaceMigration.js +53 -0
- package/dist/src/ui/hooks/useWorkspaceMigration.js.map +1 -0
- package/dist/src/ui/hooks/vim.d.ts +28 -0
- package/dist/src/ui/hooks/vim.js +639 -0
- package/dist/src/ui/hooks/vim.js.map +1 -0
- package/dist/src/ui/keyMatchers.d.ts +27 -0
- package/dist/src/ui/keyMatchers.js +68 -0
- package/dist/src/ui/keyMatchers.js.map +1 -0
- package/dist/src/ui/keyMatchers.test.d.ts +6 -0
- package/dist/src/ui/keyMatchers.test.js +276 -0
- package/dist/src/ui/keyMatchers.test.js.map +1 -0
- package/dist/src/ui/privacy/CloudFreePrivacyNotice.d.ts +12 -0
- package/dist/src/ui/privacy/CloudFreePrivacyNotice.js +41 -0
- package/dist/src/ui/privacy/CloudFreePrivacyNotice.js.map +1 -0
- package/dist/src/ui/privacy/CloudPaidPrivacyNotice.d.ts +10 -0
- package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js +18 -0
- package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js.map +1 -0
- package/dist/src/ui/privacy/GeminiPrivacyNotice.d.ts +10 -0
- package/dist/src/ui/privacy/GeminiPrivacyNotice.js +18 -0
- package/dist/src/ui/privacy/GeminiPrivacyNotice.js.map +1 -0
- package/dist/src/ui/privacy/PrivacyNotice.d.ts +12 -0
- package/dist/src/ui/privacy/PrivacyNotice.js +25 -0
- package/dist/src/ui/privacy/PrivacyNotice.js.map +1 -0
- package/dist/src/ui/semantic-colors.d.ts +7 -0
- package/dist/src/ui/semantic-colors.js +24 -0
- package/dist/src/ui/semantic-colors.js.map +1 -0
- package/dist/src/ui/textConstants.d.ts +9 -0
- package/dist/src/ui/textConstants.js +10 -0
- package/dist/src/ui/textConstants.js.map +1 -0
- package/dist/src/ui/themes/ansi-light.d.ts +7 -0
- package/dist/src/ui/themes/ansi-light.js +142 -0
- package/dist/src/ui/themes/ansi-light.js.map +1 -0
- package/dist/src/ui/themes/ansi.d.ts +7 -0
- package/dist/src/ui/themes/ansi.js +152 -0
- package/dist/src/ui/themes/ansi.js.map +1 -0
- package/dist/src/ui/themes/atom-one-dark.d.ts +7 -0
- package/dist/src/ui/themes/atom-one-dark.js +138 -0
- package/dist/src/ui/themes/atom-one-dark.js.map +1 -0
- package/dist/src/ui/themes/ayu-light.d.ts +7 -0
- package/dist/src/ui/themes/ayu-light.js +130 -0
- package/dist/src/ui/themes/ayu-light.js.map +1 -0
- package/dist/src/ui/themes/ayu.d.ts +7 -0
- package/dist/src/ui/themes/ayu.js +104 -0
- package/dist/src/ui/themes/ayu.js.map +1 -0
- package/dist/src/ui/themes/color-utils.d.ts +21 -0
- package/dist/src/ui/themes/color-utils.js +221 -0
- package/dist/src/ui/themes/color-utils.js.map +1 -0
- package/dist/src/ui/themes/color-utils.test.d.ts +6 -0
- package/dist/src/ui/themes/color-utils.test.js +197 -0
- package/dist/src/ui/themes/color-utils.test.js.map +1 -0
- package/dist/src/ui/themes/default-light.d.ts +7 -0
- package/dist/src/ui/themes/default-light.js +100 -0
- package/dist/src/ui/themes/default-light.js.map +1 -0
- package/dist/src/ui/themes/default.d.ts +7 -0
- package/dist/src/ui/themes/default.js +143 -0
- package/dist/src/ui/themes/default.js.map +1 -0
- package/dist/src/ui/themes/dracula.d.ts +7 -0
- package/dist/src/ui/themes/dracula.js +115 -0
- package/dist/src/ui/themes/dracula.js.map +1 -0
- package/dist/src/ui/themes/github-dark.d.ts +7 -0
- package/dist/src/ui/themes/github-dark.js +138 -0
- package/dist/src/ui/themes/github-dark.js.map +1 -0
- package/dist/src/ui/themes/github-light.d.ts +7 -0
- package/dist/src/ui/themes/github-light.js +140 -0
- package/dist/src/ui/themes/github-light.js.map +1 -0
- package/dist/src/ui/themes/googlecode.d.ts +7 -0
- package/dist/src/ui/themes/googlecode.js +137 -0
- package/dist/src/ui/themes/googlecode.js.map +1 -0
- package/dist/src/ui/themes/no-color.d.ts +7 -0
- package/dist/src/ui/themes/no-color.js +115 -0
- package/dist/src/ui/themes/no-color.js.map +1 -0
- package/dist/src/ui/themes/semantic-tokens.d.ts +37 -0
- package/dist/src/ui/themes/semantic-tokens.js +94 -0
- package/dist/src/ui/themes/semantic-tokens.js.map +1 -0
- package/dist/src/ui/themes/shades-of-purple.d.ts +11 -0
- package/dist/src/ui/themes/shades-of-purple.js +304 -0
- package/dist/src/ui/themes/shades-of-purple.js.map +1 -0
- package/dist/src/ui/themes/theme-manager.d.ts +66 -0
- package/dist/src/ui/themes/theme-manager.js +262 -0
- package/dist/src/ui/themes/theme-manager.js.map +1 -0
- package/dist/src/ui/themes/theme-manager.test.d.ts +6 -0
- package/dist/src/ui/themes/theme-manager.test.js +142 -0
- package/dist/src/ui/themes/theme-manager.test.js.map +1 -0
- package/dist/src/ui/themes/theme.d.ts +130 -0
- package/dist/src/ui/themes/theme.js +379 -0
- package/dist/src/ui/themes/theme.js.map +1 -0
- package/dist/src/ui/themes/xcode.d.ts +7 -0
- package/dist/src/ui/themes/xcode.js +145 -0
- package/dist/src/ui/themes/xcode.js.map +1 -0
- package/dist/src/ui/types.d.ts +193 -0
- package/dist/src/ui/types.js +44 -0
- package/dist/src/ui/types.js.map +1 -0
- package/dist/src/ui/utils/CodeColorizer.d.ts +17 -0
- package/dist/src/ui/utils/CodeColorizer.js +110 -0
- package/dist/src/ui/utils/CodeColorizer.js.map +1 -0
- package/dist/src/ui/utils/ConsolePatcher.d.ts +25 -0
- package/dist/src/ui/utils/ConsolePatcher.js +52 -0
- package/dist/src/ui/utils/ConsolePatcher.js.map +1 -0
- package/dist/src/ui/utils/InlineMarkdownRenderer.d.ts +16 -0
- package/dist/src/ui/utils/InlineMarkdownRenderer.js +111 -0
- package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -0
- package/dist/src/ui/utils/MarkdownDisplay.d.ts +14 -0
- package/dist/src/ui/utils/MarkdownDisplay.js +208 -0
- package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -0
- package/dist/src/ui/utils/MarkdownDisplay.test.d.ts +6 -0
- package/dist/src/ui/utils/MarkdownDisplay.test.js +152 -0
- package/dist/src/ui/utils/MarkdownDisplay.test.js.map +1 -0
- package/dist/src/ui/utils/TableRenderer.d.ts +17 -0
- package/dist/src/ui/utils/TableRenderer.js +84 -0
- package/dist/src/ui/utils/TableRenderer.js.map +1 -0
- package/dist/src/ui/utils/clipboardUtils.d.ts +22 -0
- package/dist/src/ui/utils/clipboardUtils.js +127 -0
- package/dist/src/ui/utils/clipboardUtils.js.map +1 -0
- package/dist/src/ui/utils/clipboardUtils.test.d.ts +6 -0
- package/dist/src/ui/utils/clipboardUtils.test.js +65 -0
- package/dist/src/ui/utils/clipboardUtils.test.js.map +1 -0
- package/dist/src/ui/utils/commandUtils.d.ts +24 -0
- package/dist/src/ui/utils/commandUtils.js +131 -0
- package/dist/src/ui/utils/commandUtils.js.map +1 -0
- package/dist/src/ui/utils/commandUtils.test.d.ts +6 -0
- package/dist/src/ui/utils/commandUtils.test.js +349 -0
- package/dist/src/ui/utils/commandUtils.test.js.map +1 -0
- package/dist/src/ui/utils/computeStats.d.ts +10 -0
- package/dist/src/ui/utils/computeStats.js +57 -0
- package/dist/src/ui/utils/computeStats.js.map +1 -0
- package/dist/src/ui/utils/displayUtils.d.ts +17 -0
- package/dist/src/ui/utils/displayUtils.js +24 -0
- package/dist/src/ui/utils/displayUtils.js.map +1 -0
- package/dist/src/ui/utils/displayUtils.test.d.ts +6 -0
- package/dist/src/ui/utils/displayUtils.test.js +42 -0
- package/dist/src/ui/utils/displayUtils.test.js.map +1 -0
- package/dist/src/ui/utils/formatters.d.ts +13 -0
- package/dist/src/ui/utils/formatters.js +56 -0
- package/dist/src/ui/utils/formatters.js.map +1 -0
- package/dist/src/ui/utils/formatters.test.d.ts +6 -0
- package/dist/src/ui/utils/formatters.test.js +56 -0
- package/dist/src/ui/utils/formatters.test.js.map +1 -0
- package/dist/src/ui/utils/isNarrowWidth.d.ts +6 -0
- package/dist/src/ui/utils/isNarrowWidth.js +9 -0
- package/dist/src/ui/utils/isNarrowWidth.js.map +1 -0
- package/dist/src/ui/utils/kittyProtocolDetector.d.ts +13 -0
- package/dist/src/ui/utils/kittyProtocolDetector.js +88 -0
- package/dist/src/ui/utils/kittyProtocolDetector.js.map +1 -0
- package/dist/src/ui/utils/markdownUtilities.d.ts +6 -0
- package/dist/src/ui/utils/markdownUtilities.js +110 -0
- package/dist/src/ui/utils/markdownUtilities.js.map +1 -0
- package/dist/src/ui/utils/markdownUtilities.test.d.ts +6 -0
- package/dist/src/ui/utils/markdownUtilities.test.js +42 -0
- package/dist/src/ui/utils/markdownUtilities.test.js.map +1 -0
- package/dist/src/ui/utils/platformConstants.d.ts +52 -0
- package/dist/src/ui/utils/platformConstants.js +53 -0
- package/dist/src/ui/utils/platformConstants.js.map +1 -0
- package/dist/src/ui/utils/terminalSetup.d.ts +30 -0
- package/dist/src/ui/utils/terminalSetup.js +281 -0
- package/dist/src/ui/utils/terminalSetup.js.map +1 -0
- package/dist/src/ui/utils/textUtils.d.ts +32 -0
- package/dist/src/ui/utils/textUtils.js +80 -0
- package/dist/src/ui/utils/textUtils.js.map +1 -0
- package/dist/src/ui/utils/updateCheck.d.ts +12 -0
- package/dist/src/ui/utils/updateCheck.js +78 -0
- package/dist/src/ui/utils/updateCheck.js.map +1 -0
- package/dist/src/ui/utils/updateCheck.test.d.ts +6 -0
- package/dist/src/ui/utils/updateCheck.test.js +145 -0
- package/dist/src/ui/utils/updateCheck.test.js.map +1 -0
- package/dist/src/utils/checks.d.ts +19 -0
- package/dist/src/utils/checks.js +24 -0
- package/dist/src/utils/checks.js.map +1 -0
- package/dist/src/utils/cleanup.d.ts +8 -0
- package/dist/src/utils/cleanup.js +35 -0
- package/dist/src/utils/cleanup.js.map +1 -0
- package/dist/src/utils/dialogScopeUtils.d.ts +32 -0
- package/dist/src/utils/dialogScopeUtils.js +48 -0
- package/dist/src/utils/dialogScopeUtils.js.map +1 -0
- package/dist/src/utils/envVarResolver.d.ts +39 -0
- package/dist/src/utils/envVarResolver.js +97 -0
- package/dist/src/utils/envVarResolver.js.map +1 -0
- package/dist/src/utils/envVarResolver.test.d.ts +6 -0
- package/dist/src/utils/envVarResolver.test.js +221 -0
- package/dist/src/utils/envVarResolver.test.js.map +1 -0
- package/dist/src/utils/errors.d.ts +6 -0
- package/dist/src/utils/errors.js +12 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/events.d.ts +11 -0
- package/dist/src/utils/events.js +13 -0
- package/dist/src/utils/events.js.map +1 -0
- package/dist/src/utils/gitUtils.d.ts +30 -0
- package/dist/src/utils/gitUtils.js +89 -0
- package/dist/src/utils/gitUtils.js.map +1 -0
- package/dist/src/utils/gitUtils.test.d.ts +6 -0
- package/dist/src/utils/gitUtils.test.js +113 -0
- package/dist/src/utils/gitUtils.test.js.map +1 -0
- package/dist/src/utils/handleAutoUpdate.d.ts +11 -0
- package/dist/src/utils/handleAutoUpdate.js +102 -0
- package/dist/src/utils/handleAutoUpdate.js.map +1 -0
- package/dist/src/utils/installationInfo.d.ts +23 -0
- package/dist/src/utils/installationInfo.js +154 -0
- package/dist/src/utils/installationInfo.js.map +1 -0
- package/dist/src/utils/installationInfo.test.d.ts +6 -0
- package/dist/src/utils/installationInfo.test.js +242 -0
- package/dist/src/utils/installationInfo.test.js.map +1 -0
- package/dist/src/utils/package.d.ts +12 -0
- package/dist/src/utils/package.js +24 -0
- package/dist/src/utils/package.js.map +1 -0
- package/dist/src/utils/readStdin.d.ts +6 -0
- package/dist/src/utils/readStdin.js +59 -0
- package/dist/src/utils/readStdin.js.map +1 -0
- package/dist/src/utils/readStdin.test.d.ts +6 -0
- package/dist/src/utils/readStdin.test.js +88 -0
- package/dist/src/utils/readStdin.test.js.map +1 -0
- package/dist/src/utils/resolvePath.d.ts +6 -0
- package/dist/src/utils/resolvePath.js +21 -0
- package/dist/src/utils/resolvePath.js.map +1 -0
- package/dist/src/utils/sandbox-macos-permissive-closed.sb +32 -0
- package/dist/src/utils/sandbox-macos-permissive-open.sb +25 -0
- package/dist/src/utils/sandbox-macos-permissive-proxied.sb +37 -0
- package/dist/src/utils/sandbox-macos-restrictive-closed.sb +93 -0
- package/dist/src/utils/sandbox-macos-restrictive-open.sb +96 -0
- package/dist/src/utils/sandbox-macos-restrictive-proxied.sb +98 -0
- package/dist/src/utils/sandbox.d.ts +7 -0
- package/dist/src/utils/sandbox.js +724 -0
- package/dist/src/utils/sandbox.js.map +1 -0
- package/dist/src/utils/settingsUtils.d.ts +134 -0
- package/dist/src/utils/settingsUtils.js +330 -0
- package/dist/src/utils/settingsUtils.js.map +1 -0
- package/dist/src/utils/settingsUtils.test.d.ts +6 -0
- package/dist/src/utils/settingsUtils.test.js +511 -0
- package/dist/src/utils/settingsUtils.test.js.map +1 -0
- package/dist/src/utils/spawnWrapper.d.ts +7 -0
- package/dist/src/utils/spawnWrapper.js +8 -0
- package/dist/src/utils/spawnWrapper.js.map +1 -0
- package/dist/src/utils/startupWarnings.d.ts +6 -0
- package/dist/src/utils/startupWarnings.js +40 -0
- package/dist/src/utils/startupWarnings.js.map +1 -0
- package/dist/src/utils/updateEventEmitter.d.ts +11 -0
- package/dist/src/utils/updateEventEmitter.js +12 -0
- package/dist/src/utils/updateEventEmitter.js.map +1 -0
- package/dist/src/utils/userStartupWarnings.d.ts +6 -0
- package/dist/src/utils/userStartupWarnings.js +54 -0
- package/dist/src/utils/userStartupWarnings.js.map +1 -0
- package/dist/src/utils/userStartupWarnings.test.d.ts +6 -0
- package/dist/src/utils/userStartupWarnings.test.js +67 -0
- package/dist/src/utils/userStartupWarnings.test.js.map +1 -0
- package/dist/src/utils/version.d.ts +6 -0
- package/dist/src/utils/version.js +11 -0
- package/dist/src/utils/version.js.map +1 -0
- package/dist/src/validateNonInterActiveAuth.d.ts +8 -0
- package/dist/src/validateNonInterActiveAuth.js +37 -0
- package/dist/src/validateNonInterActiveAuth.js.map +1 -0
- package/dist/src/zed-integration/acp.d.ts +63 -0
- package/dist/src/zed-integration/acp.js +226 -0
- package/dist/src/zed-integration/acp.js.map +1 -0
- package/dist/src/zed-integration/fileSystemService.d.ts +19 -0
- package/dist/src/zed-integration/fileSystemService.js +43 -0
- package/dist/src/zed-integration/fileSystemService.js.map +1 -0
- package/dist/src/zed-integration/schema.d.ts +11782 -0
- package/dist/src/zed-integration/schema.js +311 -0
- package/dist/src/zed-integration/schema.js.map +1 -0
- package/dist/src/zed-integration/zedIntegration.d.ts +10 -0
- package/dist/src/zed-integration/zedIntegration.js +740 -0
- package/dist/src/zed-integration/zedIntegration.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +107 -0
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/** @vitest-environment jsdom */
|
|
7
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
8
|
+
import { renderHook, waitFor } from '@testing-library/react';
|
|
9
|
+
import { useSlashCompletion } from './useSlashCompletion.js';
|
|
10
|
+
import { CommandKind } from '../commands/types.js';
|
|
11
|
+
import { useState } from 'react';
|
|
12
|
+
function createTestCommand(command) {
|
|
13
|
+
return {
|
|
14
|
+
kind: CommandKind.BUILT_IN, // default for tests
|
|
15
|
+
...command,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
// Track AsyncFzf constructor calls for cache testing
|
|
19
|
+
let asyncFzfConstructorCalls = 0;
|
|
20
|
+
const resetConstructorCallCount = () => {
|
|
21
|
+
asyncFzfConstructorCalls = 0;
|
|
22
|
+
};
|
|
23
|
+
const getConstructorCallCount = () => asyncFzfConstructorCalls;
|
|
24
|
+
// Centralized fuzzy matching simulation logic
|
|
25
|
+
// Note: This is a simplified reimplementation that may diverge from real fzf behavior.
|
|
26
|
+
// Integration tests in useSlashCompletion.integration.test.ts use the real fzf library
|
|
27
|
+
// to catch any behavioral differences and serve as our "canary in a coal mine."
|
|
28
|
+
function simulateFuzzyMatching(items, query) {
|
|
29
|
+
const results = [];
|
|
30
|
+
if (query) {
|
|
31
|
+
const lowerQuery = query.toLowerCase();
|
|
32
|
+
for (const item of items) {
|
|
33
|
+
const lowerItem = item.toLowerCase();
|
|
34
|
+
// Exact match gets highest score
|
|
35
|
+
if (lowerItem === lowerQuery) {
|
|
36
|
+
results.push({
|
|
37
|
+
item,
|
|
38
|
+
positions: [],
|
|
39
|
+
score: 100,
|
|
40
|
+
start: 0,
|
|
41
|
+
end: item.length,
|
|
42
|
+
});
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
// Prefix match gets high score
|
|
46
|
+
if (lowerItem.startsWith(lowerQuery)) {
|
|
47
|
+
results.push({
|
|
48
|
+
item,
|
|
49
|
+
positions: [],
|
|
50
|
+
score: 80,
|
|
51
|
+
start: 0,
|
|
52
|
+
end: query.length,
|
|
53
|
+
});
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
// Fuzzy matching: check if query chars appear in order
|
|
57
|
+
let queryIndex = 0;
|
|
58
|
+
let score = 0;
|
|
59
|
+
for (let i = 0; i < lowerItem.length && queryIndex < lowerQuery.length; i++) {
|
|
60
|
+
if (lowerItem[i] === lowerQuery[queryIndex]) {
|
|
61
|
+
queryIndex++;
|
|
62
|
+
score += 10 - i; // Earlier matches get higher scores
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// If all query characters were found in order, include this item
|
|
66
|
+
if (queryIndex === lowerQuery.length) {
|
|
67
|
+
results.push({
|
|
68
|
+
item,
|
|
69
|
+
positions: [],
|
|
70
|
+
score,
|
|
71
|
+
start: 0,
|
|
72
|
+
end: query.length,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Sort by score descending (better matches first)
|
|
78
|
+
results.sort((a, b) => b.score - a.score);
|
|
79
|
+
return Promise.resolve(results);
|
|
80
|
+
}
|
|
81
|
+
// Mock the fzf module to provide a working fuzzy search implementation for tests
|
|
82
|
+
vi.mock('fzf', async () => {
|
|
83
|
+
const actual = await vi.importActual('fzf');
|
|
84
|
+
return {
|
|
85
|
+
...actual,
|
|
86
|
+
AsyncFzf: vi.fn().mockImplementation((items, _options) => {
|
|
87
|
+
asyncFzfConstructorCalls++;
|
|
88
|
+
return {
|
|
89
|
+
find: vi
|
|
90
|
+
.fn()
|
|
91
|
+
.mockImplementation((query) => simulateFuzzyMatching(items, query)),
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
+
};
|
|
94
|
+
}),
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
// Default mock behavior helper - now uses centralized logic
|
|
98
|
+
const createDefaultAsyncFzfMock = () => (items, _options) => {
|
|
99
|
+
asyncFzfConstructorCalls++;
|
|
100
|
+
return {
|
|
101
|
+
find: vi
|
|
102
|
+
.fn()
|
|
103
|
+
.mockImplementation((query) => simulateFuzzyMatching(items, query)),
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
// Export test utilities
|
|
108
|
+
export { resetConstructorCallCount, getConstructorCallCount, createDefaultAsyncFzfMock, };
|
|
109
|
+
// Test harness to capture the state from the hook's callbacks.
|
|
110
|
+
function useTestHarnessForSlashCompletion(enabled, query, slashCommands, commandContext) {
|
|
111
|
+
const [suggestions, setSuggestions] = useState([]);
|
|
112
|
+
const [isLoadingSuggestions, setIsLoadingSuggestions] = useState(false);
|
|
113
|
+
const [isPerfectMatch, setIsPerfectMatch] = useState(false);
|
|
114
|
+
const { completionStart, completionEnd } = useSlashCompletion({
|
|
115
|
+
enabled,
|
|
116
|
+
query,
|
|
117
|
+
slashCommands,
|
|
118
|
+
commandContext,
|
|
119
|
+
setSuggestions,
|
|
120
|
+
setIsLoadingSuggestions,
|
|
121
|
+
setIsPerfectMatch,
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
suggestions,
|
|
125
|
+
isLoadingSuggestions,
|
|
126
|
+
isPerfectMatch,
|
|
127
|
+
completionStart,
|
|
128
|
+
completionEnd,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
describe('useSlashCompletion', () => {
|
|
132
|
+
// A minimal mock is sufficient for these tests.
|
|
133
|
+
const mockCommandContext = {};
|
|
134
|
+
describe('Top-Level Commands', () => {
|
|
135
|
+
it('should suggest all top-level commands for the root slash', async () => {
|
|
136
|
+
const slashCommands = [
|
|
137
|
+
createTestCommand({
|
|
138
|
+
name: 'help',
|
|
139
|
+
altNames: ['?'],
|
|
140
|
+
description: 'Show help',
|
|
141
|
+
}),
|
|
142
|
+
createTestCommand({
|
|
143
|
+
name: 'stats',
|
|
144
|
+
altNames: ['usage'],
|
|
145
|
+
description: 'check session stats. Usage: /stats [model|tools]',
|
|
146
|
+
}),
|
|
147
|
+
createTestCommand({ name: 'clear', description: 'Clear the screen' }),
|
|
148
|
+
createTestCommand({
|
|
149
|
+
name: 'memory',
|
|
150
|
+
description: 'Manage memory',
|
|
151
|
+
subCommands: [
|
|
152
|
+
createTestCommand({ name: 'show', description: 'Show memory' }),
|
|
153
|
+
],
|
|
154
|
+
}),
|
|
155
|
+
createTestCommand({ name: 'chat', description: 'Manage chat history' }),
|
|
156
|
+
];
|
|
157
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/', slashCommands, mockCommandContext));
|
|
158
|
+
expect(result.current.suggestions.length).toBe(slashCommands.length);
|
|
159
|
+
expect(result.current.suggestions.map((s) => s.label)).toEqual(expect.arrayContaining(['help', 'clear', 'memory', 'chat', 'stats']));
|
|
160
|
+
});
|
|
161
|
+
it('should filter commands based on partial input', async () => {
|
|
162
|
+
const slashCommands = [
|
|
163
|
+
createTestCommand({ name: 'memory', description: 'Manage memory' }),
|
|
164
|
+
];
|
|
165
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/mem', slashCommands, mockCommandContext));
|
|
166
|
+
await waitFor(() => {
|
|
167
|
+
expect(result.current.suggestions).toEqual([
|
|
168
|
+
{ label: 'memory', value: 'memory', description: 'Manage memory' },
|
|
169
|
+
]);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
it('should suggest commands based on partial altNames', async () => {
|
|
173
|
+
const slashCommands = [
|
|
174
|
+
createTestCommand({
|
|
175
|
+
name: 'stats',
|
|
176
|
+
altNames: ['usage'],
|
|
177
|
+
description: 'check session stats. Usage: /stats [model|tools]',
|
|
178
|
+
}),
|
|
179
|
+
];
|
|
180
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/usag', slashCommands, mockCommandContext));
|
|
181
|
+
await waitFor(() => {
|
|
182
|
+
expect(result.current.suggestions).toEqual([
|
|
183
|
+
{
|
|
184
|
+
label: 'stats',
|
|
185
|
+
value: 'stats',
|
|
186
|
+
description: 'check session stats. Usage: /stats [model|tools]',
|
|
187
|
+
},
|
|
188
|
+
]);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
it('should NOT provide suggestions for a perfectly typed command that is a leaf node', async () => {
|
|
192
|
+
const slashCommands = [
|
|
193
|
+
createTestCommand({
|
|
194
|
+
name: 'clear',
|
|
195
|
+
description: 'Clear the screen',
|
|
196
|
+
action: vi.fn(),
|
|
197
|
+
}),
|
|
198
|
+
];
|
|
199
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/clear', slashCommands, mockCommandContext));
|
|
200
|
+
expect(result.current.suggestions).toHaveLength(0);
|
|
201
|
+
});
|
|
202
|
+
it.each([['/?'], ['/usage']])('should not suggest commands when altNames is fully typed', async (query) => {
|
|
203
|
+
const mockSlashCommands = [
|
|
204
|
+
createTestCommand({
|
|
205
|
+
name: 'help',
|
|
206
|
+
altNames: ['?'],
|
|
207
|
+
description: 'Show help',
|
|
208
|
+
action: vi.fn(),
|
|
209
|
+
}),
|
|
210
|
+
createTestCommand({
|
|
211
|
+
name: 'stats',
|
|
212
|
+
altNames: ['usage'],
|
|
213
|
+
description: 'check session stats. Usage: /stats [model|tools]',
|
|
214
|
+
action: vi.fn(),
|
|
215
|
+
}),
|
|
216
|
+
];
|
|
217
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, query, mockSlashCommands, mockCommandContext));
|
|
218
|
+
expect(result.current.suggestions).toHaveLength(0);
|
|
219
|
+
});
|
|
220
|
+
it('should not provide suggestions for a fully typed command that has no sub-commands or argument completion', async () => {
|
|
221
|
+
const slashCommands = [
|
|
222
|
+
createTestCommand({ name: 'clear', description: 'Clear the screen' }),
|
|
223
|
+
];
|
|
224
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/clear ', slashCommands, mockCommandContext));
|
|
225
|
+
expect(result.current.suggestions).toHaveLength(0);
|
|
226
|
+
});
|
|
227
|
+
it('should not provide suggestions for an unknown command', async () => {
|
|
228
|
+
const slashCommands = [
|
|
229
|
+
createTestCommand({ name: 'help', description: 'Show help' }),
|
|
230
|
+
];
|
|
231
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/unknown-command', slashCommands, mockCommandContext));
|
|
232
|
+
expect(result.current.suggestions).toHaveLength(0);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
describe('Sub-Commands', () => {
|
|
236
|
+
it('should suggest sub-commands for a parent command', async () => {
|
|
237
|
+
const slashCommands = [
|
|
238
|
+
createTestCommand({
|
|
239
|
+
name: 'memory',
|
|
240
|
+
description: 'Manage memory',
|
|
241
|
+
subCommands: [
|
|
242
|
+
createTestCommand({ name: 'show', description: 'Show memory' }),
|
|
243
|
+
createTestCommand({ name: 'add', description: 'Add to memory' }),
|
|
244
|
+
],
|
|
245
|
+
}),
|
|
246
|
+
];
|
|
247
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/memory', slashCommands, mockCommandContext));
|
|
248
|
+
expect(result.current.suggestions).toHaveLength(2);
|
|
249
|
+
expect(result.current.suggestions).toEqual(expect.arrayContaining([
|
|
250
|
+
{ label: 'show', value: 'show', description: 'Show memory' },
|
|
251
|
+
{ label: 'add', value: 'add', description: 'Add to memory' },
|
|
252
|
+
]));
|
|
253
|
+
});
|
|
254
|
+
it('should suggest all sub-commands when the query ends with the parent command and a space', async () => {
|
|
255
|
+
const slashCommands = [
|
|
256
|
+
createTestCommand({
|
|
257
|
+
name: 'memory',
|
|
258
|
+
description: 'Manage memory',
|
|
259
|
+
subCommands: [
|
|
260
|
+
createTestCommand({ name: 'show', description: 'Show memory' }),
|
|
261
|
+
createTestCommand({ name: 'add', description: 'Add to memory' }),
|
|
262
|
+
],
|
|
263
|
+
}),
|
|
264
|
+
];
|
|
265
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/memory ', slashCommands, mockCommandContext));
|
|
266
|
+
expect(result.current.suggestions).toHaveLength(2);
|
|
267
|
+
expect(result.current.suggestions).toEqual(expect.arrayContaining([
|
|
268
|
+
{ label: 'show', value: 'show', description: 'Show memory' },
|
|
269
|
+
{ label: 'add', value: 'add', description: 'Add to memory' },
|
|
270
|
+
]));
|
|
271
|
+
});
|
|
272
|
+
it('should filter sub-commands by prefix', async () => {
|
|
273
|
+
const slashCommands = [
|
|
274
|
+
createTestCommand({
|
|
275
|
+
name: 'memory',
|
|
276
|
+
description: 'Manage memory',
|
|
277
|
+
subCommands: [
|
|
278
|
+
createTestCommand({ name: 'show', description: 'Show memory' }),
|
|
279
|
+
createTestCommand({ name: 'add', description: 'Add to memory' }),
|
|
280
|
+
],
|
|
281
|
+
}),
|
|
282
|
+
];
|
|
283
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/memory a', slashCommands, mockCommandContext));
|
|
284
|
+
await waitFor(() => {
|
|
285
|
+
expect(result.current.suggestions).toEqual([
|
|
286
|
+
{ label: 'add', value: 'add', description: 'Add to memory' },
|
|
287
|
+
]);
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
it('should provide no suggestions for an invalid sub-command', async () => {
|
|
291
|
+
const slashCommands = [
|
|
292
|
+
createTestCommand({
|
|
293
|
+
name: 'memory',
|
|
294
|
+
description: 'Manage memory',
|
|
295
|
+
subCommands: [
|
|
296
|
+
createTestCommand({ name: 'show', description: 'Show memory' }),
|
|
297
|
+
createTestCommand({ name: 'add', description: 'Add to memory' }),
|
|
298
|
+
],
|
|
299
|
+
}),
|
|
300
|
+
];
|
|
301
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/memory dothisnow', slashCommands, mockCommandContext));
|
|
302
|
+
expect(result.current.suggestions).toHaveLength(0);
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
describe('Argument Completion', () => {
|
|
306
|
+
it('should call the command.completion function for argument suggestions', async () => {
|
|
307
|
+
const availableTags = [
|
|
308
|
+
'my-chat-tag-1',
|
|
309
|
+
'my-chat-tag-2',
|
|
310
|
+
'another-channel',
|
|
311
|
+
];
|
|
312
|
+
const mockCompletionFn = vi
|
|
313
|
+
.fn()
|
|
314
|
+
.mockImplementation(async (_context, partialArg) => availableTags.filter((tag) => tag.startsWith(partialArg)));
|
|
315
|
+
const slashCommands = [
|
|
316
|
+
createTestCommand({
|
|
317
|
+
name: 'chat',
|
|
318
|
+
description: 'Manage chat history',
|
|
319
|
+
subCommands: [
|
|
320
|
+
createTestCommand({
|
|
321
|
+
name: 'resume',
|
|
322
|
+
description: 'Resume a saved chat',
|
|
323
|
+
completion: mockCompletionFn,
|
|
324
|
+
}),
|
|
325
|
+
],
|
|
326
|
+
}),
|
|
327
|
+
];
|
|
328
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/chat resume my-ch', slashCommands, mockCommandContext));
|
|
329
|
+
await waitFor(() => {
|
|
330
|
+
expect(mockCompletionFn).toHaveBeenCalledWith(mockCommandContext, 'my-ch');
|
|
331
|
+
});
|
|
332
|
+
await waitFor(() => {
|
|
333
|
+
expect(result.current.suggestions).toEqual([
|
|
334
|
+
{ label: 'my-chat-tag-1', value: 'my-chat-tag-1' },
|
|
335
|
+
{ label: 'my-chat-tag-2', value: 'my-chat-tag-2' },
|
|
336
|
+
]);
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
it('should call command.completion with an empty string when args start with a space', async () => {
|
|
340
|
+
const mockCompletionFn = vi
|
|
341
|
+
.fn()
|
|
342
|
+
.mockResolvedValue(['my-chat-tag-1', 'my-chat-tag-2', 'my-channel']);
|
|
343
|
+
const slashCommands = [
|
|
344
|
+
createTestCommand({
|
|
345
|
+
name: 'chat',
|
|
346
|
+
description: 'Manage chat history',
|
|
347
|
+
subCommands: [
|
|
348
|
+
createTestCommand({
|
|
349
|
+
name: 'resume',
|
|
350
|
+
description: 'Resume a saved chat',
|
|
351
|
+
completion: mockCompletionFn,
|
|
352
|
+
}),
|
|
353
|
+
],
|
|
354
|
+
}),
|
|
355
|
+
];
|
|
356
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/chat resume ', slashCommands, mockCommandContext));
|
|
357
|
+
await waitFor(() => {
|
|
358
|
+
expect(mockCompletionFn).toHaveBeenCalledWith(mockCommandContext, '');
|
|
359
|
+
});
|
|
360
|
+
await waitFor(() => {
|
|
361
|
+
expect(result.current.suggestions).toHaveLength(3);
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
it('should handle completion function that returns null', async () => {
|
|
365
|
+
const completionFn = vi.fn().mockResolvedValue(null);
|
|
366
|
+
const slashCommands = [
|
|
367
|
+
createTestCommand({
|
|
368
|
+
name: 'chat',
|
|
369
|
+
description: 'Manage chat history',
|
|
370
|
+
subCommands: [
|
|
371
|
+
createTestCommand({
|
|
372
|
+
name: 'resume',
|
|
373
|
+
description: 'Resume a saved chat',
|
|
374
|
+
completion: completionFn,
|
|
375
|
+
}),
|
|
376
|
+
],
|
|
377
|
+
}),
|
|
378
|
+
];
|
|
379
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/chat resume ', slashCommands, mockCommandContext));
|
|
380
|
+
await waitFor(() => {
|
|
381
|
+
expect(result.current.suggestions).toHaveLength(0);
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
describe('Fuzzy Matching', () => {
|
|
386
|
+
const fuzzyTestCommands = [
|
|
387
|
+
createTestCommand({
|
|
388
|
+
name: 'help',
|
|
389
|
+
altNames: ['?'],
|
|
390
|
+
description: 'Show help',
|
|
391
|
+
}),
|
|
392
|
+
createTestCommand({
|
|
393
|
+
name: 'history',
|
|
394
|
+
description: 'Show command history',
|
|
395
|
+
}),
|
|
396
|
+
createTestCommand({ name: 'hello', description: 'Hello world command' }),
|
|
397
|
+
createTestCommand({
|
|
398
|
+
name: 'config',
|
|
399
|
+
altNames: ['configure'],
|
|
400
|
+
description: 'Configure settings',
|
|
401
|
+
}),
|
|
402
|
+
createTestCommand({ name: 'clear', description: 'Clear the screen' }),
|
|
403
|
+
];
|
|
404
|
+
it('should match commands with fuzzy search for partial queries', async () => {
|
|
405
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/he', fuzzyTestCommands, mockCommandContext));
|
|
406
|
+
await waitFor(() => {
|
|
407
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
408
|
+
});
|
|
409
|
+
const labels = result.current.suggestions.map((s) => s.label);
|
|
410
|
+
expect(labels).toEqual(expect.arrayContaining(['help', 'hello']));
|
|
411
|
+
});
|
|
412
|
+
it('should handle case-insensitive fuzzy matching', async () => {
|
|
413
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/HeLp', fuzzyTestCommands, mockCommandContext));
|
|
414
|
+
await waitFor(() => {
|
|
415
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
416
|
+
});
|
|
417
|
+
const labels = result.current.suggestions.map((s) => s.label);
|
|
418
|
+
expect(labels).toContain('help');
|
|
419
|
+
});
|
|
420
|
+
it('should provide typo-tolerant matching', async () => {
|
|
421
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/hlp', fuzzyTestCommands, mockCommandContext));
|
|
422
|
+
await waitFor(() => {
|
|
423
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
424
|
+
});
|
|
425
|
+
const labels = result.current.suggestions.map((s) => s.label);
|
|
426
|
+
expect(labels).toContain('help');
|
|
427
|
+
});
|
|
428
|
+
it('should match against alternative names with fuzzy search', async () => {
|
|
429
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/conf', fuzzyTestCommands, mockCommandContext));
|
|
430
|
+
await waitFor(() => {
|
|
431
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
432
|
+
});
|
|
433
|
+
const labels = result.current.suggestions.map((s) => s.label);
|
|
434
|
+
expect(labels).toContain('config');
|
|
435
|
+
});
|
|
436
|
+
it('should fallback to prefix matching when AsyncFzf find fails', async () => {
|
|
437
|
+
// Mock console.error to avoid noise in test output
|
|
438
|
+
const consoleErrorSpy = vi
|
|
439
|
+
.spyOn(console, 'error')
|
|
440
|
+
.mockImplementation(() => { });
|
|
441
|
+
// Import the mocked AsyncFzf
|
|
442
|
+
const { AsyncFzf } = await import('fzf');
|
|
443
|
+
// Create a failing find method for this specific test
|
|
444
|
+
const mockFind = vi
|
|
445
|
+
.fn()
|
|
446
|
+
.mockRejectedValue(new Error('AsyncFzf find failed'));
|
|
447
|
+
// Mock AsyncFzf to return an instance with failing find
|
|
448
|
+
vi.mocked(AsyncFzf).mockImplementation((_items, _options) => ({
|
|
449
|
+
finder: vi.fn(),
|
|
450
|
+
find: mockFind,
|
|
451
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
452
|
+
}));
|
|
453
|
+
const testCommands = [
|
|
454
|
+
createTestCommand({ name: 'clear', description: 'Clear the screen' }),
|
|
455
|
+
createTestCommand({
|
|
456
|
+
name: 'config',
|
|
457
|
+
description: 'Configure settings',
|
|
458
|
+
}),
|
|
459
|
+
createTestCommand({ name: 'chat', description: 'Start chat' }),
|
|
460
|
+
];
|
|
461
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/cle', testCommands, mockCommandContext));
|
|
462
|
+
await waitFor(() => {
|
|
463
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
464
|
+
});
|
|
465
|
+
// Should still get suggestions via prefix matching fallback
|
|
466
|
+
const labels = result.current.suggestions.map((s) => s.label);
|
|
467
|
+
expect(labels).toContain('clear');
|
|
468
|
+
expect(labels).not.toContain('config'); // Doesn't start with 'cle'
|
|
469
|
+
expect(labels).not.toContain('chat'); // Doesn't start with 'cle'
|
|
470
|
+
// Verify the error was logged
|
|
471
|
+
await waitFor(() => {
|
|
472
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('[Fuzzy search - falling back to prefix matching]', expect.any(Error));
|
|
473
|
+
});
|
|
474
|
+
consoleErrorSpy.mockRestore();
|
|
475
|
+
// Reset AsyncFzf mock to default behavior for other tests
|
|
476
|
+
vi.mocked(AsyncFzf).mockImplementation(createDefaultAsyncFzfMock());
|
|
477
|
+
});
|
|
478
|
+
it('should show all commands for empty partial query', async () => {
|
|
479
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/', fuzzyTestCommands, mockCommandContext));
|
|
480
|
+
expect(result.current.suggestions.length).toBe(fuzzyTestCommands.length);
|
|
481
|
+
});
|
|
482
|
+
it('should handle AsyncFzf errors gracefully and fallback to prefix matching', async () => {
|
|
483
|
+
// Mock console.error to avoid noise in test output
|
|
484
|
+
const consoleErrorSpy = vi
|
|
485
|
+
.spyOn(console, 'error')
|
|
486
|
+
.mockImplementation(() => { });
|
|
487
|
+
// Import the mocked AsyncFzf
|
|
488
|
+
const { AsyncFzf } = await import('fzf');
|
|
489
|
+
// Create a failing find method for this specific test
|
|
490
|
+
const mockFind = vi
|
|
491
|
+
.fn()
|
|
492
|
+
.mockRejectedValue(new Error('AsyncFzf error in find'));
|
|
493
|
+
// Mock AsyncFzf to return an instance with failing find
|
|
494
|
+
vi.mocked(AsyncFzf).mockImplementation((_items, _options) => ({
|
|
495
|
+
finder: vi.fn(),
|
|
496
|
+
find: mockFind,
|
|
497
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
498
|
+
}));
|
|
499
|
+
const testCommands = [
|
|
500
|
+
{ name: 'test', description: 'Test command' },
|
|
501
|
+
{ name: 'temp', description: 'Temporary command' },
|
|
502
|
+
];
|
|
503
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/te', testCommands, mockCommandContext));
|
|
504
|
+
await waitFor(() => {
|
|
505
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
506
|
+
});
|
|
507
|
+
// Should get suggestions via prefix matching fallback
|
|
508
|
+
const labels = result.current.suggestions.map((s) => s.label);
|
|
509
|
+
expect(labels).toEqual(expect.arrayContaining(['test', 'temp']));
|
|
510
|
+
// Verify the error was logged
|
|
511
|
+
await waitFor(() => {
|
|
512
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('[Fuzzy search - falling back to prefix matching]', expect.any(Error));
|
|
513
|
+
});
|
|
514
|
+
consoleErrorSpy.mockRestore();
|
|
515
|
+
// Reset AsyncFzf mock to default behavior for other tests
|
|
516
|
+
vi.mocked(AsyncFzf).mockImplementation(createDefaultAsyncFzfMock());
|
|
517
|
+
});
|
|
518
|
+
it('should cache AsyncFzf instances for performance', async () => {
|
|
519
|
+
// Reset constructor call count and ensure mock is set up correctly
|
|
520
|
+
resetConstructorCallCount();
|
|
521
|
+
// Import the mocked AsyncFzf
|
|
522
|
+
const { AsyncFzf } = await import('fzf');
|
|
523
|
+
vi.mocked(AsyncFzf).mockImplementation(createDefaultAsyncFzfMock());
|
|
524
|
+
const { result, rerender } = renderHook(({ query }) => useTestHarnessForSlashCompletion(true, query, fuzzyTestCommands, mockCommandContext), { initialProps: { query: '/he' } });
|
|
525
|
+
await waitFor(() => {
|
|
526
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
527
|
+
});
|
|
528
|
+
const firstResults = result.current.suggestions.map((s) => s.label);
|
|
529
|
+
const callCountAfterFirst = getConstructorCallCount();
|
|
530
|
+
expect(callCountAfterFirst).toBeGreaterThan(0);
|
|
531
|
+
// Rerender with same query - should use cached instance
|
|
532
|
+
rerender({ query: '/he' });
|
|
533
|
+
await waitFor(() => {
|
|
534
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
535
|
+
});
|
|
536
|
+
const secondResults = result.current.suggestions.map((s) => s.label);
|
|
537
|
+
const callCountAfterSecond = getConstructorCallCount();
|
|
538
|
+
// Should have same number of constructor calls (reused cached instance)
|
|
539
|
+
expect(callCountAfterSecond).toBe(callCountAfterFirst);
|
|
540
|
+
expect(secondResults).toEqual(firstResults);
|
|
541
|
+
// Different query should still use same cached instance for same command set
|
|
542
|
+
rerender({ query: '/hel' });
|
|
543
|
+
await waitFor(() => {
|
|
544
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
545
|
+
});
|
|
546
|
+
const thirdCallCount = getConstructorCallCount();
|
|
547
|
+
expect(thirdCallCount).toBe(callCountAfterFirst); // Same constructor call count
|
|
548
|
+
});
|
|
549
|
+
it('should not return duplicate suggestions when query matches both name and altNames', async () => {
|
|
550
|
+
const commandsWithAltNames = [
|
|
551
|
+
createTestCommand({
|
|
552
|
+
name: 'config',
|
|
553
|
+
altNames: ['configure', 'conf'],
|
|
554
|
+
description: 'Configure settings',
|
|
555
|
+
}),
|
|
556
|
+
createTestCommand({
|
|
557
|
+
name: 'help',
|
|
558
|
+
altNames: ['?'],
|
|
559
|
+
description: 'Show help',
|
|
560
|
+
}),
|
|
561
|
+
];
|
|
562
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/con', commandsWithAltNames, mockCommandContext));
|
|
563
|
+
await waitFor(() => {
|
|
564
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
565
|
+
});
|
|
566
|
+
const labels = result.current.suggestions.map((s) => s.label);
|
|
567
|
+
const uniqueLabels = new Set(labels);
|
|
568
|
+
// Should not have duplicates
|
|
569
|
+
expect(labels.length).toBe(uniqueLabels.size);
|
|
570
|
+
expect(labels).toContain('config');
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
describe('Race Condition Handling', () => {
|
|
574
|
+
it('should handle rapid input changes without race conditions', async () => {
|
|
575
|
+
const mockDelayedCompletion = vi
|
|
576
|
+
.fn()
|
|
577
|
+
.mockImplementation(async (_context, partialArg) => {
|
|
578
|
+
// Simulate network delay with different delays for different inputs
|
|
579
|
+
const delay = partialArg.includes('slow') ? 200 : 50;
|
|
580
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
581
|
+
return [`suggestion-for-${partialArg}`];
|
|
582
|
+
});
|
|
583
|
+
const slashCommands = [
|
|
584
|
+
createTestCommand({
|
|
585
|
+
name: 'test',
|
|
586
|
+
description: 'Test command',
|
|
587
|
+
completion: mockDelayedCompletion,
|
|
588
|
+
}),
|
|
589
|
+
];
|
|
590
|
+
const { result, rerender } = renderHook(({ query }) => useTestHarnessForSlashCompletion(true, query, slashCommands, mockCommandContext), { initialProps: { query: '/test slowquery' } });
|
|
591
|
+
// Quickly change to a faster query
|
|
592
|
+
rerender({ query: '/test fastquery' });
|
|
593
|
+
await waitFor(() => {
|
|
594
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
595
|
+
});
|
|
596
|
+
// Should show suggestions for the latest query only
|
|
597
|
+
const labels = result.current.suggestions.map((s) => s.label);
|
|
598
|
+
expect(labels).toContain('suggestion-for-fastquery');
|
|
599
|
+
expect(labels).not.toContain('suggestion-for-slowquery');
|
|
600
|
+
});
|
|
601
|
+
it('should not update suggestions if component unmounts during async operation', async () => {
|
|
602
|
+
let resolveCompletion;
|
|
603
|
+
const mockCompletion = vi.fn().mockImplementation(async () => new Promise((resolve) => {
|
|
604
|
+
resolveCompletion = resolve;
|
|
605
|
+
}));
|
|
606
|
+
const slashCommands = [
|
|
607
|
+
createTestCommand({
|
|
608
|
+
name: 'test',
|
|
609
|
+
description: 'Test command',
|
|
610
|
+
completion: mockCompletion,
|
|
611
|
+
}),
|
|
612
|
+
];
|
|
613
|
+
const { unmount } = renderHook(() => useTestHarnessForSlashCompletion(true, '/test query', slashCommands, mockCommandContext));
|
|
614
|
+
// Start the async operation
|
|
615
|
+
await waitFor(() => {
|
|
616
|
+
expect(mockCompletion).toHaveBeenCalled();
|
|
617
|
+
});
|
|
618
|
+
// Unmount before completion resolves
|
|
619
|
+
unmount();
|
|
620
|
+
// Now resolve the completion
|
|
621
|
+
resolveCompletion(['late-suggestion']);
|
|
622
|
+
// Wait a bit to ensure any pending updates would have been processed
|
|
623
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
624
|
+
// Since the component is unmounted, suggestions should remain empty
|
|
625
|
+
// and no state update errors should occur
|
|
626
|
+
expect(true).toBe(true); // Test passes if no errors are thrown
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
describe('Error Logging', () => {
|
|
630
|
+
it('should log errors to the console', async () => {
|
|
631
|
+
// Mock console.error to capture log calls
|
|
632
|
+
const consoleErrorSpy = vi
|
|
633
|
+
.spyOn(console, 'error')
|
|
634
|
+
.mockImplementation(() => { });
|
|
635
|
+
// Import the mocked AsyncFzf
|
|
636
|
+
const { AsyncFzf } = await import('fzf');
|
|
637
|
+
// Create a failing find method with error containing sensitive-looking data
|
|
638
|
+
const sensitiveError = new Error('Database connection failed: user=admin, pass=secret123');
|
|
639
|
+
const mockFind = vi.fn().mockRejectedValue(sensitiveError);
|
|
640
|
+
// Mock AsyncFzf to return an instance with failing find
|
|
641
|
+
vi.mocked(AsyncFzf).mockImplementation((_items, _options) => ({
|
|
642
|
+
find: mockFind,
|
|
643
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
644
|
+
}));
|
|
645
|
+
const testCommands = [
|
|
646
|
+
createTestCommand({ name: 'test', description: 'Test command' }),
|
|
647
|
+
];
|
|
648
|
+
const { result } = renderHook(() => useTestHarnessForSlashCompletion(true, '/test', testCommands, mockCommandContext));
|
|
649
|
+
await waitFor(() => {
|
|
650
|
+
expect(result.current.suggestions.length).toBeGreaterThan(0);
|
|
651
|
+
});
|
|
652
|
+
// Should get fallback suggestions
|
|
653
|
+
const labels = result.current.suggestions.map((s) => s.label);
|
|
654
|
+
expect(labels).toContain('test');
|
|
655
|
+
// Verify error logging occurred
|
|
656
|
+
await waitFor(() => {
|
|
657
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('[Fuzzy search - falling back to prefix matching]', sensitiveError);
|
|
658
|
+
});
|
|
659
|
+
consoleErrorSpy.mockRestore();
|
|
660
|
+
// Reset AsyncFzf mock to default behavior
|
|
661
|
+
vi.mocked(AsyncFzf).mockImplementation(createDefaultAsyncFzfMock());
|
|
662
|
+
});
|
|
663
|
+
});
|
|
664
|
+
});
|
|
665
|
+
//# sourceMappingURL=useSlashCompletion.test.js.map
|