@krotovm/gitlab-ai-review 1.0.24 → 1.0.25
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/prompt/utils.js +10 -2
- package/package.json +1 -1
package/dist/prompt/utils.js
CHANGED
|
@@ -17,9 +17,17 @@ export function normalizeReviewFindingsMarkdown(input) {
|
|
|
17
17
|
const normalized = input.replace(/\r\n/g, "\n").trim();
|
|
18
18
|
if (normalized === "" || normalized === NO_ISSUES_SENTENCE)
|
|
19
19
|
return normalized;
|
|
20
|
-
|
|
20
|
+
// Some providers collapse each finding into one long line.
|
|
21
|
+
// Expand inline markers so parser can recover structured blocks.
|
|
22
|
+
const expanded = normalized
|
|
23
|
+
.replace(/\s+(File:\s*)/gi, "\n$1")
|
|
24
|
+
.replace(/\s+(Line:\s*)/gi, "\n$1")
|
|
25
|
+
.replace(/\s+(Why:\s*)/gi, "\n$1")
|
|
26
|
+
.replace(/(Why:\s*[^\n]+?)\s+([-*•]\s*\[(?:high|medium)\])/gi, "$1\n$2")
|
|
27
|
+
.trim();
|
|
28
|
+
const lines = expanded.split("\n");
|
|
21
29
|
const findings = [];
|
|
22
|
-
const headerRe = /^\s
|
|
30
|
+
const headerRe = /^\s*(?:[-*•]\s*)?\[(high|medium)\]\s+(.+?)\s*$/i;
|
|
23
31
|
const fileRe = /^\s*[-*]?\s*File:\s*(.+?)\s*$/i;
|
|
24
32
|
const lineRe = /^\s*[-*]?\s*Line:\s*(.+?)\s*$/i;
|
|
25
33
|
const whyRe = /^\s*[-*]?\s*Why:\s*(.+?)\s*$/i;
|