sdd-mcp-server 1.5.1 → 1.6.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/dist/application/services/AnswerValidator.d.ts +7 -0
- package/dist/application/services/AnswerValidator.js +52 -0
- package/dist/application/services/AnswerValidator.js.map +1 -0
- package/dist/application/services/DescriptionAnalyzer.d.ts +28 -0
- package/dist/application/services/DescriptionAnalyzer.js +184 -0
- package/dist/application/services/DescriptionAnalyzer.js.map +1 -0
- package/dist/application/services/DescriptionEnricher.d.ts +15 -0
- package/dist/application/services/DescriptionEnricher.js +77 -0
- package/dist/application/services/DescriptionEnricher.js.map +1 -0
- package/dist/application/services/QuestionGenerator.d.ts +7 -0
- package/dist/application/services/QuestionGenerator.js +30 -0
- package/dist/application/services/QuestionGenerator.js.map +1 -0
- package/dist/application/services/RequirementsClarificationService.d.ts +22 -51
- package/dist/application/services/RequirementsClarificationService.js +44 -419
- package/dist/application/services/RequirementsClarificationService.js.map +1 -1
- package/dist/application/services/SteeringContextLoader.d.ts +11 -0
- package/dist/application/services/SteeringContextLoader.js +90 -0
- package/dist/application/services/SteeringContextLoader.js.map +1 -0
- package/dist/application/services/clarification-questions.d.ts +15 -0
- package/dist/application/services/clarification-questions.js +99 -0
- package/dist/application/services/clarification-questions.js.map +1 -0
- package/dist/domain/types.d.ts +17 -0
- package/dist/infrastructure/di/container.js +18 -0
- package/dist/infrastructure/di/container.js.map +1 -1
- package/dist/infrastructure/di/types.d.ts +5 -0
- package/dist/infrastructure/di/types.js +5 -0
- package/dist/infrastructure/di/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,14 +13,35 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
import { injectable, inject } from "inversify";
|
|
14
14
|
import { v4 as uuidv4 } from "uuid";
|
|
15
15
|
import { TYPES } from "../../infrastructure/di/types.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { SteeringContextLoader } from "./SteeringContextLoader.js";
|
|
17
|
+
import { DescriptionAnalyzer } from "./DescriptionAnalyzer.js";
|
|
18
|
+
import { QuestionGenerator } from "./QuestionGenerator.js";
|
|
19
|
+
import { AnswerValidator } from "./AnswerValidator.js";
|
|
20
|
+
import { DescriptionEnricher } from "./DescriptionEnricher.js";
|
|
21
|
+
/**
|
|
22
|
+
* Orchestrator service for requirements clarification workflow
|
|
23
|
+
*
|
|
24
|
+
* Delegates to specialized services:
|
|
25
|
+
* - SteeringContextLoader: Loads steering documents
|
|
26
|
+
* - DescriptionAnalyzer: Analyzes description quality
|
|
27
|
+
* - QuestionGenerator: Generates clarification questions
|
|
28
|
+
* - AnswerValidator: Validates user answers
|
|
29
|
+
* - DescriptionEnricher: Synthesizes enriched descriptions
|
|
30
|
+
*/
|
|
18
31
|
let RequirementsClarificationService = class RequirementsClarificationService {
|
|
19
|
-
fileSystem;
|
|
20
32
|
logger;
|
|
21
|
-
|
|
22
|
-
|
|
33
|
+
steeringLoader;
|
|
34
|
+
analyzer;
|
|
35
|
+
questionGenerator;
|
|
36
|
+
answerValidator;
|
|
37
|
+
enricher;
|
|
38
|
+
constructor(logger, steeringLoader, analyzer, questionGenerator, answerValidator, enricher) {
|
|
23
39
|
this.logger = logger;
|
|
40
|
+
this.steeringLoader = steeringLoader;
|
|
41
|
+
this.analyzer = analyzer;
|
|
42
|
+
this.questionGenerator = questionGenerator;
|
|
43
|
+
this.answerValidator = answerValidator;
|
|
44
|
+
this.enricher = enricher;
|
|
24
45
|
}
|
|
25
46
|
/**
|
|
26
47
|
* Analyzes a project description to determine if clarification is needed
|
|
@@ -32,9 +53,9 @@ let RequirementsClarificationService = class RequirementsClarificationService {
|
|
|
32
53
|
descriptionLength: description.length,
|
|
33
54
|
});
|
|
34
55
|
// Load existing steering docs for context
|
|
35
|
-
const steeringContext = await this.
|
|
36
|
-
// Perform analysis
|
|
37
|
-
const analysis = this.
|
|
56
|
+
const steeringContext = await this.steeringLoader.loadContext(projectPath);
|
|
57
|
+
// Perform analysis using DescriptionAnalyzer
|
|
58
|
+
const analysis = this.analyzer.analyze(description, steeringContext);
|
|
38
59
|
this.logger.debug("Description analysis completed", {
|
|
39
60
|
correlationId,
|
|
40
61
|
qualityScore: analysis.qualityScore,
|
|
@@ -46,8 +67,8 @@ let RequirementsClarificationService = class RequirementsClarificationService {
|
|
|
46
67
|
analysis,
|
|
47
68
|
};
|
|
48
69
|
}
|
|
49
|
-
// Generate clarification questions
|
|
50
|
-
const questions = this.generateQuestions(analysis, steeringContext);
|
|
70
|
+
// Generate clarification questions using QuestionGenerator
|
|
71
|
+
const questions = this.questionGenerator.generateQuestions(analysis, steeringContext);
|
|
51
72
|
return {
|
|
52
73
|
needsClarification: true,
|
|
53
74
|
questions,
|
|
@@ -58,38 +79,7 @@ let RequirementsClarificationService = class RequirementsClarificationService {
|
|
|
58
79
|
* Validates and processes clarification answers
|
|
59
80
|
*/
|
|
60
81
|
validateAnswers(questions, answers) {
|
|
61
|
-
|
|
62
|
-
const tooShort = [];
|
|
63
|
-
const containsInvalidContent = [];
|
|
64
|
-
for (const question of questions) {
|
|
65
|
-
const answer = answers[question.id]?.trim() || "";
|
|
66
|
-
// Check for missing required answers
|
|
67
|
-
if (question.required && !answer) {
|
|
68
|
-
missingRequired.push(question.question);
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
// Check for too-short answers
|
|
72
|
-
if (answer && answer.length < ANSWER_VALIDATION.MIN_ANSWER_LENGTH) {
|
|
73
|
-
tooShort.push({
|
|
74
|
-
question: question.question,
|
|
75
|
-
minLength: ANSWER_VALIDATION.MIN_ANSWER_LENGTH,
|
|
76
|
-
currentLength: answer.length,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
// Check for potentially malicious content
|
|
80
|
-
if (answer && ANSWER_VALIDATION.INVALID_CONTENT_PATTERN.test(answer)) {
|
|
81
|
-
containsInvalidContent.push(question.question);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
const valid = missingRequired.length === 0 &&
|
|
85
|
-
tooShort.length === 0 &&
|
|
86
|
-
containsInvalidContent.length === 0;
|
|
87
|
-
return {
|
|
88
|
-
valid,
|
|
89
|
-
missingRequired,
|
|
90
|
-
tooShort,
|
|
91
|
-
containsInvalidContent,
|
|
92
|
-
};
|
|
82
|
+
return this.answerValidator.validate(questions, answers);
|
|
93
83
|
}
|
|
94
84
|
/**
|
|
95
85
|
* Synthesizes an enriched project description from original + answers
|
|
@@ -100,387 +90,22 @@ let RequirementsClarificationService = class RequirementsClarificationService {
|
|
|
100
90
|
correlationId,
|
|
101
91
|
questionCount: questions.length,
|
|
102
92
|
});
|
|
103
|
-
|
|
104
|
-
const why = this.extractAnswersByCategory(questions, answers, QuestionCategory.WHY);
|
|
105
|
-
const who = this.extractAnswersByCategory(questions, answers, QuestionCategory.WHO);
|
|
106
|
-
const what = this.extractAnswersByCategory(questions, answers, QuestionCategory.WHAT);
|
|
107
|
-
const how = this.extractAnswersByCategory(questions, answers, QuestionCategory.HOW);
|
|
108
|
-
const successCriteria = this.extractAnswersByCategory(questions, answers, QuestionCategory.SUCCESS);
|
|
109
|
-
// Build enriched description
|
|
110
|
-
const enriched = this.buildEnrichedDescription({
|
|
111
|
-
original: originalDescription,
|
|
112
|
-
why,
|
|
113
|
-
who,
|
|
114
|
-
what,
|
|
115
|
-
how,
|
|
116
|
-
successCriteria,
|
|
117
|
-
});
|
|
118
|
-
return {
|
|
119
|
-
original: originalDescription,
|
|
120
|
-
why,
|
|
121
|
-
who,
|
|
122
|
-
what,
|
|
123
|
-
how: how || undefined,
|
|
124
|
-
successCriteria,
|
|
125
|
-
enriched,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Performs the core analysis of the description
|
|
130
|
-
*/
|
|
131
|
-
performAnalysis(description, steeringContext) {
|
|
132
|
-
const missingElements = [];
|
|
133
|
-
const ambiguousTerms = [];
|
|
134
|
-
// Check for WHY (business justification, problem statement)
|
|
135
|
-
const hasWhy = this.detectWhy(description);
|
|
136
|
-
if (!hasWhy && !steeringContext.hasProductContext) {
|
|
137
|
-
missingElements.push("Business justification or problem statement (WHY)");
|
|
138
|
-
}
|
|
139
|
-
// Check for WHO (target users)
|
|
140
|
-
const hasWho = this.detectWho(description);
|
|
141
|
-
if (!hasWho && !steeringContext.hasTargetUsers) {
|
|
142
|
-
missingElements.push("Target users or personas (WHO)");
|
|
143
|
-
}
|
|
144
|
-
// Check for WHAT (core features, scope)
|
|
145
|
-
const hasWhat = this.detectWhat(description);
|
|
146
|
-
if (!hasWhat) {
|
|
147
|
-
missingElements.push("Core features or scope definition (WHAT)");
|
|
148
|
-
}
|
|
149
|
-
// Check for success criteria
|
|
150
|
-
const hasSuccessCriteria = this.detectSuccessCriteria(description);
|
|
151
|
-
if (!hasSuccessCriteria) {
|
|
152
|
-
missingElements.push("Success criteria or metrics");
|
|
153
|
-
}
|
|
154
|
-
// Detect ambiguous terms
|
|
155
|
-
ambiguousTerms.push(...this.detectAmbiguousTerms(description));
|
|
156
|
-
// Calculate quality score (0-100)
|
|
157
|
-
const qualityScore = this.calculateQualityScore({
|
|
158
|
-
hasWhy,
|
|
159
|
-
hasWho,
|
|
160
|
-
hasWhat,
|
|
161
|
-
hasSuccessCriteria,
|
|
162
|
-
ambiguousTermCount: ambiguousTerms.length,
|
|
163
|
-
descriptionLength: description.length,
|
|
164
|
-
});
|
|
165
|
-
// Need clarification if score below threshold or missing critical elements
|
|
166
|
-
const needsClarification = qualityScore < QUALITY_SCORE_WEIGHTS.MIN_ACCEPTABLE_SCORE ||
|
|
167
|
-
missingElements.length > 0;
|
|
168
|
-
return {
|
|
169
|
-
qualityScore,
|
|
170
|
-
missingElements,
|
|
171
|
-
ambiguousTerms,
|
|
172
|
-
needsClarification,
|
|
173
|
-
hasWhy,
|
|
174
|
-
hasWho,
|
|
175
|
-
hasWhat,
|
|
176
|
-
hasSuccessCriteria,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Generates targeted clarification questions based on analysis
|
|
181
|
-
*/
|
|
182
|
-
generateQuestions(analysis, steeringContext) {
|
|
183
|
-
const questions = [];
|
|
184
|
-
// WHY questions - always high priority
|
|
185
|
-
if (!analysis.hasWhy && !steeringContext.hasProductContext) {
|
|
186
|
-
questions.push({
|
|
187
|
-
id: "why_problem",
|
|
188
|
-
category: QuestionCategory.WHY,
|
|
189
|
-
question: "What business problem does this project solve? Why is it needed?",
|
|
190
|
-
why: "Understanding the business justification ensures we build the right solution",
|
|
191
|
-
examples: [
|
|
192
|
-
"Our customer support team spends 5 hours/day on repetitive inquiries",
|
|
193
|
-
"Users are abandoning checkout because the process takes too long",
|
|
194
|
-
"Developers waste time searching for undocumented APIs",
|
|
195
|
-
],
|
|
196
|
-
required: true,
|
|
197
|
-
});
|
|
198
|
-
questions.push({
|
|
199
|
-
id: "why_value",
|
|
200
|
-
category: QuestionCategory.WHY,
|
|
201
|
-
question: "What value does this project provide to users or the business?",
|
|
202
|
-
why: "Clarifying value proposition helps prioritize features and measure success",
|
|
203
|
-
examples: [
|
|
204
|
-
"Reduce support ticket volume by 40%",
|
|
205
|
-
"Increase conversion rate by improving checkout speed",
|
|
206
|
-
"Save developers 2 hours/week with better documentation",
|
|
207
|
-
],
|
|
208
|
-
required: true,
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
// WHO questions
|
|
212
|
-
if (!analysis.hasWho && !steeringContext.hasTargetUsers) {
|
|
213
|
-
questions.push({
|
|
214
|
-
id: "who_users",
|
|
215
|
-
category: QuestionCategory.WHO,
|
|
216
|
-
question: "Who are the primary users of this project?",
|
|
217
|
-
why: "Knowing the target users shapes UX, features, and technical decisions",
|
|
218
|
-
examples: [
|
|
219
|
-
"Customer support agents using ticketing systems",
|
|
220
|
-
"E-commerce shoppers on mobile devices",
|
|
221
|
-
"Backend developers integrating APIs",
|
|
222
|
-
],
|
|
223
|
-
required: true,
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
// WHAT questions
|
|
227
|
-
if (!analysis.hasWhat) {
|
|
228
|
-
questions.push({
|
|
229
|
-
id: "what_mvp_features",
|
|
230
|
-
category: QuestionCategory.WHAT,
|
|
231
|
-
question: "What are the 3-5 core features for the MVP?",
|
|
232
|
-
why: "Defining MVP scope prevents scope creep and ensures focused delivery",
|
|
233
|
-
examples: [
|
|
234
|
-
"Auto-response system, ticket categorization, analytics dashboard",
|
|
235
|
-
"Product search, cart management, payment integration",
|
|
236
|
-
"API explorer, code examples, interactive documentation",
|
|
237
|
-
],
|
|
238
|
-
required: true,
|
|
239
|
-
});
|
|
240
|
-
questions.push({
|
|
241
|
-
id: "what_out_of_scope",
|
|
242
|
-
category: QuestionCategory.WHAT,
|
|
243
|
-
question: "What is explicitly OUT OF SCOPE for this project?",
|
|
244
|
-
why: "Boundary definition prevents feature creep and manages expectations",
|
|
245
|
-
examples: [
|
|
246
|
-
"Admin panel (future phase)",
|
|
247
|
-
"Mobile app (web only for MVP)",
|
|
248
|
-
"Multi-language support (English only initially)",
|
|
249
|
-
],
|
|
250
|
-
required: false,
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
// SUCCESS questions
|
|
254
|
-
if (!analysis.hasSuccessCriteria) {
|
|
255
|
-
questions.push({
|
|
256
|
-
id: "success_metrics",
|
|
257
|
-
category: QuestionCategory.SUCCESS,
|
|
258
|
-
question: "How will you measure if this project is successful?",
|
|
259
|
-
why: "Quantifiable metrics enable objective evaluation and iteration",
|
|
260
|
-
examples: [
|
|
261
|
-
"Support ticket volume reduced by 30% within 3 months",
|
|
262
|
-
"Page load time under 2 seconds, conversion rate > 3%",
|
|
263
|
-
"API documentation rated 4.5/5 stars by developers",
|
|
264
|
-
],
|
|
265
|
-
required: true,
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
// HOW questions (technical approach) - only if no tech steering
|
|
269
|
-
if (!steeringContext.hasTechContext) {
|
|
270
|
-
questions.push({
|
|
271
|
-
id: "how_tech_constraints",
|
|
272
|
-
category: QuestionCategory.HOW,
|
|
273
|
-
question: "Are there any technical constraints or preferences? (language, platform, existing systems)",
|
|
274
|
-
why: "Technical constraints shape architecture and technology choices",
|
|
275
|
-
examples: [
|
|
276
|
-
"Must integrate with existing Salesforce CRM",
|
|
277
|
-
"TypeScript + React preferred, hosted on AWS",
|
|
278
|
-
"Python-based, needs to run on-premise",
|
|
279
|
-
],
|
|
280
|
-
required: false,
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
// Ambiguity clarification
|
|
284
|
-
for (let i = 0; i < Math.min(analysis.ambiguousTerms.length, 3); i++) {
|
|
285
|
-
const ambiguous = analysis.ambiguousTerms[i];
|
|
286
|
-
questions.push({
|
|
287
|
-
id: `ambiguity_${i + 1}`,
|
|
288
|
-
category: QuestionCategory.WHAT,
|
|
289
|
-
question: `You mentioned "${ambiguous.term}". ${ambiguous.suggestion}`,
|
|
290
|
-
why: "Removing ambiguity ensures shared understanding",
|
|
291
|
-
examples: ambiguous.context ? [ambiguous.context] : undefined,
|
|
292
|
-
required: false,
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
return questions;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Load steering documents for context
|
|
299
|
-
*/
|
|
300
|
-
async loadSteeringContext(projectPath) {
|
|
301
|
-
const defaultContext = {
|
|
302
|
-
hasProductContext: false,
|
|
303
|
-
hasTargetUsers: false,
|
|
304
|
-
hasTechContext: false,
|
|
305
|
-
};
|
|
306
|
-
if (!projectPath) {
|
|
307
|
-
return defaultContext;
|
|
308
|
-
}
|
|
309
|
-
try {
|
|
310
|
-
const context = { ...defaultContext };
|
|
311
|
-
// Check product.md
|
|
312
|
-
try {
|
|
313
|
-
const productPath = `${projectPath}/.kiro/steering/product.md`;
|
|
314
|
-
if (await this.fileSystem.exists(productPath)) {
|
|
315
|
-
const productContent = await this.fileSystem.readFile(productPath);
|
|
316
|
-
context.hasProductContext =
|
|
317
|
-
productContent.length >
|
|
318
|
-
QUALITY_SCORE_WEIGHTS.MIN_STEERING_CONTENT_LENGTH;
|
|
319
|
-
context.hasTargetUsers =
|
|
320
|
-
PATTERN_DETECTION.TARGET_USERS_PATTERN.test(productContent);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
catch (error) {
|
|
324
|
-
this.logger.debug("Failed to load product.md", {
|
|
325
|
-
error: error.message,
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
// Check tech.md
|
|
329
|
-
try {
|
|
330
|
-
const techPath = `${projectPath}/.kiro/steering/tech.md`;
|
|
331
|
-
if (await this.fileSystem.exists(techPath)) {
|
|
332
|
-
const techContent = await this.fileSystem.readFile(techPath);
|
|
333
|
-
context.hasTechContext =
|
|
334
|
-
techContent.length >
|
|
335
|
-
QUALITY_SCORE_WEIGHTS.MIN_STEERING_CONTENT_LENGTH;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
catch (error) {
|
|
339
|
-
this.logger.debug("Failed to load tech.md", {
|
|
340
|
-
error: error.message,
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
return context;
|
|
344
|
-
}
|
|
345
|
-
catch (error) {
|
|
346
|
-
this.logger.warn("Failed to load steering context, using defaults", {
|
|
347
|
-
error: error.message,
|
|
348
|
-
projectPath,
|
|
349
|
-
});
|
|
350
|
-
return defaultContext;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Detects if description contains WHY (business justification)
|
|
355
|
-
*/
|
|
356
|
-
detectWhy(description) {
|
|
357
|
-
return PATTERN_DETECTION.WHY_PATTERNS.some((pattern) => pattern.test(description));
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Detects if description contains WHO (target users)
|
|
361
|
-
*/
|
|
362
|
-
detectWho(description) {
|
|
363
|
-
return PATTERN_DETECTION.WHO_PATTERNS.some((pattern) => pattern.test(description));
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Detects if description contains WHAT (features, scope)
|
|
367
|
-
*/
|
|
368
|
-
detectWhat(description) {
|
|
369
|
-
return PATTERN_DETECTION.WHAT_PATTERNS.some((pattern) => pattern.test(description));
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Detects if description contains success criteria
|
|
373
|
-
*/
|
|
374
|
-
detectSuccessCriteria(description) {
|
|
375
|
-
return PATTERN_DETECTION.SUCCESS_PATTERNS.some((pattern) => pattern.test(description));
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Detects ambiguous terms that need clarification
|
|
379
|
-
*/
|
|
380
|
-
detectAmbiguousTerms(description) {
|
|
381
|
-
const ambiguousTerms = [];
|
|
382
|
-
for (const { pattern, suggestion } of AMBIGUOUS_TERMS) {
|
|
383
|
-
const matches = description.match(pattern);
|
|
384
|
-
if (matches) {
|
|
385
|
-
for (const match of matches) {
|
|
386
|
-
const context = this.extractContext(description, match);
|
|
387
|
-
ambiguousTerms.push({
|
|
388
|
-
term: match,
|
|
389
|
-
context,
|
|
390
|
-
suggestion,
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
return ambiguousTerms;
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* Extracts surrounding context for an ambiguous term
|
|
399
|
-
*/
|
|
400
|
-
extractContext(text, term) {
|
|
401
|
-
const index = text.toLowerCase().indexOf(term.toLowerCase());
|
|
402
|
-
if (index === -1)
|
|
403
|
-
return "";
|
|
404
|
-
const start = Math.max(0, index - 30);
|
|
405
|
-
const end = Math.min(text.length, index + term.length + 30);
|
|
406
|
-
return "..." + text.slice(start, end).trim() + "...";
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Calculates quality score based on completeness and clarity
|
|
410
|
-
*/
|
|
411
|
-
calculateQualityScore(metrics) {
|
|
412
|
-
let score = 0;
|
|
413
|
-
// WHY is most important
|
|
414
|
-
if (metrics.hasWhy)
|
|
415
|
-
score += QUALITY_SCORE_WEIGHTS.HAS_WHY;
|
|
416
|
-
// WHO is critical
|
|
417
|
-
if (metrics.hasWho)
|
|
418
|
-
score += QUALITY_SCORE_WEIGHTS.HAS_WHO;
|
|
419
|
-
// WHAT is essential
|
|
420
|
-
if (metrics.hasWhat)
|
|
421
|
-
score += QUALITY_SCORE_WEIGHTS.HAS_WHAT;
|
|
422
|
-
// Success criteria
|
|
423
|
-
if (metrics.hasSuccessCriteria)
|
|
424
|
-
score += QUALITY_SCORE_WEIGHTS.HAS_SUCCESS;
|
|
425
|
-
// Penalize ambiguous terms
|
|
426
|
-
const ambiguityPenalty = Math.min(QUALITY_SCORE_WEIGHTS.MAX_AMBIGUITY_PENALTY, metrics.ambiguousTermCount * QUALITY_SCORE_WEIGHTS.AMBIGUITY_PENALTY);
|
|
427
|
-
score -= ambiguityPenalty;
|
|
428
|
-
// Length bonus - adequate detail
|
|
429
|
-
if (metrics.descriptionLength > QUALITY_SCORE_WEIGHTS.LENGTH_BONUS_THRESHOLD_1)
|
|
430
|
-
score += QUALITY_SCORE_WEIGHTS.LENGTH_BONUS_POINTS;
|
|
431
|
-
if (metrics.descriptionLength > QUALITY_SCORE_WEIGHTS.LENGTH_BONUS_THRESHOLD_2)
|
|
432
|
-
score += QUALITY_SCORE_WEIGHTS.LENGTH_BONUS_POINTS;
|
|
433
|
-
if (metrics.descriptionLength > QUALITY_SCORE_WEIGHTS.LENGTH_BONUS_THRESHOLD_3)
|
|
434
|
-
score += QUALITY_SCORE_WEIGHTS.LENGTH_BONUS_POINTS;
|
|
435
|
-
return Math.max(0, Math.min(100, score));
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Extracts answers for a specific category
|
|
439
|
-
*/
|
|
440
|
-
extractAnswersByCategory(questions, answers, category) {
|
|
441
|
-
const categoryQuestions = questions.filter((q) => q.category === category);
|
|
442
|
-
const categoryAnswers = categoryQuestions
|
|
443
|
-
.map((q) => answers[q.id])
|
|
444
|
-
.filter((a) => a && a.trim().length > 0);
|
|
445
|
-
return categoryAnswers.join(" ");
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Builds the enriched description from all components
|
|
449
|
-
*/
|
|
450
|
-
buildEnrichedDescription(components) {
|
|
451
|
-
const parts = [];
|
|
452
|
-
// Start with original if it has content
|
|
453
|
-
if (components.original && components.original.trim().length > 0) {
|
|
454
|
-
parts.push(`## Original Description\n${components.original}`);
|
|
455
|
-
}
|
|
456
|
-
// Add WHY
|
|
457
|
-
if (components.why) {
|
|
458
|
-
parts.push(`## Business Justification (Why)\n${components.why}`);
|
|
459
|
-
}
|
|
460
|
-
// Add WHO
|
|
461
|
-
if (components.who) {
|
|
462
|
-
parts.push(`## Target Users (Who)\n${components.who}`);
|
|
463
|
-
}
|
|
464
|
-
// Add WHAT
|
|
465
|
-
if (components.what) {
|
|
466
|
-
parts.push(`## Core Features (What)\n${components.what}`);
|
|
467
|
-
}
|
|
468
|
-
// Add HOW (optional)
|
|
469
|
-
if (components.how) {
|
|
470
|
-
parts.push(`## Technical Approach (How)\n${components.how}`);
|
|
471
|
-
}
|
|
472
|
-
// Add success criteria
|
|
473
|
-
if (components.successCriteria) {
|
|
474
|
-
parts.push(`## Success Criteria\n${components.successCriteria}`);
|
|
475
|
-
}
|
|
476
|
-
return parts.join("\n\n");
|
|
93
|
+
return this.enricher.synthesize(originalDescription, questions, answers);
|
|
477
94
|
}
|
|
478
95
|
};
|
|
479
96
|
RequirementsClarificationService = __decorate([
|
|
480
97
|
injectable(),
|
|
481
|
-
__param(0, inject(TYPES.
|
|
482
|
-
__param(1, inject(TYPES.
|
|
483
|
-
|
|
98
|
+
__param(0, inject(TYPES.LoggerPort)),
|
|
99
|
+
__param(1, inject(TYPES.SteeringContextLoader)),
|
|
100
|
+
__param(2, inject(TYPES.DescriptionAnalyzer)),
|
|
101
|
+
__param(3, inject(TYPES.QuestionGenerator)),
|
|
102
|
+
__param(4, inject(TYPES.AnswerValidator)),
|
|
103
|
+
__param(5, inject(TYPES.DescriptionEnricher)),
|
|
104
|
+
__metadata("design:paramtypes", [Object, SteeringContextLoader,
|
|
105
|
+
DescriptionAnalyzer,
|
|
106
|
+
QuestionGenerator,
|
|
107
|
+
AnswerValidator,
|
|
108
|
+
DescriptionEnricher])
|
|
484
109
|
], RequirementsClarificationService);
|
|
485
110
|
export { RequirementsClarificationService };
|
|
486
111
|
//# sourceMappingURL=RequirementsClarificationService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequirementsClarificationService.js","sourceRoot":"","sources":["../../../src/application/services/RequirementsClarificationService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAEzD,OAAO,EAKL,gBAAgB,GAIjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,8BAA8B,CAAC;AAG/B,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;IAEM;IACJ;IAF7C,YACiD,UAA0B,EAC9B,MAAkB;QADd,eAAU,GAAV,UAAU,CAAgB;QAC9B,WAAM,GAAN,MAAM,CAAY;IAC5D,CAAC;IAEJ;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,WAAmB,EACnB,WAAoB;QAEpB,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC;QAE/B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uDAAuD,EAAE;YACxE,aAAa;YACb,iBAAiB,EAAE,WAAW,CAAC,MAAM;SACtC,CAAC,CAAC;QAEH,0CAA0C;QAC1C,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;QAEpE,mBAAmB;QACnB,MAAM,Q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U,EAAE;IAGR,WAAA,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IAC5B,WAAA,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;;GAHhB,gCAAgC,CA6lB5C"}
|
|
1
|
+
{"version":3,"file":"RequirementsClarificationService.js","sourceRoot":"","sources":["../../../src/application/services/RequirementsClarificationService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAUzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;;;;;;;GASG;AAEI,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;IAEE;IAE1B;IAEA;IAEA;IAEA;IAEA;IAXnB,YAC6C,MAAkB,EAE5C,cAAqC,EAErC,QAA6B,EAE7B,iBAAoC,EAEpC,eAAgC,EAEhC,QAA6B;QAVH,WAAM,GAAN,MAAM,CAAY;QAE5C,mBAAc,GAAd,cAAc,CAAuB;QAErC,aAAQ,GAAR,QAAQ,CAAqB;QAE7B,sBAAiB,GAAjB,iBAAiB,CAAmB;QAEpC,oBAAe,GAAf,eAAe,CAAiB;QAEhC,aAAQ,GAAR,QAAQ,CAAqB;IAC7C,CAAC;IAEJ;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,WAAmB,EACnB,WAAoB;QAEpB,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC;QAE/B,IAAI,C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mBAAmB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;CACF,CAAA;AAxFY,gCAAgC;IAD5C,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IACxB,WAAA,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;IAEnC,WAAA,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAEjC,WAAA,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;IAE/B,WAAA,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IAE7B,WAAA,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;6CAPD,qBAAqB;QAE3B,mBAAmB;QAEV,iBAAiB;QAEnB,eAAe;QAEtB,mBAAmB;GAZrC,gCAAgC,CAwF5C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FileSystemPort, LoggerPort } from "../../domain/ports.js";
|
|
2
|
+
import { SteeringContext } from "../../domain/types.js";
|
|
3
|
+
export declare class SteeringContextLoader {
|
|
4
|
+
private readonly fileSystem;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
constructor(fileSystem: FileSystemPort, logger: LoggerPort);
|
|
7
|
+
/**
|
|
8
|
+
* Load steering documents from filesystem
|
|
9
|
+
*/
|
|
10
|
+
loadContext(projectPath?: string): Promise<SteeringContext>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { injectable, inject } from "inversify";
|
|
14
|
+
import { TYPES } from "../../infrastructure/di/types.js";
|
|
15
|
+
import { QUALITY_SCORE_WEIGHTS, PATTERN_DETECTION, } from "./clarification-constants.js";
|
|
16
|
+
let SteeringContextLoader = class SteeringContextLoader {
|
|
17
|
+
fileSystem;
|
|
18
|
+
logger;
|
|
19
|
+
constructor(fileSystem, logger) {
|
|
20
|
+
this.fileSystem = fileSystem;
|
|
21
|
+
this.logger = logger;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Load steering documents from filesystem
|
|
25
|
+
*/
|
|
26
|
+
async loadContext(projectPath) {
|
|
27
|
+
const defaultContext = {
|
|
28
|
+
hasProductContext: false,
|
|
29
|
+
hasTargetUsers: false,
|
|
30
|
+
hasTechContext: false,
|
|
31
|
+
};
|
|
32
|
+
if (!projectPath) {
|
|
33
|
+
return defaultContext;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
let hasProductContext = false;
|
|
37
|
+
let hasTargetUsers = false;
|
|
38
|
+
let hasTechContext = false;
|
|
39
|
+
// Load product.md with individual error handling
|
|
40
|
+
const productPath = `${projectPath}/.kiro/steering/product.md`;
|
|
41
|
+
if (await this.fileSystem.exists(productPath)) {
|
|
42
|
+
try {
|
|
43
|
+
const content = await this.fileSystem.readFile(productPath);
|
|
44
|
+
hasProductContext =
|
|
45
|
+
content.length > QUALITY_SCORE_WEIGHTS.MIN_STEERING_CONTENT_LENGTH;
|
|
46
|
+
hasTargetUsers = PATTERN_DETECTION.TARGET_USERS_PATTERN.test(content);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
this.logger.debug("Failed to load product.md", {
|
|
50
|
+
error: err.message,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Load tech.md with individual error handling
|
|
55
|
+
const techPath = `${projectPath}/.kiro/steering/tech.md`;
|
|
56
|
+
if (await this.fileSystem.exists(techPath)) {
|
|
57
|
+
try {
|
|
58
|
+
const content = await this.fileSystem.readFile(techPath);
|
|
59
|
+
hasTechContext =
|
|
60
|
+
content.length > QUALITY_SCORE_WEIGHTS.MIN_STEERING_CONTENT_LENGTH;
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
this.logger.debug("Failed to load tech.md", {
|
|
64
|
+
error: err.message,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
hasProductContext,
|
|
70
|
+
hasTargetUsers,
|
|
71
|
+
hasTechContext,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
this.logger.warn("Failed to load steering context, using defaults", {
|
|
76
|
+
error: err.message,
|
|
77
|
+
projectPath,
|
|
78
|
+
});
|
|
79
|
+
return defaultContext;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
SteeringContextLoader = __decorate([
|
|
84
|
+
injectable(),
|
|
85
|
+
__param(0, inject(TYPES.FileSystemPort)),
|
|
86
|
+
__param(1, inject(TYPES.LoggerPort)),
|
|
87
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
88
|
+
], SteeringContextLoader);
|
|
89
|
+
export { SteeringContextLoader };
|
|
90
|
+
//# sourceMappingURL=SteeringContextLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SteeringContextLoader.js","sourceRoot":"","sources":["../../../src/application/services/SteeringContextLoader.ts"],"names":[],"mappings":";;;;;;;;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K,EAAG,GAAa,CAAC,OAAO;qBAC9B,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,8CAA8C;YAC9C,MAAM,QAAQ,GAAG,GAAG,WAAW,yBAAyB,CAAC;YACzD,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC3C,IAAI,CAAC;oBACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;oBACzD,cAAc;wBACZ,OAAO,CAAC,MAAM,GAAG,qBAAqB,CAAC,2BAA2B,CAAC;gBACvE,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE;wBAC1C,KAAK,EAAG,GAAa,CAAC,OAAO;qBAC9B,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,OAAO;gBACL,iBAAiB;gBACjB,cAAc;gBACd,cAAc;aACf,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iDAAiD,EAAE;gBAClE,KAAK,EAAG,GAAa,CAAC,OAAO;gBAC7B,WAAW;aACZ,CAAC,CAAC;YACH,OAAO,cAAc,CAAC;QACxB,CAAC;IACH,CAAC;CACF,CAAA;AAnEY,qBAAqB;IADjC,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IAC5B,WAAA,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;;GAHhB,qBAAqB,CAmEjC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clarification Question Templates Configuration
|
|
3
|
+
* Externalized from service logic for maintainability
|
|
4
|
+
*/
|
|
5
|
+
import { QuestionCategory, ClarificationAnalysis, SteeringContext } from "../../domain/types.js";
|
|
6
|
+
export interface QuestionTemplate {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly category: QuestionCategory;
|
|
9
|
+
readonly question: string;
|
|
10
|
+
readonly rationale: string;
|
|
11
|
+
readonly examples: string[];
|
|
12
|
+
readonly required: boolean;
|
|
13
|
+
readonly condition: (analysis: ClarificationAnalysis, context: SteeringContext) => boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const CLARIFICATION_QUESTIONS: Record<string, QuestionTemplate>;
|