74 lines
2.0 KiB
PowerShell
74 lines
2.0 KiB
PowerShell
param(
|
|
[string]$DestRoot = "$env:USERPROFILE\.codex\skills",
|
|
[switch]$Force
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$skills = @(
|
|
@{
|
|
Name = "skill-vetter"
|
|
Owner = "openclaw"
|
|
Repo = "skills"
|
|
Path = "skills/spclaudehome/skill-vetter"
|
|
},
|
|
@{
|
|
Name = "superpowers"
|
|
Owner = "openclaw"
|
|
Repo = "skills"
|
|
Path = "skills/cutd/claw-superpowers"
|
|
},
|
|
@{
|
|
Name = "frontend-design"
|
|
Owner = "vadimcomanescu"
|
|
Repo = "codex-skills"
|
|
Path = "skills/.curated/design/frontend-design"
|
|
}
|
|
)
|
|
|
|
function Get-GitHubJson([string]$Url) {
|
|
Invoke-RestMethod -Headers @{ "User-Agent" = "document-cleaning-skill-bootstrap" } -Uri $Url
|
|
}
|
|
|
|
function Download-GitHubFolder(
|
|
[string]$Owner,
|
|
[string]$Repo,
|
|
[string]$Path,
|
|
[string]$Dest
|
|
) {
|
|
New-Item -ItemType Directory -Force -Path $Dest | Out-Null
|
|
$api = "https://api.github.com/repos/$Owner/$Repo/contents/$Path"
|
|
$items = Get-GitHubJson $api
|
|
|
|
foreach ($item in $items) {
|
|
if ($item.type -eq "file") {
|
|
$target = Join-Path $Dest $item.name
|
|
Invoke-WebRequest -Headers @{ "User-Agent" = "document-cleaning-skill-bootstrap" } -Uri $item.download_url -OutFile $target
|
|
continue
|
|
}
|
|
|
|
if ($item.type -eq "dir") {
|
|
Download-GitHubFolder -Owner $Owner -Repo $Repo -Path $item.path -Dest (Join-Path $Dest $item.name)
|
|
}
|
|
}
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path $DestRoot | Out-Null
|
|
|
|
foreach ($skill in $skills) {
|
|
$dest = Join-Path $DestRoot $skill.Name
|
|
if ((Test-Path $dest) -and -not $Force) {
|
|
Write-Host "Skipping $($skill.Name) because it already exists. Use -Force to reinstall."
|
|
continue
|
|
}
|
|
|
|
if (Test-Path $dest) {
|
|
Remove-Item -Recurse -Force -LiteralPath $dest
|
|
}
|
|
|
|
Download-GitHubFolder -Owner $skill.Owner -Repo $skill.Repo -Path $skill.Path -Dest $dest
|
|
Write-Host "Installed $($skill.Name) -> $dest"
|
|
}
|
|
|
|
Write-Host "Restart Codex to pick up new skills."
|