Commit generated documentation. Args: docs_path: Path to documentation directory message: Commit message (optional) Returns: Commit hash Raises: RepositoryError: If commit fails
(
self,
docs_path: Path,
message: Optional[str] = None
)
| 121 | |
| 122 | def commit_documentation(self, docs_path: Path, message: Optional[str] = None) -> str: |
| 123 | """ |
| 124 | Commit generated documentation. |
| 125 | |
| 126 | Args: |
| 127 | docs_path: Path to documentation directory |
| 128 | message: Commit message (optional) |
| 129 | |
| 130 | Returns: |
| 131 | Commit hash |
| 132 | |
| 133 | Raises: |
| 134 | RepositoryError: If commit fails |
| 135 | """ |
| 136 | if message is None: |
| 137 | message = "Add generated documentation\n\nGenerated by CodeWiki CLI" |
| 138 | |
| 139 | try: |
| 140 | # Add documentation files |
| 141 | self.repo.index.add([str(docs_path)]) |
| 142 | |
| 143 | # Commit |
| 144 | commit = self.repo.index.commit(message) |
| 145 | |
| 146 | return commit.hexsha |
| 147 | except GitCommandError as e: |
| 148 | raise RepositoryError(f"Failed to commit documentation: {e}") |
| 149 | |
| 150 | def get_remote_url(self, remote_name: str = "origin") -> Optional[str]: |
| 151 | """ |
| 152 | Get remote repository URL. |
| 153 | |
| 154 | Args: |
| 155 | remote_name: Name of remote (default: origin) |
| 156 |
nothing calls this directly
no test coverage detected