16 lines
842 B
PowerShell
16 lines
842 B
PowerShell
param([string] $CodexHome, [switch] $Force)
|
|
$ErrorActionPreference = "Stop"
|
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$pythonCommand = if ($env:CODEX_IMAGEGEN_PYTHON) {
|
|
Get-Command $env:CODEX_IMAGEGEN_PYTHON -ErrorAction SilentlyContinue
|
|
} else {
|
|
Get-Command python.exe -ErrorAction SilentlyContinue | Select-Object -First 1
|
|
}
|
|
if (-not $pythonCommand) { $pythonCommand = Get-Command py.exe -ErrorAction SilentlyContinue | Select-Object -First 1 }
|
|
if (-not $pythonCommand) { throw "Python 3 not found; install Python or set CODEX_IMAGEGEN_PYTHON." }
|
|
$args = @((Join-Path $scriptDir "install_skill.py"))
|
|
if ($CodexHome) { $args += @("--codex-home", $CodexHome) }
|
|
if ($Force) { $args += "--force" }
|
|
& $pythonCommand.Source @args
|
|
if ($LASTEXITCODE -ne 0) { throw "Skill installation failed with exit code $LASTEXITCODE." }
|