sillyspec 3.12.2 → 3.12.4
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/hooks/worktree-guard.js +2 -0
- package/src/run.js +22 -12
package/package.json
CHANGED
|
@@ -301,6 +301,8 @@ function isSingleCommandReadonly(cmd, extraReadonlyCommands = []) {
|
|
|
301
301
|
if (READONLY_GIT_SUBS.has(sub)) return true
|
|
302
302
|
// git stash list
|
|
303
303
|
if (sub === 'stash' && (parts[2] === 'list' || parts.length === 2)) return true
|
|
304
|
+
// git worktree 管理(list/add/remove)放行
|
|
305
|
+
if (sub === 'worktree') return true
|
|
304
306
|
return false
|
|
305
307
|
}
|
|
306
308
|
|
package/src/run.js
CHANGED
|
@@ -146,10 +146,10 @@ async function ensureStageSteps(progress, stageName, cwd) {
|
|
|
146
146
|
/**
|
|
147
147
|
* 输出当前步骤的 prompt
|
|
148
148
|
*/
|
|
149
|
-
function outputStep(stageName, stepIndex, steps, cwd, changeName) {
|
|
149
|
+
async function outputStep(stageName, stepIndex, steps, cwd, changeName, dbProjectName) {
|
|
150
150
|
const step = steps[stepIndex]
|
|
151
151
|
const total = steps.length
|
|
152
|
-
const projectName = basename(cwd)
|
|
152
|
+
const projectName = dbProjectName || basename(cwd)
|
|
153
153
|
|
|
154
154
|
const personas = {
|
|
155
155
|
brainstorm: `### 🎯 你的角色:资深架构师
|
|
@@ -190,7 +190,12 @@ function outputStep(stageName, stepIndex, steps, cwd, changeName) {
|
|
|
190
190
|
console.log(guardrails.trim())
|
|
191
191
|
console.log('')
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
let promptText = step.prompt
|
|
194
|
+
// 替换 prompt 中的占位符
|
|
195
|
+
if (projectName && promptText.includes('<project>')) {
|
|
196
|
+
promptText = promptText.replace(/<project>/g, projectName)
|
|
197
|
+
}
|
|
198
|
+
console.log(promptText)
|
|
194
199
|
console.log(`\n### ⚠️ 铁律`)
|
|
195
200
|
console.log('- **文档是核心资产,代码是文档的产物。** 没有文档就没有代码——文档是 AI 的记忆,是团队协作的基础,是后续维护的唯一依据。任何代码产出必须先有对应的设计/规范文档支撑。')
|
|
196
201
|
console.log('- 只做本步骤描述的操作,不得自行扩展或跳过')
|
|
@@ -268,9 +273,14 @@ export async function runCommand(args, cwd) {
|
|
|
268
273
|
if (autoChange) {
|
|
269
274
|
progress = await pm.initChange(cwd, autoChange)
|
|
270
275
|
} else if (isAuxiliary) {
|
|
271
|
-
// 辅助阶段(scan/explore/quick/doctor/status
|
|
272
|
-
|
|
273
|
-
|
|
276
|
+
// 辅助阶段(scan/explore/quick/doctor/status)自动使用默认变更名
|
|
277
|
+
const autoName = changeName || resolveChangeNameAuto(cwd) || 'default'
|
|
278
|
+
changeName = autoName
|
|
279
|
+
progress = await pm.initChange(cwd, autoName)
|
|
280
|
+
// initChange 可能因 project 表为空返回 null
|
|
281
|
+
if (!progress) {
|
|
282
|
+
progress = { currentStage: stageName, stages: {}, lastActive: new Date().toLocaleString('zh-CN', { hour12: false }), project: '' }
|
|
283
|
+
}
|
|
274
284
|
} else {
|
|
275
285
|
// brainstorm / propose 作为流程入口,自动生成变更名并初始化
|
|
276
286
|
if (stageName === 'brainstorm' || stageName === 'propose') {
|
|
@@ -409,7 +419,7 @@ async function runStage(pm, progress, stageName, cwd, changeName, skipApproval =
|
|
|
409
419
|
|
|
410
420
|
const defSteps = await getStageSteps(stageName, cwd, progress)
|
|
411
421
|
if (defSteps && defSteps[currentIdx]) {
|
|
412
|
-
outputStep(stageName, currentIdx, defSteps, cwd, changeName)
|
|
422
|
+
await outputStep(stageName, currentIdx, defSteps, cwd, changeName, progress.project || null)
|
|
413
423
|
}
|
|
414
424
|
}
|
|
415
425
|
|
|
@@ -654,7 +664,7 @@ async function completeStep(pm, progress, stageName, cwd, outputText, inputText
|
|
|
654
664
|
const defSteps = await getStageSteps(stageName, cwd, progress)
|
|
655
665
|
console.log(`✅ Step ${currentIdx + 1}/${steps.length} 完成:${steps[currentIdx].name}\n`)
|
|
656
666
|
if (printNext) {
|
|
657
|
-
outputStep(stageName, nextPendingIdx, defSteps, cwd, changeName)
|
|
667
|
+
await outputStep(stageName, nextPendingIdx, defSteps, cwd, changeName, progress.project || null)
|
|
658
668
|
}
|
|
659
669
|
return { stageCompleted: false, currentIdx, nextPendingIdx }
|
|
660
670
|
}
|
|
@@ -692,7 +702,7 @@ async function skipStep(pm, progress, stageName, cwd, changeName) {
|
|
|
692
702
|
const nextPendingIdx = steps.findIndex(s => s.status === 'pending')
|
|
693
703
|
if (nextPendingIdx !== -1 && defSteps) {
|
|
694
704
|
console.log('')
|
|
695
|
-
outputStep(stageName, nextPendingIdx, defSteps, cwd, changeName)
|
|
705
|
+
await outputStep(stageName, nextPendingIdx, defSteps, cwd, changeName, progress.project || null)
|
|
696
706
|
}
|
|
697
707
|
}
|
|
698
708
|
|
|
@@ -837,7 +847,7 @@ async function runAutoMode(pm, progress, cwd, flags, changeName) {
|
|
|
837
847
|
}
|
|
838
848
|
}
|
|
839
849
|
}
|
|
840
|
-
outputStep(currentStage, pendingIdx, defSteps, cwd, changeName)
|
|
850
|
+
await outputStep(currentStage, pendingIdx, defSteps, cwd, changeName, progress.project || null)
|
|
841
851
|
return
|
|
842
852
|
}
|
|
843
853
|
|
|
@@ -867,7 +877,7 @@ async function runAutoMode(pm, progress, cwd, flags, changeName) {
|
|
|
867
877
|
}
|
|
868
878
|
}
|
|
869
879
|
}
|
|
870
|
-
outputStep(currentStage, nextPendingIdx, defSteps, cwd, changeName)
|
|
880
|
+
await outputStep(currentStage, nextPendingIdx, defSteps, cwd, changeName, progress.project || null)
|
|
871
881
|
return
|
|
872
882
|
}
|
|
873
883
|
|
|
@@ -909,6 +919,6 @@ async function runAutoMode(pm, progress, cwd, flags, changeName) {
|
|
|
909
919
|
}
|
|
910
920
|
}
|
|
911
921
|
}
|
|
912
|
-
outputStep(next, firstPending, nextSteps, cwd, changeName)
|
|
922
|
+
await outputStep(next, firstPending, nextSteps, cwd, changeName, progress.project || null)
|
|
913
923
|
}
|
|
914
924
|
}
|