From 82654451fb9c615f85db3c3813329ea4e64b1e22 Mon Sep 17 00:00:00 2001 From: GuDaStudio Date: Wed, 17 Dec 2025 14:15:36 +0800 Subject: [PATCH] =?UTF-8?q?v0.1.3=EF=BC=9A=E6=B7=BB=E5=8A=A0Windows=20Powe?= =?UTF-8?q?rShell=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=ACinstall.ps1=EF=BC=9B?= =?UTF-8?q?=E6=9B=B4=E6=96=B0README=E4=B8=AD=E8=8B=B1=E6=96=87=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E6=B7=BB=E5=8A=A0Windows=E5=AE=89=E8=A3=85=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E5=8F=8A=E5=8F=8C=E5=B9=B3=E5=8F=B0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=AF=B9=E7=85=A7=E8=A1=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 60 +++++++++++++--- docs/README_EN.md | 60 +++++++++++++--- install.ps1 | 180 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 282 insertions(+), 18 deletions(-) create mode 100644 install.ps1 diff --git a/README.md b/README.md index 3967134..b52ed22 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,9 @@ cd skills 提供安装脚本,支持灵活选择安装范围和目标位置。 +
+Linux / macOS + **查看可用 Skills:** ```bash @@ -81,18 +84,57 @@ cd skills ./install.sh --target /your/custom/path --all ``` +
+ +
+Windows (PowerShell) + +**查看可用 Skills:** + +```powershell +.\install.ps1 -List +``` + +**方式一:一键安装所有 Skills** + +```powershell +# 用户级安装(所有项目生效) +.\install.ps1 -User -All + +# 项目级安装(仅当前项目生效,需在项目根目录执行) +.\install.ps1 -Project -All +``` + +**方式二:选择性安装** + +```powershell +# 仅安装 collaborating-with-codex +.\install.ps1 -User -Skill collaborating-with-codex + +# 安装多个指定 Skill +.\install.ps1 -User -Skill collaborating-with-codex -Skill collaborating-with-gemini +``` + +**方式三:自定义安装路径** + +```powershell +.\install.ps1 -Target C:\your\custom\path -All +``` + +
+
点击查看完整参数说明 -| 参数 | 简写 | 说明 | -|------|------|------| -| `--user` | `-u` | 安装到用户级目录 (`~/.claude/skills/`) | -| `--project` | `-p` | 安装到项目级目录 (`./.claude/skills/`) | -| `--target ` | `-t` | 安装到自定义路径 | -| `--all` | `-a` | 安装所有可用 Skills | -| `--skill ` | `-s` | 安装指定 Skill(可多次使用) | -| `--list` | `-l` | 列出所有可用 Skills | -| `--help` | `-h` | 显示帮助信息 | +| 参数 (Bash) | 参数 (PowerShell) | 简写 | 说明 | +|-------------|-------------------|------|------| +| `--user` | `-User` | `-u` | 安装到用户级目录 (`~/.claude/skills/`) | +| `--project` | `-Project` | `-p` | 安装到项目级目录 (`./.claude/skills/`) | +| `--target ` | `-Target ` | `-t` | 安装到自定义路径 | +| `--all` | `-All` | `-a` | 安装所有可用 Skills | +| `--skill ` | `-Skill ` | `-s` | 安装指定 Skill(可多次使用) | +| `--list` | `-List` | `-l` | 列出所有可用 Skills | +| `--help` | `-Help` | `-h` | 显示帮助信息 |
diff --git a/docs/README_EN.md b/docs/README_EN.md index a2d9e72..9f49239 100644 --- a/docs/README_EN.md +++ b/docs/README_EN.md @@ -49,6 +49,9 @@ cd skills The install script provides flexible options for scope and target location. +
+Linux / macOS + **List available Skills:** ```bash @@ -81,18 +84,57 @@ The install script provides flexible options for scope and target location. ./install.sh --target /your/custom/path --all ``` +
+ +
+Windows (PowerShell) + +**List available Skills:** + +```powershell +.\install.ps1 -List +``` + +**Option 1: Install All Skills** + +```powershell +# User-level installation (available for all projects) +.\install.ps1 -User -All + +# Project-level installation (current project only, run from project root) +.\install.ps1 -Project -All +``` + +**Option 2: Selective Installation** + +```powershell +# Install only collaborating-with-codex +.\install.ps1 -User -Skill collaborating-with-codex + +# Install multiple specific Skills +.\install.ps1 -User -Skill collaborating-with-codex -Skill collaborating-with-gemini +``` + +**Option 3: Custom Installation Path** + +```powershell +.\install.ps1 -Target C:\your\custom\path -All +``` + +
+
Click to view full parameter reference -| Parameter | Short | Description | -|-----------|-------|-------------| -| `--user` | `-u` | Install to user-level directory (`~/.claude/skills/`) | -| `--project` | `-p` | Install to project-level directory (`./.claude/skills/`) | -| `--target ` | `-t` | Install to custom path | -| `--all` | `-a` | Install all available Skills | -| `--skill ` | `-s` | Install specific Skill (can be used multiple times) | -| `--list` | `-l` | List all available Skills | -| `--help` | `-h` | Show help message | +| Parameter (Bash) | Parameter (PowerShell) | Short | Description | +|------------------|------------------------|-------|-------------| +| `--user` | `-User` | `-u` | Install to user-level directory (`~/.claude/skills/`) | +| `--project` | `-Project` | `-p` | Install to project-level directory (`./.claude/skills/`) | +| `--target ` | `-Target ` | `-t` | Install to custom path | +| `--all` | `-All` | `-a` | Install all available Skills | +| `--skill ` | `-Skill ` | `-s` | Install specific Skill (can be used multiple times) | +| `--list` | `-List` | `-l` | List all available Skills | +| `--help` | `-Help` | `-h` | Show help message |
diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..4b3b90b --- /dev/null +++ b/install.ps1 @@ -0,0 +1,180 @@ +# GudaCC Skills Installer for Windows +# https://github.com/GuDaStudio/skills + +param( + [Alias("u")][switch]$User, + [Alias("p")][switch]$Project, + [Alias("t")][string]$Target, + [Alias("a")][switch]$All, + [Alias("s")][string[]]$Skill, + [Alias("l")][switch]$List, + [Alias("h")][switch]$Help +) + +$ErrorActionPreference = "Stop" +$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path +$AvailableSkills = @("collaborating-with-codex", "collaborating-with-gemini") + +function Write-ColorOutput { + param([string]$Text, [string]$Color = "White") + Write-Host $Text -ForegroundColor $Color +} + +function Show-Usage { + Write-ColorOutput "GudaCC Skills Installer" "Blue" + Write-Host "" + Write-Host "Usage: .\install.ps1 [OPTIONS]" + Write-Host "" + Write-Host "Options:" + Write-Host " -User, -u Install to user-level (~\.claude\skills\)" + Write-Host " -Project, -p Install to project-level (.\.claude\skills\)" + Write-Host " -Target, -t Install to custom target path" + Write-Host " -All, -a Install all available skills" + Write-Host " -Skill, -s Install specific skill (can be used multiple times)" + Write-Host " -List, -l List available skills" + Write-Host " -Help, -h Show this help message" + Write-Host "" + Write-Host "Examples:" + Write-Host " .\install.ps1 -User -All" + Write-Host " .\install.ps1 -Project -All" + Write-Host " .\install.ps1 -User -Skill collaborating-with-codex" + Write-Host " .\install.ps1 -User -Skill collaborating-with-codex -Skill collaborating-with-gemini" + Write-Host " .\install.ps1 -Target C:\custom\path -All" + Write-Host "" + Write-Host "Available skills:" + foreach ($s in $AvailableSkills) { + Write-Host " - $s" + } +} + +function Show-SkillList { + Write-ColorOutput "Available Skills:" "Blue" + Write-Host "" + foreach ($s in $AvailableSkills) { + $sourcePath = Join-Path $ScriptDir $s + if (Test-Path $sourcePath -PathType Container) { + Write-Host " " -NoNewline + Write-ColorOutput "✓" "Green" -NoNewline + Write-Host " $s" + } else { + Write-Host " " -NoNewline + Write-ColorOutput "✗" "Red" -NoNewline + Write-Host " $s (not found in source)" + } + } +} + +function Write-ColorOutput { + param( + [string]$Text, + [string]$Color = "White", + [switch]$NoNewline + ) + if ($NoNewline) { + Write-Host $Text -ForegroundColor $Color -NoNewline + } else { + Write-Host $Text -ForegroundColor $Color + } +} + +function Install-Skill { + param([string]$SkillName, [string]$TargetDir) + + $sourceDir = Join-Path $ScriptDir $SkillName + $destDir = Join-Path $TargetDir $SkillName + + if (-not (Test-Path $sourceDir -PathType Container)) { + Write-ColorOutput "Error: Skill '$SkillName' not found in source directory" "Red" + return $false + } + + Write-Host "Installing " -NoNewline + Write-ColorOutput "$SkillName" "Cyan" -NoNewline + Write-Host " -> $destDir" + + if (-not (Test-Path $TargetDir)) { + New-Item -ItemType Directory -Path $TargetDir -Force | Out-Null + } + + if (Test-Path $destDir) { + Write-ColorOutput " Removing existing installation..." "Yellow" + Remove-Item -Path $destDir -Recurse -Force + } + + Copy-Item -Path $sourceDir -Destination $destDir -Recurse + + $gitFile = Join-Path $destDir ".git" + if (Test-Path $gitFile -PathType Leaf) { + Remove-Item -Path $gitFile -Force + } + + Write-ColorOutput " ✓ Installed" "Green" + return $true +} + +if ($Help) { + Show-Usage + exit 0 +} + +if ($List) { + Show-SkillList + exit 0 +} + +$TargetPath = "" +if ($User) { + $TargetPath = Join-Path $env:USERPROFILE ".claude\skills" +} elseif ($Project) { + $TargetPath = ".\.claude\skills" +} elseif ($Target) { + $TargetPath = $Target +} + +if (-not $TargetPath) { + Write-ColorOutput "Error: Please specify installation target (-User, -Project, or -Target)" "Red" + Write-Host "" + Show-Usage + exit 1 +} + +if (-not $All -and (-not $Skill -or $Skill.Count -eq 0)) { + Write-ColorOutput "Error: Please specify skills to install (-All or -Skill)" "Red" + Write-Host "" + Show-Usage + exit 1 +} + +$SkillsToInstall = @() +if ($All) { + $SkillsToInstall = $AvailableSkills +} else { + $SkillsToInstall = $Skill +} + +foreach ($s in $SkillsToInstall) { + if ($s -notin $AvailableSkills) { + Write-ColorOutput "Error: Unknown skill '$s'" "Red" + Write-Host "Available skills: $($AvailableSkills -join ', ')" + exit 1 + } +} + +Write-ColorOutput "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" "Blue" +Write-ColorOutput "GudaCC Skills Installer" "Blue" +Write-ColorOutput "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" "Blue" +Write-Host "" +Write-Host "Target: " -NoNewline +Write-ColorOutput $TargetPath "Green" +Write-Host "Skills: " -NoNewline +Write-ColorOutput ($SkillsToInstall -join ", ") "Green" +Write-Host "" + +foreach ($s in $SkillsToInstall) { + Install-Skill -SkillName $s -TargetDir $TargetPath +} + +Write-Host "" +Write-ColorOutput "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" "Green" +Write-ColorOutput "Installation complete!" "Green" +Write-ColorOutput "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" "Green"