Private/Get-GERemoteSummary.ps1

function Get-GERemoteSummary {
    <#
    .SYNOPSIS
    Return the list of configured published locations with provider and purpose.
 
    .DESCRIPTION
    Parses git remote -v and returns one PSCustomObject per fetch/push entry, including Repository, Remote, Purpose (fetch or push), Provider (GitHub, GitLab, Other), and Url. Show-Remote wraps this for the user.
 
    .PARAMETER Path
    The folder to query. Defaults to the current location.
 
    .EXAMPLE
    Get-GERemoteSummary
 
    .NOTES
    Internal. Read-only.
 
    Steps:
    1. Find the project folder root.
    2. List all configured published locations in verbose form; return an empty array on failure.
    3. For each line, parse the remote name, URL, and purpose (fetch or push).
    4. Sanitize the URL to remove any embedded credentials before including it in the result.
    5. Classify the provider from the sanitized URL.
    6. Emit each result object to the pipeline.
 
    .LINK
    Show-Remote
    #>

    [CmdletBinding()]
    param(
        [string]$Path = (Get-Location).Path
    )

    $root = Get-GERepoRoot -Path $Path
    $result = Invoke-GEGit -ArgumentList @('remote', '-v') -WorkingDirectory $root -AllowFailure

    if ($result.ExitCode -ne 0) {
        return @()
    }

    foreach ($line in @($result.Output)) {
        if ([string]::IsNullOrWhiteSpace($line)) {
            continue
        }

        if ($line -match '^(?<Name>\S+)\s+(?<Url>\S+)\s+\((?<Purpose>fetch|push)\)$') {
            $remoteName = $Matches['Name']
            $remoteUrl = $Matches['Url']
            $purpose = $Matches['Purpose']
            $provider = Get-GEProviderName -RemoteUrl $remoteUrl

            # Never surface embedded credentials. .git/config is an untrusted
            # input on the read path (clone-with-creds, CI, hostile repo);
            # Test-GERemoteUrlSafe only guards GitEasy's own input path.
            [PSCustomObject]@{
                Repository = $root
                Remote     = $remoteName
                Purpose    = $purpose
                Provider   = $provider
                Url        = (Format-GESafeUrl -Url $remoteUrl)
            }
        }
    }
}