gitlab-ai-review 3.9.0 → 3.9.1
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/lib/prompt-tools.js +13 -4
- package/package.json +1 -1
package/lib/prompt-tools.js
CHANGED
|
@@ -210,18 +210,27 @@ export function buildFileReviewWithImpactPrompt(fileName, meaningfulChanges, imp
|
|
|
210
210
|
|
|
211
211
|
// 文件内部使用情况(重要!)
|
|
212
212
|
if (impactAnalysis.internalUsage && impactAnalysis.internalUsage.length > 0) {
|
|
213
|
-
prompt += `**🚨
|
|
214
|
-
prompt +=
|
|
213
|
+
prompt += `**🚨 文件内部冲突检测** (${impactAnalysis.internalUsage.length} 处):\n`;
|
|
214
|
+
prompt += `当前文件内部发现以下位置使用了被删除的符号:\n\n`;
|
|
215
215
|
|
|
216
216
|
impactAnalysis.internalUsage.slice(0, 5).forEach((usage, index) => {
|
|
217
|
-
|
|
217
|
+
const localWarning = usage.maybeLocal ? ' ⚠️ **可能有局部定义/导入**' : '';
|
|
218
|
+
prompt += `${index + 1}. 第 ${usage.lineNumber} 行使用了被删除的 \`${usage.symbol}\`${localWarning}:\n`;
|
|
218
219
|
prompt += `\`\`\`javascript\n${usage.line}\n\`\`\`\n`;
|
|
219
220
|
});
|
|
220
221
|
|
|
221
222
|
if (impactAnalysis.internalUsage.length > 5) {
|
|
222
223
|
prompt += `... 还有 ${impactAnalysis.internalUsage.length - 5} 处\n`;
|
|
223
224
|
}
|
|
224
|
-
|
|
225
|
+
|
|
226
|
+
prompt += `\n**🔍 重要:作用域分析指南**\n`;
|
|
227
|
+
prompt += `标记了 ⚠️ **可能有局部定义/导入** 的行,表示该行可能:\n`;
|
|
228
|
+
prompt += `1. 定义了局部变量(const/let/var symbol = ...)\n`;
|
|
229
|
+
prompt += `2. 是函数参数(function(symbol) 或 (symbol) => ...)\n`;
|
|
230
|
+
prompt += `3. 从其他模块导入(import { symbol } from ...)\n`;
|
|
231
|
+
prompt += `4. 对象属性或解构({ symbol } 或 symbol:)\n`;
|
|
232
|
+
prompt += `\n**对于这些标记的行,请仔细检查代码上下文,确认是否真的使用了被删除的符号。**\n`;
|
|
233
|
+
prompt += `**如果有局部定义或导入,则不是问题,不要报告!**\n\n`;
|
|
225
234
|
}
|
|
226
235
|
|
|
227
236
|
// 函数签名
|