sillyspec 3.7.18 → 3.7.20

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.
@@ -4,8 +4,14 @@ description: 归档变更 — 规范沉淀,可追溯
4
4
  ---
5
5
 
6
6
  ## 执行
7
- 运行 `sillyspec run archive`,按提示逐步执行。
8
- 每步完成后运行 `sillyspec run archive --done --output "摘要"`。
7
+
8
+ **你必须使用 exec 工具(shell)执行以下命令,不要自己编造流程:**
9
+
10
+ 1. 运行 `sillyspec run archive` — 读取输出的步骤 prompt
11
+ 2. 按照输出的 prompt **严格执行**,不要跳过或自行添加步骤
12
+ 3. 步骤完成后,运行 `sillyspec run archive --done --output "你的摘要"`
13
+ 4. 重复 2-3 直到阶段完成
14
+ 5. **禁止**在没有运行 CLI 的情况下自行决定流程
9
15
 
10
16
  ## 用户指令
11
17
  $ARGUMENTS
@@ -5,9 +5,13 @@ description: 需求探索 — 结构化头脑风暴,含技术方案输出(
5
5
 
6
6
  ## 执行
7
7
 
8
- 运行 `sillyspec run brainstorm`,按提示逐步执行。
9
- 每步完成后运行 `sillyspec run brainstorm --done --output "摘要"`。
10
- 阶段完成后自动提示下一步。
8
+ **你必须使用 exec 工具(shell)执行以下命令,不要自己编造流程:**
9
+
10
+ 1. 运行 `sillyspec run brainstorm` — 读取输出的步骤 prompt
11
+ 2. 按照输出的 prompt **严格执行**,不要跳过或自行添加步骤
12
+ 3. 步骤完成后,运行 `sillyspec run brainstorm --done --output "你的摘要"`
13
+ 4. 重复 2-3 直到阶段完成
14
+ 5. **禁止**在没有运行 CLI 的情况下自行决定流程
11
15
 
12
16
  ## 用户指令
13
17
  $ARGUMENTS
@@ -5,9 +5,13 @@ description: 波次执行 — 子代理并行 + 强制 TDD + 两阶段审查
5
5
 
6
6
  ## 执行
7
7
 
8
- 运行 `sillyspec run execute`,按提示逐步执行。
9
- 每步完成后运行 `sillyspec run execute --done --output "摘要"`。
10
- 阶段完成后自动提示下一步。
8
+ **你必须使用 exec 工具(shell)执行以下命令,不要自己编造流程:**
9
+
10
+ 1. 运行 `sillyspec run execute` — 读取输出的步骤 prompt
11
+ 2. 按照输出的 prompt **严格执行**,不要跳过或自行添加步骤
12
+ 3. 步骤完成后,运行 `sillyspec run execute --done --output "你的摘要"`
13
+ 4. 重复 2-3 直到阶段完成
14
+ 5. **禁止**在没有运行 CLI 的情况下自行决定流程
11
15
 
12
16
  ## 用户指令
13
17
  $ARGUMENTS
@@ -5,9 +5,13 @@ description: 编写实现计划 — 2-5 分钟粒度,精确到文件路径和
5
5
 
6
6
  ## 执行
7
7
 
8
- 运行 `sillyspec run plan`,按提示逐步执行。
9
- 每步完成后运行 `sillyspec run plan --done --output "摘要"`。
10
- 阶段完成后自动提示下一步。
8
+ **你必须使用 exec 工具(shell)执行以下命令,不要自己编造流程:**
9
+
10
+ 1. 运行 `sillyspec run plan` — 读取输出的步骤 prompt
11
+ 2. 按照输出的 prompt **严格执行**,不要跳过或自行添加步骤
12
+ 3. 步骤完成后,运行 `sillyspec run plan --done --output "你的摘要"`
13
+ 4. 重复 2-3 直到阶段完成
14
+ 5. **禁止**在没有运行 CLI 的情况下自行决定流程
11
15
 
12
16
  ## 用户指令
13
17
  $ARGUMENTS
@@ -5,9 +5,13 @@ description: 生成结构化规范 — proposal + design + tasks
5
5
 
6
6
  ## 执行
7
7
 
8
- 运行 `sillyspec run propose`,按提示逐步执行。
9
- 每步完成后运行 `sillyspec run propose --done --output "摘要"`。
10
- 阶段完成后自动提示下一步。
8
+ **你必须使用 exec 工具(shell)执行以下命令,不要自己编造流程:**
9
+
10
+ 1. 运行 `sillyspec run propose` — 读取输出的步骤 prompt
11
+ 2. 按照输出的 prompt **严格执行**,不要跳过或自行添加步骤
12
+ 3. 步骤完成后,运行 `sillyspec run propose --done --output "你的摘要"`
13
+ 4. 重复 2-3 直到阶段完成
14
+ 5. **禁止**在没有运行 CLI 的情况下自行决定流程
11
15
 
12
16
  ## 用户指令
13
17
  $ARGUMENTS
@@ -4,8 +4,14 @@ description: 快速任务 — 跳过完整流程,直接做
4
4
  ---
5
5
 
6
6
  ## 执行
7
- 运行 `sillyspec run quick`,按提示逐步执行。
8
- 每步完成后运行 `sillyspec run quick --done --output "摘要"`。
7
+
8
+ **你必须使用 exec 工具(shell)执行以下命令,不要自己编造流程:**
9
+
10
+ 1. 运行 `sillyspec run quick` — 读取输出的步骤 prompt
11
+ 2. 按照输出的 prompt **严格执行**,不要跳过或自行添加步骤
12
+ 3. 步骤完成后,运行 `sillyspec run quick --done --output "你的摘要"`
13
+ 4. 重复 2-3 直到阶段完成
14
+ 5. **禁止**在没有运行 CLI 的情况下自行决定流程
9
15
 
10
16
  ## 用户指令
11
17
  $ARGUMENTS
@@ -4,8 +4,14 @@ description: 代码扫描 — 分析项目结构、约定和架构
4
4
  ---
5
5
 
6
6
  ## 执行
7
- 运行 `sillyspec run scan`,按提示逐步执行。
8
- 每步完成后运行 `sillyspec run scan --done --output "摘要"`。
7
+
8
+ **你必须使用 exec 工具(shell)执行以下命令,不要自己编造流程:**
9
+
10
+ 1. 运行 `sillyspec run scan` — 读取输出的步骤 prompt
11
+ 2. 按照输出的 prompt **严格执行**,不要跳过或自行添加步骤
12
+ 3. 步骤完成后,运行 `sillyspec run scan --done --output "你的摘要"`
13
+ 4. 重复 2-3 直到阶段完成
14
+ 5. **禁止**在没有运行 CLI 的情况下自行决定流程
9
15
 
10
16
  ## 用户指令
11
17
  $ARGUMENTS
@@ -4,8 +4,14 @@ description: 查看项目进度和状态
4
4
  ---
5
5
 
6
6
  ## 执行
7
- 运行 `sillyspec run status`,按提示逐步执行。
8
- 每步完成后运行 `sillyspec run status --done --output "摘要"`。
7
+
8
+ **你必须使用 exec 工具(shell)执行以下命令,不要自己编造流程:**
9
+
10
+ 1. 运行 `sillyspec run status` — 读取输出的步骤 prompt
11
+ 2. 按照输出的 prompt **严格执行**,不要跳过或自行添加步骤
12
+ 3. 步骤完成后,运行 `sillyspec run status --done --output "你的摘要"`
13
+ 4. 重复 2-3 直到阶段完成
14
+ 5. **禁止**在没有运行 CLI 的情况下自行决定流程
9
15
 
10
16
  ## 用户指令
11
17
  $ARGUMENTS
@@ -5,9 +5,13 @@ description: 验证实现 — 对照规范检查 + 测试套件
5
5
 
6
6
  ## 执行
7
7
 
8
- 运行 `sillyspec run verify`,按提示逐步执行。
9
- 每步完成后运行 `sillyspec run verify --done --output "摘要"`。
10
- 阶段完成后自动提示下一步。
8
+ **你必须使用 exec 工具(shell)执行以下命令,不要自己编造流程:**
9
+
10
+ 1. 运行 `sillyspec run verify` — 读取输出的步骤 prompt
11
+ 2. 按照输出的 prompt **严格执行**,不要跳过或自行添加步骤
12
+ 3. 步骤完成后,运行 `sillyspec run verify --done --output "你的摘要"`
13
+ 4. 重复 2-3 直到阶段完成
14
+ 5. **禁止**在没有运行 CLI 的情况下自行决定流程
11
15
 
12
16
  ## 用户指令
13
17
  $ARGUMENTS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sillyspec",
3
- "version": "3.7.18",
3
+ "version": "3.7.20",
4
4
  "description": "SillySpec CLI — 流程状态机,让 AI 严格按步骤来",
5
5
  "icon": "logo.jpg",
6
6
  "homepage": "https://sillyspec.ppdmq.top/",
package/src/run.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * CLI 成为流程引擎,AI 变成步骤执行器。
5
5
  */
6
6
  import { basename, join } from 'path'
7
- import { existsSync, readdirSync, mkdirSync, writeFileSync } from 'fs'
7
+ import { existsSync, readdirSync, mkdirSync, writeFileSync, appendFileSync, readFileSync, statSync } from 'fs'
8
8
  import { ProgressManager } from './progress.js'
9
9
  import { stageRegistry, getNextStage, auxiliaryStages } from './stages/index.js'
10
10
  import { buildExecuteSteps } from './stages/execute.js'
@@ -167,14 +167,12 @@ function runStage(progress, stageName, cwd) {
167
167
  const currentIdx = steps.findIndex(s => s.status !== 'completed' && s.status !== 'skipped')
168
168
 
169
169
  if (currentIdx === -1) {
170
- const total = steps.length
171
- console.log(`✅ ${stageName} 阶段已完成(${total}/${total} 步)`)
172
- const next = getNextStage(stageName)
173
- if (next) {
174
- console.log(`\n下一步:sillyspec run ${next}`)
175
- console.log(`或:/sillyspec:${next}`)
176
- }
177
- process.exit(2)
170
+ // 阶段已完成,自动重置,允许重复执行
171
+ steps.forEach(s => { s.status = 'pending'; s.completedAt = null; s.output = null; s.startedAt = null })
172
+ stageData.status = 'in_progress'
173
+ stageData.completedAt = null
174
+ console.log(`🔄 ${stageName} 阶段已完成,重新开始...\n`)
175
+ currentIdx = 0
178
176
  }
179
177
 
180
178
  const stageDef = stageRegistry[stageName]
@@ -184,6 +182,36 @@ function runStage(progress, stageName, cwd) {
184
182
  }
185
183
  }
186
184
 
185
+ function validateMetadata(cwd, stageName) {
186
+ const changesDir = join(cwd, '.sillyspec', 'changes')
187
+ if (!existsSync(changesDir)) return
188
+
189
+ // 找最近 10 分钟内修改的 md/yaml 文件
190
+ const cutoff = Date.now() - 10 * 60 * 1000
191
+ const missing = []
192
+
193
+ function walk(dir) {
194
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
195
+ const full = join(dir, entry.name)
196
+ if (entry.isDirectory()) { walk(full); continue }
197
+ if (!/\.(md|yaml|yml)$/.test(entry.name)) continue
198
+ const mtime = statSync(full).mtimeMs
199
+ if (mtime < cutoff) continue
200
+ const content = readFileSync(full, 'utf-8')
201
+ if (!content.includes('author:') && !content.includes('author:')) missing.push(full)
202
+ if (!content.includes('created_at:') && !content.includes('created_at:')) missing.push(full)
203
+ }
204
+ }
205
+
206
+ walk(changesDir)
207
+ const unique = [...new Set(missing)]
208
+ if (unique.length > 0) {
209
+ console.log(`\n⚠️ 以下文件缺少 author 或 created_at 元数据:`)
210
+ unique.forEach(f => console.log(` - ${f.replace(cwd + '/', '')}`))
211
+ console.log('请在文件头部添加 author(git 用户名)和 created_at(精确到秒)')
212
+ }
213
+ }
214
+
187
215
  function completeStep(pm, progress, stageName, cwd, outputText) {
188
216
  const stageData = progress.stages[stageName]
189
217
  if (!stageData || !stageData.steps) {
@@ -237,6 +265,16 @@ function completeStep(pm, progress, stageName, cwd, outputText) {
237
265
  progress.lastActive = new Date().toISOString()
238
266
  pm._write(cwd, progress)
239
267
 
268
+ // Append to user-inputs.md
269
+ if (outputText) {
270
+ const inputsPath = join(cwd, '.sillyspec', '.runtime', 'user-inputs.md')
271
+ const entry = `\n## ${new Date().toISOString()} | ${stageName}: ${steps[currentIdx].name}\n- 输出:${outputText}\n`
272
+ appendFileSync(inputsPath, entry)
273
+ }
274
+
275
+ // 验证:检查生成的文件是否包含 author 和 created_at
276
+ validateMetadata(cwd, stageName)
277
+
240
278
  const total = steps.length
241
279
  console.log(`✅ ${stageName} 阶段已完成(${total}/${total} 步)`)
242
280
  if (next) {
@@ -249,6 +287,13 @@ function completeStep(pm, progress, stageName, cwd, outputText) {
249
287
  progress.lastActive = new Date().toISOString()
250
288
  pm._write(cwd, progress)
251
289
 
290
+ // Append to user-inputs.md
291
+ if (outputText) {
292
+ const inputsPath = join(cwd, '.sillyspec', '.runtime', 'user-inputs.md')
293
+ const entry = `\n## ${new Date().toISOString()} | ${stageName}: ${steps[currentIdx].name}\n- 输出:${outputText}\n`
294
+ appendFileSync(inputsPath, entry)
295
+ }
296
+
252
297
  const defSteps = getStageSteps(stageName, cwd)
253
298
  console.log(`✅ Step ${currentIdx + 1}/${steps.length} 完成:${steps[currentIdx].name}\n`)
254
299
  outputStep(stageName, nextPendingIdx, defSteps, cwd)