Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

feat: merge geekan:cli-etc

莘权 马94043a89f41f
diff --git a/metagpt/actions/prepare_documents.py b/metagpt/actions/prepare_documents.py
index fe954b79c..71c94d25a 100644
--- a/metagpt/actions/prepare_documents.py
+++ b/metagpt/actions/prepare_documents.py
@@ -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`.
diff --git a/metagpt/startup.py b/metagpt/startup.py
index de348780b..78f32d556 100644
--- a/metagpt/startup.py
+++ b/metagpt/startup.py
@@ -12,17 +12,18 @@ app = typer.Typer()
@app.command()
def startup(
idea: str = typer.Argument(..., help="Your innovative idea, such as 'Create a 2048 game.'"),
- investment: float = typer.Option(3.0, help="Dollar amount to invest in the AI company."),
- n_round: int = typer.Option(5, help="Number of rounds for the simulation."),
- code_review: bool = typer.Option(True, help="Whether to use code review."),
- run_tests: bool = typer.Option(False, help="Whether to enable QA for adding & running tests."),
- implement: bool = typer.Option(True, help="Enable or disable code implementation."),
- project_name: str = typer.Option("", help="Unique project name, such as 'game_2048'."),
- inc: bool = typer.Option(False, help="Incremental mode. Use it to coop with existing repo."),
+ investment: float = typer.Option(default=3.0, help="Dollar amount to invest in the AI company."),
+ n_round: int = typer.Option(default=5, help="Number of rounds for the simulation."),
+ code_review: bool = typer.Option(default=True, help="Whether to use code review."),
+ run_tests: bool = typer.Option(default=False, help="Whether to enable QA for adding & running tests."),
+ implement: bool = typer.Option(default=True, help="Enable or disable code implementation."),
+ project_name: str = typer.Option(default="", help="Unique project name, such as 'game_2048'."),
+ inc: bool = typer.Option(default=False, help="Incremental mode. Use it to coop with existing repo."),
project_path: str = typer.Option(
- help="Specify the directory path of the old version project to fulfill the " "incremental requirements."
+ default="",
+ help="Specify the directory path of the old version project to fulfill the " "incremental requirements.",
),
- reqa_file: str = typer.Option(help="Specify the source file name for rewriting the quality test code."),
+ reqa_file: str = typer.Option(default="", help="Specify the source file name for rewriting the quality test code."),
):
"""Run a startup. Be a boss."""
from metagpt.roles import (
diff --git a/metagpt/utils/file_repository.py b/metagpt/utils/file_repository.py
index 846bfcd0c..0815bf90a 100644
--- a/metagpt/utils/file_repository.py
+++ b/metagpt/utils/file_repository.py
@@ -54,7 +54,7 @@ class FileRepository:
"""
pathname = self.workdir / filename
pathname.parent.mkdir(parents=True, exist_ok=True)
- async with aiofiles.open(str(pathname), mode="wb") as writer:
+ async with aiofiles.open(str(pathname), mode="w") as writer:
await writer.write(content)
logger.info(f"save to: {str(pathname)}")
@@ -98,7 +98,7 @@ class FileRepository:
if not path_name.exists():
return None
try:
- async with aiofiles.open(str(path_name), mode="rb") as reader:
+ async with aiofiles.open(str(path_name), mode="r") as reader:
doc.content = await reader.read()
except FileNotFoundError as e:
logger.info(f"open {str(path_name)} failed:{e}")