From 4928a896ca8b357bdfbc6d08d3b72d86f4598995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Thu, 30 Nov 2023 10:16:34 +0800 Subject: [PATCH] feat: merge geekan:cli-etc --- metagpt/actions/prepare_documents.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/metagpt/actions/prepare_documents.py b/metagpt/actions/prepare_documents.py index 71c94d25a..b339d897d 100644 --- a/metagpt/actions/prepare_documents.py +++ b/metagpt/actions/prepare_documents.py @@ -7,6 +7,7 @@ @Desc: PrepareDocuments Action: initialize project folder and add new requirements to docs/requirements.txt. RFC 135 2.2.3.5.1. """ +import shutil from metagpt.actions import Action, ActionOutput from metagpt.config import CONFIG @@ -28,6 +29,8 @@ class PrepareDocuments(Action): # Create and initialize the workspace folder, initialize the Git environment. project_name = CONFIG.project_name or FileRepository.new_filename() workdir = CONFIG.project_path or DEFAULT_WORKSPACE_ROOT / project_name + if not CONFIG.inc and workdir.exists(): + shutil.rmtree(workdir) CONFIG.git_repo = GitRepository() CONFIG.git_repo.open(local_path=workdir, auto_init=True)