update increment development

This commit is contained in:
mannaandpoem 2023-12-04 17:14:52 +08:00
parent 452cdb7ff6
commit acb70fa30c
11 changed files with 153 additions and 218 deletions

View file

@ -5,6 +5,8 @@
@Author : alexanderwu
@File : software_company.py
"""
import os
from pydantic import BaseModel, Field
from metagpt.actions import BossRequirement
@ -60,3 +62,31 @@ class Team(BaseModel):
await self.environment.run()
return self.environment.history
def save_legacy(self, project_path):
prd_path = os.path.join(project_path, 'docs/prd.md')
design_path = os.path.join(project_path, 'docs/system_design.md')
api_spec_and_tasks_path = os.path.join(project_path, 'docs/api_spec_and_tasks.md')
code_path = os.path.join(project_path, os.path.basename(project_path))
with open(prd_path, 'r', encoding='utf-8') as f:
legacy_prd = f.read()
with open(design_path, 'r', encoding='utf-8') as f:
legacy_design = f.read()
with open(api_spec_and_tasks_path, 'r', encoding='utf-8') as f:
legacy_project_management = f.read()
legacy_codes = []
for root, dirs, files in os.walk(code_path):
for file in files:
legacy_code = {}
if file.endswith('.py'):
with open(os.path.join(root, file), 'r', encoding='utf-8') as f:
legacy_code['filename'] = file
legacy_code['code'] = f.read()
legacy_codes.append(legacy_code)
legacy_dict = {
'legacy_prd': legacy_prd,
'legacy_design': legacy_design,
'legacy_project_management': legacy_project_management,
'legacy_code': legacy_codes
}
self.environment.set_legacy(legacy_dict)