## ADDED Requirements ### Requirement: Repository Creation The system SHALL allow creating new bare git repositories within projects. #### Scenario: Create repository - GIVEN an authenticated user with a project - WHEN they POST a repository name - THEN a bare repo is initialized on disk at `/data/repos/{user_id}/{project_id}/{repo_name}.git` - AND metadata is stored in the database - AND the response includes the repository details #### Scenario: Duplicate name prevention - GIVEN a project with a repo named "frontend" - WHEN the user tries to create another "frontend" repo - THEN the system responds with 400 Bad Request ### Requirement: Repository Cloning The system SHALL support cloning external repositories as bare mirrors. #### Scenario: Clone repository - GIVEN an authenticated user with a project - WHEN they provide a valid remote URL - THEN the system clones as a bare mirror - AND stores it in the structured path - AND records the remote URL in metadata #### Scenario: Invalid URL - GIVEN an authenticated user - WHEN they provide an invalid or unreachable URL - THEN the system responds with 400 Bad Request ### Requirement: Repository Listing The system SHALL list all repositories for a project. #### Scenario: List repositories - GIVEN an authenticated user with a project - WHEN they GET the repositories endpoint - THEN all repos for that project are listed with name, path, and last push date ### Requirement: Repository Deletion The system SHALL remove repository records and disk contents. #### Scenario: Delete repository - GIVEN a project owner - WHEN they delete a repository - THEN the database record is removed - AND the directory on disk is removed ### Requirement: Project Cascade Delete The system SHALL clean up repositories when a project is deleted. #### Scenario: Cascade repository cleanup - GIVEN a project with associated repositories - WHEN the project owner deletes the project - THEN all repository records for that project are removed - AND all repository directories on disk are removed