mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-15 11:02:36 +02:00
feat: + __init__.py
feat: +import_git_repo
This commit is contained in:
parent
05a4967e0b
commit
1a88b3fc19
7 changed files with 103 additions and 7 deletions
|
|
@ -270,3 +270,32 @@ async def git_archive(project_path: str | Path) -> str:
|
|||
ctx.set_repo_dir(project_path)
|
||||
ctx.git_repo.archive()
|
||||
return ctx.git_repo.log()
|
||||
|
||||
|
||||
@register_tool(tags=["software development", "import git repo"])
|
||||
async def import_git_repo(url: str) -> Path:
|
||||
"""
|
||||
Imports a project from a Git website and formats it to MetaGPT project format to enable incremental appending requirements.
|
||||
|
||||
Args:
|
||||
url (str): The Git project URL, such as "https://github.com/geekan/MetaGPT.git".
|
||||
|
||||
Returns:
|
||||
Path: The path of the formatted project.
|
||||
|
||||
Example:
|
||||
# The Git project URL to input
|
||||
>>> git_url = "https://github.com/geekan/MetaGPT.git"
|
||||
|
||||
# Import the Git repository and get the formatted project path
|
||||
>>> formatted_project_path = await import_git_repo(git_url)
|
||||
>>> print("Formatted project path:", formatted_project_path)
|
||||
/PATH/TO/THE/FORMMATTED/PROJECT
|
||||
"""
|
||||
from metagpt.actions.import_repo import ImportRepo
|
||||
from metagpt.context import Context
|
||||
|
||||
ctx = Context()
|
||||
action = ImportRepo(repo_path=url, context=ctx)
|
||||
await action.run()
|
||||
return ctx.repo.workdir
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue