@safetnsr/vet 1.15.0 → 1.15.1

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.
@@ -1,6 +1,6 @@
1
1
  import type { CheckResult, CategoryResult, VetResult } from './types.js';
2
2
  export declare function toGrade(score: number): string;
3
- /** Apply a floor of 20 to non-security checks that have no security-related errors */
3
+ /** Apply a floor of 25 to non-security checks that have no security-related errors */
4
4
  export declare function applyScoreFloor(check: CheckResult): number;
5
5
  export declare function buildCategories(checkMap: {
6
6
  security: CheckResult[];
@@ -23,12 +23,12 @@ const WEIGHTS = {
23
23
  };
24
24
  // ── Scoring floor for non-security checks ────────────────────────────────────
25
25
  const SECURITY_CHECKS = new Set(['scan', 'secrets', 'permissions', 'owasp']);
26
- /** Apply a floor of 20 to non-security checks that have no security-related errors */
26
+ /** Apply a floor of 25 to non-security checks that have no security-related errors */
27
27
  export function applyScoreFloor(check) {
28
28
  if (SECURITY_CHECKS.has(check.name))
29
29
  return check.score;
30
- // Non-security check: minimum score is 20
31
- return Math.max(20, check.score);
30
+ // Non-security check: minimum score is 25
31
+ return Math.max(25, check.score);
32
32
  }
33
33
  // ── Average scores within a category ────────────────────────────────────────
34
34
  function averageScore(checks) {
@@ -41,9 +41,11 @@ function averageScore(checks) {
41
41
  /**
42
42
  * Extract completeness score and apply it as a multiplier to the overall score.
43
43
  * A repo with completeness=0 (no JS/TS source) gets heavily penalized.
44
- * completeness 0-30 multiplier 0.3-0.6
45
- * completeness 30-70 → multiplier 0.6-0.85
46
- * completeness 70-100 → multiplier 0.85-1.0
44
+ * Steeper curve to better separate quality tiers:
45
+ * completeness 0-25 → multiplier 0.2-0.45
46
+ * completeness 25-50 → multiplier 0.45-0.65
47
+ * completeness 50-75 → multiplier 0.65-0.85
48
+ * completeness 75-100 → multiplier 0.85-1.0
47
49
  */
48
50
  function completenessMultiplier(categories) {
49
51
  const integrity = categories.find(c => c.name === 'integrity');
@@ -53,11 +55,13 @@ function completenessMultiplier(categories) {
53
55
  if (!comp)
54
56
  return 1.0;
55
57
  const s = comp.score;
56
- if (s >= 70)
57
- return 0.85 + (s - 70) * (0.15 / 30);
58
- if (s >= 30)
59
- return 0.6 + (s - 30) * (0.25 / 40);
60
- return 0.3 + s * (0.3 / 30);
58
+ if (s >= 75)
59
+ return 0.85 + (s - 75) * (0.15 / 25);
60
+ if (s >= 50)
61
+ return 0.65 + (s - 50) * (0.20 / 25);
62
+ if (s >= 25)
63
+ return 0.45 + (s - 25) * (0.20 / 25);
64
+ return 0.20 + s * (0.25 / 25);
61
65
  }
62
66
  // ── Group checks into categories ─────────────────────────────────────────────
63
67
  export function buildCategories(checkMap) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@safetnsr/vet",
3
- "version": "1.15.0",
3
+ "version": "1.15.1",
4
4
  "description": "vet your AI-generated code — one command, one score card, one letter grade",
5
5
  "type": "module",
6
6
  "bin": {