sillyspec 3.22.5 → 3.22.6
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/package.json +1 -1
- package/src/stages/execute.js +19 -2
package/package.json
CHANGED
package/src/stages/execute.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'fs'
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from 'fs'
|
|
2
2
|
import path from 'path'
|
|
3
3
|
import { buildContractMatrix, buildConsumerInjection, buildContractFieldInjection } from '../contract-matrix.js'
|
|
4
4
|
|
|
@@ -447,6 +447,7 @@ function parseWavesFromPlan(planContent) {
|
|
|
447
447
|
function buildWavePrompt(wave, waveIndex, changeDir, worktreePath) {
|
|
448
448
|
// ── Contract Matrix:检查是否有 provider/consumer 契约需要注入 ──
|
|
449
449
|
let contractInjection = ''
|
|
450
|
+
let prototypeInjection = ''
|
|
450
451
|
if (changeDir) {
|
|
451
452
|
try {
|
|
452
453
|
const planFile = path.join(changeDir, 'plan.md')
|
|
@@ -503,6 +504,22 @@ ${fi}
|
|
|
503
504
|
// 契约注入是 best-effort:失败不阻断 execute,只记录
|
|
504
505
|
console.warn(` ⚠️ 契约注入跳过: ${e?.message || e}`)
|
|
505
506
|
}
|
|
507
|
+
|
|
508
|
+
// 原型引用注入:brainstorm 阶段的 HTML 原型(确认过的布局/组件/交互),
|
|
509
|
+
// 让 execute 实现前端/UI task 时参考原型,而非凭 design 文字重新发明(避免原型浪费)。
|
|
510
|
+
try {
|
|
511
|
+
const prototypes = readdirSync(changeDir).filter(f => /^prototype-.*\.html$/i.test(f))
|
|
512
|
+
if (prototypes.length > 0) {
|
|
513
|
+
const protoRelDir = `.sillyspec/changes/${path.basename(changeDir)}`
|
|
514
|
+
prototypeInjection = `
|
|
515
|
+
### 📐 原型参考(brainstorm 可视化确认)
|
|
516
|
+
本次变更有 HTML 原型(brainstorm 阶段确认过的视觉/交互),实现前端/UI 相关 task 时参考:
|
|
517
|
+
${prototypes.map(p => `- \`${path.join(protoRelDir, p)}\``).join('\n')}
|
|
518
|
+
|
|
519
|
+
照原型的布局/组件/交互实现,不要凭 design.md 文字重新发明。纯后端/无 UI 的 task 忽略本节。
|
|
520
|
+
`
|
|
521
|
+
}
|
|
522
|
+
} catch {}
|
|
506
523
|
}
|
|
507
524
|
|
|
508
525
|
// 构建任务摘要(不再内联完整蓝图,减少上下文污染)
|
|
@@ -575,7 +592,7 @@ ${taskSummary}
|
|
|
575
592
|
- 🔥 热上下文:design.md 非目标/兼容策略 + 当前 Wave 任务(必须加载)
|
|
576
593
|
- 🌡️ 温上下文:CONVENTIONS.md + ARCHITECTURE.md(需要时加载)
|
|
577
594
|
- ❄️ 冷上下文:其他变更的 design.md、历史 plan.md(不要主动加载,除非明确需要)
|
|
578
|
-
${contractInjection}
|
|
595
|
+
${contractInjection}${prototypeInjection}
|
|
579
596
|
### 本 Wave 任务
|
|
580
597
|
${taskList}
|
|
581
598
|
|