driftdetect 0.9.34 → 0.9.35
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/dist/bin/drift.d.ts +11 -0
- package/dist/commands/approve.d.ts +28 -0
- package/dist/commands/audit.d.ts +29 -0
- package/dist/commands/boundaries.d.ts +20 -0
- package/dist/commands/callgraph.d.ts +24 -0
- package/dist/commands/check.d.ts +41 -0
- package/dist/commands/constants.d.ts +35 -0
- package/dist/commands/constraints.d.ts +17 -0
- package/dist/commands/context.d.ts +19 -0
- package/dist/commands/coupling.d.ts +17 -0
- package/dist/commands/cpp.d.ts +22 -0
- package/dist/commands/dashboard.d.ts +16 -0
- package/dist/commands/decisions.d.ts +19 -0
- package/dist/commands/dna/export.d.ts +6 -0
- package/dist/commands/dna/gene.d.ts +6 -0
- package/dist/commands/dna/index.d.ts +8 -0
- package/dist/commands/dna/mutations.d.ts +6 -0
- package/dist/commands/dna/playbook.d.ts +6 -0
- package/dist/commands/dna/scan.d.ts +6 -0
- package/dist/commands/dna/status.d.ts +6 -0
- package/dist/commands/env.d.ts +23 -0
- package/dist/commands/error-handling.d.ts +15 -0
- package/dist/commands/export.d.ts +16 -0
- package/dist/commands/files.d.ts +15 -0
- package/dist/commands/gate.d.ts +33 -0
- package/dist/commands/go.d.ts +21 -0
- package/dist/commands/ignore.d.ts +20 -0
- package/dist/commands/index.d.ts +50 -0
- package/dist/commands/index.js +68 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +19 -0
- package/dist/commands/java.d.ts +15 -0
- package/dist/commands/license.d.ts +12 -0
- package/dist/commands/migrate-storage.d.ts +23 -0
- package/dist/commands/next-steps.d.ts +15 -0
- package/dist/commands/parser.d.ts +20 -0
- package/dist/commands/php.d.ts +15 -0
- package/dist/commands/projects.d.ts +17 -0
- package/dist/commands/py.d.ts +15 -0
- package/dist/commands/report.d.ts +22 -0
- package/dist/commands/rust.d.ts +21 -0
- package/dist/commands/scan.d.ts +45 -0
- package/dist/commands/simulate.d.ts +17 -0
- package/dist/commands/skills.d.ts +16 -0
- package/dist/commands/status.d.ts +20 -0
- package/dist/commands/telemetry.d.ts +9 -0
- package/dist/commands/test-topology.d.ts +15 -0
- package/dist/commands/trends.d.ts +12 -0
- package/dist/commands/troubleshoot.d.ts +14 -0
- package/dist/commands/ts.d.ts +21 -0
- package/dist/commands/watch.d.ts +13 -0
- package/dist/commands/where.d.ts +15 -0
- package/dist/commands/wpf.d.ts +21 -0
- package/dist/commands/wrappers.d.ts +16 -0
- package/dist/git/hooks.d.ts +108 -0
- package/dist/git/index.d.ts +6 -0
- package/dist/git/index.d.ts.map +1 -0
- package/dist/git/index.js +6 -0
- package/dist/git/index.js.map +1 -0
- package/dist/git/staged-files.d.ts +41 -0
- package/dist/git/staged-files.d.ts.map +1 -0
- package/dist/git/staged-files.js +118 -0
- package/dist/git/staged-files.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/reporters/github-reporter.d.ts +13 -0
- package/dist/reporters/gitlab-reporter.d.ts +16 -0
- package/dist/reporters/index.d.ts +9 -0
- package/dist/reporters/index.js +9 -0
- package/dist/reporters/index.js.map +1 -0
- package/dist/reporters/json-reporter.d.ts +13 -0
- package/dist/reporters/json-reporter.js +44 -0
- package/dist/reporters/json-reporter.js.map +1 -0
- package/dist/reporters/text-reporter.d.ts +13 -0
- package/dist/reporters/types.d.ts +42 -0
- package/dist/reporters/types.js +5 -0
- package/dist/reporters/types.js.map +1 -0
- package/dist/services/boundary-scanner.d.ts +22 -0
- package/dist/services/pattern-service-factory.d.ts +37 -0
- package/dist/services/pattern-service-factory.js +41 -0
- package/dist/services/pattern-service-factory.js.map +1 -0
- package/dist/services/scanner-service.d.ts +237 -0
- package/dist/types/index.d.ts +24 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/index.d.ts +11 -0
- package/dist/ui/index.js +15 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/progress.d.ts +115 -0
- package/dist/ui/prompts.d.ts +91 -0
- package/dist/ui/spinner.d.ts +109 -0
- package/dist/ui/table.d.ts +118 -0
- package/dist/workers/detector-worker.d.ts +125 -0
- package/package.json +1 -1
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scanner Service - Enterprise-grade pattern detection with Worker Threads
|
|
3
|
+
*
|
|
4
|
+
* Uses the real detectors from driftdetect-detectors to find
|
|
5
|
+
* high-value architectural patterns and violations.
|
|
6
|
+
*
|
|
7
|
+
* Now uses Piscina worker threads for parallel CPU-bound processing.
|
|
8
|
+
*/
|
|
9
|
+
import { ManifestStore, type Manifest } from 'driftdetect-core';
|
|
10
|
+
/**
|
|
11
|
+
* Project-wide context for detection
|
|
12
|
+
*/
|
|
13
|
+
export interface ProjectContext {
|
|
14
|
+
rootDir: string;
|
|
15
|
+
files: string[];
|
|
16
|
+
config: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Scanner service configuration
|
|
20
|
+
*/
|
|
21
|
+
export interface ScannerServiceConfig {
|
|
22
|
+
rootDir: string;
|
|
23
|
+
verbose?: boolean;
|
|
24
|
+
categories?: string[];
|
|
25
|
+
/** Only run critical/high-value detectors */
|
|
26
|
+
criticalOnly?: boolean;
|
|
27
|
+
/** Enable manifest generation */
|
|
28
|
+
generateManifest?: boolean;
|
|
29
|
+
/** Only scan changed files (incremental) */
|
|
30
|
+
incremental?: boolean;
|
|
31
|
+
/** Use worker threads for parallel processing */
|
|
32
|
+
useWorkerThreads?: boolean;
|
|
33
|
+
/** Number of worker threads (default: CPU cores - 1) */
|
|
34
|
+
workerThreads?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Aggregated pattern match across files
|
|
38
|
+
*
|
|
39
|
+
* Enhanced to preserve all metadata from detectors including:
|
|
40
|
+
* - Full location range (endLine/endColumn)
|
|
41
|
+
* - Outlier information per location
|
|
42
|
+
* - Matched text for context
|
|
43
|
+
*/
|
|
44
|
+
export interface AggregatedPattern {
|
|
45
|
+
patternId: string;
|
|
46
|
+
detectorId: string;
|
|
47
|
+
category: string;
|
|
48
|
+
subcategory: string;
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
locations: Array<{
|
|
52
|
+
file: string;
|
|
53
|
+
line: number;
|
|
54
|
+
column: number;
|
|
55
|
+
/** End line for full range highlighting */
|
|
56
|
+
endLine?: number;
|
|
57
|
+
/** End column for full range highlighting */
|
|
58
|
+
endColumn?: number;
|
|
59
|
+
/** Whether this specific location is an outlier */
|
|
60
|
+
isOutlier?: boolean;
|
|
61
|
+
/** Reason for outlier classification */
|
|
62
|
+
outlierReason?: string;
|
|
63
|
+
/** The actual text that was matched */
|
|
64
|
+
matchedText?: string;
|
|
65
|
+
/** Per-location confidence score */
|
|
66
|
+
confidence?: number;
|
|
67
|
+
}>;
|
|
68
|
+
confidence: number;
|
|
69
|
+
occurrences: number;
|
|
70
|
+
/** Total number of outliers across all locations */
|
|
71
|
+
outlierCount: number;
|
|
72
|
+
/** Custom metadata from detectors */
|
|
73
|
+
metadata?: Record<string, unknown>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Aggregated violation across files
|
|
77
|
+
*/
|
|
78
|
+
export interface AggregatedViolation {
|
|
79
|
+
patternId: string;
|
|
80
|
+
detectorId: string;
|
|
81
|
+
category: string;
|
|
82
|
+
severity: 'error' | 'warning' | 'info' | 'hint';
|
|
83
|
+
file: string;
|
|
84
|
+
line: number;
|
|
85
|
+
column: number;
|
|
86
|
+
message: string;
|
|
87
|
+
explanation?: string | undefined;
|
|
88
|
+
suggestedFix?: string | undefined;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Scan result for a single file
|
|
92
|
+
*/
|
|
93
|
+
export interface FileScanResult {
|
|
94
|
+
file: string;
|
|
95
|
+
patterns: Array<{
|
|
96
|
+
patternId: string;
|
|
97
|
+
detectorId: string;
|
|
98
|
+
confidence: number;
|
|
99
|
+
location: {
|
|
100
|
+
file: string;
|
|
101
|
+
line: number;
|
|
102
|
+
column: number;
|
|
103
|
+
endLine?: number;
|
|
104
|
+
endColumn?: number;
|
|
105
|
+
};
|
|
106
|
+
isOutlier?: boolean;
|
|
107
|
+
outlierReason?: string;
|
|
108
|
+
matchedText?: string;
|
|
109
|
+
metadata?: Record<string, unknown>;
|
|
110
|
+
}>;
|
|
111
|
+
violations: AggregatedViolation[];
|
|
112
|
+
duration: number;
|
|
113
|
+
error?: string | undefined;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Overall scan results
|
|
117
|
+
*/
|
|
118
|
+
export interface ScanResults {
|
|
119
|
+
files: FileScanResult[];
|
|
120
|
+
patterns: AggregatedPattern[];
|
|
121
|
+
violations: AggregatedViolation[];
|
|
122
|
+
totalPatterns: number;
|
|
123
|
+
totalViolations: number;
|
|
124
|
+
totalFiles: number;
|
|
125
|
+
duration: number;
|
|
126
|
+
errors: string[];
|
|
127
|
+
detectorStats: {
|
|
128
|
+
total: number;
|
|
129
|
+
ran: number;
|
|
130
|
+
skipped: number;
|
|
131
|
+
};
|
|
132
|
+
/** Manifest with semantic locations (if generateManifest is true) */
|
|
133
|
+
manifest?: Manifest | undefined;
|
|
134
|
+
/** Worker thread stats (if useWorkerThreads is true) */
|
|
135
|
+
workerStats?: {
|
|
136
|
+
threadsUsed: number;
|
|
137
|
+
tasksCompleted: number;
|
|
138
|
+
} | undefined;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Scanner Service
|
|
142
|
+
*
|
|
143
|
+
* Orchestrates pattern detection across files using real detectors.
|
|
144
|
+
* Supports both single-threaded and multi-threaded (Piscina) modes.
|
|
145
|
+
*/
|
|
146
|
+
export declare class ScannerService {
|
|
147
|
+
private config;
|
|
148
|
+
private detectors;
|
|
149
|
+
private initialized;
|
|
150
|
+
private manifestStore;
|
|
151
|
+
private pool;
|
|
152
|
+
private PiscinaClass;
|
|
153
|
+
constructor(config: ScannerServiceConfig);
|
|
154
|
+
/**
|
|
155
|
+
* Initialize the scanner service
|
|
156
|
+
*/
|
|
157
|
+
initialize(): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Warm up all worker threads by preloading detectors
|
|
160
|
+
* This runs warmup tasks in parallel so all workers load detectors simultaneously
|
|
161
|
+
*/
|
|
162
|
+
private warmupWorkers;
|
|
163
|
+
/**
|
|
164
|
+
* Get detector count
|
|
165
|
+
*/
|
|
166
|
+
getDetectorCount(): number;
|
|
167
|
+
/**
|
|
168
|
+
* Get detector counts by category
|
|
169
|
+
*/
|
|
170
|
+
getDetectorCounts(): {
|
|
171
|
+
api: number;
|
|
172
|
+
auth: number;
|
|
173
|
+
security: number;
|
|
174
|
+
errors: number;
|
|
175
|
+
structural: number;
|
|
176
|
+
components: number;
|
|
177
|
+
styling: number;
|
|
178
|
+
logging: number;
|
|
179
|
+
testing: number;
|
|
180
|
+
dataAccess: number;
|
|
181
|
+
config: number;
|
|
182
|
+
types: number;
|
|
183
|
+
accessibility: number;
|
|
184
|
+
documentation: number;
|
|
185
|
+
performance: number;
|
|
186
|
+
total: number;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Check if worker threads are enabled and initialized
|
|
190
|
+
*/
|
|
191
|
+
isUsingWorkerThreads(): boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Get worker thread count
|
|
194
|
+
*/
|
|
195
|
+
getWorkerThreadCount(): number;
|
|
196
|
+
/**
|
|
197
|
+
* Scan files for patterns
|
|
198
|
+
*/
|
|
199
|
+
scanFiles(files: string[], projectContext: ProjectContext): Promise<ScanResults>;
|
|
200
|
+
/**
|
|
201
|
+
* Scan files using worker threads (parallel)
|
|
202
|
+
*/
|
|
203
|
+
private scanFilesWithWorkers;
|
|
204
|
+
/**
|
|
205
|
+
* Aggregate results from worker threads
|
|
206
|
+
*/
|
|
207
|
+
private aggregateWorkerResults;
|
|
208
|
+
/**
|
|
209
|
+
* Add pattern match to manifest
|
|
210
|
+
*/
|
|
211
|
+
private addToManifest;
|
|
212
|
+
/**
|
|
213
|
+
* Scan files single-threaded (fallback)
|
|
214
|
+
*/
|
|
215
|
+
private scanFilesSingleThreaded;
|
|
216
|
+
/**
|
|
217
|
+
* Create a semantic location from a basic location
|
|
218
|
+
*/
|
|
219
|
+
private createSemanticLocation;
|
|
220
|
+
/**
|
|
221
|
+
* Extract semantic information from a line of code
|
|
222
|
+
*/
|
|
223
|
+
private extractSemanticInfo;
|
|
224
|
+
/**
|
|
225
|
+
* Get the manifest store
|
|
226
|
+
*/
|
|
227
|
+
getManifestStore(): ManifestStore | null;
|
|
228
|
+
/**
|
|
229
|
+
* Destroy the worker pool
|
|
230
|
+
*/
|
|
231
|
+
destroy(): Promise<void>;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Create a scanner service
|
|
235
|
+
*/
|
|
236
|
+
export declare function createScannerService(config: ScannerServiceConfig): ScannerService;
|
|
237
|
+
//# sourceMappingURL=scanner-service.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI type exports
|
|
3
|
+
*/
|
|
4
|
+
export interface CLIOptions {
|
|
5
|
+
/** Enable verbose output */
|
|
6
|
+
verbose?: boolean;
|
|
7
|
+
/** Output format */
|
|
8
|
+
format?: 'text' | 'json' | 'github' | 'gitlab';
|
|
9
|
+
/** CI mode */
|
|
10
|
+
ci?: boolean;
|
|
11
|
+
/** Check only staged files */
|
|
12
|
+
staged?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface CheckResult {
|
|
15
|
+
/** Number of violations */
|
|
16
|
+
violationCount: number;
|
|
17
|
+
/** Number of errors */
|
|
18
|
+
errorCount: number;
|
|
19
|
+
/** Number of warnings */
|
|
20
|
+
warningCount: number;
|
|
21
|
+
/** Exit code */
|
|
22
|
+
exitCode: number;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC/C,cAAc;IACd,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,8BAA8B;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,2BAA2B;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI module exports
|
|
3
|
+
*
|
|
4
|
+
* Provides CLI UI components for interactive prompts, spinners,
|
|
5
|
+
* tables, and progress bars.
|
|
6
|
+
*/
|
|
7
|
+
export { confirmPrompt, inputPrompt, selectPrompt, multiSelectPrompt, promptPatternAction, promptBatchPatternApproval, promptSeverity, promptVariantReason, promptVariantScope, promptInitOptions, promptIgnoreReason, promptReportFormat, promptCategorySelection, type PatternChoice, type PatternAction, type VariantScope, type InitPromptResult, type ReportFormat, } from './prompts.js';
|
|
8
|
+
export { Spinner, createSpinner, withSpinner, spinners, status, type SpinnerOptions, } from './spinner.js';
|
|
9
|
+
export { createTable, formatSeverity, formatConfidence, formatCount, formatPath, createPatternsTable, createViolationsTable, createSummaryTable, createStatusTable, createCategoryTable, type TableStyle, type TableOptions, type PatternRow, type ViolationRow, type SummaryRow, type StatusSummary, type CategoryBreakdown, } from './table.js';
|
|
10
|
+
export { Progress, MultiProgress, createScanProgress, createAnalysisProgress, createDetectionProgress, withProgress, logProgress, type ProgressOptions, } from './progress.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI module exports
|
|
3
|
+
*
|
|
4
|
+
* Provides CLI UI components for interactive prompts, spinners,
|
|
5
|
+
* tables, and progress bars.
|
|
6
|
+
*/
|
|
7
|
+
// Prompts
|
|
8
|
+
export { confirmPrompt, inputPrompt, selectPrompt, multiSelectPrompt, promptPatternAction, promptBatchPatternApproval, promptSeverity, promptVariantReason, promptVariantScope, promptInitOptions, promptIgnoreReason, promptReportFormat, promptCategorySelection, } from './prompts.js';
|
|
9
|
+
// Spinner
|
|
10
|
+
export { Spinner, createSpinner, withSpinner, spinners, status, } from './spinner.js';
|
|
11
|
+
// Table
|
|
12
|
+
export { createTable, formatSeverity, formatConfidence, formatCount, formatPath, createPatternsTable, createViolationsTable, createSummaryTable, createStatusTable, createCategoryTable, } from './table.js';
|
|
13
|
+
// Progress
|
|
14
|
+
export { Progress, MultiProgress, createScanProgress, createAnalysisProgress, createDetectionProgress, withProgress, logProgress, } from './progress.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,UAAU;AACV,OAAO,EACL,aAAa,EACb,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,GAMxB,MAAM,cAAc,CAAC;AAEtB,UAAU;AACV,OAAO,EACL,OAAO,EACP,aAAa,EACb,WAAW,EACX,QAAQ,EACR,MAAM,GAEP,MAAM,cAAc,CAAC;AAEtB,QAAQ;AACR,OAAO,EACL,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GAQpB,MAAM,YAAY,CAAC;AAEpB,WAAW;AACX,OAAO,EACL,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,WAAW,GAEZ,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress - Progress bars for scanning
|
|
3
|
+
*
|
|
4
|
+
* Provides progress bars for long-running operations like scanning.
|
|
5
|
+
*
|
|
6
|
+
* @requirements 29.1
|
|
7
|
+
*/
|
|
8
|
+
import { SingleBar } from 'cli-progress';
|
|
9
|
+
/**
|
|
10
|
+
* Progress bar configuration options
|
|
11
|
+
*/
|
|
12
|
+
export interface ProgressOptions {
|
|
13
|
+
/** Total number of items */
|
|
14
|
+
total: number;
|
|
15
|
+
/** Format string for the progress bar */
|
|
16
|
+
format?: string;
|
|
17
|
+
/** Whether to show ETA */
|
|
18
|
+
showEta?: boolean;
|
|
19
|
+
/** Whether to show percentage */
|
|
20
|
+
showPercentage?: boolean;
|
|
21
|
+
/** Whether to show value/total */
|
|
22
|
+
showValue?: boolean;
|
|
23
|
+
/** Whether progress is enabled (false in CI mode) */
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
/** Clear the bar on complete */
|
|
26
|
+
clearOnComplete?: boolean;
|
|
27
|
+
/** Hide cursor during progress */
|
|
28
|
+
hideCursor?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Progress bar wrapper for consistent CLI feedback
|
|
32
|
+
*/
|
|
33
|
+
export declare class Progress {
|
|
34
|
+
private bar;
|
|
35
|
+
private enabled;
|
|
36
|
+
private currentValue;
|
|
37
|
+
constructor(options: ProgressOptions);
|
|
38
|
+
/**
|
|
39
|
+
* Update progress with current value
|
|
40
|
+
*/
|
|
41
|
+
update(value: number, payload?: Record<string, string | number>): this;
|
|
42
|
+
/**
|
|
43
|
+
* Increment progress by amount
|
|
44
|
+
*/
|
|
45
|
+
increment(amount?: number, payload?: Record<string, string | number>): this;
|
|
46
|
+
/**
|
|
47
|
+
* Set the current task description
|
|
48
|
+
*/
|
|
49
|
+
task(description: string): this;
|
|
50
|
+
/**
|
|
51
|
+
* Set the total value
|
|
52
|
+
*/
|
|
53
|
+
setTotal(total: number): this;
|
|
54
|
+
/**
|
|
55
|
+
* Stop the progress bar
|
|
56
|
+
*/
|
|
57
|
+
stop(): this;
|
|
58
|
+
/**
|
|
59
|
+
* Get current value
|
|
60
|
+
*/
|
|
61
|
+
get value(): number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Multi-progress bar for parallel operations
|
|
65
|
+
*/
|
|
66
|
+
export declare class MultiProgress {
|
|
67
|
+
private multiBar;
|
|
68
|
+
private bars;
|
|
69
|
+
private enabled;
|
|
70
|
+
constructor(enabled?: boolean);
|
|
71
|
+
/**
|
|
72
|
+
* Create a new progress bar
|
|
73
|
+
*/
|
|
74
|
+
create(name: string, total: number): SingleBar | null;
|
|
75
|
+
/**
|
|
76
|
+
* Update a specific bar
|
|
77
|
+
*/
|
|
78
|
+
update(name: string, value: number, payload?: Record<string, string | number>): this;
|
|
79
|
+
/**
|
|
80
|
+
* Increment a specific bar
|
|
81
|
+
*/
|
|
82
|
+
increment(name: string, amount?: number, payload?: Record<string, string | number>): this;
|
|
83
|
+
/**
|
|
84
|
+
* Remove a specific bar
|
|
85
|
+
*/
|
|
86
|
+
remove(name: string): this;
|
|
87
|
+
/**
|
|
88
|
+
* Stop all progress bars
|
|
89
|
+
*/
|
|
90
|
+
stop(): this;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Create a progress bar for scanning operations
|
|
94
|
+
*/
|
|
95
|
+
export declare function createScanProgress(totalFiles: number): Progress;
|
|
96
|
+
/**
|
|
97
|
+
* Create a progress bar for analysis operations
|
|
98
|
+
*/
|
|
99
|
+
export declare function createAnalysisProgress(totalItems: number): Progress;
|
|
100
|
+
/**
|
|
101
|
+
* Create a progress bar for pattern detection
|
|
102
|
+
*/
|
|
103
|
+
export declare function createDetectionProgress(totalDetectors: number): Progress;
|
|
104
|
+
/**
|
|
105
|
+
* Run an operation with progress tracking
|
|
106
|
+
*/
|
|
107
|
+
export declare function withProgress<T>(items: T[], operation: (item: T, index: number) => Promise<void>, options?: {
|
|
108
|
+
format?: string;
|
|
109
|
+
getTaskName?: (item: T) => string;
|
|
110
|
+
}): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Simple percentage display for CI mode
|
|
113
|
+
*/
|
|
114
|
+
export declare function logProgress(current: number, total: number, message?: string): void;
|
|
115
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompts - Interactive prompts with Inquirer
|
|
3
|
+
*
|
|
4
|
+
* Provides interactive prompts for user input during CLI operations.
|
|
5
|
+
*
|
|
6
|
+
* @requirements 29.8
|
|
7
|
+
*/
|
|
8
|
+
import type { Severity } from 'driftdetect-core';
|
|
9
|
+
/**
|
|
10
|
+
* Pattern approval choice
|
|
11
|
+
*/
|
|
12
|
+
export interface PatternChoice {
|
|
13
|
+
/** Pattern ID */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Pattern name */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Pattern category */
|
|
18
|
+
category: string;
|
|
19
|
+
/** Confidence score */
|
|
20
|
+
confidence: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Prompt for confirmation
|
|
24
|
+
*/
|
|
25
|
+
export declare function confirmPrompt(message: string, defaultValue?: boolean): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Prompt for text input
|
|
28
|
+
*/
|
|
29
|
+
export declare function inputPrompt(message: string, defaultValue?: string): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Prompt to select from a list of options
|
|
32
|
+
*/
|
|
33
|
+
export declare function selectPrompt<T extends string>(message: string, choices: Array<{
|
|
34
|
+
value: T;
|
|
35
|
+
name: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
}>): Promise<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Prompt to select multiple items from a list
|
|
40
|
+
*/
|
|
41
|
+
export declare function multiSelectPrompt<T extends string>(message: string, choices: Array<{
|
|
42
|
+
value: T;
|
|
43
|
+
name: string;
|
|
44
|
+
checked?: boolean;
|
|
45
|
+
}>): Promise<T[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Prompt for pattern approval action
|
|
48
|
+
*/
|
|
49
|
+
export type PatternAction = 'approve' | 'ignore' | 'skip' | 'variant';
|
|
50
|
+
export declare function promptPatternAction(pattern: PatternChoice): Promise<PatternAction>;
|
|
51
|
+
/**
|
|
52
|
+
* Prompt for multiple pattern approvals
|
|
53
|
+
*/
|
|
54
|
+
export declare function promptBatchPatternApproval(patterns: PatternChoice[]): Promise<string[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Prompt for severity selection
|
|
57
|
+
*/
|
|
58
|
+
export declare function promptSeverity(message?: string): Promise<Severity>;
|
|
59
|
+
/**
|
|
60
|
+
* Prompt for variant reason
|
|
61
|
+
*/
|
|
62
|
+
export declare function promptVariantReason(): Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Prompt for variant scope
|
|
65
|
+
*/
|
|
66
|
+
export type VariantScope = 'global' | 'directory' | 'file';
|
|
67
|
+
export declare function promptVariantScope(): Promise<VariantScope>;
|
|
68
|
+
/**
|
|
69
|
+
* Prompt for initialization options
|
|
70
|
+
*/
|
|
71
|
+
export interface InitPromptResult {
|
|
72
|
+
/** Whether to scan immediately */
|
|
73
|
+
scanNow: boolean;
|
|
74
|
+
/** Whether to auto-approve high confidence patterns */
|
|
75
|
+
autoApprove: boolean;
|
|
76
|
+
}
|
|
77
|
+
export declare function promptInitOptions(): Promise<InitPromptResult>;
|
|
78
|
+
/**
|
|
79
|
+
* Prompt for ignore reason
|
|
80
|
+
*/
|
|
81
|
+
export declare function promptIgnoreReason(): Promise<string>;
|
|
82
|
+
/**
|
|
83
|
+
* Prompt for report format selection
|
|
84
|
+
*/
|
|
85
|
+
export type ReportFormat = 'text' | 'json' | 'github' | 'gitlab';
|
|
86
|
+
export declare function promptReportFormat(): Promise<ReportFormat>;
|
|
87
|
+
/**
|
|
88
|
+
* Prompt for category selection
|
|
89
|
+
*/
|
|
90
|
+
export declare function promptCategorySelection(categories: string[]): Promise<string[]>;
|
|
91
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spinner - Progress spinners
|
|
3
|
+
*
|
|
4
|
+
* Provides animated spinners for long-running operations.
|
|
5
|
+
*
|
|
6
|
+
* @requirements 29.1
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Spinner configuration options
|
|
10
|
+
*/
|
|
11
|
+
export interface SpinnerOptions {
|
|
12
|
+
/** Spinner text */
|
|
13
|
+
text?: string;
|
|
14
|
+
/** Spinner color */
|
|
15
|
+
color?: 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray';
|
|
16
|
+
/** Whether to show spinner (false in CI mode) */
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Spinner wrapper for consistent CLI feedback
|
|
21
|
+
*/
|
|
22
|
+
export declare class Spinner {
|
|
23
|
+
private spinner;
|
|
24
|
+
private enabled;
|
|
25
|
+
constructor(options?: SpinnerOptions);
|
|
26
|
+
/**
|
|
27
|
+
* Start the spinner with optional text
|
|
28
|
+
*/
|
|
29
|
+
start(text?: string): this;
|
|
30
|
+
/**
|
|
31
|
+
* Stop the spinner with a success message
|
|
32
|
+
*/
|
|
33
|
+
succeed(text?: string): this;
|
|
34
|
+
/**
|
|
35
|
+
* Stop the spinner with a failure message
|
|
36
|
+
*/
|
|
37
|
+
fail(text?: string): this;
|
|
38
|
+
/**
|
|
39
|
+
* Stop the spinner with a warning message
|
|
40
|
+
*/
|
|
41
|
+
warn(text?: string): this;
|
|
42
|
+
/**
|
|
43
|
+
* Stop the spinner with an info message
|
|
44
|
+
*/
|
|
45
|
+
info(text?: string): this;
|
|
46
|
+
/**
|
|
47
|
+
* Stop the spinner without a status symbol
|
|
48
|
+
*/
|
|
49
|
+
stop(): this;
|
|
50
|
+
/**
|
|
51
|
+
* Update the spinner text
|
|
52
|
+
*/
|
|
53
|
+
text(text: string): this;
|
|
54
|
+
/**
|
|
55
|
+
* Update the spinner color
|
|
56
|
+
*/
|
|
57
|
+
color(color: 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'): this;
|
|
58
|
+
/**
|
|
59
|
+
* Check if spinner is currently spinning
|
|
60
|
+
*/
|
|
61
|
+
get isSpinning(): boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create a new spinner instance
|
|
65
|
+
*/
|
|
66
|
+
export declare function createSpinner(textOrOptions?: string | SpinnerOptions): Spinner;
|
|
67
|
+
/**
|
|
68
|
+
* Run an async operation with a spinner
|
|
69
|
+
*/
|
|
70
|
+
export declare function withSpinner<T>(text: string, operation: () => Promise<T>, options?: {
|
|
71
|
+
successText?: string | ((result: T) => string);
|
|
72
|
+
failText?: string | ((error: Error) => string);
|
|
73
|
+
}): Promise<T>;
|
|
74
|
+
/**
|
|
75
|
+
* Pre-configured spinners for common operations
|
|
76
|
+
*/
|
|
77
|
+
export declare const spinners: {
|
|
78
|
+
/**
|
|
79
|
+
* Spinner for scanning operations
|
|
80
|
+
*/
|
|
81
|
+
scanning(text?: string): Spinner;
|
|
82
|
+
/**
|
|
83
|
+
* Spinner for analysis operations
|
|
84
|
+
*/
|
|
85
|
+
analyzing(text?: string): Spinner;
|
|
86
|
+
/**
|
|
87
|
+
* Spinner for loading operations
|
|
88
|
+
*/
|
|
89
|
+
loading(text?: string): Spinner;
|
|
90
|
+
/**
|
|
91
|
+
* Spinner for saving operations
|
|
92
|
+
*/
|
|
93
|
+
saving(text?: string): Spinner;
|
|
94
|
+
/**
|
|
95
|
+
* Spinner for checking operations
|
|
96
|
+
*/
|
|
97
|
+
checking(text?: string): Spinner;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Status indicators for non-spinner output
|
|
101
|
+
*/
|
|
102
|
+
export declare const status: {
|
|
103
|
+
success(message: string): void;
|
|
104
|
+
error(message: string): void;
|
|
105
|
+
warning(message: string): void;
|
|
106
|
+
info(message: string): void;
|
|
107
|
+
pending(message: string): void;
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=spinner.d.ts.map
|