sillyspec 3.11.3 → 3.11.5
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.
- package/.claude/skills/sillyspec-brainstorm/SKILL.md +31 -11
- package/package.json +1 -1
- package/src/run.js +58 -0
|
@@ -3,19 +3,39 @@ name: sillyspec:brainstorm
|
|
|
3
3
|
description: 用于正式开始开发前的需求澄清和技术方案设计。适合用户提出新功能、新模块、架构调整、复杂改造,或说"先做需求分析、输出技术方案、创建变更前先梳理、帮我设计下"。产出结构化方案,但不直接写代码。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# SillySpec Brainstorm — 需求探索
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## 用法
|
|
9
|
+
用户触发此 skill 时,使用 `sillyspec run brainstorm` 逐步执行需求探索。
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
**⚠️ 必须指定变更名!**
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
## 执行步骤
|
|
13
14
|
|
|
14
|
-
1.
|
|
15
|
-
2.
|
|
16
|
-
3.
|
|
17
|
-
4.
|
|
18
|
-
5.
|
|
15
|
+
1. 确定变更名(格式:`YYYY-MM-DD-<简短描述>`,如 `2026-05-28-agent-log-streaming`)
|
|
16
|
+
2. 运行 `sillyspec run brainstorm --change <变更名>` 获取当前步骤指令
|
|
17
|
+
3. 按步骤指令执行(对话、分析需求、设计方案等)
|
|
18
|
+
4. 完成步骤后运行 `sillyspec run brainstorm --done --change <变更名> --output "步骤摘要"`
|
|
19
|
+
5. CLI 会自动输出下一步的指令,重复 3-4 直到阶段完成
|
|
19
20
|
|
|
20
|
-
##
|
|
21
|
-
|
|
21
|
+
## 示例
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# 首次启动
|
|
25
|
+
sillyspec run brainstorm --change 2026-05-28-agent-log-streaming
|
|
26
|
+
|
|
27
|
+
# 完成当前步骤
|
|
28
|
+
sillyspec run brainstorm --done --change 2026-05-28-agent-log-streaming --output "需求已澄清"
|
|
29
|
+
|
|
30
|
+
# 查看进度
|
|
31
|
+
sillyspec run brainstorm --status --change 2026-05-28-agent-log-streaming
|
|
32
|
+
|
|
33
|
+
# 重置阶段
|
|
34
|
+
sillyspec run brainstorm --reset --change 2026-05-28-agent-log-streaming
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 注意
|
|
38
|
+
- **必须带 `--change <变更名>`**,否则会报错
|
|
39
|
+
- 步骤 prompt 由 CLI 管理,不需要手动读取
|
|
40
|
+
- 依赖 scan 阶段完成,CLI 会自动提醒
|
|
41
|
+
- brainstorm 完成后,运行 `sillyspec run propose --change <变更名>` 进入方案设计
|
package/package.json
CHANGED
package/src/run.js
CHANGED
|
@@ -233,6 +233,14 @@ export async function runCommand(args, cwd) {
|
|
|
233
233
|
if (autoChange) {
|
|
234
234
|
progress = pm.initChange(cwd, autoChange)
|
|
235
235
|
} else if (!isAuxiliary) {
|
|
236
|
+
// brainstorm / propose 作为流程入口,可以自动创建变更
|
|
237
|
+
if (stageName === 'brainstorm' || stageName === 'propose') {
|
|
238
|
+
// 引导用户指定变更名
|
|
239
|
+
console.error('❌ 请指定变更名')
|
|
240
|
+
console.error(' 用法: sillyspec run brainstorm --change <变更名>')
|
|
241
|
+
console.error(' 示例: sillyspec run brainstorm --change 2026-05-28-agent-log-streaming')
|
|
242
|
+
process.exit(1)
|
|
243
|
+
}
|
|
236
244
|
console.error('❌ 未找到 progress.json,请先运行 sillyspec init')
|
|
237
245
|
console.error(' 提示:使用 --change <name> 指定变更名')
|
|
238
246
|
process.exit(1)
|
|
@@ -377,6 +385,53 @@ function validateMetadata(cwd, stageName) {
|
|
|
377
385
|
}
|
|
378
386
|
}
|
|
379
387
|
|
|
388
|
+
/**
|
|
389
|
+
* 验证关键文件是否存在于正确的变更目录下
|
|
390
|
+
* 防止 AI 将文件写到错误的路径
|
|
391
|
+
*/
|
|
392
|
+
function validateFileLocations(cwd, stageName, progress, changeName) {
|
|
393
|
+
const effectiveChange = changeName || progress.currentChange
|
|
394
|
+
if (!effectiveChange) return
|
|
395
|
+
|
|
396
|
+
const changeDir = join(cwd, '.sillyspec', 'changes', effectiveChange)
|
|
397
|
+
if (!existsSync(changeDir)) return
|
|
398
|
+
|
|
399
|
+
// 每个阶段完成后预期存在的文件
|
|
400
|
+
const expectedFiles = {
|
|
401
|
+
propose: ['proposal.md', 'design.md', 'requirements.md', 'tasks.md'],
|
|
402
|
+
plan: ['plan.md'],
|
|
403
|
+
verify: ['verify-result.md'],
|
|
404
|
+
archive: ['module-impact.md'],
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
const expected = expectedFiles[stageName]
|
|
408
|
+
if (!expected) return
|
|
409
|
+
|
|
410
|
+
const missing = []
|
|
411
|
+
for (const file of expected) {
|
|
412
|
+
if (!existsSync(join(changeDir, file))) {
|
|
413
|
+
missing.push(file)
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (missing.length > 0) {
|
|
418
|
+
console.log(`\n⚠️ 文件位置验证:以下文件未在变更目录中找到`)
|
|
419
|
+
console.log(` 变更目录:${changeDir.replace(cwd + '/', '')}/`)
|
|
420
|
+
for (const f of missing) {
|
|
421
|
+
// 检查是否写到了错误的位置
|
|
422
|
+
const wrongPath = join(cwd, '.sillyspec', 'changes', 'change', effectiveChange, f)
|
|
423
|
+
if (existsSync(wrongPath)) {
|
|
424
|
+
console.log(` ❌ ${f} — 不存在,但发现了错误路径:${wrongPath.replace(cwd + '/', '')}`)
|
|
425
|
+
console.log(` 提示:应该写入 ${changeDir.replace(cwd + '/', '')}/${f}`)
|
|
426
|
+
} else {
|
|
427
|
+
console.log(` ⬜ ${f} — 未找到(该阶段可能未产出此文件)`)
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
} else {
|
|
431
|
+
console.log(`\n✅ 文件位置验证:所有 ${expected.length} 个预期文件均在变更目录中`)
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
380
435
|
async function completeStep(pm, progress, stageName, cwd, outputText, inputText = null, options = {}) {
|
|
381
436
|
const { printNext = true, confirm = false, changeName } = options
|
|
382
437
|
const stageData = progress.stages[stageName]
|
|
@@ -453,6 +508,9 @@ async function completeStep(pm, progress, stageName, cwd, outputText, inputText
|
|
|
453
508
|
|
|
454
509
|
validateMetadata(cwd, stageName)
|
|
455
510
|
|
|
511
|
+
// 验证关键文件是否在正确的变更目录下
|
|
512
|
+
validateFileLocations(cwd, stageName, progress, changeName)
|
|
513
|
+
|
|
456
514
|
// archive 阶段确认归档
|
|
457
515
|
if (stageName === 'archive' && steps[currentIdx]?.name === '确认归档') {
|
|
458
516
|
if (confirm) {
|