@shuji-bonji/rfcxml-mcp 0.4.3 → 0.4.5
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/services/rfc-fetcher.d.ts.map +1 -1
- package/dist/services/rfc-fetcher.js +3 -2
- package/dist/services/rfc-fetcher.js.map +1 -1
- package/dist/services/rfc-service.d.ts +5 -0
- package/dist/services/rfc-service.d.ts.map +1 -1
- package/dist/services/rfc-service.js +7 -0
- package/dist/services/rfc-service.js.map +1 -1
- package/dist/services/rfc-text-parser.d.ts.map +1 -1
- package/dist/services/rfc-text-parser.js +152 -21
- package/dist/services/rfc-text-parser.js.map +1 -1
- package/dist/services/rfcxml-parser.d.ts.map +1 -1
- package/dist/services/rfcxml-parser.js +96 -6
- package/dist/services/rfcxml-parser.js.map +1 -1
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +5 -0
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/handlers.d.ts +27 -4
- package/dist/tools/handlers.d.ts.map +1 -1
- package/dist/tools/handlers.js +41 -26
- package/dist/tools/handlers.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/requirement-extractor.d.ts +6 -0
- package/dist/utils/requirement-extractor.d.ts.map +1 -1
- package/dist/utils/requirement-extractor.js +33 -2
- package/dist/utils/requirement-extractor.js.map +1 -1
- package/dist/utils/statement-matcher.d.ts +84 -0
- package/dist/utils/statement-matcher.d.ts.map +1 -0
- package/dist/utils/statement-matcher.js +444 -0
- package/dist/utils/statement-matcher.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Statement Matcher Utility
|
|
3
|
+
* Weighted matching for validate_statement tool
|
|
4
|
+
*/
|
|
5
|
+
import { createRequirementRegex } from '../constants.js';
|
|
6
|
+
// ========================================
|
|
7
|
+
// Matching Configuration
|
|
8
|
+
// ========================================
|
|
9
|
+
/**
|
|
10
|
+
* マッチングに使用する重み設定
|
|
11
|
+
*/
|
|
12
|
+
export const MATCHING_WEIGHTS = {
|
|
13
|
+
/** 通常の単語の重み */
|
|
14
|
+
REGULAR_TERM: 1,
|
|
15
|
+
/** 技術用語の重み */
|
|
16
|
+
TECHNICAL_TERM: 2,
|
|
17
|
+
/** 主語(client, server等)の重み */
|
|
18
|
+
SUBJECT_TERM: 3,
|
|
19
|
+
/** 主語一致時のボーナススコア */
|
|
20
|
+
SUBJECT_MATCH_BONUS: 5,
|
|
21
|
+
/** 要件レベル一致時のボーナススコア */
|
|
22
|
+
LEVEL_MATCH_BONUS: 3,
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* マッチング処理の制限値
|
|
26
|
+
*/
|
|
27
|
+
export const MATCHING_LIMITS = {
|
|
28
|
+
/** キーワードとして認識する最小文字数 */
|
|
29
|
+
MIN_KEYWORD_LENGTH: 3,
|
|
30
|
+
/** 競合検出に必要な最小キーワード重複数 */
|
|
31
|
+
MIN_OVERLAP_FOR_CONFLICT: 2,
|
|
32
|
+
/** 短いステートメントとみなすキーワード数 */
|
|
33
|
+
SHORT_STATEMENT_THRESHOLD: 3,
|
|
34
|
+
/** デフォルトの最大結果数 */
|
|
35
|
+
DEFAULT_MAX_RESULTS: 10,
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Technical terms that should have higher weight
|
|
39
|
+
*/
|
|
40
|
+
const TECHNICAL_TERMS = new Set([
|
|
41
|
+
// Protocol terms
|
|
42
|
+
'client',
|
|
43
|
+
'server',
|
|
44
|
+
'sender',
|
|
45
|
+
'receiver',
|
|
46
|
+
'endpoint',
|
|
47
|
+
'connection',
|
|
48
|
+
'request',
|
|
49
|
+
'response',
|
|
50
|
+
'message',
|
|
51
|
+
'packet',
|
|
52
|
+
'segment',
|
|
53
|
+
'frame',
|
|
54
|
+
'header',
|
|
55
|
+
'payload',
|
|
56
|
+
'handshake',
|
|
57
|
+
// TCP/IP terms
|
|
58
|
+
'port',
|
|
59
|
+
'socket',
|
|
60
|
+
'stream',
|
|
61
|
+
'timeout',
|
|
62
|
+
'retransmit',
|
|
63
|
+
'acknowledgment',
|
|
64
|
+
'sequence',
|
|
65
|
+
'congestion',
|
|
66
|
+
// HTTP terms
|
|
67
|
+
'method',
|
|
68
|
+
'status',
|
|
69
|
+
'resource',
|
|
70
|
+
'cache',
|
|
71
|
+
'proxy',
|
|
72
|
+
'origin',
|
|
73
|
+
// Security terms
|
|
74
|
+
'authentication',
|
|
75
|
+
'authorization',
|
|
76
|
+
'certificate',
|
|
77
|
+
'encryption',
|
|
78
|
+
'signature',
|
|
79
|
+
'token',
|
|
80
|
+
// General technical
|
|
81
|
+
'implementation',
|
|
82
|
+
'specification',
|
|
83
|
+
'protocol',
|
|
84
|
+
'algorithm',
|
|
85
|
+
'parameter',
|
|
86
|
+
'field',
|
|
87
|
+
'value',
|
|
88
|
+
'error',
|
|
89
|
+
'failure',
|
|
90
|
+
'valid',
|
|
91
|
+
'invalid',
|
|
92
|
+
]);
|
|
93
|
+
/**
|
|
94
|
+
* Common words to ignore (low weight)
|
|
95
|
+
*/
|
|
96
|
+
const STOP_WORDS = new Set([
|
|
97
|
+
'the',
|
|
98
|
+
'this',
|
|
99
|
+
'that',
|
|
100
|
+
'with',
|
|
101
|
+
'from',
|
|
102
|
+
'have',
|
|
103
|
+
'been',
|
|
104
|
+
'will',
|
|
105
|
+
'when',
|
|
106
|
+
'where',
|
|
107
|
+
'what',
|
|
108
|
+
'which',
|
|
109
|
+
'there',
|
|
110
|
+
'their',
|
|
111
|
+
'they',
|
|
112
|
+
'them',
|
|
113
|
+
'than',
|
|
114
|
+
'then',
|
|
115
|
+
'each',
|
|
116
|
+
'other',
|
|
117
|
+
'some',
|
|
118
|
+
'such',
|
|
119
|
+
'only',
|
|
120
|
+
'also',
|
|
121
|
+
'more',
|
|
122
|
+
'most',
|
|
123
|
+
'case',
|
|
124
|
+
'does',
|
|
125
|
+
'into',
|
|
126
|
+
'over',
|
|
127
|
+
'used',
|
|
128
|
+
'same',
|
|
129
|
+
'after',
|
|
130
|
+
'before',
|
|
131
|
+
'about',
|
|
132
|
+
'being',
|
|
133
|
+
'could',
|
|
134
|
+
'would',
|
|
135
|
+
'should',
|
|
136
|
+
'could',
|
|
137
|
+
]);
|
|
138
|
+
/**
|
|
139
|
+
* Subject terms that identify the actor
|
|
140
|
+
*/
|
|
141
|
+
const SUBJECT_TERMS = new Set([
|
|
142
|
+
'client',
|
|
143
|
+
'server',
|
|
144
|
+
'sender',
|
|
145
|
+
'receiver',
|
|
146
|
+
'endpoint',
|
|
147
|
+
'implementation',
|
|
148
|
+
'peer',
|
|
149
|
+
'host',
|
|
150
|
+
'proxy',
|
|
151
|
+
'application',
|
|
152
|
+
'user',
|
|
153
|
+
'agent',
|
|
154
|
+
]);
|
|
155
|
+
/**
|
|
156
|
+
* Extract keywords from text with weights
|
|
157
|
+
*/
|
|
158
|
+
export function extractKeywords(text) {
|
|
159
|
+
const keywords = new Map();
|
|
160
|
+
const words = text.toLowerCase().split(/\s+/);
|
|
161
|
+
for (const word of words) {
|
|
162
|
+
// Clean word (remove punctuation)
|
|
163
|
+
const cleaned = word.replace(/[^a-z0-9]/g, '');
|
|
164
|
+
if (cleaned.length < MATCHING_LIMITS.MIN_KEYWORD_LENGTH)
|
|
165
|
+
continue;
|
|
166
|
+
if (STOP_WORDS.has(cleaned))
|
|
167
|
+
continue;
|
|
168
|
+
// Assign weight based on term type
|
|
169
|
+
let weight = MATCHING_WEIGHTS.REGULAR_TERM;
|
|
170
|
+
if (TECHNICAL_TERMS.has(cleaned)) {
|
|
171
|
+
weight = MATCHING_WEIGHTS.TECHNICAL_TERM;
|
|
172
|
+
}
|
|
173
|
+
if (SUBJECT_TERMS.has(cleaned)) {
|
|
174
|
+
weight = MATCHING_WEIGHTS.SUBJECT_TERM;
|
|
175
|
+
}
|
|
176
|
+
// Accumulate weight for repeated terms
|
|
177
|
+
keywords.set(cleaned, (keywords.get(cleaned) || 0) + weight);
|
|
178
|
+
}
|
|
179
|
+
return keywords;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Extract requirement level from text
|
|
183
|
+
*/
|
|
184
|
+
export function extractRequirementLevel(text) {
|
|
185
|
+
const regex = createRequirementRegex();
|
|
186
|
+
const match = regex.exec(text.toUpperCase());
|
|
187
|
+
if (match) {
|
|
188
|
+
return match[1];
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Extract subject from text
|
|
194
|
+
*/
|
|
195
|
+
export function extractSubject(text) {
|
|
196
|
+
const words = text.toLowerCase().split(/\s+/);
|
|
197
|
+
for (const word of words) {
|
|
198
|
+
const cleaned = word.replace(/[^a-z]/g, '');
|
|
199
|
+
if (SUBJECT_TERMS.has(cleaned)) {
|
|
200
|
+
return cleaned;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Score a requirement against statement keywords
|
|
207
|
+
*/
|
|
208
|
+
export function scoreRequirementMatch(requirement, statementKeywords, statementSubject, statementLevel) {
|
|
209
|
+
const reqText = (requirement.text + ' ' + (requirement.fullContext || '')).toLowerCase();
|
|
210
|
+
const matchedKeywords = [];
|
|
211
|
+
let score = 0;
|
|
212
|
+
// Score based on keyword matches
|
|
213
|
+
for (const [keyword, weight] of statementKeywords) {
|
|
214
|
+
if (reqText.includes(keyword)) {
|
|
215
|
+
matchedKeywords.push(keyword);
|
|
216
|
+
score += weight;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Bonus for subject match
|
|
220
|
+
const reqSubject = requirement.subject?.toLowerCase() || extractSubject(requirement.text);
|
|
221
|
+
const subjectMatch = statementSubject !== null && reqSubject === statementSubject;
|
|
222
|
+
if (subjectMatch) {
|
|
223
|
+
score += MATCHING_WEIGHTS.SUBJECT_MATCH_BONUS;
|
|
224
|
+
}
|
|
225
|
+
// Bonus for requirement level match
|
|
226
|
+
const levelMatch = statementLevel !== null && requirement.level === statementLevel;
|
|
227
|
+
if (levelMatch) {
|
|
228
|
+
score += MATCHING_WEIGHTS.LEVEL_MATCH_BONUS;
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
requirement,
|
|
232
|
+
score,
|
|
233
|
+
matchedKeywords,
|
|
234
|
+
subjectMatch,
|
|
235
|
+
levelMatch,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* 否定パターンのマッピング
|
|
240
|
+
* キーワードとその否定形を関連付ける
|
|
241
|
+
*/
|
|
242
|
+
const NEGATION_PAIRS = [
|
|
243
|
+
{
|
|
244
|
+
positive: 'mask',
|
|
245
|
+
negative: ['unmask', 'unmasked', 'not mask', 'without mask', 'without masking'],
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
positive: 'encrypt',
|
|
249
|
+
negative: ['unencrypt', 'unencrypted', 'not encrypt', 'without encrypt', 'without encryption'],
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
positive: 'validate',
|
|
253
|
+
negative: [
|
|
254
|
+
'not validate',
|
|
255
|
+
'skip validation',
|
|
256
|
+
'skips validation',
|
|
257
|
+
'without validation',
|
|
258
|
+
'no validation',
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
positive: 'verify',
|
|
263
|
+
negative: ['not verify', 'unverified', 'without verification', 'skip verification'],
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
positive: 'authenticate',
|
|
267
|
+
negative: [
|
|
268
|
+
'unauthenticated',
|
|
269
|
+
'not authenticate',
|
|
270
|
+
'without authentication',
|
|
271
|
+
'skip authentication',
|
|
272
|
+
],
|
|
273
|
+
},
|
|
274
|
+
{ positive: 'send', negative: ['not send', 'never send', 'block'] },
|
|
275
|
+
{ positive: 'receive', negative: ['not receive', 'reject', 'ignore'] },
|
|
276
|
+
{ positive: 'accept', negative: ['reject', 'not accept', 'refuse'] },
|
|
277
|
+
{ positive: 'include', negative: ['exclude', 'omit', 'not include'] },
|
|
278
|
+
{ positive: 'support', negative: ['not support', 'unsupported'] },
|
|
279
|
+
{ positive: 'allow', negative: ['disallow', 'not allow', 'forbid', 'prohibit'] },
|
|
280
|
+
{ positive: 'enable', negative: ['disable', 'not enable'] },
|
|
281
|
+
{ positive: 'close', negative: ['not close', 'keep open'] },
|
|
282
|
+
{ positive: 'open', negative: ['not open', 'close'] },
|
|
283
|
+
];
|
|
284
|
+
/**
|
|
285
|
+
* テキストが positive アクションを含むか判定(negative でないことを確認)
|
|
286
|
+
* "masks" → true, "unmasked" → false
|
|
287
|
+
*/
|
|
288
|
+
function hasPositiveAction(text, pair) {
|
|
289
|
+
const lower = text.toLowerCase();
|
|
290
|
+
// まず negative をチェック - negative があれば positive ではない
|
|
291
|
+
if (pair.negative.some((neg) => lower.includes(neg))) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
// negative がなければ positive の存在をチェック
|
|
295
|
+
return lower.includes(pair.positive);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* テキストが negative アクションを含むか判定
|
|
299
|
+
*/
|
|
300
|
+
function hasNegativeAction(text, pair) {
|
|
301
|
+
const lower = text.toLowerCase();
|
|
302
|
+
return pair.negative.some((neg) => lower.includes(neg));
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* 2つのアクションが矛盾するかチェック
|
|
306
|
+
*/
|
|
307
|
+
function actionsContradict(action1, action2) {
|
|
308
|
+
for (const pair of NEGATION_PAIRS) {
|
|
309
|
+
const hasPositive1 = hasPositiveAction(action1, pair);
|
|
310
|
+
const hasNegative1 = hasNegativeAction(action1, pair);
|
|
311
|
+
const hasPositive2 = hasPositiveAction(action2, pair);
|
|
312
|
+
const hasNegative2 = hasNegativeAction(action2, pair);
|
|
313
|
+
// 一方が positive、他方が negative なら矛盾
|
|
314
|
+
if ((hasPositive1 && hasNegative2) || (hasNegative1 && hasPositive2)) {
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Detect conflicts between statement and requirements
|
|
322
|
+
*/
|
|
323
|
+
export function detectConflicts(statement, requirements) {
|
|
324
|
+
const conflicts = [];
|
|
325
|
+
const statementLevel = extractRequirementLevel(statement);
|
|
326
|
+
const statementSubject = extractSubject(statement);
|
|
327
|
+
// Subject is still required for meaningful conflict detection
|
|
328
|
+
if (!statementSubject) {
|
|
329
|
+
return conflicts;
|
|
330
|
+
}
|
|
331
|
+
// Define conflicting level pairs
|
|
332
|
+
const conflictingLevels = {
|
|
333
|
+
MAY: ['MUST', 'MUST NOT', 'SHALL', 'SHALL NOT'],
|
|
334
|
+
OPTIONAL: ['MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT'],
|
|
335
|
+
SHOULD: ['MUST NOT', 'SHALL NOT'],
|
|
336
|
+
'SHOULD NOT': ['MUST', 'SHALL', 'REQUIRED'],
|
|
337
|
+
RECOMMENDED: ['MUST NOT', 'SHALL NOT'],
|
|
338
|
+
'NOT RECOMMENDED': ['MUST', 'SHALL', 'REQUIRED'],
|
|
339
|
+
MUST: [],
|
|
340
|
+
'MUST NOT': [],
|
|
341
|
+
REQUIRED: [],
|
|
342
|
+
SHALL: [],
|
|
343
|
+
'SHALL NOT': [],
|
|
344
|
+
};
|
|
345
|
+
const statementKeywords = extractKeywords(statement);
|
|
346
|
+
const statementLower = statement.toLowerCase();
|
|
347
|
+
for (const req of requirements) {
|
|
348
|
+
const reqSubject = req.subject?.toLowerCase() || extractSubject(req.text);
|
|
349
|
+
// Only check requirements with matching subject
|
|
350
|
+
if (reqSubject !== statementSubject)
|
|
351
|
+
continue;
|
|
352
|
+
// Check 1: Level-based conflicts (existing logic)
|
|
353
|
+
if (statementLevel) {
|
|
354
|
+
const conflicting = conflictingLevels[statementLevel] || [];
|
|
355
|
+
if (conflicting.includes(req.level)) {
|
|
356
|
+
const reqText = req.text.toLowerCase();
|
|
357
|
+
let overlap = 0;
|
|
358
|
+
for (const [keyword] of statementKeywords) {
|
|
359
|
+
if (reqText.includes(keyword))
|
|
360
|
+
overlap++;
|
|
361
|
+
}
|
|
362
|
+
if (overlap >= MATCHING_LIMITS.MIN_OVERLAP_FOR_CONFLICT ||
|
|
363
|
+
statementKeywords.size <= MATCHING_LIMITS.SHORT_STATEMENT_THRESHOLD) {
|
|
364
|
+
conflicts.push({
|
|
365
|
+
requirement: req,
|
|
366
|
+
reason: `Statement uses "${statementLevel}" but requirement uses "${req.level}"`,
|
|
367
|
+
statementLevel,
|
|
368
|
+
requirementLevel: req.level,
|
|
369
|
+
});
|
|
370
|
+
continue; // Already found conflict, skip semantic check
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
// Check 2: Semantic conflicts (new logic)
|
|
375
|
+
// Even without explicit level, detect action contradictions
|
|
376
|
+
const reqAction = req.action || req.text;
|
|
377
|
+
const reqLevel = req.level;
|
|
378
|
+
// For MUST requirements: check if statement contradicts the required action
|
|
379
|
+
if (reqLevel === 'MUST' || reqLevel === 'SHALL' || reqLevel === 'REQUIRED') {
|
|
380
|
+
if (actionsContradict(statementLower, reqAction)) {
|
|
381
|
+
conflicts.push({
|
|
382
|
+
requirement: req,
|
|
383
|
+
reason: `Statement action contradicts "${reqLevel}" requirement: "${req.action || req.text}"`,
|
|
384
|
+
statementLevel,
|
|
385
|
+
requirementLevel: reqLevel,
|
|
386
|
+
});
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
// For MUST NOT requirements: check if statement does the forbidden action
|
|
391
|
+
if (reqLevel === 'MUST NOT' || reqLevel === 'SHALL NOT') {
|
|
392
|
+
// Extract the forbidden action (after MUST NOT)
|
|
393
|
+
const forbiddenAction = reqAction.replace(/must not|shall not/gi, '').trim();
|
|
394
|
+
// Find the PRIMARY forbidden action (the verb that appears first)
|
|
395
|
+
// Only check that specific pair to avoid false positives
|
|
396
|
+
for (const pair of NEGATION_PAIRS) {
|
|
397
|
+
// Check if this pair's positive verb is the primary forbidden action
|
|
398
|
+
// by checking if it appears early in the forbidden action text
|
|
399
|
+
const forbiddenLower = forbiddenAction.toLowerCase();
|
|
400
|
+
const verbIndex = forbiddenLower.indexOf(pair.positive);
|
|
401
|
+
// Only consider this pair if the positive verb appears in the first 20 chars
|
|
402
|
+
// (to identify the primary forbidden action, not incidental mentions)
|
|
403
|
+
if (verbIndex === -1 || verbIndex > 20)
|
|
404
|
+
continue;
|
|
405
|
+
const statementDoesPositive = hasPositiveAction(statementLower, pair);
|
|
406
|
+
if (statementDoesPositive) {
|
|
407
|
+
conflicts.push({
|
|
408
|
+
requirement: req,
|
|
409
|
+
reason: `Statement does what "${reqLevel}" forbids: "${forbiddenAction}"`,
|
|
410
|
+
statementLevel,
|
|
411
|
+
requirementLevel: reqLevel,
|
|
412
|
+
});
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return conflicts;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Match statement against requirements
|
|
422
|
+
*/
|
|
423
|
+
export function matchStatement(statement, requirements, options = {}) {
|
|
424
|
+
const { maxResults = MATCHING_LIMITS.DEFAULT_MAX_RESULTS } = options;
|
|
425
|
+
const statementKeywords = extractKeywords(statement);
|
|
426
|
+
const statementSubject = extractSubject(statement);
|
|
427
|
+
const statementLevel = extractRequirementLevel(statement);
|
|
428
|
+
// Score all requirements
|
|
429
|
+
const scored = requirements.map((req) => scoreRequirementMatch(req, statementKeywords, statementSubject, statementLevel));
|
|
430
|
+
// Filter and sort by score
|
|
431
|
+
const matches = scored
|
|
432
|
+
.filter((m) => m.score > 0)
|
|
433
|
+
.sort((a, b) => b.score - a.score)
|
|
434
|
+
.slice(0, maxResults);
|
|
435
|
+
// Detect conflicts
|
|
436
|
+
const conflicts = detectConflicts(statement, requirements);
|
|
437
|
+
return {
|
|
438
|
+
matches,
|
|
439
|
+
conflicts,
|
|
440
|
+
statementLevel,
|
|
441
|
+
statementSubject,
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
//# sourceMappingURL=statement-matcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statement-matcher.js","sourceRoot":"","sources":["../../src/utils/statement-matcher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,2CAA2C;AAC3C,yBAAyB;AACzB,2CAA2C;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,eAAe;IACf,YAAY,EAAE,CAAC;IACf,cAAc;IACd,cAAc,EAAE,CAAC;IACjB,6BAA6B;IAC7B,YAAY,EAAE,CAAC;IACf,oBAAoB;IACpB,mBAAmB,EAAE,CAAC;IACtB,uBAAuB;IACvB,iBAAiB,EAAE,CAAC;CACZ,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,wBAAwB;IACxB,kBAAkB,EAAE,CAAC;IACrB,yBAAyB;IACzB,wBAAwB,EAAE,CAAC;IAC3B,0BAA0B;IAC1B,yBAAyB,EAAE,CAAC;IAC5B,kBAAkB;IAClB,mBAAmB,EAAE,EAAE;CACf,CAAC;AAuBX;;GAEG;AACH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,iBAAiB;IACjB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;IACZ,SAAS;IACT,UAAU;IACV,SAAS;IACT,QAAQ;IACR,SAAS;IACT,OAAO;IACP,QAAQ;IACR,SAAS;IACT,WAAW;IACX,eAAe;IACf,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,gBAAgB;IAChB,UA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