Private/Open-WorktreeTerminal.ps1

<#
.SYNOPSIS
    Opens a new terminal window in the given directory.
.DESCRIPTION
    Uses Windows Terminal (wt) when available; falls back to pwsh.
#>

function Open-WorktreeTerminal {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [string] $WorktreePath
    )

    if (Get-Command wt -ErrorAction SilentlyContinue) {
        Start-Process wt -ArgumentList "-d `"$WorktreePath`""
    }
    else {
        Start-Process pwsh -ArgumentList '-NoExit', '-Command', "Set-Location '$WorktreePath'"
    }
    Write-Host "Terminal opened : $WorktreePath" -ForegroundColor Cyan
}