src/_Write-CciInstalledNextStep.ps1

function _Write-CciInstalledNextStep {
<#
.SYNOPSIS
    Tells the operator what to run after a module is installed.
.DESCRIPTION
    Installing a module does not load it, and a payload module only registers
    itself with the framework at import time. A machine build that stopped at
    "installed" therefore hit "No payload module is registered" on the very
    next command, which reads like a failure rather than a missing step.
 
    Where the module advertises its own entry point (a PrivateData.CciGet.NextStep
    string in its manifest), that is shown instead of the generic import line,
    so the guidance stays with the module rather than being hardcoded here.
#>

    [CmdletBinding()]
    param([Parameter(Mandatory)][string]$Name)

    $next = $null
    try {
        $module = Get-Module -ListAvailable -Name $Name |
                  Sort-Object Version -Descending | Select-Object -First 1
        if ($module) {
            $data = $module.PrivateData
            if ($data -is [hashtable] -and $data.ContainsKey('CciGet')) {
                $cciget = $data['CciGet']
                if ($cciget -is [hashtable] -and $cciget.ContainsKey('NextStep')) {
                    $next = [string]$cciget['NextStep']
                }
            }
        }
    }
    catch { }

    Write-Host ''
    Write-Host " Next: Import-Module $Name"
    if ($next) { Write-Host " then: $next" }
    Write-Host ''
}