feat(ai-review 對話收斂): 讀 PR review 留言判斷解決狀態並收斂 findings #42
+9
-6
@@ -64,24 +64,27 @@ function newFindingsOnly(findings) {
|
||||
return findings.filter(f => f.is_new !== false);
|
||||
}
|
||||
|
||||
// 等級無法歸入 critical/warning/info(例如缺漏或無法辨識)時,歸入「無法標示」
|
||||
const isUnclassified = f => !LEVEL_ORDER.includes(f.level);
|
||||
|
||||
export function formatFindingsStats(findings) {
|
||||
const oldFindings = findings.filter(f => f.is_new === false);
|
||||
const newFindings = newFindingsOnly(findings);
|
||||
const row = (label, items) => `| ${label} | ${countBy(items, f => f.level === 'critical')} 筆 | ${countBy(items, f => f.level === 'warning')} 筆 | ${countBy(items, f => f.level === 'info')} 筆 |`;
|
||||
const row = (label, items) => `| ${label} | ${countBy(items, f => f.level === 'critical')} 筆 | ${countBy(items, f => f.level === 'warning')} 筆 | ${countBy(items, f => f.level === 'info')} 筆 | ${countBy(items, isUnclassified)} 筆 |`;
|
||||
|
||||
return [
|
||||
'| 類型 | 🔴 嚴重 | 🟡 警告 | 🔵 建議 |',
|
||||
'| --- | --- | --- | --- |',
|
||||
row('舊問題', oldFindings),
|
||||
'| 類型 | 🔴 嚴重 | 🟡 警告 | 🔵 建議 | ⚪ 無法標示 |',
|
||||
'| --- | --- | --- | --- | --- |',
|
||||
row('新問題', newFindings),
|
||||
row('舊問題', oldFindings),
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
export function formatFindingsStatsLine(findings) {
|
||||
const oldFindings = findings.filter(f => f.is_new === false);
|
||||
const newFindings = newFindingsOnly(findings);
|
||||
const row = items => `嚴重${countBy(items, f => f.level === 'critical')} / 警告${countBy(items, f => f.level === 'warning')} / 建議${countBy(items, f => f.level === 'info')}`;
|
||||
return `舊: ${row(oldFindings)};新: ${row(newFindings)}`;
|
||||
const row = items => `嚴重${countBy(items, f => f.level === 'critical')} / 警告${countBy(items, f => f.level === 'warning')} / 建議${countBy(items, f => f.level === 'info')} / 無法標示${countBy(items, isUnclassified)}`;
|
||||
return `新: ${row(newFindings)};舊: ${row(oldFindings)}`;
|
||||
}
|
||||
|
||||
function buildReviewSummary(findings, usageSection = '') {
|
||||
|
||||
Reference in New Issue
Block a user