@godv61/dsh-task-engine 0.14.0 → 0.17.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/hooks/commit-msg CHANGED
@@ -31,43 +31,73 @@ function readJson(abs) {
31
31
  }
32
32
  }
33
33
 
34
- // Mirrors defaults/eng.json — keep in sync.
35
- const DEFAULTS = {
36
- stages: ['需求评审', '设计', '开发', '交付', '代码审核', '完成'],
37
- start_stage: '需求评审',
38
- transitions: [
39
- { from: '需求评审', to: '设计', requires: ['requirement_confirmation', 'artifacts_present'] },
40
- { from: '设计', to: '开发', requires: ['solution_confirmation', 'artifacts_present'] },
41
- { from: '开发', to: '交付', requires: ['todos_done'] },
42
- { from: '交付', to: '代码审核', requires: ['verified'] },
43
- { from: '代码审核', to: '完成', requires: ['review_passed', 'artifacts_present'] },
44
- ],
45
- artifacts: [
46
- { stage: '需求评审', id: 'requirement', name: '需求说明', fields: ['scope', 'acceptance_criteria'] },
47
- { stage: '设计', id: 'design', name: '设计文档', fields: ['approach', 'risks', 'impact'] },
48
- { stage: '代码审核', id: 'review', name: '评审记录', fields: ['conclusion', 'issues'] },
49
- ],
50
- commit: {
51
- policy: 'task',
52
- message_pattern: '^【(\\S+)】【(?:TASK|T\\d+)】.+',
53
- message_hint: '【<module>】【TASK/T1】说明',
54
- checkpoints: ['交付'],
55
- file_scope: true,
34
+ // Mirrors src/workflows.ts FLOW_CONFIGS — keep in sync.
35
+ const FLOWS = {
36
+ standard: {
37
+ stages: ['需求评审', '设计', '开发', '交付', '代码审核', '完成'],
38
+ start_stage: '需求评审',
39
+ transitions: [
40
+ { from: '需求评审', to: '设计', requires: ['requirement_confirmation', 'artifacts_present'] },
41
+ { from: '设计', to: '开发', requires: ['solution_confirmation', 'artifacts_present'] },
42
+ { from: '开发', to: '交付', requires: ['todos_done'] },
43
+ { from: '交付', to: '代码审核', requires: ['verified'] },
44
+ { from: '代码审核', to: '完成', requires: ['review_passed', 'artifacts_present'] },
45
+ ],
46
+ artifacts: [
47
+ { stage: '需求评审', id: 'requirement', name: '需求说明', fields: ['scope', 'acceptance_criteria'] },
48
+ { stage: '设计', id: 'design', name: '设计文档', fields: ['approach', 'risks', 'impact'] },
49
+ { stage: '代码审核', id: 'review', name: '评审记录', fields: ['conclusion', 'issues'] },
50
+ ],
51
+ commit: {
52
+ policy: 'task',
53
+ message_pattern: '^【(\\S+)】【(?:TASK|T\\d+)】.+',
54
+ message_hint: '【<module>】【TASK/T1】说明',
55
+ checkpoints: ['交付'],
56
+ file_scope: true,
57
+ },
58
+ high_risk_requires_verification: true,
56
59
  },
57
- high_risk_requires_verification: true,
58
- }
59
-
60
- function loadWorkflow(override) {
61
- if (!override) return DEFAULTS
62
- return {
63
- stages: override.stages ?? DEFAULTS.stages,
64
- start_stage: override.start_stage ?? DEFAULTS.start_stage,
65
- transitions: override.transitions ?? DEFAULTS.transitions,
66
- artifacts: override.artifacts ?? DEFAULTS.artifacts,
67
- commit: { ...DEFAULTS.commit, ...(override.commit ?? {}) },
68
- high_risk_requires_verification:
69
- override.high_risk_requires_verification ?? DEFAULTS.high_risk_requires_verification,
70
- }
60
+ agile: {
61
+ stages: ['需求', '开发', '交付', '审查'],
62
+ start_stage: '需求',
63
+ transitions: [
64
+ { from: '需求', to: '开发', requires: ['requirement_confirmation'] },
65
+ { from: '开发', to: '交付', requires: ['todos_done'] },
66
+ { from: '交付', to: '审查', requires: [] },
67
+ ],
68
+ artifacts: [
69
+ { stage: '需求', id: 'requirement', name: '需求说明', fields: ['scope'] },
70
+ ],
71
+ commit: {
72
+ policy: 'item',
73
+ message_pattern: '^【(\\S+)】【T\\d+】.+',
74
+ message_hint: '【<module>】【T1】说明',
75
+ checkpoints: ['交付'],
76
+ file_scope: true,
77
+ },
78
+ high_risk_requires_verification: false,
79
+ },
80
+ minimal: {
81
+ stages: ['开发', '交付'],
82
+ start_stage: '开发',
83
+ transitions: [
84
+ { from: '开发', to: '交付', requires: ['todos_done'] },
85
+ ],
86
+ artifacts: [],
87
+ commit: {
88
+ policy: 'task',
89
+ message_pattern: '',
90
+ message_hint: '无格式要求',
91
+ checkpoints: ['交付'],
92
+ file_scope: false,
93
+ },
94
+ high_risk_requires_verification: false,
95
+ },
96
+ }
97
+
98
+ function loadWorkflow(parsed) {
99
+ const flow = parsed && typeof parsed.flow === 'string' ? parsed.flow : 'standard'
100
+ return FLOWS[flow] || FLOWS.standard
71
101
  }
72
102
 
73
103
  // Mirrors engine.guardSatisfied.