8b70daed53
- Add git URL parsing utilities (extract_base_repo_url, parse_git_url) - Support GitHub, GitLab, Bitbucket browser URL detection - Add /projects/repositories/parse-url endpoint - Enhance repository creation to detect browser URLs and suggest corrections - Add real-time URL validation in frontend with debouncing - Show visual indicators (green/yellow/red) for URL validity - Display inline suggestions with 'Use Suggested' button - Add comprehensive unit tests for URL parsing - Quality gates: ruff ✓, mypy ✓, typecheck ✓, lint ✓, build ✓
2.1 KiB
2.1 KiB
Smart Git URL Parsing - Tasks
Phase 1: Backend URL Parsing
-
Task 1.1: Create URL parsing utilities
- Create
src/utils/git_url_parser.py - Implement
extract_base_repo_url()function - Support GitHub, GitLab, Bitbucket patterns
- Handle query parameters, branch paths, file paths
- Add comprehensive unit tests
- Create
-
Task 1.2: Create URL validation endpoint
- Add
POST /git-repositories/parse-urlendpoint - Returns URLParseResult with original, base, validation status
- Add tests for endpoint
- Add
-
Task 1.3: Enhance repository creation endpoint
- Update
POST /projects/{project_id}/repositories - Detect browser URLs and return 422 with suggestion
- Add
force_original_urlflag to bypass suggestion - Update response models
- Update
Phase 2: Frontend Implementation
-
Task 2.1: Create API client for URL parsing
- Add
parseGitUrl()function toapi/git_repositories.ts - Add types for URLParseResult
- Add
-
Task 2.2: Enhance repository creation form
- Add real-time URL validation to input field
- Show visual indicators (green/yellow/red)
- Display inline suggestion banner
- Add "Use Suggested" / "Keep Original" buttons
-
Task 2.3: Create confirmation dialog
- Create
URLCorrectionDialogcomponent - Shows original vs suggested URL comparison
- Handles accept/reject/cancel actions
- Integrate with repository creation flow
- Create
Phase 3: Integration & Testing
-
Task 3.1: Wire up frontend to backend
- Call parse-url endpoint on URL input change (debounced)
- Handle 422 responses from repository creation
- Show confirmation dialog when needed
-
Task 3.2: Add error handling
- Handle network errors during URL validation
- Show clear error messages for unsupported URLs
- Handle clone failures gracefully
-
Task 3.3: Run quality gates
- Backend: ruff, mypy, pytest
- Frontend: typecheck, lint, build
-
Task 3.4: Manual testing
- Test with GitHub URLs (tree, blob, pull)
- Test with GitLab URLs (-/tree, -/blob)
- Test with valid git URLs (should pass through)
- Test force_original_url flag