@eduardbar/drift 1.3.0 → 1.4.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.
- package/.gga +50 -0
- package/.github/actions/drift-review/README.md +60 -0
- package/.github/actions/drift-review/action.yml +131 -0
- package/.github/actions/drift-scan/README.md +28 -32
- package/.github/actions/drift-scan/action.yml +78 -14
- package/.github/workflows/review-pr.yml +34 -41
- package/AGENTS.md +75 -251
- package/CHANGELOG.md +28 -0
- package/README.md +148 -41
- package/dist/benchmark.d.ts +1 -1
- package/dist/benchmark.js +71 -52
- package/dist/cli.js +243 -8
- package/dist/config.js +16 -2
- package/dist/diff.js +42 -50
- package/dist/doctor.d.ts +5 -0
- package/dist/doctor.js +133 -0
- package/dist/format.d.ts +17 -0
- package/dist/format.js +45 -0
- package/dist/guard-types.d.ts +57 -0
- package/dist/guard-types.js +2 -0
- package/dist/guard.d.ts +14 -0
- package/dist/guard.js +239 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +4 -1
- package/dist/init.d.ts +15 -0
- package/dist/init.js +273 -0
- package/dist/map-cycles.d.ts +2 -0
- package/dist/map-cycles.js +34 -0
- package/dist/map-svg.d.ts +19 -0
- package/dist/map-svg.js +97 -0
- package/dist/map.js +78 -138
- package/dist/metrics.js +70 -55
- package/dist/output-metadata.d.ts +13 -0
- package/dist/output-metadata.js +17 -0
- package/dist/plugins-capabilities.d.ts +4 -0
- package/dist/plugins-capabilities.js +21 -0
- package/dist/plugins-messages.d.ts +10 -0
- package/dist/plugins-messages.js +16 -0
- package/dist/plugins-rules.d.ts +9 -0
- package/dist/plugins-rules.js +137 -0
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +45 -142
- package/dist/reporter-constants.d.ts +16 -0
- package/dist/reporter-constants.js +39 -0
- package/dist/reporter.d.ts +3 -3
- package/dist/reporter.js +35 -55
- package/dist/review.d.ts +2 -1
- package/dist/review.js +2 -1
- package/dist/rules/phase3-configurable.js +23 -15
- package/dist/saas/constants.d.ts +15 -0
- package/dist/saas/constants.js +48 -0
- package/dist/saas/dashboard.d.ts +8 -0
- package/dist/saas/dashboard.js +132 -0
- package/dist/saas/errors.d.ts +19 -0
- package/dist/saas/errors.js +37 -0
- package/dist/saas/helpers.d.ts +21 -0
- package/dist/saas/helpers.js +110 -0
- package/dist/saas/ingest.d.ts +3 -0
- package/dist/saas/ingest.js +249 -0
- package/dist/saas/organization.d.ts +5 -0
- package/dist/saas/organization.js +82 -0
- package/dist/saas/plan-change.d.ts +10 -0
- package/dist/saas/plan-change.js +15 -0
- package/dist/saas/store.d.ts +21 -0
- package/dist/saas/store.js +159 -0
- package/dist/saas/types.d.ts +191 -0
- package/dist/saas/types.js +2 -0
- package/dist/saas.d.ts +8 -218
- package/dist/saas.js +7 -761
- package/dist/sarif.d.ts +74 -0
- package/dist/sarif.js +122 -0
- package/dist/trust-advanced.d.ts +14 -0
- package/dist/trust-advanced.js +65 -0
- package/dist/trust-kpi-fs.d.ts +3 -0
- package/dist/trust-kpi-fs.js +141 -0
- package/dist/trust-kpi-parse.d.ts +7 -0
- package/dist/trust-kpi-parse.js +186 -0
- package/dist/trust-kpi-types.d.ts +16 -0
- package/dist/trust-kpi-types.js +2 -0
- package/dist/trust-kpi.d.ts +1 -3
- package/dist/trust-kpi.js +6 -266
- package/dist/trust-policy.d.ts +32 -0
- package/dist/trust-policy.js +160 -0
- package/dist/trust-render.d.ts +9 -0
- package/dist/trust-render.js +54 -0
- package/dist/trust-scoring.d.ts +9 -0
- package/dist/trust-scoring.js +208 -0
- package/dist/trust.d.ts +4 -32
- package/dist/trust.js +29 -432
- package/dist/types/app.d.ts +30 -0
- package/dist/types/app.js +2 -0
- package/dist/types/config.d.ts +25 -0
- package/dist/types/config.js +2 -0
- package/dist/types/core.d.ts +100 -0
- package/dist/types/core.js +2 -0
- package/dist/types/diff.d.ts +55 -0
- package/dist/types/diff.js +2 -0
- package/dist/types/plugin.d.ts +41 -0
- package/dist/types/plugin.js +2 -0
- package/dist/types/trust.d.ts +120 -0
- package/dist/types/trust.js +2 -0
- package/dist/types.d.ts +8 -365
- package/docs/release-notes-draft.md +40 -0
- package/docs/rules-catalog.md +49 -0
- package/docs/trust-core-release-checklist.md +37 -5
- package/package.json +3 -2
- package/packages/vscode-drift/src/code-actions.ts +1 -1
- package/schemas/drift-ai-output.v1.json +162 -0
- package/schemas/drift-report.v1.json +151 -0
- package/schemas/drift-trust.v1.json +131 -0
- package/scripts/smoke-repo.mjs +394 -0
- package/src/benchmark.ts +75 -53
- package/src/cli.ts +285 -13
- package/src/config.ts +19 -2
- package/src/diff.ts +57 -48
- package/src/doctor.ts +173 -0
- package/src/format.ts +81 -0
- package/src/guard-types.ts +64 -0
- package/src/guard.ts +324 -0
- package/src/index.ts +35 -0
- package/src/init.ts +298 -0
- package/src/map-cycles.ts +38 -0
- package/src/map-svg.ts +124 -0
- package/src/map.ts +111 -142
- package/src/metrics.ts +78 -59
- package/src/output-metadata.ts +30 -0
- package/src/plugins-capabilities.ts +36 -0
- package/src/plugins-messages.ts +35 -0
- package/src/plugins-rules.ts +296 -0
- package/src/plugins.ts +76 -283
- package/src/reporter-constants.ts +46 -0
- package/src/reporter.ts +64 -65
- package/src/review.ts +4 -2
- package/src/rules/phase3-configurable.ts +39 -26
- package/src/saas/constants.ts +56 -0
- package/src/saas/dashboard.ts +172 -0
- package/src/saas/errors.ts +45 -0
- package/src/saas/helpers.ts +140 -0
- package/src/saas/ingest.ts +278 -0
- package/src/saas/organization.ts +99 -0
- package/src/saas/plan-change.ts +19 -0
- package/src/saas/store.ts +172 -0
- package/src/saas/types.ts +216 -0
- package/src/saas.ts +49 -1031
- package/src/sarif.ts +232 -0
- package/src/trust-advanced.ts +99 -0
- package/src/trust-kpi-fs.ts +169 -0
- package/src/trust-kpi-parse.ts +219 -0
- package/src/trust-kpi-types.ts +19 -0
- package/src/trust-kpi.ts +8 -316
- package/src/trust-policy.ts +246 -0
- package/src/trust-render.ts +61 -0
- package/src/trust-scoring.ts +231 -0
- package/src/trust.ts +62 -576
- package/src/types/app.ts +30 -0
- package/src/types/config.ts +27 -0
- package/src/types/core.ts +105 -0
- package/src/types/diff.ts +61 -0
- package/src/types/plugin.ts +46 -0
- package/src/types/trust.ts +134 -0
- package/src/types.ts +78 -409
- package/tests/cli-sarif.test.ts +92 -0
- package/tests/format.test.ts +157 -0
- package/tests/new-features.test.ts +10 -2
- package/tests/phase1-init-doctor-guard.test.ts +199 -0
- package/tests/sarif.test.ts +160 -0
- package/tests/trust-kpi.test.ts +31 -4
- package/tests/trust.test.ts +18 -0
|
@@ -8,7 +8,7 @@ Use this checklist before releasing the trust-core milestone.
|
|
|
8
8
|
- [x] `npm test`
|
|
9
9
|
- [x] `npx --no-install tsx ./src/cli.ts trust . --base origin/master --markdown`
|
|
10
10
|
- [x] `npx --no-install tsx ./src/cli.ts trust . --base origin/master --json-output drift-trust.json`
|
|
11
|
-
- [x] `npx --no-install tsx ./src/cli.ts trust-gate drift-trust.json --min-trust
|
|
11
|
+
- [x] `npx --no-install tsx ./src/cli.ts trust-gate drift-trust.json --min-trust 45 --max-risk HIGH`
|
|
12
12
|
- [x] `npx --no-install tsx ./src/cli.ts review --base origin/master --comment`
|
|
13
13
|
|
|
14
14
|
## 2) CI workflow validation
|
|
@@ -36,16 +36,16 @@ Smoke PR runbook:
|
|
|
36
36
|
|
|
37
37
|
Default trust gate for this milestone:
|
|
38
38
|
|
|
39
|
-
- `--min-trust
|
|
39
|
+
- `--min-trust 45`
|
|
40
40
|
- `--max-risk HIGH`
|
|
41
41
|
|
|
42
42
|
Checks:
|
|
43
43
|
|
|
44
|
-
- [x] PR fails when trust score is below
|
|
44
|
+
- [x] PR fails when trust score is below 45.
|
|
45
45
|
- [x] PR fails when merge risk is `CRITICAL`.
|
|
46
|
-
- [x] PR passes when trust score is
|
|
46
|
+
- [x] PR passes when trust score is 45+ and merge risk is `LOW`, `MEDIUM`, or `HIGH`.
|
|
47
47
|
|
|
48
|
-
Calibration evidence from docs-only smoke runs: trust score 49 (PR #11), 46 (PR #12), 41 (PR #13). Gate floor set to
|
|
48
|
+
Calibration evidence from docs-only smoke runs: trust score 49 (PR #11), 46 (PR #12), 41 (PR #13). Gate floor set to 45 to reduce false positives while still blocking weak trust outcomes and `CRITICAL` risk.
|
|
49
49
|
|
|
50
50
|
## 4) Narrative and docs acceptance
|
|
51
51
|
|
|
@@ -53,3 +53,35 @@ Calibration evidence from docs-only smoke runs: trust score 49 (PR #11), 46 (PR
|
|
|
53
53
|
- [x] `package.json` description matches the same positioning.
|
|
54
54
|
- [x] `src/cli.ts` program description matches the same positioning.
|
|
55
55
|
- [x] `ROADMAP.md` no longer contradicts PRD on core vs premium direction.
|
|
56
|
+
|
|
57
|
+
## 5) SARIF and action v2 readiness
|
|
58
|
+
|
|
59
|
+
- [x] `scan --format sarif` emits valid SARIF payload with drift rule mapping.
|
|
60
|
+
- [x] `ci --format sarif` emits SARIF without requiring GitHub annotation mode.
|
|
61
|
+
- [x] `diff --format sarif` emits SARIF from `DriftDiff` output.
|
|
62
|
+
- [x] `review --format sarif` emits SARIF from review diff context.
|
|
63
|
+
- [x] `trust --format sarif` emits SARIF based on current trust scan report.
|
|
64
|
+
- [x] CI workflow uploads SARIF artifact in PR runs.
|
|
65
|
+
- [x] Action v2 contracts are aligned with SARIF-capable commands and outputs.
|
|
66
|
+
|
|
67
|
+
## 6) Trust artifacts and KPI readiness
|
|
68
|
+
|
|
69
|
+
- [x] Trust command supports split outputs (`--json-output` + selected stdout format).
|
|
70
|
+
- [x] Artifact bundle includes trust JSON, gate result, and trust KPI aggregate.
|
|
71
|
+
- [x] `drift kpi` parses trust artifacts and prints JSON plus optional summary.
|
|
72
|
+
- [x] Trust gate policy behavior documented and calibrated for current milestone.
|
|
73
|
+
|
|
74
|
+
## 7) Quick smoke runbook (no build)
|
|
75
|
+
|
|
76
|
+
Run from repository root:
|
|
77
|
+
|
|
78
|
+
- [x] `node --import tsx ./src/cli.ts scan . --format sarif > .tmp/smoke-scan.sarif`
|
|
79
|
+
- [x] `node --import tsx ./src/cli.ts ci . --format sarif > .tmp/smoke-ci.sarif`
|
|
80
|
+
- [x] `node --import tsx ./src/cli.ts trust . --format sarif > .tmp/smoke-trust.sarif`
|
|
81
|
+
- [x] `node --import tsx ./src/cli.ts review --base HEAD~1 --format sarif > .tmp/smoke-review.sarif`
|
|
82
|
+
|
|
83
|
+
Validation hints:
|
|
84
|
+
|
|
85
|
+
- Check each command exits with code `0`.
|
|
86
|
+
- Check each `.sarif` file starts with `{"$schema"` and contains `"runs"`.
|
|
87
|
+
- Keep smoke artifacts out of release commit unless explicitly needed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eduardbar/drift",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "AI Code Audit CLI for merge trust in AI-assisted PRs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"test": "vitest run",
|
|
16
16
|
"test:watch": "vitest",
|
|
17
17
|
"test:coverage": "vitest run --coverage",
|
|
18
|
-
"benchmark": "node --import tsx src/benchmark.ts"
|
|
18
|
+
"benchmark": "node --import tsx src/benchmark.ts",
|
|
19
|
+
"smoke:repo": "node ./scripts/smoke-repo.mjs"
|
|
19
20
|
},
|
|
20
21
|
"keywords": [
|
|
21
22
|
"vibe-coding",
|
|
@@ -16,7 +16,7 @@ function buildCatchTodoEdit(document: vscode.TextDocument, line: number): vscode
|
|
|
16
16
|
const targetLine = document.lineAt(line)
|
|
17
17
|
const baseIndent = targetLine.text.match(/^\s*/)?.[0] ?? ''
|
|
18
18
|
const indent = `${baseIndent} `
|
|
19
|
-
edit.insert(document.uri, new vscode.Position(line + 1, 0), `${indent}//
|
|
19
|
+
edit.insert(document.uri, new vscode.Position(line + 1, 0), `${indent}// handle error\n`)
|
|
20
20
|
return edit
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "schemas/drift-ai-output.v1.json",
|
|
4
|
+
"title": "drift ai output v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"$schema",
|
|
9
|
+
"toolVersion",
|
|
10
|
+
"summary",
|
|
11
|
+
"files_suspected",
|
|
12
|
+
"priority_order",
|
|
13
|
+
"maintenance_risk",
|
|
14
|
+
"quality",
|
|
15
|
+
"context_for_ai"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"$schema": {
|
|
19
|
+
"const": "schemas/drift-ai-output.v1.json"
|
|
20
|
+
},
|
|
21
|
+
"toolVersion": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"summary": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"required": [
|
|
28
|
+
"score",
|
|
29
|
+
"grade",
|
|
30
|
+
"total_issues",
|
|
31
|
+
"files_affected",
|
|
32
|
+
"files_clean",
|
|
33
|
+
"ai_likelihood",
|
|
34
|
+
"ai_code_smell_score"
|
|
35
|
+
],
|
|
36
|
+
"properties": {
|
|
37
|
+
"score": { "type": "number" },
|
|
38
|
+
"grade": { "type": "string" },
|
|
39
|
+
"total_issues": { "type": "number" },
|
|
40
|
+
"files_affected": { "type": "number" },
|
|
41
|
+
"files_clean": { "type": "number" },
|
|
42
|
+
"ai_likelihood": { "type": "number" },
|
|
43
|
+
"ai_code_smell_score": { "type": "number" }
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"files_suspected": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"required": ["path", "ai_likelihood", "triggers"],
|
|
52
|
+
"properties": {
|
|
53
|
+
"path": { "type": "string" },
|
|
54
|
+
"ai_likelihood": { "type": "number" },
|
|
55
|
+
"triggers": {
|
|
56
|
+
"type": "array",
|
|
57
|
+
"items": { "type": "string" }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"priority_order": {
|
|
63
|
+
"type": "array",
|
|
64
|
+
"items": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"additionalProperties": false,
|
|
67
|
+
"required": ["rank", "file", "line", "rule", "severity", "message", "snippet", "fix_suggestion", "effort"],
|
|
68
|
+
"properties": {
|
|
69
|
+
"rank": { "type": "number" },
|
|
70
|
+
"file": { "type": "string" },
|
|
71
|
+
"line": { "type": "number" },
|
|
72
|
+
"rule": { "type": "string" },
|
|
73
|
+
"severity": { "type": "string" },
|
|
74
|
+
"message": { "type": "string" },
|
|
75
|
+
"snippet": { "type": "string" },
|
|
76
|
+
"fix_suggestion": { "type": "string" },
|
|
77
|
+
"effort": { "enum": ["low", "medium", "high"] }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"maintenance_risk": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"additionalProperties": false,
|
|
84
|
+
"required": ["score", "level", "hotspots", "signals"],
|
|
85
|
+
"properties": {
|
|
86
|
+
"score": { "type": "number" },
|
|
87
|
+
"level": { "enum": ["low", "medium", "high", "critical"] },
|
|
88
|
+
"hotspots": {
|
|
89
|
+
"type": "array",
|
|
90
|
+
"items": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"additionalProperties": false,
|
|
93
|
+
"required": [
|
|
94
|
+
"file",
|
|
95
|
+
"driftScore",
|
|
96
|
+
"complexityIssues",
|
|
97
|
+
"hasNearbyTests",
|
|
98
|
+
"changeFrequency",
|
|
99
|
+
"risk",
|
|
100
|
+
"reasons"
|
|
101
|
+
],
|
|
102
|
+
"properties": {
|
|
103
|
+
"file": { "type": "string" },
|
|
104
|
+
"driftScore": { "type": "number" },
|
|
105
|
+
"complexityIssues": { "type": "number" },
|
|
106
|
+
"hasNearbyTests": { "type": "boolean" },
|
|
107
|
+
"changeFrequency": { "type": "number" },
|
|
108
|
+
"risk": { "type": "number" },
|
|
109
|
+
"reasons": {
|
|
110
|
+
"type": "array",
|
|
111
|
+
"items": { "type": "string" }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"signals": {
|
|
117
|
+
"type": "object",
|
|
118
|
+
"additionalProperties": false,
|
|
119
|
+
"required": ["highComplexityFiles", "filesWithoutNearbyTests", "frequentChangeFiles"],
|
|
120
|
+
"properties": {
|
|
121
|
+
"highComplexityFiles": { "type": "number" },
|
|
122
|
+
"filesWithoutNearbyTests": { "type": "number" },
|
|
123
|
+
"frequentChangeFiles": { "type": "number" }
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"quality": {
|
|
129
|
+
"type": "object",
|
|
130
|
+
"additionalProperties": false,
|
|
131
|
+
"required": ["overall", "dimensions"],
|
|
132
|
+
"properties": {
|
|
133
|
+
"overall": { "type": "number" },
|
|
134
|
+
"dimensions": {
|
|
135
|
+
"type": "object",
|
|
136
|
+
"additionalProperties": false,
|
|
137
|
+
"required": ["architecture", "complexity", "ai-patterns", "testing"],
|
|
138
|
+
"properties": {
|
|
139
|
+
"architecture": { "type": "number" },
|
|
140
|
+
"complexity": { "type": "number" },
|
|
141
|
+
"ai-patterns": { "type": "number" },
|
|
142
|
+
"testing": { "type": "number" }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"context_for_ai": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"additionalProperties": false,
|
|
150
|
+
"required": ["project_type", "scan_path", "rules_detected", "recommended_action"],
|
|
151
|
+
"properties": {
|
|
152
|
+
"project_type": { "type": "string" },
|
|
153
|
+
"scan_path": { "type": "string" },
|
|
154
|
+
"rules_detected": {
|
|
155
|
+
"type": "array",
|
|
156
|
+
"items": { "type": "string" }
|
|
157
|
+
},
|
|
158
|
+
"recommended_action": { "type": "string" }
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "schemas/drift-report.v1.json",
|
|
4
|
+
"title": "drift report v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"$schema",
|
|
9
|
+
"toolVersion",
|
|
10
|
+
"scannedAt",
|
|
11
|
+
"targetPath",
|
|
12
|
+
"files",
|
|
13
|
+
"totalIssues",
|
|
14
|
+
"totalScore",
|
|
15
|
+
"totalFiles",
|
|
16
|
+
"summary",
|
|
17
|
+
"quality",
|
|
18
|
+
"maintenanceRisk"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"$schema": {
|
|
22
|
+
"const": "schemas/drift-report.v1.json"
|
|
23
|
+
},
|
|
24
|
+
"toolVersion": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"scannedAt": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"targetPath": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"files": {
|
|
34
|
+
"type": "array",
|
|
35
|
+
"items": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"required": ["path", "issues", "score"],
|
|
39
|
+
"properties": {
|
|
40
|
+
"path": { "type": "string" },
|
|
41
|
+
"score": { "type": "number" },
|
|
42
|
+
"issues": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"items": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"required": ["rule", "severity", "message", "line", "column", "snippet"],
|
|
48
|
+
"properties": {
|
|
49
|
+
"rule": { "type": "string" },
|
|
50
|
+
"severity": { "enum": ["error", "warning", "info"] },
|
|
51
|
+
"message": { "type": "string" },
|
|
52
|
+
"line": { "type": "number" },
|
|
53
|
+
"column": { "type": "number" },
|
|
54
|
+
"snippet": { "type": "string" }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"totalIssues": {
|
|
62
|
+
"type": "number"
|
|
63
|
+
},
|
|
64
|
+
"totalScore": {
|
|
65
|
+
"type": "number"
|
|
66
|
+
},
|
|
67
|
+
"totalFiles": {
|
|
68
|
+
"type": "number"
|
|
69
|
+
},
|
|
70
|
+
"summary": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"required": ["errors", "warnings", "infos", "byRule"],
|
|
74
|
+
"properties": {
|
|
75
|
+
"errors": { "type": "number" },
|
|
76
|
+
"warnings": { "type": "number" },
|
|
77
|
+
"infos": { "type": "number" },
|
|
78
|
+
"byRule": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"additionalProperties": { "type": "number" }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"quality": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"additionalProperties": false,
|
|
87
|
+
"required": ["overall", "dimensions"],
|
|
88
|
+
"properties": {
|
|
89
|
+
"overall": { "type": "number" },
|
|
90
|
+
"dimensions": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"additionalProperties": false,
|
|
93
|
+
"required": ["architecture", "complexity", "ai-patterns", "testing"],
|
|
94
|
+
"properties": {
|
|
95
|
+
"architecture": { "type": "number" },
|
|
96
|
+
"complexity": { "type": "number" },
|
|
97
|
+
"ai-patterns": { "type": "number" },
|
|
98
|
+
"testing": { "type": "number" }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"maintenanceRisk": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"required": ["score", "level", "hotspots", "signals"],
|
|
107
|
+
"properties": {
|
|
108
|
+
"score": { "type": "number" },
|
|
109
|
+
"level": { "enum": ["low", "medium", "high", "critical"] },
|
|
110
|
+
"hotspots": {
|
|
111
|
+
"type": "array",
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"additionalProperties": false,
|
|
115
|
+
"required": [
|
|
116
|
+
"file",
|
|
117
|
+
"driftScore",
|
|
118
|
+
"complexityIssues",
|
|
119
|
+
"hasNearbyTests",
|
|
120
|
+
"changeFrequency",
|
|
121
|
+
"risk",
|
|
122
|
+
"reasons"
|
|
123
|
+
],
|
|
124
|
+
"properties": {
|
|
125
|
+
"file": { "type": "string" },
|
|
126
|
+
"driftScore": { "type": "number" },
|
|
127
|
+
"complexityIssues": { "type": "number" },
|
|
128
|
+
"hasNearbyTests": { "type": "boolean" },
|
|
129
|
+
"changeFrequency": { "type": "number" },
|
|
130
|
+
"risk": { "type": "number" },
|
|
131
|
+
"reasons": {
|
|
132
|
+
"type": "array",
|
|
133
|
+
"items": { "type": "string" }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"signals": {
|
|
139
|
+
"type": "object",
|
|
140
|
+
"additionalProperties": false,
|
|
141
|
+
"required": ["highComplexityFiles", "filesWithoutNearbyTests", "frequentChangeFiles"],
|
|
142
|
+
"properties": {
|
|
143
|
+
"highComplexityFiles": { "type": "number" },
|
|
144
|
+
"filesWithoutNearbyTests": { "type": "number" },
|
|
145
|
+
"frequentChangeFiles": { "type": "number" }
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "schemas/drift-trust.v1.json",
|
|
4
|
+
"title": "drift trust v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"$schema",
|
|
9
|
+
"toolVersion",
|
|
10
|
+
"scannedAt",
|
|
11
|
+
"targetPath",
|
|
12
|
+
"trust_score",
|
|
13
|
+
"merge_risk",
|
|
14
|
+
"top_reasons",
|
|
15
|
+
"fix_priorities"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"$schema": {
|
|
19
|
+
"const": "schemas/drift-trust.v1.json"
|
|
20
|
+
},
|
|
21
|
+
"toolVersion": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"scannedAt": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"targetPath": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"trust_score": {
|
|
31
|
+
"type": "number"
|
|
32
|
+
},
|
|
33
|
+
"merge_risk": {
|
|
34
|
+
"enum": ["LOW", "MEDIUM", "HIGH", "CRITICAL"]
|
|
35
|
+
},
|
|
36
|
+
"top_reasons": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"additionalProperties": false,
|
|
41
|
+
"required": ["label", "detail", "impact"],
|
|
42
|
+
"properties": {
|
|
43
|
+
"label": { "type": "string" },
|
|
44
|
+
"detail": { "type": "string" },
|
|
45
|
+
"impact": { "type": "number" }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"fix_priorities": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": false,
|
|
54
|
+
"required": [
|
|
55
|
+
"rank",
|
|
56
|
+
"rule",
|
|
57
|
+
"severity",
|
|
58
|
+
"occurrences",
|
|
59
|
+
"estimated_trust_gain",
|
|
60
|
+
"effort",
|
|
61
|
+
"suggestion"
|
|
62
|
+
],
|
|
63
|
+
"properties": {
|
|
64
|
+
"rank": { "type": "number" },
|
|
65
|
+
"rule": { "type": "string" },
|
|
66
|
+
"severity": { "enum": ["error", "warning", "info"] },
|
|
67
|
+
"occurrences": { "type": "number" },
|
|
68
|
+
"estimated_trust_gain": { "type": "number" },
|
|
69
|
+
"effort": { "enum": ["low", "medium", "high"] },
|
|
70
|
+
"suggestion": { "type": "string" },
|
|
71
|
+
"confidence": { "enum": ["low", "medium", "high"] },
|
|
72
|
+
"explanation": { "type": "string" },
|
|
73
|
+
"systemic": { "type": "boolean" }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"diff_context": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"additionalProperties": false,
|
|
80
|
+
"required": [
|
|
81
|
+
"baseRef",
|
|
82
|
+
"status",
|
|
83
|
+
"scoreDelta",
|
|
84
|
+
"newIssues",
|
|
85
|
+
"resolvedIssues",
|
|
86
|
+
"filesChanged",
|
|
87
|
+
"penalty",
|
|
88
|
+
"bonus",
|
|
89
|
+
"netImpact"
|
|
90
|
+
],
|
|
91
|
+
"properties": {
|
|
92
|
+
"baseRef": { "type": "string" },
|
|
93
|
+
"status": { "enum": ["improved", "regressed", "neutral"] },
|
|
94
|
+
"scoreDelta": { "type": "number" },
|
|
95
|
+
"newIssues": { "type": "number" },
|
|
96
|
+
"resolvedIssues": { "type": "number" },
|
|
97
|
+
"filesChanged": { "type": "number" },
|
|
98
|
+
"penalty": { "type": "number" },
|
|
99
|
+
"bonus": { "type": "number" },
|
|
100
|
+
"netImpact": { "type": "number" }
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"advanced_context": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"required": ["team_guidance"],
|
|
107
|
+
"properties": {
|
|
108
|
+
"comparison": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"additionalProperties": false,
|
|
111
|
+
"required": ["source", "trend", "summary"],
|
|
112
|
+
"properties": {
|
|
113
|
+
"source": { "enum": ["previous-trust-json", "snapshot-history"] },
|
|
114
|
+
"trend": { "enum": ["improving", "regressing", "stable"] },
|
|
115
|
+
"summary": { "type": "string" },
|
|
116
|
+
"trust_delta": { "type": "number" },
|
|
117
|
+
"previous_trust_score": { "type": "number" },
|
|
118
|
+
"previous_merge_risk": { "enum": ["LOW", "MEDIUM", "HIGH", "CRITICAL"] },
|
|
119
|
+
"snapshot_score_delta": { "type": "number" },
|
|
120
|
+
"snapshot_label": { "type": "string" },
|
|
121
|
+
"snapshot_timestamp": { "type": "string" }
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"team_guidance": {
|
|
125
|
+
"type": "array",
|
|
126
|
+
"items": { "type": "string" }
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|