39 lines
1.1 KiB
PowerShell
39 lines
1.1 KiB
PowerShell
param(
|
|
[string]$RepoUrl = "https://fun-md.com/Fun_MD/devops-skills.git",
|
|
[string]$CodexHome = "$HOME\.codex"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$skillName = "gitea-issue-devops-agent"
|
|
$targetDir = Join-Path $CodexHome "skills\$skillName"
|
|
$tmpRoot = Join-Path $env:TEMP ("devops-skills-" + [Guid]::NewGuid().ToString("N"))
|
|
|
|
try {
|
|
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
|
throw "[install] git is required but not found."
|
|
}
|
|
|
|
Write-Host "[install] downloading $skillName from $RepoUrl"
|
|
git clone --depth 1 $RepoUrl $tmpRoot | Out-Null
|
|
|
|
$sourceDir = Join-Path $tmpRoot "skills\$skillName"
|
|
if (-not (Test-Path $sourceDir)) {
|
|
throw "[install] skill directory not found in repository."
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force (Join-Path $CodexHome "skills") | Out-Null
|
|
if (Test-Path $targetDir) {
|
|
Remove-Item -Recurse -Force $targetDir
|
|
}
|
|
Copy-Item -Path $sourceDir -Destination $targetDir -Recurse -Force
|
|
|
|
Write-Host "[install] done"
|
|
Write-Host "[install] installed path: $targetDir"
|
|
}
|
|
finally {
|
|
if (Test-Path $tmpRoot) {
|
|
Remove-Item -Recurse -Force $tmpRoot
|
|
}
|
|
}
|