driftdetect 0.2.3 → 0.3.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.
Files changed (82) hide show
  1. package/dist/bin/drift.js +15 -1
  2. package/dist/bin/drift.js.map +1 -1
  3. package/dist/commands/boundaries.d.ts.map +1 -0
  4. package/dist/commands/boundaries.js +602 -0
  5. package/dist/commands/boundaries.js.map +1 -0
  6. package/dist/commands/dna/export.d.ts.map +1 -0
  7. package/dist/commands/dna/export.js +91 -0
  8. package/dist/commands/dna/export.js.map +1 -0
  9. package/dist/commands/dna/gene.d.ts.map +1 -0
  10. package/dist/commands/dna/gene.js +96 -0
  11. package/dist/commands/dna/gene.js.map +1 -0
  12. package/dist/commands/dna/index.d.ts.map +1 -0
  13. package/dist/commands/dna/index.js +25 -0
  14. package/dist/commands/dna/index.js.map +1 -0
  15. package/dist/commands/dna/mutations.d.ts.map +1 -0
  16. package/dist/commands/dna/mutations.js +111 -0
  17. package/dist/commands/dna/mutations.js.map +1 -0
  18. package/dist/commands/dna/playbook.d.ts.map +1 -0
  19. package/dist/commands/dna/playbook.js +67 -0
  20. package/dist/commands/dna/playbook.js.map +1 -0
  21. package/dist/commands/dna/scan.d.ts.map +1 -0
  22. package/dist/commands/dna/scan.js +117 -0
  23. package/dist/commands/dna/scan.js.map +1 -0
  24. package/dist/commands/dna/status.d.ts.map +1 -0
  25. package/dist/commands/dna/status.js +106 -0
  26. package/dist/commands/dna/status.js.map +1 -0
  27. package/dist/commands/index.d.ts.map +1 -1
  28. package/dist/commands/index.js +4 -0
  29. package/dist/commands/index.js.map +1 -1
  30. package/dist/commands/parser.d.ts.map +1 -0
  31. package/dist/commands/parser.js +521 -0
  32. package/dist/commands/parser.js.map +1 -0
  33. package/dist/commands/scan.d.ts.map +1 -1
  34. package/dist/commands/scan.js +118 -3
  35. package/dist/commands/scan.js.map +1 -1
  36. package/dist/commands/trends.d.ts.map +1 -0
  37. package/dist/commands/trends.js +115 -0
  38. package/dist/commands/trends.js.map +1 -0
  39. package/dist/commands/watch.js +2 -2
  40. package/dist/commands/watch.js.map +1 -1
  41. package/dist/services/boundary-scanner.d.ts.map +1 -0
  42. package/dist/services/boundary-scanner.js +374 -0
  43. package/dist/services/boundary-scanner.js.map +1 -0
  44. package/dist/services/contract-scanner.d.ts.map +1 -1
  45. package/dist/services/contract-scanner.js +49 -1
  46. package/dist/services/contract-scanner.js.map +1 -1
  47. package/dist/services/scanner-service.d.ts.map +1 -1
  48. package/dist/services/scanner-service.js +32 -1
  49. package/dist/services/scanner-service.js.map +1 -1
  50. package/package.json +4 -4
  51. package/dist/bin/drift.d.ts +0 -11
  52. package/dist/commands/approve.d.ts +0 -18
  53. package/dist/commands/check.d.ts +0 -39
  54. package/dist/commands/dashboard.d.ts +0 -16
  55. package/dist/commands/export.d.ts +0 -16
  56. package/dist/commands/files.d.ts +0 -15
  57. package/dist/commands/ignore.d.ts +0 -18
  58. package/dist/commands/index.d.ts +0 -18
  59. package/dist/commands/init.d.ts +0 -19
  60. package/dist/commands/report.d.ts +0 -20
  61. package/dist/commands/scan.d.ts +0 -29
  62. package/dist/commands/status.d.ts +0 -18
  63. package/dist/commands/watch.d.ts +0 -13
  64. package/dist/commands/where.d.ts +0 -15
  65. package/dist/git/hooks.d.ts +0 -108
  66. package/dist/git/index.d.ts +0 -6
  67. package/dist/git/staged-files.d.ts +0 -41
  68. package/dist/index.d.ts +0 -17
  69. package/dist/reporters/github-reporter.d.ts +0 -13
  70. package/dist/reporters/gitlab-reporter.d.ts +0 -16
  71. package/dist/reporters/index.d.ts +0 -9
  72. package/dist/reporters/json-reporter.d.ts +0 -13
  73. package/dist/reporters/text-reporter.d.ts +0 -13
  74. package/dist/reporters/types.d.ts +0 -42
  75. package/dist/services/contract-scanner.d.ts +0 -35
  76. package/dist/services/scanner-service.d.ts +0 -166
  77. package/dist/types/index.d.ts +0 -24
  78. package/dist/ui/index.d.ts +0 -11
  79. package/dist/ui/progress.d.ts +0 -115
  80. package/dist/ui/prompts.d.ts +0 -91
  81. package/dist/ui/spinner.d.ts +0 -109
  82. package/dist/ui/table.d.ts +0 -118
@@ -1,42 +0,0 @@
1
- /**
2
- * Reporter type definitions
3
- */
4
- import type { Violation, Pattern } from 'driftdetect-core';
5
- /**
6
- * Summary of violations
7
- */
8
- export interface ViolationSummary {
9
- /** Total number of violations */
10
- total: number;
11
- /** Number of errors */
12
- errors: number;
13
- /** Number of warnings */
14
- warnings: number;
15
- /** Number of info violations */
16
- infos: number;
17
- /** Number of hints */
18
- hints: number;
19
- }
20
- /**
21
- * Data passed to reporters
22
- */
23
- export interface ReportData {
24
- /** Violations found */
25
- violations: Violation[];
26
- /** Summary statistics */
27
- summary: ViolationSummary;
28
- /** Patterns checked */
29
- patterns: Pattern[];
30
- /** Timestamp of the report */
31
- timestamp: string;
32
- /** Root directory */
33
- rootDir: string;
34
- }
35
- /**
36
- * Reporter interface
37
- */
38
- export interface Reporter {
39
- /** Generate a report from the data */
40
- generate(data: ReportData): string;
41
- }
42
- //# sourceMappingURL=types.d.ts.map
@@ -1,35 +0,0 @@
1
- /**
2
- * Contract Scanner Service
3
- *
4
- * Scans backend and frontend files to detect API contracts
5
- * and identify mismatches between what backend returns and
6
- * what frontend expects.
7
- */
8
- import { type ExtractedEndpoint, type ExtractedApiCall } from 'driftdetect-detectors';
9
- import { ContractStore, type Contract } from 'driftdetect-core';
10
- export interface ContractScannerConfig {
11
- rootDir: string;
12
- verbose?: boolean;
13
- }
14
- export interface ContractScanResult {
15
- contracts: Contract[];
16
- unmatchedBackend: ExtractedEndpoint[];
17
- unmatchedFrontend: ExtractedApiCall[];
18
- stats: {
19
- backendEndpoints: number;
20
- frontendCalls: number;
21
- matchedContracts: number;
22
- mismatches: number;
23
- };
24
- duration: number;
25
- }
26
- export declare class ContractScanner {
27
- private config;
28
- private store;
29
- constructor(config: ContractScannerConfig);
30
- initialize(): Promise<void>;
31
- scanFiles(files: string[]): Promise<ContractScanResult>;
32
- getStore(): ContractStore;
33
- }
34
- export declare function createContractScanner(config: ContractScannerConfig): ContractScanner;
35
- //# sourceMappingURL=contract-scanner.d.ts.map
@@ -1,166 +0,0 @@
1
- /**
2
- * Scanner Service - Enterprise-grade pattern detection
3
- *
4
- * Uses the real detectors from driftdetect-detectors to find
5
- * high-value architectural patterns and violations.
6
- *
7
- * Now includes manifest generation for pattern location discovery.
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
- }
32
- /**
33
- * Aggregated pattern match across files
34
- */
35
- export interface AggregatedPattern {
36
- patternId: string;
37
- detectorId: string;
38
- category: string;
39
- subcategory: string;
40
- name: string;
41
- description: string;
42
- locations: Array<{
43
- file: string;
44
- line: number;
45
- column: number;
46
- }>;
47
- confidence: number;
48
- occurrences: number;
49
- }
50
- /**
51
- * Aggregated violation across files
52
- */
53
- export interface AggregatedViolation {
54
- patternId: string;
55
- detectorId: string;
56
- category: string;
57
- severity: 'error' | 'warning' | 'info' | 'hint';
58
- file: string;
59
- line: number;
60
- column: number;
61
- message: string;
62
- explanation?: string | undefined;
63
- suggestedFix?: string | undefined;
64
- }
65
- /**
66
- * Scan result for a single file
67
- */
68
- export interface FileScanResult {
69
- file: string;
70
- patterns: Array<{
71
- patternId: string;
72
- detectorId: string;
73
- confidence: number;
74
- location: {
75
- file: string;
76
- line: number;
77
- column: number;
78
- };
79
- }>;
80
- violations: AggregatedViolation[];
81
- duration: number;
82
- error?: string;
83
- }
84
- /**
85
- * Overall scan results
86
- */
87
- export interface ScanResults {
88
- files: FileScanResult[];
89
- patterns: AggregatedPattern[];
90
- violations: AggregatedViolation[];
91
- totalPatterns: number;
92
- totalViolations: number;
93
- totalFiles: number;
94
- duration: number;
95
- errors: string[];
96
- detectorStats: {
97
- total: number;
98
- ran: number;
99
- skipped: number;
100
- };
101
- /** Manifest with semantic locations (if generateManifest is true) */
102
- manifest?: Manifest;
103
- }
104
- /**
105
- * Scanner Service
106
- *
107
- * Orchestrates pattern detection across files using real detectors
108
- * from driftdetect-detectors package.
109
- */
110
- export declare class ScannerService {
111
- private config;
112
- private detectors;
113
- private initialized;
114
- private manifestStore;
115
- constructor(config: ScannerServiceConfig);
116
- /**
117
- * Initialize the scanner service - loads all detectors
118
- */
119
- initialize(): Promise<void>;
120
- /**
121
- * Get detector count
122
- */
123
- getDetectorCount(): number;
124
- /**
125
- * Get detector counts by category
126
- */
127
- getDetectorCounts(): {
128
- api: number;
129
- auth: number;
130
- security: number;
131
- errors: number;
132
- structural: number;
133
- components: number;
134
- styling: number;
135
- logging: number;
136
- testing: number;
137
- dataAccess: number;
138
- config: number;
139
- types: number;
140
- accessibility: number;
141
- documentation: number;
142
- performance: number;
143
- total: number;
144
- };
145
- /**
146
- * Scan files for patterns using real detectors
147
- */
148
- scanFiles(files: string[], projectContext: ProjectContext): Promise<ScanResults>;
149
- /**
150
- * Create a semantic location from a basic location
151
- */
152
- private createSemanticLocation;
153
- /**
154
- * Extract semantic information from a line of code
155
- */
156
- private extractSemanticInfo;
157
- /**
158
- * Get the manifest store (for external access)
159
- */
160
- getManifestStore(): ManifestStore | null;
161
- }
162
- /**
163
- * Create a scanner service
164
- */
165
- export declare function createScannerService(config: ScannerServiceConfig): ScannerService;
166
- //# sourceMappingURL=scanner-service.d.ts.map
@@ -1,24 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,115 +0,0 @@
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
@@ -1,91 +0,0 @@
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
@@ -1,109 +0,0 @@
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