feat(update-skills): dual install target — ~/.claude/skills + ~/.agents/skills (agent-neutral); pi settings hack removed (v0.2.1)

This commit is contained in:
2026-08-12 21:43:00 +03:00
parent e431e9e142
commit 348f6f3108
7 changed files with 155 additions and 94 deletions

View File

@@ -22,7 +22,10 @@ $ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$skillsSrc = Join-Path $root 'skills'
$target = if ($env:CLAUDE_SKILLS_DIR) { $env:CLAUDE_SKILLS_DIR } else { Join-Path $env:USERPROFILE '.claude\skills' }
# Dual install targets — the "canon" is the git repo (skills/); both dirs are installs.
$targets = @()
if ($env:CLAUDE_SKILLS_DIR) { $targets += $env:CLAUDE_SKILLS_DIR } else { $targets += (Join-Path $env:USERPROFILE '.claude\skills') }
$targets += (Join-Path $env:USERPROFILE '.agents\skills')
$commonRoot = if ($env:COMMON_ROOT) { $env:COMMON_ROOT } else { Join-Path $env:USERPROFILE 'projects\.common' }
$metaMcp = Join-Path $commonRoot 'lib\projects-meta-mcp'
@@ -31,13 +34,15 @@ $internsMcp = Join-Path $commonRoot 'lib\interns-mcp'
# -- Collect before-versions --------------------------------------------------
$beforeVersions = @{}
if (Test-Path $target) {
Get-ChildItem -Path $target -Directory -ErrorAction SilentlyContinue | ForEach-Object {
$vf = Join-Path $_.FullName 'SKILL.md'
if (Test-Path $vf) {
$match = Select-String -Path $vf -Pattern '^version:\s*(\d+\.\d+\.\d+)' -ErrorAction SilentlyContinue | Select-Object -First 1
$ver = if ($match) { $match.Matches.Groups[1].Value } else { '?' }
$beforeVersions[$_.Name] = $ver
foreach ($target in $targets) {
if (Test-Path $target) {
Get-ChildItem -Path $target -Directory -ErrorAction SilentlyContinue | ForEach-Object {
$vf = Join-Path $_.FullName 'SKILL.md'
if (Test-Path $vf) {
$match = Select-String -Path $vf -Pattern '^version:\s*(\d+\.\d+\.\d+)' -ErrorAction SilentlyContinue | Select-Object -First 1
$ver = if ($match) { $match.Matches.Groups[1].Value } else { '?' }
$beforeVersions[$_.Name] = $ver
}
}
}
}
@@ -144,16 +149,18 @@ Write-Host "[ok] Skills installed." -ForegroundColor Green
Write-Host "[update] Version diff:" -ForegroundColor Cyan
$changes = $false
Get-ChildItem -Path $target -Directory -ErrorAction SilentlyContinue | ForEach-Object {
$vf = Join-Path $_.FullName 'SKILL.md'
if (Test-Path $vf) {
$match = Select-String -Path $vf -Pattern '^version:\s*(\d+\.\d+\.\d+)' -ErrorAction SilentlyContinue | Select-Object -First 1
$after = if ($match) { $match.Matches.Groups[1].Value } else { '?' }
$before = $beforeVersions[$_.Name]
if (-not $before) { $before = 'new' }
if ($before -ne $after) {
Write-Host " $before -> $after ($($_.Name))"
$changes = $true
foreach ($target in $targets) {
Get-ChildItem -Path $target -Directory -ErrorAction SilentlyContinue | ForEach-Object {
$vf = Join-Path $_.FullName 'SKILL.md'
if (Test-Path $vf) {
$match = Select-String -Path $vf -Pattern '^version:\s*(\d+\.\d+\.\d+)' -ErrorAction SilentlyContinue | Select-Object -First 1
$after = if ($match) { $match.Matches.Groups[1].Value } else { '?' }
$before = $beforeVersions[$_.Name]
if (-not $before) { $before = 'new' }
if ($before -ne $after) {
Write-Host " $before -> $after ($($_.Name))"
$changes = $true
}
}
}
}
@@ -166,9 +173,11 @@ if (-not $changes) {
$newSetup = @()
Get-ChildItem -Path $skillsSrc -Directory | ForEach-Object {
$name = $_.Name
if ($name -like 'setup-*' -and -not (Test-Path (Join-Path $target $name))) {
$newSetup += $name
$missing = $false
foreach ($target in $targets) {
if ($name -like 'setup-*' -and -not (Test-Path (Join-Path $target $name))) { $missing = $true }
}
if ($missing) { $newSetup += $name }
}
if ($newSetup.Count -gt 0) {