2026-01-16 17:44:35 +08:00
|
|
|
# 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
|
|
|
|
|
|
2026-02-02 15:38:16 +08:00
|
|
|
# Define global skills directories for different platforms
|
|
|
|
|
$GlobalSkillsDirs = @(
|
|
|
|
|
@{ Name = "Claude"; Path = Join-Path $HOME ".claude\skills" }
|
|
|
|
|
@{ Name = "Trae"; Path = Join-Path $HOME ".trae\skills" }
|
|
|
|
|
@{ Name = "Trae-CN"; Path = Join-Path $HOME ".trae-cn\skills" }
|
|
|
|
|
)
|
2026-01-16 17:44:35 +08:00
|
|
|
|
2026-02-02 15:38:16 +08:00
|
|
|
Write-Host "Syncing skills from $ProjectSkillsDir..." -ForegroundColor Cyan
|
2026-01-16 17:44:35 +08:00
|
|
|
|
|
|
|
|
# Get all skill directories in the project
|
|
|
|
|
$Skills = Get-ChildItem -Path $ProjectSkillsDir -Directory
|
|
|
|
|
|
2026-02-02 15:38:16 +08:00
|
|
|
foreach ($DirConfig in $GlobalSkillsDirs) {
|
|
|
|
|
$PlatformName = $DirConfig.Name
|
|
|
|
|
$TargetBaseDir = $DirConfig.Path
|
2026-01-16 17:44:35 +08:00
|
|
|
|
2026-02-02 15:38:16 +08:00
|
|
|
Write-Host "`nSyncing to $PlatformName skills directory: $TargetBaseDir..." -ForegroundColor Magenta
|
2026-01-16 17:44:35 +08:00
|
|
|
|
2026-02-02 15:38:16 +08:00
|
|
|
if (-not (Test-Path $TargetBaseDir)) {
|
|
|
|
|
Write-Host "$PlatformName skills directory does not exist. Creating it..." -ForegroundColor Yellow
|
|
|
|
|
New-Item -ItemType Directory -Path $TargetBaseDir -Force
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($Skill in $Skills) {
|
|
|
|
|
$SkillName = $Skill.Name
|
|
|
|
|
$TargetDir = Join-Path $TargetBaseDir $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 $TargetBaseDir -Recurse -Force
|
|
|
|
|
}
|
2026-01-16 17:44:35 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-02 15:38:16 +08:00
|
|
|
Write-Host "`nSync completed successfully to all platforms!" -ForegroundColor Green
|