Repository navigation
Expand file tree
/
Copy pathtypes.ts
More file actions
162 lines (145 loc) · 3.34 KB
/
Copy pathtypes.ts
File metadata and controls
162 lines (145 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// Shared contracts between the analysis engine, the API and the UI.
export type Severity = "critical" | "major" | "minor" | "info";
export type Category =
| "quality"
| "security"
| "documentation"
| "testing"
| "maintainability";
export const CATEGORY_LABELS: Record<Category, string> = {
quality: "Code Quality",
security: "Security",
documentation: "Documentation",
testing: "Testing",
maintainability: "Maintainability",
};
export interface Finding {
id: string;
category: Category;
severity: Severity;
title: string;
detail: string;
file?: string;
line?: number;
metric?: string;
penalty: number;
link?: string;
}
export interface Contribution {
title: string;
penalty: number;
}
export interface CategoryScore {
key: Category;
label: string;
score: number;
penalty: number;
contributions: Contribution[];
note?: string;
}
export interface Confidence {
filesAnalyzed: number;
filesTotal: number;
languages: string[];
partial: boolean;
}
export interface ScoreReport {
overall: number;
grade: string;
categories: CategoryScore[];
confidence: Confidence;
}
export interface RepoMeta {
owner: string;
name: string;
description: string | null;
stars: number;
forks: number;
openIssues: number;
defaultBranch: string;
primaryLanguage: string | null;
languages: Record<string, number>;
license: string | null;
createdAt: string | null;
pushedAt: string | null;
contributors: number;
busFactor: number;
archived: boolean;
}
export interface GraphNode {
id: string;
label: string;
kind: "module" | "file";
loc: number;
complexity: number;
fanIn: number;
fanOut: number;
inCycle: boolean;
}
export interface GraphEdge {
source: string;
target: string;
weight: number;
}
export interface ArchitectureGraph {
level: "module" | "file";
nodes: GraphNode[];
edges: GraphEdge[];
cycles: string[][];
topFanIn: { id: string; fanIn: number }[];
externalDeps: { name: string; count: number }[];
unresolvedImports: number;
}
export interface PlanItem {
rank: number;
title: string;
detail: string;
impact: "high" | "medium" | "low";
effort: "low" | "medium" | "high";
relatedFindings: string[];
}
export interface AnalysisStats {
filesAnalyzed: number;
filesTotal: number;
totalLoc: number;
durationMs: number;
byLanguage: Record<string, { files: number; loc: number }>;
}
export interface VulnerableDep {
name: string;
version: string;
ecosystem: string;
vulns: { id: string; summary?: string; url: string }[];
}
export interface AnalysisResult {
id: string;
repo: { url: string; owner: string; name: string; ref: string };
meta: RepoMeta;
scores: ScoreReport;
findings: Finding[];
architecture: ArchitectureGraph;
fileGraph?: ArchitectureGraph;
prescription?: { text: string; provider: string; generatedAt: string } | null;
plan: PlanItem[];
stats: AnalysisStats;
vulnerableDeps: VulnerableDep[];
notes: string[];
analyzedAt: string;
}
export type JobStatus = "queued" | "running" | "done" | "error";
export interface Job {
id: string;
repoUrl: string;
owner: string;
repo: string;
status: JobStatus;
stage: string;
progress: number;
message: string;
createdAt: string;
finishedAt?: string;
error?: string;
cached?: boolean;
resultId?: string;
summary?: { overall: number; grade: string };
}