Added a question at the beginning of a project rerun so user can decide if they want to update files with their latest changes they made

This commit is contained in:
Zvonimir Sabljic
2023-09-12 21:05:40 +02:00
parent 6e977590c3
commit 33c38985bf
2 changed files with 16 additions and 4 deletions

View File

@@ -94,9 +94,21 @@ class Project:
clear_directory(self.root_path)
delete_all_app_development_data(self.args['app_id'])
self.skip_steps = False
elif 'update_files_before_start' in self.args and self.skip_until_dev_step is not None:
FileSnapshot.delete().where(FileSnapshot.app == self.app and FileSnapshot.development_step == self.skip_until_dev_step).execute()
self.save_files_snapshot(self.skip_until_dev_step)
elif self.skip_until_dev_step is not None:
should_overwrite_files = ''
while should_overwrite_files != 'y' or should_overwrite_files != 'n':
should_overwrite_files = styled_text(
self,
f'Do you want to overwrite the dev step {self.args["skip_until_dev_step"]} code with system changes? Type y/n',
ignore_user_input_count=True
)
if should_overwrite_files == 'n':
break
elif should_overwrite_files == 'y':
FileSnapshot.delete().where(FileSnapshot.app == self.app and FileSnapshot.development_step == self.skip_until_dev_step).execute()
self.save_files_snapshot(self.skip_until_dev_step)
break
# TODO END
self.developer.start_coding()

View File

@@ -29,7 +29,7 @@ class CodeMonkey(Agent):
}, IMPLEMENT_CHANGES)
convo.remove_last_x_messages(1)
if ('update_files_before_start' not in self.project.args) or (self.project.skip_until_dev_step != str(self.project.checkpoints['last_development_step'].id)):
if self.project.skip_until_dev_step != str(self.project.checkpoints['last_development_step'].id):
for file_data in changes:
self.project.save_file(file_data)