@tyvm/knowhow 0.0.33 → 0.0.34
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 +147 -21
- 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 +980 -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 +72 -24
- 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 +14 -1
- package/ts_build/src/agents/base/base.js +91 -17
- 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 +56 -0
- package/ts_build/src/chat/modules/AgentModule.js +705 -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 +4 -5
- package/ts_build/src/plugins/downloader/downloader.js +55 -26
- 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,105 @@
|
|
|
1
|
+
import { ycmdStart, ycmdDiagnostics, ycmdCompletion, ycmdGoTo } from '../../../src/agents/tools/ycmd';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
|
|
5
|
+
async function testTypeScriptYcmd() {
|
|
6
|
+
console.log('=== YCMD TypeScript Project Test ===\n');
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
// Test 1: Check project structure
|
|
10
|
+
console.log('1. Checking project structure...');
|
|
11
|
+
const cwd = process.cwd();
|
|
12
|
+
console.log('Current working directory:', cwd);
|
|
13
|
+
|
|
14
|
+
const tsconfigPath = path.join(cwd, 'tsconfig.json');
|
|
15
|
+
const packageJsonPath = path.join(cwd, 'package.json');
|
|
16
|
+
|
|
17
|
+
console.log('Looking for tsconfig.json at:', tsconfigPath);
|
|
18
|
+
console.log('tsconfig.json exists:', fs.existsSync(tsconfigPath));
|
|
19
|
+
|
|
20
|
+
console.log('Looking for package.json at:', packageJsonPath);
|
|
21
|
+
console.log('package.json exists:', fs.existsSync(packageJsonPath));
|
|
22
|
+
|
|
23
|
+
// Test 2: Start ycmd server with TypeScript project
|
|
24
|
+
console.log('\n2. Starting ycmd server for TypeScript project...');
|
|
25
|
+
const startResult = await ycmdStart({
|
|
26
|
+
workspaceRoot: cwd
|
|
27
|
+
});
|
|
28
|
+
console.log('Start result:', JSON.stringify(startResult, null, 2));
|
|
29
|
+
|
|
30
|
+
if (!startResult.success) {
|
|
31
|
+
console.error('Failed to start ycmd server, stopping test');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Give server time to start up and initialize TypeScript support
|
|
36
|
+
console.log('Waiting 5 seconds for server to initialize TypeScript support...');
|
|
37
|
+
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
38
|
+
|
|
39
|
+
// Test 3: Test diagnostics on TypeScript file
|
|
40
|
+
console.log('\n3. Testing diagnostics on TypeScript file...');
|
|
41
|
+
const tsFilepath = path.resolve('./test-typescript-sample.ts');
|
|
42
|
+
console.log('TypeScript filepath:', tsFilepath);
|
|
43
|
+
console.log('File exists:', fs.existsSync(tsFilepath));
|
|
44
|
+
|
|
45
|
+
const diagResult = await ycmdDiagnostics({
|
|
46
|
+
filepath: tsFilepath,
|
|
47
|
+
line: 1,
|
|
48
|
+
column: 1
|
|
49
|
+
});
|
|
50
|
+
console.log('Diagnostics result:', JSON.stringify(diagResult, null, 2));
|
|
51
|
+
|
|
52
|
+
// Test 4: Test completion on TypeScript - should complete user. properties
|
|
53
|
+
console.log('\n4. Testing completion on TypeScript file...');
|
|
54
|
+
console.log('Testing completion after "user." on line 25, column 20');
|
|
55
|
+
const compResult = await ycmdCompletion({
|
|
56
|
+
filepath: tsFilepath,
|
|
57
|
+
line: 25,
|
|
58
|
+
column: 20
|
|
59
|
+
});
|
|
60
|
+
console.log('Completion result:', JSON.stringify(compResult, null, 2));
|
|
61
|
+
|
|
62
|
+
// Check specifically for "No Project" error
|
|
63
|
+
if (!compResult.success && compResult.message.includes('No project')) {
|
|
64
|
+
console.log('\n⚠️ FOUND "No Project" ERROR! This is what we need to fix.');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Test 5: Test GoTo definition on UserService
|
|
68
|
+
console.log('\n5. Testing GoTo definition on UserService...');
|
|
69
|
+
console.log('Testing GoTo on "UserService" on line 28, column 25');
|
|
70
|
+
const gotoResult = await ycmdGoTo({
|
|
71
|
+
filepath: tsFilepath,
|
|
72
|
+
line: 28,
|
|
73
|
+
column: 25,
|
|
74
|
+
command: 'GoTo'
|
|
75
|
+
});
|
|
76
|
+
console.log('GoTo result:', JSON.stringify(gotoResult, null, 2));
|
|
77
|
+
|
|
78
|
+
// Check for "No Project" error in GoTo as well
|
|
79
|
+
if (!gotoResult.success && gotoResult.message.includes('No project')) {
|
|
80
|
+
console.log('\n⚠️ FOUND "No Project" ERROR in GoTo! This is what we need to fix.');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Test 6: Try with contents parameter to see if it helps
|
|
84
|
+
console.log('\n6. Testing with contents parameter...');
|
|
85
|
+
const fileContent = fs.readFileSync(tsFilepath, 'utf8');
|
|
86
|
+
const compWithContentResult = await ycmdCompletion({
|
|
87
|
+
filepath: tsFilepath,
|
|
88
|
+
line: 25,
|
|
89
|
+
column: 20,
|
|
90
|
+
contents: fileContent
|
|
91
|
+
});
|
|
92
|
+
console.log('Completion with contents result:', JSON.stringify(compWithContentResult, null, 2));
|
|
93
|
+
|
|
94
|
+
console.log('\n=== TypeScript ycmd test completed ===');
|
|
95
|
+
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error('Error during TypeScript ycmd test:', error);
|
|
98
|
+
if (error instanceof Error) {
|
|
99
|
+
console.error('Error message:', error.message);
|
|
100
|
+
console.error('Stack trace:', error.stack);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
testTypeScriptYcmd();
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ycmdServerManager } from "../../../src/agents/tools/ycmd/serverManager";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
|
|
5
|
+
async function testWorkspaceConfiguration() {
|
|
6
|
+
console.log("=== Workspace Configuration Diagnostic Test ===\n");
|
|
7
|
+
|
|
8
|
+
// Check current working directory and project structure
|
|
9
|
+
const cwd = process.cwd();
|
|
10
|
+
console.log("Current working directory:", cwd);
|
|
11
|
+
|
|
12
|
+
// Check for tsconfig.json
|
|
13
|
+
const tsconfigPath = path.join(cwd, "tsconfig.json");
|
|
14
|
+
const tsconfigExists = fs.existsSync(tsconfigPath);
|
|
15
|
+
console.log("tsconfig.json exists:", tsconfigExists);
|
|
16
|
+
|
|
17
|
+
if (tsconfigExists) {
|
|
18
|
+
const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, "utf8"));
|
|
19
|
+
console.log(
|
|
20
|
+
"tsconfig.json compilerOptions.rootDir:",
|
|
21
|
+
tsconfig.compilerOptions?.rootDir
|
|
22
|
+
);
|
|
23
|
+
console.log("tsconfig.json include patterns:", tsconfig.include);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Test with a file closer to root
|
|
27
|
+
const testFiles = [
|
|
28
|
+
"./src/index.ts",
|
|
29
|
+
"./src/agents/tools/ycmd/utils/pathUtils.ts",
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
for (const filepath of testFiles) {
|
|
33
|
+
console.log(`\n--- Testing file: ${filepath} ---`);
|
|
34
|
+
|
|
35
|
+
const absolutePath = path.resolve(filepath);
|
|
36
|
+
console.log("Absolute path:", absolutePath);
|
|
37
|
+
console.log("File exists:", fs.existsSync(absolutePath));
|
|
38
|
+
|
|
39
|
+
if (!fs.existsSync(absolutePath)) {
|
|
40
|
+
console.log("❌ File does not exist, skipping...");
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
// Try to start a fresh server for each test
|
|
46
|
+
console.log("\nStarting fresh ycmd server...");
|
|
47
|
+
const setupResult = await ycmdServerManager.setupClientAndNotifyFile({
|
|
48
|
+
filepath
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if (!setupResult.success) {
|
|
52
|
+
console.error("❌ Setup failed:", setupResult.message);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
console.log("✅ File notification successful");
|
|
57
|
+
console.log("Resolved file path:", setupResult.resolvedFilePath);
|
|
58
|
+
console.log("File types:", setupResult.filetypes);
|
|
59
|
+
|
|
60
|
+
// Try to get diagnostics first (this often reveals project issues)
|
|
61
|
+
console.log("\nTesting diagnostics...");
|
|
62
|
+
try {
|
|
63
|
+
const diagnostics = await setupResult.client.getDiagnostics(
|
|
64
|
+
setupResult.resolvedFilePath,
|
|
65
|
+
setupResult.contents,
|
|
66
|
+
setupResult.filetypes
|
|
67
|
+
);
|
|
68
|
+
console.log("✅ Diagnostics successful");
|
|
69
|
+
console.log("Diagnostic count:", diagnostics?.length || 0);
|
|
70
|
+
} catch (diagError) {
|
|
71
|
+
console.error("❌ Diagnostics failed:", diagError.message);
|
|
72
|
+
}
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error("❌ Test failed for", filepath, ":", error.message);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Stop the server between tests
|
|
78
|
+
await ycmdServerManager.stop();
|
|
79
|
+
console.log("Server stopped for next test");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
console.log("\n=== Workspace Configuration Test Complete ===");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Run the test
|
|
86
|
+
testWorkspaceConfiguration()
|
|
87
|
+
.catch(console.error)
|
|
88
|
+
.finally(() => {
|
|
89
|
+
process.exit(0);
|
|
90
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
|
|
3
|
+
import { ycmdStart } from '../../../src/agents/tools/ycmd/tools/start';
|
|
4
|
+
import { ycmdCompletion } from '../../../src/agents/tools/ycmd/tools/completion';
|
|
5
|
+
import { ycmdDiagnostics } from '../../../src/agents/tools/ycmd/tools/diagnostics';
|
|
6
|
+
import { ycmdGoTo } from '../../../src/agents/tools/ycmd/tools/goto';
|
|
7
|
+
import { ycmdRefactor } from '../../../src/agents/tools/ycmd/tools/refactor';
|
|
8
|
+
import { ycmdSignatureHelp } from '../../../src/agents/tools/ycmd/tools/signature';
|
|
9
|
+
import { ycmdServerManager } from '../../../src/agents/tools/ycmd/serverManager';
|
|
10
|
+
import * as fs from 'fs';
|
|
11
|
+
import * as path from 'path';
|
|
12
|
+
|
|
13
|
+
async function testYcmdAutoStart() {
|
|
14
|
+
console.log('🧪 Testing YCMD Auto-Start Functionality');
|
|
15
|
+
console.log('=' .repeat(50));
|
|
16
|
+
|
|
17
|
+
// Create a test Python file
|
|
18
|
+
const testFile = path.join(process.cwd(), 'test_auto_start.py');
|
|
19
|
+
const testContent = `import os
|
|
20
|
+
import sys
|
|
21
|
+
|
|
22
|
+
def hello_world(name: str) -> str:
|
|
23
|
+
"""Greets a person by name."""
|
|
24
|
+
return f"Hello, {name}!"
|
|
25
|
+
|
|
26
|
+
def calculate_sum(a: int, b: int) -> int:
|
|
27
|
+
"""Calculate the sum of two numbers."""
|
|
28
|
+
return a + b
|
|
29
|
+
|
|
30
|
+
# Test completion and diagnostics
|
|
31
|
+
result = hello_world("
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
console.log('📝 Creating test file:', testFile);
|
|
35
|
+
await fs.promises.writeFile(testFile, testContent);
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
// Ensure server is stopped initially
|
|
39
|
+
console.log('🛑 Stopping any existing ycmd server...');
|
|
40
|
+
await ycmdServerManager.stop();
|
|
41
|
+
|
|
42
|
+
// Wait a moment for cleanup
|
|
43
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
44
|
+
|
|
45
|
+
console.log('🔍 Verifying server is not running...');
|
|
46
|
+
const initiallyRunning = await ycmdServerManager.isRunning();
|
|
47
|
+
console.log(`Server initially running: ${initiallyRunning}`);
|
|
48
|
+
|
|
49
|
+
// Test 1: Completion with auto-start
|
|
50
|
+
console.log('\n🚀 Test 1: Testing completion with auto-start...');
|
|
51
|
+
const completionResult = await ycmdCompletion({
|
|
52
|
+
filepath: testFile,
|
|
53
|
+
line: 12,
|
|
54
|
+
column: 21, // After the opening quote
|
|
55
|
+
contents: testContent
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
console.log('Completion result:', JSON.stringify(completionResult, null, 2));
|
|
59
|
+
|
|
60
|
+
// Test 2: Diagnostics (should use already started server)
|
|
61
|
+
console.log('\n🔧 Test 2: Testing diagnostics...');
|
|
62
|
+
const diagnosticsResult = await ycmdDiagnostics({
|
|
63
|
+
filepath: testFile,
|
|
64
|
+
fileContents: testContent
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
console.log('Diagnostics result:', JSON.stringify(diagnosticsResult, null, 2));
|
|
68
|
+
|
|
69
|
+
// Test 3: Go to definition
|
|
70
|
+
console.log('\n🎯 Test 3: Testing goto definition...');
|
|
71
|
+
const gotoResult = await ycmdGoTo({
|
|
72
|
+
filepath: testFile,
|
|
73
|
+
line: 12,
|
|
74
|
+
column: 10, // On "hello_world"
|
|
75
|
+
command: 'GoTo',
|
|
76
|
+
contents: testContent
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
console.log('Goto result:', JSON.stringify(gotoResult, null, 2));
|
|
80
|
+
|
|
81
|
+
// Test 4: Signature help
|
|
82
|
+
console.log('\n📋 Test 4: Testing signature help...');
|
|
83
|
+
const signatureResult = await ycmdSignatureHelp({
|
|
84
|
+
filepath: testFile,
|
|
85
|
+
line: 12,
|
|
86
|
+
column: 10, // On function call
|
|
87
|
+
contents: testContent
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
console.log('Signature result:', JSON.stringify(signatureResult, null, 2));
|
|
91
|
+
|
|
92
|
+
// Test 5: Refactor (organize imports)
|
|
93
|
+
console.log('\n🔄 Test 5: Testing refactor (organize imports)...');
|
|
94
|
+
const refactorResult = await ycmdRefactor({
|
|
95
|
+
filepath: testFile,
|
|
96
|
+
line: 1,
|
|
97
|
+
column: 1,
|
|
98
|
+
command: 'organize_imports',
|
|
99
|
+
contents: testContent
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
console.log('Refactor result:', JSON.stringify(refactorResult, null, 2));
|
|
103
|
+
|
|
104
|
+
// Verify server is still running
|
|
105
|
+
console.log('\n✅ Verifying server is running after tests...');
|
|
106
|
+
const finallyRunning = await ycmdServerManager.isRunning();
|
|
107
|
+
console.log(`Server finally running: ${finallyRunning}`);
|
|
108
|
+
|
|
109
|
+
const serverInfo = ycmdServerManager.getServerInfo();
|
|
110
|
+
if (serverInfo) {
|
|
111
|
+
console.log(`Server info: ${serverInfo.host}:${serverInfo.port} (${serverInfo.status})`);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
console.log('\n🎉 Auto-start functionality test completed!');
|
|
115
|
+
console.log('All tools should have automatically started the ycmd server when needed.');
|
|
116
|
+
process.exit(0);
|
|
117
|
+
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error('❌ Test failed:', error);
|
|
120
|
+
} finally {
|
|
121
|
+
// Cleanup
|
|
122
|
+
console.log('\n🧹 Cleaning up...');
|
|
123
|
+
try {
|
|
124
|
+
await fs.promises.unlink(testFile);
|
|
125
|
+
console.log('Test file removed');
|
|
126
|
+
} catch (error) {
|
|
127
|
+
console.warn('Failed to remove test file:', error);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Stop server
|
|
131
|
+
await ycmdServerManager.stop();
|
|
132
|
+
console.log('Server stopped');
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Run the test
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ycmdStart, ycmdDiagnostics, ycmdCompletion, ycmdGoTo } from '../../../src/agents/tools/ycmd';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
|
|
4
|
+
async function testYcmdTools() {
|
|
5
|
+
console.log('=== YCMD Tools Comprehensive Test ===\n');
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
// Test 1: Start ycmd server
|
|
9
|
+
console.log('1. Starting ycmd server...');
|
|
10
|
+
const startResult = await ycmdStart({});
|
|
11
|
+
console.log('Start result:', JSON.stringify(startResult, null, 2));
|
|
12
|
+
|
|
13
|
+
// Give server time to start up
|
|
14
|
+
if (startResult.success) {
|
|
15
|
+
console.log('Waiting 3 seconds for server to initialize...');
|
|
16
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Test 2: Test diagnostics
|
|
20
|
+
console.log('\n2. Testing diagnostics...');
|
|
21
|
+
const filepath = path.resolve('./test_ycmd_fixed.py');
|
|
22
|
+
console.log('Filepath:', filepath);
|
|
23
|
+
|
|
24
|
+
const diagResult = await ycmdDiagnostics({
|
|
25
|
+
filepath,
|
|
26
|
+
line: 1,
|
|
27
|
+
column: 1
|
|
28
|
+
});
|
|
29
|
+
console.log('Diagnostics result:', JSON.stringify(diagResult, null, 2));
|
|
30
|
+
|
|
31
|
+
// Test 3: Test completion
|
|
32
|
+
console.log('\n3. Testing completion...');
|
|
33
|
+
const compResult = await ycmdCompletion({
|
|
34
|
+
filepath,
|
|
35
|
+
line: 14,
|
|
36
|
+
column: 15
|
|
37
|
+
});
|
|
38
|
+
console.log('Completion result:', JSON.stringify(compResult, null, 2));
|
|
39
|
+
|
|
40
|
+
// Test 4: Test GoTo with correct command
|
|
41
|
+
console.log('\n4. Testing GoTo definition...');
|
|
42
|
+
const gotoResult = await ycmdGoTo({
|
|
43
|
+
filepath,
|
|
44
|
+
line: 5, // Line with 'fibonacci' function definition
|
|
45
|
+
column: 5,
|
|
46
|
+
command: 'GoTo'
|
|
47
|
+
});
|
|
48
|
+
console.log('GoTo result:', JSON.stringify(gotoResult, null, 2));
|
|
49
|
+
|
|
50
|
+
// Test 5: Test GoTo references
|
|
51
|
+
console.log('\n5. Testing GoTo references...');
|
|
52
|
+
const refsResult = await ycmdGoTo({
|
|
53
|
+
filepath,
|
|
54
|
+
line: 5,
|
|
55
|
+
column: 5,
|
|
56
|
+
command: 'GoToReferences'
|
|
57
|
+
});
|
|
58
|
+
console.log('References result:', JSON.stringify(refsResult, null, 2));
|
|
59
|
+
|
|
60
|
+
console.log('\n=== All tests completed ===');
|
|
61
|
+
process.exit(0);
|
|
62
|
+
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.error('Error during comprehensive test:', error);
|
|
65
|
+
if (error instanceof Error) {
|
|
66
|
+
console.error('Error message:', error.message);
|
|
67
|
+
console.error('Stack trace:', error.stack);
|
|
68
|
+
}
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
testYcmdTools();
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
|
|
3
|
+
import { ycmdStart } from '../../../src/agents/tools/ycmd/tools/start';
|
|
4
|
+
import { ycmdDiagnostics } from '../../../src/agents/tools/ycmd/tools/diagnostics';
|
|
5
|
+
import { ycmdCompletion } from '../../../src/agents/tools/ycmd/tools/completion';
|
|
6
|
+
import { ycmdGoTo } from '../../../src/agents/tools/ycmd/tools/goto';
|
|
7
|
+
import { ycmdSignatureHelp } from '../../../src/agents/tools/ycmd/tools/signature';
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
|
|
11
|
+
async function testYcmdTools() {
|
|
12
|
+
console.log('🚀 Starting ycmd tools test...\n');
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
// 1. Start ycmd server
|
|
16
|
+
console.log('1. Starting ycmd server...');
|
|
17
|
+
const startResult = await ycmdStart({});
|
|
18
|
+
console.log('Start result:', startResult);
|
|
19
|
+
|
|
20
|
+
if (!startResult.success) {
|
|
21
|
+
console.error('❌ Failed to start server');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Wait a moment for server to be ready
|
|
26
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
27
|
+
|
|
28
|
+
// 2. Create a test TypeScript file with intentional errors
|
|
29
|
+
const testFile = '/tmp/test_diagnostics.ts';
|
|
30
|
+
const testContent = `// Test TypeScript file with errors
|
|
31
|
+
let message: string = 123; // Type error
|
|
32
|
+
let unused_variable = "test"; // Unused variable
|
|
33
|
+
|
|
34
|
+
function greet(name: string): string {
|
|
35
|
+
return "Hello " + name;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Missing return type and parameter type
|
|
39
|
+
function badFunction(param) {
|
|
40
|
+
console.log(param);
|
|
41
|
+
// Missing return statement
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Call with wrong argument type
|
|
45
|
+
greet(42);
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
fs.writeFileSync(testFile, testContent);
|
|
49
|
+
console.log(`✅ Created test file: ${testFile}\n`);
|
|
50
|
+
|
|
51
|
+
// 3. Test diagnostics
|
|
52
|
+
console.log('2. Testing diagnostics...');
|
|
53
|
+
const diagnosticsResult = await ycmdDiagnostics({
|
|
54
|
+
filepath: testFile,
|
|
55
|
+
fileContents: testContent
|
|
56
|
+
});
|
|
57
|
+
console.log('Diagnostics result:', JSON.stringify(diagnosticsResult, null, 2));
|
|
58
|
+
|
|
59
|
+
if (diagnosticsResult.success && diagnosticsResult.diagnostics) {
|
|
60
|
+
console.log(`✅ Found ${diagnosticsResult.diagnostics.length} diagnostics`);
|
|
61
|
+
diagnosticsResult.diagnostics.forEach((diag, i) => {
|
|
62
|
+
console.log(` ${i + 1}. [${diag.kind}] Line ${diag.location.line}: ${diag.text}`);
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
console.log('❌ Diagnostics failed or returned no results');
|
|
66
|
+
}
|
|
67
|
+
console.log();
|
|
68
|
+
|
|
69
|
+
// 4. Test completion
|
|
70
|
+
console.log('3. Testing completion...');
|
|
71
|
+
const completionResult = await ycmdCompletion({
|
|
72
|
+
filepath: testFile,
|
|
73
|
+
contents: testContent,
|
|
74
|
+
line: 5,
|
|
75
|
+
column: 10 // Inside the greet function
|
|
76
|
+
});
|
|
77
|
+
console.log('Completion result:', JSON.stringify(completionResult, null, 2));
|
|
78
|
+
|
|
79
|
+
if (completionResult.success && completionResult.completions) {
|
|
80
|
+
console.log(`✅ Found ${completionResult.completions.length} completions`);
|
|
81
|
+
completionResult.completions.slice(0, 5).forEach((comp, i) => {
|
|
82
|
+
console.log(` ${i + 1}. ${comp.text} (${comp.kind})`);
|
|
83
|
+
});
|
|
84
|
+
} else {
|
|
85
|
+
console.log('❌ Completion failed or returned no results');
|
|
86
|
+
}
|
|
87
|
+
console.log();
|
|
88
|
+
|
|
89
|
+
// 5. Test goto definition
|
|
90
|
+
console.log('4. Testing goto definition...');
|
|
91
|
+
const gotoResult = await ycmdGoTo({
|
|
92
|
+
filepath: testFile,
|
|
93
|
+
contents: testContent,
|
|
94
|
+
line: 15, // On the greet function call
|
|
95
|
+
column: 1,
|
|
96
|
+
command: 'GoTo'
|
|
97
|
+
});
|
|
98
|
+
console.log('Goto result:', JSON.stringify(gotoResult, null, 2));
|
|
99
|
+
|
|
100
|
+
if (gotoResult.success && gotoResult.locations) {
|
|
101
|
+
console.log(`✅ Found ${gotoResult.locations.length} goto locations`);
|
|
102
|
+
gotoResult.locations.forEach((loc, i) => {
|
|
103
|
+
console.log(` ${i + 1}. ${loc.filepath}:${loc.line}:${loc.column}`);
|
|
104
|
+
});
|
|
105
|
+
} else {
|
|
106
|
+
console.log('❌ Goto failed or returned no results');
|
|
107
|
+
}
|
|
108
|
+
console.log();
|
|
109
|
+
|
|
110
|
+
// 6. Test signature help
|
|
111
|
+
console.log('5. Testing signature help...');
|
|
112
|
+
const signatureResult = await ycmdSignatureHelp({
|
|
113
|
+
filepath: testFile,
|
|
114
|
+
contents: testContent,
|
|
115
|
+
line: 15, // On the greet function call
|
|
116
|
+
column: 6 // Inside the parentheses
|
|
117
|
+
});
|
|
118
|
+
console.log('Signature result:', JSON.stringify(signatureResult, null, 2));
|
|
119
|
+
|
|
120
|
+
if (signatureResult.success && signatureResult.signatureHelp?.signatures) {
|
|
121
|
+
console.log(`✅ Found ${signatureResult.signatureHelp.signatures.length} signatures`);
|
|
122
|
+
signatureResult.signatureHelp.signatures.forEach((sig, i) => {
|
|
123
|
+
console.log(` ${i + 1}. ${sig.label}`);
|
|
124
|
+
});
|
|
125
|
+
} else {
|
|
126
|
+
console.log('❌ Signature help failed or returned no results');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
console.log('\n🎉 ycmd tools test completed!');
|
|
130
|
+
process.exit(0);
|
|
131
|
+
|
|
132
|
+
} catch (error) {
|
|
133
|
+
console.error('❌ Test failed with error:', error);
|
|
134
|
+
process.exit(1);
|
|
135
|
+
} finally {
|
|
136
|
+
// Cleanup test file
|
|
137
|
+
try { fs.unlinkSync('/tmp/test_diagnostics.ts'); } catch {}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Run the test
|
|
142
|
+
testYcmdTools().catch(console.error);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Test file for experimenting with ycmd tools
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
|
|
5
|
+
interface User {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
email: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class UserManager {
|
|
12
|
+
private users: User[] = [];
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
this.loadUsers();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
addUser(user: User): void {
|
|
19
|
+
this.users.push(user);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getUserById(id: number): User | undefined {
|
|
23
|
+
return this.users.find(u => u.id === id);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private loadUsers(): void {
|
|
27
|
+
// Intentional error: using non-existent method
|
|
28
|
+
const data = fs.readFileSync('./users.json', 'utf8');
|
|
29
|
+
this.users = JSON.parse(data);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
updateUserEmail(userId: number, newEmail: string): boolean {
|
|
33
|
+
const user = this.getUserById(userId);
|
|
34
|
+
if (user) {
|
|
35
|
+
user.email = newEmail;
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Test function with parameters
|
|
43
|
+
function calculateTotal(items: number[], taxRate: number = 0.1): number {
|
|
44
|
+
const subtotal = items.reduce((sum, item) => sum + item, 0);
|
|
45
|
+
return subtotal * (1 + taxRate);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { UserManager, calculateTotal };
|