v0.1.3:添加Windows PowerShell安装脚本install.ps1;更新README中英文文档添加Windows安装说明及双平台参数对照表。

This commit is contained in:
GuDaStudio
2025-12-17 14:15:36 +08:00
parent 862534a89a
commit 82654451fb
3 changed files with 282 additions and 18 deletions

View File

@@ -49,6 +49,9 @@ cd skills
提供安装脚本,支持灵活选择安装范围和目标位置。 提供安装脚本,支持灵活选择安装范围和目标位置。
<details open>
<summary><b>Linux / macOS</b></summary>
**查看可用 Skills** **查看可用 Skills**
```bash ```bash
@@ -81,18 +84,57 @@ cd skills
./install.sh --target /your/custom/path --all ./install.sh --target /your/custom/path --all
``` ```
</details>
<details open>
<summary><b>Windows (PowerShell)</b></summary>
**查看可用 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
```
</details>
<details> <details>
<summary>点击查看完整参数说明</summary> <summary>点击查看完整参数说明</summary>
| 参数 | 简写 | 说明 | | 参数 (Bash) | 参数 (PowerShell) | 简写 | 说明 |
|------|------|------| |-------------|-------------------|------|------|
| `--user` | `-u` | 安装到用户级目录 (`~/.claude/skills/`) | | `--user` | `-User` | `-u` | 安装到用户级目录 (`~/.claude/skills/`) |
| `--project` | `-p` | 安装到项目级目录 (`./.claude/skills/`) | | `--project` | `-Project` | `-p` | 安装到项目级目录 (`./.claude/skills/`) |
| `--target <path>` | `-t` | 安装到自定义路径 | | `--target <path>` | `-Target <path>` | `-t` | 安装到自定义路径 |
| `--all` | `-a` | 安装所有可用 Skills | | `--all` | `-All` | `-a` | 安装所有可用 Skills |
| `--skill <name>` | `-s` | 安装指定 Skill可多次使用 | | `--skill <name>` | `-Skill <name>` | `-s` | 安装指定 Skill可多次使用 |
| `--list` | `-l` | 列出所有可用 Skills | | `--list` | `-List` | `-l` | 列出所有可用 Skills |
| `--help` | `-h` | 显示帮助信息 | | `--help` | `-Help` | `-h` | 显示帮助信息 |
</details> </details>

View File

@@ -49,6 +49,9 @@ cd skills
The install script provides flexible options for scope and target location. The install script provides flexible options for scope and target location.
<details open>
<summary><b>Linux / macOS</b></summary>
**List available Skills:** **List available Skills:**
```bash ```bash
@@ -81,18 +84,57 @@ The install script provides flexible options for scope and target location.
./install.sh --target /your/custom/path --all ./install.sh --target /your/custom/path --all
``` ```
</details>
<details open>
<summary><b>Windows (PowerShell)</b></summary>
**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
```
</details>
<details> <details>
<summary>Click to view full parameter reference</summary> <summary>Click to view full parameter reference</summary>
| Parameter | Short | Description | | Parameter (Bash) | Parameter (PowerShell) | Short | Description |
|-----------|-------|-------------| |------------------|------------------------|-------|-------------|
| `--user` | `-u` | Install to user-level directory (`~/.claude/skills/`) | | `--user` | `-User` | `-u` | Install to user-level directory (`~/.claude/skills/`) |
| `--project` | `-p` | Install to project-level directory (`./.claude/skills/`) | | `--project` | `-Project` | `-p` | Install to project-level directory (`./.claude/skills/`) |
| `--target <path>` | `-t` | Install to custom path | | `--target <path>` | `-Target <path>` | `-t` | Install to custom path |
| `--all` | `-a` | Install all available Skills | | `--all` | `-All` | `-a` | Install all available Skills |
| `--skill <name>` | `-s` | Install specific Skill (can be used multiple times) | | `--skill <name>` | `-Skill <name>` | `-s` | Install specific Skill (can be used multiple times) |
| `--list` | `-l` | List all available Skills | | `--list` | `-List` | `-l` | List all available Skills |
| `--help` | `-h` | Show help message | | `--help` | `-Help` | `-h` | Show help message |
</details> </details>

180
install.ps1 Normal file
View File

@@ -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 <path> Install to custom target path"
Write-Host " -All, -a Install all available skills"
Write-Host " -Skill, -s <name> 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"