Private/Test-KadenProjectId.ps1

function Test-KadenProjectId {
    <#
    .SYNOPSIS
        Return true when a project id is safe to record and to place in AGENTS.md.
    .DESCRIPTION
        Matches the legacy slug rule: at most 64 characters, lowercase letters,
        digits, and single hyphens. Rejects whitespace and marker text.
    #>

    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [AllowEmptyString()]
        [string]$ProjectId
    )

    if ([string]::IsNullOrWhiteSpace($ProjectId)) {
        return $false
    }
    if ($ProjectId.Trim() -ne $ProjectId) {
        return $false
    }
    if ($ProjectId.Length -gt 64) {
        return $false
    }
    if ($ProjectId -cnotmatch '^[a-z0-9]+(-[a-z0-9]+)*$') {
        return $false
    }
    return $true
}