Modules/businessdev.ALbuild.Pipeline/Private/ConvertFrom-VsoCommand.ps1

function ConvertFrom-VsoCommand {
    <#
    .SYNOPSIS
        Parses an Azure DevOps "##vso[task.setvariable ...]" logging command line.
    .DESCRIPTION
        Internal, pure helper for the local pipeline runner. Recognises the set-variable logging
        command a task emits to pass an output to later steps and returns its name, value and
        secret flag. Returns $null for any other line.
    .PARAMETER Line
        A single line of task output.
    .OUTPUTS
        PSCustomObject (Name, Value, IsSecret) or $null.
    #>

    [CmdletBinding()]
    [OutputType([PSCustomObject])]
    param(
        [AllowNull()] [AllowEmptyString()] [string] $Line
    )

    if ([string]::IsNullOrWhiteSpace($Line)) { return $null }

    $match = [regex]::Match($Line, '##vso\[task\.setvariable\s+(?<props>[^\]]*)\](?<value>.*)$')
    if (-not $match.Success) { return $null }

    $props = @{}
    foreach ($pair in ($match.Groups['props'].Value -split ';')) {
        $kv = $pair.Split('=', 2)
        if ($kv.Count -eq 2) { $props[$kv[0].Trim().ToLowerInvariant()] = $kv[1].Trim() }
    }
    if (-not $props.ContainsKey('variable')) { return $null }

    return [PSCustomObject]@{
        Name     = $props['variable']
        Value    = $match.Groups['value'].Value
        IsSecret = ($props.ContainsKey('issecret') -and $props['issecret'] -eq 'true')
    }
}