driftdetect 0.9.33 → 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/bin/drift.js +0 -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 +13 -13
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table - Table formatting for output
|
|
3
|
+
*
|
|
4
|
+
* Provides formatted table output for CLI results.
|
|
5
|
+
*
|
|
6
|
+
* @requirements 29.1
|
|
7
|
+
*/
|
|
8
|
+
import Table from 'cli-table3';
|
|
9
|
+
import type { Severity } from 'driftdetect-core';
|
|
10
|
+
/**
|
|
11
|
+
* Table style presets
|
|
12
|
+
*/
|
|
13
|
+
export type TableStyle = 'default' | 'compact' | 'borderless' | 'minimal';
|
|
14
|
+
/**
|
|
15
|
+
* Table configuration options
|
|
16
|
+
*/
|
|
17
|
+
export interface TableOptions {
|
|
18
|
+
/** Table headers */
|
|
19
|
+
head?: string[];
|
|
20
|
+
/** Column widths */
|
|
21
|
+
colWidths?: number[];
|
|
22
|
+
/** Column alignments */
|
|
23
|
+
colAligns?: Array<'left' | 'center' | 'right'>;
|
|
24
|
+
/** Table style preset */
|
|
25
|
+
style?: TableStyle;
|
|
26
|
+
/** Word wrap long content */
|
|
27
|
+
wordWrap?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a formatted table
|
|
31
|
+
*/
|
|
32
|
+
export declare function createTable(options?: TableOptions): Table.Table;
|
|
33
|
+
/**
|
|
34
|
+
* Format a severity value with color
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatSeverity(severity: Severity): string;
|
|
37
|
+
/**
|
|
38
|
+
* Format a confidence score with color
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatConfidence(confidence: number): string;
|
|
41
|
+
/**
|
|
42
|
+
* Format a count with color based on value
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatCount(count: number, threshold?: number): string;
|
|
45
|
+
/**
|
|
46
|
+
* Format a file path (truncate if too long)
|
|
47
|
+
*/
|
|
48
|
+
export declare function formatPath(path: string, maxLength?: number): string;
|
|
49
|
+
/**
|
|
50
|
+
* Pattern table row data
|
|
51
|
+
*/
|
|
52
|
+
export interface PatternRow {
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
category: string;
|
|
56
|
+
confidence: number;
|
|
57
|
+
locations: number;
|
|
58
|
+
outliers: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a patterns table
|
|
62
|
+
*/
|
|
63
|
+
export declare function createPatternsTable(patterns: PatternRow[]): string;
|
|
64
|
+
/**
|
|
65
|
+
* Violation table row data
|
|
66
|
+
*/
|
|
67
|
+
export interface ViolationRow {
|
|
68
|
+
severity: Severity;
|
|
69
|
+
file: string;
|
|
70
|
+
line: number;
|
|
71
|
+
message: string;
|
|
72
|
+
pattern: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a violations table
|
|
76
|
+
*/
|
|
77
|
+
export declare function createViolationsTable(violations: ViolationRow[]): string;
|
|
78
|
+
/**
|
|
79
|
+
* Summary table row data
|
|
80
|
+
*/
|
|
81
|
+
export interface SummaryRow {
|
|
82
|
+
label: string;
|
|
83
|
+
value: string | number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Create a summary table
|
|
87
|
+
*/
|
|
88
|
+
export declare function createSummaryTable(rows: SummaryRow[]): string;
|
|
89
|
+
/**
|
|
90
|
+
* Status summary data
|
|
91
|
+
*/
|
|
92
|
+
export interface StatusSummary {
|
|
93
|
+
totalPatterns: number;
|
|
94
|
+
approvedPatterns: number;
|
|
95
|
+
discoveredPatterns: number;
|
|
96
|
+
ignoredPatterns: number;
|
|
97
|
+
totalViolations: number;
|
|
98
|
+
errors: number;
|
|
99
|
+
warnings: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create a status summary table
|
|
103
|
+
*/
|
|
104
|
+
export declare function createStatusTable(summary: StatusSummary): string;
|
|
105
|
+
/**
|
|
106
|
+
* Category breakdown data
|
|
107
|
+
*/
|
|
108
|
+
export interface CategoryBreakdown {
|
|
109
|
+
category: string;
|
|
110
|
+
patterns: number;
|
|
111
|
+
violations: number;
|
|
112
|
+
coverage: number;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Create a category breakdown table
|
|
116
|
+
*/
|
|
117
|
+
export declare function createCategoryTable(categories: CategoryBreakdown[]): string;
|
|
118
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detector Worker - Worker thread for running pattern detectors
|
|
3
|
+
*
|
|
4
|
+
* This worker runs in a separate thread and handles:
|
|
5
|
+
* - Loading and running detectors on file content
|
|
6
|
+
* - Tree-sitter AST parsing
|
|
7
|
+
* - Pattern matching and violation detection
|
|
8
|
+
*
|
|
9
|
+
* @requirements 2.6 - Parallel file processing with worker threads
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Warmup task - preloads detectors without processing files
|
|
13
|
+
*/
|
|
14
|
+
export interface WarmupTask {
|
|
15
|
+
type: 'warmup';
|
|
16
|
+
categories?: string[] | undefined;
|
|
17
|
+
criticalOnly?: boolean | undefined;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Warmup result
|
|
21
|
+
*/
|
|
22
|
+
export interface WarmupResult {
|
|
23
|
+
type: 'warmup';
|
|
24
|
+
detectorsLoaded: number;
|
|
25
|
+
duration: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Task input for detector worker
|
|
29
|
+
*/
|
|
30
|
+
export interface DetectorWorkerTask {
|
|
31
|
+
/** Task type - 'scan' for file processing, 'warmup' for preloading */
|
|
32
|
+
type?: 'scan' | undefined;
|
|
33
|
+
/** Relative path to the file */
|
|
34
|
+
file: string;
|
|
35
|
+
/** Root directory */
|
|
36
|
+
rootDir: string;
|
|
37
|
+
/** Project files list (for context) */
|
|
38
|
+
projectFiles: string[];
|
|
39
|
+
/** Project config */
|
|
40
|
+
projectConfig: Record<string, unknown>;
|
|
41
|
+
/** Detector IDs to run (empty = all) */
|
|
42
|
+
detectorIds?: string[] | undefined;
|
|
43
|
+
/** Categories to filter by */
|
|
44
|
+
categories?: string[] | undefined;
|
|
45
|
+
/** Only run critical detectors */
|
|
46
|
+
criticalOnly?: boolean | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Pattern match from detector
|
|
50
|
+
*
|
|
51
|
+
* Enhanced to preserve all metadata from detectors including:
|
|
52
|
+
* - Full location range (endLine/endColumn)
|
|
53
|
+
* - Outlier information (isOutlier, outlierReason)
|
|
54
|
+
* - Matched text for context
|
|
55
|
+
* - Custom detector metadata
|
|
56
|
+
*/
|
|
57
|
+
export interface WorkerPatternMatch {
|
|
58
|
+
patternId: string;
|
|
59
|
+
detectorId: string;
|
|
60
|
+
detectorName: string;
|
|
61
|
+
detectorDescription: string;
|
|
62
|
+
category: string;
|
|
63
|
+
subcategory: string;
|
|
64
|
+
confidence: number;
|
|
65
|
+
location: {
|
|
66
|
+
file: string;
|
|
67
|
+
line: number;
|
|
68
|
+
column: number;
|
|
69
|
+
/** End line for full range highlighting */
|
|
70
|
+
endLine?: number;
|
|
71
|
+
/** End column for full range highlighting */
|
|
72
|
+
endColumn?: number;
|
|
73
|
+
};
|
|
74
|
+
/** Whether this match deviates from the established pattern */
|
|
75
|
+
isOutlier?: boolean;
|
|
76
|
+
/** Explanation for why this is an outlier */
|
|
77
|
+
outlierReason?: string;
|
|
78
|
+
/** The actual text that was matched */
|
|
79
|
+
matchedText?: string;
|
|
80
|
+
/** Custom metadata from the detector (auth types, route info, etc.) */
|
|
81
|
+
metadata?: Record<string, unknown>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Violation from detector
|
|
85
|
+
*/
|
|
86
|
+
export interface WorkerViolation {
|
|
87
|
+
patternId: string;
|
|
88
|
+
detectorId: string;
|
|
89
|
+
category: string;
|
|
90
|
+
severity: 'error' | 'warning' | 'info' | 'hint';
|
|
91
|
+
file: string;
|
|
92
|
+
line: number;
|
|
93
|
+
column: number;
|
|
94
|
+
message: string;
|
|
95
|
+
explanation?: string | undefined;
|
|
96
|
+
suggestedFix?: string | undefined;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Result from detector worker
|
|
100
|
+
*/
|
|
101
|
+
export interface DetectorWorkerResult {
|
|
102
|
+
/** File that was processed */
|
|
103
|
+
file: string;
|
|
104
|
+
/** Detected language */
|
|
105
|
+
language: string | null;
|
|
106
|
+
/** Pattern matches found */
|
|
107
|
+
patterns: WorkerPatternMatch[];
|
|
108
|
+
/** Violations found */
|
|
109
|
+
violations: WorkerViolation[];
|
|
110
|
+
/** Number of detectors that ran */
|
|
111
|
+
detectorsRan: number;
|
|
112
|
+
/** Number of detectors skipped */
|
|
113
|
+
detectorsSkipped: number;
|
|
114
|
+
/** Processing duration in milliseconds */
|
|
115
|
+
duration: number;
|
|
116
|
+
/** Error message if processing failed */
|
|
117
|
+
error?: string | undefined;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Process a single file with detectors
|
|
121
|
+
*
|
|
122
|
+
* This is the main export that Piscina will call for each task.
|
|
123
|
+
*/
|
|
124
|
+
export default function processFile(task: DetectorWorkerTask | WarmupTask): Promise<DetectorWorkerResult | WarmupResult>;
|
|
125
|
+
//# sourceMappingURL=detector-worker.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "driftdetect",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.35",
|
|
4
4
|
"description": "Codebase pattern detection for AI agents - scans your code, learns conventions, feeds context to Claude/Cursor/Copilot via MCP. Static analysis for TypeScript, Python, C#, Java, PHP.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Geoffrey Fernald",
|
|
@@ -49,6 +49,17 @@
|
|
|
49
49
|
"files": [
|
|
50
50
|
"dist"
|
|
51
51
|
],
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc",
|
|
54
|
+
"clean": "rm -rf dist",
|
|
55
|
+
"dev": "tsc --watch",
|
|
56
|
+
"lint": "eslint src --ext .ts",
|
|
57
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
58
|
+
"test": "vitest run",
|
|
59
|
+
"test:watch": "vitest",
|
|
60
|
+
"test:coverage": "vitest run --coverage",
|
|
61
|
+
"typecheck": "tsc --noEmit"
|
|
62
|
+
},
|
|
52
63
|
"dependencies": {
|
|
53
64
|
"@inquirer/prompts": "^7.0.0",
|
|
54
65
|
"chalk": "^5.3.0",
|
|
@@ -70,16 +81,5 @@
|
|
|
70
81
|
"fast-check": "^3.15.0",
|
|
71
82
|
"typescript": "^5.3.0",
|
|
72
83
|
"vitest": "^1.0.0"
|
|
73
|
-
},
|
|
74
|
-
"scripts": {
|
|
75
|
-
"build": "tsc",
|
|
76
|
-
"clean": "rm -rf dist",
|
|
77
|
-
"dev": "tsc --watch",
|
|
78
|
-
"lint": "eslint src --ext .ts",
|
|
79
|
-
"lint:fix": "eslint src --ext .ts --fix",
|
|
80
|
-
"test": "vitest run",
|
|
81
|
-
"test:watch": "vitest",
|
|
82
|
-
"test:coverage": "vitest run --coverage",
|
|
83
|
-
"typecheck": "tsc --noEmit"
|
|
84
84
|
}
|
|
85
|
-
}
|
|
85
|
+
}
|