Private/Get-GraphResourceShardKey.ps1

function Get-GraphResourceShardKey {
    <#
    .SYNOPSIS
        Derives the resource-based shard key used by the by-cmdlet lite index.
    .DESCRIPTION
        Keep this in sync with the identical logic in
        scripts/build-graphshell-lite-indexes.ps1. Both must compute the same shard name for
        the same cmdlet, since the build script decides which file a record lives in and this
        function decides which file Resolve-GraphMapping asks for.
    #>

    [CmdletBinding()]
    [OutputType([string])]
    param(
        [Parameter(Mandatory)]
        [string]$Command
    )

    $resource = $Command -replace '^[A-Za-z]+-Mg(Beta)?', ''
    if ($resource) { return $resource.Substring(0, 1).ToUpperInvariant() }
    return 'X'
}