@juspay/yama 1.6.0 → 2.1.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/.mcp-config.example.json +26 -0
- package/CHANGELOG.md +46 -0
- package/README.md +311 -685
- package/dist/cli/v2.cli.d.ts +13 -0
- package/dist/cli/v2.cli.js +359 -0
- package/dist/index.d.ts +12 -13
- package/dist/index.js +18 -19
- package/dist/v2/config/ConfigLoader.d.ts +50 -0
- package/dist/v2/config/ConfigLoader.js +205 -0
- package/dist/v2/config/DefaultConfig.d.ts +9 -0
- package/dist/v2/config/DefaultConfig.js +187 -0
- package/dist/v2/core/LearningOrchestrator.d.ts +65 -0
- package/dist/v2/core/LearningOrchestrator.js +499 -0
- package/dist/v2/core/MCPServerManager.d.ts +22 -0
- package/dist/v2/core/MCPServerManager.js +100 -0
- package/dist/v2/core/SessionManager.d.ts +72 -0
- package/dist/v2/core/SessionManager.js +200 -0
- package/dist/v2/core/YamaV2Orchestrator.d.ts +112 -0
- package/dist/v2/core/YamaV2Orchestrator.js +549 -0
- package/dist/v2/learning/FeedbackExtractor.d.ts +46 -0
- package/dist/v2/learning/FeedbackExtractor.js +237 -0
- package/dist/v2/learning/KnowledgeBaseManager.d.ts +91 -0
- package/dist/v2/learning/KnowledgeBaseManager.js +475 -0
- package/dist/v2/learning/types.d.ts +121 -0
- package/dist/v2/learning/types.js +15 -0
- package/dist/v2/prompts/EnhancementSystemPrompt.d.ts +8 -0
- package/dist/v2/prompts/EnhancementSystemPrompt.js +216 -0
- package/dist/v2/prompts/LangfusePromptManager.d.ts +48 -0
- package/dist/v2/prompts/LangfusePromptManager.js +144 -0
- package/dist/v2/prompts/LearningSystemPrompt.d.ts +11 -0
- package/dist/v2/prompts/LearningSystemPrompt.js +180 -0
- package/dist/v2/prompts/PromptBuilder.d.ts +45 -0
- package/dist/v2/prompts/PromptBuilder.js +257 -0
- package/dist/v2/prompts/ReviewSystemPrompt.d.ts +8 -0
- package/dist/v2/prompts/ReviewSystemPrompt.js +270 -0
- package/dist/v2/types/config.types.d.ts +141 -0
- package/dist/v2/types/config.types.js +5 -0
- package/dist/v2/types/mcp.types.d.ts +191 -0
- package/dist/v2/types/mcp.types.js +6 -0
- package/dist/v2/types/v2.types.d.ts +182 -0
- package/dist/v2/types/v2.types.js +42 -0
- package/dist/v2/utils/ObservabilityConfig.d.ts +22 -0
- package/dist/v2/utils/ObservabilityConfig.js +48 -0
- package/package.json +16 -10
- package/yama.config.example.yaml +259 -204
- package/dist/cli/index.d.ts +0 -12
- package/dist/cli/index.js +0 -538
- package/dist/core/ContextGatherer.d.ts +0 -110
- package/dist/core/ContextGatherer.js +0 -470
- package/dist/core/Guardian.d.ts +0 -81
- package/dist/core/Guardian.js +0 -480
- package/dist/core/providers/BitbucketProvider.d.ts +0 -105
- package/dist/core/providers/BitbucketProvider.js +0 -489
- package/dist/features/CodeReviewer.d.ts +0 -173
- package/dist/features/CodeReviewer.js +0 -1707
- package/dist/features/DescriptionEnhancer.d.ts +0 -70
- package/dist/features/DescriptionEnhancer.js +0 -511
- package/dist/features/MultiInstanceProcessor.d.ts +0 -74
- package/dist/features/MultiInstanceProcessor.js +0 -360
- package/dist/types/index.d.ts +0 -624
- package/dist/types/index.js +0 -104
- package/dist/utils/Cache.d.ts +0 -103
- package/dist/utils/Cache.js +0 -444
- package/dist/utils/ConfigManager.d.ts +0 -88
- package/dist/utils/ConfigManager.js +0 -602
- package/dist/utils/ContentSimilarityService.d.ts +0 -74
- package/dist/utils/ContentSimilarityService.js +0 -215
- package/dist/utils/ExactDuplicateRemover.d.ts +0 -77
- package/dist/utils/ExactDuplicateRemover.js +0 -361
- package/dist/utils/Logger.d.ts +0 -31
- package/dist/utils/Logger.js +0 -214
- package/dist/utils/MemoryBankManager.d.ts +0 -73
- package/dist/utils/MemoryBankManager.js +0 -310
- package/dist/utils/ParallelProcessing.d.ts +0 -140
- package/dist/utils/ParallelProcessing.js +0 -333
- package/dist/utils/ProviderLimits.d.ts +0 -58
- package/dist/utils/ProviderLimits.js +0 -143
- package/dist/utils/RetryManager.d.ts +0 -78
- package/dist/utils/RetryManager.js +0 -205
package/dist/types/index.d.ts
DELETED
|
@@ -1,624 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core TypeScript types for Yama
|
|
3
|
-
* Consolidates all interfaces and types used across the application
|
|
4
|
-
*/
|
|
5
|
-
export interface AIProviderConfig {
|
|
6
|
-
provider?: "auto" | "google-ai" | "openai" | "anthropic" | "azure" | "bedrock";
|
|
7
|
-
model?: string;
|
|
8
|
-
enableFallback?: boolean;
|
|
9
|
-
enableAnalytics?: boolean;
|
|
10
|
-
enableEvaluation?: boolean;
|
|
11
|
-
timeout?: string | number;
|
|
12
|
-
temperature?: number;
|
|
13
|
-
maxTokens?: number;
|
|
14
|
-
retryAttempts?: number;
|
|
15
|
-
}
|
|
16
|
-
export interface AIResponse {
|
|
17
|
-
content: string;
|
|
18
|
-
provider: string;
|
|
19
|
-
model?: string;
|
|
20
|
-
usage?: {
|
|
21
|
-
inputTokens: number;
|
|
22
|
-
outputTokens: number;
|
|
23
|
-
totalTokens: number;
|
|
24
|
-
};
|
|
25
|
-
responseTime?: number;
|
|
26
|
-
analytics?: AnalyticsData;
|
|
27
|
-
evaluation?: EvaluationData;
|
|
28
|
-
}
|
|
29
|
-
export interface AnalyticsData {
|
|
30
|
-
requestId: string;
|
|
31
|
-
timestamp: string;
|
|
32
|
-
provider: string;
|
|
33
|
-
model: string;
|
|
34
|
-
promptTokens: number;
|
|
35
|
-
completionTokens: number;
|
|
36
|
-
totalTokens: number;
|
|
37
|
-
responseTime: number;
|
|
38
|
-
cost?: number;
|
|
39
|
-
}
|
|
40
|
-
export interface EvaluationData {
|
|
41
|
-
overallScore: number;
|
|
42
|
-
qualityMetrics: {
|
|
43
|
-
relevance: number;
|
|
44
|
-
accuracy: number;
|
|
45
|
-
completeness: number;
|
|
46
|
-
clarity: number;
|
|
47
|
-
};
|
|
48
|
-
confidence: number;
|
|
49
|
-
}
|
|
50
|
-
export type GitPlatform = "bitbucket" | "github" | "gitlab" | "azure-devops";
|
|
51
|
-
export interface GitCredentials {
|
|
52
|
-
username: string;
|
|
53
|
-
token: string;
|
|
54
|
-
baseUrl?: string;
|
|
55
|
-
}
|
|
56
|
-
export interface GitProviderConfig {
|
|
57
|
-
platform: GitPlatform;
|
|
58
|
-
credentials: GitCredentials;
|
|
59
|
-
defaultWorkspace?: string;
|
|
60
|
-
}
|
|
61
|
-
export interface PRIdentifier {
|
|
62
|
-
workspace: string;
|
|
63
|
-
repository: string;
|
|
64
|
-
branch?: string;
|
|
65
|
-
pullRequestId?: number | string;
|
|
66
|
-
}
|
|
67
|
-
export interface PRInfo {
|
|
68
|
-
id: number | string;
|
|
69
|
-
title: string;
|
|
70
|
-
description: string;
|
|
71
|
-
author: string;
|
|
72
|
-
state: "OPEN" | "MERGED" | "DECLINED" | "CLOSED";
|
|
73
|
-
sourceRef: string;
|
|
74
|
-
targetRef: string;
|
|
75
|
-
createdDate: string;
|
|
76
|
-
updatedDate: string;
|
|
77
|
-
reviewers?: PRReviewer[];
|
|
78
|
-
comments?: PRComment[];
|
|
79
|
-
fileChanges?: string[];
|
|
80
|
-
}
|
|
81
|
-
export interface PRReviewer {
|
|
82
|
-
user: {
|
|
83
|
-
name: string;
|
|
84
|
-
emailAddress: string;
|
|
85
|
-
displayName: string;
|
|
86
|
-
};
|
|
87
|
-
approved: boolean;
|
|
88
|
-
status: "APPROVED" | "UNAPPROVED" | "NEEDS_WORK";
|
|
89
|
-
}
|
|
90
|
-
export interface PRComment {
|
|
91
|
-
id: number;
|
|
92
|
-
text: string;
|
|
93
|
-
author: {
|
|
94
|
-
name: string;
|
|
95
|
-
displayName: string;
|
|
96
|
-
};
|
|
97
|
-
createdDate: string;
|
|
98
|
-
updatedDate: string;
|
|
99
|
-
anchor?: {
|
|
100
|
-
filePath: string;
|
|
101
|
-
lineFrom: number;
|
|
102
|
-
lineTo: number;
|
|
103
|
-
lineType: "ADDED" | "REMOVED" | "CONTEXT";
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
export interface PRDiff {
|
|
107
|
-
diff: string;
|
|
108
|
-
fileChanges: FileChange[];
|
|
109
|
-
totalAdditions: number;
|
|
110
|
-
totalDeletions: number;
|
|
111
|
-
}
|
|
112
|
-
export interface FileChange {
|
|
113
|
-
path: string;
|
|
114
|
-
changeType: "ADDED" | "MODIFIED" | "DELETED" | "RENAMED";
|
|
115
|
-
additions: number;
|
|
116
|
-
deletions: number;
|
|
117
|
-
hunks: DiffHunk[];
|
|
118
|
-
}
|
|
119
|
-
export interface DiffHunk {
|
|
120
|
-
oldStart: number;
|
|
121
|
-
oldLines: number;
|
|
122
|
-
newStart: number;
|
|
123
|
-
newLines: number;
|
|
124
|
-
lines: DiffLine[];
|
|
125
|
-
}
|
|
126
|
-
export interface DiffLine {
|
|
127
|
-
type: "added" | "removed" | "context";
|
|
128
|
-
content: string;
|
|
129
|
-
oldLineNumber?: number;
|
|
130
|
-
newLineNumber?: number;
|
|
131
|
-
}
|
|
132
|
-
export type ViolationSeverity = "CRITICAL" | "MAJOR" | "MINOR" | "SUGGESTION";
|
|
133
|
-
export type ViolationType = "inline" | "general";
|
|
134
|
-
export type ViolationCategory = "security" | "performance" | "maintainability" | "functionality" | "error_handling" | "testing" | "general";
|
|
135
|
-
export interface Violation {
|
|
136
|
-
type: ViolationType;
|
|
137
|
-
file?: string;
|
|
138
|
-
code_snippet?: string;
|
|
139
|
-
search_context?: {
|
|
140
|
-
before: string[];
|
|
141
|
-
after: string[];
|
|
142
|
-
};
|
|
143
|
-
line_type?: "ADDED" | "REMOVED" | "CONTEXT";
|
|
144
|
-
severity: ViolationSeverity;
|
|
145
|
-
category: ViolationCategory;
|
|
146
|
-
issue: string;
|
|
147
|
-
message: string;
|
|
148
|
-
impact: string;
|
|
149
|
-
suggestion?: string;
|
|
150
|
-
}
|
|
151
|
-
export interface ReviewResult {
|
|
152
|
-
violations: Violation[];
|
|
153
|
-
summary: string;
|
|
154
|
-
improvementsSinceLast?: string;
|
|
155
|
-
positiveObservations: string[];
|
|
156
|
-
statistics: ReviewStatistics;
|
|
157
|
-
}
|
|
158
|
-
export interface ReviewStatistics {
|
|
159
|
-
filesReviewed: number;
|
|
160
|
-
totalIssues: number;
|
|
161
|
-
criticalCount: number;
|
|
162
|
-
majorCount: number;
|
|
163
|
-
minorCount: number;
|
|
164
|
-
suggestionCount: number;
|
|
165
|
-
batchCount?: number;
|
|
166
|
-
processingStrategy?: "single-request" | "batch-processing" | "multi-instance";
|
|
167
|
-
averageBatchSize?: number;
|
|
168
|
-
totalProcessingTime?: number;
|
|
169
|
-
}
|
|
170
|
-
export interface FileBatch {
|
|
171
|
-
files: string[];
|
|
172
|
-
priority: "high" | "medium" | "low";
|
|
173
|
-
estimatedTokens: number;
|
|
174
|
-
batchIndex: number;
|
|
175
|
-
}
|
|
176
|
-
export interface BatchResult {
|
|
177
|
-
batchIndex: number;
|
|
178
|
-
files: string[];
|
|
179
|
-
violations: Violation[];
|
|
180
|
-
processingTime: number;
|
|
181
|
-
tokenUsage?: {
|
|
182
|
-
input: number;
|
|
183
|
-
output: number;
|
|
184
|
-
total: number;
|
|
185
|
-
};
|
|
186
|
-
error?: string;
|
|
187
|
-
}
|
|
188
|
-
export type FilePriority = "high" | "medium" | "low";
|
|
189
|
-
export interface PrioritizedFile {
|
|
190
|
-
path: string;
|
|
191
|
-
priority: FilePriority;
|
|
192
|
-
estimatedTokens: number;
|
|
193
|
-
diff?: string;
|
|
194
|
-
}
|
|
195
|
-
export interface ReviewOptions {
|
|
196
|
-
workspace: string;
|
|
197
|
-
repository: string;
|
|
198
|
-
branch?: string;
|
|
199
|
-
pullRequestId?: number | string;
|
|
200
|
-
dryRun?: boolean;
|
|
201
|
-
verbose?: boolean;
|
|
202
|
-
excludePatterns?: string[];
|
|
203
|
-
customRules?: string;
|
|
204
|
-
contextLines?: number;
|
|
205
|
-
}
|
|
206
|
-
export interface RequiredSection {
|
|
207
|
-
key: string;
|
|
208
|
-
name: string;
|
|
209
|
-
required: boolean;
|
|
210
|
-
present?: boolean;
|
|
211
|
-
content?: string;
|
|
212
|
-
}
|
|
213
|
-
export interface PreservableContent {
|
|
214
|
-
media: string[];
|
|
215
|
-
files: string[];
|
|
216
|
-
links: string[];
|
|
217
|
-
originalText: string;
|
|
218
|
-
}
|
|
219
|
-
export interface SectionAnalysis {
|
|
220
|
-
requiredSections: RequiredSection[];
|
|
221
|
-
missingCount: number;
|
|
222
|
-
preservedContent: PreservableContent;
|
|
223
|
-
gaps: string[];
|
|
224
|
-
}
|
|
225
|
-
export interface EnhancementOptions {
|
|
226
|
-
workspace: string;
|
|
227
|
-
repository: string;
|
|
228
|
-
branch?: string;
|
|
229
|
-
pullRequestId?: number | string;
|
|
230
|
-
dryRun?: boolean;
|
|
231
|
-
verbose?: boolean;
|
|
232
|
-
preserveContent?: boolean;
|
|
233
|
-
ensureRequiredSections?: boolean;
|
|
234
|
-
customSections?: RequiredSection[];
|
|
235
|
-
}
|
|
236
|
-
export interface EnhancementResult {
|
|
237
|
-
originalDescription: string;
|
|
238
|
-
enhancedDescription: string;
|
|
239
|
-
sectionsAdded: string[];
|
|
240
|
-
sectionsEnhanced: string[];
|
|
241
|
-
preservedItems: {
|
|
242
|
-
media: number;
|
|
243
|
-
files: number;
|
|
244
|
-
links: number;
|
|
245
|
-
};
|
|
246
|
-
statistics: {
|
|
247
|
-
originalLength: number;
|
|
248
|
-
enhancedLength: number;
|
|
249
|
-
completedSections: number;
|
|
250
|
-
totalSections: number;
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
export interface DisplayConfig {
|
|
254
|
-
showBanner: boolean;
|
|
255
|
-
}
|
|
256
|
-
export interface GuardianConfig {
|
|
257
|
-
display?: DisplayConfig;
|
|
258
|
-
providers: {
|
|
259
|
-
ai: AIProviderConfig;
|
|
260
|
-
git: GitProviderConfig;
|
|
261
|
-
};
|
|
262
|
-
features: {
|
|
263
|
-
codeReview: CodeReviewConfig;
|
|
264
|
-
descriptionEnhancement: DescriptionEnhancementConfig;
|
|
265
|
-
diffStrategy?: DiffStrategyConfig;
|
|
266
|
-
securityScan?: SecurityScanConfig;
|
|
267
|
-
analytics?: AnalyticsConfig;
|
|
268
|
-
};
|
|
269
|
-
memoryBank?: MemoryBankConfig;
|
|
270
|
-
cache?: CacheConfig;
|
|
271
|
-
performance?: PerformanceConfig;
|
|
272
|
-
rules?: CustomRulesConfig;
|
|
273
|
-
reporting?: ReportingConfig;
|
|
274
|
-
monitoring?: MonitoringConfig;
|
|
275
|
-
}
|
|
276
|
-
export interface CodeReviewConfig {
|
|
277
|
-
enabled: boolean;
|
|
278
|
-
severityLevels: ViolationSeverity[];
|
|
279
|
-
categories: ViolationCategory[];
|
|
280
|
-
excludePatterns: string[];
|
|
281
|
-
contextLines: number;
|
|
282
|
-
customRules?: string;
|
|
283
|
-
systemPrompt?: string;
|
|
284
|
-
analysisTemplate?: string;
|
|
285
|
-
focusAreas?: string[];
|
|
286
|
-
postSummaryComment?: boolean;
|
|
287
|
-
batchProcessing?: BatchProcessingConfig;
|
|
288
|
-
multiInstance?: MultiInstanceConfig;
|
|
289
|
-
semanticDeduplication?: SemanticDeduplicationConfig;
|
|
290
|
-
}
|
|
291
|
-
export interface SemanticDeduplicationConfig {
|
|
292
|
-
enabled: boolean;
|
|
293
|
-
similarityThreshold: number;
|
|
294
|
-
batchSize: number;
|
|
295
|
-
timeout: string;
|
|
296
|
-
fallbackOnError: boolean;
|
|
297
|
-
logMatches: boolean;
|
|
298
|
-
}
|
|
299
|
-
export interface BatchProcessingConfig {
|
|
300
|
-
enabled: boolean;
|
|
301
|
-
maxFilesPerBatch: number;
|
|
302
|
-
prioritizeSecurityFiles: boolean;
|
|
303
|
-
parallelBatches: boolean;
|
|
304
|
-
batchDelayMs: number;
|
|
305
|
-
singleRequestThreshold: number;
|
|
306
|
-
parallel?: {
|
|
307
|
-
enabled: boolean;
|
|
308
|
-
maxConcurrentBatches: number;
|
|
309
|
-
rateLimitStrategy: "fixed" | "adaptive";
|
|
310
|
-
tokenBudgetDistribution: "equal" | "weighted";
|
|
311
|
-
failureHandling: "stop-all" | "continue";
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
export interface MultiInstanceConfig {
|
|
315
|
-
enabled: boolean;
|
|
316
|
-
instanceCount: number;
|
|
317
|
-
instances: InstanceConfig[];
|
|
318
|
-
deduplication: DeduplicationConfig;
|
|
319
|
-
}
|
|
320
|
-
export interface InstanceConfig {
|
|
321
|
-
name: string;
|
|
322
|
-
provider: string;
|
|
323
|
-
model?: string;
|
|
324
|
-
temperature?: number;
|
|
325
|
-
maxTokens?: number;
|
|
326
|
-
weight?: number;
|
|
327
|
-
timeout?: string;
|
|
328
|
-
}
|
|
329
|
-
export interface DeduplicationConfig {
|
|
330
|
-
enabled: boolean;
|
|
331
|
-
similarityThreshold: number;
|
|
332
|
-
aiProvider?: string;
|
|
333
|
-
maxCommentsToPost: number;
|
|
334
|
-
prioritizeBy: "severity" | "similarity" | "confidence";
|
|
335
|
-
}
|
|
336
|
-
export interface InstanceResult {
|
|
337
|
-
instanceName: string;
|
|
338
|
-
violations: Violation[];
|
|
339
|
-
processingTime: number;
|
|
340
|
-
tokenUsage?: {
|
|
341
|
-
input: number;
|
|
342
|
-
output: number;
|
|
343
|
-
total: number;
|
|
344
|
-
};
|
|
345
|
-
error?: string;
|
|
346
|
-
success: boolean;
|
|
347
|
-
}
|
|
348
|
-
export interface DeduplicationResult {
|
|
349
|
-
uniqueViolations: Violation[];
|
|
350
|
-
duplicatesRemoved: {
|
|
351
|
-
exactDuplicates: number;
|
|
352
|
-
normalizedDuplicates: number;
|
|
353
|
-
sameLineDuplicates: number;
|
|
354
|
-
semanticDuplicates?: number;
|
|
355
|
-
};
|
|
356
|
-
instanceContributions: Map<string, number>;
|
|
357
|
-
processingMetrics: DeduplicationMetrics;
|
|
358
|
-
}
|
|
359
|
-
export interface DeduplicationMetrics {
|
|
360
|
-
totalViolationsInput: number;
|
|
361
|
-
exactDuplicatesRemoved: number;
|
|
362
|
-
normalizedDuplicatesRemoved: number;
|
|
363
|
-
sameLineDuplicatesRemoved: number;
|
|
364
|
-
semanticDuplicatesRemoved?: number;
|
|
365
|
-
finalUniqueViolations: number;
|
|
366
|
-
deduplicationRate: number;
|
|
367
|
-
instanceContributions: Record<string, number>;
|
|
368
|
-
processingTimeMs: number;
|
|
369
|
-
}
|
|
370
|
-
export interface CommentDeduplicationResult {
|
|
371
|
-
uniqueViolations: Violation[];
|
|
372
|
-
duplicatesRemoved: number;
|
|
373
|
-
semanticMatches: Array<{
|
|
374
|
-
violation: string;
|
|
375
|
-
comment: string;
|
|
376
|
-
similarityScore: number;
|
|
377
|
-
reasoning?: string;
|
|
378
|
-
}>;
|
|
379
|
-
}
|
|
380
|
-
export interface MultiInstanceResult {
|
|
381
|
-
instances: InstanceResult[];
|
|
382
|
-
deduplication: DeduplicationResult;
|
|
383
|
-
finalViolations: Violation[];
|
|
384
|
-
summary: {
|
|
385
|
-
totalInstances: number;
|
|
386
|
-
successfulInstances: number;
|
|
387
|
-
failedInstances: number;
|
|
388
|
-
totalViolationsFound: number;
|
|
389
|
-
uniqueViolationsAfterDedup: number;
|
|
390
|
-
deduplicationRate: number;
|
|
391
|
-
totalProcessingTime: number;
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
export interface DescriptionEnhancementConfig {
|
|
395
|
-
enabled: boolean;
|
|
396
|
-
preserveContent: boolean;
|
|
397
|
-
requiredSections: RequiredSection[];
|
|
398
|
-
autoFormat: boolean;
|
|
399
|
-
systemPrompt?: string;
|
|
400
|
-
outputTemplate?: string;
|
|
401
|
-
enhancementInstructions?: string;
|
|
402
|
-
}
|
|
403
|
-
export interface DiffStrategyConfig {
|
|
404
|
-
enabled: boolean;
|
|
405
|
-
thresholds: {
|
|
406
|
-
wholeDiffMaxFiles: number;
|
|
407
|
-
fileByFileMinFiles: number;
|
|
408
|
-
};
|
|
409
|
-
forceStrategy?: "whole" | "file-by-file" | "auto";
|
|
410
|
-
}
|
|
411
|
-
export interface SecurityScanConfig {
|
|
412
|
-
enabled: boolean;
|
|
413
|
-
level: "strict" | "moderate" | "basic";
|
|
414
|
-
scanTypes: string[];
|
|
415
|
-
}
|
|
416
|
-
export interface AnalyticsConfig {
|
|
417
|
-
enabled: boolean;
|
|
418
|
-
trackMetrics: boolean;
|
|
419
|
-
exportFormat: "json" | "csv" | "yaml";
|
|
420
|
-
}
|
|
421
|
-
export interface MemoryBankConfig {
|
|
422
|
-
enabled: boolean;
|
|
423
|
-
path: string;
|
|
424
|
-
fallbackPaths?: string[];
|
|
425
|
-
}
|
|
426
|
-
export interface CacheConfig {
|
|
427
|
-
enabled: boolean;
|
|
428
|
-
ttl: string;
|
|
429
|
-
maxSize: string;
|
|
430
|
-
storage: "memory" | "redis" | "file";
|
|
431
|
-
}
|
|
432
|
-
export interface PerformanceConfig {
|
|
433
|
-
batch: {
|
|
434
|
-
enabled: boolean;
|
|
435
|
-
maxConcurrent: number;
|
|
436
|
-
delayBetween: string;
|
|
437
|
-
};
|
|
438
|
-
optimization: {
|
|
439
|
-
reuseConnections: boolean;
|
|
440
|
-
compressRequests: boolean;
|
|
441
|
-
enableHttp2: boolean;
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
export interface CustomRulesConfig {
|
|
445
|
-
[category: string]: CustomRule[];
|
|
446
|
-
}
|
|
447
|
-
export interface CustomRule {
|
|
448
|
-
name: string;
|
|
449
|
-
pattern: string;
|
|
450
|
-
severity: ViolationSeverity;
|
|
451
|
-
message?: string;
|
|
452
|
-
suggestion?: string;
|
|
453
|
-
}
|
|
454
|
-
export interface ReportingConfig {
|
|
455
|
-
formats: string[];
|
|
456
|
-
includeAnalytics: boolean;
|
|
457
|
-
includeMetrics: boolean;
|
|
458
|
-
customTemplates?: string;
|
|
459
|
-
}
|
|
460
|
-
export interface MonitoringConfig {
|
|
461
|
-
enabled: boolean;
|
|
462
|
-
metrics: string[];
|
|
463
|
-
exportFormat?: "json" | "prometheus" | "csv";
|
|
464
|
-
endpoint?: string;
|
|
465
|
-
interval?: string;
|
|
466
|
-
}
|
|
467
|
-
export type OperationType = "review" | "enhance-description" | "security-scan" | "analytics" | "all";
|
|
468
|
-
export interface OperationOptions {
|
|
469
|
-
workspace: string;
|
|
470
|
-
repository: string;
|
|
471
|
-
branch?: string;
|
|
472
|
-
pullRequestId?: number | string;
|
|
473
|
-
operations: OperationType[];
|
|
474
|
-
dryRun?: boolean;
|
|
475
|
-
verbose?: boolean;
|
|
476
|
-
config?: Partial<GuardianConfig>;
|
|
477
|
-
}
|
|
478
|
-
export interface OperationResult {
|
|
479
|
-
operation: OperationType;
|
|
480
|
-
status: "success" | "error" | "skipped";
|
|
481
|
-
data?: any;
|
|
482
|
-
error?: string;
|
|
483
|
-
duration: number;
|
|
484
|
-
timestamp: string;
|
|
485
|
-
}
|
|
486
|
-
export interface ProcessResult {
|
|
487
|
-
pullRequest: PRInfo;
|
|
488
|
-
operations: OperationResult[];
|
|
489
|
-
summary: {
|
|
490
|
-
totalOperations: number;
|
|
491
|
-
successCount: number;
|
|
492
|
-
errorCount: number;
|
|
493
|
-
skippedCount: number;
|
|
494
|
-
totalDuration: number;
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
export interface StreamUpdate {
|
|
498
|
-
operation: OperationType;
|
|
499
|
-
status: "started" | "progress" | "completed" | "error";
|
|
500
|
-
progress?: number;
|
|
501
|
-
message?: string;
|
|
502
|
-
data?: any;
|
|
503
|
-
timestamp: string;
|
|
504
|
-
}
|
|
505
|
-
export interface StreamOptions {
|
|
506
|
-
onUpdate?: (update: StreamUpdate) => void;
|
|
507
|
-
onError?: (error: Error) => void;
|
|
508
|
-
onComplete?: (result: ProcessResult) => void;
|
|
509
|
-
}
|
|
510
|
-
export type LogLevel = "debug" | "info" | "warn" | "error";
|
|
511
|
-
export interface LoggerOptions {
|
|
512
|
-
level: LogLevel;
|
|
513
|
-
verbose: boolean;
|
|
514
|
-
format: "simple" | "json" | "detailed";
|
|
515
|
-
colors: boolean;
|
|
516
|
-
}
|
|
517
|
-
export interface Logger {
|
|
518
|
-
debug(message: string, ...args: any[]): void;
|
|
519
|
-
info(message: string, ...args: any[]): void;
|
|
520
|
-
warn(message: string, ...args: any[]): void;
|
|
521
|
-
error(message: string, ...args: any[]): void;
|
|
522
|
-
badge(): void;
|
|
523
|
-
phase(message: string): void;
|
|
524
|
-
success(message: string): void;
|
|
525
|
-
}
|
|
526
|
-
export interface CacheEntry<T = any> {
|
|
527
|
-
key: string;
|
|
528
|
-
value: T;
|
|
529
|
-
ttl: number;
|
|
530
|
-
createdAt: number;
|
|
531
|
-
}
|
|
532
|
-
export interface CacheOptions {
|
|
533
|
-
ttl?: number;
|
|
534
|
-
maxSize?: number;
|
|
535
|
-
checkPeriod?: number;
|
|
536
|
-
}
|
|
537
|
-
export interface Cache {
|
|
538
|
-
get<T>(key: string): T | undefined;
|
|
539
|
-
set<T>(key: string, value: T, ttl?: number): boolean;
|
|
540
|
-
del(key: string): number;
|
|
541
|
-
has(key: string): boolean;
|
|
542
|
-
clear(): void;
|
|
543
|
-
keys(): string[];
|
|
544
|
-
stats(): {
|
|
545
|
-
hits: number;
|
|
546
|
-
misses: number;
|
|
547
|
-
keys: number;
|
|
548
|
-
size: number;
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
export interface ParallelProcessingMetrics {
|
|
552
|
-
totalBatches: number;
|
|
553
|
-
concurrentBatches: number;
|
|
554
|
-
parallelSpeedup: number;
|
|
555
|
-
tokenEfficiency: number;
|
|
556
|
-
failedBatches: number;
|
|
557
|
-
averageBatchTime: number;
|
|
558
|
-
totalProcessingTime: number;
|
|
559
|
-
serialProcessingTime?: number;
|
|
560
|
-
}
|
|
561
|
-
export interface SemaphoreInterface {
|
|
562
|
-
acquire(): Promise<void>;
|
|
563
|
-
release(): void;
|
|
564
|
-
getAvailablePermits(): number;
|
|
565
|
-
}
|
|
566
|
-
export interface TokenBudgetManagerInterface {
|
|
567
|
-
allocateForBatch(batchIndex: number, estimatedTokens: number): boolean;
|
|
568
|
-
releaseBatch(batchIndex: number): void;
|
|
569
|
-
getAvailableBudget(): number;
|
|
570
|
-
getTotalBudget(): number;
|
|
571
|
-
getUsedTokens(): number;
|
|
572
|
-
preAllocateAllBatches(allocations: Map<number, number>): boolean;
|
|
573
|
-
}
|
|
574
|
-
export declare class GuardianError extends Error {
|
|
575
|
-
code: string;
|
|
576
|
-
context?: any | undefined;
|
|
577
|
-
constructor(code: string, message: string, context?: any | undefined);
|
|
578
|
-
}
|
|
579
|
-
export declare class ConfigurationError extends GuardianError {
|
|
580
|
-
constructor(message: string, context?: any);
|
|
581
|
-
}
|
|
582
|
-
export declare class ProviderError extends GuardianError {
|
|
583
|
-
constructor(message: string, context?: any);
|
|
584
|
-
}
|
|
585
|
-
export declare class ValidationError extends GuardianError {
|
|
586
|
-
constructor(message: string, context?: any);
|
|
587
|
-
}
|
|
588
|
-
export declare enum CacheErrorCode {
|
|
589
|
-
CACHE_SYSTEM_FAILURE = "CACHE_SYSTEM_FAILURE",
|
|
590
|
-
CACHE_MEMORY_EXHAUSTED = "CACHE_MEMORY_EXHAUSTED",
|
|
591
|
-
CACHE_INITIALIZATION_FAILED = "CACHE_INITIALIZATION_FAILED",
|
|
592
|
-
CACHE_STORAGE_FULL = "CACHE_STORAGE_FULL",
|
|
593
|
-
CACHE_STORAGE_PERMISSION = "CACHE_STORAGE_PERMISSION",
|
|
594
|
-
CACHE_STORAGE_CORRUPTION = "CACHE_STORAGE_CORRUPTION",
|
|
595
|
-
CACHE_NETWORK_CONNECTION = "CACHE_NETWORK_CONNECTION",
|
|
596
|
-
CACHE_NETWORK_TIMEOUT = "CACHE_NETWORK_TIMEOUT",
|
|
597
|
-
CACHE_NETWORK_AUTH = "CACHE_NETWORK_AUTH",
|
|
598
|
-
CACHE_CONFIG_INVALID = "CACHE_CONFIG_INVALID",
|
|
599
|
-
CACHE_CONFIG_MISSING = "CACHE_CONFIG_MISSING",
|
|
600
|
-
CACHE_OPERATION_FAILED = "CACHE_OPERATION_FAILED",
|
|
601
|
-
CACHE_SERIALIZATION_ERROR = "CACHE_SERIALIZATION_ERROR",
|
|
602
|
-
CACHE_KEY_INVALID = "CACHE_KEY_INVALID"
|
|
603
|
-
}
|
|
604
|
-
export declare abstract class CacheError extends GuardianError {
|
|
605
|
-
operation?: string | undefined;
|
|
606
|
-
key?: string | undefined;
|
|
607
|
-
constructor(code: CacheErrorCode, message: string, operation?: string | undefined, key?: string | undefined, context?: any);
|
|
608
|
-
}
|
|
609
|
-
export declare class CacheSystemError extends CacheError {
|
|
610
|
-
constructor(message: string, operation?: string, key?: string, context?: any);
|
|
611
|
-
}
|
|
612
|
-
export declare class CacheStorageError extends CacheError {
|
|
613
|
-
constructor(code: CacheErrorCode | undefined, message: string, operation?: string, key?: string, context?: any);
|
|
614
|
-
}
|
|
615
|
-
export declare class CacheNetworkError extends CacheError {
|
|
616
|
-
constructor(code: CacheErrorCode | undefined, message: string, operation?: string, key?: string, context?: any);
|
|
617
|
-
}
|
|
618
|
-
export declare class CacheConfigurationError extends CacheError {
|
|
619
|
-
constructor(code: CacheErrorCode | undefined, message: string, operation?: string, key?: string, context?: any);
|
|
620
|
-
}
|
|
621
|
-
export declare class CacheOperationError extends CacheError {
|
|
622
|
-
constructor(code: CacheErrorCode | undefined, message: string, operation?: string, key?: string, context?: any);
|
|
623
|
-
}
|
|
624
|
-
//# sourceMappingURL=index.d.ts.map
|