feat(ai-review 使用量): 新增多平台 AI 助理使用量統計與剩餘可用百分比
This commit is contained in:
+7
-4
@@ -84,12 +84,14 @@ export function formatFindingsStatsLine(findings) {
|
||||
return `舊: ${row(oldFindings)};新: ${row(newFindings)}`;
|
||||
}
|
||||
|
||||
function buildReviewSummary(findings) {
|
||||
return [
|
||||
function buildReviewSummary(findings, usageSection = '') {
|
||||
const parts = [
|
||||
'## AI Code Review 統計',
|
||||
'',
|
||||
formatFindingsStats(findings),
|
||||
].join('\n');
|
||||
];
|
||||
if (usageSection) parts.push('', usageSection);
|
||||
return parts.join('\n');
|
||||
}
|
||||
|
||||
function toReviewComment(f) {
|
||||
@@ -112,10 +114,11 @@ export async function postFindingsReview(findings, deps = {}) {
|
||||
postReview = postPullReview,
|
||||
summaryFindings = findings,
|
||||
commentFindings = findings,
|
||||
usageSection = '',
|
||||
} = deps;
|
||||
const sortedComments = [...commentFindings].sort(bySeverity);
|
||||
const comments = sortedComments.map(toReviewComment).filter(Boolean);
|
||||
const body = buildReviewSummary(summaryFindings);
|
||||
const body = buildReviewSummary(summaryFindings, usageSection);
|
||||
await postReview({ body, comments });
|
||||
ok(`review 發布: summary=${summaryFindings.length} total=${sortedComments.length} commentable=${comments.length}`);
|
||||
line(`review summary 統計: ${formatFindingsStatsLine(summaryFindings)}`);
|
||||
|
||||
Reference in New Issue
Block a user