quantalogic 0.2.26__tar.gz → 0.2.27__tar.gz
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.
- {quantalogic-0.2.26 → quantalogic-0.2.27}/PKG-INFO +6 -2
- {quantalogic-0.2.26 → quantalogic-0.2.27}/README.md +1 -1
- {quantalogic-0.2.26 → quantalogic-0.2.27}/pyproject.toml +5 -1
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/coding_agent.py +3 -1
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/__init__.py +7 -1
- quantalogic-0.2.27/quantalogic/tools/generate_database_report_tool.py +52 -0
- quantalogic-0.2.27/quantalogic/tools/grep_app_tool.py +499 -0
- quantalogic-0.2.27/quantalogic/tools/sql_query_tool.py +167 -0
- quantalogic-0.2.27/quantalogic/tools/utils/__init__.py +13 -0
- quantalogic-0.2.27/quantalogic/tools/utils/create_sample_database.py +124 -0
- quantalogic-0.2.27/quantalogic/tools/utils/generate_database_report.py +289 -0
- quantalogic-0.2.26/quantalogic/.DS_Store +0 -0
- quantalogic-0.2.26/quantalogic/server/__pycache__/__init__.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/server/__pycache__/agent_server.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/server/__pycache__/models.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/server/__pycache__/state.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/__init__.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/__init__.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/agent_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/agent_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/attempt_reply.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/coder_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/context_diff_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/dalle_e.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/diff_patch_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/download_http_file_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/download_http_file_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/duckduckgo_search_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/edit_whole_content_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/edit_whole_content_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/elixir_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/elixir_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/execute_bash_command_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/execute_bash_command_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/input_question_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/input_question_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/jinja_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/list_code_definitions_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/list_directory_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/list_directory_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/llm_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/llm_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/llm_vision_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/markitdown_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/markitdown_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/nodejs_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/nodejs_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/python_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/python_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/read_file_block_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/read_file_block_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/read_file_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/read_file_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/read_html_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/replace_in_file_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/replace_in_file_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/repository_map_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/ripgrep_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/ripgrep_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/search_definition_names.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/search_definition_names.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/search_replace_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/serpapi_search_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/serpapi_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/task_complete_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/task_complete_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/unified_diff_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/unified_diff_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/variable_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/wikipedia_search_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/wikipedia_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/write_file_tool.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/__pycache__/write_file_tool.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/__init__.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/__init__.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/c_handler.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/c_handler.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/cpp_handler.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/cpp_handler.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/go_handler.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/go_handler.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/java_handler.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/java_handler.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/javascript_handler.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/javascript_handler.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/language_handlers.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/python_handler.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/python_handler.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/rust_handler.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/rust_handler.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/scala_handler.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/scala_handler.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/typescript_handler.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/language_handlers/__pycache__/typescript_handler.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/tools/utils/__pycache__/git_ls.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/__init__.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/__init__.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/ask_user_validation.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/check_version.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/download_http_file.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/download_http_file.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/get_coding_environment.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/get_environment.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/get_quantalogic_rules_content.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/git_ls.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/logger_config.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/memory_utils.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/read_file.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/read_file.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/read_http_text_content.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/read_http_text_content.cpython-313.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/spinner.cpython-312.pyc +0 -0
- quantalogic-0.2.26/quantalogic/utils/__pycache__/version_check.cpython-312.pyc +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/LICENSE +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/__init__.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/agent.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/agent_config.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/agent_factory.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/console_print_events.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/console_print_token.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/docs_cli.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/event_emitter.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/generative_model.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/get_model_info.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/interactive_text_editor.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/main.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/memory.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/model_names.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/prompts.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/search_agent.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/server/__init__.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/server/agent_server.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/server/models.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/server/routes.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/server/state.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/server/static/js/event_visualizer.js +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/server/static/js/quantalogic.js +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/server/templates/index.html +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/task_file_reader.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/task_runner.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tool_manager.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/agent_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/dalle_e.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/download_http_file_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/duckduckgo_search_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/edit_whole_content_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/elixir_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/execute_bash_command_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/input_question_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/jinja_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/language_handlers/__init__.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/language_handlers/c_handler.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/language_handlers/cpp_handler.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/language_handlers/go_handler.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/language_handlers/java_handler.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/language_handlers/javascript_handler.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/language_handlers/python_handler.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/language_handlers/rust_handler.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/language_handlers/scala_handler.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/language_handlers/typescript_handler.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/list_directory_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/llm_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/llm_vision_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/markitdown_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/nodejs_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/python_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/read_file_block_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/read_file_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/read_html_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/replace_in_file_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/ripgrep_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/search_definition_names.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/serpapi_search_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/task_complete_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/unified_diff_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/wikipedia_search_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/tools/write_file_tool.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/utils/__init__.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/utils/ask_user_validation.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/utils/check_version.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/utils/download_http_file.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/utils/get_coding_environment.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/utils/get_environment.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/utils/get_quantalogic_rules_content.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/utils/git_ls.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/utils/read_file.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/utils/read_http_text_content.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/version.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/version_check.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/welcome_message.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/xml_parser.py +0 -0
- {quantalogic-0.2.26 → quantalogic-0.2.27}/quantalogic/xml_tool_parser.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: quantalogic
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.27
|
4
4
|
Summary: QuantaLogic ReAct Agents
|
5
5
|
Author: Raphaël MANSUY
|
6
6
|
Author-email: raphael.mansuy@gmail.com
|
@@ -12,6 +12,7 @@ Requires-Dist: beautifulsoup4 (>=4.12.3,<5.0.0)
|
|
12
12
|
Requires-Dist: boto3 (>=1.35.86,<2.0.0)
|
13
13
|
Requires-Dist: click (>=8.1.8,<9.0.0)
|
14
14
|
Requires-Dist: duckduckgo-search (>=7.2.1,<8.0.0)
|
15
|
+
Requires-Dist: faker (>=33.3.1,<34.0.0)
|
15
16
|
Requires-Dist: fastapi (>=0.115.6,<0.116.0)
|
16
17
|
Requires-Dist: google-auth (>=2.20.0,<3.0.0)
|
17
18
|
Requires-Dist: google-search-results (>=2.4.2,<3.0.0)
|
@@ -28,13 +29,16 @@ Requires-Dist: mkdocs-mermaid2-plugin (>=1.1.1,<2.0.0)
|
|
28
29
|
Requires-Dist: mkdocs-minify-plugin (>=0.7.1,<0.8.0)
|
29
30
|
Requires-Dist: mkdocstrings (>=0.24.0,<0.25.0)
|
30
31
|
Requires-Dist: mkdocstrings-python (>=1.7.0,<2.0.0)
|
32
|
+
Requires-Dist: networkx (>=3.4.2,<4.0.0)
|
31
33
|
Requires-Dist: pathspec (>=0.12.1,<0.13.0)
|
32
34
|
Requires-Dist: prompt-toolkit (>=3.0.48,<4.0.0)
|
33
35
|
Requires-Dist: pydantic (>=2.10.4,<3.0.0)
|
34
36
|
Requires-Dist: pymdown-extensions (>=10.3.1,<11.0.0)
|
37
|
+
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
35
38
|
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
36
39
|
Requires-Dist: rich (>=13.9.4,<14.0.0)
|
37
40
|
Requires-Dist: serpapi (>=0.1.5,<0.2.0)
|
41
|
+
Requires-Dist: sqlalchemy (>=2.0.37,<3.0.0)
|
38
42
|
Requires-Dist: tenacity (>=9.0.0,<10.0.0)
|
39
43
|
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
40
44
|
Requires-Dist: tree-sitter (>=0.23.2,<0.24.0)
|
@@ -82,7 +86,7 @@ We created [QuantaLogic](https://www.quantalogic.app) because we saw a significa
|
|
82
86
|
## 🌟 Highlights
|
83
87
|
|
84
88
|
- **ReAct Framework**: Advanced implementation combining LLM reasoning with concrete actions
|
85
|
-
- **Universal LLM Support**: Integration with OpenAI, Anthropic, LM Studio, Bedrock, Ollama, DeepSeek V3, via LiteLLM
|
89
|
+
- **Universal LLM Support**: Integration with OpenAI, Anthropic, LM Studio, Bedrock, Ollama, DeepSeek V3, DeepSeek R1, via LiteLLM. Example usage: `quantalogic --model-name deepseek/deepseek-reasoner` or `quantalogic --model-name openrouter/deepseek/deepseek-r1`
|
86
90
|
- **Secure Tool System**: Docker-based code execution and file manipulation tools
|
87
91
|
- **Real-time Monitoring**: Web interface with SSE-based event visualization
|
88
92
|
- **Memory Management**: Intelligent context handling and optimization
|
@@ -28,7 +28,7 @@ We created [QuantaLogic](https://www.quantalogic.app) because we saw a significa
|
|
28
28
|
## 🌟 Highlights
|
29
29
|
|
30
30
|
- **ReAct Framework**: Advanced implementation combining LLM reasoning with concrete actions
|
31
|
-
- **Universal LLM Support**: Integration with OpenAI, Anthropic, LM Studio, Bedrock, Ollama, DeepSeek V3, via LiteLLM
|
31
|
+
- **Universal LLM Support**: Integration with OpenAI, Anthropic, LM Studio, Bedrock, Ollama, DeepSeek V3, DeepSeek R1, via LiteLLM. Example usage: `quantalogic --model-name deepseek/deepseek-reasoner` or `quantalogic --model-name openrouter/deepseek/deepseek-r1`
|
32
32
|
- **Secure Tool System**: Docker-based code execution and file manipulation tools
|
33
33
|
- **Real-time Monitoring**: Web interface with SSE-based event visualization
|
34
34
|
- **Memory Management**: Intelligent context handling and optimization
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "quantalogic"
|
3
|
-
version = "0.2.
|
3
|
+
version = "0.2.27"
|
4
4
|
description = "QuantaLogic ReAct Agents"
|
5
5
|
authors = ["Raphaël MANSUY <raphael.mansuy@gmail.com>"]
|
6
6
|
readme = "README.md"
|
@@ -50,6 +50,10 @@ jinja2 = "^3.1.5"
|
|
50
50
|
beautifulsoup4 = "^4.12.3"
|
51
51
|
markdownify = "^0.14.1"
|
52
52
|
requests = "^2.32.3"
|
53
|
+
sqlalchemy = "^2.0.37"
|
54
|
+
python-dotenv = "^1.0.1"
|
55
|
+
networkx = "^3.4.2"
|
56
|
+
faker = "^33.3.1"
|
53
57
|
|
54
58
|
[tool.poetry.scripts]
|
55
59
|
quantalogic = "quantalogic.main:cli"
|
@@ -4,6 +4,7 @@ from quantalogic.tools import (
|
|
4
4
|
DuckDuckGoSearchTool,
|
5
5
|
EditWholeContentTool,
|
6
6
|
ExecuteBashCommandTool,
|
7
|
+
GrepAppTool,
|
7
8
|
InputQuestionTool,
|
8
9
|
JinjaTool,
|
9
10
|
ListDirectoryTool,
|
@@ -75,7 +76,8 @@ def create_coding_agent(
|
|
75
76
|
InputQuestionTool(),
|
76
77
|
DuckDuckGoSearchTool(),
|
77
78
|
JinjaTool(),
|
78
|
-
ReadHTMLTool()
|
79
|
+
ReadHTMLTool(),
|
80
|
+
GrepAppTool()
|
79
81
|
]
|
80
82
|
|
81
83
|
if vision_model_name:
|
@@ -7,6 +7,8 @@ from .duckduckgo_search_tool import DuckDuckGoSearchTool
|
|
7
7
|
from .edit_whole_content_tool import EditWholeContentTool
|
8
8
|
from .elixir_tool import ElixirTool
|
9
9
|
from .execute_bash_command_tool import ExecuteBashCommandTool
|
10
|
+
from .generate_database_report_tool import GenerateDatabaseReportTool
|
11
|
+
from .grep_app_tool import GrepAppTool
|
10
12
|
from .input_question_tool import InputQuestionTool
|
11
13
|
from .jinja_tool import JinjaTool
|
12
14
|
from .list_directory_tool import ListDirectoryTool
|
@@ -22,6 +24,7 @@ from .replace_in_file_tool import ReplaceInFileTool
|
|
22
24
|
from .ripgrep_tool import RipgrepTool
|
23
25
|
from .search_definition_names import SearchDefinitionNames
|
24
26
|
from .serpapi_search_tool import SerpApiSearchTool
|
27
|
+
from .sql_query_tool import SQLQueryTool
|
25
28
|
from .task_complete_tool import TaskCompleteTool
|
26
29
|
from .tool import Tool, ToolArgument
|
27
30
|
from .unified_diff_tool import UnifiedDiffTool
|
@@ -56,5 +59,8 @@ __all__ = [
|
|
56
59
|
"EditWholeContentTool",
|
57
60
|
"JinjaTool",
|
58
61
|
"LLMImageGenerationTool",
|
59
|
-
"ReadHTMLTool"
|
62
|
+
"ReadHTMLTool",
|
63
|
+
"GrepAppTool",
|
64
|
+
"GenerateDatabaseReportTool",
|
65
|
+
'SQLQueryTool'
|
60
66
|
]
|
@@ -0,0 +1,52 @@
|
|
1
|
+
"""Tool for generating comprehensive database documentation reports."""
|
2
|
+
|
3
|
+
from pydantic import Field, ValidationError
|
4
|
+
|
5
|
+
from quantalogic.tools.tool import Tool
|
6
|
+
from quantalogic.tools.utils.generate_database_report import generate_database_report
|
7
|
+
|
8
|
+
|
9
|
+
class GenerateDatabaseReportTool(Tool):
|
10
|
+
"""Tool for generating database documentation reports from a connection string."""
|
11
|
+
|
12
|
+
name: str = "generate_database_report_tool"
|
13
|
+
description: str = (
|
14
|
+
"Generates a comprehensive Markdown database documentation report with ER diagram. "
|
15
|
+
)
|
16
|
+
arguments: list = [] # No execution arguments - connection string is configured during tool setup
|
17
|
+
connection_string: str = Field(
|
18
|
+
...,
|
19
|
+
description="SQLAlchemy-compatible database connection string (e.g., 'sqlite:///database.db')",
|
20
|
+
example="postgresql://user:password@localhost/mydatabase"
|
21
|
+
)
|
22
|
+
|
23
|
+
def execute(self) -> str:
|
24
|
+
"""Generates a database documentation report using the configured connection string.
|
25
|
+
|
26
|
+
Returns:
|
27
|
+
str: Markdown-formatted database report
|
28
|
+
|
29
|
+
Raises:
|
30
|
+
ValueError: For invalid connection strings or database connection errors
|
31
|
+
RuntimeError: For errors during report generation
|
32
|
+
"""
|
33
|
+
try:
|
34
|
+
return generate_database_report(self.connection_string)
|
35
|
+
except ValidationError as e:
|
36
|
+
raise ValueError(f"Invalid connection configuration: {e}") from e
|
37
|
+
except Exception as e:
|
38
|
+
raise RuntimeError(f"Database report generation failed: {e}") from e
|
39
|
+
|
40
|
+
|
41
|
+
if __name__ == "__main__":
|
42
|
+
|
43
|
+
from quantalogic.tools.utils.create_sample_database import create_sample_database
|
44
|
+
|
45
|
+
# Create and document sample database
|
46
|
+
create_sample_database("sample.db")
|
47
|
+
|
48
|
+
# Example usage
|
49
|
+
tool = GenerateDatabaseReportTool(
|
50
|
+
connection_string="sqlite:///sample.db"
|
51
|
+
)
|
52
|
+
print(tool.execute())
|
@@ -0,0 +1,499 @@
|
|
1
|
+
# quantalogic/tools/grep_app_tool.py
|
2
|
+
|
3
|
+
import random
|
4
|
+
import sys
|
5
|
+
import time
|
6
|
+
from typing import Any, ClassVar, Dict, Optional, Union
|
7
|
+
|
8
|
+
import requests
|
9
|
+
from loguru import logger
|
10
|
+
from pydantic import BaseModel, Field, ValidationError, model_validator
|
11
|
+
|
12
|
+
from quantalogic.tools.tool import Tool, ToolArgument
|
13
|
+
|
14
|
+
# Configurable User Agents
|
15
|
+
USER_AGENTS = [
|
16
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
17
|
+
"Chrome/91.0.4472.124 Safari/537.36",
|
18
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) "
|
19
|
+
"Chrome/91.0.4472.124 Safari/537.36",
|
20
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0",
|
21
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/20100101 Firefox/89.0",
|
22
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) "
|
23
|
+
"Version/14.1.1 Safari/605.1.15"
|
24
|
+
]
|
25
|
+
|
26
|
+
class SearchError(Exception):
|
27
|
+
"""Custom exception for search-related errors"""
|
28
|
+
pass
|
29
|
+
|
30
|
+
class GrepAppArguments(BaseModel):
|
31
|
+
"""Pydantic model for grep.app search arguments"""
|
32
|
+
search_query: str = Field(
|
33
|
+
...,
|
34
|
+
description="GitHub Code search using simple keyword or regular expression",
|
35
|
+
example="code2prompt"
|
36
|
+
)
|
37
|
+
repository: Optional[str] = Field(
|
38
|
+
None,
|
39
|
+
description="Filter by repository (e.g. user/repo)",
|
40
|
+
example="quantalogic/quantalogic",
|
41
|
+
)
|
42
|
+
page: int = Field(
|
43
|
+
1,
|
44
|
+
description="Results page number",
|
45
|
+
ge=1
|
46
|
+
)
|
47
|
+
per_page: int = Field(
|
48
|
+
10,
|
49
|
+
description="Number of results per page",
|
50
|
+
ge=1,
|
51
|
+
le=100
|
52
|
+
)
|
53
|
+
regexp: bool = Field(
|
54
|
+
False,
|
55
|
+
description="Enable regular expression search"
|
56
|
+
)
|
57
|
+
case: bool = Field(
|
58
|
+
False,
|
59
|
+
description="Enable case-sensitive search"
|
60
|
+
)
|
61
|
+
words: bool = Field(
|
62
|
+
False,
|
63
|
+
description="Match whole words only"
|
64
|
+
)
|
65
|
+
|
66
|
+
@model_validator(mode='before')
|
67
|
+
@classmethod
|
68
|
+
def convert_types(cls, data: Dict[str, Any]) -> Dict[str, Any]:
|
69
|
+
"""Convert input types before validation"""
|
70
|
+
# Convert string numbers to integers
|
71
|
+
for field in ['page', 'per_page']:
|
72
|
+
if field in data and isinstance(data[field], str):
|
73
|
+
try:
|
74
|
+
data[field] = int(data[field])
|
75
|
+
except ValueError:
|
76
|
+
raise ValueError(f"{field} must be a valid integer")
|
77
|
+
|
78
|
+
# Convert various string representations to booleans
|
79
|
+
for field in ['regexp', 'case', 'words']:
|
80
|
+
if field in data:
|
81
|
+
if isinstance(data[field], str):
|
82
|
+
data[field] = data[field].lower() in ['true', '1', 'yes', 'on']
|
83
|
+
|
84
|
+
return data
|
85
|
+
|
86
|
+
@model_validator(mode='after')
|
87
|
+
def validate_search_query(self) -> 'GrepAppArguments':
|
88
|
+
"""Validate search query is not empty and has reasonable length"""
|
89
|
+
if not self.search_query or not self.search_query.strip():
|
90
|
+
raise ValueError("Search query cannot be empty")
|
91
|
+
if len(self.search_query) > 500: # Reasonable limit for search query
|
92
|
+
raise ValueError("Search query is too long (max 500 characters)")
|
93
|
+
return self
|
94
|
+
|
95
|
+
class GrepAppTool(Tool):
|
96
|
+
"""Tool for searching GitHub code via grep.app API"""
|
97
|
+
|
98
|
+
BASE_URL: ClassVar[str] = "https://grep.app/api/search"
|
99
|
+
TIMEOUT: ClassVar[int] = 10
|
100
|
+
|
101
|
+
def __init__(self):
|
102
|
+
super().__init__(
|
103
|
+
name="grep_app_tool",
|
104
|
+
description="Searches GitHub code using grep.app API. Returns code matches with metadata."
|
105
|
+
)
|
106
|
+
self.arguments = [
|
107
|
+
ToolArgument(
|
108
|
+
name="search_query",
|
109
|
+
arg_type="string",
|
110
|
+
description="Search query using grep.app syntax",
|
111
|
+
required=True
|
112
|
+
),
|
113
|
+
ToolArgument(
|
114
|
+
name="repository",
|
115
|
+
arg_type="string",
|
116
|
+
description="Filter by repository",
|
117
|
+
required=False
|
118
|
+
),
|
119
|
+
ToolArgument(
|
120
|
+
name="page",
|
121
|
+
arg_type="int",
|
122
|
+
description="Pagination page number",
|
123
|
+
default="1",
|
124
|
+
required=False
|
125
|
+
),
|
126
|
+
ToolArgument(
|
127
|
+
name="per_page",
|
128
|
+
arg_type="int",
|
129
|
+
description="Results per page",
|
130
|
+
default="10",
|
131
|
+
required=False
|
132
|
+
),
|
133
|
+
ToolArgument(
|
134
|
+
name="regexp",
|
135
|
+
arg_type="boolean",
|
136
|
+
description="Enable regular expression search",
|
137
|
+
default="False",
|
138
|
+
required=False
|
139
|
+
),
|
140
|
+
ToolArgument(
|
141
|
+
name="case",
|
142
|
+
arg_type="boolean",
|
143
|
+
description="Enable case-sensitive search",
|
144
|
+
default="False",
|
145
|
+
required=False
|
146
|
+
),
|
147
|
+
ToolArgument(
|
148
|
+
name="words",
|
149
|
+
arg_type="boolean",
|
150
|
+
description="Match whole words only",
|
151
|
+
default="False",
|
152
|
+
required=False
|
153
|
+
)
|
154
|
+
]
|
155
|
+
|
156
|
+
def _build_headers(self) -> Dict[str, str]:
|
157
|
+
"""Build request headers with random User-Agent"""
|
158
|
+
headers = {
|
159
|
+
"User-Agent": random.choice(USER_AGENTS),
|
160
|
+
"Accept": "application/json",
|
161
|
+
"Accept-Language": "en-US,en;q=0.5",
|
162
|
+
"DNT": "1"
|
163
|
+
}
|
164
|
+
logger.debug(f"Built headers: {headers}")
|
165
|
+
return headers
|
166
|
+
|
167
|
+
def _build_params(self, args: GrepAppArguments) -> Dict[str, Any]:
|
168
|
+
"""Build request parameters from arguments"""
|
169
|
+
params = {
|
170
|
+
"q": args.search_query,
|
171
|
+
"page": args.page,
|
172
|
+
"per_page": args.per_page
|
173
|
+
}
|
174
|
+
if args.repository:
|
175
|
+
params["filter[repo][0]"] = args.repository
|
176
|
+
if args.regexp:
|
177
|
+
params["regexp"] = "true"
|
178
|
+
if args.case:
|
179
|
+
params["case"] = "true"
|
180
|
+
if args.words:
|
181
|
+
params["words"] = "true"
|
182
|
+
logger.debug(f"Built params: {params}")
|
183
|
+
return params
|
184
|
+
|
185
|
+
def _make_request(self, params: Dict[str, Any], headers: Dict[str, str]) -> Dict[str, Any]:
|
186
|
+
"""Make the API request"""
|
187
|
+
logger.info("Making API request to grep.app")
|
188
|
+
response = requests.get(
|
189
|
+
self.BASE_URL,
|
190
|
+
params=params,
|
191
|
+
headers=headers,
|
192
|
+
timeout=self.TIMEOUT
|
193
|
+
)
|
194
|
+
logger.debug(f"API Response Status Code: {response.status_code}")
|
195
|
+
response.raise_for_status()
|
196
|
+
data = response.json()
|
197
|
+
if not isinstance(data, dict):
|
198
|
+
raise SearchError("Invalid response format from API")
|
199
|
+
logger.debug(f"API Response Data: {data}")
|
200
|
+
return data
|
201
|
+
|
202
|
+
def execute(self,
|
203
|
+
search_query: str,
|
204
|
+
repository: Optional[str] = None,
|
205
|
+
page: Union[int, str] = 1,
|
206
|
+
per_page: Union[int, str] = 10,
|
207
|
+
regexp: bool = False,
|
208
|
+
case: bool = False,
|
209
|
+
words: bool = False,
|
210
|
+
skip_delay: bool = False) -> str:
|
211
|
+
"""Execute grep.app API search with pagination and return formatted results as a string"""
|
212
|
+
try:
|
213
|
+
# Validate and convert arguments
|
214
|
+
args = GrepAppArguments(
|
215
|
+
search_query=search_query,
|
216
|
+
repository=repository,
|
217
|
+
page=int(page),
|
218
|
+
per_page=int(per_page),
|
219
|
+
regexp=regexp,
|
220
|
+
case=case,
|
221
|
+
words=words
|
222
|
+
)
|
223
|
+
|
224
|
+
logger.info(f"Executing search: '{args.search_query}'")
|
225
|
+
logger.debug(f"Search parameters: {args.model_dump()}")
|
226
|
+
|
227
|
+
# Add random delay to mimic human behavior (unless skipped for testing)
|
228
|
+
if not skip_delay:
|
229
|
+
delay = random.uniform(0.5, 1.5)
|
230
|
+
logger.debug(f"Sleeping for {delay:.2f} seconds to mimic human behavior")
|
231
|
+
time.sleep(delay)
|
232
|
+
|
233
|
+
# Make API request
|
234
|
+
headers = self._build_headers()
|
235
|
+
params = self._build_params(args)
|
236
|
+
results = self._make_request(params, headers)
|
237
|
+
|
238
|
+
# Format and return results
|
239
|
+
return self._format_results(results)
|
240
|
+
|
241
|
+
except ValidationError as e:
|
242
|
+
logger.error(f"Validation error: {e}")
|
243
|
+
return self._format_error("Validation Error", str(e))
|
244
|
+
except requests.RequestException as e:
|
245
|
+
logger.error(f"API request failed: {e}")
|
246
|
+
return self._format_error(
|
247
|
+
"API Error",
|
248
|
+
str(e),
|
249
|
+
{"Request URL": getattr(e.response, 'url', 'N/A') if hasattr(e, 'response') else 'N/A'}
|
250
|
+
)
|
251
|
+
except SearchError as e:
|
252
|
+
logger.error(f"Search error: {e}")
|
253
|
+
return self._format_error("Search Error", str(e))
|
254
|
+
except Exception as e:
|
255
|
+
logger.error(f"Unexpected error: {e}")
|
256
|
+
return self._format_error("Unexpected Error", str(e))
|
257
|
+
|
258
|
+
def _format_results(self, data: Dict[str, Any]) -> str:
|
259
|
+
"""Format API results into a structured Markdown string"""
|
260
|
+
query = data.get('query', '')
|
261
|
+
total_results = data.get('hits', {}).get('total', 0)
|
262
|
+
hits = data.get("hits", {}).get("hits", [])
|
263
|
+
|
264
|
+
output = [
|
265
|
+
"# 🔍 Search Results",
|
266
|
+
"",
|
267
|
+
f"**Query:** `{query if query else '<empty>'}` • **Found:** {total_results} matches",
|
268
|
+
""
|
269
|
+
]
|
270
|
+
|
271
|
+
if not hits:
|
272
|
+
output.append("> No matches found for your search query.")
|
273
|
+
else:
|
274
|
+
for idx, result in enumerate(hits, 1):
|
275
|
+
repo = result.get('repo', {}).get('raw', 'N/A')
|
276
|
+
file_path = result.get('path', {}).get('raw', 'N/A')
|
277
|
+
language = result.get('language', 'N/A').lower()
|
278
|
+
content = result.get("content", {})
|
279
|
+
|
280
|
+
# Extract the actual code and line info
|
281
|
+
snippet = content.get("snippet", "")
|
282
|
+
line_num = content.get("line", "")
|
283
|
+
|
284
|
+
# Clean up the snippet
|
285
|
+
import re
|
286
|
+
clean_snippet = re.sub(r'<[^>]+>', '', snippet)
|
287
|
+
clean_snippet = re.sub(r'"', '"', clean_snippet)
|
288
|
+
clean_snippet = re.sub(r'<', '<', clean_snippet)
|
289
|
+
clean_snippet = re.sub(r'>', '>', clean_snippet)
|
290
|
+
clean_snippet = clean_snippet.strip()
|
291
|
+
|
292
|
+
# Split into lines and clean each line
|
293
|
+
raw_lines = clean_snippet.split('\n')
|
294
|
+
lines = []
|
295
|
+
current_line_num = int(line_num) if line_num else 1
|
296
|
+
|
297
|
+
# First pass: collect all lines and their content
|
298
|
+
for line in raw_lines:
|
299
|
+
# Remove excess whitespace but preserve indentation
|
300
|
+
stripped = line.rstrip()
|
301
|
+
if not stripped:
|
302
|
+
lines.append(('', current_line_num))
|
303
|
+
current_line_num += 1
|
304
|
+
continue
|
305
|
+
|
306
|
+
# Remove duplicate indentation
|
307
|
+
if stripped.startswith(' '):
|
308
|
+
stripped = stripped[4:]
|
309
|
+
|
310
|
+
# Handle URLs that might be split across lines
|
311
|
+
if stripped.startswith(('prompt', '-working')):
|
312
|
+
if lines and lines[-1][0].endswith('/'):
|
313
|
+
# Combine with previous line
|
314
|
+
prev_content, prev_num = lines.pop()
|
315
|
+
lines.append((prev_content + stripped, prev_num))
|
316
|
+
continue
|
317
|
+
|
318
|
+
# Handle concatenated lines by looking for line numbers
|
319
|
+
line_parts = re.split(r'(\d+)(?=\s*[^\d])', stripped)
|
320
|
+
if len(line_parts) > 1:
|
321
|
+
# Process each part that might be a new line
|
322
|
+
for i in range(0, len(line_parts)-1, 2):
|
323
|
+
prefix = line_parts[i].rstrip()
|
324
|
+
if prefix:
|
325
|
+
if not any(l[0] == prefix for l in lines): # Avoid duplicates
|
326
|
+
lines.append((prefix, current_line_num))
|
327
|
+
|
328
|
+
# Update line number if found
|
329
|
+
try:
|
330
|
+
current_line_num = int(line_parts[i+1])
|
331
|
+
except ValueError:
|
332
|
+
current_line_num += 1
|
333
|
+
|
334
|
+
# Add the content after the line number
|
335
|
+
if i+2 < len(line_parts):
|
336
|
+
content = line_parts[i+2].lstrip()
|
337
|
+
if content and not any(l[0] == content for l in lines): # Avoid duplicates
|
338
|
+
lines.append((content, current_line_num))
|
339
|
+
else:
|
340
|
+
if not any(l[0] == stripped for l in lines): # Avoid duplicates
|
341
|
+
lines.append((stripped, current_line_num))
|
342
|
+
current_line_num += 1
|
343
|
+
|
344
|
+
# Format line numbers and code
|
345
|
+
formatted_lines = []
|
346
|
+
max_line_width = len(str(max(line[1] for line in lines))) if lines else 3
|
347
|
+
|
348
|
+
# Second pass: format each line
|
349
|
+
for line_content, line_no in lines:
|
350
|
+
if not line_content: # Empty line
|
351
|
+
formatted_lines.append('')
|
352
|
+
continue
|
353
|
+
|
354
|
+
# Special handling for markdown badges and links
|
355
|
+
if '[![' in line_content or '[!' in line_content:
|
356
|
+
badges = re.findall(r'(\[!\[.*?\]\(.*?\)\]\(.*?\))', line_content)
|
357
|
+
if badges:
|
358
|
+
for badge in badges:
|
359
|
+
if not any(badge in l for l in formatted_lines): # Avoid duplicates
|
360
|
+
formatted_lines.append(f"{str(line_no).rjust(max_line_width)} │ {badge}")
|
361
|
+
continue
|
362
|
+
|
363
|
+
# Add syntax highlighting for comments
|
364
|
+
if line_content.lstrip().startswith(('// ', '# ', '/* ', '* ', '*/')):
|
365
|
+
line_str = f"{str(line_no).rjust(max_line_width)} │ <dim>{line_content}</dim>"
|
366
|
+
if not any(line_str in l for l in formatted_lines): # Avoid duplicates
|
367
|
+
formatted_lines.append(line_str)
|
368
|
+
else:
|
369
|
+
# Split line into indentation and content for better formatting
|
370
|
+
indent = len(line_content) - len(line_content.lstrip())
|
371
|
+
indentation = line_content[:indent]
|
372
|
+
content = line_content[indent:]
|
373
|
+
|
374
|
+
# Highlight strings and special syntax
|
375
|
+
content = re.sub(r'(["\'])(.*?)\1', r'<str>\1\2\1</str>', content)
|
376
|
+
content = re.sub(r'\b(function|const|let|var|import|export|class|interface|type|enum)\b',
|
377
|
+
r'<keyword>\1</keyword>', content)
|
378
|
+
|
379
|
+
line_str = f"{str(line_no).rjust(max_line_width)} │ {indentation}{content}"
|
380
|
+
if not any(line_str in l for l in formatted_lines): # Avoid duplicates
|
381
|
+
formatted_lines.append(line_str)
|
382
|
+
|
383
|
+
# Truncate if too long and add line count
|
384
|
+
if len(formatted_lines) > 5:
|
385
|
+
remaining = len(formatted_lines) - 5
|
386
|
+
formatted_lines = formatted_lines[:5]
|
387
|
+
if remaining > 0:
|
388
|
+
formatted_lines.append(f" ┆ {remaining} more line{'s' if remaining > 1 else ''}")
|
389
|
+
|
390
|
+
clean_snippet = '\n'.join(formatted_lines)
|
391
|
+
|
392
|
+
# Format the repository link to be clickable
|
393
|
+
if '/' in repo:
|
394
|
+
repo_link = f"[`{repo}`](https://github.com/{repo})"
|
395
|
+
else:
|
396
|
+
repo_link = f"`{repo}`"
|
397
|
+
|
398
|
+
# Determine the best language display and icon
|
399
|
+
lang_display = language if language != 'n/a' else ''
|
400
|
+
lang_icon = {
|
401
|
+
'python': '🐍',
|
402
|
+
'typescript': '📘',
|
403
|
+
'javascript': '📒',
|
404
|
+
'markdown': '📝',
|
405
|
+
'toml': '⚙️',
|
406
|
+
'yaml': '📋',
|
407
|
+
'json': '📦',
|
408
|
+
'shell': '🐚',
|
409
|
+
'rust': '🦀',
|
410
|
+
'go': '🔵',
|
411
|
+
'java': '☕',
|
412
|
+
'ruby': '💎',
|
413
|
+
}.get(lang_display, '📄')
|
414
|
+
|
415
|
+
# Format file path with language icon and line info
|
416
|
+
file_info = [f"{lang_icon} `{file_path}`"]
|
417
|
+
if line_num:
|
418
|
+
file_info.append(f"Line {line_num}")
|
419
|
+
|
420
|
+
output.extend([
|
421
|
+
f"### {repo_link}",
|
422
|
+
" • ".join(file_info),
|
423
|
+
"```",
|
424
|
+
clean_snippet,
|
425
|
+
"```",
|
426
|
+
""
|
427
|
+
])
|
428
|
+
|
429
|
+
return "\n".join(filter(None, output))
|
430
|
+
|
431
|
+
def _format_error(self, error_type: str, message: str, additional_info: Dict[str, str] = None) -> str:
|
432
|
+
"""Format error messages consistently using Markdown"""
|
433
|
+
output = [
|
434
|
+
f"## {error_type}",
|
435
|
+
f"**Message:** {message}"
|
436
|
+
]
|
437
|
+
|
438
|
+
if additional_info:
|
439
|
+
output.append("**Additional Information:**")
|
440
|
+
for key, value in additional_info.items():
|
441
|
+
output.append(f"- **{key}:** {value}")
|
442
|
+
|
443
|
+
output.append(f"## End {error_type}")
|
444
|
+
return "\n\n".join(output)
|
445
|
+
|
446
|
+
if __name__ == "__main__":
|
447
|
+
# Configure logger
|
448
|
+
logger.remove() # Remove default handlers
|
449
|
+
logger.add(sys.stderr, level="INFO", format="<green>{time}</green> <level>{message}</level>")
|
450
|
+
|
451
|
+
logger.info("Starting GrepAppTool test cases")
|
452
|
+
tool = GrepAppTool()
|
453
|
+
|
454
|
+
test_cases = [
|
455
|
+
{
|
456
|
+
"name": "Python __init__ Methods Search",
|
457
|
+
"args": {
|
458
|
+
"search_query": "lang:python def __init__",
|
459
|
+
"per_page": 5,
|
460
|
+
"skip_delay": True # Skip delay for testing
|
461
|
+
}
|
462
|
+
},
|
463
|
+
{
|
464
|
+
"name": "Logging Patterns Search",
|
465
|
+
"args": {
|
466
|
+
"search_query": "logger",
|
467
|
+
"per_page": 3,
|
468
|
+
"skip_delay": True
|
469
|
+
}
|
470
|
+
},
|
471
|
+
{
|
472
|
+
"name": "Repository-Specific Search",
|
473
|
+
"args": {
|
474
|
+
"search_query": "def",
|
475
|
+
"repository": "quantalogic/quantalogic",
|
476
|
+
"per_page": 5,
|
477
|
+
"words": True,
|
478
|
+
"skip_delay": True
|
479
|
+
}
|
480
|
+
},
|
481
|
+
{
|
482
|
+
"name": "Raphaël MANSUY",
|
483
|
+
"args": {
|
484
|
+
"search_query": "raphaelmansuy",
|
485
|
+
"per_page": 3,
|
486
|
+
"skip_delay": True
|
487
|
+
}
|
488
|
+
}
|
489
|
+
]
|
490
|
+
|
491
|
+
for test in test_cases:
|
492
|
+
try:
|
493
|
+
logger.info(f"Running test: {test['name']}")
|
494
|
+
logger.info(f"Executing with arguments: {test['args']}")
|
495
|
+
result = tool.execute(**test['args'])
|
496
|
+
print(f"\n### Test: {test['name']}\n{result}\n")
|
497
|
+
time.sleep(1) # Add a small delay between tests to avoid rate limiting
|
498
|
+
except Exception as e:
|
499
|
+
logger.error(f"{test['name']} Failed: {e}", exc_info=True)
|