- Add install.ps1 (PowerShell one-liner) - Add install.bat (Batch script for double-click) - Update README.md with Windows instructions Co-Authored-By: Claude <noreply@anthropic.com>
79 lines
2.3 KiB
PowerShell
79 lines
2.3 KiB
PowerShell
# Claude Code Skills 安装脚本 (Windows)
|
||
# 用法: irm https://git.let5see.xyz/let5see/skills/raw/main/install.ps1 | iex
|
||
|
||
$ErrorActionPreference = "Stop"
|
||
|
||
$RepoUrl = "https://git.let5see.xyz/let5see/skills.git"
|
||
$TempDir = Join-Path $env:TEMP "skills-install-$(Get-Random)"
|
||
$SkillsDir = Join-Path $env:USERPROFILE ".claude\skills"
|
||
|
||
Write-Host "🚀 正在安装 Claude Code Skills..." -ForegroundColor Green
|
||
Write-Host ""
|
||
|
||
# 检查 git 是否安装
|
||
Write-Host "🔍 检查 Git..." -ForegroundColor Yellow
|
||
try {
|
||
$null = git --version
|
||
Write-Host " ✓ Git 已安装" -ForegroundColor Green
|
||
} catch {
|
||
Write-Host " ✗ 未找到 Git,请先安装 Git: https://git-scm.com/download/win" -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
|
||
# 创建临时目录
|
||
Write-Host "📦 下载 skills..." -ForegroundColor Yellow
|
||
New-Item -ItemType Directory -Path $TempDir -Force | Out-Null
|
||
|
||
# 克隆仓库
|
||
try {
|
||
git clone "$RepoUrl" "$TempDir" --depth 1 --quiet
|
||
Write-Host " ✓ 下载完成" -ForegroundColor Green
|
||
} catch {
|
||
Write-Host " ✗ 下载失败: $_" -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
|
||
# 确保 skills 目录存在
|
||
New-Item -ItemType Directory -Path $SkillsDir -Force | Out-Null
|
||
|
||
# 复制所有 skills
|
||
Write-Host "📋 安装 skills..." -ForegroundColor Yellow
|
||
|
||
$skillDirs = Get-ChildItem -Path $TempDir -Directory
|
||
$installedCount = 0
|
||
|
||
foreach ($skillDir in $skillDirs) {
|
||
$skillName = $skillDir.Name
|
||
$skillMd = Join-Path $skillDir.FullName "SKILL.md"
|
||
|
||
if (Test-Path $skillMd) {
|
||
$destPath = Join-Path $SkillsDir $skillName
|
||
|
||
# 如果已存在,先删除
|
||
if (Test-Path $destPath) {
|
||
Remove-Item -Recurse -Force $destPath
|
||
}
|
||
|
||
Copy-Item -Recurse -Force $skillDir.FullName $destPath
|
||
Write-Host " ✓ $skillName" -ForegroundColor Green
|
||
$installedCount++
|
||
} else {
|
||
Write-Host " ⚠ 跳过 $skillName (缺少 SKILL.md)" -ForegroundColor Yellow
|
||
}
|
||
}
|
||
|
||
# 清理临时文件
|
||
Remove-Item -Recurse -Force $TempDir
|
||
|
||
Write-Host ""
|
||
Write-Host "✅ 安装完成!" -ForegroundColor Green
|
||
Write-Host ""
|
||
Write-Host "已安装 $installedCount 个 skills:" -ForegroundColor Cyan
|
||
|
||
Get-ChildItem -Path $SkillsDir -Directory | ForEach-Object {
|
||
Write-Host " - $($_.Name)" -ForegroundColor White
|
||
}
|
||
|
||
Write-Host ""
|
||
Write-Host "提示: 重启 Claude Code 以加载新的 skills" -ForegroundColor Yellow
|