@tyvm/knowhow 0.0.33 → 0.0.35
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/autodoc/plugins/downloader/downloader.mdx +2 -2
- package/benchmarks/.dockerignore +7 -0
- package/benchmarks/README.md +166 -0
- package/benchmarks/docker/Dockerfile +68 -0
- package/benchmarks/example-config.yml +27 -0
- package/benchmarks/jest.config.js +13 -0
- package/benchmarks/package-lock.json +4297 -0
- package/benchmarks/package.json +39 -0
- package/benchmarks/results/4542435/2025-08-05/lms/lms-openai-gpt-oss-20b.json +2814 -0
- package/benchmarks/results/4542435/2025-08-05/lms/lms-qwen-qwen3-30b-a3b-2507.json +2014 -0
- package/benchmarks/results/4fb9125/2025-08-07/anthropic/anthropic-claude-sonnet-4-20250514.json +3121 -0
- package/benchmarks/results/5766aee/2025-08-02/lms-qwen/qwen3-coder-30b.json +98 -0
- package/benchmarks/results/6d73808/2025-08-07/openai/openai-gpt-5.json +3256 -0
- package/benchmarks/results/77bf0a6/2025-08-02/lms-qwen/qwen3-30b-a3b-2507.json +4298 -0
- package/benchmarks/results/8c0d445/2025-08-03/anthropic/anthropic-claude-sonnet-4-20250514.json +3031 -0
- package/benchmarks/results/8c0d445/2025-08-03/openai/openai-gpt-4.1-2025-04-14.json +2990 -0
- package/benchmarks/results/ac6b2ab/2025-08-03/anthropic/anthropic-claude-sonnet-4-20250514.json +3256 -0
- package/benchmarks/results/ac6b2ab/2025-08-03/lms/lms-qwen-qwen3-coder-30b.json +3007 -0
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-2025-04-14.json +3256 -0
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-mini-2025-04-14.json +3036 -0
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-nano-2025-04-14.json +3280 -0
- package/benchmarks/results/adff675/2025-08-04/lms/lms-qwen-qwen3-30b-a3b-2507.json +1920 -0
- package/benchmarks/results/adff675/2025-08-04/lms/lms-qwen-qwen3-coder-30b.json +3281 -0
- package/benchmarks/results/b502ed9/2025-08-03/lms-qwen/qwen3-coder-30b.json +2896 -0
- package/benchmarks/results/d1a8129/2025-08-03/lms/lms-qwen-qwen3-coder-30b.json +3011 -0
- package/benchmarks/results/e60471c/2025-08-03/lms/qwen3-30b-a3b-2507.json +3003 -0
- package/benchmarks/scripts/build-and-run.sh +47 -0
- package/benchmarks/scripts/clone-exercism.sh +92 -0
- package/benchmarks/scripts/validate.sh +48 -0
- package/benchmarks/src/__tests__/runner.test.ts +27 -0
- package/benchmarks/src/cli.ts +90 -0
- package/benchmarks/src/evaluators/EvaluatorRegistry.ts +64 -0
- package/benchmarks/src/evaluators/JavaScriptEvaluator.ts +183 -0
- package/benchmarks/src/evaluators/index.ts +3 -0
- package/benchmarks/src/evaluators/types.ts +22 -0
- package/benchmarks/src/index.ts +3 -0
- package/benchmarks/src/providers.ts +13 -0
- package/benchmarks/src/runner.ts +824 -0
- package/benchmarks/src/types.ts +63 -0
- package/benchmarks/tsconfig.json +19 -0
- package/jest.config.js +2 -1
- package/leaderboard/README.md +148 -0
- package/leaderboard/app/api/benchmark-data/route.ts +131 -0
- package/leaderboard/app/api/benchmark-detail/route.ts +172 -0
- package/leaderboard/app/details/[model]/[provider]/[language]/page.tsx +501 -0
- package/leaderboard/app/exercise/[model]/[provider]/[language]/[exercise]/page.tsx +375 -0
- package/leaderboard/app/globals.css +27 -0
- package/leaderboard/app/layout.tsx +21 -0
- package/leaderboard/app/page.tsx +170 -0
- package/leaderboard/components/LeaderboardTable.tsx +168 -0
- package/leaderboard/components/PerformanceChart.tsx +109 -0
- package/leaderboard/next-env.d.ts +5 -0
- package/leaderboard/next.config.js +4 -0
- package/leaderboard/package-lock.json +6363 -0
- package/leaderboard/package.json +28 -0
- package/leaderboard/postcss.config.js +6 -0
- package/leaderboard/tailwind.config.js +17 -0
- package/leaderboard/tsconfig.json +28 -0
- package/leaderboard/types/benchmark.ts +67 -0
- package/leaderboard/utils/dataProcessor.ts +33 -0
- package/package.json +2 -1
- package/src/agents/base/base.ts +182 -24
- package/src/agents/base/prompt.ts +28 -0
- package/src/agents/index.ts +3 -0
- package/src/agents/patcher/patcher.ts +6 -4
- package/src/agents/setup/setup.ts +56 -0
- package/src/agents/tools/agentCall.ts +6 -2
- package/src/agents/tools/aiClient.ts +74 -8
- package/src/agents/tools/execCommand.ts +13 -14
- package/src/agents/tools/executeScript/README.md +16 -0
- package/src/agents/tools/index.ts +2 -0
- package/src/agents/tools/list.ts +73 -16
- package/src/agents/tools/startAgentTask.ts +109 -0
- package/src/agents/tools/textSearch.ts +1 -1
- package/src/agents/tools/visionTool.ts +31 -2
- package/src/agents/tools/ycmd/client.ts +608 -0
- package/src/agents/tools/ycmd/definitions.ts +294 -0
- package/src/agents/tools/ycmd/detection.ts +211 -0
- package/src/agents/tools/ycmd/index.ts +11 -0
- package/src/agents/tools/ycmd/installer.ts +251 -0
- package/src/agents/tools/ycmd/server.ts +535 -0
- package/src/agents/tools/ycmd/serverManager.ts +316 -0
- package/src/agents/tools/ycmd/tools/completion.ts +113 -0
- package/src/agents/tools/ycmd/tools/diagnostics.ts +155 -0
- package/src/agents/tools/ycmd/tools/getLocations.ts +173 -0
- package/src/agents/tools/ycmd/tools/goto.ts +169 -0
- package/src/agents/tools/ycmd/tools/refactor.ts +204 -0
- package/src/agents/tools/ycmd/tools/signature.ts +174 -0
- package/src/agents/tools/ycmd/tools/start.ts +95 -0
- package/src/agents/tools/ycmd/utils/pathUtils.ts +59 -0
- package/src/ai.ts +15 -0
- package/src/chat/CliChatService.ts +277 -0
- package/src/chat/modules/AgentModule.ts +985 -0
- package/src/chat/modules/AskModule.ts +98 -0
- package/src/chat/modules/BaseChatModule.ts +66 -0
- package/src/chat/modules/InternalChatModule.ts +174 -0
- package/src/chat/modules/SearchModule.ts +166 -0
- package/src/chat/modules/SetupModule.ts +185 -0
- package/src/chat/modules/SystemModule.ts +120 -0
- package/src/chat/modules/VoiceModule.ts +70 -0
- package/src/chat/modules/index.js +5 -0
- package/src/chat/types.ts +97 -0
- package/src/chat.ts +9 -1
- package/src/chat2.ts +62 -0
- package/src/cli.ts +264 -35
- package/src/clients/anthropic.ts +14 -7
- package/src/clients/gemini.ts +15 -7
- package/src/clients/http.ts +17 -7
- package/src/clients/index.ts +117 -4
- package/src/clients/knowhow.ts +7 -2
- package/src/clients/knowhowMcp.ts +118 -0
- package/src/clients/openai.ts +32 -8
- package/src/clients/types.ts +1 -0
- package/src/clients/xai.ts +17 -5
- package/src/config.ts +30 -5
- package/src/conversion.ts +4 -1
- package/src/login.ts +26 -9
- package/src/microphone.ts +0 -1
- package/src/plugins/downloader/downloader.ts +191 -49
- package/src/plugins/downloader/plugin.ts +3 -1
- package/src/plugins/plugins.ts +3 -0
- package/src/processors/CustomVariables.ts +425 -0
- package/src/processors/HarmonyToolProcessor.ts +264 -0
- package/src/processors/XmlToolCallProcessor.ts +533 -0
- package/src/processors/index.ts +3 -0
- package/src/prompts/KnowhowConfigExamples.ts +376 -0
- package/src/services/KnowhowClient.ts +49 -3
- package/src/services/Mcp.ts +42 -3
- package/src/services/McpServer.ts +14 -4
- package/src/services/McpWebsocketTransport.ts +21 -7
- package/src/services/MessageProcessor.ts +10 -5
- package/src/services/index.ts +5 -0
- package/src/services/script-execution/ScriptExecutor.ts +34 -1
- package/src/services/types.ts +17 -14
- package/src/types.ts +17 -0
- package/src/utils/index.ts +138 -0
- package/tests/XmlToolCallProcessor.test.ts +468 -0
- package/tests/manual/ycmd/debug_diagnostics_test.ts +127 -0
- package/tests/manual/ycmd/fixtures/debug_diagnostics.ts +26 -0
- package/tests/manual/ycmd/fixtures/file_change_test.ts +17 -0
- package/tests/manual/ycmd/minimal_advanced_test.ts +108 -0
- package/tests/manual/ycmd/simple_diagnostics_test.ts +61 -0
- package/tests/manual/ycmd/simple_test.ts +74 -0
- package/tests/manual/ycmd/test-typescript-sample.ts +34 -0
- package/tests/manual/ycmd/test_advanced_features.ts +407 -0
- package/tests/manual/ycmd/test_advanced_with_tools.ts +320 -0
- package/tests/manual/ycmd/test_comprehensive_typescript.ts +179 -0
- package/tests/manual/ycmd/test_diagnostics_file_changes.ts +249 -0
- package/tests/manual/ycmd/test_diagnostics_fix.ts +99 -0
- package/tests/manual/ycmd/test_diagnostics_simple.ts +100 -0
- package/tests/manual/ycmd/test_diagnostics_timing.ts +120 -0
- package/tests/manual/ycmd/test_discover_commands.ts +310 -0
- package/tests/manual/ycmd/test_endpoints.ts +115 -0
- package/tests/manual/ycmd/test_final_comprehensive.ts +218 -0
- package/tests/manual/ycmd/test_final_validation.ts +150 -0
- package/tests/manual/ycmd/test_implementation.js +42 -0
- package/tests/manual/ycmd/test_individual_ycmd_tool.ts +39 -0
- package/tests/manual/ycmd/test_server_manager.ts +52 -0
- package/tests/manual/ycmd/test_simple_debug.ts +86 -0
- package/tests/manual/ycmd/test_tsserver_workflow.js +83 -0
- package/tests/manual/ycmd/test_tsserver_workflow.ts +122 -0
- package/tests/manual/ycmd/test_typescript_simple.ts +48 -0
- package/tests/manual/ycmd/test_typescript_ycmd.ts +105 -0
- package/tests/manual/ycmd/test_workspace_config.ts +90 -0
- package/tests/manual/ycmd/test_ycmd_auto_start.ts +137 -0
- package/tests/manual/ycmd/test_ycmd_comprehensive.ts +73 -0
- package/tests/manual/ycmd/test_ycmd_connection.py +10 -0
- package/tests/manual/ycmd/test_ycmd_direct.ts +142 -0
- package/tests/manual/ycmd/test_ycmd_experiment.ts +48 -0
- package/tests/manual/ycmd/test_ycmd_final.ts +200 -0
- package/tests/manual/ycmd/test_ycmd_fixed.py +18 -0
- package/tests/manual/ycmd/test_ycmd_integration.ts +112 -0
- package/tests/manual/ycmd/test_ycmd_simple.ts +45 -0
- package/tests/manual/ycmd/test_ycmd_usage.py +27 -0
- package/tests/manual/ycmd/working_simple_test.ts +134 -0
- package/ts_build/src/agents/base/base.d.ts +15 -1
- package/ts_build/src/agents/base/base.js +121 -20
- package/ts_build/src/agents/base/base.js.map +1 -1
- package/ts_build/src/agents/base/prompt.d.ts +1 -1
- package/ts_build/src/agents/base/prompt.js +28 -0
- package/ts_build/src/agents/base/prompt.js.map +1 -1
- package/ts_build/src/agents/index.d.ts +2 -0
- package/ts_build/src/agents/index.js +2 -0
- package/ts_build/src/agents/index.js.map +1 -1
- package/ts_build/src/agents/patcher/patcher.js +6 -3
- package/ts_build/src/agents/patcher/patcher.js.map +1 -1
- package/ts_build/src/agents/setup/setup.d.ts +8 -0
- package/ts_build/src/agents/setup/setup.js +59 -0
- package/ts_build/src/agents/setup/setup.js.map +1 -0
- package/ts_build/src/agents/tools/agentCall.js +5 -2
- package/ts_build/src/agents/tools/agentCall.js.map +1 -1
- package/ts_build/src/agents/tools/aiClient.d.ts +6 -5
- package/ts_build/src/agents/tools/aiClient.js +37 -6
- package/ts_build/src/agents/tools/aiClient.js.map +1 -1
- package/ts_build/src/agents/tools/execCommand.d.ts +2 -2
- package/ts_build/src/agents/tools/execCommand.js +5 -6
- package/ts_build/src/agents/tools/execCommand.js.map +1 -1
- package/ts_build/src/agents/tools/executeScript/index.d.ts +1 -1
- package/ts_build/src/agents/tools/index.d.ts +2 -0
- package/ts_build/src/agents/tools/index.js +2 -0
- package/ts_build/src/agents/tools/index.js.map +1 -1
- package/ts_build/src/agents/tools/list.js +66 -16
- package/ts_build/src/agents/tools/list.js.map +1 -1
- package/ts_build/src/agents/tools/startAgentTask.d.ts +13 -0
- package/ts_build/src/agents/tools/startAgentTask.js +74 -0
- package/ts_build/src/agents/tools/startAgentTask.js.map +1 -0
- package/ts_build/src/agents/tools/startChatTask.d.ts +13 -0
- package/ts_build/src/agents/tools/startChatTask.js +73 -0
- package/ts_build/src/agents/tools/startChatTask.js.map +1 -0
- package/ts_build/src/agents/tools/textSearch.js +1 -1
- package/ts_build/src/agents/tools/textSearch.js.map +1 -1
- package/ts_build/src/agents/tools/visionTool.d.ts +1 -1
- package/ts_build/src/agents/tools/visionTool.js +23 -3
- package/ts_build/src/agents/tools/visionTool.js.map +1 -1
- package/ts_build/src/agents/tools/ycmd/client.d.ts +93 -0
- package/ts_build/src/agents/tools/ycmd/client.js +355 -0
- package/ts_build/src/agents/tools/ycmd/client.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/definitions.d.ts +345 -0
- package/ts_build/src/agents/tools/ycmd/definitions.js +298 -0
- package/ts_build/src/agents/tools/ycmd/definitions.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/detection.d.ts +11 -0
- package/ts_build/src/agents/tools/ycmd/detection.js +175 -0
- package/ts_build/src/agents/tools/ycmd/detection.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/index.d.ts +8 -0
- package/ts_build/src/agents/tools/ycmd/index.js +20 -0
- package/ts_build/src/agents/tools/ycmd/index.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/installer.d.ts +19 -0
- package/ts_build/src/agents/tools/ycmd/installer.js +196 -0
- package/ts_build/src/agents/tools/ycmd/installer.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/server.d.ts +35 -0
- package/ts_build/src/agents/tools/ycmd/server.js +363 -0
- package/ts_build/src/agents/tools/ycmd/server.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/serverManager.d.ts +39 -0
- package/ts_build/src/agents/tools/ycmd/serverManager.js +210 -0
- package/ts_build/src/agents/tools/ycmd/serverManager.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/completion.d.ts +22 -0
- package/ts_build/src/agents/tools/ycmd/tools/completion.js +72 -0
- package/ts_build/src/agents/tools/ycmd/tools/completion.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/diagnostics.d.ts +42 -0
- package/ts_build/src/agents/tools/ycmd/tools/diagnostics.js +88 -0
- package/ts_build/src/agents/tools/ycmd/tools/diagnostics.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/getLocations.d.ts +22 -0
- package/ts_build/src/agents/tools/ycmd/tools/getLocations.js +142 -0
- package/ts_build/src/agents/tools/ycmd/tools/getLocations.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/goto.d.ts +20 -0
- package/ts_build/src/agents/tools/ycmd/tools/goto.js +101 -0
- package/ts_build/src/agents/tools/ycmd/tools/goto.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/refactor.d.ts +32 -0
- package/ts_build/src/agents/tools/ycmd/tools/refactor.js +123 -0
- package/ts_build/src/agents/tools/ycmd/tools/refactor.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/signature.d.ts +25 -0
- package/ts_build/src/agents/tools/ycmd/tools/signature.js +110 -0
- package/ts_build/src/agents/tools/ycmd/tools/signature.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/start.d.ts +17 -0
- package/ts_build/src/agents/tools/ycmd/tools/start.js +65 -0
- package/ts_build/src/agents/tools/ycmd/tools/start.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/utils/pathUtils.d.ts +4 -0
- package/ts_build/src/agents/tools/ycmd/utils/pathUtils.js +67 -0
- package/ts_build/src/agents/tools/ycmd/utils/pathUtils.js.map +1 -0
- package/ts_build/src/ai.d.ts +1 -0
- package/ts_build/src/ai.js +40 -1
- package/ts_build/src/ai.js.map +1 -1
- package/ts_build/src/chat/ChatCommandHandler.d.ts +36 -0
- package/ts_build/src/chat/ChatCommandHandler.js +268 -0
- package/ts_build/src/chat/ChatCommandHandler.js.map +1 -0
- package/ts_build/src/chat/ChatInputManager.d.ts +22 -0
- package/ts_build/src/chat/ChatInputManager.js +85 -0
- package/ts_build/src/chat/ChatInputManager.js.map +1 -0
- package/ts_build/src/chat/ChatManager.d.ts +49 -0
- package/ts_build/src/chat/ChatManager.js +271 -0
- package/ts_build/src/chat/ChatManager.js.map +1 -0
- package/ts_build/src/chat/ChatSession.d.ts +32 -0
- package/ts_build/src/chat/ChatSession.js +3 -0
- package/ts_build/src/chat/ChatSession.js.map +1 -0
- package/ts_build/src/chat/ChatSessionManager.d.ts +19 -0
- package/ts_build/src/chat/ChatSessionManager.js +188 -0
- package/ts_build/src/chat/ChatSessionManager.js.map +1 -0
- package/ts_build/src/chat/ChatStateManager.d.ts +58 -0
- package/ts_build/src/chat/ChatStateManager.js +156 -0
- package/ts_build/src/chat/ChatStateManager.js.map +1 -0
- package/ts_build/src/chat/CliChatService.d.ts +35 -0
- package/ts_build/src/chat/CliChatService.js +201 -0
- package/ts_build/src/chat/CliChatService.js.map +1 -0
- package/ts_build/src/chat/InterruptibleInput.d.ts +20 -0
- package/ts_build/src/chat/InterruptibleInput.js +109 -0
- package/ts_build/src/chat/InterruptibleInput.js.map +1 -0
- package/ts_build/src/chat/interfaces/ChatModule.d.ts +6 -0
- package/ts_build/src/chat/interfaces/ChatModule.js +3 -0
- package/ts_build/src/chat/interfaces/ChatModule.js.map +1 -0
- package/ts_build/src/chat/modules/AgentModule.d.ts +57 -0
- package/ts_build/src/chat/modules/AgentModule.js +709 -0
- package/ts_build/src/chat/modules/AgentModule.js.map +1 -0
- package/ts_build/src/chat/modules/AskModule.d.ts +10 -0
- package/ts_build/src/chat/modules/AskModule.js +63 -0
- package/ts_build/src/chat/modules/AskModule.js.map +1 -0
- package/ts_build/src/chat/modules/BaseChatModule.d.ts +14 -0
- package/ts_build/src/chat/modules/BaseChatModule.js +32 -0
- package/ts_build/src/chat/modules/BaseChatModule.js.map +1 -0
- package/ts_build/src/chat/modules/InternalChatModule.d.ts +24 -0
- package/ts_build/src/chat/modules/InternalChatModule.js +127 -0
- package/ts_build/src/chat/modules/InternalChatModule.js.map +1 -0
- package/ts_build/src/chat/modules/SearchModule.d.ts +12 -0
- package/ts_build/src/chat/modules/SearchModule.js +119 -0
- package/ts_build/src/chat/modules/SearchModule.js.map +1 -0
- package/ts_build/src/chat/modules/SetupModule.d.ts +15 -0
- package/ts_build/src/chat/modules/SetupModule.js +147 -0
- package/ts_build/src/chat/modules/SetupModule.js.map +1 -0
- package/ts_build/src/chat/modules/SystemModule.d.ts +14 -0
- package/ts_build/src/chat/modules/SystemModule.js +90 -0
- package/ts_build/src/chat/modules/SystemModule.js.map +1 -0
- package/ts_build/src/chat/modules/VoiceModule.d.ts +11 -0
- package/ts_build/src/chat/modules/VoiceModule.js +57 -0
- package/ts_build/src/chat/modules/VoiceModule.js.map +1 -0
- package/ts_build/src/chat/types.d.ts +83 -0
- package/ts_build/src/chat/types.js +3 -0
- package/ts_build/src/chat/types.js.map +1 -0
- package/ts_build/src/chat.js +7 -1
- package/ts_build/src/chat.js.map +1 -1
- package/ts_build/src/chat2.d.ts +3 -0
- package/ts_build/src/chat2.js +47 -0
- package/ts_build/src/chat2.js.map +1 -0
- package/ts_build/src/cli.js +218 -37
- package/ts_build/src/cli.js.map +1 -1
- package/ts_build/src/clients/anthropic.d.ts +5 -2
- package/ts_build/src/clients/anthropic.js +12 -7
- package/ts_build/src/clients/anthropic.js.map +1 -1
- package/ts_build/src/clients/gemini.d.ts +6 -3
- package/ts_build/src/clients/gemini.js +13 -7
- package/ts_build/src/clients/gemini.js.map +1 -1
- package/ts_build/src/clients/http.d.ts +1 -0
- package/ts_build/src/clients/http.js +12 -5
- package/ts_build/src/clients/http.js.map +1 -1
- package/ts_build/src/clients/index.d.ts +10 -0
- package/ts_build/src/clients/index.js +74 -4
- package/ts_build/src/clients/index.js.map +1 -1
- package/ts_build/src/clients/knowhow.d.ts +3 -1
- package/ts_build/src/clients/knowhow.js +8 -2
- package/ts_build/src/clients/knowhow.js.map +1 -1
- package/ts_build/src/clients/knowhowMcp.d.ts +20 -0
- package/ts_build/src/clients/knowhowMcp.js +86 -0
- package/ts_build/src/clients/knowhowMcp.js.map +1 -0
- package/ts_build/src/clients/openai.d.ts +5 -2
- package/ts_build/src/clients/openai.js +29 -8
- package/ts_build/src/clients/openai.js.map +1 -1
- package/ts_build/src/clients/types.d.ts +1 -0
- package/ts_build/src/clients/xai.d.ts +5 -2
- package/ts_build/src/clients/xai.js +15 -5
- package/ts_build/src/clients/xai.js.map +1 -1
- package/ts_build/src/config.js +24 -3
- package/ts_build/src/config.js.map +1 -1
- package/ts_build/src/conversion.js +6 -4
- package/ts_build/src/conversion.js.map +1 -1
- package/ts_build/src/login.d.ts +1 -1
- package/ts_build/src/login.js +21 -7
- package/ts_build/src/login.js.map +1 -1
- package/ts_build/src/microphone.js.map +1 -1
- package/ts_build/src/plugins/downloader/downloader.d.ts +7 -5
- package/ts_build/src/plugins/downloader/downloader.js +147 -44
- package/ts_build/src/plugins/downloader/downloader.js.map +1 -1
- package/ts_build/src/plugins/downloader/plugin.js +5 -3
- package/ts_build/src/plugins/downloader/plugin.js.map +1 -1
- package/ts_build/src/plugins/plugins.js +3 -0
- package/ts_build/src/plugins/plugins.js.map +1 -1
- package/ts_build/src/processors/CustomVariables.d.ts +32 -0
- package/ts_build/src/processors/CustomVariables.js +297 -0
- package/ts_build/src/processors/CustomVariables.js.map +1 -0
- package/ts_build/src/processors/HarmonyToolProcessor.d.ts +15 -0
- package/ts_build/src/processors/HarmonyToolProcessor.js +154 -0
- package/ts_build/src/processors/HarmonyToolProcessor.js.map +1 -0
- package/ts_build/src/processors/XmlToolCallProcessor.d.ts +14 -0
- package/ts_build/src/processors/XmlToolCallProcessor.js +357 -0
- package/ts_build/src/processors/XmlToolCallProcessor.js.map +1 -0
- package/ts_build/src/processors/index.d.ts +3 -0
- package/ts_build/src/processors/index.js +7 -1
- package/ts_build/src/processors/index.js.map +1 -1
- package/ts_build/src/prompts/KnowhowConfigExamples.d.ts +2 -0
- package/ts_build/src/prompts/KnowhowConfigExamples.js +379 -0
- package/ts_build/src/prompts/KnowhowConfigExamples.js.map +1 -0
- package/ts_build/src/services/KnowhowClient.d.ts +22 -0
- package/ts_build/src/services/KnowhowClient.js +14 -2
- package/ts_build/src/services/KnowhowClient.js.map +1 -1
- package/ts_build/src/services/Mcp.d.ts +1 -0
- package/ts_build/src/services/Mcp.js +20 -3
- package/ts_build/src/services/Mcp.js.map +1 -1
- package/ts_build/src/services/McpServer.d.ts +1 -1
- package/ts_build/src/services/McpServer.js +8 -4
- package/ts_build/src/services/McpServer.js.map +1 -1
- package/ts_build/src/services/McpWebsocketTransport.js +17 -7
- package/ts_build/src/services/McpWebsocketTransport.js.map +1 -1
- package/ts_build/src/services/MessageProcessor.d.ts +1 -1
- package/ts_build/src/services/MessageProcessor.js +4 -4
- package/ts_build/src/services/MessageProcessor.js.map +1 -1
- package/ts_build/src/services/index.d.ts +2 -0
- package/ts_build/src/services/index.js +4 -0
- package/ts_build/src/services/index.js.map +1 -1
- package/ts_build/src/services/script-execution/ScriptExecutor.d.ts +1 -0
- package/ts_build/src/services/script-execution/ScriptExecutor.js +23 -0
- package/ts_build/src/services/script-execution/ScriptExecutor.js.map +1 -1
- package/ts_build/src/services/types.d.ts +2 -6
- package/ts_build/src/services/types.js +4 -4
- package/ts_build/src/services/types.js.map +1 -1
- package/ts_build/src/types.d.ts +11 -0
- package/ts_build/src/types.js +8 -0
- package/ts_build/src/types.js.map +1 -1
- package/ts_build/src/utils/index.d.ts +2 -0
- package/ts_build/src/utils/index.js +102 -1
- package/ts_build/src/utils/index.js.map +1 -1
- package/ts_build/tests/XmlToolCallProcessor.test.d.ts +1 -0
- package/ts_build/tests/XmlToolCallProcessor.test.js +376 -0
- package/ts_build/tests/XmlToolCallProcessor.test.js.map +1 -0
- package/ts_build/tests/manual/ycmd/debug_diagnostics_test.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/debug_diagnostics_test.js +114 -0
- package/ts_build/tests/manual/ycmd/debug_diagnostics_test.js.map +1 -0
- package/ts_build/tests/manual/ycmd/minimal_advanced_test.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/minimal_advanced_test.js +104 -0
- package/ts_build/tests/manual/ycmd/minimal_advanced_test.js.map +1 -0
- package/ts_build/tests/manual/ycmd/simple_diagnostics_test.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/simple_diagnostics_test.js +74 -0
- package/ts_build/tests/manual/ycmd/simple_diagnostics_test.js.map +1 -0
- package/ts_build/tests/manual/ycmd/simple_test.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/simple_test.js +82 -0
- package/ts_build/tests/manual/ycmd/simple_test.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test-typescript-sample.d.ts +14 -0
- package/ts_build/tests/manual/ycmd/test-typescript-sample.js +20 -0
- package/ts_build/tests/manual/ycmd/test-typescript-sample.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_advanced_features.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_advanced_features.js +297 -0
- package/ts_build/tests/manual/ycmd/test_advanced_features.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_advanced_with_tools.d.ts +3 -0
- package/ts_build/tests/manual/ycmd/test_advanced_with_tools.js +262 -0
- package/ts_build/tests/manual/ycmd/test_advanced_with_tools.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_comprehensive_typescript.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_comprehensive_typescript.js +186 -0
- package/ts_build/tests/manual/ycmd/test_comprehensive_typescript.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_file_changes.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_file_changes.js +174 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_file_changes.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_fix.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_fix.js +106 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_fix.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_simple.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_simple.js +104 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_simple.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_timing.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_timing.js +119 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_timing.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_discover_commands.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_discover_commands.js +243 -0
- package/ts_build/tests/manual/ycmd/test_discover_commands.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_endpoints.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_endpoints.js +120 -0
- package/ts_build/tests/manual/ycmd/test_endpoints.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_final_comprehensive.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_final_comprehensive.js +221 -0
- package/ts_build/tests/manual/ycmd/test_final_comprehensive.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_final_validation.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_final_validation.js +160 -0
- package/ts_build/tests/manual/ycmd/test_final_validation.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_individual_ycmd_tool.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_individual_ycmd_tool.js +37 -0
- package/ts_build/tests/manual/ycmd/test_individual_ycmd_tool.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_server_manager.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_server_manager.js +38 -0
- package/ts_build/tests/manual/ycmd/test_server_manager.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_simple_debug.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_simple_debug.js +99 -0
- package/ts_build/tests/manual/ycmd/test_simple_debug.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_tsserver_workflow.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_tsserver_workflow.js +128 -0
- package/ts_build/tests/manual/ycmd/test_tsserver_workflow.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_typescript_simple.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_typescript_simple.js +66 -0
- package/ts_build/tests/manual/ycmd/test_typescript_simple.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_typescript_ycmd.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_typescript_ycmd.js +105 -0
- package/ts_build/tests/manual/ycmd/test_typescript_ycmd.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_workspace_config.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_workspace_config.js +89 -0
- package/ts_build/tests/manual/ycmd/test_workspace_config.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_auto_start.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_auto_start.js +130 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_auto_start.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_comprehensive.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_comprehensive.js +83 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_comprehensive.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_direct.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_direct.js +149 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_direct.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_experiment.d.ts +15 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_experiment.js +58 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_experiment.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_final.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_final.js +195 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_final.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_integration.d.ts +3 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_integration.js +110 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_integration.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_simple.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_simple.js +36 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_simple.js.map +1 -0
- package/ts_build/tests/manual/ycmd/working_simple_test.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/working_simple_test.js +134 -0
- package/ts_build/tests/manual/ycmd/working_simple_test.js.map +1 -0
- package/tsconfig.json +3 -1
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { ycmdStart, ycmdDiagnostics } from "../../../src/agents/tools/ycmd";
|
|
2
|
+
import { ycmdServerManager } from "../../../src/agents/tools/ycmd/serverManager";
|
|
3
|
+
import {
|
|
4
|
+
YcmdClient,
|
|
5
|
+
getFileTypes,
|
|
6
|
+
} from "../../../src/agents/tools/ycmd/client";
|
|
7
|
+
import * as fs from "fs";
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
|
|
10
|
+
async function wait(ms: number) {
|
|
11
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async function testDiagnosticsWithFileChanges() {
|
|
15
|
+
console.log(
|
|
16
|
+
"🔧 Testing ycmd diagnostics with proper file change notifications..."
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
// Start ycmd server
|
|
21
|
+
console.log("Starting ycmd server...");
|
|
22
|
+
const startResult = await ycmdStart({
|
|
23
|
+
workspaceRoot: process.cwd(),
|
|
24
|
+
logLevel: "debug",
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (!startResult.success) {
|
|
28
|
+
throw new Error(`Failed to start server: ${startResult.message}`);
|
|
29
|
+
}
|
|
30
|
+
console.log("✅ ycmd server started");
|
|
31
|
+
|
|
32
|
+
// Wait for server to initialize
|
|
33
|
+
console.log("⏳ Waiting for server initialization...");
|
|
34
|
+
await wait(2000);
|
|
35
|
+
|
|
36
|
+
const testDir = path.join(process.cwd(), "tests/ycmd/fixtures");
|
|
37
|
+
const testFile = path.join(testDir, "file_change_test.ts");
|
|
38
|
+
|
|
39
|
+
// Ensure test directory exists
|
|
40
|
+
if (!fs.existsSync(testDir)) {
|
|
41
|
+
fs.mkdirSync(testDir, { recursive: true });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Get server info and create client
|
|
45
|
+
const serverInfo = ycmdServerManager.getServerInfo();
|
|
46
|
+
if (!serverInfo) {
|
|
47
|
+
throw new Error("Failed to get server info");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const client = new YcmdClient(serverInfo);
|
|
51
|
+
const filetypes = getFileTypes(testFile);
|
|
52
|
+
|
|
53
|
+
console.log("📝 Step 1: Creating valid TypeScript file...");
|
|
54
|
+
const validContent = `interface User {
|
|
55
|
+
name: string;
|
|
56
|
+
age: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function createUser(name: string, age: number): User {
|
|
60
|
+
return { name, age };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { createUser };`;
|
|
64
|
+
|
|
65
|
+
fs.writeFileSync(testFile, validContent);
|
|
66
|
+
|
|
67
|
+
// Notify ycmd about the initial file
|
|
68
|
+
console.log("🔔 Notifying ycmd about initial file...");
|
|
69
|
+
await client.notifyFileEvent(
|
|
70
|
+
"BufferVisit",
|
|
71
|
+
testFile,
|
|
72
|
+
validContent,
|
|
73
|
+
filetypes
|
|
74
|
+
);
|
|
75
|
+
await wait(100);
|
|
76
|
+
await client.notifyFileEvent(
|
|
77
|
+
"FileReadyToParse",
|
|
78
|
+
testFile,
|
|
79
|
+
validContent,
|
|
80
|
+
filetypes
|
|
81
|
+
);
|
|
82
|
+
await wait(500);
|
|
83
|
+
|
|
84
|
+
// Test diagnostics on valid file
|
|
85
|
+
console.log("🔍 Testing diagnostics on valid file...");
|
|
86
|
+
let diagnostics = await ycmdDiagnostics({
|
|
87
|
+
filepath: testFile,
|
|
88
|
+
line: 1,
|
|
89
|
+
column: 1,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
console.log(
|
|
93
|
+
"Valid file diagnostics:",
|
|
94
|
+
JSON.stringify(diagnostics, null, 2)
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
console.log("📝 Step 2: Modifying file to introduce TypeScript errors...");
|
|
98
|
+
const errorContent = `interface User {
|
|
99
|
+
name: string;
|
|
100
|
+
age: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function createUser(name: string, age: number): User {
|
|
104
|
+
// ERROR: Missing 'age' property - should cause TypeScript error
|
|
105
|
+
return { name };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ERROR: Using undefined variable - should cause TypeScript error
|
|
109
|
+
console.log(undefinedVariable);
|
|
110
|
+
|
|
111
|
+
// ERROR: Type mismatch - missing required property - should cause TypeScript error
|
|
112
|
+
const user: User = { name: 'Alice' };
|
|
113
|
+
|
|
114
|
+
export { createUser };`;
|
|
115
|
+
|
|
116
|
+
fs.writeFileSync(testFile, errorContent);
|
|
117
|
+
|
|
118
|
+
// KEY STEP: Properly notify ycmd about file changes
|
|
119
|
+
console.log("🔔 Step 3: Notifying ycmd about file changes...");
|
|
120
|
+
|
|
121
|
+
// First unload the old version
|
|
122
|
+
console.log(" 📤 Unloading old file version...");
|
|
123
|
+
await client.notifyFileEvent(
|
|
124
|
+
"BufferUnload",
|
|
125
|
+
testFile,
|
|
126
|
+
validContent,
|
|
127
|
+
filetypes
|
|
128
|
+
);
|
|
129
|
+
await wait(200);
|
|
130
|
+
|
|
131
|
+
// Then load the new version
|
|
132
|
+
console.log(" 📥 Loading new file version...");
|
|
133
|
+
await client.notifyFileEvent(
|
|
134
|
+
"BufferVisit",
|
|
135
|
+
testFile,
|
|
136
|
+
errorContent,
|
|
137
|
+
filetypes
|
|
138
|
+
);
|
|
139
|
+
await wait(100);
|
|
140
|
+
await client.notifyFileEvent(
|
|
141
|
+
"FileReadyToParse",
|
|
142
|
+
testFile,
|
|
143
|
+
errorContent,
|
|
144
|
+
filetypes
|
|
145
|
+
);
|
|
146
|
+
await wait(100);
|
|
147
|
+
|
|
148
|
+
// Additional time for TSServer to process the changes
|
|
149
|
+
console.log(" ⏳ Waiting for TSServer to process changes...");
|
|
150
|
+
await wait(2000);
|
|
151
|
+
|
|
152
|
+
// Test diagnostics with the new content
|
|
153
|
+
console.log("🔍 Step 4: Testing diagnostics on modified file...");
|
|
154
|
+
diagnostics = await ycmdDiagnostics({
|
|
155
|
+
filepath: testFile,
|
|
156
|
+
fileContents: errorContent, // Pass the new content explicitly
|
|
157
|
+
line: 1,
|
|
158
|
+
column: 1,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
console.log(
|
|
162
|
+
"Modified file diagnostics:",
|
|
163
|
+
JSON.stringify(diagnostics, null, 2)
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
if (
|
|
167
|
+
diagnostics.success &&
|
|
168
|
+
diagnostics.diagnostics &&
|
|
169
|
+
diagnostics.diagnostics.length > 0
|
|
170
|
+
) {
|
|
171
|
+
console.log(
|
|
172
|
+
`🎉 SUCCESS: Found ${diagnostics.diagnostics.length} diagnostic(s)!`
|
|
173
|
+
);
|
|
174
|
+
diagnostics.diagnostics.forEach((diag, index) => {
|
|
175
|
+
console.log(` ${index + 1}. Line ${diag.location.line}: ${diag.text}`);
|
|
176
|
+
});
|
|
177
|
+
} else {
|
|
178
|
+
console.log(
|
|
179
|
+
"❌ Still no diagnostics found. Trying alternative approaches..."
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
// Try triggering diagnostics on specific error lines
|
|
183
|
+
console.log("🎯 Testing specific error locations...");
|
|
184
|
+
const errorLines = [8, 11, 14]; // Lines with errors
|
|
185
|
+
|
|
186
|
+
for (const line of errorLines) {
|
|
187
|
+
console.log(` Testing line ${line}...`);
|
|
188
|
+
const lineDiagnostics = await ycmdDiagnostics({
|
|
189
|
+
filepath: testFile,
|
|
190
|
+
fileContents: errorContent,
|
|
191
|
+
line,
|
|
192
|
+
column: 1,
|
|
193
|
+
});
|
|
194
|
+
console.log(
|
|
195
|
+
` Line ${line} diagnostics:`,
|
|
196
|
+
JSON.stringify(lineDiagnostics, null, 2)
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
if (
|
|
200
|
+
lineDiagnostics.success &&
|
|
201
|
+
lineDiagnostics.diagnostics &&
|
|
202
|
+
lineDiagnostics.diagnostics.length > 0
|
|
203
|
+
) {
|
|
204
|
+
console.log(` 🎉 Found diagnostics at line ${line}!`);
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Try manual diagnostic check using client directly
|
|
210
|
+
console.log("🔧 Trying direct client diagnostic check...");
|
|
211
|
+
try {
|
|
212
|
+
const directDiagnostics = await client.getDiagnostics(
|
|
213
|
+
testFile,
|
|
214
|
+
errorContent,
|
|
215
|
+
filetypes,
|
|
216
|
+
1,
|
|
217
|
+
1
|
|
218
|
+
);
|
|
219
|
+
console.log(
|
|
220
|
+
"Direct client diagnostics:",
|
|
221
|
+
JSON.stringify(directDiagnostics, null, 2)
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
if (directDiagnostics.length > 0) {
|
|
225
|
+
console.log(
|
|
226
|
+
`🎉 SUCCESS via direct client: Found ${directDiagnostics.length} diagnostic(s)!`
|
|
227
|
+
);
|
|
228
|
+
directDiagnostics.forEach((diag, index) => {
|
|
229
|
+
console.log(
|
|
230
|
+
` ${index + 1}. Line ${diag.location.line_num}: ${diag.text}`
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
} catch (error) {
|
|
235
|
+
console.log("Direct client diagnostics failed:", error.message);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Clean up
|
|
240
|
+
fs.unlinkSync(testFile);
|
|
241
|
+
console.log("✅ Test completed");
|
|
242
|
+
} catch (error) {
|
|
243
|
+
console.error("❌ Test failed:", error.message);
|
|
244
|
+
console.error("Stack trace:", error.stack);
|
|
245
|
+
process.exit(1);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
testDiagnosticsWithFileChanges();
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Test diagnostics fix - verify that the corrected diagnostics endpoint works
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { ycmdDiagnostics } from '../../../src/agents/tools/ycmd/tools/diagnostics';
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
|
|
11
|
+
async function testDiagnosticsFix() {
|
|
12
|
+
console.log('🧪 Testing Diagnostics Fix...\n');
|
|
13
|
+
|
|
14
|
+
// Create a test file with clear TypeScript errors
|
|
15
|
+
const testFilePath = path.join(__dirname, 'fixtures', 'test_diagnostics_fix.ts');
|
|
16
|
+
const testContent = `
|
|
17
|
+
interface User {
|
|
18
|
+
name: string;
|
|
19
|
+
age: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Error 1: Missing required property 'age'
|
|
23
|
+
const user1: User = {
|
|
24
|
+
name: "John"
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// Error 2: Undefined variable
|
|
28
|
+
console.log(undefinedVariable);
|
|
29
|
+
|
|
30
|
+
// Error 3: Type mismatch
|
|
31
|
+
const user2: User = {
|
|
32
|
+
name: "Jane",
|
|
33
|
+
age: "not a number" // Should be number, not string
|
|
34
|
+
};
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
// Write the test file
|
|
38
|
+
await fs.promises.writeFile(testFilePath, testContent, 'utf8');
|
|
39
|
+
console.log(`📝 Created test file: ${testFilePath}`);
|
|
40
|
+
console.log(`📄 Test file content:\n${testContent}`);
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
console.log('🔍 Running diagnostics...');
|
|
44
|
+
|
|
45
|
+
const result = await ycmdDiagnostics({
|
|
46
|
+
filepath: testFilePath,
|
|
47
|
+
fileContents: testContent
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
console.log('\n📊 Diagnostics Result:');
|
|
51
|
+
console.log(`Success: ${result.success}`);
|
|
52
|
+
console.log(`Message: ${result.message}`);
|
|
53
|
+
|
|
54
|
+
if (result.diagnostics) {
|
|
55
|
+
console.log(`\n🔎 Found ${result.diagnostics.length} diagnostic(s):`);
|
|
56
|
+
|
|
57
|
+
result.diagnostics.forEach((diag, index) => {
|
|
58
|
+
console.log(`\n${index + 1}. ${diag.kind}: ${diag.text}`);
|
|
59
|
+
console.log(` Location: Line ${diag.location.line}, Column ${diag.location.column}`);
|
|
60
|
+
if (diag.fixit_available) {
|
|
61
|
+
console.log(` ✨ Fix available`);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (result.diagnostics.length > 0) {
|
|
66
|
+
console.log('\n✅ SUCCESS: Diagnostics are now working!');
|
|
67
|
+
|
|
68
|
+
// Categorize the diagnostics
|
|
69
|
+
const errors = result.diagnostics.filter(d => d.kind === 'ERROR');
|
|
70
|
+
const warnings = result.diagnostics.filter(d => d.kind === 'WARNING');
|
|
71
|
+
const infos = result.diagnostics.filter(d => d.kind === 'INFO');
|
|
72
|
+
|
|
73
|
+
console.log(`\n📈 Summary:`);
|
|
74
|
+
console.log(` - Errors: ${errors.length}`);
|
|
75
|
+
console.log(` - Warnings: ${warnings.length}`);
|
|
76
|
+
console.log(` - Info: ${infos.length}`);
|
|
77
|
+
|
|
78
|
+
} else {
|
|
79
|
+
console.log('\n❌ ISSUE: Still no diagnostics found');
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
console.log('\n❌ ISSUE: No diagnostics returned');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error('\n💥 Error during diagnostics test:', error);
|
|
87
|
+
} finally {
|
|
88
|
+
// Clean up test file
|
|
89
|
+
try {
|
|
90
|
+
await fs.promises.unlink(testFilePath);
|
|
91
|
+
console.log(`\n🧹 Cleaned up test file: ${testFilePath}`);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.warn(`⚠️ Failed to clean up test file: ${error}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Run the test
|
|
99
|
+
testDiagnosticsFix().catch(console.error);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ycmdStart, ycmdDiagnostics } from '../../../src/agents/tools/ycmd';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
|
|
5
|
+
async function wait(ms: number) {
|
|
6
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async function testDiagnosticsSimple() {
|
|
10
|
+
console.log('🔧 Testing ycmd diagnostics with TypeScript errors...');
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
// Start ycmd server
|
|
14
|
+
console.log('Starting ycmd server...');
|
|
15
|
+
const startResult = await ycmdStart({
|
|
16
|
+
workspaceRoot: process.cwd(),
|
|
17
|
+
logLevel: 'debug'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (!startResult.success) {
|
|
21
|
+
throw new Error(`Failed to start server: ${startResult.message}`);
|
|
22
|
+
}
|
|
23
|
+
console.log('✅ ycmd server started');
|
|
24
|
+
|
|
25
|
+
// Wait for server to initialize
|
|
26
|
+
console.log('⏳ Waiting for server initialization...');
|
|
27
|
+
await wait(3000);
|
|
28
|
+
|
|
29
|
+
const testDir = path.join(process.cwd(), 'tests/ycmd/fixtures');
|
|
30
|
+
const testFile = path.join(testDir, 'diagnostic_test.ts');
|
|
31
|
+
|
|
32
|
+
// Ensure test directory exists
|
|
33
|
+
if (!fs.existsSync(testDir)) {
|
|
34
|
+
fs.mkdirSync(testDir, { recursive: true });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.log('📝 Creating TypeScript file with clear errors...');
|
|
38
|
+
const errorContent = `interface User {
|
|
39
|
+
name: string;
|
|
40
|
+
age: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function createUser(name: string, age: number): User {
|
|
44
|
+
// ERROR: Missing 'age' property - should cause TypeScript error
|
|
45
|
+
return { name };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ERROR: Using undefined variable - should cause TypeScript error
|
|
49
|
+
console.log(undefinedVariable);
|
|
50
|
+
|
|
51
|
+
// ERROR: Type mismatch - missing required property
|
|
52
|
+
const user: User = { name: 'Alice' };
|
|
53
|
+
|
|
54
|
+
export { createUser };`;
|
|
55
|
+
|
|
56
|
+
fs.writeFileSync(testFile, errorContent);
|
|
57
|
+
|
|
58
|
+
console.log('🔍 Testing diagnostics (setupClient should handle notifications automatically)...');
|
|
59
|
+
|
|
60
|
+
// Test diagnostics - setupClientAndNotifyFile should handle all notifications
|
|
61
|
+
const diagnostics = await ycmdDiagnostics({
|
|
62
|
+
filepath: testFile,
|
|
63
|
+
fileContents: errorContent, // Pass content explicitly
|
|
64
|
+
line: 1,
|
|
65
|
+
column: 1
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
console.log('Diagnostics result:', JSON.stringify(diagnostics, null, 2));
|
|
69
|
+
|
|
70
|
+
if (diagnostics.success && diagnostics.diagnostics && diagnostics.diagnostics.length > 0) {
|
|
71
|
+
console.log(`🎉 SUCCESS: Found ${diagnostics.diagnostics.length} diagnostic(s)!`);
|
|
72
|
+
diagnostics.diagnostics.forEach((diag, index) => {
|
|
73
|
+
console.log(` ${index + 1}. ${diag.kind} at line ${diag.location.line}: ${diag.text}`);
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
console.log('❌ No diagnostics found.');
|
|
77
|
+
console.log('This suggests either:');
|
|
78
|
+
console.log(' 1. TSServer is not processing the file correctly');
|
|
79
|
+
console.log(' 2. File notifications are not working as expected');
|
|
80
|
+
console.log(' 3. ycmd diagnostics API has an issue');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Clean up
|
|
84
|
+
if (fs.existsSync(testFile)) {
|
|
85
|
+
fs.unlinkSync(testFile);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
console.log('✅ Test completed');
|
|
89
|
+
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.error('❌ Test failed:', error.message);
|
|
92
|
+
console.error('Stack trace:', error.stack);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Important: Exit the process to prevent hanging
|
|
97
|
+
process.exit(0);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
testDiagnosticsSimple();
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { ycmdStart, ycmdDiagnostics } from '../../../src/agents/tools/ycmd';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
|
|
5
|
+
async function testDiagnosticsTiming() {
|
|
6
|
+
console.log('🔧 Testing ycmd diagnostics with timing...');
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
// Start ycmd server
|
|
10
|
+
console.log('Starting ycmd server...');
|
|
11
|
+
const startResult = await ycmdStart({
|
|
12
|
+
workspaceRoot: process.cwd(),
|
|
13
|
+
logLevel: 'debug'
|
|
14
|
+
});
|
|
15
|
+
console.log('✅ ycmd server started');
|
|
16
|
+
|
|
17
|
+
// Wait for server to initialize
|
|
18
|
+
console.log('⏳ Waiting 3 seconds for server initialization...');
|
|
19
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
20
|
+
|
|
21
|
+
const testDir = path.join(process.cwd(), 'tests/ycmd/fixtures');
|
|
22
|
+
const testFile = path.join(testDir, 'timing_test.ts');
|
|
23
|
+
|
|
24
|
+
// First create a valid file
|
|
25
|
+
console.log('📝 Creating valid TypeScript file...');
|
|
26
|
+
const validContent = `interface User {
|
|
27
|
+
name: string;
|
|
28
|
+
age: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function createUser(name: string, age: number): User {
|
|
32
|
+
return { name, age };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { createUser };`;
|
|
36
|
+
|
|
37
|
+
fs.writeFileSync(testFile, validContent);
|
|
38
|
+
|
|
39
|
+
// Test diagnostics on valid file
|
|
40
|
+
console.log('🔍 Testing diagnostics on valid file...');
|
|
41
|
+
let diagnostics = await ycmdDiagnostics({
|
|
42
|
+
filepath: testFile,
|
|
43
|
+
line: 1,
|
|
44
|
+
column: 1
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
console.log('Valid file diagnostics:', JSON.stringify(diagnostics, null, 2));
|
|
48
|
+
|
|
49
|
+
// Now introduce errors
|
|
50
|
+
console.log('📝 Introducing TypeScript errors...');
|
|
51
|
+
const errorContent = `interface User {
|
|
52
|
+
name: string;
|
|
53
|
+
age: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function createUser(name: string, age: number): User {
|
|
57
|
+
// This should cause an error - missing 'age' property
|
|
58
|
+
return { name };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// This should cause an error - undefined variable
|
|
62
|
+
console.log(undefinedVariable);
|
|
63
|
+
|
|
64
|
+
// This should cause an error - type mismatch
|
|
65
|
+
const user: User = { name: 'Alice' };
|
|
66
|
+
|
|
67
|
+
export { createUser };`;
|
|
68
|
+
|
|
69
|
+
fs.writeFileSync(testFile, errorContent);
|
|
70
|
+
|
|
71
|
+
// Test diagnostics at different delays
|
|
72
|
+
const delays = [500, 1000, 2000, 5000];
|
|
73
|
+
|
|
74
|
+
for (const delay of delays) {
|
|
75
|
+
console.log(`🔍 Testing diagnostics after ${delay}ms delay...`);
|
|
76
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
77
|
+
|
|
78
|
+
diagnostics = await ycmdDiagnostics({
|
|
79
|
+
filepath: testFile,
|
|
80
|
+
line: 1,
|
|
81
|
+
column: 1
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
console.log(`Diagnostics after ${delay}ms:`, JSON.stringify(diagnostics, null, 2));
|
|
85
|
+
|
|
86
|
+
if (diagnostics.success && diagnostics.diagnostics && diagnostics.diagnostics.length > 0) {
|
|
87
|
+
console.log(`✅ SUCCESS: Found ${diagnostics.diagnostics.length} diagnostic(s) after ${delay}ms!`);
|
|
88
|
+
diagnostics.diagnostics.forEach((diag, index) => {
|
|
89
|
+
console.log(` ${index + 1}. Line ${diag.location.line}: ${diag.text}`);
|
|
90
|
+
});
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Try testing different lines where errors are
|
|
96
|
+
console.log('🎯 Testing specific error locations...');
|
|
97
|
+
|
|
98
|
+
const errorLines = [8, 11, 14]; // Lines with errors
|
|
99
|
+
for (const line of errorLines) {
|
|
100
|
+
console.log(`Testing line ${line}...`);
|
|
101
|
+
const lineDiagnostics = await ycmdDiagnostics({
|
|
102
|
+
filepath: testFile,
|
|
103
|
+
line: line,
|
|
104
|
+
column: 1
|
|
105
|
+
});
|
|
106
|
+
console.log(`Line ${line} diagnostics:`, JSON.stringify(lineDiagnostics, null, 2));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Clean up
|
|
110
|
+
fs.unlinkSync(testFile);
|
|
111
|
+
console.log('✅ Test completed');
|
|
112
|
+
process.exit(0);
|
|
113
|
+
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error('❌ Test failed:', error.message);
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
testDiagnosticsTiming();
|