-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.ps1
More file actions
277 lines (244 loc) · 12.7 KB
/
Copy pathsetup.ps1
File metadata and controls
277 lines (244 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# =============================================================================
# Setup & Update - AI Project Rules Generator
# =============================================================================
# Install: irm <raw-url>/setup.ps1 | iex
# Update: .\setup.ps1 -Update
# =============================================================================
param(
[switch]$Update,
[switch]$NonInteractive,
[switch]$Verbose,
[string]$SkillSource,
[string]$SkillRoot = ".agent",
[switch]$Uninstall
)
$ErrorActionPreference = "Stop"
$RepoRaw = "https://raw.githubusercontent.com/naravid19/ai-project-rules-generator/main"
$WorkflowFile = "SKILL.md"
function Write-Log([string]$msg) {
if ($Verbose) {
Write-Host "[DEBUG] $msg" -ForegroundColor DarkGray
}
}
function Get-WorkflowVersion {
param([string]$Path)
$version = "unknown"
$match = Select-String -Path $Path -Pattern '^version:\s*(\d+\.\d+(\.\d+)?)' | Select-Object -First 1
if ($match -and $match.Line -match '^version:\s*(\d+\.\d+(\.\d+)?)') {
$version = "v$($Matches[1])"
}
return $version
}
function Update-OrCloneRepo {
param(
[string]$RepoUrl,
[string]$TargetPath,
[string]$Label
)
if (Test-Path "$TargetPath/.git") {
Write-Host "Updating $Label..." -ForegroundColor Yellow
git -C $TargetPath pull --ff-only
return
}
if (Test-Path $TargetPath) {
$items = Get-ChildItem -Force -Path $TargetPath -ErrorAction SilentlyContinue
if ($items.Count -gt 0) {
Write-Host "Skip ${Label}: target exists and is not an empty git repo ($TargetPath)." -ForegroundColor DarkGray
return
}
}
Write-Host "Cloning $Label..." -ForegroundColor Yellow
git clone --depth 1 $RepoUrl $TargetPath
}
function Install-Skill {
param([string]$Key)
switch ($Key) {
"antigravity" {
Update-OrCloneRepo -RepoUrl "https://github.com/sickn33/antigravity-awesome-skills.git" -TargetPath (Join-Path $SkillRoot "skills") -Label "sickn33/antigravity-awesome-skills"
}
"claude" {
Update-OrCloneRepo -RepoUrl "https://github.com/ComposioHQ/awesome-claude-skills.git" -TargetPath (Join-Path $SkillRoot "awesome-claude-skills") -Label "ComposioHQ/awesome-claude-skills"
}
"anthropic" {
Update-OrCloneRepo -RepoUrl "https://github.com/anthropics/skills.git" -TargetPath (Join-Path $SkillRoot "anthropic-skills") -Label "anthropics/skills"
}
"techleads" {
Update-OrCloneRepo -RepoUrl "https://github.com/tech-leads-club/agent-skills.git" -TargetPath (Join-Path $SkillRoot "techleads-agent-skills") -Label "tech-leads-club/agent-skills"
}
"jeffallan" {
Update-OrCloneRepo -RepoUrl "https://github.com/Jeffallan/claude-skills.git" -TargetPath (Join-Path $SkillRoot "jeffallan-claude-skills") -Label "Jeffallan/claude-skills"
}
"ui-ux-pro-max" {
Update-OrCloneRepo -RepoUrl "https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git" -TargetPath (Join-Path $SkillRoot "ui-ux-pro-max-skill") -Label "nextlevelbuilder/ui-ux-pro-max-skill"
}
"othmanadi" {
Update-OrCloneRepo -RepoUrl "https://github.com/OthmanAdi/planning-with-files.git" -TargetPath (Join-Path $SkillRoot "othman-planning-with-files") -Label "OthmanAdi/planning-with-files"
}
"scientific" {
Update-OrCloneRepo -RepoUrl "https://github.com/K-Dense-AI/claude-scientific-skills.git" -TargetPath (Join-Path $SkillRoot "claude-scientific-skills") -Label "K-Dense-AI/claude-scientific-skills"
}
"karpathy" {
Update-OrCloneRepo -RepoUrl "https://github.com/forrestchang/andrej-karpathy-skills.git" -TargetPath (Join-Path $SkillRoot "andrej-karpathy-skills") -Label "forrestchang/andrej-karpathy-skills"
}
"superpowers" {
Update-OrCloneRepo -RepoUrl "https://github.com/obra/superpowers.git" -TargetPath (Join-Path $SkillRoot "superpowers-skills") -Label "obra/superpowers"
}
"all" {
$keys = @("antigravity", "claude", "anthropic", "techleads", "jeffallan", "ui-ux-pro-max", "othmanadi", "scientific", "karpathy", "superpowers")
foreach ($k in $keys) { Install-Skill -Key $k }
}
default {
Write-Host "Unknown skill source: $Key. Options: antigravity, claude, anthropic, techleads, jeffallan, ui-ux-pro-max, othmanadi, scientific, karpathy, superpowers, all" -ForegroundColor Red
}
}
}
# ─── Prerequisite Check ──────────────────────────────────────────────────────
function Test-Prerequisites {
# Check Git
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
Write-Host "❌ Git is required but not found." -ForegroundColor Red
Write-Host " Install from: https://git-scm.com/downloads" -ForegroundColor Yellow
Write-Host " Or via winget: winget install Git.Git" -ForegroundColor Yellow
exit 1
}
Write-Log "Git found: $(git --version)"
# Check internet connectivity
try {
$null = Invoke-WebRequest -Uri "https://github.com" -TimeoutSec 5 -UseBasicParsing -ErrorAction Stop
Write-Log "Internet connectivity OK"
}
catch {
Write-Host "❌ Cannot reach GitHub. Check your internet connection." -ForegroundColor Red
exit 1
}
}
# ─── Uninstall ───────────────────────────────────────────────────────────────
if ($Uninstall) {
Write-Host "AI Project Rules Generator - Uninstall" -ForegroundColor Cyan
Write-Host "=======================================" -ForegroundColor Cyan
Write-Host ""
$filesToRemove = @(
$WorkflowFile,
"$WorkflowFile.backup"
)
foreach ($file in $filesToRemove) {
if (Test-Path $file) {
Remove-Item $file -Force
Write-Host " Removed: $file" -ForegroundColor Yellow
}
}
# Check if .agent is empty
if ((Test-Path ".agent") -and
(Get-ChildItem ".agent" -ErrorAction SilentlyContinue).Count -eq 0) {
Remove-Item ".agent" -Force
Write-Host " Removed empty: .agent/" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "Uninstall complete." -ForegroundColor Green
Write-Host "Note: Skill sources (.agent/skills/, shared SkillRoot paths, etc.) were NOT removed." -ForegroundColor DarkGray
Write-Host " Remove them manually if desired." -ForegroundColor DarkGray
Write-Host "=======================================" -ForegroundColor Cyan
exit 0
}
# ─── Update ──────────────────────────────────────────────────────────────────
if ($Update) {
Write-Host "AI Project Rules Generator - Update" -ForegroundColor Cyan
Write-Host "===================================" -ForegroundColor Cyan
Write-Host ""
Test-Prerequisites
if (-not (Test-Path $WorkflowFile)) {
Write-Host "❌ Workflow not found at $WorkflowFile" -ForegroundColor Red
Write-Host "Run without -Update to install first."
exit 1
}
Copy-Item $WorkflowFile "$WorkflowFile.backup" -Force
Write-Host "Backed up current workflow to $WorkflowFile.backup" -ForegroundColor Yellow
Write-Host "Downloading latest workflow..." -ForegroundColor Yellow
Invoke-WebRequest -Uri "$RepoRaw/SKILL.md" -OutFile $WorkflowFile
$version = Get-WorkflowVersion -Path $WorkflowFile
Write-Host "✅ Workflow updated successfully." -ForegroundColor Green
Write-Host "Current version: $version"
Write-Host "Backup saved at: $WorkflowFile.backup"
Write-Host ""
Write-Host "Tip: Your .cursorrules and AGENTS.md are NOT affected." -ForegroundColor DarkGray
Write-Host "Re-run /create-project-rules to regenerate with latest workflow."
Write-Host "===================================" -ForegroundColor Cyan
exit 0
}
# ─── Install ─────────────────────────────────────────────────────────────────
Write-Host "AI Project Rules Generator - Quick Start Setup" -ForegroundColor Cyan
Write-Host "===============================================" -ForegroundColor Cyan
Write-Host ""
Test-Prerequisites
Write-Host "Creating .agent/ directory structure..." -ForegroundColor Yellow
New-Item -ItemType Directory -Force -Path $SkillRoot | Out-Null
if ($SkillRoot -ne ".agent") {
Write-Host "Using shared skill root: $SkillRoot" -ForegroundColor DarkGray
Write-Host "Keeping workflow local at $WorkflowFile" -ForegroundColor DarkGray
}
Write-Host "Downloading workflow..." -ForegroundColor Yellow
Invoke-WebRequest -Uri "$RepoRaw/SKILL.md" -OutFile $WorkflowFile
$version = Get-WorkflowVersion -Path $WorkflowFile
Write-Host "✅ Workflow installed at $WorkflowFile (version: $version)" -ForegroundColor Green
Write-Host ""
# ─── Skill Source Selection ──────────────────────────────────────────────────
if ($SkillSource) {
# Direct skill source via parameter
Install-Skill -Key $SkillSource.ToLower()
}
elseif ($NonInteractive) {
Write-Host "Non-interactive mode: skipping skill source selection." -ForegroundColor DarkGray
Write-Host "Use -SkillSource <name> to install skill sources." -ForegroundColor DarkGray
Write-Host "Use -SkillRoot <path> to install sources into a shared skill root." -ForegroundColor DarkGray
}
else {
Write-Host "Recommended skill sources (optional):" -ForegroundColor Cyan
Write-Host "Install root for skill sources: $SkillRoot" -ForegroundColor DarkGray
Write-Host " 1) sickn33 / antigravity-awesome-skills (CATALOG, large catalog index)"
Write-Host " 2) ComposioHQ / awesome-claude-skills (FOLDER, community skill packs)"
Write-Host " 3) anthropics / skills (FOLDER, official Anthropic skills)"
Write-Host " 4) tech-leads-club / agent-skills (FOLDER, curated registry)"
Write-Host " 5) Jeffallan / claude-skills (FOLDER, broad full-stack set)"
Write-Host " 6) nextlevelbuilder / ui-ux-pro-max (WORKFLOW, UI/UX design intel)"
Write-Host " 7) OthmanAdi / planning-with-files (FOLDER, planning persistence)"
Write-Host " 8) K-Dense-AI / claude-scientific-skills (FOLDER, scientific/research workflows)"
Write-Host " 9) forrestchang / andrej-karpathy-skills (FOLDER, Andrej Karpathy's skills/workflows)"
Write-Host " 10) obra / superpowers (FOLDER, advanced agent skills)"
Write-Host " 11) All of the above"
Write-Host " 12) Skip (add your own later)"
Write-Host ""
$choice = Read-Host "Choose [1-12]"
switch ($choice) {
"1" { Install-Skill -Key "antigravity" }
"2" { Install-Skill -Key "claude" }
"3" { Install-Skill -Key "anthropic" }
"4" { Install-Skill -Key "techleads" }
"5" { Install-Skill -Key "jeffallan" }
"6" { Install-Skill -Key "ui-ux-pro-max" }
"7" { Install-Skill -Key "othmanadi" }
"8" { Install-Skill -Key "scientific" }
"9" { Install-Skill -Key "karpathy" }
"10" { Install-Skill -Key "superpowers" }
"11" { Install-Skill -Key "all" }
"12" { Write-Host "Skipping skill source installation." -ForegroundColor DarkGray }
default { Write-Host "Invalid choice, skipping skill source installation." -ForegroundColor DarkGray }
}
}
Write-Host ""
Write-Host "===============================================" -ForegroundColor Cyan
Write-Host "✅ Setup complete." -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:"
Write-Host " 1) Open your project in your AI assistant"
Write-Host " 2) Run: /create-project-rules"
Write-Host " 3) Get tailored .cursorrules + AGENTS.md"
Write-Host ""
Write-Host "Options:"
Write-Host " Update: .\setup.ps1 -Update" -ForegroundColor Blue
Write-Host " Uninstall: .\setup.ps1 -Uninstall" -ForegroundColor Blue
Write-Host " CI/CD mode: .\setup.ps1 -NonInteractive -SkillSource all" -ForegroundColor Blue
Write-Host " Shared root: .\setup.ps1 -SkillSource all -SkillRoot C:\Shared\.agent" -ForegroundColor Blue
Write-Host " Verbose: .\setup.ps1 -Verbose" -ForegroundColor Blue
Write-Host ""
Write-Host "Docs: https://github.com/naravid19/ai-project-rules-generator" -ForegroundColor Blue
Write-Host "===============================================" -ForegroundColor Cyan