feat: AI Discovery AEO/GEO 채점 기준표 v1.0 + /discovery/:id 리포트 (뷰성형외과 44점)

- 채점 기준표: 6 카테고리 36 항목 100점, 항목별 근거등급/통제/채점방식/howToCheck
- 집계: 미검증 항목 분모 제외, llms.txt 항목 제외
- 뷰성형외과 실측 결과 + 핵심 발견 5 + 액션 7 + 하지 않을 것 5
- DiscoveryReportPage: INFINITH 디자인 토큰, 본문 +2pt, 판정 배지/우선순위 +4pt 볼드, keep-all
- SeverityBadge className prop 추가
- Badge.tsx 복원 (PricingPage import 누락으로 빌드 깨져 있던 것)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Fable 5 committed 2026-08-28 10:26:29 +09:00
1 parent 7251c6d153
commit ef4d8218e9
9 files changed
+1469 -2

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
/**
* AEO/GEO 채점 집계
*
* - level(0~3) → weight × level/3
* - 'unverified' 항목은 분모(possible)에서 제외 → 확인 못 한 것을 감점하지 않는다
* - 전체 점수 = earned / possible × 100 (검증 항목 기준 정규화)
*/
import type {
CategoryScore,
CriterionLevel,
CriterionResult,
DiscoveryResult,
OverallScore,
Rubric,
} from '../types/discovery';
export const levelToPct = (level: CriterionLevel) => (level / 3) * 100;
export const levelToSeverity = (
level: CriterionLevel | 'unverified',
): 'critical' | 'warning' | 'good' | 'excellent' | 'unknown' => {
if (level === 'unverified') return 'unknown';
return (['critical', 'warning', 'good', 'excellent'] as const)[level];
};
export const gradeFromScore = (score: number): OverallScore['grade'] => {
if (score > 80) return 'A';
if (score > 60) return 'B';
if (score > 40) return 'C';
return 'D';
};
export function scoreDiscovery(rubric: Rubric, result: DiscoveryResult): OverallScore {
const byId = new Map<string, CriterionResult>(result.results.map((r) => [r.criterionId, r]));
const categories: CategoryScore[] = rubric.categories.map((category) => {
const criteria = rubric.criteria.filter((c) => c.category === category.id);
let earned = 0;
let possible = 0;
let verifiedCount = 0;
for (const c of criteria) {
const r = byId.get(c.id);
if (!r || r.level === 'unverified') continue;
verifiedCount += 1;
possible += c.weight;
earned += (c.weight * r.level) / 3;
}
return {
category,
earned: round1(earned),
possible,
weight: category.weight,
pct: possible === 0 ? 0 : Math.round((earned / possible) * 100),
verifiedCount,
totalCount: criteria.length,
};
});
const earned = categories.reduce((s, c) => s + c.earned, 0);
const possible = categories.reduce((s, c) => s + c.possible, 0);
const score = possible === 0 ? 0 : Math.round((earned / possible) * 100);
return { score, earned: round1(earned), possible, categories, grade: gradeFromScore(score) };
}
const round1 = (n: number) => Math.round(n * 10) / 10;