kyd-shared-badge 0.2.30 → 0.2.32
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/package.json +1 -1
- package/src/SharedBadgeDisplay.tsx +62 -70
- package/src/components/GaugeCard.tsx +1 -1
- package/src/components/Reveal.tsx +1 -1
- package/src/types.ts +5 -0
package/package.json
CHANGED
|
@@ -49,14 +49,11 @@ const SharedBadgeDisplay = ({ badgeData }: { badgeData: PublicBadgeData }) => {
|
|
|
49
49
|
const graphInsights: GraphInsightsPayload = (assessmentResult)?.graph_insights || {} as GraphInsightsPayload;
|
|
50
50
|
const scoringSummary: ScoringSummary = (assessmentResult)?.scoring_summary || {} as ScoringSummary;
|
|
51
51
|
|
|
52
|
-
// const devTrustScore = summary_scores.developer_trust;
|
|
53
|
-
// const riskScore = summary_scores.risk_score;
|
|
54
|
-
// const aiUsageScore = summary_scores.ai_usage;
|
|
55
52
|
|
|
56
53
|
const wrapperMaxWidth = 'max-w-5xl';
|
|
57
54
|
|
|
58
55
|
// Overall and genre scores
|
|
59
|
-
const overallFinalPercent =
|
|
56
|
+
const overallFinalPercent = assessmentResult?.final_percent || 0;
|
|
60
57
|
|
|
61
58
|
// Build category display grouped by genres from scoring_summary.config.genre_mapping
|
|
62
59
|
const genreMapping = (scoringSummary?.config?.genre_mapping) || {};
|
|
@@ -155,75 +152,70 @@ const SharedBadgeDisplay = ({ badgeData }: { badgeData: PublicBadgeData }) => {
|
|
|
155
152
|
className={'rounded-xl shadow-xl p-6 sm:p-8 mt-8 border'}
|
|
156
153
|
style={{ backgroundColor: 'var(--content-card-background)', borderColor: 'var(--icon-button-secondary)' }}
|
|
157
154
|
>
|
|
158
|
-
|
|
159
155
|
<div className={'space-y-12 divide-y'} style={{ borderColor: 'var(--icon-button-secondary)' }}>
|
|
160
156
|
<div className="pt-8 first:pt-0">
|
|
161
157
|
<Reveal as={'h4'} offsetY={8} durationMs={500} className={'text-2xl font-semibold mb-3'} style={{ color: 'var(--text-main)' }}>Report Summary</Reveal>
|
|
162
|
-
<div className=
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
</Reveal>
|
|
224
|
-
);
|
|
225
|
-
})()}
|
|
226
|
-
</div>
|
|
158
|
+
<Reveal as={'div'} offsetY={8} durationMs={500} className={'space-y-12 divide-y'} style={{ borderColor: 'var(--icon-button-secondary)' }}>
|
|
159
|
+
<div className="grid grid-cols-1 sm:grid-cols-3 gap-4 *:min-h-full">
|
|
160
|
+
{/* Technical semicircle gauge (refactored) */}
|
|
161
|
+
{(() => {
|
|
162
|
+
const ui = graphInsights?.uiSummary?.technical || {};
|
|
163
|
+
const pct = Math.round(Number(ui?.percent ?? 0));
|
|
164
|
+
const label = ui?.label || 'EVIDENCE';
|
|
165
|
+
const top = ui?.top_movers && ui.top_movers.length > 0 ? ui.top_movers : topBusinessForGenre('Technical');
|
|
166
|
+
return (
|
|
167
|
+
<GaugeCard
|
|
168
|
+
key={'technical-card'}
|
|
169
|
+
title={'KYD Technical'}
|
|
170
|
+
description={'The gauge visualization shows a weighted composite of technical evidence, with rightward movement indicating stronger indications of developer capability'}
|
|
171
|
+
percent={pct}
|
|
172
|
+
label={label}
|
|
173
|
+
topMovers={top?.map(t => ({ label: t?.label, uid: t?.uid }))}
|
|
174
|
+
topMoversTitle={'Top Score Movers'}
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
177
|
+
})()}
|
|
178
|
+
|
|
179
|
+
{/* Risk descending bars card (abstracted) */}
|
|
180
|
+
{(() => {
|
|
181
|
+
const ui = graphInsights?.uiSummary?.risk || {};
|
|
182
|
+
const pctGood = Math.round(Number(ui?.percent_good ?? 0));
|
|
183
|
+
const label = ui?.label || 'RISK';
|
|
184
|
+
const top = ui?.top_movers && ui.top_movers.length > 0 ? ui.top_movers : topBusinessForGenre('Risk');
|
|
185
|
+
const tooltip = 'Higher bar filled indicates lower overall risk; movement to the right reflects improved risk posture.';
|
|
186
|
+
return (
|
|
187
|
+
<RiskCard
|
|
188
|
+
title={'KYD Risk'}
|
|
189
|
+
description={'The bar chart visualizes relative risk levels, where shorter bars denote lower risk and taller bars indicate greater exposure.'}
|
|
190
|
+
percentGood={pctGood}
|
|
191
|
+
label={label}
|
|
192
|
+
topMovers={top?.map(t => ({ label: t?.label, uid: t?.uid }))}
|
|
193
|
+
topMoversTitle={'Top Score Movers'}
|
|
194
|
+
tooltipText={tooltip}
|
|
195
|
+
/>
|
|
196
|
+
);
|
|
197
|
+
})()}
|
|
198
|
+
|
|
199
|
+
{/* AI transparency semicircle gauge */}
|
|
200
|
+
{(() => {
|
|
201
|
+
const ai_usage_summary = assessmentResult?.ai_usage_summary;
|
|
202
|
+
const label = 'AI Transparency'// TODO: calculate label frontend
|
|
203
|
+
const topMovers = ai_usage_summary?.key_findings || []
|
|
204
|
+
return (
|
|
205
|
+
<GaugeCard
|
|
206
|
+
key={'ai-card'}
|
|
207
|
+
title={'KYD AI'}
|
|
208
|
+
description={'Indicates the degree to which AI-assisted code is explicitly disclosed across analyzed files.'}
|
|
209
|
+
percent={ai_usage_summary?.transparency_score}
|
|
210
|
+
label={label}
|
|
211
|
+
// id non-functional
|
|
212
|
+
topMovers={topMovers.map(t => ({ label: t, uid: 'ai-usage' }))}
|
|
213
|
+
topMoversTitle={'Key Findings'}
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
})()}
|
|
217
|
+
</div>
|
|
218
|
+
</Reveal>
|
|
227
219
|
</div>
|
|
228
220
|
|
|
229
221
|
{/* Technical Scores */}
|
|
@@ -34,7 +34,7 @@ export default function GaugeCard({
|
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
36
|
<div
|
|
37
|
-
className={'rounded-md p-5 border flex flex-col'}
|
|
37
|
+
className={'rounded-md p-5 border flex flex-col min-h-full'}
|
|
38
38
|
style={{
|
|
39
39
|
backgroundColor: 'var(--content-card-background)',
|
|
40
40
|
borderColor: 'var(--icon-button-secondary)',
|
|
@@ -4,7 +4,7 @@ import React, { CSSProperties, PropsWithChildren } from 'react';
|
|
|
4
4
|
import { useInViewOnce } from './useInViewOnce';
|
|
5
5
|
|
|
6
6
|
type RevealProps = PropsWithChildren<{
|
|
7
|
-
as?:
|
|
7
|
+
as?: React.ElementType;
|
|
8
8
|
/** px to translate on Y axis initially */
|
|
9
9
|
offsetY?: number;
|
|
10
10
|
/** px to translate on X axis initially (rarely needed) */
|
package/src/types.ts
CHANGED
|
@@ -156,6 +156,7 @@ export interface FBIWantedMatch {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
export interface AssessmentResult {
|
|
159
|
+
final_percent: number;
|
|
159
160
|
report_summary?: string;
|
|
160
161
|
recommendations: {
|
|
161
162
|
summary?: string;
|
|
@@ -238,6 +239,10 @@ export interface ClientMetadata {
|
|
|
238
239
|
// --- Scoring Summary (from rules engine) ---
|
|
239
240
|
export interface ScoringSummaryConfig {
|
|
240
241
|
coldstart_fraction?: number;
|
|
242
|
+
coldstart_mapping?: {
|
|
243
|
+
default?: number;
|
|
244
|
+
by_category?: { [category: string]: number };
|
|
245
|
+
};
|
|
241
246
|
system_weights?: { [k: string]: number };
|
|
242
247
|
genre_mapping?: { [genre: string]: string[] };
|
|
243
248
|
}
|