driftdetect 0.9.34 → 0.9.37

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.
Files changed (96) hide show
  1. package/dist/bin/drift.d.ts +11 -0
  2. package/dist/commands/approve.d.ts +28 -0
  3. package/dist/commands/audit.d.ts +29 -0
  4. package/dist/commands/boundaries.d.ts +20 -0
  5. package/dist/commands/callgraph.d.ts +24 -0
  6. package/dist/commands/check.d.ts +41 -0
  7. package/dist/commands/constants.d.ts +35 -0
  8. package/dist/commands/constraints.d.ts +17 -0
  9. package/dist/commands/context.d.ts +19 -0
  10. package/dist/commands/coupling.d.ts +17 -0
  11. package/dist/commands/cpp.d.ts +22 -0
  12. package/dist/commands/dashboard.d.ts +16 -0
  13. package/dist/commands/decisions.d.ts +19 -0
  14. package/dist/commands/dna/export.d.ts +6 -0
  15. package/dist/commands/dna/gene.d.ts +6 -0
  16. package/dist/commands/dna/index.d.ts +8 -0
  17. package/dist/commands/dna/mutations.d.ts +6 -0
  18. package/dist/commands/dna/playbook.d.ts +6 -0
  19. package/dist/commands/dna/scan.d.ts +6 -0
  20. package/dist/commands/dna/status.d.ts +6 -0
  21. package/dist/commands/env.d.ts +23 -0
  22. package/dist/commands/error-handling.d.ts +15 -0
  23. package/dist/commands/export.d.ts +16 -0
  24. package/dist/commands/files.d.ts +15 -0
  25. package/dist/commands/gate.d.ts +33 -0
  26. package/dist/commands/go.d.ts +21 -0
  27. package/dist/commands/ignore.d.ts +20 -0
  28. package/dist/commands/index.d.ts +50 -0
  29. package/dist/commands/index.js +68 -0
  30. package/dist/commands/index.js.map +1 -0
  31. package/dist/commands/init.d.ts +19 -0
  32. package/dist/commands/java.d.ts +15 -0
  33. package/dist/commands/license.d.ts +12 -0
  34. package/dist/commands/migrate-storage.d.ts +23 -0
  35. package/dist/commands/next-steps.d.ts +15 -0
  36. package/dist/commands/parser.d.ts +20 -0
  37. package/dist/commands/php.d.ts +15 -0
  38. package/dist/commands/projects.d.ts +17 -0
  39. package/dist/commands/py.d.ts +15 -0
  40. package/dist/commands/report.d.ts +22 -0
  41. package/dist/commands/rust.d.ts +21 -0
  42. package/dist/commands/scan.d.ts +45 -0
  43. package/dist/commands/simulate.d.ts +17 -0
  44. package/dist/commands/skills.d.ts +16 -0
  45. package/dist/commands/status.d.ts +20 -0
  46. package/dist/commands/telemetry.d.ts +9 -0
  47. package/dist/commands/test-topology.d.ts +15 -0
  48. package/dist/commands/trends.d.ts +12 -0
  49. package/dist/commands/troubleshoot.d.ts +14 -0
  50. package/dist/commands/ts.d.ts +21 -0
  51. package/dist/commands/watch.d.ts +13 -0
  52. package/dist/commands/where.d.ts +15 -0
  53. package/dist/commands/wpf.d.ts +21 -0
  54. package/dist/commands/wrappers.d.ts +16 -0
  55. package/dist/git/hooks.d.ts +108 -0
  56. package/dist/git/index.d.ts +6 -0
  57. package/dist/git/index.d.ts.map +1 -0
  58. package/dist/git/index.js +6 -0
  59. package/dist/git/index.js.map +1 -0
  60. package/dist/git/staged-files.d.ts +41 -0
  61. package/dist/git/staged-files.d.ts.map +1 -0
  62. package/dist/git/staged-files.js +118 -0
  63. package/dist/git/staged-files.js.map +1 -0
  64. package/dist/index.d.ts +17 -0
  65. package/dist/index.js +24 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/reporters/github-reporter.d.ts +13 -0
  68. package/dist/reporters/gitlab-reporter.d.ts +16 -0
  69. package/dist/reporters/index.d.ts +9 -0
  70. package/dist/reporters/index.js +9 -0
  71. package/dist/reporters/index.js.map +1 -0
  72. package/dist/reporters/json-reporter.d.ts +13 -0
  73. package/dist/reporters/json-reporter.js +44 -0
  74. package/dist/reporters/json-reporter.js.map +1 -0
  75. package/dist/reporters/text-reporter.d.ts +13 -0
  76. package/dist/reporters/types.d.ts +42 -0
  77. package/dist/reporters/types.js +5 -0
  78. package/dist/reporters/types.js.map +1 -0
  79. package/dist/services/boundary-scanner.d.ts +22 -0
  80. package/dist/services/pattern-service-factory.d.ts +37 -0
  81. package/dist/services/pattern-service-factory.js +41 -0
  82. package/dist/services/pattern-service-factory.js.map +1 -0
  83. package/dist/services/scanner-service.d.ts +237 -0
  84. package/dist/types/index.d.ts +24 -0
  85. package/dist/types/index.d.ts.map +1 -0
  86. package/dist/types/index.js +5 -0
  87. package/dist/types/index.js.map +1 -0
  88. package/dist/ui/index.d.ts +11 -0
  89. package/dist/ui/index.js +15 -0
  90. package/dist/ui/index.js.map +1 -0
  91. package/dist/ui/progress.d.ts +115 -0
  92. package/dist/ui/prompts.d.ts +91 -0
  93. package/dist/ui/spinner.d.ts +109 -0
  94. package/dist/ui/table.d.ts +118 -0
  95. package/dist/workers/detector-worker.d.ts +125 -0
  96. package/package.json +3 -3
@@ -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.34",
3
+ "version": "0.9.37",
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",
@@ -66,9 +66,9 @@
66
66
  "cli-progress": "^3.12.0",
67
67
  "cli-table3": "^0.6.5",
68
68
  "commander": "^12.1.0",
69
- "driftdetect-core": "^0.9.28",
69
+ "driftdetect-core": "0.9.37",
70
70
  "driftdetect-dashboard": "^0.9.28",
71
- "driftdetect-detectors": "^0.9.28",
71
+ "driftdetect-detectors": "0.9.37",
72
72
  "ora": "^8.1.0",
73
73
  "piscina": "^5.1.4",
74
74
  "react": "^18.2.0",