Files
agent-skills/skills/skill-sync/scripts/sync.ps1
T

29 lines
1.1 KiB
PowerShell

# Get the current skill directory (the parent of the scripts folder)
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$SkillDir = Split-Path -Parent $ScriptDir
$ProjectSkillsDir = Split-Path -Parent $SkillDir
$GlobalSkillsDir = Join-Path $HOME ".claude\skills"
Write-Host "Syncing skills from $ProjectSkillsDir to $GlobalSkillsDir..." -ForegroundColor Cyan
if (-not (Test-Path $GlobalSkillsDir)) {
Write-Host "Global skills directory does not exist. Creating it..." -ForegroundColor Yellow
New-Item -ItemType Directory -Path $GlobalSkillsDir -Force
}
# Get all skill directories in the project
$Skills = Get-ChildItem -Path $ProjectSkillsDir -Directory
foreach ($Skill in $Skills) {
$SkillName = $Skill.Name
$TargetDir = Join-Path $GlobalSkillsDir $SkillName
Write-Host "Syncing skill: $SkillName..." -ForegroundColor Green
# Sync the skill directory
# Note: Copy-Item -Recurse -Force will overwrite existing files
Copy-Item -Path $Skill.FullName -Destination $GlobalSkillsDir -Recurse -Force
}
Write-Host "Sync completed successfully." -ForegroundColor Green