Added ask_for_human_verification and get_test_directory_tree to the Project class + added so that directory tree is created from within the folder

This commit is contained in:
Zvonimir Sabljic
2023-08-03 11:16:17 +02:00
parent 3904c0bf03
commit 60805a5408
2 changed files with 22 additions and 4 deletions

View File

@@ -1,5 +1,8 @@
import os
from termcolor import colored
from const.common import IGNORE_FOLDERS
from utils.questionary import styled_text
from helpers.files import get_files_content
from helpers.cli import build_directory_tree
from helpers.agents.TechLead import TechLead
@@ -49,7 +52,11 @@ class Project:
self.developer.start_coding()
def get_directory_tree(self):
return build_directory_tree(self.root_path, ignore=IGNORE_FOLDERS)
return build_directory_tree(self.root_path + '/', ignore=IGNORE_FOLDERS)
def get_test_directory_tree(self):
# TODO remove hardcoded path
return build_directory_tree(self.root_path + '/tests', ignore=IGNORE_FOLDERS)
def get_files(self, files):
files_with_content = []
@@ -87,4 +94,13 @@ class Project:
# Write/overwrite the file with its content
with open(full_path, 'w', encoding='utf-8') as f:
f.write(file_snapshot.content)
f.write(file_snapshot.content)
def ask_for_human_verification(self, message, description):
print(colored(message, "orange"))
print(description)
answer = ''
while answer != 'continue':
answer = styled_text(
'Once you are ready, type "continue" to continue.',
)

View File

@@ -125,5 +125,7 @@ def run_command_until_success(command, timeout, convo):
command = response
if not command_executed:
# TODO ask user to debug and press enter to continue
pass
convo.agent.project.ask_for_human_verification(
'It seems like I cannot debug this problem by myself. Can you please help me and try debugging it yourself?',
command
)