sillyspec 3.24.7 → 3.25.0
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/constants.js +25 -0
- package/src/contract-matrix.js +48 -20
- package/src/endpoint-extractor.js +92 -6
- package/src/fs-atomic.js +69 -0
- package/src/hooks/worktree-guard.js +16 -4
- package/src/index.js +6 -7
- package/src/modules.js +2 -2
- package/src/progress.js +38 -53
- package/src/run.js +578 -459
- package/src/scan-postcheck.js +2 -10
- package/src/stage-contract.js +8 -17
- package/src/stages/brainstorm-auto.js +1 -1
- package/src/stages/brainstorm.js +571 -571
- package/src/stages/doctor.js +5 -5
- package/src/stages/execute.js +1 -1
- package/src/stages/index.js +1 -1
- package/src/stages/plan.js +2 -2
- package/src/stages/propose.js +1 -1
- package/src/stages/status.js +1 -1
- package/src/stages/verify.js +2 -0
- package/src/verify-postcheck.js +41 -0
- package/src/worktree-apply.js +45 -18
- package/src/worktree.js +13 -5
package/src/scan-postcheck.js
CHANGED
|
@@ -7,17 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
import { existsSync, readdirSync, readFileSync, mkdirSync, writeFileSync } from 'fs'
|
|
9
9
|
import { join, basename } from 'path'
|
|
10
|
-
import { SCAN_STATUS, CHECK_SEVERITY } from './constants.js'
|
|
10
|
+
import { SCAN_STATUS, CHECK_SEVERITY, SCAN_REQUIRED_DOCS } from './constants.js'
|
|
11
11
|
|
|
12
|
-
const REQUIRED_SCAN_DOCS =
|
|
13
|
-
'ARCHITECTURE.md',
|
|
14
|
-
'CONVENTIONS.md',
|
|
15
|
-
'STRUCTURE.md',
|
|
16
|
-
'INTEGRATIONS.md',
|
|
17
|
-
'TESTING.md',
|
|
18
|
-
'CONCERNS.md',
|
|
19
|
-
'PROJECT.md',
|
|
20
|
-
]
|
|
12
|
+
const REQUIRED_SCAN_DOCS = SCAN_REQUIRED_DOCS
|
|
21
13
|
|
|
22
14
|
/**
|
|
23
15
|
* @param {object} opts
|
package/src/stage-contract.js
CHANGED
|
@@ -9,6 +9,7 @@ import { existsSync, readdirSync, readFileSync } from 'fs'
|
|
|
9
9
|
import { join, basename } from 'path'
|
|
10
10
|
import { execFileSync } from 'child_process'
|
|
11
11
|
import { detectChangeRisk, checkIntegrationEvidence } from './change-risk-profile.js'
|
|
12
|
+
import { SCAN_REQUIRED_DOCS, AUXILIARY_STAGES } from './constants.js'
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* 校验结果
|
|
@@ -215,15 +216,7 @@ function validateScanOutputs(cwd, changeName, context = {}) {
|
|
|
215
216
|
? join(specBase, 'docs', projectName, 'scan')
|
|
216
217
|
: join(specBase, 'docs', 'scan')
|
|
217
218
|
|
|
218
|
-
const requiredDocs =
|
|
219
|
-
'ARCHITECTURE.md',
|
|
220
|
-
'CONVENTIONS.md',
|
|
221
|
-
'STRUCTURE.md',
|
|
222
|
-
'INTEGRATIONS.md',
|
|
223
|
-
'TESTING.md',
|
|
224
|
-
'CONCERNS.md',
|
|
225
|
-
'PROJECT.md',
|
|
226
|
-
]
|
|
219
|
+
const requiredDocs = SCAN_REQUIRED_DOCS
|
|
227
220
|
|
|
228
221
|
const errors = []
|
|
229
222
|
const warnings = []
|
|
@@ -698,10 +691,8 @@ function validateExecuteOutputs(cwd, changeName, context = {}) {
|
|
|
698
691
|
*/
|
|
699
692
|
const mainFlowStages = ['brainstorm', 'plan', 'execute', 'verify']
|
|
700
693
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
*/
|
|
704
|
-
const auxiliaryStages = ['scan', 'quick', 'explore', 'archive', 'status', 'doctor']
|
|
694
|
+
// 辅助阶段(可独立运行,无严格转换顺序)定义在 constants.js 的 AUXILIARY_STAGES,
|
|
695
|
+
// 与 stages/index.js 共用单一真相源,避免两处逐字重复分叉。
|
|
705
696
|
|
|
706
697
|
/**
|
|
707
698
|
* @type {Object<string, StageContract>}
|
|
@@ -812,7 +803,7 @@ export function checkTransition(fromStage, toStage, options = {}) {
|
|
|
812
803
|
}
|
|
813
804
|
|
|
814
805
|
// 辅助阶段随时可执行(archive 除外:从主流程进入 archive 需要校验)
|
|
815
|
-
if (
|
|
806
|
+
if (AUXILIARY_STAGES.includes(toStage) && toStage !== 'archive') {
|
|
816
807
|
return { allowed: true }
|
|
817
808
|
}
|
|
818
809
|
|
|
@@ -838,14 +829,14 @@ export function checkTransition(fromStage, toStage, options = {}) {
|
|
|
838
829
|
return { allowed: true }
|
|
839
830
|
}
|
|
840
831
|
// 独立运行 archive(无前置)也允许
|
|
841
|
-
if (!fromStage ||
|
|
832
|
+
if (!fromStage || AUXILIARY_STAGES.includes(fromStage)) {
|
|
842
833
|
return { allowed: true }
|
|
843
834
|
}
|
|
844
835
|
return { allowed: false, reason: 'archive 的前置阶段是 verify,不能从 ' + fromStage + ' 跳转' }
|
|
845
836
|
}
|
|
846
837
|
|
|
847
838
|
// 从辅助阶段进入主流程:允许
|
|
848
|
-
if (
|
|
839
|
+
if (AUXILIARY_STAGES.includes(fromStage)) {
|
|
849
840
|
return { allowed: true }
|
|
850
841
|
}
|
|
851
842
|
|
|
@@ -899,4 +890,4 @@ export function runValidators(stageName, cwd, changeName, context = {}) {
|
|
|
899
890
|
/**
|
|
900
891
|
* 获取所有主流程阶段
|
|
901
892
|
*/
|
|
902
|
-
export { mainFlowStages, auxiliaryStages }
|
|
893
|
+
export { mainFlowStages, AUXILIARY_STAGES as auxiliaryStages }
|
|
@@ -25,7 +25,7 @@ export const definition = {
|
|
|
25
25
|
3. **检查变更名称**:如果当前变更名是自动生成的(如 \`2026-06-02-new-change-a3f2b7c1\`),直接重命名为有意义名称,然后运行 \`sillyspec change-rename <旧名> <新名>\`
|
|
26
26
|
|
|
27
27
|
### 加载上下文
|
|
28
|
-
4.
|
|
28
|
+
4. 读取项目总览 \`.sillyspec/docs/<project>/scan/PROJECT.md\`(如存在)+ 共享规范 + 子项目上下文
|
|
29
29
|
5. 加载项目信息:\`cat .sillyspec/projects/*.yaml 2>/dev/null\`
|
|
30
30
|
6. 加载本地配置:\`cat .sillyspec/local.yaml 2>/dev/null\`
|
|
31
31
|
7. 棕地项目:读取 scan 下的 STRUCTURE.md、CONVENTIONS.md、ARCHITECTURE.md
|