@eduardbar/drift 1.2.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/publish-vscode.yml +3 -3
- package/.github/workflows/publish.yml +3 -3
- package/.github/workflows/review-pr.yml +94 -9
- package/AGENTS.md +75 -245
- package/CHANGELOG.md +28 -0
- package/README.md +308 -51
- package/ROADMAP.md +6 -5
- package/dist/analyzer.d.ts +2 -2
- package/dist/analyzer.js +420 -159
- package/dist/benchmark.d.ts +2 -0
- package/dist/benchmark.js +204 -0
- package/dist/cli.js +693 -67
- package/dist/config.js +16 -2
- package/dist/diff.js +66 -10
- 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/git.js +12 -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 +12 -3
- package/dist/index.js +6 -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 +2 -1
- package/dist/plugins.js +80 -28
- package/dist/printer.js +4 -0
- 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 +4 -3
- package/dist/rules/comments.js +2 -2
- package/dist/rules/complexity.js +2 -7
- package/dist/rules/nesting.js +3 -13
- package/dist/rules/phase0-basic.js +10 -10
- package/dist/rules/phase3-configurable.js +23 -15
- package/dist/rules/shared.d.ts +2 -0
- package/dist/rules/shared.js +27 -3
- 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 -82
- package/dist/saas.js +7 -320
- 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 +7 -0
- package/dist/trust-kpi.js +185 -0
- 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 +37 -0
- package/dist/trust.js +168 -0
- 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 -211
- package/docs/PRD.md +187 -109
- package/docs/plugin-contract.md +61 -0
- package/docs/release-notes-draft.md +40 -0
- package/docs/rules-catalog.md +49 -0
- package/docs/trust-core-release-checklist.md +87 -0
- package/package.json +6 -3
- 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/analyzer.ts +484 -155
- package/src/benchmark.ts +266 -0
- package/src/cli.ts +840 -85
- package/src/config.ts +19 -2
- package/src/diff.ts +84 -10
- package/src/doctor.ts +173 -0
- package/src/format.ts +81 -0
- package/src/git.ts +16 -0
- package/src/guard-types.ts +64 -0
- package/src/guard.ts +324 -0
- package/src/index.ts +83 -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 +148 -27
- package/src/printer.ts +4 -0
- package/src/reporter-constants.ts +46 -0
- package/src/reporter.ts +64 -65
- package/src/review.ts +6 -4
- package/src/rules/comments.ts +2 -2
- package/src/rules/complexity.ts +2 -7
- package/src/rules/nesting.ts +3 -13
- package/src/rules/phase0-basic.ts +11 -12
- package/src/rules/phase3-configurable.ts +39 -26
- package/src/rules/shared.ts +31 -3
- 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 -433
- 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 +210 -0
- 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 +260 -0
- 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 -238
- package/tests/cli-sarif.test.ts +92 -0
- package/tests/diff.test.ts +124 -0
- package/tests/format.test.ts +157 -0
- package/tests/new-features.test.ts +80 -1
- package/tests/phase1-init-doctor-guard.test.ts +199 -0
- package/tests/plugins.test.ts +219 -0
- package/tests/rules.test.ts +23 -1
- package/tests/saas-foundation.test.ts +358 -1
- package/tests/sarif.test.ts +160 -0
- package/tests/trust-kpi.test.ts +147 -0
- package/tests/trust.test.ts +602 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface LayerDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
patterns: string[];
|
|
4
|
+
canImportFrom: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface ModuleBoundary {
|
|
7
|
+
name: string;
|
|
8
|
+
root: string;
|
|
9
|
+
allowedExternalImports?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface DriftPerformanceConfig {
|
|
12
|
+
lowMemory?: boolean;
|
|
13
|
+
chunkSize?: number;
|
|
14
|
+
maxFiles?: number;
|
|
15
|
+
maxFileSizeKb?: number;
|
|
16
|
+
includeSemanticDuplication?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface DriftAnalysisOptions {
|
|
19
|
+
lowMemory?: boolean;
|
|
20
|
+
chunkSize?: number;
|
|
21
|
+
maxFiles?: number;
|
|
22
|
+
maxFileSizeKb?: number;
|
|
23
|
+
includeSemanticDuplication?: boolean;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export interface DriftIssue {
|
|
2
|
+
rule: string;
|
|
3
|
+
severity: 'error' | 'warning' | 'info';
|
|
4
|
+
message: string;
|
|
5
|
+
line: number;
|
|
6
|
+
column: number;
|
|
7
|
+
snippet: string;
|
|
8
|
+
}
|
|
9
|
+
export interface FileReport {
|
|
10
|
+
path: string;
|
|
11
|
+
issues: DriftIssue[];
|
|
12
|
+
score: number;
|
|
13
|
+
}
|
|
14
|
+
export interface RepoQualityScore {
|
|
15
|
+
overall: number;
|
|
16
|
+
dimensions: {
|
|
17
|
+
architecture: number;
|
|
18
|
+
complexity: number;
|
|
19
|
+
'ai-patterns': number;
|
|
20
|
+
testing: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface RiskHotspot {
|
|
24
|
+
file: string;
|
|
25
|
+
driftScore: number;
|
|
26
|
+
complexityIssues: number;
|
|
27
|
+
hasNearbyTests: boolean;
|
|
28
|
+
changeFrequency: number;
|
|
29
|
+
risk: number;
|
|
30
|
+
reasons: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface MaintenanceRiskMetrics {
|
|
33
|
+
score: number;
|
|
34
|
+
level: 'low' | 'medium' | 'high' | 'critical';
|
|
35
|
+
hotspots: RiskHotspot[];
|
|
36
|
+
signals: {
|
|
37
|
+
highComplexityFiles: number;
|
|
38
|
+
filesWithoutNearbyTests: number;
|
|
39
|
+
frequentChangeFiles: number;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface DriftReport {
|
|
43
|
+
scannedAt: string;
|
|
44
|
+
targetPath: string;
|
|
45
|
+
files: FileReport[];
|
|
46
|
+
totalIssues: number;
|
|
47
|
+
totalScore: number;
|
|
48
|
+
totalFiles: number;
|
|
49
|
+
summary: {
|
|
50
|
+
errors: number;
|
|
51
|
+
warnings: number;
|
|
52
|
+
infos: number;
|
|
53
|
+
byRule: Record<string, number>;
|
|
54
|
+
};
|
|
55
|
+
quality: RepoQualityScore;
|
|
56
|
+
maintenanceRisk: MaintenanceRiskMetrics;
|
|
57
|
+
}
|
|
58
|
+
export interface AIIssue {
|
|
59
|
+
rank: number;
|
|
60
|
+
file: string;
|
|
61
|
+
line: number;
|
|
62
|
+
rule: string;
|
|
63
|
+
severity: string;
|
|
64
|
+
message: string;
|
|
65
|
+
snippet: string;
|
|
66
|
+
fix_suggestion: string;
|
|
67
|
+
effort: 'low' | 'medium' | 'high';
|
|
68
|
+
}
|
|
69
|
+
export interface AIOutput {
|
|
70
|
+
summary: {
|
|
71
|
+
score: number;
|
|
72
|
+
grade: string;
|
|
73
|
+
total_issues: number;
|
|
74
|
+
files_affected: number;
|
|
75
|
+
files_clean: number;
|
|
76
|
+
ai_likelihood: number;
|
|
77
|
+
ai_code_smell_score: number;
|
|
78
|
+
};
|
|
79
|
+
files_suspected: Array<{
|
|
80
|
+
path: string;
|
|
81
|
+
ai_likelihood: number;
|
|
82
|
+
triggers: string[];
|
|
83
|
+
}>;
|
|
84
|
+
priority_order: AIIssue[];
|
|
85
|
+
maintenance_risk: MaintenanceRiskMetrics;
|
|
86
|
+
quality: RepoQualityScore;
|
|
87
|
+
context_for_ai: {
|
|
88
|
+
project_type: string;
|
|
89
|
+
scan_path: string;
|
|
90
|
+
rules_detected: string[];
|
|
91
|
+
recommended_action: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export interface DriftOutputMetadata {
|
|
95
|
+
$schema: string;
|
|
96
|
+
toolVersion: string;
|
|
97
|
+
}
|
|
98
|
+
export type DriftReportJson = DriftReport & DriftOutputMetadata;
|
|
99
|
+
export type AIOutputJson = AIOutput & DriftOutputMetadata;
|
|
100
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { DriftIssue, DriftReport, FileReport } from './core.js';
|
|
2
|
+
export interface FileDiff {
|
|
3
|
+
path: string;
|
|
4
|
+
scoreBefore: number;
|
|
5
|
+
scoreAfter: number;
|
|
6
|
+
scoreDelta: number;
|
|
7
|
+
newIssues: DriftIssue[];
|
|
8
|
+
resolvedIssues: DriftIssue[];
|
|
9
|
+
}
|
|
10
|
+
export interface DriftDiff {
|
|
11
|
+
baseRef: string;
|
|
12
|
+
projectPath: string;
|
|
13
|
+
scannedAt: string;
|
|
14
|
+
files: FileDiff[];
|
|
15
|
+
totalScoreBefore: number;
|
|
16
|
+
totalScoreAfter: number;
|
|
17
|
+
totalDelta: number;
|
|
18
|
+
newIssuesCount: number;
|
|
19
|
+
resolvedIssuesCount: number;
|
|
20
|
+
}
|
|
21
|
+
export interface HistoricalAnalysis {
|
|
22
|
+
commitHash: string;
|
|
23
|
+
commitDate: Date;
|
|
24
|
+
author: string;
|
|
25
|
+
message: string;
|
|
26
|
+
files: FileReport[];
|
|
27
|
+
totalScore: number;
|
|
28
|
+
averageScore: number;
|
|
29
|
+
}
|
|
30
|
+
export interface TrendDataPoint {
|
|
31
|
+
date: Date;
|
|
32
|
+
score: number;
|
|
33
|
+
fileCount: number;
|
|
34
|
+
avgIssuesPerFile: number;
|
|
35
|
+
}
|
|
36
|
+
export interface BlameAttribution {
|
|
37
|
+
author: string;
|
|
38
|
+
email: string;
|
|
39
|
+
commits: number;
|
|
40
|
+
linesChanged: number;
|
|
41
|
+
issuesIntroduced: number;
|
|
42
|
+
avgScoreImpact: number;
|
|
43
|
+
}
|
|
44
|
+
export interface DriftTrendReport extends DriftReport {
|
|
45
|
+
trend: TrendDataPoint[];
|
|
46
|
+
regression: {
|
|
47
|
+
slope: number;
|
|
48
|
+
intercept: number;
|
|
49
|
+
r2: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface DriftBlameReport extends DriftReport {
|
|
53
|
+
blame: BlameAttribution[];
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SourceFile } from 'ts-morph';
|
|
2
|
+
import type { DriftConfig } from './app.js';
|
|
3
|
+
import type { DriftIssue } from './core.js';
|
|
4
|
+
export interface PluginRuleContext {
|
|
5
|
+
projectRoot: string;
|
|
6
|
+
filePath: string;
|
|
7
|
+
config?: DriftConfig;
|
|
8
|
+
}
|
|
9
|
+
export interface DriftPluginRule {
|
|
10
|
+
id?: string;
|
|
11
|
+
name: string;
|
|
12
|
+
severity?: DriftIssue['severity'];
|
|
13
|
+
weight?: number;
|
|
14
|
+
detect: (file: SourceFile, context: PluginRuleContext) => DriftIssue[];
|
|
15
|
+
fix?: (issue: DriftIssue, file: SourceFile, context: PluginRuleContext) => DriftIssue | void;
|
|
16
|
+
}
|
|
17
|
+
export interface DriftPlugin {
|
|
18
|
+
name: string;
|
|
19
|
+
apiVersion?: number;
|
|
20
|
+
capabilities?: Record<string, string | number | boolean>;
|
|
21
|
+
rules: DriftPluginRule[];
|
|
22
|
+
}
|
|
23
|
+
export interface LoadedPlugin {
|
|
24
|
+
id: string;
|
|
25
|
+
plugin: DriftPlugin;
|
|
26
|
+
}
|
|
27
|
+
export interface PluginLoadError {
|
|
28
|
+
pluginId: string;
|
|
29
|
+
pluginName?: string;
|
|
30
|
+
ruleId?: string;
|
|
31
|
+
code?: string;
|
|
32
|
+
message: string;
|
|
33
|
+
}
|
|
34
|
+
export interface PluginLoadWarning {
|
|
35
|
+
pluginId: string;
|
|
36
|
+
pluginName?: string;
|
|
37
|
+
ruleId?: string;
|
|
38
|
+
code?: string;
|
|
39
|
+
message: string;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { DriftIssue, DriftOutputMetadata } from './core.js';
|
|
2
|
+
export type MergeRiskLevel = 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
|
|
3
|
+
export interface TrustGatePolicyPreset {
|
|
4
|
+
branch: string;
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
minTrust?: number;
|
|
7
|
+
maxRisk?: MergeRiskLevel;
|
|
8
|
+
}
|
|
9
|
+
export interface TrustGatePolicyPack {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
minTrust?: number;
|
|
12
|
+
maxRisk?: MergeRiskLevel;
|
|
13
|
+
}
|
|
14
|
+
export interface TrustGatePolicyConfig {
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
minTrust?: number;
|
|
17
|
+
maxRisk?: MergeRiskLevel;
|
|
18
|
+
presets?: TrustGatePolicyPreset[];
|
|
19
|
+
policyPacks?: Record<string, TrustGatePolicyPack>;
|
|
20
|
+
}
|
|
21
|
+
export interface TrustReason {
|
|
22
|
+
label: string;
|
|
23
|
+
detail: string;
|
|
24
|
+
impact: number;
|
|
25
|
+
}
|
|
26
|
+
export interface TrustFixPriority {
|
|
27
|
+
rank: number;
|
|
28
|
+
rule: string;
|
|
29
|
+
severity: DriftIssue['severity'];
|
|
30
|
+
occurrences: number;
|
|
31
|
+
estimated_trust_gain: number;
|
|
32
|
+
effort: 'low' | 'medium' | 'high';
|
|
33
|
+
suggestion: string;
|
|
34
|
+
confidence?: 'low' | 'medium' | 'high';
|
|
35
|
+
explanation?: string;
|
|
36
|
+
systemic?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface TrustAdvancedComparison {
|
|
39
|
+
source: 'previous-trust-json' | 'snapshot-history';
|
|
40
|
+
trend: 'improving' | 'regressing' | 'stable';
|
|
41
|
+
summary: string;
|
|
42
|
+
trust_delta?: number;
|
|
43
|
+
previous_trust_score?: number;
|
|
44
|
+
previous_merge_risk?: MergeRiskLevel;
|
|
45
|
+
snapshot_score_delta?: number;
|
|
46
|
+
snapshot_label?: string;
|
|
47
|
+
snapshot_timestamp?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface TrustAdvancedContext {
|
|
50
|
+
comparison?: TrustAdvancedComparison;
|
|
51
|
+
team_guidance: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface TrustDiffContext {
|
|
54
|
+
baseRef: string;
|
|
55
|
+
status: 'improved' | 'regressed' | 'neutral';
|
|
56
|
+
scoreDelta: number;
|
|
57
|
+
newIssues: number;
|
|
58
|
+
resolvedIssues: number;
|
|
59
|
+
filesChanged: number;
|
|
60
|
+
penalty: number;
|
|
61
|
+
bonus: number;
|
|
62
|
+
netImpact: number;
|
|
63
|
+
}
|
|
64
|
+
export interface DriftTrustReport {
|
|
65
|
+
scannedAt: string;
|
|
66
|
+
targetPath: string;
|
|
67
|
+
trust_score: number;
|
|
68
|
+
merge_risk: MergeRiskLevel;
|
|
69
|
+
top_reasons: TrustReason[];
|
|
70
|
+
fix_priorities: TrustFixPriority[];
|
|
71
|
+
diff_context?: TrustDiffContext;
|
|
72
|
+
advanced_context?: TrustAdvancedContext;
|
|
73
|
+
}
|
|
74
|
+
export type DriftTrustReportJson = DriftTrustReport & DriftOutputMetadata;
|
|
75
|
+
export interface TrustKpiDiagnostic {
|
|
76
|
+
level: 'warning' | 'error';
|
|
77
|
+
code: 'path-not-found' | 'path-not-supported' | 'read-failed' | 'parse-failed' | 'invalid-shape' | 'invalid-diff-context';
|
|
78
|
+
message: string;
|
|
79
|
+
file?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface TrustScoreStats {
|
|
82
|
+
average: number | null;
|
|
83
|
+
median: number | null;
|
|
84
|
+
min: number | null;
|
|
85
|
+
max: number | null;
|
|
86
|
+
}
|
|
87
|
+
export interface TrustDiffTrendSummary {
|
|
88
|
+
available: boolean;
|
|
89
|
+
samples: number;
|
|
90
|
+
statusDistribution: {
|
|
91
|
+
improved: number;
|
|
92
|
+
regressed: number;
|
|
93
|
+
neutral: number;
|
|
94
|
+
};
|
|
95
|
+
scoreDelta: {
|
|
96
|
+
average: number | null;
|
|
97
|
+
median: number | null;
|
|
98
|
+
};
|
|
99
|
+
issues: {
|
|
100
|
+
newTotal: number;
|
|
101
|
+
resolvedTotal: number;
|
|
102
|
+
netNew: number;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export interface TrustKpiReport {
|
|
106
|
+
generatedAt: string;
|
|
107
|
+
input: string;
|
|
108
|
+
files: {
|
|
109
|
+
matched: number;
|
|
110
|
+
parsed: number;
|
|
111
|
+
malformed: number;
|
|
112
|
+
};
|
|
113
|
+
prsEvaluated: number;
|
|
114
|
+
mergeRiskDistribution: Record<MergeRiskLevel, number>;
|
|
115
|
+
trustScore: TrustScoreStats;
|
|
116
|
+
highRiskRatio: number | null;
|
|
117
|
+
diffTrend: TrustDiffTrendSummary;
|
|
118
|
+
diagnostics: TrustKpiDiagnostic[];
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=trust.d.ts.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,212 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
export interface FileReport {
|
|
11
|
-
path: string;
|
|
12
|
-
issues: DriftIssue[];
|
|
13
|
-
score: number;
|
|
14
|
-
}
|
|
15
|
-
export interface DriftReport {
|
|
16
|
-
scannedAt: string;
|
|
17
|
-
targetPath: string;
|
|
18
|
-
files: FileReport[];
|
|
19
|
-
totalIssues: number;
|
|
20
|
-
totalScore: number;
|
|
21
|
-
totalFiles: number;
|
|
22
|
-
summary: {
|
|
23
|
-
errors: number;
|
|
24
|
-
warnings: number;
|
|
25
|
-
infos: number;
|
|
26
|
-
byRule: Record<string, number>;
|
|
27
|
-
};
|
|
28
|
-
quality: RepoQualityScore;
|
|
29
|
-
maintenanceRisk: MaintenanceRiskMetrics;
|
|
30
|
-
}
|
|
31
|
-
export interface RepoQualityScore {
|
|
32
|
-
overall: number;
|
|
33
|
-
dimensions: {
|
|
34
|
-
architecture: number;
|
|
35
|
-
complexity: number;
|
|
36
|
-
'ai-patterns': number;
|
|
37
|
-
testing: number;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
export interface RiskHotspot {
|
|
41
|
-
file: string;
|
|
42
|
-
driftScore: number;
|
|
43
|
-
complexityIssues: number;
|
|
44
|
-
hasNearbyTests: boolean;
|
|
45
|
-
changeFrequency: number;
|
|
46
|
-
risk: number;
|
|
47
|
-
reasons: string[];
|
|
48
|
-
}
|
|
49
|
-
export interface MaintenanceRiskMetrics {
|
|
50
|
-
score: number;
|
|
51
|
-
level: 'low' | 'medium' | 'high' | 'critical';
|
|
52
|
-
hotspots: RiskHotspot[];
|
|
53
|
-
signals: {
|
|
54
|
-
highComplexityFiles: number;
|
|
55
|
-
filesWithoutNearbyTests: number;
|
|
56
|
-
frequentChangeFiles: number;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
export interface AIOutput {
|
|
60
|
-
summary: {
|
|
61
|
-
score: number;
|
|
62
|
-
grade: string;
|
|
63
|
-
total_issues: number;
|
|
64
|
-
files_affected: number;
|
|
65
|
-
files_clean: number;
|
|
66
|
-
ai_likelihood: number;
|
|
67
|
-
ai_code_smell_score: number;
|
|
68
|
-
};
|
|
69
|
-
files_suspected: Array<{
|
|
70
|
-
path: string;
|
|
71
|
-
ai_likelihood: number;
|
|
72
|
-
triggers: string[];
|
|
73
|
-
}>;
|
|
74
|
-
priority_order: AIIssue[];
|
|
75
|
-
maintenance_risk: MaintenanceRiskMetrics;
|
|
76
|
-
quality: RepoQualityScore;
|
|
77
|
-
context_for_ai: {
|
|
78
|
-
project_type: string;
|
|
79
|
-
scan_path: string;
|
|
80
|
-
rules_detected: string[];
|
|
81
|
-
recommended_action: string;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
export interface AIIssue {
|
|
85
|
-
rank: number;
|
|
86
|
-
file: string;
|
|
87
|
-
line: number;
|
|
88
|
-
rule: string;
|
|
89
|
-
severity: string;
|
|
90
|
-
message: string;
|
|
91
|
-
snippet: string;
|
|
92
|
-
fix_suggestion: string;
|
|
93
|
-
effort: 'low' | 'medium' | 'high';
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Layer definition for architectural boundary enforcement.
|
|
97
|
-
*/
|
|
98
|
-
export interface LayerDefinition {
|
|
99
|
-
name: string;
|
|
100
|
-
patterns: string[];
|
|
101
|
-
canImportFrom: string[];
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Module boundary definition for cross-boundary enforcement.
|
|
105
|
-
*/
|
|
106
|
-
export interface ModuleBoundary {
|
|
107
|
-
name: string;
|
|
108
|
-
root: string;
|
|
109
|
-
allowedExternalImports?: string[];
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Optional project-level configuration for drift.
|
|
113
|
-
* Place in drift.config.ts (or .js / .json) at the project root.
|
|
114
|
-
*/
|
|
115
|
-
export interface DriftConfig {
|
|
116
|
-
layers?: LayerDefinition[];
|
|
117
|
-
modules?: ModuleBoundary[];
|
|
118
|
-
plugins?: string[];
|
|
119
|
-
architectureRules?: {
|
|
120
|
-
controllerNoDb?: boolean;
|
|
121
|
-
serviceNoHttp?: boolean;
|
|
122
|
-
maxFunctionLines?: number;
|
|
123
|
-
};
|
|
124
|
-
saas?: {
|
|
125
|
-
freeUserThreshold?: number;
|
|
126
|
-
maxRunsPerWorkspacePerMonth?: number;
|
|
127
|
-
maxReposPerWorkspace?: number;
|
|
128
|
-
retentionDays?: number;
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
export interface PluginRuleContext {
|
|
132
|
-
projectRoot: string;
|
|
133
|
-
filePath: string;
|
|
134
|
-
config?: DriftConfig;
|
|
135
|
-
}
|
|
136
|
-
export interface DriftPluginRule {
|
|
137
|
-
name: string;
|
|
138
|
-
severity?: DriftIssue['severity'];
|
|
139
|
-
weight?: number;
|
|
140
|
-
detect: (file: SourceFile, context: PluginRuleContext) => DriftIssue[];
|
|
141
|
-
}
|
|
142
|
-
export interface DriftPlugin {
|
|
143
|
-
name: string;
|
|
144
|
-
rules: DriftPluginRule[];
|
|
145
|
-
}
|
|
146
|
-
export interface LoadedPlugin {
|
|
147
|
-
id: string;
|
|
148
|
-
plugin: DriftPlugin;
|
|
149
|
-
}
|
|
150
|
-
export interface PluginLoadError {
|
|
151
|
-
pluginId: string;
|
|
152
|
-
message: string;
|
|
153
|
-
}
|
|
154
|
-
export interface FileDiff {
|
|
155
|
-
path: string;
|
|
156
|
-
scoreBefore: number;
|
|
157
|
-
scoreAfter: number;
|
|
158
|
-
scoreDelta: number;
|
|
159
|
-
newIssues: DriftIssue[];
|
|
160
|
-
resolvedIssues: DriftIssue[];
|
|
161
|
-
}
|
|
162
|
-
export interface DriftDiff {
|
|
163
|
-
baseRef: string;
|
|
164
|
-
projectPath: string;
|
|
165
|
-
scannedAt: string;
|
|
166
|
-
files: FileDiff[];
|
|
167
|
-
totalScoreBefore: number;
|
|
168
|
-
totalScoreAfter: number;
|
|
169
|
-
totalDelta: number;
|
|
170
|
-
newIssuesCount: number;
|
|
171
|
-
resolvedIssuesCount: number;
|
|
172
|
-
}
|
|
173
|
-
/** Historical analysis data for a single commit */
|
|
174
|
-
export interface HistoricalAnalysis {
|
|
175
|
-
commitHash: string;
|
|
176
|
-
commitDate: Date;
|
|
177
|
-
author: string;
|
|
178
|
-
message: string;
|
|
179
|
-
files: FileReport[];
|
|
180
|
-
totalScore: number;
|
|
181
|
-
averageScore: number;
|
|
182
|
-
}
|
|
183
|
-
/** Trend data point for score evolution */
|
|
184
|
-
export interface TrendDataPoint {
|
|
185
|
-
date: Date;
|
|
186
|
-
score: number;
|
|
187
|
-
fileCount: number;
|
|
188
|
-
avgIssuesPerFile: number;
|
|
189
|
-
}
|
|
190
|
-
/** Blame attribution data */
|
|
191
|
-
export interface BlameAttribution {
|
|
192
|
-
author: string;
|
|
193
|
-
email: string;
|
|
194
|
-
commits: number;
|
|
195
|
-
linesChanged: number;
|
|
196
|
-
issuesIntroduced: number;
|
|
197
|
-
avgScoreImpact: number;
|
|
198
|
-
}
|
|
199
|
-
/** Extended DriftReport with historical context */
|
|
200
|
-
export interface DriftTrendReport extends DriftReport {
|
|
201
|
-
trend: TrendDataPoint[];
|
|
202
|
-
regression: {
|
|
203
|
-
slope: number;
|
|
204
|
-
intercept: number;
|
|
205
|
-
r2: number;
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
/** Extended DriftReport with blame data */
|
|
209
|
-
export interface DriftBlameReport extends DriftReport {
|
|
210
|
-
blame: BlameAttribution[];
|
|
211
|
-
}
|
|
1
|
+
export type { DriftIssue, FileReport, RepoQualityScore, RiskHotspot, MaintenanceRiskMetrics, AIIssue, AIOutput, AIOutputJson, DriftReport, DriftReportJson, DriftOutputMetadata, } from './types/core.js';
|
|
2
|
+
export type { MergeRiskLevel, TrustGatePolicyPreset, TrustGatePolicyPack, TrustGatePolicyConfig, TrustReason, TrustFixPriority, TrustAdvancedComparison, TrustAdvancedContext, TrustDiffContext, DriftTrustReport, DriftTrustReportJson, TrustKpiDiagnostic, TrustScoreStats, TrustDiffTrendSummary, TrustKpiReport, } from './types/trust.js';
|
|
3
|
+
export type { LayerDefinition, ModuleBoundary, DriftPerformanceConfig, DriftAnalysisOptions, } from './types/config.js';
|
|
4
|
+
export type { DriftConfig } from './types/app.js';
|
|
5
|
+
export type { PluginRuleContext, DriftPluginRule, DriftPlugin, LoadedPlugin, PluginLoadError, PluginLoadWarning, } from './types/plugin.js';
|
|
6
|
+
export type { FileDiff, DriftDiff, HistoricalAnalysis, TrendDataPoint, BlameAttribution, DriftTrendReport, DriftBlameReport, } from './types/diff.js';
|
|
7
|
+
export type { GuardBaseline, GuardThresholds, GuardOptions, GuardMetrics, GuardCheck, GuardEvaluation, GuardResult, } from './guard-types.js';
|
|
8
|
+
export type { SarifLevel, DriftSarifRule, DriftSarifResult, DriftSarifRun, DriftSarifLog, } from './sarif.js';
|
|
212
9
|
//# sourceMappingURL=types.d.ts.map
|