Validate repository for documentation generation. Checks: - Path exists and is a directory - Contains supported code files - Has sufficient files for meaningful documentation Args: repo_path: Path to repository Returns: Tuple of (valida
(repo_path: Path)
| 36 | ".rs", # Rust |
| 37 | ".dart", # Dart |
| 38 | ".go", # Go |
| 39 | ".zig", # Zig |
| 40 | ".lean", # Lean 4 |
| 41 | ".vue", # Vue single-file components |
| 42 | } |
| 43 | |
| 44 | |
| 45 | def validate_repository(repo_path: Path) -> tuple[Path, list[tuple[str, int]]]: |
| 46 | """ |
| 47 | Validate repository for documentation generation. |
| 48 | |
| 49 | Checks: |
| 50 | - Path exists and is a directory |
| 51 | - Contains supported code files |
| 52 | - Has sufficient files for meaningful documentation |
| 53 | |
| 54 | Args: |
| 55 | repo_path: Path to repository |
| 56 | |
| 57 | Returns: |
| 58 | Tuple of (validated_path, language_counts) |
| 59 | |
| 60 | Raises: |
| 61 | RepositoryError: If validation fails |
| 62 | """ |
| 63 | # Validate path exists |
| 64 | repo_path = validate_repository_path(repo_path) |
| 65 | |
| 66 | # Detect languages |
| 67 | languages = detect_supported_languages(repo_path) |
| 68 | |
| 69 | if not languages: |
| 70 | raise RepositoryError( |
| 71 | f"No supported code files found in {repo_path}\n\n" |
| 72 | "CodeWiki supports: Python, Java, JavaScript, TypeScript, C, C++, C#, Kotlin, PHP, " |
| 73 | "Ruby, Scala, Rust, Dart, Go, Zig, Vue\n\n" |
| 74 | "Please navigate to a code repository or specify a custom directory:\n" |
no test coverage detected