feat: merge geekan:cli-etc

This commit is contained in:
莘权 马 2023-11-29 20:12:03 +08:00
parent 7b44fccf8d
commit 94043a89f4
3 changed files with 14 additions and 17 deletions

View file

@ -8,8 +8,6 @@
RFC 135 2.2.3.5.1.
"""
from pathlib import Path
from metagpt.actions import Action, ActionOutput
from metagpt.config import CONFIG
from metagpt.const import DEFAULT_WORKSPACE_ROOT, DOCS_FILE_REPO, REQUIREMENT_FILENAME
@ -28,11 +26,9 @@ class PrepareDocuments(Action):
return ActionOutput(content=doc.json(exclue="content"), instruct_content=doc)
# Create and initialize the workspace folder, initialize the Git environment.
default_workspace_root = CONFIG.project_path or DEFAULT_WORKSPACE_ROOT
default_project_name = CONFIG.project_name or FileRepository.new_filename()
default_workdir = Path(default_workspace_root) / default_project_name
project_name = CONFIG.project_name or FileRepository.new_filename()
workdir = CONFIG.project_path or DEFAULT_WORKSPACE_ROOT / project_name
CONFIG.git_repo = GitRepository()
workdir = Path(CONFIG.WORKDIR) if CONFIG.WORKDIR else default_workdir
CONFIG.git_repo.open(local_path=workdir, auto_init=True)
# Write the newly added requirements from the main parameter idea to `docs/requirement.txt`.