auto-coder 0.1.353__tar.gz → 0.1.355__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.
Potentially problematic release.
This version of auto-coder might be problematic. Click here for more details.
- {auto_coder-0.1.353 → auto_coder-0.1.355}/PKG-INFO +1 -1
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/auto_coder.egg-info/PKG-INFO +1 -1
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/auto_coder.egg-info/SOURCES.txt +15 -4
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/agentic_filter.py +1 -1
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/auto_coder.py +8 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/auto_coder_rag.py +37 -1
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/auto_coder_runner.py +58 -77
- auto_coder-0.1.355/src/autocoder/chat/conf_command.py +270 -0
- auto_coder-0.1.355/src/autocoder/chat/models_command.py +485 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/chat_auto_coder.py +29 -24
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/chat_auto_coder_lang.py +26 -2
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/commands/auto_command.py +60 -132
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/commands/auto_web.py +1 -1
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/commands/tools.py +1 -1
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/__init__.py +3 -1
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/command_completer.py +58 -12
- auto_coder-0.1.355/src/autocoder/common/command_completer_v2.py +576 -0
- auto_coder-0.1.355/src/autocoder/common/conversations/__init__.py +52 -0
- auto_coder-0.1.355/src/autocoder/common/conversations/compatibility.py +303 -0
- auto_coder-0.1.355/src/autocoder/common/conversations/conversation_manager.py +502 -0
- auto_coder-0.1.355/src/autocoder/common/conversations/example.py +152 -0
- auto_coder-0.1.355/src/autocoder/common/file_monitor/__init__.py +5 -0
- auto_coder-0.1.355/src/autocoder/common/file_monitor/monitor.py +383 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/global_cancel.py +53 -16
- {auto_coder-0.1.353/src/autocoder → auto_coder-0.1.355/src/autocoder/common}/ignorefiles/ignore_file_utils.py +40 -0
- {auto_coder-0.1.353/src/autocoder → auto_coder-0.1.355/src/autocoder/common}/ignorefiles/test_ignore_file_utils.py +1 -1
- auto_coder-0.1.355/src/autocoder/common/rulefiles/__init__.py +15 -0
- auto_coder-0.1.355/src/autocoder/common/rulefiles/autocoderrules_utils.py +173 -0
- auto_coder-0.1.355/src/autocoder/common/save_formatted_log.py +54 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit.py +10 -39
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/list_files_tool_resolver.py +1 -1
- auto_coder-0.1.355/src/autocoder/common/v2/agent/agentic_edit_tools/search_files_tool_resolver.py +134 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_agentic_editblock_manager.py +9 -9
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_diff_manager.py +2 -2
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_editblock_manager.py +31 -18
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_strict_diff_manager.py +3 -2
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/dispacher/actions/action.py +6 -6
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/dispacher/actions/plugins/action_regex_project.py +2 -2
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/events/event_manager_singleton.py +1 -1
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/index/index.py +3 -3
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/models.py +22 -9
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/api_server.py +14 -2
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/cache/local_byzer_storage_cache.py +1 -1
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/cache/local_duckdb_storage_cache.py +8 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/cache/simple_cache.py +63 -33
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/loaders/docx_loader.py +1 -1
- auto_coder-0.1.355/src/autocoder/rag/loaders/filter_utils.py +163 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/loaders/image_loader.py +15 -3
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/loaders/pdf_loader.py +2 -2
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/long_context_rag.py +11 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/qa_conversation_strategy.py +5 -31
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/utils.py +21 -2
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/_markitdown.py +66 -25
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/auto_coder_utils/chat_stream_out.py +4 -4
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/thread_utils.py +9 -27
- auto_coder-0.1.355/src/autocoder/version.py +1 -0
- auto_coder-0.1.353/src/autocoder/common/v2/agent/agentic_edit_conversation.py +0 -188
- auto_coder-0.1.353/src/autocoder/common/v2/agent/agentic_edit_tools/search_files_tool_resolver.py +0 -104
- auto_coder-0.1.353/src/autocoder/rag/loaders/filter_utils.py +0 -106
- auto_coder-0.1.353/src/autocoder/version.py +0 -1
- {auto_coder-0.1.353 → auto_coder-0.1.355}/LICENSE +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/README.md +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/setup.cfg +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/setup.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/auto_coder.egg-info/dependency_links.txt +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/auto_coder.egg-info/entry_points.txt +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/auto_coder.egg-info/requires.txt +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/auto_coder.egg-info/top_level.txt +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/auto_demand_organizer.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/auto_filegroup.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/auto_guess_query.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/auto_learn_from_commit.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/auto_review_commit.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/auto_tool.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/coder.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/designer.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/planner.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/agent/project_reader.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/auto_coder_server.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/benchmark.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/chat/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/command_args.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/command_parser.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/commands/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/JupyterClient.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/ShellClient.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/action_yml_file_manager.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/anything2images.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/anything2img.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/audio.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/auto_coder_lang.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/auto_configure.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/buildin_tokenizer.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/chunk_validation.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/cleaner.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/code_auto_execute.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/code_auto_generate.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/code_auto_generate_diff.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/code_auto_generate_editblock.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/code_auto_generate_strict_diff.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/code_auto_merge.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/code_auto_merge_diff.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/code_auto_merge_editblock.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/code_auto_merge_strict_diff.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/code_modification_ranker.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/command_generator.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/command_templates.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/computer_use.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/conf_import_export.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/conf_utils.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/conf_validator.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/const.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/context_pruner.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/conversation_pruner.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/files.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/git_utils.py +0 -0
- {auto_coder-0.1.353/src/autocoder → auto_coder-0.1.355/src/autocoder/common}/ignorefiles/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/image_to_page.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/index_import_export.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/interpreter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/llm_rerank.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/mcp_hub.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/mcp_server.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/mcp_server_install.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/mcp_server_types.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/mcp_servers/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/mcp_servers/mcp_server_gpt4o_mini_search.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/mcp_servers/mcp_server_perplexity.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/mcp_tools.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/memory_manager.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/model_speed_tester.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/openai_content.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/printer.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/recall_validation.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/result_manager.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/run_cmd.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/screenshots.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/search.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/search_replace.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/shells.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/stats_panel.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/stream_out_type.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/sys_prompt.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/test_run_cmd.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/text.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/token_cost_caculate.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/types.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/utils_code_auto_generate.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/ask_followup_question_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/attempt_completion_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/base_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/execute_command_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/list_code_definition_names_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/list_package_info_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/plan_mode_respond_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/read_file_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/replace_in_file_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/test_search_files_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/use_mcp_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_tools/write_to_file_tool_resolver.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_edit_types.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/agent/agentic_tool_display.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_auto_generate.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_auto_generate_diff.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_auto_generate_editblock.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_auto_generate_strict_diff.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_auto_merge.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_auto_merge_diff.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_auto_merge_editblock.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_auto_merge_strict_diff.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/common/v2/code_manager.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/base_compiler.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/compiler_config_api.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/compiler_config_manager.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/compiler_factory.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/java_compiler.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/models.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/provided_compiler.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/python_compiler.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/reactjs_compiler.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/shadow_compiler.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/compilers/vue_compiler.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/data/byzerllm.md +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/data/tokenizer.json +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/db/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/db/store.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/dispacher/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/dispacher/actions/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/dispacher/actions/copilot.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/dispacher/actions/plugins/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/events/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/events/event_content.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/events/event_manager.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/events/event_store.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/events/event_types.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/helper/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/helper/project_creator.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/helper/rag_doc_creator.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/index/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/index/entry.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/index/filter/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/index/filter/normal_filter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/index/filter/quick_filter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/index/for_command.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/index/symbols_utils.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/index/types.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/lang.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/linters/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/linters/base_linter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/linters/linter_factory.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/linters/models.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/linters/python_linter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/linters/reactjs_linter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/linters/shadow_linter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/linters/vue_linter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/memory/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/memory/active_context_manager.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/memory/active_package.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/memory/async_processor.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/memory/directory_mapper.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/plugins/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/plugins/dynamic_completion_example.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/plugins/git_helper_plugin.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/plugins/sample_plugin.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/plugins/token_helper_plugin.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/plugins/utils.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/privacy/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/privacy/model_filter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/pyproject/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/cache/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/cache/base_cache.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/cache/byzer_storage_cache.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/cache/cache_result_merge.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/cache/failed_files_utils.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/cache/file_monitor_cache.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/cache/rag_file_meta.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/conversation_to_queries.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/doc_filter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/document_retriever.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/lang.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/llm_wrapper.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/loaders/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/loaders/excel_loader.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/loaders/ppt_loader.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/loaders/test_image_loader.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/rag_config.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/rag_entry.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/raw_rag.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/relevant_utils.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/searchable.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/simple_directory_reader.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/simple_rag.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/stream_event/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/stream_event/event_writer.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/stream_event/types.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/token_checker.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/token_counter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/token_limiter.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/token_limiter_utils.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/types.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/rag/variable_holder.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/regexproject/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/run_context.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/shadows/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/shadows/shadow_manager.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/suffixproject/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/tsproject/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/auto_coder_utils/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/auto_project_type.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/chat_auto_coder_utils/__init__.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/conversation_store.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/llm_client_interceptors.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/llms.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/log_capture.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/model_provider_selector.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/multi_turn.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/operate_config_api.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/print_table.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/project_structure.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/queue_communicate.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/request_event_queue.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/request_queue.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/rest.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/stream_thinking.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/tests.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/src/autocoder/utils/types.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/tests/test_action_regex_project.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/tests/test_action_yml_file_manager.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/tests/test_chat_auto_coder.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/tests/test_code_auto_merge_editblock.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/tests/test_command_completer.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/tests/test_planner.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/tests/test_plugins.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/tests/test_privacy.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/tests/test_queue_communicate.py +0 -0
- {auto_coder-0.1.353 → auto_coder-0.1.355}/tests/test_symbols_utils.py +0 -0
|
@@ -34,6 +34,8 @@ src/autocoder/agent/designer.py
|
|
|
34
34
|
src/autocoder/agent/planner.py
|
|
35
35
|
src/autocoder/agent/project_reader.py
|
|
36
36
|
src/autocoder/chat/__init__.py
|
|
37
|
+
src/autocoder/chat/conf_command.py
|
|
38
|
+
src/autocoder/chat/models_command.py
|
|
37
39
|
src/autocoder/commands/__init__.py
|
|
38
40
|
src/autocoder/commands/auto_command.py
|
|
39
41
|
src/autocoder/commands/auto_web.py
|
|
@@ -61,6 +63,7 @@ src/autocoder/common/code_auto_merge_editblock.py
|
|
|
61
63
|
src/autocoder/common/code_auto_merge_strict_diff.py
|
|
62
64
|
src/autocoder/common/code_modification_ranker.py
|
|
63
65
|
src/autocoder/common/command_completer.py
|
|
66
|
+
src/autocoder/common/command_completer_v2.py
|
|
64
67
|
src/autocoder/common/command_generator.py
|
|
65
68
|
src/autocoder/common/command_templates.py
|
|
66
69
|
src/autocoder/common/computer_use.py
|
|
@@ -89,6 +92,7 @@ src/autocoder/common/printer.py
|
|
|
89
92
|
src/autocoder/common/recall_validation.py
|
|
90
93
|
src/autocoder/common/result_manager.py
|
|
91
94
|
src/autocoder/common/run_cmd.py
|
|
95
|
+
src/autocoder/common/save_formatted_log.py
|
|
92
96
|
src/autocoder/common/screenshots.py
|
|
93
97
|
src/autocoder/common/search.py
|
|
94
98
|
src/autocoder/common/search_replace.py
|
|
@@ -101,9 +105,20 @@ src/autocoder/common/text.py
|
|
|
101
105
|
src/autocoder/common/token_cost_caculate.py
|
|
102
106
|
src/autocoder/common/types.py
|
|
103
107
|
src/autocoder/common/utils_code_auto_generate.py
|
|
108
|
+
src/autocoder/common/conversations/__init__.py
|
|
109
|
+
src/autocoder/common/conversations/compatibility.py
|
|
110
|
+
src/autocoder/common/conversations/conversation_manager.py
|
|
111
|
+
src/autocoder/common/conversations/example.py
|
|
112
|
+
src/autocoder/common/file_monitor/__init__.py
|
|
113
|
+
src/autocoder/common/file_monitor/monitor.py
|
|
114
|
+
src/autocoder/common/ignorefiles/__init__.py
|
|
115
|
+
src/autocoder/common/ignorefiles/ignore_file_utils.py
|
|
116
|
+
src/autocoder/common/ignorefiles/test_ignore_file_utils.py
|
|
104
117
|
src/autocoder/common/mcp_servers/__init__.py
|
|
105
118
|
src/autocoder/common/mcp_servers/mcp_server_gpt4o_mini_search.py
|
|
106
119
|
src/autocoder/common/mcp_servers/mcp_server_perplexity.py
|
|
120
|
+
src/autocoder/common/rulefiles/__init__.py
|
|
121
|
+
src/autocoder/common/rulefiles/autocoderrules_utils.py
|
|
107
122
|
src/autocoder/common/v2/__init__.py
|
|
108
123
|
src/autocoder/common/v2/code_agentic_editblock_manager.py
|
|
109
124
|
src/autocoder/common/v2/code_auto_generate.py
|
|
@@ -120,7 +135,6 @@ src/autocoder/common/v2/code_manager.py
|
|
|
120
135
|
src/autocoder/common/v2/code_strict_diff_manager.py
|
|
121
136
|
src/autocoder/common/v2/agent/__init__.py
|
|
122
137
|
src/autocoder/common/v2/agent/agentic_edit.py
|
|
123
|
-
src/autocoder/common/v2/agent/agentic_edit_conversation.py
|
|
124
138
|
src/autocoder/common/v2/agent/agentic_edit_types.py
|
|
125
139
|
src/autocoder/common/v2/agent/agentic_tool_display.py
|
|
126
140
|
src/autocoder/common/v2/agent/agentic_edit_tools/__init__.py
|
|
@@ -169,9 +183,6 @@ src/autocoder/events/event_types.py
|
|
|
169
183
|
src/autocoder/helper/__init__.py
|
|
170
184
|
src/autocoder/helper/project_creator.py
|
|
171
185
|
src/autocoder/helper/rag_doc_creator.py
|
|
172
|
-
src/autocoder/ignorefiles/__init__.py
|
|
173
|
-
src/autocoder/ignorefiles/ignore_file_utils.py
|
|
174
|
-
src/autocoder/ignorefiles/test_ignore_file_utils.py
|
|
175
186
|
src/autocoder/index/__init__.py
|
|
176
187
|
src/autocoder/index/entry.py
|
|
177
188
|
src/autocoder/index/for_command.py
|
|
@@ -676,7 +676,7 @@ class AgenticFilter:
|
|
|
676
676
|
)
|
|
677
677
|
|
|
678
678
|
while True:
|
|
679
|
-
global_cancel.check_and_raise()
|
|
679
|
+
global_cancel.check_and_raise(token=self.args.event_file)
|
|
680
680
|
# print(json.dumps(conversations, ensure_ascii=False, indent=4))
|
|
681
681
|
model_name = ",".join(llms_utils.get_llm_names(self.llm))
|
|
682
682
|
start_time = time.monotonic()
|
|
@@ -184,6 +184,14 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
184
184
|
f.write("\n/actions/")
|
|
185
185
|
f.write("\n/output.txt")
|
|
186
186
|
|
|
187
|
+
# 生成 .autocoderignore 文件,采用 .gitignore 格式
|
|
188
|
+
autocoderignore_path = os.path.join(source_dir, ".autocoderignore")
|
|
189
|
+
autocoderignore_content = (
|
|
190
|
+
"target\n"
|
|
191
|
+
)
|
|
192
|
+
with open(autocoderignore_path, "w", encoding="utf-8") as f:
|
|
193
|
+
f.write(autocoderignore_content)
|
|
194
|
+
|
|
187
195
|
print(
|
|
188
196
|
f"""Successfully initialized auto-coder project in {os.path.abspath(args.source_dir)}."""
|
|
189
197
|
)
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
logging.getLogger("ppocr").setLevel(logging.WARNING)
|
|
3
|
+
|
|
1
4
|
import argparse
|
|
2
5
|
from typing import Optional, List
|
|
3
6
|
import byzerllm
|
|
@@ -19,8 +22,11 @@ from rich.table import Table
|
|
|
19
22
|
import os
|
|
20
23
|
import hashlib
|
|
21
24
|
from loguru import logger
|
|
25
|
+
import sys
|
|
22
26
|
import asyncio
|
|
23
27
|
from datetime import datetime
|
|
28
|
+
from autocoder.common.file_monitor.monitor import FileMonitor
|
|
29
|
+
from autocoder.common.rulefiles.autocoderrules_utils import get_rules
|
|
24
30
|
|
|
25
31
|
from autocoder.rag.utils import process_file_local
|
|
26
32
|
import pkg_resources
|
|
@@ -567,6 +573,7 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
567
573
|
# Generate unique name for RAG build if doc_dir exists
|
|
568
574
|
if server_args.doc_dir:
|
|
569
575
|
auto_coder_args.rag_build_name = generate_unique_name_from_path(server_args.doc_dir)
|
|
576
|
+
auto_coder_args.source_dir = server_args.doc_dir
|
|
570
577
|
logger.info(f"Generated RAG build name: {auto_coder_args.rag_build_name}")
|
|
571
578
|
|
|
572
579
|
if auto_coder_args.enable_hybrid_index and args.product_mode == "pro":
|
|
@@ -741,9 +748,38 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
741
748
|
service_info.save()
|
|
742
749
|
except Exception as e:
|
|
743
750
|
logger.warning(f"Failed to save service info: {str(e)}")
|
|
751
|
+
|
|
752
|
+
# Start FileMonitor if monitor_mode is enabled and source_dir is provided
|
|
753
|
+
if server_args.doc_dir:
|
|
754
|
+
try:
|
|
755
|
+
# Use singleton pattern to get/create monitor instance
|
|
756
|
+
# FileMonitor ensures only one instance runs per root_dir
|
|
757
|
+
monitor = FileMonitor(server_args.doc_dir)
|
|
758
|
+
if not monitor.is_running():
|
|
759
|
+
# TODO: Register specific callbacks here if needed in the future
|
|
760
|
+
# Example: monitor.register(os.path.join(args.source_dir, "specific_file.py"), my_callback)
|
|
761
|
+
monitor.start()
|
|
762
|
+
logger.info(f"File monitor started for directory: {server_args.doc_dir}")
|
|
763
|
+
else:
|
|
764
|
+
# Log if monitor was already running (e.g., started by another part of the app)
|
|
765
|
+
# Check if the existing monitor's root matches the current request
|
|
766
|
+
if monitor.root_dir == os.path.abspath(server_args.doc_dir):
|
|
767
|
+
logger.info(f"File monitor already running for directory: {monitor.root_dir}")
|
|
768
|
+
else:
|
|
769
|
+
logger.warning(f"File monitor is running for a different directory ({monitor.root_dir}), cannot start a new one for {args.source_dir}.")
|
|
770
|
+
|
|
771
|
+
logger.info(f"Getting rules for {server_args.doc_dir}")
|
|
772
|
+
_ = get_rules(server_args.doc_dir)
|
|
773
|
+
|
|
774
|
+
except ValueError as ve: # Catch specific error if root_dir is invalid during init
|
|
775
|
+
logger.error(f"Failed to initialize file monitor for {args.source_dir}: {ve}")
|
|
776
|
+
except ImportError as ie: # Catch if watchfiles is not installed
|
|
777
|
+
logger.error(f"Failed to start file monitor: {ie}")
|
|
778
|
+
except Exception as e:
|
|
779
|
+
logger.error(f"An unexpected error occurred while starting file monitor for {args.source_dir}: {e}")
|
|
744
780
|
|
|
745
781
|
serve(llm=llm_wrapper, args=server_args)
|
|
746
|
-
elif args.command == "build_hybrid_index":
|
|
782
|
+
elif args.command == "build_hybrid_index":
|
|
747
783
|
auto_coder_args = AutoCoderArgs(
|
|
748
784
|
**{
|
|
749
785
|
arg: getattr(args, arg)
|
|
@@ -34,7 +34,7 @@ from rich.console import Console
|
|
|
34
34
|
from rich.panel import Panel
|
|
35
35
|
from rich.table import Table
|
|
36
36
|
from rich.live import Live
|
|
37
|
-
|
|
37
|
+
# Removed Text import as it's only used in the deleted print_conf
|
|
38
38
|
from rich.live import Live
|
|
39
39
|
from rich.markdown import Markdown
|
|
40
40
|
from byzerllm.utils.nontext import Image
|
|
@@ -53,6 +53,7 @@ from autocoder.common.memory_manager import get_global_memory_file_paths
|
|
|
53
53
|
from autocoder import models as models_module
|
|
54
54
|
import shlex
|
|
55
55
|
from autocoder.utils.llms import get_single_llm
|
|
56
|
+
import fnmatch
|
|
56
57
|
import pkg_resources
|
|
57
58
|
from autocoder.common.printer import Printer
|
|
58
59
|
from autocoder.utils.thread_utils import run_in_raw_thread
|
|
@@ -63,6 +64,7 @@ from autocoder import command_parser as CommandParser
|
|
|
63
64
|
from loguru import logger as global_logger
|
|
64
65
|
from autocoder.utils.project_structure import EnhancedFileAnalyzer
|
|
65
66
|
from autocoder.common import SourceCodeList,SourceCode
|
|
67
|
+
from autocoder.common.file_monitor import FileMonitor
|
|
66
68
|
|
|
67
69
|
|
|
68
70
|
## 对外API,用于第三方集成 auto-coder 使用。
|
|
@@ -96,6 +98,7 @@ memory = {
|
|
|
96
98
|
|
|
97
99
|
project_root = os.getcwd()
|
|
98
100
|
|
|
101
|
+
|
|
99
102
|
base_persist_dir = os.path.join(project_root,".auto-coder", "plugins", "chat-auto-coder")
|
|
100
103
|
|
|
101
104
|
defaut_exclude_dirs = [".git", "node_modules", "dist", "build", "__pycache__",".auto-coder"]
|
|
@@ -255,6 +258,12 @@ def configure_logger():
|
|
|
255
258
|
|
|
256
259
|
configure_logger()
|
|
257
260
|
|
|
261
|
+
try:
|
|
262
|
+
FileMonitor(project_root).start()
|
|
263
|
+
except Exception as e:
|
|
264
|
+
global_logger.error(f"Failed to start file monitor: {e}")
|
|
265
|
+
global_logger.exception(e)
|
|
266
|
+
|
|
258
267
|
def initialize_system(args:InitializeSystemRequest):
|
|
259
268
|
from autocoder.utils.model_provider_selector import ModelProviderSelector
|
|
260
269
|
from autocoder import models as models_module
|
|
@@ -533,7 +542,7 @@ def find_files_in_project(patterns: List[str]) -> List[str]:
|
|
|
533
542
|
def convert_config_value(key, value):
|
|
534
543
|
field_info = AutoCoderArgs.model_fields.get(key)
|
|
535
544
|
if field_info:
|
|
536
|
-
if value.lower() in ["true", "false"]:
|
|
545
|
+
if isinstance(value, str) and value.lower() in ["true", "false"]:
|
|
537
546
|
return value.lower() == "true"
|
|
538
547
|
elif "int" in str(field_info.annotation):
|
|
539
548
|
return int(value)
|
|
@@ -644,15 +653,15 @@ def load_memory():
|
|
|
644
653
|
_memory = json.load(f)
|
|
645
654
|
# clear memory
|
|
646
655
|
memory.clear()
|
|
647
|
-
memory.update(_memory)
|
|
648
|
-
completer.update_current_files(memory["current_files"]["files"])
|
|
656
|
+
memory.update(_memory)
|
|
649
657
|
return memory
|
|
650
658
|
|
|
651
659
|
def get_memory():
|
|
652
660
|
return load_memory()
|
|
653
661
|
|
|
654
662
|
|
|
655
|
-
|
|
663
|
+
from autocoder.common.command_completer_v2 import CommandCompleterV2
|
|
664
|
+
completer = CommandCompleterV2(commands,
|
|
656
665
|
file_system_model=CCFileSystemModel(project_root=project_root,
|
|
657
666
|
defaut_exclude_dirs=defaut_exclude_dirs,
|
|
658
667
|
get_all_file_names_in_project=get_all_file_names_in_project,
|
|
@@ -661,57 +670,8 @@ completer = CommandCompleter(commands,
|
|
|
661
670
|
get_all_file_in_project_with_dot=get_all_file_in_project_with_dot,
|
|
662
671
|
get_symbol_list=get_symbol_list
|
|
663
672
|
),
|
|
664
|
-
memory_model=CCMemoryModel(
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
def print_conf(content:Dict[str,Any]):
|
|
671
|
-
"""Display configuration dictionary in a Rich table format with enhanced visual styling.
|
|
672
|
-
|
|
673
|
-
Args:
|
|
674
|
-
conf (Dict[str, Any]): Configuration dictionary to display
|
|
675
|
-
"""
|
|
676
|
-
console = Console()
|
|
677
|
-
|
|
678
|
-
# Create a styled table with rounded borders
|
|
679
|
-
table = Table(
|
|
680
|
-
show_header=True,
|
|
681
|
-
header_style="bold magenta",
|
|
682
|
-
title=get_message("conf_title"),
|
|
683
|
-
title_style="bold blue",
|
|
684
|
-
border_style="blue",
|
|
685
|
-
show_lines=True
|
|
686
|
-
)
|
|
687
|
-
|
|
688
|
-
# Add columns with explicit width and alignment
|
|
689
|
-
table.add_column(get_message("conf_key"), style="cyan", justify="right", width=30, no_wrap=False)
|
|
690
|
-
table.add_column(get_message("conf_value"), style="green", justify="left", width=50, no_wrap=False)
|
|
691
|
-
|
|
692
|
-
# Sort keys for consistent display
|
|
693
|
-
for key in sorted(content.keys()):
|
|
694
|
-
value = content[key]
|
|
695
|
-
# Format value based on type
|
|
696
|
-
if isinstance(value, (dict, list)):
|
|
697
|
-
formatted_value = Text(json.dumps(value, indent=2), style="yellow")
|
|
698
|
-
elif isinstance(value, bool):
|
|
699
|
-
formatted_value = Text(str(value), style="bright_green" if value else "red")
|
|
700
|
-
elif isinstance(value, (int, float)):
|
|
701
|
-
formatted_value = Text(str(value), style="bright_cyan")
|
|
702
|
-
else:
|
|
703
|
-
formatted_value = Text(str(value), style="green")
|
|
704
|
-
|
|
705
|
-
table.add_row(str(key), formatted_value)
|
|
706
|
-
|
|
707
|
-
# Add padding and print with a panel
|
|
708
|
-
console.print(Panel(
|
|
709
|
-
table,
|
|
710
|
-
padding=(1, 2),
|
|
711
|
-
subtitle=f"[italic]{get_message('conf_subtitle')}[/italic]",
|
|
712
|
-
border_style="blue"
|
|
713
|
-
))
|
|
714
|
-
|
|
673
|
+
memory_model=CCMemoryModel(get_memory_func=get_memory,
|
|
674
|
+
save_memory_func=save_memory))
|
|
715
675
|
def revert():
|
|
716
676
|
result_manager = ResultManager()
|
|
717
677
|
last_yaml_file = get_last_yaml_file("actions")
|
|
@@ -1017,7 +977,6 @@ def add_files(args: List[str]):
|
|
|
1017
977
|
result_manager.append(content=f"No files matched.",
|
|
1018
978
|
meta={"action": "add_files","success":False, "input":{ "args": args}})
|
|
1019
979
|
|
|
1020
|
-
completer.update_current_files(memory["current_files"]["files"])
|
|
1021
980
|
save_memory()
|
|
1022
981
|
|
|
1023
982
|
|
|
@@ -1030,39 +989,61 @@ def remove_files(file_names: List[str]):
|
|
|
1030
989
|
memory["current_files"]["files"] = []
|
|
1031
990
|
memory["current_files"]["current_groups"] = []
|
|
1032
991
|
printer.print_in_terminal("remove_files_all", style="green")
|
|
1033
|
-
result_manager.append(content="All files removed.",
|
|
992
|
+
result_manager.append(content="All files removed.",
|
|
1034
993
|
meta={"action": "remove_files","success":True, "input":{ "file_names": file_names}})
|
|
1035
994
|
else:
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
995
|
+
files_to_remove = set()
|
|
996
|
+
current_files_abs = memory["current_files"]["files"]
|
|
997
|
+
|
|
998
|
+
for pattern in file_names:
|
|
999
|
+
pattern = pattern.strip() # Remove leading/trailing whitespace
|
|
1000
|
+
if not pattern:
|
|
1001
|
+
continue
|
|
1002
|
+
|
|
1003
|
+
is_wildcard = "*" in pattern or "?" in pattern
|
|
1004
|
+
|
|
1005
|
+
for file_path_abs in current_files_abs:
|
|
1006
|
+
relative_path = os.path.relpath(file_path_abs, project_root)
|
|
1007
|
+
basename = os.path.basename(file_path_abs)
|
|
1008
|
+
|
|
1009
|
+
matched = False
|
|
1010
|
+
if is_wildcard:
|
|
1011
|
+
# Match pattern against relative path or basename
|
|
1012
|
+
if fnmatch.fnmatch(relative_path, pattern) or fnmatch.fnmatch(basename, pattern):
|
|
1013
|
+
matched = True
|
|
1014
|
+
else:
|
|
1015
|
+
# Exact match against relative path, absolute path, or basename
|
|
1016
|
+
if relative_path == pattern or file_path_abs == pattern or basename == pattern:
|
|
1017
|
+
matched = True
|
|
1018
|
+
|
|
1019
|
+
if matched:
|
|
1020
|
+
files_to_remove.add(file_path_abs)
|
|
1021
|
+
|
|
1022
|
+
removed_files_list = list(files_to_remove)
|
|
1023
|
+
if removed_files_list:
|
|
1024
|
+
# Update memory by filtering out the files to remove
|
|
1025
|
+
memory["current_files"]["files"] = [
|
|
1026
|
+
f for f in current_files_abs if f not in files_to_remove
|
|
1027
|
+
]
|
|
1028
|
+
|
|
1029
|
+
table = Table(
|
|
1030
|
+
show_header=True,
|
|
1048
1031
|
header_style="bold magenta"
|
|
1049
1032
|
)
|
|
1050
|
-
table.add_column("
|
|
1051
|
-
for f in
|
|
1033
|
+
table.add_column(printer.get_message_from_key("file_column_title"), style="green")
|
|
1034
|
+
for f in removed_files_list:
|
|
1052
1035
|
table.add_row(os.path.relpath(f, project_root))
|
|
1053
1036
|
|
|
1054
1037
|
console = Console()
|
|
1055
1038
|
console.print(
|
|
1056
1039
|
Panel(table, border_style="green",
|
|
1057
|
-
title=printer.get_message_from_key("files_removed")))
|
|
1058
|
-
result_manager.append(content=f"Removed files: {', '.join(
|
|
1040
|
+
title=printer.get_message_from_key("files_removed")))
|
|
1041
|
+
result_manager.append(content=f"Removed files: {', '.join(removed_files_list)}",
|
|
1059
1042
|
meta={"action": "remove_files","success":True, "input":{ "file_names": file_names}})
|
|
1060
1043
|
else:
|
|
1061
1044
|
printer.print_in_terminal("remove_files_none", style="yellow")
|
|
1062
1045
|
result_manager.append(content=printer.get_message_from_key("remove_files_none"),
|
|
1063
|
-
meta={"action": "remove_files","success":False, "input":{ "file_names": file_names}})
|
|
1064
|
-
|
|
1065
|
-
completer.update_current_files(memory["current_files"]["files"])
|
|
1046
|
+
meta={"action": "remove_files","success":False, "input":{ "file_names": file_names}})
|
|
1066
1047
|
save_memory()
|
|
1067
1048
|
|
|
1068
1049
|
@run_in_raw_thread()
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
|
|
2
|
+
import os
|
|
3
|
+
import io
|
|
4
|
+
import contextlib
|
|
5
|
+
import fnmatch
|
|
6
|
+
import json
|
|
7
|
+
from typing import Dict, Any, List, Callable, Optional
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from rich.panel import Panel
|
|
10
|
+
from rich.table import Table
|
|
11
|
+
from rich.text import Text
|
|
12
|
+
from autocoder.auto_coder_runner import save_memory # Import save_memory
|
|
13
|
+
from autocoder.common.conf_validator import ConfigValidator
|
|
14
|
+
from autocoder.common.auto_coder_lang import get_message, get_message_with_format
|
|
15
|
+
|
|
16
|
+
# Helper function to print the configuration table (internal implementation)
|
|
17
|
+
def _print_conf_table(content: Dict[str, Any], title: str = "Configuration Settings"):
|
|
18
|
+
"""Display configuration dictionary in a Rich table format."""
|
|
19
|
+
console = Console(file=io.StringIO(), force_terminal=True, color_system="truecolor") # Capture output
|
|
20
|
+
|
|
21
|
+
# Create a styled table with rounded borders
|
|
22
|
+
table = Table(
|
|
23
|
+
show_header=True,
|
|
24
|
+
header_style="bold magenta",
|
|
25
|
+
title=title,
|
|
26
|
+
title_style="bold blue",
|
|
27
|
+
border_style="blue",
|
|
28
|
+
show_lines=True
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# Add columns with explicit width and alignment
|
|
32
|
+
table.add_column(get_message("conf_key"), style="cyan", justify="right", width=30, no_wrap=False)
|
|
33
|
+
table.add_column(get_message("conf_value"), style="green", justify="left", width=50, no_wrap=False)
|
|
34
|
+
|
|
35
|
+
# Sort keys for consistent display
|
|
36
|
+
for key in sorted(content.keys()):
|
|
37
|
+
value = content[key]
|
|
38
|
+
# Format value based on type
|
|
39
|
+
if isinstance(value, (dict, list)):
|
|
40
|
+
formatted_value = Text(json.dumps(value, indent=2), style="yellow")
|
|
41
|
+
elif isinstance(value, bool):
|
|
42
|
+
formatted_value = Text(str(value), style="bright_green" if value else "red")
|
|
43
|
+
elif isinstance(value, (int, float)):
|
|
44
|
+
formatted_value = Text(str(value), style="bright_cyan")
|
|
45
|
+
else:
|
|
46
|
+
formatted_value = Text(str(value), style="green")
|
|
47
|
+
|
|
48
|
+
table.add_row(str(key), formatted_value)
|
|
49
|
+
|
|
50
|
+
# Add padding and print with a panel
|
|
51
|
+
console.print(Panel(
|
|
52
|
+
table,
|
|
53
|
+
padding=(1, 2),
|
|
54
|
+
subtitle=f"[italic]{get_message('conf_subtitle')}[/italic]",
|
|
55
|
+
border_style="blue"
|
|
56
|
+
))
|
|
57
|
+
return console.file.getvalue() # Return captured string
|
|
58
|
+
|
|
59
|
+
# --- Command Handlers ---
|
|
60
|
+
|
|
61
|
+
def _handle_list_conf(memory: Dict[str, Any], args: List[str]) -> str:
|
|
62
|
+
"""Handles listing configuration settings, supports wildcard filtering."""
|
|
63
|
+
conf = memory.get("conf", {})
|
|
64
|
+
pattern = args[0] if args else "*" # Default to all if no pattern
|
|
65
|
+
|
|
66
|
+
if pattern == "*":
|
|
67
|
+
title = get_message("conf_title")
|
|
68
|
+
filtered_conf = conf
|
|
69
|
+
else:
|
|
70
|
+
title = f"Filtered Configuration (Pattern: {pattern})"
|
|
71
|
+
filtered_conf = {k: v for k, v in conf.items() if fnmatch.fnmatch(k, pattern)}
|
|
72
|
+
if not filtered_conf:
|
|
73
|
+
return f"No configuration keys found matching pattern: {pattern}"
|
|
74
|
+
|
|
75
|
+
if not filtered_conf and pattern == "*":
|
|
76
|
+
return "No configurations set."
|
|
77
|
+
|
|
78
|
+
return _print_conf_table(filtered_conf, title)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _handle_get_conf(memory: Dict[str, Any], args: List[str]) -> str:
|
|
82
|
+
"""Handles getting a specific configuration setting."""
|
|
83
|
+
if len(args) != 1:
|
|
84
|
+
return "Error: 'get' command requires exactly one argument (the key). Usage: /conf get <key>"
|
|
85
|
+
key = args[0]
|
|
86
|
+
conf = memory.get("conf", {})
|
|
87
|
+
value = conf.get(key)
|
|
88
|
+
if value is None:
|
|
89
|
+
return f"Error: Configuration key '{key}' not found."
|
|
90
|
+
else:
|
|
91
|
+
# Format value for better readability
|
|
92
|
+
if isinstance(value, (list, dict)):
|
|
93
|
+
formatted_value = json.dumps(value, indent=2)
|
|
94
|
+
else:
|
|
95
|
+
formatted_value = repr(value)
|
|
96
|
+
return f"{key}: {formatted_value}"
|
|
97
|
+
|
|
98
|
+
def _parse_value(value_str: str) -> Any:
|
|
99
|
+
"""Attempts to parse the value string into common types."""
|
|
100
|
+
value_str = value_str.strip()
|
|
101
|
+
if value_str.lower() == 'true':
|
|
102
|
+
return True
|
|
103
|
+
if value_str.lower() == 'false':
|
|
104
|
+
return False
|
|
105
|
+
if value_str.lower() == 'none' or value_str.lower() == 'null':
|
|
106
|
+
return None
|
|
107
|
+
# Keep quoted strings as strings without quotes
|
|
108
|
+
if (value_str.startswith('"') and value_str.endswith('"')) or \
|
|
109
|
+
(value_str.startswith("'") and value_str.endswith("'")):
|
|
110
|
+
return value_str[1:-1]
|
|
111
|
+
|
|
112
|
+
try:
|
|
113
|
+
# Try int first
|
|
114
|
+
return int(value_str)
|
|
115
|
+
except ValueError:
|
|
116
|
+
pass
|
|
117
|
+
try:
|
|
118
|
+
# Then try float
|
|
119
|
+
return float(value_str)
|
|
120
|
+
except ValueError:
|
|
121
|
+
pass
|
|
122
|
+
# If none of the above, return as string
|
|
123
|
+
return value_str
|
|
124
|
+
|
|
125
|
+
def _handle_set_conf(memory: Dict[str, Any], args: List[str]) -> str:
|
|
126
|
+
"""Handles setting or updating a configuration setting."""
|
|
127
|
+
if len(args) < 2:
|
|
128
|
+
return "Error: 'set' command requires at least two arguments (key and value). Usage: /conf set <key> <value>"
|
|
129
|
+
key = args[0]
|
|
130
|
+
# Join the rest of the arguments to form the value string
|
|
131
|
+
value_str = " ".join(args[1:])
|
|
132
|
+
try:
|
|
133
|
+
parsed_value = _parse_value(value_str)
|
|
134
|
+
|
|
135
|
+
# Validate before setting
|
|
136
|
+
product_mode = memory.get("conf", {}).get("product_mode", "lite")
|
|
137
|
+
ConfigValidator.validate(key, str(parsed_value), product_mode) # Validate the parsed value as string initially if needed, or adjust validation
|
|
138
|
+
|
|
139
|
+
if "conf" not in memory:
|
|
140
|
+
memory["conf"] = {}
|
|
141
|
+
memory["conf"][key] = parsed_value
|
|
142
|
+
save_memory() # Save after modification
|
|
143
|
+
# Use repr for confirmation message for clarity
|
|
144
|
+
return f"Configuration updated: {key} = {repr(parsed_value)}"
|
|
145
|
+
except Exception as e:
|
|
146
|
+
return f"Error setting configuration for key '{key}': {e}"
|
|
147
|
+
|
|
148
|
+
def _handle_delete_conf(memory: Dict[str, Any], args: List[str]) -> str:
|
|
149
|
+
"""Handles deleting a configuration setting."""
|
|
150
|
+
if len(args) != 1:
|
|
151
|
+
return "Error: 'delete' command requires exactly one argument (the key). Usage: /conf delete <key>"
|
|
152
|
+
key = args[0]
|
|
153
|
+
conf = memory.get("conf", {})
|
|
154
|
+
if key in conf:
|
|
155
|
+
try:
|
|
156
|
+
del memory["conf"][key]
|
|
157
|
+
save_memory() # Save after modification
|
|
158
|
+
return f"Configuration deleted: {key}"
|
|
159
|
+
except Exception as e:
|
|
160
|
+
return f"Error deleting key '{key}': {e}"
|
|
161
|
+
else:
|
|
162
|
+
return f"Error: Configuration key '{key}' not found."
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def _handle_help(memory: Dict[str, Any], args: List[str]) -> str:
|
|
166
|
+
"""Provides help text for the /conf command."""
|
|
167
|
+
if args:
|
|
168
|
+
return f"Error: 'help' command takes no arguments. Usage: /conf help"
|
|
169
|
+
|
|
170
|
+
help_text = """
|
|
171
|
+
/conf command usage:
|
|
172
|
+
/conf [pattern] - Show configurations. Optional wildcard pattern (e.g., *_model, api*).
|
|
173
|
+
/conf get <key> - Get the value of a specific configuration key.
|
|
174
|
+
/conf set <key>:<value> - Set or update a configuration key.
|
|
175
|
+
Value parsed (bool, int, float, None) or treated as string.
|
|
176
|
+
Use quotes ("value with spaces") for explicit strings.
|
|
177
|
+
/conf /drop <key> - Delete a configuration key.
|
|
178
|
+
/conf /export <path> - Export current configuration to a file.
|
|
179
|
+
/conf /import <path> - Import configuration from a file.
|
|
180
|
+
/conf help - Show this help message.
|
|
181
|
+
"""
|
|
182
|
+
return help_text.strip()
|
|
183
|
+
|
|
184
|
+
# Command dispatch table
|
|
185
|
+
COMMAND_HANDLERS: Dict[str, Callable[[Dict[str, Any], List[str]], str]] = {
|
|
186
|
+
"list": _handle_list_conf,
|
|
187
|
+
"show": _handle_list_conf, # Alias
|
|
188
|
+
"get": _handle_get_conf,
|
|
189
|
+
"set": _handle_set_conf,
|
|
190
|
+
"delete": _handle_delete_conf,
|
|
191
|
+
"del": _handle_delete_conf, # Alias
|
|
192
|
+
"rm": _handle_delete_conf, # Alias
|
|
193
|
+
"help": _handle_help,
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
def handle_conf_command(command_args: str, memory: Dict[str, Any]) -> str:
|
|
197
|
+
"""
|
|
198
|
+
Handles the /conf command, its subcommands, and wildcard listing.
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
command_args: The arguments string following the /conf command.
|
|
202
|
+
Example: "key:value", "get key", "set key value", "*_model", "/export path"
|
|
203
|
+
memory: The current session memory dictionary.
|
|
204
|
+
|
|
205
|
+
Returns:
|
|
206
|
+
A string response to be displayed to the user.
|
|
207
|
+
"""
|
|
208
|
+
conf_str = command_args.strip()
|
|
209
|
+
|
|
210
|
+
# Handle special subcommands first
|
|
211
|
+
if conf_str.startswith("/export"):
|
|
212
|
+
from autocoder.common.conf_import_export import export_conf
|
|
213
|
+
export_path = conf_str[len("/export"):].strip()
|
|
214
|
+
if not export_path:
|
|
215
|
+
return "Error: Please specify a path for export. Usage: /conf /export <path>"
|
|
216
|
+
try:
|
|
217
|
+
export_conf(os.getcwd(), export_path)
|
|
218
|
+
return f"Configuration exported successfully to {export_path}"
|
|
219
|
+
except Exception as e:
|
|
220
|
+
return f"Error exporting configuration: {e}"
|
|
221
|
+
elif conf_str.startswith("/import"):
|
|
222
|
+
from autocoder.common.conf_import_export import import_conf
|
|
223
|
+
import_path = conf_str[len("/import"):].strip()
|
|
224
|
+
if not import_path:
|
|
225
|
+
return "Error: Please specify a path for import. Usage: /conf /import <path>"
|
|
226
|
+
try:
|
|
227
|
+
import_conf(os.getcwd(), import_path)
|
|
228
|
+
# Reload memory after import might be needed depending on import_conf implementation
|
|
229
|
+
# load_memory() # Consider if import_conf modifies the passed memory or global state
|
|
230
|
+
return f"Configuration imported successfully from {import_path}. Use '/conf' to see changes."
|
|
231
|
+
except Exception as e:
|
|
232
|
+
return f"Error importing configuration: {e}"
|
|
233
|
+
|
|
234
|
+
# Handle regular commands and listing/filtering
|
|
235
|
+
args = conf_str.split()
|
|
236
|
+
|
|
237
|
+
if not args:
|
|
238
|
+
# Default action: list all configurations
|
|
239
|
+
return _handle_list_conf(memory, [])
|
|
240
|
+
else:
|
|
241
|
+
command = args[0].lower()
|
|
242
|
+
command_args_list = args[1:]
|
|
243
|
+
|
|
244
|
+
# Check if the first argument is a known command or potentially a pattern
|
|
245
|
+
handler = COMMAND_HANDLERS.get(command)
|
|
246
|
+
|
|
247
|
+
if handler:
|
|
248
|
+
# It's a known command (list, get, set, delete, help)
|
|
249
|
+
try:
|
|
250
|
+
return handler(memory, command_args_list)
|
|
251
|
+
except Exception as e:
|
|
252
|
+
return f"An unexpected error occurred while executing '/conf {command}': {e}"
|
|
253
|
+
elif "*" in command or "?" in command:
|
|
254
|
+
# Treat as a list/filter pattern if it contains wildcards and is not a known command
|
|
255
|
+
return _handle_list_conf(memory, [command]) # Pass the pattern as the argument to list
|
|
256
|
+
else:
|
|
257
|
+
# Handle legacy key:value format for setting (optional, can be removed if only set command is preferred)
|
|
258
|
+
if ":" in conf_str and len(args) == 1: # Check if it looks like key:value and is a single "word"
|
|
259
|
+
parts = conf_str.split(":", 1)
|
|
260
|
+
if len(parts) == 2:
|
|
261
|
+
key, value_str = parts[0].strip(), parts[1].strip()
|
|
262
|
+
if key and value_str:
|
|
263
|
+
return _handle_set_conf(memory, [key, value_str])
|
|
264
|
+
else:
|
|
265
|
+
return f"Error: Invalid key:value format in '{conf_str}'. Use '/conf set {key} {value_str}' or '/conf help'."
|
|
266
|
+
else:
|
|
267
|
+
return f"Error: Unknown command or invalid format '{conf_str}'. Type '/conf help' for available commands."
|
|
268
|
+
else:
|
|
269
|
+
# If it's not a known command, not a wildcard, and not key:value format
|
|
270
|
+
return f"Error: Unknown command '/conf {command}'. Type '/conf help' for available commands."
|