11import asyncio
22import copy
3- import os
3+
44from cover_agent .AICaller import AICaller
5- from cover_agent .utils import parse_args_full_repo , find_test_files
65from cover_agent .CoverAgent import CoverAgent
76from cover_agent .lsp_logic .ContextHelper import ContextHelper
7+ from cover_agent .settings .config_loader import get_settings
8+ from cover_agent .settings .config_schema import CoverAgentConfig
9+ from cover_agent .utils import find_test_files , parse_args_full_repo
810
911
1012async def run ():
11- args = parse_args_full_repo ()
13+ settings = get_settings ().get ("default" )
14+ args = parse_args_full_repo (settings )
1215
1316 if args .project_language == "python" :
1417 context_helper = ContextHelper (args )
1518 else :
16- raise NotImplementedError (
17- "Unsupported language: {}" .format (args .project_language )
18- )
19+ raise NotImplementedError ("Unsupported language: {}" .format (args .project_language ))
1920
2021 # scan the project directory for test files
2122 test_files = find_test_files (args )
22- print (
23- "============\n Test files to be extended:\n "
24- + "" .join (f"{ f } \n ============\n " for f in test_files )
25- )
23+ print ("============\n Test files to be extended:\n " + "" .join (f"{ f } \n ============\n " for f in test_files ))
2624
2725 # start the language server
2826 async with context_helper .start_server ():
2927 print ("LSP server initialized." )
3028
31- ai_caller = AICaller (model = args .model )
29+ generate_log_files = not args .suppress_log_files
30+ ai_caller = AICaller (model = args .model , generate_log_files = generate_log_files )
3231
3332 # main loop for analyzing test files
3433 for test_file in test_files :
3534 # Find the context files for the test file
3635 context_files = await context_helper .find_test_file_context (test_file )
37- print (
38- "Context files for test file '{}':\n {}" .format (
39- test_file , "" .join (f"{ f } \n " for f in context_files )
40- )
41- )
36+ print ("Context files for test file '{}':\n {}" .format (test_file , "" .join (f"{ f } \n " for f in context_files )))
4237
4338 # Analyze the test file against the context files
4439 print ("\n Analyzing test file against context files..." )
@@ -54,7 +49,9 @@ async def run():
5449 args_copy .test_command_dir = args .project_root
5550 args_copy .test_file_path = test_file
5651 args_copy .included_files = context_files_include
57- agent = CoverAgent (args_copy )
52+
53+ config = CoverAgentConfig .from_cli_args_with_defaults (args_copy )
54+ agent = CoverAgent (config )
5855 agent .run ()
5956 except Exception as e :
6057 print (f"Error running CoverAgent for test file '{ test_file } ': { e } " )
0 commit comments