sillyspec 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.claude/commands/sillyspec/archive.md +63 -0
  2. package/.claude/commands/sillyspec/brainstorm.md +463 -0
  3. package/.claude/commands/sillyspec/continue.md +44 -0
  4. package/.claude/commands/sillyspec/execute.md +255 -0
  5. package/.claude/commands/sillyspec/explore.md +88 -0
  6. package/.claude/commands/sillyspec/export.md +53 -0
  7. package/.claude/commands/sillyspec/init.md +166 -0
  8. package/.claude/commands/sillyspec/plan.md +238 -0
  9. package/.claude/commands/sillyspec/propose.md +234 -0
  10. package/.claude/commands/sillyspec/quick.md +62 -0
  11. package/.claude/commands/sillyspec/resume.md +100 -0
  12. package/.claude/commands/sillyspec/scan.md +672 -0
  13. package/.claude/commands/sillyspec/status.md +122 -0
  14. package/.claude/commands/sillyspec/verify.md +141 -0
  15. package/.claude/commands/sillyspec/workspace.md +122 -0
  16. package/README.md +158 -0
  17. package/SKILL.md +46 -0
  18. package/adapters/adapters.sh +172 -0
  19. package/bin/sillyspec.js +2 -0
  20. package/commands/sillyspec/archive.md +62 -0
  21. package/commands/sillyspec/brainstorm.md +462 -0
  22. package/commands/sillyspec/continue.md +41 -0
  23. package/commands/sillyspec/execute.md +254 -0
  24. package/commands/sillyspec/explore.md +85 -0
  25. package/commands/sillyspec/export.md +51 -0
  26. package/commands/sillyspec/init.md +163 -0
  27. package/commands/sillyspec/plan.md +237 -0
  28. package/commands/sillyspec/propose.md +233 -0
  29. package/commands/sillyspec/quick.md +59 -0
  30. package/commands/sillyspec/resume.md +99 -0
  31. package/commands/sillyspec/scan.md +671 -0
  32. package/commands/sillyspec/status.md +119 -0
  33. package/commands/sillyspec/verify.md +140 -0
  34. package/commands/sillyspec/workspace.md +120 -0
  35. package/package.json +14 -0
  36. package/scripts/init.sh +2 -0
  37. package/scripts/install.ps1 +316 -0
  38. package/scripts/scan-preprocess.sh +378 -0
  39. package/scripts/validate-all.sh +50 -0
  40. package/scripts/validate-plan.sh +44 -0
  41. package/scripts/validate-proposal.sh +87 -0
  42. package/scripts/validate-scan.sh +90 -0
  43. package/src/index.js +560 -0
  44. package/src/init.js +269 -0
  45. package/templates/archive.md +58 -0
  46. package/templates/brainstorm.md +458 -0
  47. package/templates/continue.md +39 -0
  48. package/templates/execute.md +250 -0
  49. package/templates/explore.md +83 -0
  50. package/templates/export.md +48 -0
  51. package/templates/init.md +161 -0
  52. package/templates/plan.md +233 -0
  53. package/templates/propose.md +229 -0
  54. package/templates/quick.md +57 -0
  55. package/templates/resume.md +95 -0
  56. package/templates/scan.md +667 -0
  57. package/templates/status.md +117 -0
  58. package/templates/verify.md +136 -0
  59. package/templates/workspace.md +117 -0
@@ -0,0 +1,316 @@
1
+ <#
2
+ .SYNOPSIS
3
+ SillySpec v2.3 — Windows 一键安装
4
+ .DESCRIPTION
5
+ 从 GitHub 下载模板并生成对应 AI 工具的命令文件。
6
+ .PARAMETER Workspace
7
+ 启用多项目工作区模式
8
+ .PARAMETER Tool
9
+ 指定安装目标工具(claude/cursor/codex/opencode/openclaw)
10
+ .PARAMETER Dir
11
+ 指定安装目录(默认当前目录)
12
+ .EXAMPLE
13
+ powershell -c "irm https://raw.githubusercontent.com/q512426816/sillyspec/main/scripts/install.ps1 | iex"
14
+ powershell -c "irm https://raw.githubusercontent.com/q512426816/sillyspec/main/scripts/install.ps1 | iex; SillySpec-Install -Workspace"
15
+ powershell -c "irm https://raw.githubusercontent.com/q512426816/sillyspec/main/scripts/install.ps1 | iex; SillySpec-Install -Tool cursor -Workspace"
16
+ #>
17
+
18
+ $ErrorActionPreference = "Stop"
19
+
20
+ $REPO = "q512426816/sillyspec"
21
+ $BRANCH = "main"
22
+ $BASE = "https://raw.githubusercontent.com/$REPO/$BRANCH"
23
+ $VERSION = "2.3"
24
+
25
+ $COMMANDS = @("init","scan","explore","brainstorm","propose","plan","execute",
26
+ "verify","archive","status","continue","state","resume","quick",
27
+ "workspace","export")
28
+
29
+ # ── 主安装函数 ──
30
+
31
+ function Invoke-SillySpecInstall {
32
+ param([switch]$Workspace, [string[]]$Tool, [string]$Dir)
33
+
34
+ $UseWorkspace = $Workspace.IsPresent
35
+ $InstallDir = if ($Dir) { $Dir } else { (Get-Location).Path }
36
+ $ToolFilter = if ($Tool) { $Tool } else { @() }
37
+
38
+ if ($ToolFilter -contains "help") {
39
+ Write-Host @"
40
+ SillySpec v$VERSION 安装脚本
41
+
42
+ 用法:
43
+ SillySpec-Install [-Workspace] [-Tool <tool>] [-Dir <path>]
44
+
45
+ 参数:
46
+ -Workspace 启用多项目工作区模式
47
+ -Tool 指定目标工具: claude, claude_skills, cursor, codex, opencode, openclaw
48
+ 可多次指定: -Tool claude -Tool cursor
49
+ -Dir 指定安装目录(默认当前目录)
50
+ -Help 显示帮助
51
+
52
+ 示例:
53
+ SillySpec-Install # 自动检测工具,安装到当前目录
54
+ SillySpec-Install -Workspace # 工作区模式
55
+ SillySpec-Install -Tool cursor # 只安装 Cursor
56
+ SillySpec-Install -Dir D:\myproject # 安装到指定目录
57
+ SillySpec-Install -Tool claude -Tool cursor -Workspace
58
+ "@
59
+ return
60
+ }
61
+
62
+ # ── 切换到目标目录 ──
63
+
64
+ if (-not (Test-Path $InstallDir)) {
65
+ New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
66
+ }
67
+ Set-Location $InstallDir
68
+
69
+ # ── 元数据 ──
70
+
71
+ function Get-Desc($name) {
72
+ switch ($name) {
73
+ "init" { return "绿地项目初始化 — 深度提问、调研、需求文档、路线图" }
74
+ "scan" { return "代码库扫描 — 支持快速扫描和深度扫描两阶段" }
75
+ "explore" { return "自由思考模式 — 讨论、画图、调研,不写代码" }
76
+ "brainstorm" { return "需求探索 — 结构化头脑风暴,生成设计文档" }
77
+ "propose" { return "生成结构化规范 — proposal + design + tasks" }
78
+ "plan" { return "编写实现计划 — 精确到文件路径和代码" }
79
+ "execute" { return "波次执行 — 子代理并行 + 强制 TDD + 两阶段审查" }
80
+ "verify" { return "验证实现 — 对照规范检查 + 测试套件" }
81
+ "archive" { return "归档变更 — 规范沉淀,可追溯" }
82
+ "status" { return "查看项目进度和状态" }
83
+ "continue" { return "自动判断并执行下一步" }
84
+ "state" { return "查看当前工作状态 — 显示 STATE.md 内容" }
85
+ "resume" { return "恢复工作 — 从 STATE.md 读取进度" }
86
+ "quick" { return "快速任务 — 跳过完整流程,直接做" }
87
+ "workspace" { return "工作区管理 — 多项目工作区" }
88
+ "export" { return "导出成功方案为可复用模板" }
89
+ default { return "SillySpec $name" }
90
+ }
91
+ }
92
+
93
+ function Get-ArgHint($name) {
94
+ switch ($name) {
95
+ "init" { return "[项目名]" }
96
+ "scan" { return "[可选:指定区域] [--deep 深度扫描]" }
97
+ "explore" { return "[探索主题]" }
98
+ "brainstorm" { return "[需求或想法描述]" }
99
+ "propose" { return "[变更名]" }
100
+ "plan" { return "[计划名]" }
101
+ "execute" { return "[任务编号或 'all']" }
102
+ "verify" { return "[可选:指定验证范围]" }
103
+ "archive" { return "[变更名]" }
104
+ "state" { return "" }
105
+ "quick" { return "[任务描述]" }
106
+ "workspace" { return "[可选:add/remove/status/info]" }
107
+ "export" { return "<change-name> [--to <path>]" }
108
+ default { return "" }
109
+ }
110
+ }
111
+
112
+ # ── 下载模板 ──
113
+
114
+ $tempDir = Join-Path $env:TEMP "sillyspec-install"
115
+ if (Test-Path $tempDir) { Remove-Item -Recurse -Force $tempDir }
116
+ New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
117
+
118
+ Write-Host ""
119
+ Write-Host "SillySpec v$VERSION" -ForegroundColor Magenta
120
+ Write-Host "=================="
121
+ Write-Host ""
122
+
123
+ # ── 安装 CLI ──
124
+
125
+ Write-Host " 安装 SillySpec CLI..." -ForegroundColor Cyan
126
+ $cliDir = Join-Path $PSScriptRoot "..\cli"
127
+ if (Test-Path $cliDir) {
128
+ Push-Location $cliDir
129
+ try {
130
+ npm install -g . 2>$null
131
+ if ($LASTEXITCODE -eq 0) {
132
+ Write-Host " ✅ sillyspec CLI 已安装" -ForegroundColor Green
133
+ } else {
134
+ # 直接复制 bin 到 PATH 目录
135
+ $npmPrefix = npm config get prefix 2>$null
136
+ if ($npmPrefix) {
137
+ $destDir = Join-Path $npmPrefix
138
+ if (Test-Path (Join-Path $destDir "sillyspec.cmd")) {
139
+ Write-Host " ✅ sillyspec CLI 已安装" -ForegroundColor Green
140
+ } else {
141
+ Write-Host " ⚠️ CLI 安装需要管理员权限,请以管理员运行" -ForegroundColor Yellow
142
+ }
143
+ }
144
+ }
145
+ } catch {
146
+ Write-Host " ⚠️ CLI 安装失败,可手动: cd cli && npm install -g ." -ForegroundColor Yellow
147
+ }
148
+ Pop-Location
149
+ } else {
150
+ Write-Host " ⚠️ cli/ 不存在,跳过 CLI 安装(npm 安装模式无 CLI)" -ForegroundColor Yellow
151
+ }
152
+ Write-Host ""
153
+
154
+ # ── 下载模板 ──
155
+
156
+ Write-Host " 下载模板..." -ForegroundColor Cyan
157
+
158
+ foreach ($cmd in $COMMANDS) {
159
+ $url = "$BASE/templates/$cmd.md"
160
+ $out = Join-Path $tempDir "$cmd.md"
161
+ try {
162
+ (New-Object System.Net.WebClient).DownloadFile($url, $out)
163
+ } catch {
164
+ Write-Host " 下载失败: $cmd ($url)" -ForegroundColor Red
165
+ Write-Host " 请检查网络连接或稍后重试" -ForegroundColor Yellow
166
+ return
167
+ }
168
+ }
169
+ Write-Host " OK`n" -ForegroundColor Green
170
+
171
+ # ── 写文件(无 BOM UTF-8,避免乱码) ──
172
+
173
+ function Write-Utf8NoBom($path, $content) {
174
+ $fullPath = Join-Path (Get-Location).Path $path
175
+ $dir = Split-Path $fullPath
176
+ if (-not (Test-Path $dir)) {
177
+ New-Item -ItemType Directory -Path $dir -Force | Out-Null
178
+ }
179
+ [System.IO.File]::WriteAllText($fullPath, $content, [System.Text.UTF8Encoding]::new($false))
180
+ }
181
+
182
+ # ── 确定安装工具 ──
183
+
184
+ $agentsDir = Join-Path $env:USERPROFILE ".agents\skills"
185
+
186
+ if ($ToolFilter.Count -gt 0) {
187
+ $tools = $ToolFilter
188
+ } else {
189
+ $tools = @()
190
+ if (Test-Path ".claude") { $tools += "claude" }
191
+ if (Test-Path ".cursor") { $tools += "cursor" }
192
+ if (Test-Path ".opencode") { $tools += "opencode" }
193
+ if (Test-Path ".openclaw") { $tools += "openclaw" }
194
+ if (Test-Path $agentsDir) { $tools += "codex" }
195
+ if ($tools.Count -eq 0) { $tools = @("claude") }
196
+ }
197
+
198
+ Write-Host " 安装工具: $($tools -join ', ')"
199
+ if ($UseWorkspace) { Write-Host " 模式: 工作区" -ForegroundColor Yellow }
200
+ Write-Host ""
201
+
202
+ # ── 创建目录 ──
203
+
204
+ $dirs = @(
205
+ ".sillyspec\codebase", ".sillyspec\changes", ".sillyspec\changes\archive",
206
+ ".sillyspec\plans", ".sillyspec\specs", ".sillyspec\phases",
207
+ (Join-Path $env:USERPROFILE ".sillyspec\templates")
208
+ )
209
+
210
+ if ($UseWorkspace) {
211
+ $dirs += ".sillyspec\shared"
212
+ $dirs += ".sillyspec\workspace"
213
+ }
214
+
215
+ foreach ($d in $dirs) {
216
+ New-Item -ItemType Directory -Path $d -Force | Out-Null
217
+ }
218
+
219
+ # ── 工作区 config.yaml ──
220
+
221
+ if ($UseWorkspace) {
222
+ $configContent = "# SillySpec 工作区配置`n# 使用 /sillyspec:workspace add 添加子项目`n`nprojects:`n"
223
+ Write-Utf8NoBom ".sillyspec\config.yaml" $configContent
224
+ Write-Host " 已创建工作区配置: .sillyspec\config.yaml" -ForegroundColor Cyan
225
+ Write-Host " 下一步: /sillyspec:workspace add 添加子项目`n" -ForegroundColor Yellow
226
+ }
227
+
228
+ # ── 生成文件 ──
229
+
230
+ $count = 0
231
+
232
+ foreach ($t in $tools) {
233
+ Write-Host " [$t]" -ForegroundColor Yellow
234
+
235
+ foreach ($cmd in $COMMANDS) {
236
+ $desc = Get-Desc $cmd
237
+ $argHint = Get-ArgHint $cmd
238
+ $body = Get-Content (Join-Path $tempDir "$cmd.md") -Raw
239
+
240
+ switch ($t) {
241
+ "claude" {
242
+ $outDir = ".claude\commands\sillyspec"
243
+ $fm = "---`r`ndescription: $desc`r`nargument-hint: `"$argHint`"`r`n---"
244
+ Write-Utf8NoBom "$outDir\$cmd.md" "$fm`n`n$body"
245
+ }
246
+ "claude_skills" {
247
+ $outDir = ".claude\skills\sillyspec-$cmd"
248
+ $fm = "---`r`nname: sillyspec:$cmd`r`ndescription: $desc`r`n---"
249
+ Write-Utf8NoBom "$outDir\SKILL.md" "$fm`n`n$body"
250
+ }
251
+ "cursor" {
252
+ $outDir = ".cursor\commands"
253
+ $fm = "---`r`nname: /sillyspec-$cmd`r`nid: sillyspec-$cmd`r`ndescription: $desc`r`n---"
254
+ Write-Utf8NoBom "$outDir\sillyspec-$cmd.md" "$fm`n`n$body"
255
+ }
256
+ "codex" {
257
+ $outDir = Join-Path $agentsDir "sillyspec-$cmd"
258
+ $fm = "---`r`nname: sillyspec:$cmd`r`ndescription: $desc`r`n---"
259
+ Write-Utf8NoBom "$outDir\SKILL.md" "$fm`n`n$body"
260
+ }
261
+ "opencode" {
262
+ $outDir = ".opencode\skills\sillyspec-$cmd"
263
+ $fm = "---`r`nname: sillyspec:$cmd`r`ndescription: $desc`r`n---"
264
+ Write-Utf8NoBom "$outDir\SKILL.md" "$fm`n`n$body"
265
+ }
266
+ "openclaw" {
267
+ $outDir = ".openclaw\skills\sillyspec-$cmd"
268
+ $fm = "---`r`nname: sillyspec:$cmd`r`ndescription: $desc`r`n---"
269
+ Write-Utf8NoBom "$outDir\SKILL.md" "$fm`n`n$body"
270
+ }
271
+ }
272
+ $count++
273
+ }
274
+ Write-Host " OK`n" -ForegroundColor Green
275
+ }
276
+
277
+ # ── 全局 skill(仅 claude) ──
278
+
279
+ if ($tools -contains "claude") {
280
+ $skillContent = "# SillySpec`n全局加载提示。Claude Code 启动时会自动读取此文件。`n输入 /sillyspec: 查看所有可用命令。"
281
+ Write-Utf8NoBom ".claude\skills\sillyspec\SKILL.md" $skillContent
282
+ }
283
+
284
+ # ── 清理 ──
285
+
286
+ Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
287
+
288
+ # ── 完成 ──
289
+
290
+ Write-Host "==================="
291
+ Write-Host " DONE! $count 个命令已安装" -ForegroundColor Green
292
+ Write-Host " 目录: $InstallDir"
293
+ Write-Host ""
294
+ Write-Host " 已安装工具: $($tools -join ', ')"
295
+ if ($UseWorkspace) { Write-Host " 模式: 工作区(使用 /sillyspec:workspace add 添加子项目)" }
296
+ Write-Host ""
297
+ Write-Host " 入口选择:"
298
+ Write-Host " 绿地项目: /sillyspec:init"
299
+ Write-Host " 棕地项目: /sillyspec:scan"
300
+ Write-Host " 不确定: /sillyspec:continue"
301
+ Write-Host ""
302
+ Write-Host " 文档: https://sillyspec.ppdmq.top/"
303
+ Write-Host ""
304
+ Write-Host " 带参数重新安装: SillySpec-Install -Workspace"
305
+ Write-Host " 帮助: SillySpec-Install -Help"
306
+ }
307
+
308
+ # ── iex 管道:直接安装(无参数) ──
309
+ # ── 带参数安装:SillySpec-Install -Workspace -Tool cursor ──
310
+
311
+ Invoke-SillySpecInstall
312
+
313
+ # 导出函数供后续带参数调用
314
+ function SillySpec-Install {
315
+ Invoke-SillySpecInstall @args
316
+ }