@vybestack/llxprt-code-core 0.1.19-beta → 0.1.19-gamma
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/src/auth/anthropic-device-flow.d.ts +53 -0
- package/dist/src/auth/anthropic-device-flow.js +208 -0
- package/dist/src/auth/anthropic-device-flow.js.map +1 -0
- package/dist/src/auth/precedence.d.ts +55 -0
- package/dist/src/auth/precedence.js +211 -0
- package/dist/src/auth/precedence.js.map +1 -0
- package/dist/src/auth/qwen-device-flow.d.ts +45 -0
- package/dist/src/auth/qwen-device-flow.js +179 -0
- package/dist/src/auth/qwen-device-flow.js.map +1 -0
- package/dist/src/auth/token-store.d.ts +66 -0
- package/dist/src/auth/token-store.js +151 -0
- package/dist/src/auth/token-store.js.map +1 -0
- package/dist/src/auth/types.d.ts +130 -0
- package/dist/src/auth/types.js +60 -0
- package/dist/src/auth/types.js.map +1 -0
- package/dist/src/config/config.d.ts +7 -1
- package/dist/src/config/config.js +42 -4
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/endpoints.d.ts +60 -0
- package/dist/src/config/endpoints.js +126 -0
- package/dist/src/config/endpoints.js.map +1 -0
- package/dist/src/config/profileManager.d.ts +14 -4
- package/dist/src/config/profileManager.js +90 -11
- package/dist/src/config/profileManager.js.map +1 -1
- package/dist/src/core/client.js +9 -12
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/contentGenerator.d.ts +4 -1
- package/dist/src/core/contentGenerator.js +3 -0
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/subagent.js +12 -10
- package/dist/src/core/subagent.js.map +1 -1
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/providers/BaseProvider.d.ts +149 -0
- package/dist/src/providers/BaseProvider.js +315 -0
- package/dist/src/providers/BaseProvider.js.map +1 -0
- package/dist/src/providers/IProvider.d.ts +1 -0
- package/dist/src/providers/LoggingProviderWrapper.d.ts +1 -0
- package/dist/src/providers/LoggingProviderWrapper.js +3 -0
- package/dist/src/providers/LoggingProviderWrapper.js.map +1 -1
- package/dist/src/providers/ProviderManager.d.ts +0 -1
- package/dist/src/providers/ProviderManager.js +23 -14
- package/dist/src/providers/ProviderManager.js.map +1 -1
- package/dist/src/providers/anthropic/AnthropicProvider.d.ts +20 -6
- package/dist/src/providers/anthropic/AnthropicProvider.js +172 -26
- package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -1
- package/dist/src/providers/gemini/GeminiProvider.d.ts +16 -7
- package/dist/src/providers/gemini/GeminiProvider.js +163 -148
- package/dist/src/providers/gemini/GeminiProvider.js.map +1 -1
- package/dist/src/providers/openai/OpenAIProvider.d.ts +53 -6
- package/dist/src/providers/openai/OpenAIProvider.js +373 -40
- package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
- package/dist/src/providers/openai/RESPONSES_API_MODELS.d.ts +1 -1
- package/dist/src/providers/openai/RESPONSES_API_MODELS.js +1 -0
- package/dist/src/providers/openai/RESPONSES_API_MODELS.js.map +1 -1
- package/dist/src/providers/openai/syntheticToolResponses.d.ts +52 -0
- package/dist/src/providers/openai/syntheticToolResponses.js +129 -0
- package/dist/src/providers/openai/syntheticToolResponses.js.map +1 -0
- package/dist/src/settings/SettingsService.d.ts +32 -0
- package/dist/src/settings/SettingsService.js +204 -0
- package/dist/src/settings/SettingsService.js.map +1 -0
- package/dist/src/settings/settingsServiceInstance.d.ts +12 -0
- package/dist/src/settings/settingsServiceInstance.js +24 -0
- package/dist/src/settings/settingsServiceInstance.js.map +1 -0
- package/dist/src/settings/types.d.ts +141 -0
- package/dist/src/settings/types.js +5 -0
- package/dist/src/settings/types.js.map +1 -0
- package/package.json +4 -2
- package/dist/src/code_assist/converter.test.d.ts +0 -6
- package/dist/src/code_assist/converter.test.js +0 -279
- package/dist/src/code_assist/converter.test.js.map +0 -1
- package/dist/src/code_assist/oauth2.test.d.ts +0 -6
- package/dist/src/code_assist/oauth2.test.js +0 -370
- package/dist/src/code_assist/oauth2.test.js.map +0 -1
- package/dist/src/code_assist/server.test.d.ts +0 -6
- package/dist/src/code_assist/server.test.js +0 -134
- package/dist/src/code_assist/server.test.js.map +0 -1
- package/dist/src/code_assist/setup.test.d.ts +0 -6
- package/dist/src/code_assist/setup.test.js +0 -65
- package/dist/src/code_assist/setup.test.js.map +0 -1
- package/dist/src/config/config.alwaysAllow.test.d.ts +0 -6
- package/dist/src/config/config.alwaysAllow.test.js +0 -84
- package/dist/src/config/config.alwaysAllow.test.js.map +0 -1
- package/dist/src/config/config.ephemeral.test.d.ts +0 -6
- package/dist/src/config/config.ephemeral.test.js +0 -152
- package/dist/src/config/config.ephemeral.test.js.map +0 -1
- package/dist/src/config/config.test.d.ts +0 -6
- package/dist/src/config/config.test.js +0 -369
- package/dist/src/config/config.test.js.map +0 -1
- package/dist/src/config/flashFallback.test.d.ts +0 -6
- package/dist/src/config/flashFallback.test.js +0 -91
- package/dist/src/config/flashFallback.test.js.map +0 -1
- package/dist/src/core/client.test.d.ts +0 -6
- package/dist/src/core/client.test.js +0 -1322
- package/dist/src/core/client.test.js.map +0 -1
- package/dist/src/core/contentGenerator.test.d.ts +0 -6
- package/dist/src/core/contentGenerator.test.js +0 -103
- package/dist/src/core/contentGenerator.test.js.map +0 -1
- package/dist/src/core/coreToolScheduler.test.d.ts +0 -6
- package/dist/src/core/coreToolScheduler.test.js +0 -637
- package/dist/src/core/coreToolScheduler.test.js.map +0 -1
- package/dist/src/core/geminiChat.test.d.ts +0 -6
- package/dist/src/core/geminiChat.test.js +0 -425
- package/dist/src/core/geminiChat.test.js.map +0 -1
- package/dist/src/core/googleGenAIWrapper.test.d.ts +0 -6
- package/dist/src/core/googleGenAIWrapper.test.js +0 -104
- package/dist/src/core/googleGenAIWrapper.test.js.map +0 -1
- package/dist/src/core/logger.test.d.ts +0 -6
- package/dist/src/core/logger.test.js +0 -467
- package/dist/src/core/logger.test.js.map +0 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.d.ts +0 -6
- package/dist/src/core/nonInteractiveToolExecutor.test.js +0 -165
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +0 -1
- package/dist/src/core/prompts-async.test.d.ts +0 -6
- package/dist/src/core/prompts-async.test.js +0 -115
- package/dist/src/core/prompts-async.test.js.map +0 -1
- package/dist/src/core/prompts.test.d.ts +0 -6
- package/dist/src/core/prompts.test.js +0 -68
- package/dist/src/core/prompts.test.js.map +0 -1
- package/dist/src/core/subagent.test.d.ts +0 -6
- package/dist/src/core/subagent.test.js +0 -519
- package/dist/src/core/subagent.test.js.map +0 -1
- package/dist/src/core/tokenLimits.test.d.ts +0 -6
- package/dist/src/core/tokenLimits.test.js +0 -66
- package/dist/src/core/tokenLimits.test.js.map +0 -1
- package/dist/src/core/turn.test.d.ts +0 -6
- package/dist/src/core/turn.test.js +0 -366
- package/dist/src/core/turn.test.js.map +0 -1
- package/dist/src/hooks/tool-render-suppression-hook.test.d.ts +0 -6
- package/dist/src/hooks/tool-render-suppression-hook.test.js +0 -59
- package/dist/src/hooks/tool-render-suppression-hook.test.js.map +0 -1
- package/dist/src/ide/ide-installer.test.d.ts +0 -6
- package/dist/src/ide/ide-installer.test.js +0 -55
- package/dist/src/ide/ide-installer.test.js.map +0 -1
- package/dist/src/ide/ideContext.test.d.ts +0 -6
- package/dist/src/ide/ideContext.test.js +0 -265
- package/dist/src/ide/ideContext.test.js.map +0 -1
- package/dist/src/index.test.d.ts +0 -6
- package/dist/src/index.test.js +0 -12
- package/dist/src/index.test.js.map +0 -1
- package/dist/src/integration-tests/todo-system.test.d.ts +0 -6
- package/dist/src/integration-tests/todo-system.test.js +0 -46
- package/dist/src/integration-tests/todo-system.test.js.map +0 -1
- package/dist/src/mcp/google-auth-provider.test.d.ts +0 -6
- package/dist/src/mcp/google-auth-provider.test.js +0 -54
- package/dist/src/mcp/google-auth-provider.test.js.map +0 -1
- package/dist/src/mcp/oauth-provider.test.d.ts +0 -6
- package/dist/src/mcp/oauth-provider.test.js +0 -602
- package/dist/src/mcp/oauth-provider.test.js.map +0 -1
- package/dist/src/mcp/oauth-token-storage.test.d.ts +0 -6
- package/dist/src/mcp/oauth-token-storage.test.js +0 -205
- package/dist/src/mcp/oauth-token-storage.test.js.map +0 -1
- package/dist/src/mcp/oauth-utils.test.d.ts +0 -6
- package/dist/src/mcp/oauth-utils.test.js +0 -144
- package/dist/src/mcp/oauth-utils.test.js.map +0 -1
- package/dist/src/parsers/TextToolCallParser.multibyte.test.d.ts +0 -1
- package/dist/src/parsers/TextToolCallParser.multibyte.test.js +0 -42
- package/dist/src/parsers/TextToolCallParser.multibyte.test.js.map +0 -1
- package/dist/src/parsers/TextToolCallParser.test.d.ts +0 -1
- package/dist/src/parsers/TextToolCallParser.test.js +0 -225
- package/dist/src/parsers/TextToolCallParser.test.js.map +0 -1
- package/dist/src/prompt-config/TemplateEngine.test.d.ts +0 -1
- package/dist/src/prompt-config/TemplateEngine.test.js +0 -494
- package/dist/src/prompt-config/TemplateEngine.test.js.map +0 -1
- package/dist/src/prompt-config/prompt-cache.test.d.ts +0 -6
- package/dist/src/prompt-config/prompt-cache.test.js +0 -437
- package/dist/src/prompt-config/prompt-cache.test.js.map +0 -1
- package/dist/src/prompt-config/prompt-installer.test.d.ts +0 -7
- package/dist/src/prompt-config/prompt-installer.test.js +0 -503
- package/dist/src/prompt-config/prompt-installer.test.js.map +0 -1
- package/dist/src/prompt-config/prompt-loader.test.d.ts +0 -5
- package/dist/src/prompt-config/prompt-loader.test.js +0 -413
- package/dist/src/prompt-config/prompt-loader.test.js.map +0 -1
- package/dist/src/prompt-config/prompt-resolver.test.d.ts +0 -1
- package/dist/src/prompt-config/prompt-resolver.test.js +0 -529
- package/dist/src/prompt-config/prompt-resolver.test.js.map +0 -1
- package/dist/src/prompt-config/prompt-service.test.d.ts +0 -1
- package/dist/src/prompt-config/prompt-service.test.js +0 -811
- package/dist/src/prompt-config/prompt-service.test.js.map +0 -1
- package/dist/src/providers/ProviderManager.gemini-switch.test.d.ts +0 -6
- package/dist/src/providers/ProviderManager.gemini-switch.test.js +0 -57
- package/dist/src/providers/ProviderManager.gemini-switch.test.js.map +0 -1
- package/dist/src/providers/ProviderManager.test.d.ts +0 -6
- package/dist/src/providers/ProviderManager.test.js +0 -284
- package/dist/src/providers/ProviderManager.test.js.map +0 -1
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.test.d.ts +0 -6
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.test.js +0 -273
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.test.js.map +0 -1
- package/dist/src/providers/anthropic/AnthropicProvider.modelParams.test.d.ts +0 -1
- package/dist/src/providers/anthropic/AnthropicProvider.modelParams.test.js +0 -48
- package/dist/src/providers/anthropic/AnthropicProvider.modelParams.test.js.map +0 -1
- package/dist/src/providers/anthropic/AnthropicProvider.test.d.ts +0 -1
- package/dist/src/providers/anthropic/AnthropicProvider.test.js +0 -487
- package/dist/src/providers/anthropic/AnthropicProvider.test.js.map +0 -1
- package/dist/src/providers/gemini/GeminiProvider.integration.test.d.ts +0 -6
- package/dist/src/providers/gemini/GeminiProvider.integration.test.js +0 -126
- package/dist/src/providers/gemini/GeminiProvider.integration.test.js.map +0 -1
- package/dist/src/providers/gemini/GeminiProvider.test.d.ts +0 -6
- package/dist/src/providers/gemini/GeminiProvider.test.js +0 -136
- package/dist/src/providers/gemini/GeminiProvider.test.js.map +0 -1
- package/dist/src/providers/integration/multi-provider.integration.test.d.ts +0 -6
- package/dist/src/providers/integration/multi-provider.integration.test.js +0 -292
- package/dist/src/providers/integration/multi-provider.integration.test.js.map +0 -1
- package/dist/src/providers/openai/ConversationCache.accumTokens.test.d.ts +0 -1
- package/dist/src/providers/openai/ConversationCache.accumTokens.test.js +0 -97
- package/dist/src/providers/openai/ConversationCache.accumTokens.test.js.map +0 -1
- package/dist/src/providers/openai/ConversationCache.test.d.ts +0 -1
- package/dist/src/providers/openai/ConversationCache.test.js +0 -113
- package/dist/src/providers/openai/ConversationCache.test.js.map +0 -1
- package/dist/src/providers/openai/OpenAIProvider.callResponses.stateless.test.d.ts +0 -1
- package/dist/src/providers/openai/OpenAIProvider.callResponses.stateless.test.js +0 -189
- package/dist/src/providers/openai/OpenAIProvider.callResponses.stateless.test.js.map +0 -1
- package/dist/src/providers/openai/OpenAIProvider.integration.test.d.ts +0 -6
- package/dist/src/providers/openai/OpenAIProvider.integration.test.js +0 -125
- package/dist/src/providers/openai/OpenAIProvider.integration.test.js.map +0 -1
- package/dist/src/providers/openai/OpenAIProvider.responses.test.d.ts +0 -1
- package/dist/src/providers/openai/OpenAIProvider.responses.test.js +0 -350
- package/dist/src/providers/openai/OpenAIProvider.responses.test.js.map +0 -1
- package/dist/src/providers/openai/OpenAIProvider.responsesIntegration.test.d.ts +0 -1
- package/dist/src/providers/openai/OpenAIProvider.responsesIntegration.test.js +0 -213
- package/dist/src/providers/openai/OpenAIProvider.responsesIntegration.test.js.map +0 -1
- package/dist/src/providers/openai/OpenAIProvider.shouldUseResponses.test.d.ts +0 -1
- package/dist/src/providers/openai/OpenAIProvider.shouldUseResponses.test.js +0 -59
- package/dist/src/providers/openai/OpenAIProvider.shouldUseResponses.test.js.map +0 -1
- package/dist/src/providers/openai/OpenAIProvider.stateful.integration.test.d.ts +0 -6
- package/dist/src/providers/openai/OpenAIProvider.stateful.integration.test.js +0 -105
- package/dist/src/providers/openai/OpenAIProvider.stateful.integration.test.js.map +0 -1
- package/dist/src/providers/openai/OpenAIProvider.switch.test.d.ts +0 -1
- package/dist/src/providers/openai/OpenAIProvider.switch.test.js +0 -256
- package/dist/src/providers/openai/OpenAIProvider.switch.test.js.map +0 -1
- package/dist/src/providers/openai/OpenAIProvider.test.d.ts +0 -16
- package/dist/src/providers/openai/OpenAIProvider.test.js +0 -620
- package/dist/src/providers/openai/OpenAIProvider.test.js.map +0 -1
- package/dist/src/providers/openai/ResponsesContextTrim.integration.test.d.ts +0 -1
- package/dist/src/providers/openai/ResponsesContextTrim.integration.test.js +0 -210
- package/dist/src/providers/openai/ResponsesContextTrim.integration.test.js.map +0 -1
- package/dist/src/providers/openai/__tests__/formatArrayResponse.test.d.ts +0 -1
- package/dist/src/providers/openai/__tests__/formatArrayResponse.test.js +0 -65
- package/dist/src/providers/openai/__tests__/formatArrayResponse.test.js.map +0 -1
- package/dist/src/providers/openai/buildResponsesRequest.stripToolCalls.test.d.ts +0 -1
- package/dist/src/providers/openai/buildResponsesRequest.stripToolCalls.test.js +0 -129
- package/dist/src/providers/openai/buildResponsesRequest.stripToolCalls.test.js.map +0 -1
- package/dist/src/providers/openai/buildResponsesRequest.test.d.ts +0 -1
- package/dist/src/providers/openai/buildResponsesRequest.test.js +0 -406
- package/dist/src/providers/openai/buildResponsesRequest.test.js.map +0 -1
- package/dist/src/providers/openai/buildResponsesRequest.undefined.test.d.ts +0 -1
- package/dist/src/providers/openai/buildResponsesRequest.undefined.test.js +0 -50
- package/dist/src/providers/openai/buildResponsesRequest.undefined.test.js.map +0 -1
- package/dist/src/providers/openai/estimateRemoteTokens.test.d.ts +0 -1
- package/dist/src/providers/openai/estimateRemoteTokens.test.js +0 -125
- package/dist/src/providers/openai/estimateRemoteTokens.test.js.map +0 -1
- package/dist/src/providers/openai/parseResponsesStream.responsesToolCalls.test.d.ts +0 -1
- package/dist/src/providers/openai/parseResponsesStream.responsesToolCalls.test.js +0 -192
- package/dist/src/providers/openai/parseResponsesStream.responsesToolCalls.test.js.map +0 -1
- package/dist/src/providers/openai/parseResponsesStream.test.d.ts +0 -1
- package/dist/src/providers/openai/parseResponsesStream.test.js +0 -151
- package/dist/src/providers/openai/parseResponsesStream.test.js.map +0 -1
- package/dist/src/services/fileDiscoveryService.test.d.ts +0 -6
- package/dist/src/services/fileDiscoveryService.test.js +0 -143
- package/dist/src/services/fileDiscoveryService.test.js.map +0 -1
- package/dist/src/services/gitService.test.d.ts +0 -6
- package/dist/src/services/gitService.test.js +0 -209
- package/dist/src/services/gitService.test.js.map +0 -1
- package/dist/src/services/loopDetectionService.test.d.ts +0 -6
- package/dist/src/services/loopDetectionService.test.js +0 -484
- package/dist/src/services/loopDetectionService.test.js.map +0 -1
- package/dist/src/services/shellExecutionService.multibyte.test.d.ts +0 -6
- package/dist/src/services/shellExecutionService.multibyte.test.js +0 -72
- package/dist/src/services/shellExecutionService.multibyte.test.js.map +0 -1
- package/dist/src/services/shellExecutionService.test.d.ts +0 -6
- package/dist/src/services/shellExecutionService.test.js +0 -272
- package/dist/src/services/shellExecutionService.test.js.map +0 -1
- package/dist/src/services/shellExecutionService.windows.multibyte.test.d.ts +0 -6
- package/dist/src/services/shellExecutionService.windows.multibyte.test.js +0 -98
- package/dist/src/services/shellExecutionService.windows.multibyte.test.js.map +0 -1
- package/dist/src/services/shellExecutionService.windows.test.d.ts +0 -6
- package/dist/src/services/shellExecutionService.windows.test.js +0 -79
- package/dist/src/services/shellExecutionService.windows.test.js.map +0 -1
- package/dist/src/services/tool-call-tracker-service.test.d.ts +0 -6
- package/dist/src/services/tool-call-tracker-service.test.js +0 -99
- package/dist/src/services/tool-call-tracker-service.test.js.map +0 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +0 -6
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +0 -187
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +0 -1
- package/dist/src/telemetry/loggers.test.d.ts +0 -6
- package/dist/src/telemetry/loggers.test.js +0 -573
- package/dist/src/telemetry/loggers.test.js.map +0 -1
- package/dist/src/telemetry/metrics.test.d.ts +0 -6
- package/dist/src/telemetry/metrics.test.js +0 -212
- package/dist/src/telemetry/metrics.test.js.map +0 -1
- package/dist/src/telemetry/telemetry.test.d.ts +0 -6
- package/dist/src/telemetry/telemetry.test.js +0 -54
- package/dist/src/telemetry/telemetry.test.js.map +0 -1
- package/dist/src/telemetry/uiTelemetry.test.d.ts +0 -6
- package/dist/src/telemetry/uiTelemetry.test.js +0 -518
- package/dist/src/telemetry/uiTelemetry.test.js.map +0 -1
- package/dist/src/tools/ToolFormatter.test.d.ts +0 -16
- package/dist/src/tools/ToolFormatter.test.js +0 -349
- package/dist/src/tools/ToolFormatter.test.js.map +0 -1
- package/dist/src/tools/ToolFormatter.toResponsesTool.test.d.ts +0 -1
- package/dist/src/tools/ToolFormatter.toResponsesTool.test.js +0 -241
- package/dist/src/tools/ToolFormatter.toResponsesTool.test.js.map +0 -1
- package/dist/src/tools/diffOptions.test.d.ts +0 -6
- package/dist/src/tools/diffOptions.test.js +0 -119
- package/dist/src/tools/diffOptions.test.js.map +0 -1
- package/dist/src/tools/edit.test.d.ts +0 -6
- package/dist/src/tools/edit.test.js +0 -689
- package/dist/src/tools/edit.test.js.map +0 -1
- package/dist/src/tools/glob.test.d.ts +0 -6
- package/dist/src/tools/glob.test.js +0 -332
- package/dist/src/tools/glob.test.js.map +0 -1
- package/dist/src/tools/grep.test.d.ts +0 -6
- package/dist/src/tools/grep.test.js +0 -272
- package/dist/src/tools/grep.test.js.map +0 -1
- package/dist/src/tools/ls.test.d.ts +0 -6
- package/dist/src/tools/ls.test.js +0 -357
- package/dist/src/tools/ls.test.js.map +0 -1
- package/dist/src/tools/mcp-client.test.d.ts +0 -6
- package/dist/src/tools/mcp-client.test.js +0 -617
- package/dist/src/tools/mcp-client.test.js.map +0 -1
- package/dist/src/tools/mcp-tool.test.d.ts +0 -6
- package/dist/src/tools/mcp-tool.test.js +0 -501
- package/dist/src/tools/mcp-tool.test.js.map +0 -1
- package/dist/src/tools/memoryTool.test.d.ts +0 -6
- package/dist/src/tools/memoryTool.test.js +0 -266
- package/dist/src/tools/memoryTool.test.js.map +0 -1
- package/dist/src/tools/modifiable-tool.test.d.ts +0 -6
- package/dist/src/tools/modifiable-tool.test.js +0 -193
- package/dist/src/tools/modifiable-tool.test.js.map +0 -1
- package/dist/src/tools/read-file.test.d.ts +0 -6
- package/dist/src/tools/read-file.test.js +0 -319
- package/dist/src/tools/read-file.test.js.map +0 -1
- package/dist/src/tools/read-many-files.test.d.ts +0 -6
- package/dist/src/tools/read-many-files.test.js +0 -644
- package/dist/src/tools/read-many-files.test.js.map +0 -1
- package/dist/src/tools/shell.multibyte.test.d.ts +0 -6
- package/dist/src/tools/shell.multibyte.test.js +0 -75
- package/dist/src/tools/shell.multibyte.test.js.map +0 -1
- package/dist/src/tools/shell.test.d.ts +0 -6
- package/dist/src/tools/shell.test.js +0 -367
- package/dist/src/tools/shell.test.js.map +0 -1
- package/dist/src/tools/todo-pause.spec.d.ts +0 -6
- package/dist/src/tools/todo-pause.spec.js +0 -287
- package/dist/src/tools/todo-pause.spec.js.map +0 -1
- package/dist/src/tools/todo-read.test.d.ts +0 -6
- package/dist/src/tools/todo-read.test.js +0 -162
- package/dist/src/tools/todo-read.test.js.map +0 -1
- package/dist/src/tools/todo-schemas.test.d.ts +0 -6
- package/dist/src/tools/todo-schemas.test.js +0 -341
- package/dist/src/tools/todo-schemas.test.js.map +0 -1
- package/dist/src/tools/todo-store.test.d.ts +0 -6
- package/dist/src/tools/todo-store.test.js +0 -169
- package/dist/src/tools/todo-store.test.js.map +0 -1
- package/dist/src/tools/todo-write.test.d.ts +0 -6
- package/dist/src/tools/todo-write.test.js +0 -226
- package/dist/src/tools/todo-write.test.js.map +0 -1
- package/dist/src/tools/tool-registry.test.d.ts +0 -6
- package/dist/src/tools/tool-registry.test.js +0 -468
- package/dist/src/tools/tool-registry.test.js.map +0 -1
- package/dist/src/tools/tools.test.d.ts +0 -6
- package/dist/src/tools/tools.test.js +0 -117
- package/dist/src/tools/tools.test.js.map +0 -1
- package/dist/src/tools/web-fetch.integration.test.d.ts +0 -6
- package/dist/src/tools/web-fetch.integration.test.js +0 -532
- package/dist/src/tools/web-fetch.integration.test.js.map +0 -1
- package/dist/src/tools/web-search.test.d.ts +0 -6
- package/dist/src/tools/web-search.test.js +0 -230
- package/dist/src/tools/web-search.test.js.map +0 -1
- package/dist/src/tools/write-file.test.d.ts +0 -6
- package/dist/src/tools/write-file.test.js +0 -465
- package/dist/src/tools/write-file.test.js.map +0 -1
- package/dist/src/utils/bfsFileSearch.test.d.ts +0 -6
- package/dist/src/utils/bfsFileSearch.test.js +0 -191
- package/dist/src/utils/bfsFileSearch.test.js.map +0 -1
- package/dist/src/utils/editCorrector.test.d.ts +0 -6
- package/dist/src/utils/editCorrector.test.js +0 -564
- package/dist/src/utils/editCorrector.test.js.map +0 -1
- package/dist/src/utils/editor.test.d.ts +0 -6
- package/dist/src/utils/editor.test.js +0 -445
- package/dist/src/utils/editor.test.js.map +0 -1
- package/dist/src/utils/environmentContext.test.d.ts +0 -6
- package/dist/src/utils/environmentContext.test.js +0 -139
- package/dist/src/utils/environmentContext.test.js.map +0 -1
- package/dist/src/utils/errorReporting.test.d.ts +0 -6
- package/dist/src/utils/errorReporting.test.js +0 -130
- package/dist/src/utils/errorReporting.test.js.map +0 -1
- package/dist/src/utils/fileUtils.test.d.ts +0 -6
- package/dist/src/utils/fileUtils.test.js +0 -363
- package/dist/src/utils/fileUtils.test.js.map +0 -1
- package/dist/src/utils/filesearch/crawlCache.test.d.ts +0 -6
- package/dist/src/utils/filesearch/crawlCache.test.js +0 -103
- package/dist/src/utils/filesearch/crawlCache.test.js.map +0 -1
- package/dist/src/utils/filesearch/fileSearch.test.d.ts +0 -6
- package/dist/src/utils/filesearch/fileSearch.test.js +0 -654
- package/dist/src/utils/filesearch/fileSearch.test.js.map +0 -1
- package/dist/src/utils/filesearch/ignore.test.d.ts +0 -6
- package/dist/src/utils/filesearch/ignore.test.js +0 -57
- package/dist/src/utils/filesearch/ignore.test.js.map +0 -1
- package/dist/src/utils/filesearch/result-cache.test.d.ts +0 -6
- package/dist/src/utils/filesearch/result-cache.test.js +0 -47
- package/dist/src/utils/filesearch/result-cache.test.js.map +0 -1
- package/dist/src/utils/flashFallback.integration.test.d.ts +0 -6
- package/dist/src/utils/flashFallback.integration.test.js +0 -120
- package/dist/src/utils/flashFallback.integration.test.js.map +0 -1
- package/dist/src/utils/generateContentResponseUtilities.test.d.ts +0 -6
- package/dist/src/utils/generateContentResponseUtilities.test.js +0 -273
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +0 -1
- package/dist/src/utils/getFolderStructure.test.d.ts +0 -6
- package/dist/src/utils/getFolderStructure.test.js +0 -282
- package/dist/src/utils/getFolderStructure.test.js.map +0 -1
- package/dist/src/utils/gitIgnoreParser.test.d.ts +0 -6
- package/dist/src/utils/gitIgnoreParser.test.js +0 -154
- package/dist/src/utils/gitIgnoreParser.test.js.map +0 -1
- package/dist/src/utils/memoryDiscovery.test.d.ts +0 -6
- package/dist/src/utils/memoryDiscovery.test.js +0 -181
- package/dist/src/utils/memoryDiscovery.test.js.map +0 -1
- package/dist/src/utils/memoryImportProcessor.test.d.ts +0 -6
- package/dist/src/utils/memoryImportProcessor.test.js +0 -715
- package/dist/src/utils/memoryImportProcessor.test.js.map +0 -1
- package/dist/src/utils/nextSpeakerChecker.test.d.ts +0 -6
- package/dist/src/utils/nextSpeakerChecker.test.js +0 -172
- package/dist/src/utils/nextSpeakerChecker.test.js.map +0 -1
- package/dist/src/utils/partUtils.test.d.ts +0 -6
- package/dist/src/utils/partUtils.test.js +0 -130
- package/dist/src/utils/partUtils.test.js.map +0 -1
- package/dist/src/utils/paths.test.d.ts +0 -6
- package/dist/src/utils/paths.test.js +0 -153
- package/dist/src/utils/paths.test.js.map +0 -1
- package/dist/src/utils/retry.test.d.ts +0 -6
- package/dist/src/utils/retry.test.js +0 -322
- package/dist/src/utils/retry.test.js.map +0 -1
- package/dist/src/utils/safeJsonStringify.test.d.ts +0 -6
- package/dist/src/utils/safeJsonStringify.test.js +0 -61
- package/dist/src/utils/safeJsonStringify.test.js.map +0 -1
- package/dist/src/utils/sanitization.test.d.ts +0 -6
- package/dist/src/utils/sanitization.test.js +0 -81
- package/dist/src/utils/sanitization.test.js.map +0 -1
- package/dist/src/utils/schemaValidator.test.d.ts +0 -6
- package/dist/src/utils/schemaValidator.test.js +0 -146
- package/dist/src/utils/schemaValidator.test.js.map +0 -1
- package/dist/src/utils/secure-browser-launcher.test.d.ts +0 -6
- package/dist/src/utils/secure-browser-launcher.test.js +0 -149
- package/dist/src/utils/secure-browser-launcher.test.js.map +0 -1
- package/dist/src/utils/shell-utils.shellReplacement.test.d.ts +0 -6
- package/dist/src/utils/shell-utils.shellReplacement.test.js +0 -149
- package/dist/src/utils/shell-utils.shellReplacement.test.js.map +0 -1
- package/dist/src/utils/shell-utils.test.d.ts +0 -6
- package/dist/src/utils/shell-utils.test.js +0 -200
- package/dist/src/utils/shell-utils.test.js.map +0 -1
- package/dist/src/utils/summarizer.test.d.ts +0 -6
- package/dist/src/utils/summarizer.test.js +0 -131
- package/dist/src/utils/summarizer.test.js.map +0 -1
- package/dist/src/utils/systemEncoding.test.d.ts +0 -6
- package/dist/src/utils/systemEncoding.test.js +0 -368
- package/dist/src/utils/systemEncoding.test.js.map +0 -1
- package/dist/src/utils/toolOutputLimiter.test.d.ts +0 -6
- package/dist/src/utils/toolOutputLimiter.test.js +0 -164
- package/dist/src/utils/toolOutputLimiter.test.js.map +0 -1
- package/dist/src/utils/unicodeUtils.test.d.ts +0 -6
- package/dist/src/utils/unicodeUtils.test.js +0 -120
- package/dist/src/utils/unicodeUtils.test.js.map +0 -1
- package/dist/src/utils/user_account.test.d.ts +0 -6
- package/dist/src/utils/user_account.test.js +0 -153
- package/dist/src/utils/user_account.test.js.map +0 -1
- package/dist/src/utils/user_id.test.d.ts +0 -6
- package/dist/src/utils/user_id.test.js +0 -21
- package/dist/src/utils/user_id.test.js.map +0 -1
- package/dist/src/utils/workspaceContext.test.d.ts +0 -6
- package/dist/src/utils/workspaceContext.test.js +0 -209
- package/dist/src/utils/workspaceContext.test.js.map +0 -1
|
@@ -1,654 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
7
|
-
import * as fs from 'fs/promises';
|
|
8
|
-
import * as path from 'path';
|
|
9
|
-
import * as cache from './crawlCache.js';
|
|
10
|
-
import { FileSearch, AbortError, filter } from './fileSearch.js';
|
|
11
|
-
import { createTmpDir, cleanupTmpDir } from '@vybestack/llxprt-code-test-utils';
|
|
12
|
-
describe('FileSearch', () => {
|
|
13
|
-
let tmpDir;
|
|
14
|
-
afterEach(async () => {
|
|
15
|
-
if (tmpDir) {
|
|
16
|
-
await cleanupTmpDir(tmpDir);
|
|
17
|
-
}
|
|
18
|
-
vi.restoreAllMocks();
|
|
19
|
-
});
|
|
20
|
-
it('should use .geminiignore rules', async () => {
|
|
21
|
-
tmpDir = await createTmpDir({
|
|
22
|
-
'.geminiignore': 'dist/',
|
|
23
|
-
dist: ['ignored.js'],
|
|
24
|
-
src: ['not-ignored.js'],
|
|
25
|
-
});
|
|
26
|
-
const fileSearch = new FileSearch({
|
|
27
|
-
projectRoot: tmpDir,
|
|
28
|
-
useGitignore: false,
|
|
29
|
-
useGeminiignore: true,
|
|
30
|
-
ignoreDirs: [],
|
|
31
|
-
cache: false,
|
|
32
|
-
cacheTtl: 0,
|
|
33
|
-
});
|
|
34
|
-
await fileSearch.initialize();
|
|
35
|
-
const results = await fileSearch.search('');
|
|
36
|
-
expect(results).toEqual(['src/', '.geminiignore', 'src/not-ignored.js']);
|
|
37
|
-
});
|
|
38
|
-
it('should combine .gitignore and .geminiignore rules', async () => {
|
|
39
|
-
tmpDir = await createTmpDir({
|
|
40
|
-
'.gitignore': 'dist/',
|
|
41
|
-
'.geminiignore': 'build/',
|
|
42
|
-
dist: ['ignored-by-git.js'],
|
|
43
|
-
build: ['ignored-by-gemini.js'],
|
|
44
|
-
src: ['not-ignored.js'],
|
|
45
|
-
});
|
|
46
|
-
const fileSearch = new FileSearch({
|
|
47
|
-
projectRoot: tmpDir,
|
|
48
|
-
useGitignore: true,
|
|
49
|
-
useGeminiignore: true,
|
|
50
|
-
ignoreDirs: [],
|
|
51
|
-
cache: false,
|
|
52
|
-
cacheTtl: 0,
|
|
53
|
-
});
|
|
54
|
-
await fileSearch.initialize();
|
|
55
|
-
const results = await fileSearch.search('');
|
|
56
|
-
expect(results).toEqual([
|
|
57
|
-
'src/',
|
|
58
|
-
'.geminiignore',
|
|
59
|
-
'.gitignore',
|
|
60
|
-
'src/not-ignored.js',
|
|
61
|
-
]);
|
|
62
|
-
});
|
|
63
|
-
it('should use ignoreDirs option', async () => {
|
|
64
|
-
tmpDir = await createTmpDir({
|
|
65
|
-
logs: ['some.log'],
|
|
66
|
-
src: ['main.js'],
|
|
67
|
-
});
|
|
68
|
-
const fileSearch = new FileSearch({
|
|
69
|
-
projectRoot: tmpDir,
|
|
70
|
-
useGitignore: false,
|
|
71
|
-
useGeminiignore: false,
|
|
72
|
-
ignoreDirs: ['logs'],
|
|
73
|
-
cache: false,
|
|
74
|
-
cacheTtl: 0,
|
|
75
|
-
});
|
|
76
|
-
await fileSearch.initialize();
|
|
77
|
-
const results = await fileSearch.search('');
|
|
78
|
-
expect(results).toEqual(['src/', 'src/main.js']);
|
|
79
|
-
});
|
|
80
|
-
it('should handle negated directories', async () => {
|
|
81
|
-
tmpDir = await createTmpDir({
|
|
82
|
-
'.gitignore': ['build/**', '!build/public', '!build/public/**'].join('\n'),
|
|
83
|
-
build: {
|
|
84
|
-
'private.js': '',
|
|
85
|
-
public: ['index.html'],
|
|
86
|
-
},
|
|
87
|
-
src: ['main.js'],
|
|
88
|
-
});
|
|
89
|
-
const fileSearch = new FileSearch({
|
|
90
|
-
projectRoot: tmpDir,
|
|
91
|
-
useGitignore: true,
|
|
92
|
-
useGeminiignore: false,
|
|
93
|
-
ignoreDirs: [],
|
|
94
|
-
cache: false,
|
|
95
|
-
cacheTtl: 0,
|
|
96
|
-
});
|
|
97
|
-
await fileSearch.initialize();
|
|
98
|
-
const results = await fileSearch.search('');
|
|
99
|
-
expect(results).toEqual([
|
|
100
|
-
'build/',
|
|
101
|
-
'build/public/',
|
|
102
|
-
'src/',
|
|
103
|
-
'.gitignore',
|
|
104
|
-
'build/public/index.html',
|
|
105
|
-
'src/main.js',
|
|
106
|
-
]);
|
|
107
|
-
});
|
|
108
|
-
it('should filter results with a search pattern', async () => {
|
|
109
|
-
tmpDir = await createTmpDir({
|
|
110
|
-
src: {
|
|
111
|
-
'main.js': '',
|
|
112
|
-
'util.ts': '',
|
|
113
|
-
'style.css': '',
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
const fileSearch = new FileSearch({
|
|
117
|
-
projectRoot: tmpDir,
|
|
118
|
-
useGitignore: false,
|
|
119
|
-
useGeminiignore: false,
|
|
120
|
-
ignoreDirs: [],
|
|
121
|
-
cache: false,
|
|
122
|
-
cacheTtl: 0,
|
|
123
|
-
});
|
|
124
|
-
await fileSearch.initialize();
|
|
125
|
-
const results = await fileSearch.search('**/*.js');
|
|
126
|
-
expect(results).toEqual(['src/main.js']);
|
|
127
|
-
});
|
|
128
|
-
it('should handle root-level file negation', async () => {
|
|
129
|
-
tmpDir = await createTmpDir({
|
|
130
|
-
'.gitignore': ['*.mk', '!Foo.mk'].join('\n'),
|
|
131
|
-
'bar.mk': '',
|
|
132
|
-
'Foo.mk': '',
|
|
133
|
-
});
|
|
134
|
-
const fileSearch = new FileSearch({
|
|
135
|
-
projectRoot: tmpDir,
|
|
136
|
-
useGitignore: true,
|
|
137
|
-
useGeminiignore: false,
|
|
138
|
-
ignoreDirs: [],
|
|
139
|
-
cache: false,
|
|
140
|
-
cacheTtl: 0,
|
|
141
|
-
});
|
|
142
|
-
await fileSearch.initialize();
|
|
143
|
-
const results = await fileSearch.search('');
|
|
144
|
-
expect(results).toEqual(['.gitignore', 'Foo.mk']);
|
|
145
|
-
});
|
|
146
|
-
it('should handle directory negation with glob', async () => {
|
|
147
|
-
tmpDir = await createTmpDir({
|
|
148
|
-
'.gitignore': [
|
|
149
|
-
'third_party/**',
|
|
150
|
-
'!third_party/foo',
|
|
151
|
-
'!third_party/foo/bar',
|
|
152
|
-
'!third_party/foo/bar/baz_buffer',
|
|
153
|
-
].join('\n'),
|
|
154
|
-
third_party: {
|
|
155
|
-
foo: {
|
|
156
|
-
bar: {
|
|
157
|
-
baz_buffer: '',
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
ignore_this: '',
|
|
161
|
-
},
|
|
162
|
-
});
|
|
163
|
-
const fileSearch = new FileSearch({
|
|
164
|
-
projectRoot: tmpDir,
|
|
165
|
-
useGitignore: true,
|
|
166
|
-
useGeminiignore: false,
|
|
167
|
-
ignoreDirs: [],
|
|
168
|
-
cache: false,
|
|
169
|
-
cacheTtl: 0,
|
|
170
|
-
});
|
|
171
|
-
await fileSearch.initialize();
|
|
172
|
-
const results = await fileSearch.search('');
|
|
173
|
-
expect(results).toEqual([
|
|
174
|
-
'third_party/',
|
|
175
|
-
'third_party/foo/',
|
|
176
|
-
'third_party/foo/bar/',
|
|
177
|
-
'.gitignore',
|
|
178
|
-
'third_party/foo/bar/baz_buffer',
|
|
179
|
-
]);
|
|
180
|
-
});
|
|
181
|
-
it('should correctly handle negated patterns in .gitignore', async () => {
|
|
182
|
-
tmpDir = await createTmpDir({
|
|
183
|
-
'.gitignore': ['dist/**', '!dist/keep.js'].join('\n'),
|
|
184
|
-
dist: ['ignore.js', 'keep.js'],
|
|
185
|
-
src: ['main.js'],
|
|
186
|
-
});
|
|
187
|
-
const fileSearch = new FileSearch({
|
|
188
|
-
projectRoot: tmpDir,
|
|
189
|
-
useGitignore: true,
|
|
190
|
-
useGeminiignore: false,
|
|
191
|
-
ignoreDirs: [],
|
|
192
|
-
cache: false,
|
|
193
|
-
cacheTtl: 0,
|
|
194
|
-
});
|
|
195
|
-
await fileSearch.initialize();
|
|
196
|
-
const results = await fileSearch.search('');
|
|
197
|
-
expect(results).toEqual([
|
|
198
|
-
'dist/',
|
|
199
|
-
'src/',
|
|
200
|
-
'.gitignore',
|
|
201
|
-
'dist/keep.js',
|
|
202
|
-
'src/main.js',
|
|
203
|
-
]);
|
|
204
|
-
});
|
|
205
|
-
// New test cases start here
|
|
206
|
-
it('should initialize correctly when ignore files are missing', async () => {
|
|
207
|
-
tmpDir = await createTmpDir({
|
|
208
|
-
src: ['file1.js'],
|
|
209
|
-
});
|
|
210
|
-
const fileSearch = new FileSearch({
|
|
211
|
-
projectRoot: tmpDir,
|
|
212
|
-
useGitignore: true,
|
|
213
|
-
useGeminiignore: true,
|
|
214
|
-
ignoreDirs: [],
|
|
215
|
-
cache: false,
|
|
216
|
-
cacheTtl: 0,
|
|
217
|
-
});
|
|
218
|
-
// Expect no errors to be thrown during initialization
|
|
219
|
-
await expect(fileSearch.initialize()).resolves.toBeUndefined();
|
|
220
|
-
const results = await fileSearch.search('');
|
|
221
|
-
expect(results).toEqual(['src/', 'src/file1.js']);
|
|
222
|
-
});
|
|
223
|
-
it('should respect maxResults option in search', async () => {
|
|
224
|
-
tmpDir = await createTmpDir({
|
|
225
|
-
src: {
|
|
226
|
-
'file1.js': '',
|
|
227
|
-
'file2.js': '',
|
|
228
|
-
'file3.js': '',
|
|
229
|
-
'file4.js': '',
|
|
230
|
-
},
|
|
231
|
-
});
|
|
232
|
-
const fileSearch = new FileSearch({
|
|
233
|
-
projectRoot: tmpDir,
|
|
234
|
-
useGitignore: false,
|
|
235
|
-
useGeminiignore: false,
|
|
236
|
-
ignoreDirs: [],
|
|
237
|
-
cache: false,
|
|
238
|
-
cacheTtl: 0,
|
|
239
|
-
});
|
|
240
|
-
await fileSearch.initialize();
|
|
241
|
-
const results = await fileSearch.search('**/*.js', { maxResults: 2 });
|
|
242
|
-
expect(results).toEqual(['src/file1.js', 'src/file2.js']); // Assuming alphabetical sort
|
|
243
|
-
});
|
|
244
|
-
it('should use fzf for fuzzy matching when pattern does not contain wildcards', async () => {
|
|
245
|
-
tmpDir = await createTmpDir({
|
|
246
|
-
src: {
|
|
247
|
-
'main.js': '',
|
|
248
|
-
'util.ts': '',
|
|
249
|
-
'style.css': '',
|
|
250
|
-
},
|
|
251
|
-
});
|
|
252
|
-
const fileSearch = new FileSearch({
|
|
253
|
-
projectRoot: tmpDir,
|
|
254
|
-
useGitignore: false,
|
|
255
|
-
useGeminiignore: false,
|
|
256
|
-
ignoreDirs: [],
|
|
257
|
-
cache: false,
|
|
258
|
-
cacheTtl: 0,
|
|
259
|
-
});
|
|
260
|
-
await fileSearch.initialize();
|
|
261
|
-
const results = await fileSearch.search('sst');
|
|
262
|
-
expect(results).toEqual(['src/style.css']);
|
|
263
|
-
});
|
|
264
|
-
it('should return empty array when no matches are found', async () => {
|
|
265
|
-
tmpDir = await createTmpDir({
|
|
266
|
-
src: ['file1.js'],
|
|
267
|
-
});
|
|
268
|
-
const fileSearch = new FileSearch({
|
|
269
|
-
projectRoot: tmpDir,
|
|
270
|
-
useGitignore: false,
|
|
271
|
-
useGeminiignore: false,
|
|
272
|
-
ignoreDirs: [],
|
|
273
|
-
cache: false,
|
|
274
|
-
cacheTtl: 0,
|
|
275
|
-
});
|
|
276
|
-
await fileSearch.initialize();
|
|
277
|
-
const results = await fileSearch.search('nonexistent-file.xyz');
|
|
278
|
-
expect(results).toEqual([]);
|
|
279
|
-
});
|
|
280
|
-
it('should throw AbortError when filter is aborted', async () => {
|
|
281
|
-
const controller = new AbortController();
|
|
282
|
-
const dummyPaths = Array.from({ length: 5000 }, (_, i) => `file${i}.js`); // Large array to ensure yielding
|
|
283
|
-
const filterPromise = filter(dummyPaths, '*.js', controller.signal);
|
|
284
|
-
// Abort after a short delay to ensure filter has started
|
|
285
|
-
setTimeout(() => controller.abort(), 1);
|
|
286
|
-
await expect(filterPromise).rejects.toThrow(AbortError);
|
|
287
|
-
});
|
|
288
|
-
describe('with in-memory cache', () => {
|
|
289
|
-
beforeEach(() => {
|
|
290
|
-
cache.clear();
|
|
291
|
-
});
|
|
292
|
-
afterEach(() => {
|
|
293
|
-
vi.useRealTimers();
|
|
294
|
-
});
|
|
295
|
-
it('should throw an error if search is called before initialization', async () => {
|
|
296
|
-
tmpDir = await createTmpDir({});
|
|
297
|
-
const fileSearch = new FileSearch({
|
|
298
|
-
projectRoot: tmpDir,
|
|
299
|
-
useGitignore: false,
|
|
300
|
-
useGeminiignore: false,
|
|
301
|
-
ignoreDirs: [],
|
|
302
|
-
cache: false,
|
|
303
|
-
cacheTtl: 0,
|
|
304
|
-
});
|
|
305
|
-
await expect(fileSearch.search('')).rejects.toThrow('Engine not initialized. Call initialize() first.');
|
|
306
|
-
});
|
|
307
|
-
it('should hit the cache for subsequent searches', async () => {
|
|
308
|
-
tmpDir = await createTmpDir({ 'file1.js': '' });
|
|
309
|
-
const getOptions = () => ({
|
|
310
|
-
projectRoot: tmpDir,
|
|
311
|
-
useGitignore: false,
|
|
312
|
-
useGeminiignore: false,
|
|
313
|
-
ignoreDirs: [],
|
|
314
|
-
cache: true,
|
|
315
|
-
cacheTtl: 10,
|
|
316
|
-
});
|
|
317
|
-
const fs1 = new FileSearch(getOptions());
|
|
318
|
-
const crawlSpy1 = vi.spyOn(fs1, 'performCrawl');
|
|
319
|
-
await fs1.initialize();
|
|
320
|
-
expect(crawlSpy1).toHaveBeenCalledTimes(1);
|
|
321
|
-
// Second search should hit the cache because the options are identical
|
|
322
|
-
const fs2 = new FileSearch(getOptions());
|
|
323
|
-
const crawlSpy2 = vi.spyOn(fs2, 'performCrawl');
|
|
324
|
-
await fs2.initialize();
|
|
325
|
-
expect(crawlSpy2).not.toHaveBeenCalled();
|
|
326
|
-
});
|
|
327
|
-
it('should miss the cache when ignore rules change', async () => {
|
|
328
|
-
tmpDir = await createTmpDir({
|
|
329
|
-
'.gitignore': 'a.txt',
|
|
330
|
-
'a.txt': '',
|
|
331
|
-
'b.txt': '',
|
|
332
|
-
});
|
|
333
|
-
const options = {
|
|
334
|
-
projectRoot: tmpDir,
|
|
335
|
-
useGitignore: true,
|
|
336
|
-
useGeminiignore: false,
|
|
337
|
-
ignoreDirs: [],
|
|
338
|
-
cache: true,
|
|
339
|
-
cacheTtl: 10000,
|
|
340
|
-
};
|
|
341
|
-
// Initial search to populate the cache
|
|
342
|
-
const fs1 = new FileSearch(options);
|
|
343
|
-
const crawlSpy1 = vi.spyOn(fs1, 'performCrawl');
|
|
344
|
-
await fs1.initialize();
|
|
345
|
-
const results1 = await fs1.search('');
|
|
346
|
-
expect(crawlSpy1).toHaveBeenCalledTimes(1);
|
|
347
|
-
expect(results1).toEqual(['.gitignore', 'b.txt']);
|
|
348
|
-
// Modify the ignore file
|
|
349
|
-
await fs.writeFile(path.join(tmpDir, '.gitignore'), 'b.txt');
|
|
350
|
-
// Second search should miss the cache and trigger a recrawl
|
|
351
|
-
const fs2 = new FileSearch(options);
|
|
352
|
-
const crawlSpy2 = vi.spyOn(fs2, 'performCrawl');
|
|
353
|
-
await fs2.initialize();
|
|
354
|
-
const results2 = await fs2.search('');
|
|
355
|
-
expect(crawlSpy2).toHaveBeenCalledTimes(1);
|
|
356
|
-
expect(results2).toEqual(['.gitignore', 'a.txt']);
|
|
357
|
-
});
|
|
358
|
-
it('should miss the cache after TTL expires', async () => {
|
|
359
|
-
vi.useFakeTimers();
|
|
360
|
-
tmpDir = await createTmpDir({ 'file1.js': '' });
|
|
361
|
-
const options = {
|
|
362
|
-
projectRoot: tmpDir,
|
|
363
|
-
useGitignore: false,
|
|
364
|
-
useGeminiignore: false,
|
|
365
|
-
ignoreDirs: [],
|
|
366
|
-
cache: true,
|
|
367
|
-
cacheTtl: 10, // 10 seconds
|
|
368
|
-
};
|
|
369
|
-
// Initial search to populate the cache
|
|
370
|
-
const fs1 = new FileSearch(options);
|
|
371
|
-
await fs1.initialize();
|
|
372
|
-
// Advance time past the TTL
|
|
373
|
-
await vi.advanceTimersByTimeAsync(11000);
|
|
374
|
-
// Second search should miss the cache and trigger a recrawl
|
|
375
|
-
const fs2 = new FileSearch(options);
|
|
376
|
-
const crawlSpy = vi.spyOn(fs2, 'performCrawl');
|
|
377
|
-
await fs2.initialize();
|
|
378
|
-
expect(crawlSpy).toHaveBeenCalledTimes(1);
|
|
379
|
-
});
|
|
380
|
-
it('should miss the cache when maxDepth changes', async () => {
|
|
381
|
-
tmpDir = await createTmpDir({ 'file1.js': '' });
|
|
382
|
-
const getOptions = (maxDepth) => ({
|
|
383
|
-
projectRoot: tmpDir,
|
|
384
|
-
useGitignore: false,
|
|
385
|
-
useGeminiignore: false,
|
|
386
|
-
ignoreDirs: [],
|
|
387
|
-
cache: true,
|
|
388
|
-
cacheTtl: 10000,
|
|
389
|
-
maxDepth,
|
|
390
|
-
});
|
|
391
|
-
// 1. First search with maxDepth: 1, should trigger a crawl.
|
|
392
|
-
const fs1 = new FileSearch(getOptions(1));
|
|
393
|
-
const crawlSpy1 = vi.spyOn(fs1, 'performCrawl');
|
|
394
|
-
await fs1.initialize();
|
|
395
|
-
expect(crawlSpy1).toHaveBeenCalledTimes(1);
|
|
396
|
-
// 2. Second search with maxDepth: 2, should be a cache miss and trigger a crawl.
|
|
397
|
-
const fs2 = new FileSearch(getOptions(2));
|
|
398
|
-
const crawlSpy2 = vi.spyOn(fs2, 'performCrawl');
|
|
399
|
-
await fs2.initialize();
|
|
400
|
-
expect(crawlSpy2).toHaveBeenCalledTimes(1);
|
|
401
|
-
// 3. Third search with maxDepth: 1 again, should be a cache hit.
|
|
402
|
-
const fs3 = new FileSearch(getOptions(1));
|
|
403
|
-
const crawlSpy3 = vi.spyOn(fs3, 'performCrawl');
|
|
404
|
-
await fs3.initialize();
|
|
405
|
-
expect(crawlSpy3).not.toHaveBeenCalled();
|
|
406
|
-
});
|
|
407
|
-
});
|
|
408
|
-
it('should handle empty or commented-only ignore files', async () => {
|
|
409
|
-
tmpDir = await createTmpDir({
|
|
410
|
-
'.gitignore': '# This is a comment\n\n \n',
|
|
411
|
-
src: ['main.js'],
|
|
412
|
-
});
|
|
413
|
-
const fileSearch = new FileSearch({
|
|
414
|
-
projectRoot: tmpDir,
|
|
415
|
-
useGitignore: true,
|
|
416
|
-
useGeminiignore: false,
|
|
417
|
-
ignoreDirs: [],
|
|
418
|
-
cache: false,
|
|
419
|
-
cacheTtl: 0,
|
|
420
|
-
});
|
|
421
|
-
await fileSearch.initialize();
|
|
422
|
-
const results = await fileSearch.search('');
|
|
423
|
-
expect(results).toEqual(['src/', '.gitignore', 'src/main.js']);
|
|
424
|
-
});
|
|
425
|
-
it('should always ignore the .git directory', async () => {
|
|
426
|
-
tmpDir = await createTmpDir({
|
|
427
|
-
'.git': ['config', 'HEAD'],
|
|
428
|
-
src: ['main.js'],
|
|
429
|
-
});
|
|
430
|
-
const fileSearch = new FileSearch({
|
|
431
|
-
projectRoot: tmpDir,
|
|
432
|
-
useGitignore: false, // Explicitly disable .gitignore to isolate this rule
|
|
433
|
-
useGeminiignore: false,
|
|
434
|
-
ignoreDirs: [],
|
|
435
|
-
cache: false,
|
|
436
|
-
cacheTtl: 0,
|
|
437
|
-
});
|
|
438
|
-
await fileSearch.initialize();
|
|
439
|
-
const results = await fileSearch.search('');
|
|
440
|
-
expect(results).toEqual(['src/', 'src/main.js']);
|
|
441
|
-
});
|
|
442
|
-
it('should be cancellable via AbortSignal', async () => {
|
|
443
|
-
const largeDir = {};
|
|
444
|
-
for (let i = 0; i < 100; i++) {
|
|
445
|
-
largeDir[`file${i}.js`] = '';
|
|
446
|
-
}
|
|
447
|
-
tmpDir = await createTmpDir(largeDir);
|
|
448
|
-
const fileSearch = new FileSearch({
|
|
449
|
-
projectRoot: tmpDir,
|
|
450
|
-
useGitignore: false,
|
|
451
|
-
useGeminiignore: false,
|
|
452
|
-
ignoreDirs: [],
|
|
453
|
-
cache: false,
|
|
454
|
-
cacheTtl: 0,
|
|
455
|
-
});
|
|
456
|
-
await fileSearch.initialize();
|
|
457
|
-
const controller = new AbortController();
|
|
458
|
-
const searchPromise = fileSearch.search('**/*.js', {
|
|
459
|
-
signal: controller.signal,
|
|
460
|
-
});
|
|
461
|
-
// Yield to allow the search to start before aborting.
|
|
462
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
463
|
-
controller.abort();
|
|
464
|
-
await expect(searchPromise).rejects.toThrow(AbortError);
|
|
465
|
-
});
|
|
466
|
-
it('should leverage ResultCache for bestBaseQuery optimization', async () => {
|
|
467
|
-
tmpDir = await createTmpDir({
|
|
468
|
-
src: {
|
|
469
|
-
'foo.js': '',
|
|
470
|
-
'bar.ts': '',
|
|
471
|
-
nested: {
|
|
472
|
-
'baz.js': '',
|
|
473
|
-
},
|
|
474
|
-
},
|
|
475
|
-
});
|
|
476
|
-
const fileSearch = new FileSearch({
|
|
477
|
-
projectRoot: tmpDir,
|
|
478
|
-
useGitignore: false,
|
|
479
|
-
useGeminiignore: false,
|
|
480
|
-
ignoreDirs: [],
|
|
481
|
-
cache: true, // Enable caching for this test
|
|
482
|
-
cacheTtl: 0,
|
|
483
|
-
});
|
|
484
|
-
await fileSearch.initialize();
|
|
485
|
-
// Perform a broad search to prime the cache
|
|
486
|
-
const broadResults = await fileSearch.search('src/**');
|
|
487
|
-
expect(broadResults).toEqual([
|
|
488
|
-
'src/',
|
|
489
|
-
'src/nested/',
|
|
490
|
-
'src/bar.ts',
|
|
491
|
-
'src/foo.js',
|
|
492
|
-
'src/nested/baz.js',
|
|
493
|
-
]);
|
|
494
|
-
// Perform a more specific search that should leverage the broad search's cached results
|
|
495
|
-
const specificResults = await fileSearch.search('src/**/*.js');
|
|
496
|
-
expect(specificResults).toEqual(['src/foo.js', 'src/nested/baz.js']);
|
|
497
|
-
// Although we can't directly inspect ResultCache.hits/misses from here,
|
|
498
|
-
// the correctness of specificResults after a broad search implicitly
|
|
499
|
-
// verifies that the caching mechanism, including bestBaseQuery, is working.
|
|
500
|
-
});
|
|
501
|
-
it('should be case-insensitive by default', async () => {
|
|
502
|
-
tmpDir = await createTmpDir({
|
|
503
|
-
'File1.Js': '',
|
|
504
|
-
'file2.js': '',
|
|
505
|
-
'FILE3.JS': '',
|
|
506
|
-
'other.txt': '',
|
|
507
|
-
});
|
|
508
|
-
const fileSearch = new FileSearch({
|
|
509
|
-
projectRoot: tmpDir,
|
|
510
|
-
useGitignore: false,
|
|
511
|
-
useGeminiignore: false,
|
|
512
|
-
ignoreDirs: [],
|
|
513
|
-
cache: false,
|
|
514
|
-
cacheTtl: 0,
|
|
515
|
-
});
|
|
516
|
-
await fileSearch.initialize();
|
|
517
|
-
// Search with a lowercase pattern
|
|
518
|
-
let results = await fileSearch.search('file*.js');
|
|
519
|
-
expect(results).toHaveLength(3);
|
|
520
|
-
expect(results).toEqual(expect.arrayContaining(['File1.Js', 'file2.js', 'FILE3.JS']));
|
|
521
|
-
// Search with an uppercase pattern
|
|
522
|
-
results = await fileSearch.search('FILE*.JS');
|
|
523
|
-
expect(results).toHaveLength(3);
|
|
524
|
-
expect(results).toEqual(expect.arrayContaining(['File1.Js', 'file2.js', 'FILE3.JS']));
|
|
525
|
-
// Search with a mixed-case pattern
|
|
526
|
-
results = await fileSearch.search('FiLe*.Js');
|
|
527
|
-
expect(results).toHaveLength(3);
|
|
528
|
-
expect(results).toEqual(expect.arrayContaining(['File1.Js', 'file2.js', 'FILE3.JS']));
|
|
529
|
-
});
|
|
530
|
-
it('should respect maxResults even when the cache returns an exact match', async () => {
|
|
531
|
-
tmpDir = await createTmpDir({
|
|
532
|
-
'file1.js': '',
|
|
533
|
-
'file2.js': '',
|
|
534
|
-
'file3.js': '',
|
|
535
|
-
'file4.js': '',
|
|
536
|
-
'file5.js': '',
|
|
537
|
-
});
|
|
538
|
-
const fileSearch = new FileSearch({
|
|
539
|
-
projectRoot: tmpDir,
|
|
540
|
-
useGitignore: false,
|
|
541
|
-
useGeminiignore: false,
|
|
542
|
-
ignoreDirs: [],
|
|
543
|
-
cache: true, // Ensure caching is enabled
|
|
544
|
-
cacheTtl: 10000,
|
|
545
|
-
});
|
|
546
|
-
await fileSearch.initialize();
|
|
547
|
-
// 1. Perform a broad search to populate the cache with an exact match.
|
|
548
|
-
const initialResults = await fileSearch.search('*.js');
|
|
549
|
-
expect(initialResults).toEqual([
|
|
550
|
-
'file1.js',
|
|
551
|
-
'file2.js',
|
|
552
|
-
'file3.js',
|
|
553
|
-
'file4.js',
|
|
554
|
-
'file5.js',
|
|
555
|
-
]);
|
|
556
|
-
// 2. Perform the same search again, but this time with a maxResults limit.
|
|
557
|
-
const limitedResults = await fileSearch.search('*.js', { maxResults: 2 });
|
|
558
|
-
// 3. Assert that the maxResults limit was respected, even with a cache hit.
|
|
559
|
-
expect(limitedResults).toEqual(['file1.js', 'file2.js']);
|
|
560
|
-
});
|
|
561
|
-
describe('with maxDepth', () => {
|
|
562
|
-
beforeEach(async () => {
|
|
563
|
-
tmpDir = await createTmpDir({
|
|
564
|
-
'file-root.txt': '',
|
|
565
|
-
level1: {
|
|
566
|
-
'file-level1.txt': '',
|
|
567
|
-
level2: {
|
|
568
|
-
'file-level2.txt': '',
|
|
569
|
-
level3: {
|
|
570
|
-
'file-level3.txt': '',
|
|
571
|
-
},
|
|
572
|
-
},
|
|
573
|
-
},
|
|
574
|
-
});
|
|
575
|
-
});
|
|
576
|
-
it('should only search top-level files when maxDepth is 0', async () => {
|
|
577
|
-
const fileSearch = new FileSearch({
|
|
578
|
-
projectRoot: tmpDir,
|
|
579
|
-
useGitignore: false,
|
|
580
|
-
useGeminiignore: false,
|
|
581
|
-
ignoreDirs: [],
|
|
582
|
-
cache: false,
|
|
583
|
-
cacheTtl: 0,
|
|
584
|
-
maxDepth: 0,
|
|
585
|
-
});
|
|
586
|
-
await fileSearch.initialize();
|
|
587
|
-
const results = await fileSearch.search('');
|
|
588
|
-
expect(results).toEqual(['level1/', 'file-root.txt']);
|
|
589
|
-
});
|
|
590
|
-
it('should search one level deep when maxDepth is 1', async () => {
|
|
591
|
-
const fileSearch = new FileSearch({
|
|
592
|
-
projectRoot: tmpDir,
|
|
593
|
-
useGitignore: false,
|
|
594
|
-
useGeminiignore: false,
|
|
595
|
-
ignoreDirs: [],
|
|
596
|
-
cache: false,
|
|
597
|
-
cacheTtl: 0,
|
|
598
|
-
maxDepth: 1,
|
|
599
|
-
});
|
|
600
|
-
await fileSearch.initialize();
|
|
601
|
-
const results = await fileSearch.search('');
|
|
602
|
-
expect(results).toEqual([
|
|
603
|
-
'level1/',
|
|
604
|
-
'level1/level2/',
|
|
605
|
-
'file-root.txt',
|
|
606
|
-
'level1/file-level1.txt',
|
|
607
|
-
]);
|
|
608
|
-
});
|
|
609
|
-
it('should search two levels deep when maxDepth is 2', async () => {
|
|
610
|
-
const fileSearch = new FileSearch({
|
|
611
|
-
projectRoot: tmpDir,
|
|
612
|
-
useGitignore: false,
|
|
613
|
-
useGeminiignore: false,
|
|
614
|
-
ignoreDirs: [],
|
|
615
|
-
cache: false,
|
|
616
|
-
cacheTtl: 0,
|
|
617
|
-
maxDepth: 2,
|
|
618
|
-
});
|
|
619
|
-
await fileSearch.initialize();
|
|
620
|
-
const results = await fileSearch.search('');
|
|
621
|
-
expect(results).toEqual([
|
|
622
|
-
'level1/',
|
|
623
|
-
'level1/level2/',
|
|
624
|
-
'level1/level2/level3/',
|
|
625
|
-
'file-root.txt',
|
|
626
|
-
'level1/file-level1.txt',
|
|
627
|
-
'level1/level2/file-level2.txt',
|
|
628
|
-
]);
|
|
629
|
-
});
|
|
630
|
-
it('should perform a full recursive search when maxDepth is undefined', async () => {
|
|
631
|
-
const fileSearch = new FileSearch({
|
|
632
|
-
projectRoot: tmpDir,
|
|
633
|
-
useGitignore: false,
|
|
634
|
-
useGeminiignore: false,
|
|
635
|
-
ignoreDirs: [],
|
|
636
|
-
cache: false,
|
|
637
|
-
cacheTtl: 0,
|
|
638
|
-
maxDepth: undefined, // Explicitly undefined
|
|
639
|
-
});
|
|
640
|
-
await fileSearch.initialize();
|
|
641
|
-
const results = await fileSearch.search('');
|
|
642
|
-
expect(results).toEqual([
|
|
643
|
-
'level1/',
|
|
644
|
-
'level1/level2/',
|
|
645
|
-
'level1/level2/level3/',
|
|
646
|
-
'file-root.txt',
|
|
647
|
-
'level1/file-level1.txt',
|
|
648
|
-
'level1/level2/file-level2.txt',
|
|
649
|
-
'level1/level2/level3/file-level3.txt',
|
|
650
|
-
]);
|
|
651
|
-
});
|
|
652
|
-
});
|
|
653
|
-
});
|
|
654
|
-
//# sourceMappingURL=fileSearch.test.js.map
|