sillyspec 3.11.9 → 3.11.10
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/.npmrc.tmp +1 -0
- package/package.json +1 -1
- package/src/hooks/worktree-guard.js +39 -4
package/.npmrc.tmp
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//registry.npmjs.org/:_authToken=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
|
package/package.json
CHANGED
|
@@ -352,7 +352,18 @@ export function shouldBlockWrite(filePath, cwd) {
|
|
|
352
352
|
const effectiveCwd = cwd || process.cwd()
|
|
353
353
|
const gateStatus = readGateStatus(effectiveCwd)
|
|
354
354
|
if (!gateStatus || !ALLOWED_STAGES.includes(gateStatus.stage)) {
|
|
355
|
-
|
|
355
|
+
const stage = gateStatus?.stage || '(none)'
|
|
356
|
+
return {
|
|
357
|
+
blocked: true,
|
|
358
|
+
reason: [
|
|
359
|
+
`当前阶段 "${stage}" 不允许修改源码。`,
|
|
360
|
+
`源码修改只能在 execute 或 quick 阶段进行。`,
|
|
361
|
+
'请先完成文档规划流程:',
|
|
362
|
+
' - 小改动:运行 sillyspec run quick',
|
|
363
|
+
' - 大改动:运行 sillyspec run brainstorm → plan → execute',
|
|
364
|
+
' - 或使用 sillyspec run auto 连续推进全流程',
|
|
365
|
+
].join('\n')
|
|
366
|
+
}
|
|
356
367
|
}
|
|
357
368
|
|
|
358
369
|
// 3. 位置门禁
|
|
@@ -360,10 +371,24 @@ export function shouldBlockWrite(filePath, cwd) {
|
|
|
360
371
|
|
|
361
372
|
// noWorktree 模式:无隔离环境,禁止源码写入(降级到更严格)
|
|
362
373
|
if (isNoWorktreeMode(effectiveCwd)) {
|
|
363
|
-
return {
|
|
374
|
+
return {
|
|
375
|
+
blocked: true,
|
|
376
|
+
reason: [
|
|
377
|
+
'当前处于 --no-worktree 降级模式,不允许源码写入。',
|
|
378
|
+
'如需修改源码,请移除 --no-worktree 标志重新执行。',
|
|
379
|
+
'紧急情况可设置 SILLYSPEC_DISABLE_HOOKS=1 绕过限制。',
|
|
380
|
+
].join('\n')
|
|
381
|
+
}
|
|
364
382
|
}
|
|
365
383
|
|
|
366
|
-
return {
|
|
384
|
+
return {
|
|
385
|
+
blocked: true,
|
|
386
|
+
reason: [
|
|
387
|
+
'源码修改只能在 worktree 隔离环境中进行。',
|
|
388
|
+
'execute/quick 阶段会自动创建 worktree。',
|
|
389
|
+
'如果你正在 execute 阶段,请确认 worktree 已创建:sillyspec worktree list',
|
|
390
|
+
].join('\n')
|
|
391
|
+
}
|
|
367
392
|
}
|
|
368
393
|
|
|
369
394
|
/**
|
|
@@ -389,7 +414,17 @@ export function shouldBlockBash(command, cwd) {
|
|
|
389
414
|
const localConfig = loadLocalConfig(effectiveCwd)
|
|
390
415
|
const extraReadonly = localConfig.worktreeHook?.readonlyCommands || localConfig['worktree-hook']?.readonlyCommands || []
|
|
391
416
|
if (matchReadonlyWhitelist(command, extraReadonly)) return { blocked: false }
|
|
392
|
-
|
|
417
|
+
const stage = gateStatus?.stage || '(none)'
|
|
418
|
+
return {
|
|
419
|
+
blocked: true,
|
|
420
|
+
reason: [
|
|
421
|
+
`当前阶段 "${stage}" 不允许执行此命令。`,
|
|
422
|
+
'源码修改只能在 execute 或 quick 阶段进行。',
|
|
423
|
+
'请先完成文档规划流程:',
|
|
424
|
+
' - 小改动:运行 sillyspec run quick',
|
|
425
|
+
' - 大改动:运行 sillyspec run brainstorm → plan → execute',
|
|
426
|
+
].join('\n')
|
|
427
|
+
}
|
|
393
428
|
}
|
|
394
429
|
|
|
395
430
|
// execute/quick 阶段 + 主工作区
|