From 858b7eb6dc08efe3775cdd8f0ddd4e18872370de Mon Sep 17 00:00:00 2001 From: Myfro9 <36755290+Myfro9@users.noreply.github.com> Date: Wed, 23 Sep 2026 17:02:24 +0800 Subject: [PATCH] =?UTF-8?q?tools-sync:=20mirror=20=E9=98=B6=E6=AE=B5?= =?UTF-8?q?=E5=8F=AA=E9=93=BE=E6=8E=A5=E5=90=AB=20SKILL.md=20=E7=9A=84?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude Code 会把账号侧下发的 skills 缓存进 ~\.claude\skills\synced\\, 它不是 skill(顶层没有 SKILL.md),但内层目录各自带 SKILL.md。旧逻辑无条件 镜像主副本下的每个非点开头目录,于是给 Codex 建了 synced 的 junction —— Codex 递归扫到内层那批,会把账号已经提供的 skills 再注册一遍。 改为以顶层 SKILL.md 作为判据(与脚本自己 '\' 检查、以及 Codex 的注册 规则一致),并把被跳过的目录打印出来。 --- tools-sync/scripts/sync_repos.ps1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools-sync/scripts/sync_repos.ps1 b/tools-sync/scripts/sync_repos.ps1 index 19968cc..16f7542 100644 --- a/tools-sync/scripts/sync_repos.ps1 +++ b/tools-sync/scripts/sync_repos.ps1 @@ -376,8 +376,17 @@ if ($MirrorRegistry) { # A primary entry that is itself a link belongs to whichever host installed it (its real home # is a registry the host already exposes to Codex). Mirroring it would register it twice. - $primarySkills = Get-ChildItem $ClaudeSkills -Directory -Force | + $primaryDirs = Get-ChildItem $ClaudeSkills -Directory -Force | Where-Object { $_.Name -notlike ".*" -and -not (Test-IsLink $_) } + # A directory without SKILL.md at its top level is not a skill -- e.g. 'synced/', the + # runtime cache of account-side skills Claude Code downloads. Mirroring it is worse than + # useless: its NESTED directories do carry SKILL.md, so Codex would register that whole + # set a second time alongside the ones it already gets from the account. + $primarySkills = $primaryDirs | Where-Object { Test-Path (Join-Path $_.FullName "SKILL.md") } + $notSkills = $primaryDirs | Where-Object { -not (Test-Path (Join-Path $_.FullName "SKILL.md")) } + if ($notSkills) { + Write-Host " not skills (no SKILL.md), not mirrored: $(($notSkills | ForEach-Object Name) -join ', ')" + } foreach ($d in $primarySkills) { $link = Join-Path $MirrorRegistry $d.Name if (Test-Path $link) { continue }