@nahisaho/musubix-workflow-engine 2.4.2
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/dist/application/PhaseController.d.ts +110 -0
- package/dist/application/PhaseController.d.ts.map +1 -0
- package/dist/application/PhaseController.js +272 -0
- package/dist/application/PhaseController.js.map +1 -0
- package/dist/application/QualityGateRunner.d.ts +97 -0
- package/dist/application/QualityGateRunner.d.ts.map +1 -0
- package/dist/application/QualityGateRunner.js +234 -0
- package/dist/application/QualityGateRunner.js.map +1 -0
- package/dist/application/StateTracker.d.ts +119 -0
- package/dist/application/StateTracker.d.ts.map +1 -0
- package/dist/application/StateTracker.js +192 -0
- package/dist/application/StateTracker.js.map +1 -0
- package/dist/application/index.d.ts +11 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/index.js +11 -0
- package/dist/application/index.js.map +1 -0
- package/dist/domain/entities/Phase.d.ts +125 -0
- package/dist/domain/entities/Phase.d.ts.map +1 -0
- package/dist/domain/entities/Phase.js +146 -0
- package/dist/domain/entities/Phase.js.map +1 -0
- package/dist/domain/entities/QualityGate.d.ts +85 -0
- package/dist/domain/entities/QualityGate.d.ts.map +1 -0
- package/dist/domain/entities/QualityGate.js +117 -0
- package/dist/domain/entities/QualityGate.js.map +1 -0
- package/dist/domain/entities/Workflow.d.ts +90 -0
- package/dist/domain/entities/Workflow.d.ts.map +1 -0
- package/dist/domain/entities/Workflow.js +174 -0
- package/dist/domain/entities/Workflow.js.map +1 -0
- package/dist/domain/entities/index.d.ts +11 -0
- package/dist/domain/entities/index.d.ts.map +1 -0
- package/dist/domain/entities/index.js +11 -0
- package/dist/domain/entities/index.js.map +1 -0
- package/dist/domain/events/PhaseTransitioned.d.ts +37 -0
- package/dist/domain/events/PhaseTransitioned.d.ts.map +1 -0
- package/dist/domain/events/PhaseTransitioned.js +38 -0
- package/dist/domain/events/PhaseTransitioned.js.map +1 -0
- package/dist/domain/events/QualityGatePassed.d.ts +63 -0
- package/dist/domain/events/QualityGatePassed.d.ts.map +1 -0
- package/dist/domain/events/QualityGatePassed.js +68 -0
- package/dist/domain/events/QualityGatePassed.js.map +1 -0
- package/dist/domain/events/index.d.ts +13 -0
- package/dist/domain/events/index.d.ts.map +1 -0
- package/dist/domain/events/index.js +9 -0
- package/dist/domain/events/index.js.map +1 -0
- package/dist/domain/index.d.ts +11 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +14 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/value-objects/ApprovalStatus.d.ts +69 -0
- package/dist/domain/value-objects/ApprovalStatus.d.ts.map +1 -0
- package/dist/domain/value-objects/ApprovalStatus.js +105 -0
- package/dist/domain/value-objects/ApprovalStatus.js.map +1 -0
- package/dist/domain/value-objects/PhaseType.d.ts +66 -0
- package/dist/domain/value-objects/PhaseType.d.ts.map +1 -0
- package/dist/domain/value-objects/PhaseType.js +105 -0
- package/dist/domain/value-objects/PhaseType.js.map +1 -0
- package/dist/domain/value-objects/TaskStatus.d.ts +59 -0
- package/dist/domain/value-objects/TaskStatus.d.ts.map +1 -0
- package/dist/domain/value-objects/TaskStatus.js +90 -0
- package/dist/domain/value-objects/TaskStatus.js.map +1 -0
- package/dist/domain/value-objects/index.d.ts +11 -0
- package/dist/domain/value-objects/index.d.ts.map +1 -0
- package/dist/domain/value-objects/index.js +11 -0
- package/dist/domain/value-objects/index.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PhaseController - Application Service
|
|
3
|
+
*
|
|
4
|
+
* Controls phase transitions and manages workflow state
|
|
5
|
+
*
|
|
6
|
+
* @see TSK-WORKFLOW-001 - PhaseController
|
|
7
|
+
* @see REQ-ORCH-001 - Phase Transition
|
|
8
|
+
* @see DES-ORCH-001 - PhaseController Component
|
|
9
|
+
*/
|
|
10
|
+
import { type PhaseType, type Phase, type Workflow, type ReviewResult, type ReviewCheckpoint } from '../domain/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Phase controller configuration
|
|
13
|
+
*/
|
|
14
|
+
export interface PhaseControllerConfig {
|
|
15
|
+
/** Auto-start workflow on creation */
|
|
16
|
+
autoStart?: boolean;
|
|
17
|
+
/** Require explicit approval for transitions */
|
|
18
|
+
requireApproval?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Phase controller result
|
|
22
|
+
*/
|
|
23
|
+
export interface PhaseControllerResult<T = void> {
|
|
24
|
+
readonly success: boolean;
|
|
25
|
+
readonly data?: T;
|
|
26
|
+
readonly error?: string;
|
|
27
|
+
readonly message: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Phase Controller
|
|
31
|
+
*
|
|
32
|
+
* Manages workflow phase transitions
|
|
33
|
+
*/
|
|
34
|
+
export declare class PhaseController {
|
|
35
|
+
private workflows;
|
|
36
|
+
private readonly config;
|
|
37
|
+
constructor(config?: PhaseControllerConfig);
|
|
38
|
+
/**
|
|
39
|
+
* Create a new workflow
|
|
40
|
+
*
|
|
41
|
+
* @param name - Workflow name
|
|
42
|
+
* @param description - Optional description
|
|
43
|
+
* @returns Created workflow
|
|
44
|
+
*/
|
|
45
|
+
createWorkflow(name: string, description?: string): PhaseControllerResult<Workflow>;
|
|
46
|
+
/**
|
|
47
|
+
* Get workflow by ID
|
|
48
|
+
*
|
|
49
|
+
* @param workflowId - Workflow ID
|
|
50
|
+
* @returns Workflow or undefined
|
|
51
|
+
*/
|
|
52
|
+
getWorkflow(workflowId: string): Workflow | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Submit phase for review
|
|
55
|
+
*
|
|
56
|
+
* @param workflowId - Workflow ID
|
|
57
|
+
* @param checkpoints - Review checkpoints
|
|
58
|
+
* @returns Review result
|
|
59
|
+
*/
|
|
60
|
+
submitForReview(workflowId: string, checkpoints: ReviewCheckpoint[]): PhaseControllerResult<ReviewResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Process user approval/rejection response
|
|
63
|
+
*
|
|
64
|
+
* @param workflowId - Workflow ID
|
|
65
|
+
* @param userInput - User input text
|
|
66
|
+
* @param approver - Approver identifier
|
|
67
|
+
* @returns Result
|
|
68
|
+
*/
|
|
69
|
+
processApproval(workflowId: string, userInput: string, approver: string): PhaseControllerResult<Phase>;
|
|
70
|
+
/**
|
|
71
|
+
* Transition to next phase
|
|
72
|
+
*
|
|
73
|
+
* @param workflowId - Workflow ID
|
|
74
|
+
* @param targetPhase - Target phase
|
|
75
|
+
* @returns Result
|
|
76
|
+
*/
|
|
77
|
+
transitionTo(workflowId: string, targetPhase: PhaseType): PhaseControllerResult<Workflow>;
|
|
78
|
+
/**
|
|
79
|
+
* Get next valid phase
|
|
80
|
+
*
|
|
81
|
+
* @param workflowId - Workflow ID
|
|
82
|
+
* @returns Next phase type or null
|
|
83
|
+
*/
|
|
84
|
+
getNextPhase(workflowId: string): PhaseType | null;
|
|
85
|
+
/**
|
|
86
|
+
* Format review message for display
|
|
87
|
+
*
|
|
88
|
+
* @param review - Review result
|
|
89
|
+
* @returns Formatted message
|
|
90
|
+
*/
|
|
91
|
+
private formatReviewMessage;
|
|
92
|
+
/**
|
|
93
|
+
* Get all workflows
|
|
94
|
+
*
|
|
95
|
+
* @returns All workflows
|
|
96
|
+
*/
|
|
97
|
+
getAllWorkflows(): Workflow[];
|
|
98
|
+
/**
|
|
99
|
+
* Clear all workflows (for testing)
|
|
100
|
+
*/
|
|
101
|
+
clearAll(): void;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create a phase controller instance
|
|
105
|
+
*
|
|
106
|
+
* @param config - Configuration
|
|
107
|
+
* @returns PhaseController instance
|
|
108
|
+
*/
|
|
109
|
+
export declare function createPhaseController(config?: PhaseControllerConfig): PhaseController;
|
|
110
|
+
//# sourceMappingURL=PhaseController.d.ts.map
|
|
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CAAC,KAAK,CAAC;IAwD/B;;;;;;OAMG;IACH,YAAY,CACV,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,SAAS,GACrB,qBAAqB,CAAC,QAAQ,CAAC;IAqClC;;;;;OAKG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAuBlD;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAe3B;;;;OAIG;IACH,eAAe,IAAI,QAAQ,EAAE;IAI7B;;OAEG;IACH,QAAQ,IAAI,IAAI;CAGjB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,eAAe,CAErF"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PhaseController - Application Service
|
|
3
|
+
*
|
|
4
|
+
* Controls phase transitions and manages workflow state
|
|
5
|
+
*
|
|
6
|
+
* @see TSK-WORKFLOW-001 - PhaseController
|
|
7
|
+
* @see REQ-ORCH-001 - Phase Transition
|
|
8
|
+
* @see DES-ORCH-001 - PhaseController Component
|
|
9
|
+
*/
|
|
10
|
+
import { createWorkflow, startWorkflow, updatePhase, transitionToPhase, getCurrentPhase, setReview, approvePhase, createReviewResult, parseApprovalFromInput, getPhaseMetadata, generateWorkflowId, } from '../domain/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Phase Controller
|
|
13
|
+
*
|
|
14
|
+
* Manages workflow phase transitions
|
|
15
|
+
*/
|
|
16
|
+
export class PhaseController {
|
|
17
|
+
workflows = new Map();
|
|
18
|
+
config;
|
|
19
|
+
constructor(config = {}) {
|
|
20
|
+
this.config = {
|
|
21
|
+
autoStart: true,
|
|
22
|
+
requireApproval: true,
|
|
23
|
+
...config,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create a new workflow
|
|
28
|
+
*
|
|
29
|
+
* @param name - Workflow name
|
|
30
|
+
* @param description - Optional description
|
|
31
|
+
* @returns Created workflow
|
|
32
|
+
*/
|
|
33
|
+
createWorkflow(name, description) {
|
|
34
|
+
try {
|
|
35
|
+
const id = generateWorkflowId(name);
|
|
36
|
+
let workflow = createWorkflow(id, name, description);
|
|
37
|
+
if (this.config.autoStart) {
|
|
38
|
+
workflow = startWorkflow(workflow);
|
|
39
|
+
}
|
|
40
|
+
this.workflows.set(id, workflow);
|
|
41
|
+
return {
|
|
42
|
+
success: true,
|
|
43
|
+
data: workflow,
|
|
44
|
+
message: `Workflow "${name}" created with ID: ${id}`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
return {
|
|
49
|
+
success: false,
|
|
50
|
+
error: error instanceof Error ? error.message : String(error),
|
|
51
|
+
message: 'Failed to create workflow',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get workflow by ID
|
|
57
|
+
*
|
|
58
|
+
* @param workflowId - Workflow ID
|
|
59
|
+
* @returns Workflow or undefined
|
|
60
|
+
*/
|
|
61
|
+
getWorkflow(workflowId) {
|
|
62
|
+
return this.workflows.get(workflowId);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Submit phase for review
|
|
66
|
+
*
|
|
67
|
+
* @param workflowId - Workflow ID
|
|
68
|
+
* @param checkpoints - Review checkpoints
|
|
69
|
+
* @returns Review result
|
|
70
|
+
*/
|
|
71
|
+
submitForReview(workflowId, checkpoints) {
|
|
72
|
+
try {
|
|
73
|
+
const workflow = this.workflows.get(workflowId);
|
|
74
|
+
if (!workflow) {
|
|
75
|
+
return {
|
|
76
|
+
success: false,
|
|
77
|
+
error: 'Workflow not found',
|
|
78
|
+
message: `Workflow ${workflowId} not found`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const currentPhase = getCurrentPhase(workflow);
|
|
82
|
+
if (!currentPhase) {
|
|
83
|
+
return {
|
|
84
|
+
success: false,
|
|
85
|
+
error: 'No active phase',
|
|
86
|
+
message: 'Workflow has no active phase',
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const review = createReviewResult(currentPhase.type, checkpoints);
|
|
90
|
+
const updatedPhase = setReview(currentPhase, review);
|
|
91
|
+
const updatedWorkflow = updatePhase(workflow, updatedPhase);
|
|
92
|
+
this.workflows.set(workflowId, updatedWorkflow);
|
|
93
|
+
return {
|
|
94
|
+
success: true,
|
|
95
|
+
data: review,
|
|
96
|
+
message: this.formatReviewMessage(review),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return {
|
|
101
|
+
success: false,
|
|
102
|
+
error: error instanceof Error ? error.message : String(error),
|
|
103
|
+
message: 'Failed to submit for review',
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Process user approval/rejection response
|
|
109
|
+
*
|
|
110
|
+
* @param workflowId - Workflow ID
|
|
111
|
+
* @param userInput - User input text
|
|
112
|
+
* @param approver - Approver identifier
|
|
113
|
+
* @returns Result
|
|
114
|
+
*/
|
|
115
|
+
processApproval(workflowId, userInput, approver) {
|
|
116
|
+
try {
|
|
117
|
+
const workflow = this.workflows.get(workflowId);
|
|
118
|
+
if (!workflow) {
|
|
119
|
+
return {
|
|
120
|
+
success: false,
|
|
121
|
+
error: 'Workflow not found',
|
|
122
|
+
message: `Workflow ${workflowId} not found`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const currentPhase = getCurrentPhase(workflow);
|
|
126
|
+
if (!currentPhase) {
|
|
127
|
+
return {
|
|
128
|
+
success: false,
|
|
129
|
+
error: 'No active phase',
|
|
130
|
+
message: 'Workflow has no active phase',
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const approvalStatus = parseApprovalFromInput(userInput);
|
|
134
|
+
if (approvalStatus === 'rejected') {
|
|
135
|
+
return {
|
|
136
|
+
success: true,
|
|
137
|
+
data: currentPhase,
|
|
138
|
+
message: '修正が要求されました。フィードバックに基づいて修正を行います。',
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
if (approvalStatus === 'approved') {
|
|
142
|
+
const approvedPhase = approvePhase(currentPhase, approver, userInput);
|
|
143
|
+
const updatedWorkflow = updatePhase(workflow, approvedPhase);
|
|
144
|
+
this.workflows.set(workflowId, updatedWorkflow);
|
|
145
|
+
return {
|
|
146
|
+
success: true,
|
|
147
|
+
data: approvedPhase,
|
|
148
|
+
message: `${getPhaseMetadata(currentPhase.type).label}が承認されました。`,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
success: false,
|
|
153
|
+
error: 'Approval status unclear',
|
|
154
|
+
message: '承認キーワードが検出できませんでした。「承認」または「修正」でお答えください。',
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
return {
|
|
159
|
+
success: false,
|
|
160
|
+
error: error instanceof Error ? error.message : String(error),
|
|
161
|
+
message: 'Failed to process approval',
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Transition to next phase
|
|
167
|
+
*
|
|
168
|
+
* @param workflowId - Workflow ID
|
|
169
|
+
* @param targetPhase - Target phase
|
|
170
|
+
* @returns Result
|
|
171
|
+
*/
|
|
172
|
+
transitionTo(workflowId, targetPhase) {
|
|
173
|
+
try {
|
|
174
|
+
const workflow = this.workflows.get(workflowId);
|
|
175
|
+
if (!workflow) {
|
|
176
|
+
return {
|
|
177
|
+
success: false,
|
|
178
|
+
error: 'Workflow not found',
|
|
179
|
+
message: `Workflow ${workflowId} not found`,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
// Enforce requirement: design → implementation is FORBIDDEN
|
|
183
|
+
if (workflow.currentPhase === 'design' && targetPhase === 'implementation') {
|
|
184
|
+
return {
|
|
185
|
+
success: false,
|
|
186
|
+
error: 'Direct transition forbidden',
|
|
187
|
+
message: '⚠️ 設計から実装への直接遷移は禁止されています。必ずPhase 3(タスク分解)を経てください。',
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
const updatedWorkflow = transitionToPhase(workflow, targetPhase);
|
|
191
|
+
this.workflows.set(workflowId, updatedWorkflow);
|
|
192
|
+
return {
|
|
193
|
+
success: true,
|
|
194
|
+
data: updatedWorkflow,
|
|
195
|
+
message: `${getPhaseMetadata(targetPhase).label}に移行しました。`,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
return {
|
|
200
|
+
success: false,
|
|
201
|
+
error: error instanceof Error ? error.message : String(error),
|
|
202
|
+
message: 'Failed to transition phase',
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Get next valid phase
|
|
208
|
+
*
|
|
209
|
+
* @param workflowId - Workflow ID
|
|
210
|
+
* @returns Next phase type or null
|
|
211
|
+
*/
|
|
212
|
+
getNextPhase(workflowId) {
|
|
213
|
+
const workflow = this.workflows.get(workflowId);
|
|
214
|
+
if (!workflow?.currentPhase) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
const currentPhase = workflow.currentPhase;
|
|
218
|
+
const phaseOrder = [
|
|
219
|
+
'requirements',
|
|
220
|
+
'design',
|
|
221
|
+
'task-breakdown',
|
|
222
|
+
'implementation',
|
|
223
|
+
'completion',
|
|
224
|
+
];
|
|
225
|
+
const currentIndex = phaseOrder.indexOf(currentPhase);
|
|
226
|
+
if (currentIndex < 0 || currentIndex >= phaseOrder.length - 1) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
return phaseOrder[currentIndex + 1];
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Format review message for display
|
|
233
|
+
*
|
|
234
|
+
* @param review - Review result
|
|
235
|
+
* @returns Formatted message
|
|
236
|
+
*/
|
|
237
|
+
formatReviewMessage(review) {
|
|
238
|
+
const lines = ['📋 **レビュー結果**', '', '| 観点 | 状態 | 詳細 |', '|------|------|------|'];
|
|
239
|
+
for (const checkpoint of review.checkpoints) {
|
|
240
|
+
lines.push(`| ${checkpoint.name} | ${checkpoint.status} | ${checkpoint.details} |`);
|
|
241
|
+
}
|
|
242
|
+
lines.push('');
|
|
243
|
+
lines.push('👉 **次のアクションを選択してください:**');
|
|
244
|
+
lines.push('- 「修正」/ 具体的な修正指示 → 修正して再提示');
|
|
245
|
+
lines.push('- 「承認」/「OK」/「進める」 → 次フェーズへ');
|
|
246
|
+
return lines.join('\n');
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Get all workflows
|
|
250
|
+
*
|
|
251
|
+
* @returns All workflows
|
|
252
|
+
*/
|
|
253
|
+
getAllWorkflows() {
|
|
254
|
+
return Array.from(this.workflows.values());
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Clear all workflows (for testing)
|
|
258
|
+
*/
|
|
259
|
+
clearAll() {
|
|
260
|
+
this.workflows.clear();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Create a phase controller instance
|
|
265
|
+
*
|
|
266
|
+
* @param config - Configuration
|
|
267
|
+
* @returns PhaseController instance
|
|
268
|
+
*/
|
|
269
|
+
export function createPhaseController(config) {
|
|
270
|
+
return new PhaseController(config);
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=PhaseController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhaseController.js","sourceRoot":"","sources":["../../src/application/PhaseController.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAML,cAAc,EACd,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAsB5B;;;;GAIG;AACH,MAAM,OAAO,eAAe;IAClB,SAAS,GAA0B,IA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,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA8B;IAClE,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QualityGateRunner - Application Service
|
|
3
|
+
*
|
|
4
|
+
* Runs quality gates and validates phase completion
|
|
5
|
+
*
|
|
6
|
+
* @see TSK-WORKFLOW-003 - QualityGateRunner
|
|
7
|
+
* @see REQ-ORCH-003 - Quality Gate Integration
|
|
8
|
+
* @see DES-ORCH-003 - QualityGateRunner Component
|
|
9
|
+
*/
|
|
10
|
+
import { type PhaseType, type QualityGate, type QualityGateResult } from '../domain/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Gate runner configuration
|
|
13
|
+
*/
|
|
14
|
+
export interface QualityGateRunnerConfig {
|
|
15
|
+
/** Timeout for individual gate execution (ms) */
|
|
16
|
+
gateTimeout?: number;
|
|
17
|
+
/** Continue running gates after failure */
|
|
18
|
+
continueOnFailure?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Gate run result
|
|
22
|
+
*/
|
|
23
|
+
export interface GateRunResult {
|
|
24
|
+
readonly phase: PhaseType;
|
|
25
|
+
readonly results: readonly QualityGateResult[];
|
|
26
|
+
readonly allPassed: boolean;
|
|
27
|
+
readonly mandatoryPassed: boolean;
|
|
28
|
+
readonly summary: string;
|
|
29
|
+
readonly duration: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Quality Gate Runner
|
|
33
|
+
*
|
|
34
|
+
* Executes quality gates for phase transitions
|
|
35
|
+
*/
|
|
36
|
+
export declare class QualityGateRunner {
|
|
37
|
+
private gates;
|
|
38
|
+
private readonly config;
|
|
39
|
+
constructor(config?: QualityGateRunnerConfig);
|
|
40
|
+
/**
|
|
41
|
+
* Register a quality gate
|
|
42
|
+
*
|
|
43
|
+
* @param gate - Quality gate to register
|
|
44
|
+
*/
|
|
45
|
+
registerGate(gate: QualityGate): void;
|
|
46
|
+
/**
|
|
47
|
+
* Run all gates for a phase
|
|
48
|
+
*
|
|
49
|
+
* @param phase - Phase type
|
|
50
|
+
* @returns Gate run result
|
|
51
|
+
*/
|
|
52
|
+
runGates(phase: PhaseType): Promise<GateRunResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Execute gate with timeout
|
|
55
|
+
*
|
|
56
|
+
* @param gate - Gate to execute
|
|
57
|
+
* @returns Gate result
|
|
58
|
+
*/
|
|
59
|
+
private executeWithTimeout;
|
|
60
|
+
/**
|
|
61
|
+
* Register default quality gates
|
|
62
|
+
*/
|
|
63
|
+
private registerDefaultGates;
|
|
64
|
+
/**
|
|
65
|
+
* Create a passing result (placeholder for actual implementation)
|
|
66
|
+
*
|
|
67
|
+
* @param name - Check name
|
|
68
|
+
* @returns Passing check result
|
|
69
|
+
*/
|
|
70
|
+
private createPassingResult;
|
|
71
|
+
/**
|
|
72
|
+
* Format gate results for display
|
|
73
|
+
*
|
|
74
|
+
* @param result - Gate run result
|
|
75
|
+
* @returns Formatted string
|
|
76
|
+
*/
|
|
77
|
+
formatResults(result: GateRunResult): string;
|
|
78
|
+
/**
|
|
79
|
+
* Get registered gates for a phase
|
|
80
|
+
*
|
|
81
|
+
* @param phase - Phase type
|
|
82
|
+
* @returns Quality gates
|
|
83
|
+
*/
|
|
84
|
+
getGatesForPhase(phase: PhaseType): readonly QualityGate[];
|
|
85
|
+
/**
|
|
86
|
+
* Clear all gates
|
|
87
|
+
*/
|
|
88
|
+
clearGates(): void;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create a quality gate runner instance
|
|
92
|
+
*
|
|
93
|
+
* @param config - Configuration
|
|
94
|
+
* @returns QualityGateRunner instance
|
|
95
|
+
*/
|
|
96
|
+
export declare function createQualityGateRunner(config?: QualityGateRunnerConfig): QualityGateRunner;
|
|
97
|
+
//# sourceMappingURL=QualityGateRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QualityGateRunner.d.ts","sourceRoot":"","sources":["../../src/application/QualityGateRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,iBAAiB,EAKvB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAA4C;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;gBAErC,MAAM,GAAE,uBAA4B;IAWhD;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAMrC;;;;;OAKG;IACG,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC;IA2CxD;;;;;OAKG;YACW,kBAAkB;IAWhC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA+E5B;;;;;OAKG;IACH,OAAO,CAAC,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