Initialize-DeveloperMachine.psm1

<#
.SYNOPSIS
    PowerShell module wrapper around Initialize-DeveloperMachine.ps1.

.DESCRIPTION
    Exposes Initialize-DeveloperMachine as a function so the script can
    be installed via PSGallery (Install-Module Initialize-DeveloperMachine)
    and invoked from any working directory.

    The function delegates to the bundled Initialize-DeveloperMachine.ps1
    so there's a single source of truth for behaviour - the module is
    purely a packaging/discovery layer.
#>


function Initialize-DeveloperMachine {
    <#
    .SYNOPSIS
        Bootstrap a Windows developer machine: install tools, relocate
        caches off C:, mount junctions, and configure WSL / Docker Desktop.

    .DESCRIPTION
        Wraps the bundled Initialize-DeveloperMachine.ps1 script. See its
        own help (or the project README) for full behaviour. Common
        parameters (-WhatIf, -Confirm, -Verbose) flow through.

    .PARAMETER Task
        Specific task ID(s) to run, or 'All'. When omitted an interactive
        menu lets you pick. Tab-completion lists discovered task IDs.

    .PARAMETER ConfigFile
        Explicit path to a config JSON file. When omitted the module
        searches: $PWD, then $env:USERPROFILE\.config\Initialize-DeveloperMachine\,
        then the module folder.

    .PARAMETER Force
        Skip the interactive prompt that fires when blocking applications
        (Docker Desktop, Claude, IDEs) are detected. Intended for
        non-interactive runs.

    .PARAMETER NoSpinner
        Force the spinner off even on an interactive terminal. Auto-
        disabled in CI/redirected-stdout scenarios regardless.

    .PARAMETER DryRunDelayMs
        Milliseconds to hold the spinner per task during a -WhatIf run.

    .EXAMPLE
        Initialize-DeveloperMachine
        Shows the interactive menu so you can pick which tasks to run.

    .EXAMPLE
        Initialize-DeveloperMachine -Task All
        Runs every task without showing the menu.

    .EXAMPLE
        Initialize-DeveloperMachine -Task NuGet,NPM -WhatIf
        Dry-runs only the NuGet and NPM tasks.
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')]
    param(
        [Parameter()]
        [string[]] $Task,

        [Parameter()]
        [ValidateRange(0, 60000)]
        [int] $DryRunDelayMs = 500,

        [Parameter()]
        [switch] $Force,

        [Parameter()]
        [switch] $NoSpinner,

        [Parameter()]
        [string] $ConfigFile
    )

    $scriptPath = Join-Path $PSScriptRoot 'Initialize-DeveloperMachine.ps1'
    if (-not (Test-Path -LiteralPath $scriptPath)) {
        throw "Initialize-DeveloperMachine.ps1 not found alongside the module at $scriptPath."
    }

    & $scriptPath @PSBoundParameters
}

Export-ModuleMember -Function Initialize-DeveloperMachine