feat(ai-review review): 發布統計 Review 並彙整行內 comments

This commit is contained in:
2026-06-22 10:01:49 +00:00
parent 1b3c5a7aec
commit 757d9ad3c2
3 changed files with 83 additions and 7 deletions
+4 -6
View File
@@ -3,7 +3,7 @@ import { GITEA_REPOSITORY, PR_NUMBER, PR_HEAD_BRANCH, PR_BASE_BRANCH, getLLMConf
import { loadRoles, getRoleIntro } from './roles.js';
import { getPRDiff, postComment, getCommitMessageBySha, getBotReviewOutcome, shouldSkipBotCommit } from './gitea.js';
import { analyzeWithRole, loadOldFindings, mergeFindings, sortByLevel, deduplicateWithAI, loadExclusions, applyExclusions, filterFalsePositivesWithAI } from './findings.js';
import { saveFindings, postOldFindingsComment, postNewNonCriticalComment, postNewCriticalComments } from './comments.js';
import { saveFindings, postFindingsReview } from './comments.js';
import { cloneRepo, commitAndPush, getRepoState } from './git.js';
import { validateJSONArrayFile, ensureJSONArrayFileExists } from './json.js';
import { runPreflight } from './preflight.js';
@@ -107,16 +107,14 @@ async function main() {
const filtered = await filterFalsePositivesWithAI(ruleFiltered, exclusions);
ok(`Step4 完成: findings total=${filtered.length}`);
step('Step5', 'Findings 寫入與 Comment 發布');
step('Step5', 'Findings 寫入與 Review 發布');
const reviewDir = repoDir || WORKSPACE;
saveFindings(WORKSPACE, filtered, reviewDir);
try {
await postOldFindingsComment(filtered);
await postNewNonCriticalComment(filtered);
await postNewCriticalComments(filtered);
await postFindingsReview(filtered);
ok('Step5 完成');
} catch (e) {
warn(`comment 發布失敗(繼續執行): ${e.message}`);
warn(`review 發布失敗(繼續執行): ${e.message}`);
}
step('Step6', 'JSON 格式驗證');