| 4 | |
| 5 | |
| 6 | def clone_and_create_context_folder(repo_name: str, id_name: str) -> str: |
| 7 | # Create a work folder in the current working directory if it doesn't already exist |
| 8 | work_folder = os.path.join(os.getcwd(), "work") |
| 9 | if not os.path.exists(work_folder): |
| 10 | os.makedirs(work_folder) |
| 11 | |
| 12 | # Clone the repository into the work folder |
| 13 | repo_path = os.path.join(work_folder, id_name) |
| 14 | if not os.path.exists(repo_path): |
| 15 | Repo.clone_from(repo_name, repo_path) |
| 16 | |
| 17 | # Create a context folder with the specified id_name in the current working directory |
| 18 | context_folder = os.path.join(os.getcwd(), f"context/{id_name}_context") |
| 19 | if not os.path.exists(context_folder): |
| 20 | os.makedirs(context_folder) |
| 21 | |
| 22 | return repo_path, context_folder |