From ec9acbd4b2f4fb470fde2b5ea40668c40d64da04 Mon Sep 17 00:00:00 2001 From: dchaudhari7177 Date: Wed, 12 Aug 2026 22:35:29 +0530 Subject: [PATCH] feat(score): display the trust tier alongside the numeric score `mcp-observatory score` printed only the number and letter grade, so the tier that turns it into a trust signal was invisible in the terminal. MCP Health Score: 87/100 (B) Tier: Gold Appended to the existing header rather than added as a new line, so the existing formatting is untouched. Tier colours are deliberately distinct from the grade colours (grade is green/yellow/red for pass/warn/fail), so the two signals do not read as one: platinum cyan and gold yellow per the issue, silver blue, bronze and unrated dim. getTrustTier already exists in src/score.ts and is covered by tests, so this adds only the rendering; no scoring logic changes. Co-Authored-By: Claude Opus 5 --- src/commands/score.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/commands/score.ts b/src/commands/score.ts index e57de09f..343d6eb7 100644 --- a/src/commands/score.ts +++ b/src/commands/score.ts @@ -4,6 +4,8 @@ import type { Command } from "commander"; import { generateBadgeSvg } from "../badge.js"; import { auditScore, resolveAuditTarget, runAudit } from "../audit.js"; +import { getTrustTier } from "../score.js"; +import type { TrustTier } from "../types.js"; import { runTarget, writeRunArtifact, @@ -46,6 +48,20 @@ function extractTrailingProfileScoreFlags( return { commandArgs, options: nextOptions }; } +/** Terminal colour per trust tier. Metal-ish, and distinct from the grade colour. */ +const TIER_COLORS: Record = { + platinum: ANSI.cyan, + gold: ANSI.yellow, + silver: ANSI.blue, + bronze: ANSI.dim, + unrated: ANSI.dim, +}; + +/** "gold" -> "Gold". The tier is stored lowercase but reads as a label. */ +function formatTier(tier: TrustTier): string { + return tier.charAt(0).toUpperCase() + tier.slice(1); +} + export function registerScoreCommands(program: Command): void { // ── score ──────────────────────────────────────────────────────────── @@ -154,7 +170,9 @@ export function registerScoreCommands(program: Command): void { : score.grade === "C" ? ANSI.yellow : ANSI.red; - process.stdout.write(c(ANSI.bold, ` MCP Health Score: ${c(gradeColor, `${score.overall}/100`)} (${c(gradeColor, score.grade)})\n\n`)); + const tier = getTrustTier(score.overall); + + process.stdout.write(c(ANSI.bold, ` MCP Health Score: ${c(gradeColor, `${score.overall}/100`)} (${c(gradeColor, score.grade)}) Tier: ${c(TIER_COLORS[tier], formatTier(tier))}\n\n`)); for (const dim of score.dimensions) { const filled = Math.round(dim.score / 5);