mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-18 18:04:26 +00:00
feat: add trust level badges during install confirmation
Show trust badges for each skill during install: [Official] for known official sources (Anthropic, Vercel, Expo, Remotion, Supabase, Stripe), or [Trusted]/[Review]/[Caution] based on TrustScorer analysis.
This commit is contained in:
@@ -26,6 +26,8 @@ import {
|
||||
AgentsMdParser,
|
||||
AgentsMdGenerator,
|
||||
SkillsShRegistry,
|
||||
TrustScorer,
|
||||
readSkillContent,
|
||||
} from "@skillkit/core";
|
||||
import type { SkillsShStats } from "@skillkit/core";
|
||||
import type { SkillMetadata, GitProvider, AgentType } from "@skillkit/core";
|
||||
@@ -56,6 +58,7 @@ import {
|
||||
getLastAgents,
|
||||
formatQualityBadge,
|
||||
getQualityGradeFromScore,
|
||||
formatTrustBadge,
|
||||
type InstallResult,
|
||||
} from "../onboarding/index.js";
|
||||
|
||||
@@ -435,6 +438,33 @@ export class InstallCommand extends Command {
|
||||
console.log("");
|
||||
}
|
||||
|
||||
const officialSources = [
|
||||
"anthropics/skills",
|
||||
"vercel-labs/agent-skills",
|
||||
"expo/skills",
|
||||
"remotion-dev/skills",
|
||||
"supabase/agent-skills",
|
||||
"stripe/ai",
|
||||
];
|
||||
const isOfficial = officialSources.some((prefix) => this.source.startsWith(prefix));
|
||||
|
||||
const scorer = new TrustScorer();
|
||||
for (const skill of skillsToInstall) {
|
||||
const content = readSkillContent(skill.path);
|
||||
if (content) {
|
||||
const result = scorer.score(content);
|
||||
const badge = formatTrustBadge({
|
||||
isOfficial,
|
||||
officialSource: isOfficial ? this.source : undefined,
|
||||
grade: result.grade,
|
||||
score: result.score,
|
||||
source: this.source,
|
||||
});
|
||||
console.log(` Trust: ${badge}`);
|
||||
}
|
||||
}
|
||||
console.log("");
|
||||
|
||||
const agentDisplay =
|
||||
targetAgents.length <= 3
|
||||
? targetAgents.map(formatAgent).join(", ")
|
||||
|
||||
@@ -12,6 +12,7 @@ export {
|
||||
formatQualityBadge,
|
||||
formatQualityBadgeCompact,
|
||||
getQualityGradeFromScore,
|
||||
formatTrustBadge,
|
||||
} from './theme.js';
|
||||
|
||||
export {
|
||||
|
||||
@@ -178,3 +178,25 @@ export function formatQualityBadgeCompact(score: number): string {
|
||||
if (score >= 60) return colors.warning(grade);
|
||||
return colors.error(grade);
|
||||
}
|
||||
|
||||
export function formatTrustBadge(options: {
|
||||
isOfficial: boolean;
|
||||
officialSource?: string;
|
||||
grade?: 'trusted' | 'review' | 'caution';
|
||||
score?: number;
|
||||
source?: string;
|
||||
}): string {
|
||||
if (options.isOfficial) {
|
||||
const label = options.officialSource || options.source || '';
|
||||
return `${colors.success('[Official]')} ${label}`;
|
||||
}
|
||||
const label = options.source || '';
|
||||
const scoreText = typeof options.score === 'number' ? ` (score: ${options.score}/10)` : '';
|
||||
if (options.grade === 'trusted') {
|
||||
return `${colors.success('[Trusted]')} ${label}${scoreText}`;
|
||||
}
|
||||
if (options.grade === 'caution') {
|
||||
return `${colors.error('[Caution]')} ${label}${scoreText}`;
|
||||
}
|
||||
return `${colors.warning('[Review]')} ${label}${scoreText}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user