job51-gitlab-cr-node-skill-prompt-optimize 1.4.9 → 1.5.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/index.js +7 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -367,13 +367,16 @@ ${diffObject.diff}`;
|
|
|
367
367
|
if (!reviewResult) return null;
|
|
368
368
|
|
|
369
369
|
// 解析<LINE_INFO>[{"new_path":"xxx","new_line":87,"old_path":"yyy","old_line":85}]</LINE_INFO>格式
|
|
370
|
-
const lineInfoRegex = /<LINE_INFO
|
|
370
|
+
const lineInfoRegex = /<LINE_INFO>\s*([\s\S]*?)\s*<\/LINE_INFO>/;
|
|
371
371
|
const match = reviewResult.match(lineInfoRegex);
|
|
372
372
|
|
|
373
373
|
if (match) {
|
|
374
374
|
try {
|
|
375
|
-
//
|
|
376
|
-
const lineInfoJson = match[1].
|
|
375
|
+
// 提取 JSON 内容并去除首尾空白字符
|
|
376
|
+
const lineInfoJson = match[1].trim();
|
|
377
|
+
|
|
378
|
+
debugLog(`解析 LINE_INFO 原始内容:${match[1]}`);
|
|
379
|
+
debugLog(`解析 LINE_INFO 处理后内容:${lineInfoJson}`);
|
|
377
380
|
|
|
378
381
|
// 如果是空数组,返回 null 使用后备方案
|
|
379
382
|
if (lineInfoJson === '[]') {
|
|
@@ -382,6 +385,7 @@ ${diffObject.diff}`;
|
|
|
382
385
|
}
|
|
383
386
|
|
|
384
387
|
const lineInfoArray = JSON.parse(lineInfoJson);
|
|
388
|
+
debugLog(`解析 LINE_INFO JSON 成功:${JSON.stringify(lineInfoArray)}`);
|
|
385
389
|
|
|
386
390
|
if (Array.isArray(lineInfoArray) && lineInfoArray.length > 0) {
|
|
387
391
|
debugLog(`从 LINE_INFO 中解析出行号信息:${JSON.stringify(lineInfoArray)}`);
|
package/package.json
CHANGED