From 3ea09a1cddd6a24b39e8cdc6783fddcc2d214f29 Mon Sep 17 00:00:00 2001 From: "ken.li" Date: Mon, 2 Feb 2026 15:38:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(skill-sync):=20=E6=89=A9=E5=B1=95=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E5=90=8C=E6=AD=A5=E5=8A=9F=E8=83=BD=E4=BB=A5=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=A4=9A=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新技能同步功能,支持将项目中的技能同步到多个全局目录(Claude、Trae 和 Trae-CN) 修改同步脚本以处理多个目标目录,并添加相应的文档说明 --- skills/g3fo-docs/SKILL.md | 9 ++++++- skills/skill-sync/SKILL.md | 15 +++++++---- skills/skill-sync/scripts/sync.ps1 | 41 ++++++++++++++++++++---------- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/skills/g3fo-docs/SKILL.md b/skills/g3fo-docs/SKILL.md index 4b47176..8e28134 100644 --- a/skills/g3fo-docs/SKILL.md +++ b/skills/g3fo-docs/SKILL.md @@ -13,6 +13,7 @@ description: g3fo 系统相关文档。管理业务流程说明、服务职责 - **查架构概览**:查阅 `references/architecture/domain_overview.md`。 - **分析测试流程**:参考 `references/business_flows/_TEST_FLOW_TEMPLATE.md`。 - **查标准运维流程**:去 `references/middleware/` 或 `references/system-init/`。 +- **查中间件总览/高可用架构**:查阅 `references/middleware/middleware-comprehensive-guide.md`。 - **查具体环境/客户资产**: - 内部环境(Dev/UAT):查阅 `references/inventory/internal.md`。 - 外部客户(客户A、B等):查阅 `references/inventory/clients/[客户名].md`。 @@ -67,6 +68,7 @@ description: g3fo 系统相关文档。管理业务流程说明、服务职责 - “`g3fo-margin-service` 负责哪些核心逻辑?它的上下游依赖是谁?” - **部署配置**: - “请结合 `references/inventory/internal.md` 中的 `UAT` 环境变量,参考 `references/middleware/keepalived/deploy.md` 部署文档,为我生成 Node A 的 `keepalived.conf` 配置文件。” + - “请根据 `references/middleware/middleware-comprehensive-guide.md` 和 `references/middleware/nacos/deploy.md`,结合客户资产清单生成 Nacos 部署配置。” - **故障排查**: - “我的 MySQL 出现了复制冲突,报错 `Duplicate entry`,请根据 `references/middleware/mysql/fault-analysis.md` 提供排查脚本 and 修复建议。” @@ -75,9 +77,14 @@ description: g3fo 系统相关文档。管理业务流程说明、服务职责 - **服务职责**: `services/` (g3fo-trade-service, g3fo-margin-service 等) - **跨服务流程**: `business_flows/` (订单生命周期等) - **架构概览**: `architecture/domain_overview.md` -- **中间件标准**: +- **中间件标准**(部署/故障分析等详见各子目录): + - **总览**:`middleware/middleware-comprehensive-guide.md` - **Keepalived**: `middleware/keepalived/` - **MySQL**: `middleware/mysql/` + - **Nacos**: `middleware/nacos/` + - **PowerJob**: `middleware/powerjob/` - **Redis**: `middleware/redis/` + - **RocketMQ**: `middleware/rocketmq/` + - **Stunnel4**: `middleware/stunnel4/` - **系统规范**: 内核优化, 安全加固... - **资产清单**: 内部测试机, 客户生产环境... diff --git a/skills/skill-sync/SKILL.md b/skills/skill-sync/SKILL.md index ded225a..4625109 100644 --- a/skills/skill-sync/SKILL.md +++ b/skills/skill-sync/SKILL.md @@ -1,21 +1,26 @@ --- name: skill-sync -description: Synchronize skills from the current project to the global Claude skills directory (~/.claude/skills). Use this when you have modified skills in the project and want to update the global installation. Supports Windows 11. +description: Synchronize skills from the current project to multiple global skills directories (~/.claude/skills, ~/.trae/skills, ~/.trae-cn/skills). Use this when you have modified skills in the project and want to update the global installations. Supports Windows 11. --- # Skill Sync -Synchronize skills from the project's `skills/` directory to the global Claude environment. +Synchronize skills from the project's `skills/` directory to multiple global environments (Claude, Trae, and Trae-CN). ## Workflow ### 1. Synchronize All Skills -When changes are made to skills within this project, run the synchronization script to update the global installation. +When changes are made to skills within this project, run the synchronization script to update all global installations. - **Operation**: Run `powershell -ExecutionPolicy Bypass -File skills/skill-sync/scripts/sync.ps1` -- **Effect**: All skill directories in `skills/` will be copied to `~\.claude\skills`. Existing skills in the target directory will be updated, while additional skills in the target that are not in the project remain untouched. +- **Effect**: All skill directories in `skills/` will be copied to the following locations: + - `~\.claude\skills` (Claude) + - `~\.trae\skills` (Trae) + - `~\.trae-cn\skills` (Trae-CN) + + Existing skills in the target directories will be updated, while additional skills in the targets that are not in the project remain untouched. ## Resources ### scripts/ -- `sync.ps1`: PowerShell script for synchronizing skill directories to the global Claude skills folder. +- `sync.ps1`: PowerShell script for synchronizing skill directories to multiple global skills folders (Claude, Trae, and Trae-CN). diff --git a/skills/skill-sync/scripts/sync.ps1 b/skills/skill-sync/scripts/sync.ps1 index 6448af1..0a7b8aa 100644 --- a/skills/skill-sync/scripts/sync.ps1 +++ b/skills/skill-sync/scripts/sync.ps1 @@ -2,27 +2,40 @@ $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 +# 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" } +) -if (-not (Test-Path $GlobalSkillsDir)) { - Write-Host "Global skills directory does not exist. Creating it..." -ForegroundColor Yellow - New-Item -ItemType Directory -Path $GlobalSkillsDir -Force -} +Write-Host "Syncing skills from $ProjectSkillsDir..." -ForegroundColor Cyan # 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 +foreach ($DirConfig in $GlobalSkillsDirs) { + $PlatformName = $DirConfig.Name + $TargetBaseDir = $DirConfig.Path - Write-Host "Syncing skill: $SkillName..." -ForegroundColor Green + Write-Host "`nSyncing to $PlatformName skills directory: $TargetBaseDir..." -ForegroundColor Magenta - # Sync the skill directory - # Note: Copy-Item -Recurse -Force will overwrite existing files - Copy-Item -Path $Skill.FullName -Destination $GlobalSkillsDir -Recurse -Force + 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 + } } -Write-Host "Sync completed successfully." -ForegroundColor Green +Write-Host "`nSync completed successfully to all platforms!" -ForegroundColor Green