@machina.ai/cell-cli 1.4.0-rc2 → 1.6.1-rc1
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 +12 -8
- package/dist/src/commands/extensions/disable.d.ts +2 -3
- package/dist/src/commands/extensions/disable.js +20 -6
- package/dist/src/commands/extensions/disable.js.map +1 -1
- package/dist/src/commands/extensions/enable.d.ts +2 -3
- package/dist/src/commands/extensions/enable.js +20 -9
- package/dist/src/commands/extensions/enable.js.map +1 -1
- package/dist/src/commands/extensions/install.d.ts +2 -0
- package/dist/src/commands/extensions/install.js +20 -4
- package/dist/src/commands/extensions/install.js.map +1 -1
- package/dist/src/commands/extensions/install.test.js +80 -3
- package/dist/src/commands/extensions/install.test.js.map +1 -1
- package/dist/src/commands/extensions/link.js +1 -1
- package/dist/src/commands/extensions/link.js.map +1 -1
- package/dist/src/commands/extensions/uninstall.js +1 -1
- package/dist/src/commands/extensions/uninstall.js.map +1 -1
- package/dist/src/commands/extensions/update.js +42 -11
- package/dist/src/commands/extensions/update.js.map +1 -1
- package/dist/src/config/config.d.ts +2 -1
- package/dist/src/config/config.js +33 -16
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/extension.d.ts +10 -14
- package/dist/src/config/extension.js +160 -145
- package/dist/src/config/extension.js.map +1 -1
- package/dist/src/config/extensions/extensionEnablement.d.ts +44 -0
- package/dist/src/config/extensions/extensionEnablement.js +161 -0
- package/dist/src/config/extensions/extensionEnablement.js.map +1 -0
- package/dist/src/config/extensions/extensionEnablement.test.js +261 -0
- package/dist/src/config/extensions/extensionEnablement.test.js.map +1 -0
- package/dist/src/config/extensions/github.d.ts +29 -0
- package/dist/src/config/extensions/github.js +306 -0
- package/dist/src/config/extensions/github.js.map +1 -0
- package/dist/src/config/extensions/github.test.d.ts +6 -0
- package/dist/src/config/extensions/github.test.js +267 -0
- package/dist/src/config/extensions/github.test.js.map +1 -0
- package/dist/src/config/extensions/update.d.ts +20 -0
- package/dist/src/config/extensions/update.js +94 -0
- package/dist/src/config/extensions/update.js.map +1 -0
- package/dist/src/config/extensions/update.test.d.ts +6 -0
- package/dist/src/config/extensions/update.test.js +324 -0
- package/dist/src/config/extensions/update.test.js.map +1 -0
- package/dist/src/config/extensions/variableSchema.d.ts +8 -0
- package/dist/src/config/extensions/variableSchema.js +4 -0
- package/dist/src/config/extensions/variableSchema.js.map +1 -1
- package/dist/src/config/keyBindings.d.ts +4 -1
- package/dist/src/config/keyBindings.js +8 -0
- package/dist/src/config/keyBindings.js.map +1 -1
- package/dist/src/config/settings.d.ts +3 -0
- package/dist/src/config/settings.js +58 -18
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/config/settingsSchema.d.ts +121 -12
- package/dist/src/config/settingsSchema.js +112 -9
- package/dist/src/config/settingsSchema.js.map +1 -1
- package/dist/src/config/settingsSchema.test.js +68 -55
- 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 +9 -4
- package/dist/src/config/trustedFolders.js.map +1 -1
- package/dist/src/config/trustedFolders.test.js +41 -25
- package/dist/src/config/trustedFolders.test.js.map +1 -1
- package/dist/src/core/auth.d.ts +13 -0
- package/dist/src/core/auth.js +27 -0
- package/dist/src/core/auth.js.map +1 -0
- package/dist/src/core/initializer.d.ts +21 -0
- package/dist/src/core/initializer.js +33 -0
- package/dist/src/core/initializer.js.map +1 -0
- package/dist/src/core/theme.d.ts +12 -0
- package/dist/src/core/theme.js +20 -0
- package/dist/src/core/theme.js.map +1 -0
- package/dist/src/gemini.d.ts +2 -1
- package/dist/src/gemini.js +110 -69
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.test.js +124 -14
- package/dist/src/gemini.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/nonInteractiveCli.js +87 -71
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.test.js +16 -17
- package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -1
- package/dist/src/services/FeedbackService.d.ts +21 -0
- package/dist/src/services/FeedbackService.js +124 -0
- package/dist/src/services/FeedbackService.js.map +1 -0
- package/dist/src/services/McpPromptLoader.js +43 -8
- package/dist/src/services/McpPromptLoader.js.map +1 -1
- package/dist/src/services/McpPromptLoader.test.js +228 -1
- package/dist/src/services/McpPromptLoader.test.js.map +1 -1
- package/dist/src/services/prompt-processors/shellProcessor.js +8 -1
- package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -1
- package/dist/src/test-utils/createExtension.d.ts +15 -0
- package/dist/src/test-utils/createExtension.js +25 -0
- package/dist/src/test-utils/createExtension.js.map +1 -0
- package/dist/src/test-utils/mockCommandContext.js +2 -0
- package/dist/src/test-utils/mockCommandContext.js.map +1 -1
- package/dist/src/ui/App.d.ts +1 -10
- package/dist/src/ui/App.js +17 -729
- package/dist/src/ui/App.js.map +1 -1
- package/dist/src/ui/AppContainer.d.ts +17 -0
- package/dist/src/ui/AppContainer.js +905 -0
- package/dist/src/ui/AppContainer.js.map +1 -0
- package/dist/src/ui/AppContainer.test.d.ts +6 -0
- package/dist/src/ui/AppContainer.test.js +422 -0
- package/dist/src/ui/AppContainer.test.js.map +1 -0
- package/dist/src/ui/IdeIntegrationNudge.js +2 -1
- package/dist/src/ui/IdeIntegrationNudge.js.map +1 -1
- package/dist/src/ui/auth/AuthDialog.d.ts +18 -0
- package/dist/src/ui/auth/AuthDialog.js +81 -0
- package/dist/src/ui/auth/AuthDialog.js.map +1 -0
- package/dist/src/ui/auth/AuthDialog.test.d.ts +6 -0
- package/dist/src/ui/auth/AuthDialog.test.js +176 -0
- package/dist/src/ui/auth/AuthDialog.test.js.map +1 -0
- package/dist/src/ui/{components → auth}/AuthInProgress.js +2 -2
- package/dist/src/ui/auth/AuthInProgress.js.map +1 -0
- package/dist/src/ui/auth/useAuth.d.ts +15 -0
- package/dist/src/ui/auth/useAuth.js +73 -0
- package/dist/src/ui/auth/useAuth.js.map +1 -0
- package/dist/src/ui/commands/chatCommand.d.ts +2 -0
- package/dist/src/ui/commands/chatCommand.js +82 -3
- package/dist/src/ui/commands/chatCommand.js.map +1 -1
- package/dist/src/ui/commands/corgiCommand.js +1 -0
- package/dist/src/ui/commands/corgiCommand.js.map +1 -1
- package/dist/src/ui/commands/extensionsCommand.js +86 -16
- package/dist/src/ui/commands/extensionsCommand.js.map +1 -1
- package/dist/src/ui/commands/ideCommand.js +2 -2
- package/dist/src/ui/commands/ideCommand.js.map +1 -1
- package/dist/src/ui/commands/mcpCommand.js +1 -1
- package/dist/src/ui/commands/mcpCommand.js.map +1 -1
- package/dist/src/ui/commands/types.d.ts +5 -1
- package/dist/src/ui/commands/types.js +0 -1
- package/dist/src/ui/commands/types.js.map +1 -1
- package/dist/src/ui/components/AboutBox.js +2 -2
- package/dist/src/ui/components/AboutBox.js.map +1 -1
- package/dist/src/ui/components/AnsiOutput.d.ts +13 -0
- package/dist/src/ui/components/AnsiOutput.js +12 -0
- package/dist/src/ui/components/AnsiOutput.js.map +1 -0
- package/dist/src/ui/components/AnsiOutput.test.d.ts +6 -0
- package/dist/src/ui/components/AnsiOutput.test.js +97 -0
- package/dist/src/ui/components/AnsiOutput.test.js.map +1 -0
- package/dist/src/ui/components/AppHeader.d.ts +10 -0
- package/dist/src/ui/components/AppHeader.js +22 -0
- package/dist/src/ui/components/AppHeader.js.map +1 -0
- package/dist/src/ui/components/AsciiArt.d.ts +3 -3
- package/dist/src/ui/components/AsciiArt.js +3 -3
- package/dist/src/ui/components/AutoAcceptIndicator.js +4 -4
- package/dist/src/ui/components/AutoAcceptIndicator.js.map +1 -1
- package/dist/src/ui/components/Composer.d.ts +6 -0
- package/dist/src/ui/components/Composer.js +74 -0
- package/dist/src/ui/components/Composer.js.map +1 -0
- package/dist/src/ui/components/Composer.test.d.ts +6 -0
- package/dist/src/ui/components/Composer.test.js +340 -0
- package/dist/src/ui/components/Composer.test.js.map +1 -0
- package/dist/src/ui/components/ConfigInitDisplay.d.ts +6 -0
- package/dist/src/ui/components/ConfigInitDisplay.js +38 -0
- package/dist/src/ui/components/ConfigInitDisplay.js.map +1 -0
- package/dist/src/ui/components/ConsoleSummaryDisplay.js +2 -2
- package/dist/src/ui/components/ConsoleSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/ContextSummaryDisplay.js +3 -3
- package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/ContextUsageDisplay.js +2 -2
- package/dist/src/ui/components/ContextUsageDisplay.js.map +1 -1
- package/dist/src/ui/components/DebugProfiler.js +2 -2
- package/dist/src/ui/components/DebugProfiler.js.map +1 -1
- package/dist/src/ui/components/DetailedMessagesDisplay.js +7 -7
- package/dist/src/ui/components/DetailedMessagesDisplay.js.map +1 -1
- package/dist/src/ui/components/DialogManager.d.ts +6 -0
- package/dist/src/ui/components/DialogManager.js +85 -0
- package/dist/src/ui/components/DialogManager.js.map +1 -0
- package/dist/src/ui/components/EditorSettingsDialog.js +5 -5
- package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -1
- package/dist/src/ui/components/FolderTrustDialog.js +16 -8
- package/dist/src/ui/components/FolderTrustDialog.js.map +1 -1
- package/dist/src/ui/components/FolderTrustDialog.test.js +18 -8
- package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/Footer.d.ts +1 -2
- package/dist/src/ui/components/Footer.js +6 -2
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/GeminiRespondingSpinner.d.ts +5 -0
- package/dist/src/ui/components/GeminiRespondingSpinner.js +7 -2
- package/dist/src/ui/components/GeminiRespondingSpinner.js.map +1 -1
- package/dist/src/ui/components/Header.js +2 -2
- package/dist/src/ui/components/Header.js.map +1 -1
- package/dist/src/ui/components/Help.d.ts +1 -1
- package/dist/src/ui/components/Help.js +9 -6
- package/dist/src/ui/components/Help.js.map +1 -1
- package/dist/src/ui/components/Help.test.d.ts +6 -0
- package/dist/src/ui/components/Help.test.js +57 -0
- package/dist/src/ui/components/Help.test.js.map +1 -0
- package/dist/src/ui/components/HistoryItemDisplay.d.ts +2 -2
- package/dist/src/ui/components/HistoryItemDisplay.js +2 -1
- package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.d.ts +3 -0
- package/dist/src/ui/components/InputPrompt.js +122 -22
- package/dist/src/ui/components/InputPrompt.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/LoopDetectionConfirmation.d.ts +13 -0
- package/dist/src/ui/components/LoopDetectionConfirmation.js +35 -0
- package/dist/src/ui/components/LoopDetectionConfirmation.js.map +1 -0
- package/dist/src/ui/components/LoopDetectionConfirmation.test.d.ts +6 -0
- package/dist/src/ui/components/LoopDetectionConfirmation.test.js +25 -0
- package/dist/src/ui/components/LoopDetectionConfirmation.test.js.map +1 -0
- package/dist/src/ui/components/MainContent.d.ts +6 -0
- package/dist/src/ui/components/MainContent.js +23 -0
- package/dist/src/ui/components/MainContent.js.map +1 -0
- package/dist/src/ui/components/MemoryUsageDisplay.js +6 -4
- package/dist/src/ui/components/MemoryUsageDisplay.js.map +1 -1
- package/dist/src/ui/components/ModelStatsDisplay.js +7 -7
- package/dist/src/ui/components/ModelStatsDisplay.js.map +1 -1
- package/dist/src/ui/components/Notifications.d.ts +6 -0
- package/dist/src/ui/components/Notifications.js +23 -0
- package/dist/src/ui/components/Notifications.js.map +1 -0
- package/dist/src/ui/components/PrepareLabel.d.ts +5 -5
- package/dist/src/ui/components/PrepareLabel.js +67 -11
- package/dist/src/ui/components/PrepareLabel.js.map +1 -1
- package/dist/src/ui/components/PrepareLabel.test.d.ts +6 -0
- package/dist/src/ui/components/PrepareLabel.test.js +71 -0
- package/dist/src/ui/components/PrepareLabel.test.js.map +1 -0
- package/dist/src/ui/components/ProQuotaDialog.d.ts +2 -2
- package/dist/src/ui/components/ProQuotaDialog.js +3 -3
- package/dist/src/ui/components/ProQuotaDialog.js.map +1 -1
- package/dist/src/ui/components/ProQuotaDialog.test.js +3 -3
- package/dist/src/ui/components/ProQuotaDialog.test.js.map +1 -1
- package/dist/src/ui/components/QuittingDisplay.d.ts +6 -0
- package/dist/src/ui/components/QuittingDisplay.js +20 -0
- package/dist/src/ui/components/QuittingDisplay.js.map +1 -0
- package/dist/src/ui/components/RatingWidget.d.ts +14 -0
- package/dist/src/ui/components/RatingWidget.js +56 -0
- package/dist/src/ui/components/RatingWidget.js.map +1 -0
- package/dist/src/ui/components/SessionSummaryDisplay.d.ts +4 -0
- package/dist/src/ui/components/SessionSummaryDisplay.js +1 -1
- package/dist/src/ui/components/SessionSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/SettingsDialog.d.ts +2 -1
- package/dist/src/ui/components/SettingsDialog.js +93 -22
- package/dist/src/ui/components/SettingsDialog.js.map +1 -1
- package/dist/src/ui/components/SettingsDialog.test.js +435 -79
- package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
- package/dist/src/ui/components/ShellConfirmationDialog.js +2 -2
- package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -1
- package/dist/src/ui/components/ShellInputPrompt.d.ts +11 -0
- package/dist/src/ui/components/ShellInputPrompt.js +36 -0
- package/dist/src/ui/components/ShellInputPrompt.js.map +1 -0
- package/dist/src/ui/components/ShellModeIndicator.js +2 -2
- package/dist/src/ui/components/ShellModeIndicator.js.map +1 -1
- package/dist/src/ui/components/ShowMoreLines.js +2 -2
- package/dist/src/ui/components/ShowMoreLines.js.map +1 -1
- package/dist/src/ui/components/StatsDisplay.d.ts +4 -0
- package/dist/src/ui/components/StatsDisplay.js +10 -7
- package/dist/src/ui/components/StatsDisplay.js.map +1 -1
- package/dist/src/ui/components/SuggestionsDisplay.d.ts +7 -2
- package/dist/src/ui/components/SuggestionsDisplay.js +17 -17
- package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
- package/dist/src/ui/components/ThemeDialog.js +12 -29
- package/dist/src/ui/components/ThemeDialog.js.map +1 -1
- package/dist/src/ui/components/ThemeDialog.test.d.ts +6 -0
- package/dist/src/ui/components/ThemeDialog.test.js +75 -0
- package/dist/src/ui/components/ThemeDialog.test.js.map +1 -0
- package/dist/src/ui/components/Tips.js +2 -2
- package/dist/src/ui/components/Tips.js.map +1 -1
- package/dist/src/ui/components/ToolStatsDisplay.js +4 -4
- package/dist/src/ui/components/ToolStatsDisplay.js.map +1 -1
- package/dist/src/ui/components/UpdateNotification.js +2 -2
- package/dist/src/ui/components/UpdateNotification.js.map +1 -1
- package/dist/src/ui/components/WorkspaceMigrationDialog.js +4 -4
- package/dist/src/ui/components/WorkspaceMigrationDialog.js.map +1 -1
- package/dist/src/ui/components/messages/CompressionMessage.d.ts +1 -2
- package/dist/src/ui/components/messages/CompressionMessage.js +37 -8
- package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -1
- package/dist/src/ui/components/messages/CompressionMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/CompressionMessage.test.js +160 -0
- package/dist/src/ui/components/messages/CompressionMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/DiffRenderer.d.ts +2 -1
- package/dist/src/ui/components/messages/DiffRenderer.js +14 -22
- package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -1
- package/dist/src/ui/components/messages/ErrorMessage.js +2 -2
- package/dist/src/ui/components/messages/ErrorMessage.js.map +1 -1
- package/dist/src/ui/components/messages/GeminiMessage.js +2 -2
- package/dist/src/ui/components/messages/GeminiMessage.js.map +1 -1
- package/dist/src/ui/components/messages/InfoMessage.js +2 -2
- package/dist/src/ui/components/messages/InfoMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js +31 -19
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +3 -2
- package/dist/src/ui/components/messages/ToolGroupMessage.js +17 -9
- package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js +17 -15
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -1
- package/dist/src/ui/components/messages/ToolMessage.d.ts +4 -0
- package/dist/src/ui/components/messages/ToolMessage.js +24 -10
- package/dist/src/ui/components/messages/ToolMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolMessage.test.js +33 -1
- package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -1
- package/dist/src/ui/components/messages/UserMessage.js +3 -3
- package/dist/src/ui/components/messages/UserMessage.js.map +1 -1
- package/dist/src/ui/components/messages/UserShellMessage.js +2 -2
- package/dist/src/ui/components/messages/UserShellMessage.js.map +1 -1
- package/dist/src/ui/components/shared/EnumSelector.d.ts +18 -0
- package/dist/src/ui/components/shared/EnumSelector.js +44 -0
- package/dist/src/ui/components/shared/EnumSelector.js.map +1 -0
- package/dist/src/ui/components/shared/EnumSelector.test.d.ts +6 -0
- package/dist/src/ui/components/shared/EnumSelector.test.js +70 -0
- package/dist/src/ui/components/shared/EnumSelector.test.js.map +1 -0
- package/dist/src/ui/components/shared/MaxSizedBox.js +2 -2
- package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -1
- package/dist/src/ui/components/shared/RadioButtonSelect.js +12 -12
- package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -1
- package/dist/src/ui/components/shared/ScopeSelector.d.ts +19 -0
- package/dist/src/ui/components/shared/ScopeSelector.js +11 -0
- package/dist/src/ui/components/shared/ScopeSelector.js.map +1 -0
- package/dist/src/ui/components/shared/text-buffer.d.ts +19 -2
- package/dist/src/ui/components/shared/text-buffer.js +191 -133
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/components/views/ExtensionsList.d.ts +6 -0
- package/dist/src/ui/components/views/ExtensionsList.js +47 -0
- package/dist/src/ui/components/views/ExtensionsList.js.map +1 -0
- package/dist/src/ui/components/views/ExtensionsList.test.d.ts +6 -0
- package/dist/src/ui/components/views/ExtensionsList.test.js +97 -0
- package/dist/src/ui/components/views/ExtensionsList.test.js.map +1 -0
- package/dist/src/ui/constants.d.ts +1 -0
- package/dist/src/ui/constants.js +1 -0
- package/dist/src/ui/constants.js.map +1 -1
- package/dist/src/ui/contexts/AppContext.d.ts +11 -0
- package/dist/src/ui/contexts/AppContext.js +15 -0
- package/dist/src/ui/contexts/AppContext.js.map +1 -0
- package/dist/src/ui/contexts/ConfigContext.d.ts +9 -0
- package/dist/src/ui/contexts/ConfigContext.js +16 -0
- package/dist/src/ui/contexts/ConfigContext.js.map +1 -0
- package/dist/src/ui/contexts/KeypressContext.d.ts +3 -0
- package/dist/src/ui/contexts/KeypressContext.js +51 -2
- package/dist/src/ui/contexts/KeypressContext.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.test.js +173 -1
- package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
- package/dist/src/ui/contexts/UIActionsContext.d.ts +36 -0
- package/dist/src/ui/contexts/UIActionsContext.js +20 -0
- package/dist/src/ui/contexts/UIActionsContext.js.map +1 -0
- package/dist/src/ui/contexts/UIStateContext.d.ts +103 -0
- package/dist/src/ui/contexts/UIStateContext.js +15 -0
- package/dist/src/ui/contexts/UIStateContext.js.map +1 -0
- package/dist/src/ui/hooks/atCommandProcessor.test.js +7 -5
- package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/keyToAnsi.d.ts +15 -0
- package/dist/src/ui/hooks/keyToAnsi.js +67 -0
- package/dist/src/ui/hooks/keyToAnsi.js.map +1 -0
- package/dist/src/ui/hooks/shellCommandProcessor.d.ts +2 -1
- package/dist/src/ui/hooks/shellCommandProcessor.js +60 -15
- package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/shellCommandProcessor.test.js +196 -17
- package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +16 -2
- package/dist/src/ui/hooks/slashCommandProcessor.js +28 -70
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useAutoAcceptIndicator.d.ts +3 -2
- package/dist/src/ui/hooks/useAutoAcceptIndicator.js +9 -5
- package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -1
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +69 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.d.ts +12 -0
- package/dist/src/ui/hooks/useExtensionUpdates.js +64 -0
- package/dist/src/ui/hooks/useExtensionUpdates.js.map +1 -0
- package/dist/src/ui/hooks/useExtensionUpdates.test.d.ts +6 -0
- package/dist/src/ui/hooks/useExtensionUpdates.test.js +162 -0
- package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +1 -0
- package/dist/src/ui/hooks/useFolderTrust.d.ts +1 -1
- package/dist/src/ui/hooks/useFolderTrust.js +12 -13
- package/dist/src/ui/hooks/useFolderTrust.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.d.ts +11 -1
- package/dist/src/ui/hooks/useGeminiStream.js +124 -59
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useGitBranchName.js +15 -18
- package/dist/src/ui/hooks/useGitBranchName.js.map +1 -1
- package/dist/src/ui/hooks/useGitBranchName.test.js +49 -53
- package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -1
- package/dist/src/ui/hooks/useIdeTrustListener.js +2 -2
- package/dist/src/ui/hooks/useIdeTrustListener.js.map +1 -1
- package/dist/src/ui/hooks/useMessageQueue.d.ts +2 -1
- package/dist/src/ui/hooks/useMessageQueue.js +5 -3
- package/dist/src/ui/hooks/useMessageQueue.js.map +1 -1
- package/dist/src/ui/hooks/useMessageQueue.test.js +9 -0
- package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -1
- package/dist/src/ui/hooks/useQuotaAndFallback.d.ts +21 -0
- package/dist/src/ui/hooks/useQuotaAndFallback.js +122 -0
- package/dist/src/ui/hooks/useQuotaAndFallback.js.map +1 -0
- package/dist/src/ui/hooks/useQuotaAndFallback.test.d.ts +6 -0
- package/dist/src/ui/hooks/useQuotaAndFallback.test.js +267 -0
- package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +1 -0
- package/dist/src/ui/hooks/useReactToolScheduler.d.ts +3 -2
- package/dist/src/ui/hooks/useReactToolScheduler.js +23 -17
- package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
- package/dist/src/ui/hooks/useReverseSearchCompletion.d.ts +1 -1
- package/dist/src/ui/hooks/useReverseSearchCompletion.js +67 -20
- package/dist/src/ui/hooks/useReverseSearchCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.d.ts +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.js +16 -3
- package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.test.js +169 -270
- package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useThemeCommand.d.ts +1 -1
- package/dist/src/ui/hooks/useThemeCommand.js +3 -14
- package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
- package/dist/src/ui/hooks/useToolScheduler.test.js +12 -5
- package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
- package/dist/src/ui/keyMatchers.test.js +8 -0
- package/dist/src/ui/keyMatchers.test.js.map +1 -1
- package/dist/src/ui/privacy/CloudFreePrivacyNotice.js +8 -8
- package/dist/src/ui/privacy/CloudFreePrivacyNotice.js.map +1 -1
- package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js +2 -2
- package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js.map +1 -1
- package/dist/src/ui/privacy/GeminiPrivacyNotice.js +2 -2
- package/dist/src/ui/privacy/GeminiPrivacyNotice.js.map +1 -1
- package/dist/src/ui/state/extensions.d.ts +15 -0
- package/dist/src/ui/state/extensions.js +17 -0
- package/dist/src/ui/state/extensions.js.map +1 -0
- package/dist/src/ui/themes/ayu.js +1 -1
- package/dist/src/ui/themes/dracula.js +2 -2
- package/dist/src/ui/themes/github-dark.js +1 -1
- package/dist/src/ui/themes/theme.js +17 -17
- package/dist/src/ui/themes/theme.js.map +1 -1
- package/dist/src/ui/types.d.ts +29 -3
- package/dist/src/ui/types.js +11 -0
- package/dist/src/ui/types.js.map +1 -1
- package/dist/src/ui/utils/CodeColorizer.js +3 -2
- package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
- package/dist/src/ui/utils/InlineMarkdownRenderer.js +7 -7
- package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -1
- package/dist/src/ui/utils/MarkdownDisplay.js +10 -10
- package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
- package/dist/src/ui/utils/MarkdownDisplay.test.js +6 -2
- package/dist/src/ui/utils/MarkdownDisplay.test.js.map +1 -1
- package/dist/src/ui/utils/TableRenderer.js +4 -4
- package/dist/src/ui/utils/TableRenderer.js.map +1 -1
- package/dist/src/ui/utils/clipboardUtils.js +5 -6
- package/dist/src/ui/utils/clipboardUtils.js.map +1 -1
- package/dist/src/ui/utils/displayUtils.js +4 -4
- package/dist/src/ui/utils/displayUtils.js.map +1 -1
- package/dist/src/ui/utils/highlight.d.ts +1 -1
- package/dist/src/ui/utils/highlight.js +15 -6
- package/dist/src/ui/utils/highlight.js.map +1 -1
- package/dist/src/ui/utils/highlight.test.js +56 -29
- package/dist/src/ui/utils/highlight.test.js.map +1 -1
- package/dist/src/ui/utils/kittyProtocolDetector.js +39 -29
- package/dist/src/ui/utils/kittyProtocolDetector.js.map +1 -1
- package/dist/src/ui/utils/textUtils.d.ts +9 -0
- package/dist/src/ui/utils/textUtils.js +52 -3
- package/dist/src/ui/utils/textUtils.js.map +1 -1
- package/dist/src/utils/commands.d.ts +20 -0
- package/dist/src/utils/commands.js +53 -0
- package/dist/src/utils/commands.js.map +1 -0
- package/dist/src/utils/commands.test.d.ts +6 -0
- package/dist/src/utils/commands.test.js +115 -0
- package/dist/src/utils/commands.test.js.map +1 -0
- package/dist/src/utils/commentJson.d.ts +9 -0
- package/dist/src/utils/commentJson.js +48 -0
- package/dist/src/utils/commentJson.js.map +1 -0
- package/dist/src/utils/commentJson.test.d.ts +6 -0
- package/dist/src/utils/commentJson.test.js +146 -0
- package/dist/src/utils/commentJson.test.js.map +1 -0
- package/dist/src/utils/errors.d.ts +21 -0
- package/dist/src/utils/errors.js +93 -0
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/errors.test.d.ts +6 -0
- package/dist/src/utils/errors.test.js +303 -0
- package/dist/src/utils/errors.test.js.map +1 -0
- package/dist/src/utils/processUtils.d.ts +13 -0
- package/dist/src/utils/processUtils.js +18 -0
- package/dist/src/utils/processUtils.js.map +1 -0
- package/dist/src/utils/processUtils.test.d.ts +6 -0
- package/dist/src/utils/processUtils.test.js +20 -0
- package/dist/src/utils/processUtils.test.js.map +1 -0
- package/dist/src/utils/sandbox.d.ts +1 -1
- package/dist/src/utils/sandbox.js +19 -8
- package/dist/src/utils/sandbox.js.map +1 -1
- package/dist/src/utils/settingsUtils.d.ts +16 -6
- package/dist/src/utils/settingsUtils.js +35 -25
- package/dist/src/utils/settingsUtils.js.map +1 -1
- package/dist/src/utils/settingsUtils.test.js +455 -158
- package/dist/src/utils/settingsUtils.test.js.map +1 -1
- package/dist/src/zed-integration/schema.d.ts +596 -596
- package/dist/src/zed-integration/zedIntegration.js +10 -7
- package/dist/src/zed-integration/zedIntegration.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -9
- package/dist/src/ui/components/AuthDialog.d.ts +0 -16
- package/dist/src/ui/components/AuthDialog.js +0 -62
- package/dist/src/ui/components/AuthDialog.js.map +0 -1
- package/dist/src/ui/components/AuthDialog.test.js +0 -175
- package/dist/src/ui/components/AuthDialog.test.js.map +0 -1
- package/dist/src/ui/components/AuthInProgress.js.map +0 -1
- package/dist/src/ui/hooks/useAuthCommand.d.ts +0 -15
- package/dist/src/ui/hooks/useAuthCommand.js +0 -68
- package/dist/src/ui/hooks/useAuthCommand.js.map +0 -1
- /package/dist/src/{ui/components/AuthDialog.test.d.ts → config/extensions/extensionEnablement.test.d.ts} +0 -0
- /package/dist/src/ui/{components → auth}/AuthInProgress.d.ts +0 -0
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
const HIGHLIGHT_REGEX = /(
|
|
7
|
-
export function parseInputForHighlighting(text) {
|
|
6
|
+
const HIGHLIGHT_REGEX = /(^\/[a-zA-Z0-9_-]+|@(?:\\ |[a-zA-Z0-9_./-])+)/g;
|
|
7
|
+
export function parseInputForHighlighting(text, index) {
|
|
8
8
|
if (!text) {
|
|
9
9
|
return [{ text: '', type: 'default' }];
|
|
10
10
|
}
|
|
@@ -23,10 +23,19 @@ export function parseInputForHighlighting(text) {
|
|
|
23
23
|
}
|
|
24
24
|
// Add the matched token
|
|
25
25
|
const type = fullMatch.startsWith('/') ? 'command' : 'file';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
// Only highlight slash commands if the index is 0.
|
|
27
|
+
if (type === 'command' && index !== 0) {
|
|
28
|
+
tokens.push({
|
|
29
|
+
text: fullMatch,
|
|
30
|
+
type: 'default',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
tokens.push({
|
|
35
|
+
text: fullMatch,
|
|
36
|
+
type,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
30
39
|
lastIndex = matchIndex + fullMatch.length;
|
|
31
40
|
}
|
|
32
41
|
// Add any remaining text after the last match
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.js","sourceRoot":"","sources":["../../../../src/ui/utils/highlight.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,eAAe,GAAG,
|
|
1
|
+
{"version":3,"file":"highlight.js","sourceRoot":"","sources":["../../../../src/ui/utils/highlight.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,eAAe,GAAG,gDAAgD,CAAC;AAEzE,MAAM,UAAU,yBAAyB,CACvC,IAAY,EACZ,KAAa;IAEb,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,KAAK,CAAC;IAEV,OAAO,CAAC,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACrD,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;QAC1B,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC;QAE/B,mDAAmD;QACnD,IAAI,UAAU,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC;gBACvC,IAAI,EAAE,SAAS;aAChB,CAAC,CAAC;QACL,CAAC;QAED,wBAAwB;QACxB,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;QAC5D,mDAAmD;QACnD,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YACtC,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;aAChB,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,SAAS;gBACf,IAAI;aACL,CAAC,CAAC;QACL,CAAC;QAED,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC;IAC5C,CAAC;IAED,8CAA8C;IAC9C,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YAC3B,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -7,87 +7,114 @@ import { describe, it, expect } from 'vitest';
|
|
|
7
7
|
import { parseInputForHighlighting } from './highlight.js';
|
|
8
8
|
describe('parseInputForHighlighting', () => {
|
|
9
9
|
it('should handle an empty string', () => {
|
|
10
|
-
expect(parseInputForHighlighting('')).toEqual([
|
|
10
|
+
expect(parseInputForHighlighting('', 0)).toEqual([
|
|
11
11
|
{ text: '', type: 'default' },
|
|
12
12
|
]);
|
|
13
13
|
});
|
|
14
14
|
it('should handle text with no commands or files', () => {
|
|
15
15
|
const text = 'this is a normal sentence';
|
|
16
|
-
expect(parseInputForHighlighting(text)).toEqual([
|
|
16
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
17
17
|
{ text, type: 'default' },
|
|
18
18
|
]);
|
|
19
19
|
});
|
|
20
|
-
it('should highlight a single command at the beginning', () => {
|
|
20
|
+
it('should highlight a single command at the beginning when index is 0', () => {
|
|
21
21
|
const text = '/help me';
|
|
22
|
-
expect(parseInputForHighlighting(text)).toEqual([
|
|
22
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
23
23
|
{ text: '/help', type: 'command' },
|
|
24
24
|
{ text: ' me', type: 'default' },
|
|
25
25
|
]);
|
|
26
26
|
});
|
|
27
|
+
it('should NOT highlight a command at the beginning when index is not 0', () => {
|
|
28
|
+
const text = '/help me';
|
|
29
|
+
expect(parseInputForHighlighting(text, 1)).toEqual([
|
|
30
|
+
{ text: '/help', type: 'default' },
|
|
31
|
+
{ text: ' me', type: 'default' },
|
|
32
|
+
]);
|
|
33
|
+
});
|
|
27
34
|
it('should highlight a single file path at the beginning', () => {
|
|
28
35
|
const text = '@path/to/file.txt please';
|
|
29
|
-
expect(parseInputForHighlighting(text)).toEqual([
|
|
36
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
30
37
|
{ text: '@path/to/file.txt', type: 'file' },
|
|
31
38
|
{ text: ' please', type: 'default' },
|
|
32
39
|
]);
|
|
33
40
|
});
|
|
34
|
-
it('should highlight a command in the middle', () => {
|
|
41
|
+
it('should not highlight a command in the middle', () => {
|
|
35
42
|
const text = 'I need /help with this';
|
|
36
|
-
expect(parseInputForHighlighting(text)).toEqual([
|
|
37
|
-
{ text: 'I need ', type: 'default' },
|
|
38
|
-
{ text: '/help', type: 'command' },
|
|
39
|
-
{ text: ' with this', type: 'default' },
|
|
43
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
44
|
+
{ text: 'I need /help with this', type: 'default' },
|
|
40
45
|
]);
|
|
41
46
|
});
|
|
42
47
|
it('should highlight a file path in the middle', () => {
|
|
43
48
|
const text = 'Please check @path/to/file.txt for details';
|
|
44
|
-
expect(parseInputForHighlighting(text)).toEqual([
|
|
49
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
45
50
|
{ text: 'Please check ', type: 'default' },
|
|
46
51
|
{ text: '@path/to/file.txt', type: 'file' },
|
|
47
52
|
{ text: ' for details', type: 'default' },
|
|
48
53
|
]);
|
|
49
54
|
});
|
|
50
|
-
it('should highlight
|
|
55
|
+
it('should highlight files but not commands not at the start', () => {
|
|
51
56
|
const text = 'Use /run with @file.js and also /format @another/file.ts';
|
|
52
|
-
expect(parseInputForHighlighting(text)).toEqual([
|
|
53
|
-
{ text: 'Use ', type: 'default' },
|
|
54
|
-
{ text: '/run', type: 'command' },
|
|
55
|
-
{ text: ' with ', type: 'default' },
|
|
57
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
58
|
+
{ text: 'Use /run with ', type: 'default' },
|
|
56
59
|
{ text: '@file.js', type: 'file' },
|
|
57
|
-
{ text: ' and also ', type: 'default' },
|
|
58
|
-
{ text: '/format', type: 'command' },
|
|
59
|
-
{ text: ' ', type: 'default' },
|
|
60
|
+
{ text: ' and also /format ', type: 'default' },
|
|
60
61
|
{ text: '@another/file.ts', type: 'file' },
|
|
61
62
|
]);
|
|
62
63
|
});
|
|
63
|
-
it('should handle adjacent highlights', () => {
|
|
64
|
+
it('should handle adjacent highlights at start', () => {
|
|
64
65
|
const text = '/run@file.js';
|
|
65
|
-
expect(parseInputForHighlighting(text)).toEqual([
|
|
66
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
66
67
|
{ text: '/run', type: 'command' },
|
|
67
68
|
{ text: '@file.js', type: 'file' },
|
|
68
69
|
]);
|
|
69
70
|
});
|
|
70
|
-
it('should
|
|
71
|
+
it('should not highlight command at the end of the string', () => {
|
|
71
72
|
const text = 'Get help with /help';
|
|
72
|
-
expect(parseInputForHighlighting(text)).toEqual([
|
|
73
|
-
{ text: 'Get help with ', type: 'default' },
|
|
74
|
-
{ text: '/help', type: 'command' },
|
|
73
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
74
|
+
{ text: 'Get help with /help', type: 'default' },
|
|
75
75
|
]);
|
|
76
76
|
});
|
|
77
77
|
it('should handle file paths with dots and dashes', () => {
|
|
78
78
|
const text = 'Check @./path-to/file-name.v2.txt';
|
|
79
|
-
expect(parseInputForHighlighting(text)).toEqual([
|
|
79
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
80
80
|
{ text: 'Check ', type: 'default' },
|
|
81
81
|
{ text: '@./path-to/file-name.v2.txt', type: 'file' },
|
|
82
82
|
]);
|
|
83
83
|
});
|
|
84
|
-
it('should
|
|
84
|
+
it('should not highlight command with dashes and numbers not at start', () => {
|
|
85
85
|
const text = 'Run /command-123 now';
|
|
86
|
-
expect(parseInputForHighlighting(text)).toEqual([
|
|
87
|
-
{ text: 'Run ', type: 'default' },
|
|
86
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
87
|
+
{ text: 'Run /command-123 now', type: 'default' },
|
|
88
|
+
]);
|
|
89
|
+
});
|
|
90
|
+
it('should highlight command with dashes and numbers at start', () => {
|
|
91
|
+
const text = '/command-123 now';
|
|
92
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
88
93
|
{ text: '/command-123', type: 'command' },
|
|
89
94
|
{ text: ' now', type: 'default' },
|
|
90
95
|
]);
|
|
91
96
|
});
|
|
97
|
+
it('should still highlight a file path on a non-zero line', () => {
|
|
98
|
+
const text = 'some text @path/to/file.txt';
|
|
99
|
+
expect(parseInputForHighlighting(text, 1)).toEqual([
|
|
100
|
+
{ text: 'some text ', type: 'default' },
|
|
101
|
+
{ text: '@path/to/file.txt', type: 'file' },
|
|
102
|
+
]);
|
|
103
|
+
});
|
|
104
|
+
it('should not highlight command but highlight file on a non-zero line', () => {
|
|
105
|
+
const text = '/cmd @file.txt';
|
|
106
|
+
expect(parseInputForHighlighting(text, 2)).toEqual([
|
|
107
|
+
{ text: '/cmd', type: 'default' },
|
|
108
|
+
{ text: ' ', type: 'default' },
|
|
109
|
+
{ text: '@file.txt', type: 'file' },
|
|
110
|
+
]);
|
|
111
|
+
});
|
|
112
|
+
it('should highlight a file path with escaped spaces', () => {
|
|
113
|
+
const text = 'cat @/my\\ path/file.txt';
|
|
114
|
+
expect(parseInputForHighlighting(text, 0)).toEqual([
|
|
115
|
+
{ text: 'cat ', type: 'default' },
|
|
116
|
+
{ text: '@/my\\ path/file.txt', type: 'file' },
|
|
117
|
+
]);
|
|
118
|
+
});
|
|
92
119
|
});
|
|
93
120
|
//# sourceMappingURL=highlight.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.test.js","sourceRoot":"","sources":["../../../../src/ui/utils/highlight.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"highlight.test.js","sourceRoot":"","sources":["../../../../src/ui/utils/highlight.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,yBAAyB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YAC/C,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;SAC9B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,IAAI,GAAG,2BAA2B,CAAC;QACzC,MAAM,CAAC,yBAAyB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YACjD,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;QAC5E,MA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AC,CAAC,OAAO,CAAC;YACjD,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE;YACvC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE;SAC5C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;QAC5E,MAAM,IAAI,GAAG,gBAAgB,CAAC;QAC9B,MAAM,CAAC,yBAAyB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YACjD,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;YACjC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE;YAC9B,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE;SACpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,IAAI,GAAG,0BAA0B,CAAC;QACxC,MAAM,CAAC,yBAAyB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YACjD,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;YACjC,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -27,50 +27,60 @@ export async function detectAndEnableKittyProtocol() {
|
|
|
27
27
|
}
|
|
28
28
|
let responseBuffer = '';
|
|
29
29
|
let progressiveEnhancementReceived = false;
|
|
30
|
-
let
|
|
30
|
+
let timeoutId;
|
|
31
|
+
const onTimeout = () => {
|
|
32
|
+
timeoutId = undefined;
|
|
33
|
+
process.stdin.removeListener('data', handleData);
|
|
34
|
+
if (!originalRawMode) {
|
|
35
|
+
process.stdin.setRawMode(false);
|
|
36
|
+
}
|
|
37
|
+
detectionComplete = true;
|
|
38
|
+
resolve(false);
|
|
39
|
+
};
|
|
31
40
|
const handleData = (data) => {
|
|
41
|
+
if (timeoutId === undefined) {
|
|
42
|
+
// Race condition. We have already timed out.
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
32
45
|
responseBuffer += data.toString();
|
|
33
46
|
// Check for progressive enhancement response (CSI ? <flags> u)
|
|
34
47
|
if (responseBuffer.includes('\x1b[?') && responseBuffer.includes('u')) {
|
|
35
48
|
progressiveEnhancementReceived = true;
|
|
49
|
+
// Give more time to get the full set of kitty responses if we have an
|
|
50
|
+
// indication the terminal probably supports kitty and we just need to
|
|
51
|
+
// wait a bit longer for a response.
|
|
52
|
+
clearTimeout(timeoutId);
|
|
53
|
+
timeoutId = setTimeout(onTimeout, 1000);
|
|
36
54
|
}
|
|
37
55
|
// Check for device attributes response (CSI ? <attrs> c)
|
|
38
56
|
if (responseBuffer.includes('\x1b[?') && responseBuffer.includes('c')) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
if (progressiveEnhancementReceived) {
|
|
46
|
-
// Enable the protocol
|
|
47
|
-
process.stdout.write('\x1b[>1u');
|
|
48
|
-
protocolSupported = true;
|
|
49
|
-
protocolEnabled = true;
|
|
50
|
-
// Set up cleanup on exit
|
|
51
|
-
process.on('exit', disableProtocol);
|
|
52
|
-
process.on('SIGTERM', disableProtocol);
|
|
53
|
-
}
|
|
54
|
-
detectionComplete = true;
|
|
55
|
-
resolve(protocolSupported);
|
|
57
|
+
clearTimeout(timeoutId);
|
|
58
|
+
timeoutId = undefined;
|
|
59
|
+
process.stdin.removeListener('data', handleData);
|
|
60
|
+
if (!originalRawMode) {
|
|
61
|
+
process.stdin.setRawMode(false);
|
|
56
62
|
}
|
|
63
|
+
if (progressiveEnhancementReceived) {
|
|
64
|
+
// Enable the protocol
|
|
65
|
+
process.stdout.write('\x1b[>1u');
|
|
66
|
+
protocolSupported = true;
|
|
67
|
+
protocolEnabled = true;
|
|
68
|
+
// Set up cleanup on exit
|
|
69
|
+
process.on('exit', disableProtocol);
|
|
70
|
+
process.on('SIGTERM', disableProtocol);
|
|
71
|
+
}
|
|
72
|
+
detectionComplete = true;
|
|
73
|
+
resolve(protocolSupported);
|
|
57
74
|
}
|
|
58
75
|
};
|
|
59
76
|
process.stdin.on('data', handleData);
|
|
60
77
|
// Send queries
|
|
61
78
|
process.stdout.write('\x1b[?u'); // Query progressive enhancement
|
|
62
79
|
process.stdout.write('\x1b[c'); // Query device attributes
|
|
63
|
-
// Timeout after
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (!originalRawMode) {
|
|
68
|
-
process.stdin.setRawMode(false);
|
|
69
|
-
}
|
|
70
|
-
detectionComplete = true;
|
|
71
|
-
resolve(false);
|
|
72
|
-
}
|
|
73
|
-
}, 50);
|
|
80
|
+
// Timeout after 200ms
|
|
81
|
+
// When a iterm2 terminal does not have focus this can take over 90s on a
|
|
82
|
+
// fast macbook so we need a somewhat longer threshold than would be ideal.
|
|
83
|
+
timeoutId = setTimeout(onTimeout, 200);
|
|
74
84
|
});
|
|
75
85
|
}
|
|
76
86
|
function disableProtocol() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kittyProtocolDetector.js","sourceRoot":"","sources":["../../../../src/ui/utils/kittyProtocolDetector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,IAAI,eAAe,GAAG,KAAK,CAAC;AAE5B;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B;IAChD,IAAI,iBAAiB,EAAE,CAAC;QACtB,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,CA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- needed for line breaks
|
|
31
31
|
*/
|
|
32
32
|
export declare function stripUnsafeCharacters(str: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Cached version of stringWidth function for better performance
|
|
35
|
+
* Follows Ink's approach with unlimited cache (no eviction)
|
|
36
|
+
*/
|
|
37
|
+
export declare const getCachedStringWidth: (str: string) => number;
|
|
38
|
+
/**
|
|
39
|
+
* Clear the string width cache
|
|
40
|
+
*/
|
|
41
|
+
export declare const clearStringWidthCache: () => void;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import stripAnsi from 'strip-ansi';
|
|
7
7
|
import { stripVTControlCharacters } from 'node:util';
|
|
8
|
+
import stringWidth from 'string-width';
|
|
8
9
|
/**
|
|
9
10
|
* Calculates the maximum width of a multi-line ASCII art string.
|
|
10
11
|
* @param asciiArt The ASCII art string.
|
|
@@ -22,10 +23,34 @@ export const getAsciiArtWidth = (asciiArt) => {
|
|
|
22
23
|
* Unicode‑aware helpers (work at the code‑point level rather than UTF‑16
|
|
23
24
|
* code units so that surrogate‑pair emoji count as one "column".)
|
|
24
25
|
* ---------------------------------------------------------------------- */
|
|
26
|
+
// Cache for code points to reduce GC pressure
|
|
27
|
+
const codePointsCache = new Map();
|
|
28
|
+
const MAX_STRING_LENGTH_TO_CACHE = 1000;
|
|
25
29
|
export function toCodePoints(str) {
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
// ASCII fast path - check if all chars are ASCII (0-127)
|
|
31
|
+
let isAscii = true;
|
|
32
|
+
for (let i = 0; i < str.length; i++) {
|
|
33
|
+
if (str.charCodeAt(i) > 127) {
|
|
34
|
+
isAscii = false;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (isAscii) {
|
|
39
|
+
return str.split('');
|
|
40
|
+
}
|
|
41
|
+
// Cache short strings
|
|
42
|
+
if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
|
|
43
|
+
const cached = codePointsCache.get(str);
|
|
44
|
+
if (cached) {
|
|
45
|
+
return cached;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const result = Array.from(str);
|
|
49
|
+
// Cache result (unlimited like Ink)
|
|
50
|
+
if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
|
|
51
|
+
codePointsCache.set(str, result);
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
29
54
|
}
|
|
30
55
|
export function cpLen(str) {
|
|
31
56
|
return toCodePoints(str).length;
|
|
@@ -77,4 +102,28 @@ export function stripUnsafeCharacters(str) {
|
|
|
77
102
|
})
|
|
78
103
|
.join('');
|
|
79
104
|
}
|
|
105
|
+
// String width caching for performance optimization
|
|
106
|
+
const stringWidthCache = new Map();
|
|
107
|
+
/**
|
|
108
|
+
* Cached version of stringWidth function for better performance
|
|
109
|
+
* Follows Ink's approach with unlimited cache (no eviction)
|
|
110
|
+
*/
|
|
111
|
+
export const getCachedStringWidth = (str) => {
|
|
112
|
+
// ASCII printable chars have width 1
|
|
113
|
+
if (/^[\x20-\x7E]*$/.test(str)) {
|
|
114
|
+
return str.length;
|
|
115
|
+
}
|
|
116
|
+
if (stringWidthCache.has(str)) {
|
|
117
|
+
return stringWidthCache.get(str);
|
|
118
|
+
}
|
|
119
|
+
const width = stringWidth(str);
|
|
120
|
+
stringWidthCache.set(str, width);
|
|
121
|
+
return width;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Clear the string width cache
|
|
125
|
+
*/
|
|
126
|
+
export const clearStringWidthCache = () => {
|
|
127
|
+
stringWidthCache.clear();
|
|
128
|
+
};
|
|
80
129
|
//# sourceMappingURL=textUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textUtils.js","sourceRoot":"","sources":["../../../../src/ui/utils/textUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,WA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AI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI;YAAE,OAAO,KAAK,CAAC;QAE/C,mEAAmE;QACnE,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI;YAAE,OAAO,KAAK,CAAC;QAE/C,kFAAkF;QAClF,oDAAoD;QAEpD,yDAAyD;QACzD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,oDAAoD;AACpD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAU,EAAE;IAC1D,qCAAqC;IACrC,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;IACpC,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEjC,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAS,EAAE;IAC9C,gBAAgB,CAAC,KAAK,EAAE,CAAC;AAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type SlashCommand } from '../ui/commands/types.js';
|
|
7
|
+
export type ParsedSlashCommand = {
|
|
8
|
+
commandToExecute: SlashCommand | undefined;
|
|
9
|
+
args: string;
|
|
10
|
+
canonicalPath: string[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Parses a raw slash command string into its command, arguments, and canonical path.
|
|
14
|
+
* If no valid command is found, the `commandToExecute` property will be `undefined`.
|
|
15
|
+
*
|
|
16
|
+
* @param query The raw input string, e.g., "/memory add some data" or "/help".
|
|
17
|
+
* @param commands The list of available top-level slash commands.
|
|
18
|
+
* @returns An object containing the resolved command, its arguments, and its canonical path.
|
|
19
|
+
*/
|
|
20
|
+
export declare const parseSlashCommand: (query: string, commands: readonly SlashCommand[]) => ParsedSlashCommand;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import {} from '../ui/commands/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Parses a raw slash command string into its command, arguments, and canonical path.
|
|
9
|
+
* If no valid command is found, the `commandToExecute` property will be `undefined`.
|
|
10
|
+
*
|
|
11
|
+
* @param query The raw input string, e.g., "/memory add some data" or "/help".
|
|
12
|
+
* @param commands The list of available top-level slash commands.
|
|
13
|
+
* @returns An object containing the resolved command, its arguments, and its canonical path.
|
|
14
|
+
*/
|
|
15
|
+
export const parseSlashCommand = (query, commands) => {
|
|
16
|
+
const trimmed = query.trim();
|
|
17
|
+
const parts = trimmed.substring(1).trim().split(/\s+/);
|
|
18
|
+
const commandPath = parts.filter((p) => p); // The parts of the command, e.g., ['memory', 'add']
|
|
19
|
+
let currentCommands = commands;
|
|
20
|
+
let commandToExecute;
|
|
21
|
+
let pathIndex = 0;
|
|
22
|
+
const canonicalPath = [];
|
|
23
|
+
for (const part of commandPath) {
|
|
24
|
+
// TODO: For better performance and architectural clarity, this two-pass
|
|
25
|
+
// search could be replaced. A more optimal approach would be to
|
|
26
|
+
// pre-compute a single lookup map in `CommandService.ts` that resolves
|
|
27
|
+
// all name and alias conflicts during the initial loading phase. The
|
|
28
|
+
// processor would then perform a single, fast lookup on that map.
|
|
29
|
+
// First pass: check for an exact match on the primary command name.
|
|
30
|
+
let foundCommand = currentCommands.find((cmd) => cmd.name === part);
|
|
31
|
+
// Second pass: if no primary name matches, check for an alias.
|
|
32
|
+
if (!foundCommand) {
|
|
33
|
+
foundCommand = currentCommands.find((cmd) => cmd.altNames?.includes(part));
|
|
34
|
+
}
|
|
35
|
+
if (foundCommand) {
|
|
36
|
+
commandToExecute = foundCommand;
|
|
37
|
+
canonicalPath.push(foundCommand.name);
|
|
38
|
+
pathIndex++;
|
|
39
|
+
if (foundCommand.subCommands) {
|
|
40
|
+
currentCommands = foundCommand.subCommands;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const args = parts.slice(pathIndex).join(' ');
|
|
51
|
+
return { commandToExecute, args, canonicalPath };
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../src/utils/commands.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAqB,MAAM,yBAAyB,CAAC;AAQ5D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAAa,EACb,QAAiC,EACb,EAAE;IACtB,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAE7B,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,oDAAoD;IAEh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2.0
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect } from 'vitest';
|
|
7
|
+
import { parseSlashCommand } from './commands.js';
|
|
8
|
+
import { CommandKind } from '../ui/commands/types.js';
|
|
9
|
+
// Mock command structure for testing
|
|
10
|
+
const mockCommands = [
|
|
11
|
+
{
|
|
12
|
+
name: 'help',
|
|
13
|
+
description: 'Show help',
|
|
14
|
+
action: async () => { },
|
|
15
|
+
kind: CommandKind.BUILT_IN,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'commit',
|
|
19
|
+
description: 'Commit changes',
|
|
20
|
+
action: async () => { },
|
|
21
|
+
kind: CommandKind.FILE,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'memory',
|
|
25
|
+
description: 'Manage memory',
|
|
26
|
+
altNames: ['mem'],
|
|
27
|
+
subCommands: [
|
|
28
|
+
{
|
|
29
|
+
name: 'add',
|
|
30
|
+
description: 'Add to memory',
|
|
31
|
+
action: async () => { },
|
|
32
|
+
kind: CommandKind.BUILT_IN,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'clear',
|
|
36
|
+
description: 'Clear memory',
|
|
37
|
+
altNames: ['c'],
|
|
38
|
+
action: async () => { },
|
|
39
|
+
kind: CommandKind.BUILT_IN,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
kind: CommandKind.BUILT_IN,
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
describe('parseSlashCommand', () => {
|
|
46
|
+
it('should parse a simple command without arguments', () => {
|
|
47
|
+
const result = parseSlashCommand('/help', mockCommands);
|
|
48
|
+
expect(result.commandToExecute?.name).toBe('help');
|
|
49
|
+
expect(result.args).toBe('');
|
|
50
|
+
expect(result.canonicalPath).toEqual(['help']);
|
|
51
|
+
});
|
|
52
|
+
it('should parse a simple command with arguments', () => {
|
|
53
|
+
const result = parseSlashCommand('/commit -m "Initial commit"', mockCommands);
|
|
54
|
+
expect(result.commandToExecute?.name).toBe('commit');
|
|
55
|
+
expect(result.args).toBe('-m "Initial commit"');
|
|
56
|
+
expect(result.canonicalPath).toEqual(['commit']);
|
|
57
|
+
});
|
|
58
|
+
it('should parse a subcommand', () => {
|
|
59
|
+
const result = parseSlashCommand('/memory add', mockCommands);
|
|
60
|
+
expect(result.commandToExecute?.name).toBe('add');
|
|
61
|
+
expect(result.args).toBe('');
|
|
62
|
+
expect(result.canonicalPath).toEqual(['memory', 'add']);
|
|
63
|
+
});
|
|
64
|
+
it('should parse a subcommand with arguments', () => {
|
|
65
|
+
const result = parseSlashCommand('/memory add some important data', mockCommands);
|
|
66
|
+
expect(result.commandToExecute?.name).toBe('add');
|
|
67
|
+
expect(result.args).toBe('some important data');
|
|
68
|
+
expect(result.canonicalPath).toEqual(['memory', 'add']);
|
|
69
|
+
});
|
|
70
|
+
it('should handle a command alias', () => {
|
|
71
|
+
const result = parseSlashCommand('/mem add some data', mockCommands);
|
|
72
|
+
expect(result.commandToExecute?.name).toBe('add');
|
|
73
|
+
expect(result.args).toBe('some data');
|
|
74
|
+
expect(result.canonicalPath).toEqual(['memory', 'add']);
|
|
75
|
+
});
|
|
76
|
+
it('should handle a subcommand alias', () => {
|
|
77
|
+
const result = parseSlashCommand('/memory c', mockCommands);
|
|
78
|
+
expect(result.commandToExecute?.name).toBe('clear');
|
|
79
|
+
expect(result.args).toBe('');
|
|
80
|
+
expect(result.canonicalPath).toEqual(['memory', 'clear']);
|
|
81
|
+
});
|
|
82
|
+
it('should return undefined for an unknown command', () => {
|
|
83
|
+
const result = parseSlashCommand('/unknown', mockCommands);
|
|
84
|
+
expect(result.commandToExecute).toBeUndefined();
|
|
85
|
+
expect(result.args).toBe('unknown');
|
|
86
|
+
expect(result.canonicalPath).toEqual([]);
|
|
87
|
+
});
|
|
88
|
+
it('should return the parent command if subcommand is unknown', () => {
|
|
89
|
+
const result = parseSlashCommand('/memory unknownsub some args', mockCommands);
|
|
90
|
+
expect(result.commandToExecute?.name).toBe('memory');
|
|
91
|
+
expect(result.args).toBe('unknownsub some args');
|
|
92
|
+
expect(result.canonicalPath).toEqual(['memory']);
|
|
93
|
+
});
|
|
94
|
+
it('should handle extra whitespace', () => {
|
|
95
|
+
const result = parseSlashCommand(' /memory add some data ', mockCommands);
|
|
96
|
+
expect(result.commandToExecute?.name).toBe('add');
|
|
97
|
+
expect(result.args).toBe('some data');
|
|
98
|
+
expect(result.canonicalPath).toEqual(['memory', 'add']);
|
|
99
|
+
});
|
|
100
|
+
it('should return undefined if query does not start with a slash', () => {
|
|
101
|
+
const result = parseSlashCommand('help', mockCommands);
|
|
102
|
+
expect(result.commandToExecute).toBeUndefined();
|
|
103
|
+
});
|
|
104
|
+
it('should handle an empty query', () => {
|
|
105
|
+
const result = parseSlashCommand('', mockCommands);
|
|
106
|
+
expect(result.commandToExecute).toBeUndefined();
|
|
107
|
+
});
|
|
108
|
+
it('should handle a query with only a slash', () => {
|
|
109
|
+
const result = parseSlashCommand('/', mockCommands);
|
|
110
|
+
expect(result.commandToExecute).toBeUndefined();
|
|
111
|
+
expect(result.args).toBe('');
|
|
112
|
+
expect(result.canonicalPath).toEqual([]);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=commands.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.test.js","sourceRoot":"","sources":["../../../src/utils/commands.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,WAAW,EAAqB,MAAM,yBAAyB,CAAC;AAEzE,qCAAqC;AACrC,MAAM,YAAY,GAA4B;IAC5C;QACE,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,WAAW;QACxB,MAAM,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;QACtB,IAAI,EAAE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