Create the ``.autoforge/`` directory (if needed) and write its ``.gitignore``. Returns: The path to the ``.autoforge`` directory.
(project_dir: Path)
| 97 | |
| 98 | |
| 99 | def ensure_autoforge_dir(project_dir: Path) -> Path: |
| 100 | """Create the ``.autoforge/`` directory (if needed) and write its ``.gitignore``. |
| 101 | |
| 102 | Returns: |
| 103 | The path to the ``.autoforge`` directory. |
| 104 | """ |
| 105 | autoforge_dir = get_autoforge_dir(project_dir) |
| 106 | autoforge_dir.mkdir(parents=True, exist_ok=True) |
| 107 | |
| 108 | gitignore_path = autoforge_dir / ".gitignore" |
| 109 | gitignore_path.write_text(_GITIGNORE_CONTENT, encoding="utf-8") |
| 110 | |
| 111 | return autoforge_dir |
| 112 | |
| 113 | |
| 114 | # --------------------------------------------------------------------------- |
no test coverage detected