From 06b4e4767a9ab7a74d8f293b215d644d1cda71a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Mon, 29 Jan 2024 10:14:09 +0800 Subject: [PATCH] feat: generate_repo return ProjectRepo --- metagpt/startup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/metagpt/startup.py b/metagpt/startup.py index 000b3c5d4..4a077cab7 100644 --- a/metagpt/startup.py +++ b/metagpt/startup.py @@ -1,5 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- + import asyncio import shutil from pathlib import Path @@ -9,6 +10,7 @@ import typer from metagpt.config2 import config from metagpt.const import CONFIG_ROOT, METAGPT_ROOT from metagpt.context import Context +from metagpt.utils.project_repo import ProjectRepo app = typer.Typer(add_completion=False, pretty_exceptions_show_locals=False) @@ -26,7 +28,7 @@ def generate_repo( reqa_file, max_auto_summarize_code, recover_path, -): +) -> ProjectRepo: """Run the startup logic. Can be called from CLI or other Python scripts.""" from metagpt.roles import ( Architect, @@ -67,6 +69,8 @@ def generate_repo( company.run_project(idea) asyncio.run(company.run(n_round=n_round)) + return ctx.repo + @app.command("", help="Start a new project.") def startup(