feat: git mount URL validation with branch detection

- Add POST /config-profiles/validate-git-url endpoint:
  - Parses URL using existing parse_git_url utility
  - Suggests corrected URL for browser URLs
  - Runs git ls-remote --heads to verify reachability
  - Lists available branches from remote
  - Supports SSH key for private repos
  - Returns structured response: valid, suggested_url, branches,
    default_branch, error, error_code

- Update frontend GitMountEditor:
  - Add Check button next to URL field with loading state
  - Show validation result: valid (green), suggestion (yellow),
    invalid (red)
  - Suggestion includes Use this button to apply corrected URL
  - Branch field becomes dropdown when URL is validated,
    populated with remote branches
  - Mappings section disabled until URL is validated
  - Shows hint: Validate the URL first

- Quality gates: pytest (218 passed, 6 pre-existing),
  tsc --noEmit (clean)
This commit is contained in:
Alex Blank
2026-05-29 12:15:30 +02:00
parent 4a0d38384f
commit 090edf7ef6
5 changed files with 347 additions and 30 deletions
+20
View File
@@ -167,3 +167,23 @@ export const resolveDefaultProfile = async (
});
return response.data;
};
export interface ValidateGitUrlResponse {
valid: boolean;
suggested_url?: string;
branches?: string[];
default_branch?: string;
error?: string;
error_code?: string;
}
export const validateGitUrl = async (
url: string,
sshKeyId?: string,
): Promise<ValidateGitUrlResponse> => {
const response = await apiClient.post<ValidateGitUrlResponse>(
"/config-profiles/validate-git-url",
{ url, ssh_key_id: sshKeyId },
);
return response.data;
};