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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kyd-shared-badge",
3
- "version": "0.2.30",
3
+ "version": "0.2.32",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -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 = Math.round(Number(scoringSummary?.overall?.combined?.percent_progress || 0));
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="grid grid-cols-1 sm:grid-cols-3 gap-4">
163
- {/* Technical semicircle gauge (refactored) */}
164
- {(() => {
165
- const ui = graphInsights?.uiSummary?.technical || {};
166
- const pct = Math.round(Number(ui?.percent ?? 0));
167
- const label = ui?.label || 'EVIDENCE';
168
- const top = ui?.top_movers && ui.top_movers.length > 0 ? ui.top_movers : topBusinessForGenre('Technical');
169
- return (
170
- <Reveal delayMs={0} offsetY={12}>
171
- <GaugeCard
172
- key={'technical-card'}
173
- title={'KYD Technical'}
174
- description={'The gauge visualization shows a weighted composite of technical evidence, with rightward movement indicating stronger indications of developer capability'}
175
- percent={pct}
176
- label={label}
177
- topMovers={top?.map(t => ({ label: t?.label, uid: t?.uid }))}
178
- topMoversTitle={'Top Score Movers'}
179
- />
180
- </Reveal>
181
- );
182
- })()}
183
-
184
- {/* Risk descending bars card (abstracted) */}
185
- {(() => {
186
- const ui = graphInsights?.uiSummary?.risk || {};
187
- const pctGood = Math.round(Number(ui?.percent_good ?? 0));
188
- const label = ui?.label || 'RISK';
189
- const top = ui?.top_movers && ui.top_movers.length > 0 ? ui.top_movers : topBusinessForGenre('Risk');
190
- const tooltip = 'Higher bar filled indicates lower overall risk; movement to the right reflects improved risk posture.';
191
- return (
192
- <Reveal delayMs={80} offsetY={12}>
193
- <RiskCard
194
- title={'KYD Risk'}
195
- description={'The bar chart visualizes relative risk levels, where shorter bars denote lower risk and taller bars indicate greater exposure.'}
196
- percentGood={pctGood}
197
- label={label}
198
- topMovers={top?.map(t => ({ label: t?.label, uid: t?.uid }))}
199
- topMoversTitle={'Top Score Movers'}
200
- tooltipText={tooltip}
201
- />
202
- </Reveal>
203
- );
204
- })()}
205
-
206
- {/* AI transparency semicircle gauge */}
207
- {(() => {
208
- const ai_usage_summary = assessmentResult?.ai_usage_summary;
209
- const label = 'AI Transparency'// TODO: calculate label frontend
210
- const topMovers = ai_usage_summary?.key_findings || []
211
- return (
212
- <Reveal delayMs={160} offsetY={12}>
213
- <GaugeCard
214
- key={'ai-card'}
215
- title={'KYD AI'}
216
- description={'Indicates the degree to which AI-assisted code is explicitly disclosed across analyzed files.'}
217
- percent={ai_usage_summary?.transparency_score}
218
- label={label}
219
- // id non-functional
220
- topMovers={topMovers.map(t => ({ label: t, uid: 'ai-usage' }))}
221
- topMoversTitle={'Key Findings'}
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?: keyof JSX.IntrinsicElements;
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
  }