dep-oracle 1.2.0 → 1.3.0

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.
Files changed (41) hide show
  1. package/README.md +33 -8
  2. package/dist/action/index.js +398 -16
  3. package/dist/badge-5Z3WAD2B.js +89 -0
  4. package/dist/badge-5Z3WAD2B.js.map +1 -0
  5. package/dist/chunk-32B3QIPY.js +1505 -0
  6. package/dist/chunk-32B3QIPY.js.map +1 -0
  7. package/dist/chunk-7DST6SNA.js +258 -0
  8. package/dist/chunk-7DST6SNA.js.map +1 -0
  9. package/dist/{chunk-TXSNFX3N.js → chunk-DLWG22RC.js} +403 -17
  10. package/dist/chunk-DLWG22RC.js.map +1 -0
  11. package/dist/chunk-HX6MGNBD.js +271 -0
  12. package/dist/chunk-HX6MGNBD.js.map +1 -0
  13. package/dist/chunk-IVXGOPRU.js +145 -0
  14. package/dist/chunk-IVXGOPRU.js.map +1 -0
  15. package/dist/chunk-SP3VYPXX.js +218 -0
  16. package/dist/chunk-SP3VYPXX.js.map +1 -0
  17. package/dist/chunk-T5EVLWZM.js +4234 -0
  18. package/dist/chunk-T5EVLWZM.js.map +1 -0
  19. package/dist/chunk-UMB5MJHL.js +239 -0
  20. package/dist/chunk-UMB5MJHL.js.map +1 -0
  21. package/dist/cli/index.js +163 -6499
  22. package/dist/cli/index.js.map +1 -1
  23. package/dist/index.js +9 -84
  24. package/dist/index.js.map +1 -1
  25. package/dist/mcp/server.js +33 -12
  26. package/dist/mcp/server.js.map +1 -1
  27. package/dist/npm-UB54H37N.js +9 -0
  28. package/dist/npm-UB54H37N.js.map +1 -0
  29. package/dist/orchestrator-VOOYKDPT.js +8 -0
  30. package/dist/orchestrator-VOOYKDPT.js.map +1 -0
  31. package/dist/python-U4G2GK4J.js +9 -0
  32. package/dist/python-U4G2GK4J.js.map +1 -0
  33. package/dist/server-WONIBSG4.js +640 -0
  34. package/dist/server-WONIBSG4.js.map +1 -0
  35. package/dist/store-Z5UANEBB.js +8 -0
  36. package/dist/store-Z5UANEBB.js.map +1 -0
  37. package/dist/trust-score-YXYDFVPZ.js +8 -0
  38. package/dist/trust-score-YXYDFVPZ.js.map +1 -0
  39. package/package.json +1 -1
  40. package/server.json +2 -2
  41. package/dist/chunk-TXSNFX3N.js.map +0 -1
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/reporters/badge.ts
4
+ var BadgeReporter = class {
5
+ /**
6
+ * Generate an SVG badge string for the given trust score.
7
+ *
8
+ * @param score - Overall trust score (0-100).
9
+ * @returns A complete SVG string that can be saved as .svg or embedded inline.
10
+ */
11
+ generate(score) {
12
+ const clamped = Math.max(0, Math.min(100, Math.round(score)));
13
+ const color = this.scoreColor(clamped);
14
+ const scoreText = String(clamped);
15
+ const label = "dep-oracle";
16
+ const labelWidth = this.measureText(label);
17
+ const scoreWidth = this.measureText(scoreText);
18
+ const pad = 10;
19
+ const leftWidth = labelWidth + pad * 2;
20
+ const rightWidth = scoreWidth + pad * 2;
21
+ const totalWidth = leftWidth + rightWidth;
22
+ const textY = 14;
23
+ return [
24
+ `<svg xmlns="http://www.w3.org/2000/svg" width="${totalWidth}" height="20" role="img" aria-label="${label}: ${clamped}">`,
25
+ ` <title>${label}: ${clamped}</title>`,
26
+ ` <linearGradient id="s" x2="0" y2="100%">`,
27
+ ` <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>`,
28
+ ` <stop offset="1" stop-opacity=".1"/>`,
29
+ ` </linearGradient>`,
30
+ ` <clipPath id="r">`,
31
+ ` <rect width="${totalWidth}" height="20" rx="3" fill="#fff"/>`,
32
+ ` </clipPath>`,
33
+ ` <g clip-path="url(#r)">`,
34
+ ` <rect width="${leftWidth}" height="20" fill="#555"/>`,
35
+ ` <rect x="${leftWidth}" width="${rightWidth}" height="20" fill="${color}"/>`,
36
+ ` <rect width="${totalWidth}" height="20" fill="url(#s)"/>`,
37
+ ` </g>`,
38
+ ` <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">`,
39
+ ` <text x="${leftWidth / 2}" y="${textY}" fill="#010101" fill-opacity=".3">${this.escapeXml(label)}</text>`,
40
+ ` <text x="${leftWidth / 2}" y="${textY - 1}" fill="#fff">${this.escapeXml(label)}</text>`,
41
+ ` <text x="${leftWidth + rightWidth / 2}" y="${textY}" fill="#010101" fill-opacity=".3">${clamped}</text>`,
42
+ ` <text x="${leftWidth + rightWidth / 2}" y="${textY - 1}" fill="#fff">${clamped}</text>`,
43
+ ` </g>`,
44
+ `</svg>`
45
+ ].join("\n");
46
+ }
47
+ // -------------------------------------------------------------------------
48
+ // Internals
49
+ // -------------------------------------------------------------------------
50
+ /**
51
+ * Map a trust score to a hex color string.
52
+ * 0-49 = red (#e05d44)
53
+ * 50-79 = yellow (#dfb317)
54
+ * 80-100 = green (#4c1)
55
+ */
56
+ scoreColor(score) {
57
+ if (score >= 80) return "#4c1";
58
+ if (score >= 50) return "#dfb317";
59
+ return "#e05d44";
60
+ }
61
+ /**
62
+ * Approximate text width for Verdana 11px.
63
+ * This is a simplified character-width table similar to what
64
+ * shields.io uses internally.
65
+ */
66
+ measureText(text) {
67
+ let width = 0;
68
+ for (const ch of text) {
69
+ if ("iljft!|:;,.".includes(ch)) {
70
+ width += 4;
71
+ } else if ("mwMW".includes(ch)) {
72
+ width += 9;
73
+ } else if ("0123456789".includes(ch)) {
74
+ width += 7;
75
+ } else {
76
+ width += 6.5;
77
+ }
78
+ }
79
+ return Math.ceil(width);
80
+ }
81
+ /** Escape special XML characters in text content. */
82
+ escapeXml(text) {
83
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
84
+ }
85
+ };
86
+ export {
87
+ BadgeReporter
88
+ };
89
+ //# sourceMappingURL=badge-5Z3WAD2B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/reporters/badge.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// BadgeReporter - shields.io-style SVG badge generator\n// ---------------------------------------------------------------------------\n\n/**\n * Generate a static SVG badge showing the dep-oracle trust score.\n * The badge follows the shields.io flat-square aesthetic and is\n * completely self-contained (no external fonts or assets).\n */\nexport class BadgeReporter {\n /**\n * Generate an SVG badge string for the given trust score.\n *\n * @param score - Overall trust score (0-100).\n * @returns A complete SVG string that can be saved as .svg or embedded inline.\n */\n generate(score: number): string {\n const clamped = Math.max(0, Math.min(100, Math.round(score)));\n const color = this.scoreColor(clamped);\n const scoreText = String(clamped);\n const label = \"dep-oracle\";\n\n // Character widths (approximation for Verdana 11px)\n const labelWidth = this.measureText(label);\n const scoreWidth = this.measureText(scoreText);\n\n // Padding on each side of each section\n const pad = 10;\n const leftWidth = labelWidth + pad * 2;\n const rightWidth = scoreWidth + pad * 2;\n const totalWidth = leftWidth + rightWidth;\n\n // Vertical center for 20px height badge\n const textY = 14;\n\n return [\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${totalWidth}\" height=\"20\" role=\"img\" aria-label=\"${label}: ${clamped}\">`,\n ` <title>${label}: ${clamped}</title>`,\n ` <linearGradient id=\"s\" x2=\"0\" y2=\"100%\">`,\n ` <stop offset=\"0\" stop-color=\"#bbb\" stop-opacity=\".1\"/>`,\n ` <stop offset=\"1\" stop-opacity=\".1\"/>`,\n ` </linearGradient>`,\n ` <clipPath id=\"r\">`,\n ` <rect width=\"${totalWidth}\" height=\"20\" rx=\"3\" fill=\"#fff\"/>`,\n ` </clipPath>`,\n ` <g clip-path=\"url(#r)\">`,\n ` <rect width=\"${leftWidth}\" height=\"20\" fill=\"#555\"/>`,\n ` <rect x=\"${leftWidth}\" width=\"${rightWidth}\" height=\"20\" fill=\"${color}\"/>`,\n ` <rect width=\"${totalWidth}\" height=\"20\" fill=\"url(#s)\"/>`,\n ` </g>`,\n ` <g fill=\"#fff\" text-anchor=\"middle\" font-family=\"Verdana,Geneva,DejaVu Sans,sans-serif\" text-rendering=\"geometricPrecision\" font-size=\"11\">`,\n ` <text x=\"${leftWidth / 2}\" y=\"${textY}\" fill=\"#010101\" fill-opacity=\".3\">${this.escapeXml(label)}</text>`,\n ` <text x=\"${leftWidth / 2}\" y=\"${textY - 1}\" fill=\"#fff\">${this.escapeXml(label)}</text>`,\n ` <text x=\"${leftWidth + rightWidth / 2}\" y=\"${textY}\" fill=\"#010101\" fill-opacity=\".3\">${clamped}</text>`,\n ` <text x=\"${leftWidth + rightWidth / 2}\" y=\"${textY - 1}\" fill=\"#fff\">${clamped}</text>`,\n ` </g>`,\n `</svg>`,\n ].join(\"\\n\");\n }\n\n // -------------------------------------------------------------------------\n // Internals\n // -------------------------------------------------------------------------\n\n /**\n * Map a trust score to a hex color string.\n * 0-49 = red (#e05d44)\n * 50-79 = yellow (#dfb317)\n * 80-100 = green (#4c1)\n */\n private scoreColor(score: number): string {\n if (score >= 80) return \"#4c1\";\n if (score >= 50) return \"#dfb317\";\n return \"#e05d44\";\n }\n\n /**\n * Approximate text width for Verdana 11px.\n * This is a simplified character-width table similar to what\n * shields.io uses internally.\n */\n private measureText(text: string): number {\n // Average character width for Verdana 11px is ~6.8px.\n // Narrow chars (i, l, 1) are ~4px, wide chars (m, w) are ~9px.\n let width = 0;\n for (const ch of text) {\n if (\"iljft!|:;,.\".includes(ch)) {\n width += 4;\n } else if (\"mwMW\".includes(ch)) {\n width += 9;\n } else if (\"0123456789\".includes(ch)) {\n width += 7;\n } else {\n width += 6.5;\n }\n }\n return Math.ceil(width);\n }\n\n /** Escape special XML characters in text content. */\n private escapeXml(text: string): string {\n return text\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&apos;\");\n }\n}\n"],"mappings":";;;AASO,IAAM,gBAAN,MAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOzB,SAAS,OAAuB;AAC9B,UAAM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