@getcodesentinel/codesentinel 1.17.1 → 1.17.2

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/README.md CHANGED
@@ -416,6 +416,7 @@ Score direction:
416
416
 
417
417
  - `risk.riskScore`: higher means higher risk (worse).
418
418
  - `health.healthScore`: higher means better health posture.
419
+ - Report views also include derived tiers: `riskTier` and `healthTier`.
419
420
  - `health.trace`: per-dimension factor traces with normalized metrics and evidence.
420
421
 
421
422
  Health v2 dimensions and weights:
package/dist/index.js CHANGED
@@ -1700,6 +1700,21 @@ var toRiskTier = (score) => {
1700
1700
  }
1701
1701
  return "very_high";
1702
1702
  };
1703
+ var toHealthTier = (score) => {
1704
+ if (score < 20) {
1705
+ return "critical";
1706
+ }
1707
+ if (score < 40) {
1708
+ return "weak";
1709
+ }
1710
+ if (score < 60) {
1711
+ return "fair";
1712
+ }
1713
+ if (score < 80) {
1714
+ return "good";
1715
+ }
1716
+ return "excellent";
1717
+ };
1703
1718
  var factorLabelById = {
1704
1719
  "repository.structural": "Structural complexity",
1705
1720
  "repository.evolution": "Change volatility",
@@ -1936,6 +1951,7 @@ var createReport = (snapshot, diff) => {
1936
1951
  riskScore: snapshot.analysis.risk.riskScore,
1937
1952
  normalizedScore: snapshot.analysis.risk.normalizedScore,
1938
1953
  riskTier: toRiskTier(snapshot.analysis.risk.riskScore),
1954
+ healthTier: toHealthTier(snapshot.analysis.health.healthScore),
1939
1955
  confidence: repositoryConfidence(snapshot),
1940
1956
  dimensionScores: repositoryDimensionScores(snapshot)
1941
1957
  },
@@ -2003,6 +2019,7 @@ var renderTextReport = (report) => {
2003
2019
  lines.push(` riskScore: ${report.repository.riskScore}`);
2004
2020
  lines.push(` normalizedScore: ${report.repository.normalizedScore}`);
2005
2021
  lines.push(` riskTier: ${report.repository.riskTier}`);
2022
+ lines.push(` healthTier: ${report.repository.healthTier}`);
2006
2023
  lines.push(` confidence: ${report.repository.confidence ?? "n/a"}`);
2007
2024
  lines.push("");
2008
2025
  lines.push("Dimension Scores (0-100)");
@@ -2096,6 +2113,7 @@ var renderMarkdownReport = (report) => {
2096
2113
  lines.push(`- riskScore: \`${report.repository.riskScore}\``);
2097
2114
  lines.push(`- normalizedScore: \`${report.repository.normalizedScore}\``);
2098
2115
  lines.push(`- riskTier: \`${report.repository.riskTier}\``);
2116
+ lines.push(`- healthTier: \`${report.repository.healthTier}\``);
2099
2117
  lines.push(`- confidence: \`${report.repository.confidence ?? "n/a"}\``);
2100
2118
  lines.push("");
2101
2119
  lines.push("## Dimension Scores (0-100)");
@@ -2826,6 +2844,21 @@ import { dirname as dirname2, resolve as resolve5 } from "path";
2826
2844
  import { fileURLToPath } from "url";
2827
2845
 
2828
2846
  // src/application/format-analyze-output.ts
2847
+ var toHealthTier2 = (score) => {
2848
+ if (score < 20) {
2849
+ return "critical";
2850
+ }
2851
+ if (score < 40) {
2852
+ return "weak";
2853
+ }
2854
+ if (score < 60) {
2855
+ return "fair";
2856
+ }
2857
+ if (score < 80) {
2858
+ return "good";
2859
+ }
2860
+ return "excellent";
2861
+ };
2829
2862
  var createSummaryShape = (summary) => ({
2830
2863
  targetPath: summary.structural.targetPath,
2831
2864
  structural: summary.structural.metrics,
@@ -2865,6 +2898,7 @@ var createSummaryShape = (summary) => ({
2865
2898
  },
2866
2899
  health: {
2867
2900
  healthScore: summary.health.healthScore,
2901
+ healthTier: toHealthTier2(summary.health.healthScore),
2868
2902
  normalizedScore: summary.health.normalizedScore,
2869
2903
  dimensions: summary.health.dimensions,
2870
2904
  topIssues: summary.health.topIssues.slice(0, 5)
@@ -7295,6 +7329,7 @@ var renderReportHighlightsText = (report) => {
7295
7329
  lines.push(` healthScore: ${report.health.healthScore}`);
7296
7330
  lines.push(` normalizedScore: ${report.repository.normalizedScore}`);
7297
7331
  lines.push(` riskTier: ${report.repository.riskTier}`);
7332
+ lines.push(` healthTier: ${report.repository.healthTier}`);
7298
7333
  lines.push("");
7299
7334
  lines.push("Top Hotspots");
7300
7335
  for (const hotspot of report.hotspots.slice(0, 5)) {
@@ -7311,6 +7346,7 @@ var renderReportHighlightsMarkdown = (report) => {
7311
7346
  lines.push(`- healthScore: \`${report.health.healthScore}\``);
7312
7347
  lines.push(`- normalizedScore: \`${report.repository.normalizedScore}\``);
7313
7348
  lines.push(`- riskTier: \`${report.repository.riskTier}\``);
7349
+ lines.push(`- healthTier: \`${report.repository.healthTier}\``);
7314
7350
  lines.push("");
7315
7351
  lines.push("## Top Hotspots");
7316
7352
  for (const hotspot of report.hotspots.slice(0, 5)) {
@@ -7328,6 +7364,7 @@ var renderCompactText = (report, explainSummary) => {
7328
7364
  lines.push(` riskScore: ${report.repository.riskScore}`);
7329
7365
  lines.push(` healthScore: ${report.health.healthScore}`);
7330
7366
  lines.push(` riskTier: ${report.repository.riskTier}`);
7367
+ lines.push(` healthTier: ${report.repository.healthTier}`);
7331
7368
  lines.push(
7332
7369
  ` dimensions: structural=${report.repository.dimensionScores.structural ?? "n/a"}, evolution=${report.repository.dimensionScores.evolution ?? "n/a"}, external=${report.repository.dimensionScores.external ?? "n/a"}, interactions=${report.repository.dimensionScores.interactions ?? "n/a"}`
7333
7370
  );
@@ -7354,6 +7391,7 @@ var renderCompactMarkdown = (report, explainSummary) => {
7354
7391
  lines.push(`- riskScore: \`${report.repository.riskScore}\``);
7355
7392
  lines.push(`- healthScore: \`${report.health.healthScore}\``);
7356
7393
  lines.push(`- riskTier: \`${report.repository.riskTier}\``);
7394
+ lines.push(`- healthTier: \`${report.repository.healthTier}\``);
7357
7395
  lines.push(
7358
7396
  `- dimensions: structural=\`${report.repository.dimensionScores.structural ?? "n/a"}\`, evolution=\`${report.repository.dimensionScores.evolution ?? "n/a"}\`, external=\`${report.repository.dimensionScores.external ?? "n/a"}\`, interactions=\`${report.repository.dimensionScores.interactions ?? "n/a"}\``
7359
7397
  );