## ADDED Requirements ### Requirement: Clone mode instance creation The system SHALL support creating tool instances with a clone mode that clones the repository into the instance directory. #### Scenario: Create instance in clone mode - **GIVEN** an authenticated user with a repository that has an SSH key and remote URL - **WHEN** they create an instance with `clone_mode: "clone"` and `branch: "main"` - **THEN** the system clones the repository into the instance directory - **AND** the compose file uses the clone path as `REPO_PATH` - **AND** the instance record stores `clone_mode="clone"` and `branch="main"` #### Scenario: Create instance in mount mode - **GIVEN** an authenticated user with a repository - **WHEN** they create an instance with `clone_mode: "mount"` (or omit the field) - **THEN** the compose file uses the host repository path as `REPO_PATH` - **AND** the instance record stores `clone_mode="mount"` ### Requirement: SSH key mounting for git operations The system SHALL mount the repository's SSH key into clone-mode containers for git operations. #### Scenario: Start clone-mode instance - **GIVEN** a clone-mode instance with an associated SSH key - **WHEN** the instance is started - **THEN** the SSH key is decrypted and written to `instance_dir/.ssh/` - **AND** the `.ssh` directory is mounted into the container - **AND** the container can perform git push/pull operations ### Requirement: Dirty check on clone deletion The system SHALL check for uncommitted changes before deleting a clone-mode instance. #### Scenario: Delete clean clone - **GIVEN** a clone-mode instance with no uncommitted changes - **WHEN** the user requests deletion - **THEN** the instance is deleted successfully #### Scenario: Delete dirty clone with confirmation - **GIVEN** a clone-mode instance with uncommitted changes - **WHEN** the user requests deletion - **THEN** the system returns a warning with change details - **AND** the user must confirm deletion #### Scenario: Force delete dirty clone - **GIVEN** a clone-mode instance with uncommitted changes - **WHEN** the user requests deletion with `force=true` - **THEN** the instance is deleted regardless of uncommitted changes ## MODIFIED Requirements None. ## REMOVED Requirements None.