kyd-shared-badge 0.2.25 → 0.2.26

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.25",
3
+ "version": "0.2.26",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -74,7 +74,8 @@ const SharedBadgeDisplay = ({ badgeData }: { badgeData: PublicBadgeData }) => {
74
74
  badgeId={badgeId}
75
75
  developerName={badgeData.developerName}
76
76
  updatedAt={updatedAt}
77
- score={summary_scores.kyd_self_check.score}
77
+ // TODO: add back in
78
+ score={0}
78
79
  isPublic={true}
79
80
  badgeImageUrl={badgeData.badgeImageUrl || ''}
80
81
  />
@@ -110,7 +111,7 @@ const SharedBadgeDisplay = ({ badgeData }: { badgeData: PublicBadgeData }) => {
110
111
  </div>
111
112
  <ProviderInsights
112
113
  platforms={connectedAccounts || []}
113
- insights={assessmentResult.provider_insights}
114
+ topContributingRules={assessmentResult.top_contributing_rules || []}
114
115
  />
115
116
  </div>
116
117
 
@@ -1,7 +1,7 @@
1
1
  import { IconType } from 'react-icons';
2
2
  import { FaGithub, FaGitlab, FaStackOverflow, FaAtlassian, FaLinkedin, FaGoogle } from 'react-icons/fa';
3
3
  import { SiFiverr, SiCredly, SiKaggle } from 'react-icons/si';
4
- import { ProviderInsight } from '../types';
4
+ import { TopContributingRule } from '../types';
5
5
 
6
6
  interface Platform {
7
7
  name: string;
@@ -12,7 +12,7 @@ interface Platform {
12
12
 
13
13
  interface ProviderInsightsProps {
14
14
  platforms: Platform[];
15
- insights: { [provider: string]: ProviderInsight };
15
+ topContributingRules: TopContributingRule[];
16
16
  }
17
17
 
18
18
  const providerIcons: { [key: string]: IconType } = {
@@ -27,7 +27,19 @@ const providerIcons: { [key: string]: IconType } = {
27
27
  'Google Scholar': FaGoogle,
28
28
  };
29
29
 
30
- export default function ProviderInsights({ platforms, insights }: ProviderInsightsProps) {
30
+ const providerDisplayMap: { [key: string]: string } = {
31
+ github: 'GitHub',
32
+ gitlab: 'GitLab',
33
+ stackoverflow: 'Stack Overflow',
34
+ atlassian: 'Atlassian',
35
+ fiverr: 'Fiverr',
36
+ linkedin: 'LinkedIn',
37
+ credly: 'Credly',
38
+ kaggle: 'Kaggle',
39
+ gscholar: 'Google Scholar',
40
+ };
41
+
42
+ export default function ProviderInsights({ platforms, topContributingRules }: ProviderInsightsProps) {
31
43
  if (!platforms || platforms.length === 0) {
32
44
  return null;
33
45
  }
@@ -37,7 +49,11 @@ export default function ProviderInsights({ platforms, insights }: ProviderInsigh
37
49
  {platforms.map(platform => {
38
50
  const normalizedName = platform.name || '';
39
51
  const Icon = normalizedName ? (providerIcons[normalizedName] || null) : null;
40
- const providerInsight = insights[normalizedName];
52
+ // Group top contributing rules by provider display name
53
+ const rulesForProvider = (topContributingRules || []).filter(r => {
54
+ const display = providerDisplayMap[(r.provider || '').toLowerCase()] || r.provider;
55
+ return display === normalizedName;
56
+ });
41
57
  const observedDate = platform.observedAt ? new Date(platform.observedAt).toLocaleDateString(undefined, {
42
58
  year: 'numeric',
43
59
  month: 'short',
@@ -84,29 +100,21 @@ export default function ProviderInsights({ platforms, insights }: ProviderInsigh
84
100
  </div>
85
101
  </div>
86
102
 
87
- {/* Insights */}
88
- {providerInsight && providerInsight.data_points && (
103
+ {/* Top Contributing Rules */}
104
+ {rulesForProvider && rulesForProvider.length > 0 && (
89
105
  <div className="p-4">
90
- {/* Summary */}
91
- <p className={'text-sm mb-4'} style={{ color: 'var(--text-secondary)' }}>
92
- {providerInsight.summary}
93
- </p>
94
-
95
- {/* Data Points */}
96
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
97
- {providerInsight.data_points.map((point, index) => (
98
- <div key={index} className={'rounded-lg p-4'} style={{ backgroundColor: 'var(--content-card-background)/90' }}>
99
- <div className="flex justify-between items-baseline mb-2">
100
- <h4 className={'font-medium'} style={{ color: 'var(--text-main)' }}>
101
- {point.label}
102
- </h4>
103
- <span className={'font-bold'} style={{ color: 'var(--text-main)' }}>
104
- {point.value}
105
- </span>
106
+ <div className="space-y-3">
107
+ {rulesForProvider.map((r, idx) => (
108
+ <div key={idx} className={'rounded-lg p-3 border'} style={{ backgroundColor: 'var(--content-card-background)/90', borderColor: 'var(--icon-button-secondary)' }}>
109
+ <div className="flex items-start gap-2">
110
+ <div className={'mt-1 h-2 w-2 rounded-full'} style={{ backgroundColor: 'var(--text-secondary)' }} />
111
+ <div>
112
+ <div className={'font-medium'} style={{ color: 'var(--text-main)' }}>{r.rule_label}</div>
113
+ {r.why && (
114
+ <div className={'text-sm mt-1'} style={{ color: 'var(--text-secondary)' }}>{r.why}</div>
115
+ )}
116
+ </div>
106
117
  </div>
107
- <p className={'text-sm'} style={{ color: 'var(--text-secondary)' }}>
108
- {point.significance}
109
- </p>
110
118
  </div>
111
119
  ))}
112
120
  </div>
package/src/types.ts CHANGED
@@ -69,6 +69,7 @@ export interface SummaryScore {
69
69
  letter_grade?: string;
70
70
  }
71
71
 
72
+ // Deprecated in favor of TopContributingRule mapped view
72
73
  export interface DataPoint {
73
74
  label: string;
74
75
  value: string;
@@ -154,7 +155,8 @@ export interface AssessmentResult {
154
155
  kyd_self_check?: SummaryScore;
155
156
  ai_usage?: SummaryScore;
156
157
  };
157
- provider_insights: {
158
+ // Deprecated: previously per-provider narrative and datapoints
159
+ provider_insights?: {
158
160
  [provider: string]: ProviderInsight;
159
161
  };
160
162
  badgeId?: string;