driftdetect 0.7.1 → 0.8.1
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 +26 -1
- package/dist/bin/drift.js.map +1 -1
- package/dist/commands/approve.d.ts +2 -0
- package/dist/commands/approve.d.ts.map +1 -1
- package/dist/commands/approve.js +92 -1
- package/dist/commands/approve.js.map +1 -1
- package/dist/commands/boundaries.d.ts +20 -0
- package/dist/commands/callgraph.d.ts.map +1 -1
- package/dist/commands/callgraph.js +42 -52
- package/dist/commands/callgraph.js.map +1 -1
- package/dist/commands/context.d.ts +19 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +301 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/cpp.d.ts +22 -0
- package/dist/commands/cpp.d.ts.map +1 -0
- package/dist/commands/cpp.js +485 -0
- package/dist/commands/cpp.js.map +1 -0
- package/dist/commands/dashboard.d.ts +16 -0
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +3 -1
- package/dist/commands/dashboard.js.map +1 -1
- 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/gate.d.ts +33 -0
- package/dist/commands/gate.d.ts.map +1 -0
- package/dist/commands/gate.js +199 -0
- package/dist/commands/gate.js.map +1 -0
- package/dist/commands/ignore.d.ts.map +1 -1
- package/dist/commands/ignore.js +36 -0
- package/dist/commands/ignore.js.map +1 -1
- package/dist/commands/index.d.ts +6 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +12 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts +19 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +41 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/license.d.ts +12 -0
- package/dist/commands/license.d.ts.map +1 -0
- package/dist/commands/license.js +133 -0
- package/dist/commands/license.js.map +1 -0
- package/dist/commands/parser.d.ts +20 -0
- package/dist/commands/rust.d.ts +21 -0
- package/dist/commands/rust.d.ts.map +1 -0
- package/dist/commands/rust.js +526 -0
- package/dist/commands/rust.js.map +1 -0
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +69 -1
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/simulate.d.ts.map +1 -1
- package/dist/commands/simulate.js +22 -1
- package/dist/commands/simulate.js.map +1 -1
- package/dist/commands/telemetry.d.ts +9 -0
- package/dist/commands/telemetry.d.ts.map +1 -0
- package/dist/commands/telemetry.js +289 -0
- package/dist/commands/telemetry.js.map +1 -0
- package/dist/commands/trends.d.ts +12 -0
- package/dist/commands/watch.d.ts +13 -0
- package/dist/git/hooks.d.ts +108 -0
- package/dist/git/index.d.ts +6 -0
- package/dist/git/staged-files.d.ts +41 -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/json-reporter.d.ts +13 -0
- package/dist/reporters/text-reporter.d.ts +13 -0
- package/dist/reporters/types.d.ts +42 -0
- package/dist/services/boundary-scanner.d.ts +21 -0
- package/dist/services/contract-scanner.d.ts +35 -0
- package/dist/types/index.d.ts +24 -0
- package/dist/ui/index.d.ts +11 -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/package.json +17 -17
- package/LICENSE +0 -21
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Hooks - Pre-commit and pre-push hook setup
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to install and manage Git hooks for Drift integration.
|
|
5
|
+
* Supports both Husky-based and direct Git hooks installation.
|
|
6
|
+
*
|
|
7
|
+
* @requirements 37.1, 37.3
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Hook types supported by Drift
|
|
11
|
+
*/
|
|
12
|
+
export type HookType = 'pre-commit' | 'pre-push';
|
|
13
|
+
/**
|
|
14
|
+
* Result of a hook installation operation
|
|
15
|
+
*/
|
|
16
|
+
export interface HookInstallResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
hookType: HookType;
|
|
19
|
+
method: 'husky' | 'git';
|
|
20
|
+
message: string;
|
|
21
|
+
path?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Options for hook installation
|
|
25
|
+
*/
|
|
26
|
+
export interface HookInstallOptions {
|
|
27
|
+
/** Force overwrite existing hooks */
|
|
28
|
+
force?: boolean;
|
|
29
|
+
/** Use Husky if available */
|
|
30
|
+
preferHusky?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Check if Husky is installed and configured in the project
|
|
34
|
+
*
|
|
35
|
+
* @param rootDir - Root directory of the repository
|
|
36
|
+
* @returns True if Husky is available
|
|
37
|
+
*/
|
|
38
|
+
export declare function isHuskyInstalled(rootDir: string): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Get the Git hooks directory path
|
|
41
|
+
*
|
|
42
|
+
* @param rootDir - Root directory of the repository
|
|
43
|
+
* @returns Path to the Git hooks directory
|
|
44
|
+
*/
|
|
45
|
+
export declare function getGitHooksDir(rootDir: string): Promise<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Install a pre-commit hook for Drift
|
|
48
|
+
*
|
|
49
|
+
* The pre-commit hook runs `drift check --staged` to check only staged files
|
|
50
|
+
* before allowing a commit.
|
|
51
|
+
*
|
|
52
|
+
* @param rootDir - Root directory of the repository
|
|
53
|
+
* @param options - Installation options
|
|
54
|
+
* @returns Installation result
|
|
55
|
+
*
|
|
56
|
+
* @requirements 37.1
|
|
57
|
+
*/
|
|
58
|
+
export declare function installPreCommitHook(rootDir: string, options?: HookInstallOptions): Promise<HookInstallResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Install a pre-push hook for Drift
|
|
61
|
+
*
|
|
62
|
+
* The pre-push hook runs `drift check` to perform a full check
|
|
63
|
+
* before allowing a push.
|
|
64
|
+
*
|
|
65
|
+
* @param rootDir - Root directory of the repository
|
|
66
|
+
* @param options - Installation options
|
|
67
|
+
* @returns Installation result
|
|
68
|
+
*
|
|
69
|
+
* @requirements 37.3
|
|
70
|
+
*/
|
|
71
|
+
export declare function installPrePushHook(rootDir: string, options?: HookInstallOptions): Promise<HookInstallResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Install all Drift Git hooks (pre-commit and pre-push)
|
|
74
|
+
*
|
|
75
|
+
* @param rootDir - Root directory of the repository
|
|
76
|
+
* @param options - Installation options
|
|
77
|
+
* @returns Array of installation results
|
|
78
|
+
*
|
|
79
|
+
* @requirements 37.1, 37.3
|
|
80
|
+
*/
|
|
81
|
+
export declare function installAllHooks(rootDir: string, options?: HookInstallOptions): Promise<HookInstallResult[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Uninstall a Git hook
|
|
84
|
+
*
|
|
85
|
+
* @param rootDir - Root directory of the repository
|
|
86
|
+
* @param hookType - Type of hook to uninstall
|
|
87
|
+
* @returns True if hook was removed
|
|
88
|
+
*/
|
|
89
|
+
export declare function uninstallHook(rootDir: string, hookType: HookType): Promise<boolean>;
|
|
90
|
+
/**
|
|
91
|
+
* Uninstall all Drift Git hooks
|
|
92
|
+
*
|
|
93
|
+
* @param rootDir - Root directory of the repository
|
|
94
|
+
* @returns Object with results for each hook type
|
|
95
|
+
*/
|
|
96
|
+
export declare function uninstallAllHooks(rootDir: string): Promise<Record<HookType, boolean>>;
|
|
97
|
+
/**
|
|
98
|
+
* Get the status of installed hooks
|
|
99
|
+
*
|
|
100
|
+
* @param rootDir - Root directory of the repository
|
|
101
|
+
* @returns Object with status for each hook type
|
|
102
|
+
*/
|
|
103
|
+
export declare function getHooksStatus(rootDir: string): Promise<Record<HookType, {
|
|
104
|
+
installed: boolean;
|
|
105
|
+
method?: 'husky' | 'git';
|
|
106
|
+
path?: string;
|
|
107
|
+
}>>;
|
|
108
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git module exports
|
|
3
|
+
*/
|
|
4
|
+
export { getStagedFiles, getChangedFiles, getUntrackedFiles, isGitRepository, getGitRoot, } from './staged-files.js';
|
|
5
|
+
export { type HookType, type HookInstallResult, type HookInstallOptions, isHuskyInstalled, getGitHooksDir, installPreCommitHook, installPrePushHook, installAllHooks, uninstallHook, uninstallAllHooks, getHooksStatus, } from './hooks.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Staged Files - Get list of staged files from Git
|
|
3
|
+
*
|
|
4
|
+
* @requirements 37.2
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Get list of staged files from Git
|
|
8
|
+
*
|
|
9
|
+
* @param rootDir - Root directory of the repository
|
|
10
|
+
* @returns Array of staged file paths (relative to rootDir)
|
|
11
|
+
*/
|
|
12
|
+
export declare function getStagedFiles(rootDir: string): Promise<string[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Get list of all changed files (staged and unstaged)
|
|
15
|
+
*
|
|
16
|
+
* @param rootDir - Root directory of the repository
|
|
17
|
+
* @returns Array of changed file paths (relative to rootDir)
|
|
18
|
+
*/
|
|
19
|
+
export declare function getChangedFiles(rootDir: string): Promise<string[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Get list of untracked files
|
|
22
|
+
*
|
|
23
|
+
* @param rootDir - Root directory of the repository
|
|
24
|
+
* @returns Array of untracked file paths (relative to rootDir)
|
|
25
|
+
*/
|
|
26
|
+
export declare function getUntrackedFiles(rootDir: string): Promise<string[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a path is inside a Git repository
|
|
29
|
+
*
|
|
30
|
+
* @param dirPath - Directory path to check
|
|
31
|
+
* @returns True if inside a Git repository
|
|
32
|
+
*/
|
|
33
|
+
export declare function isGitRepository(dirPath: string): Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Get the root directory of the Git repository
|
|
36
|
+
*
|
|
37
|
+
* @param dirPath - Directory path inside the repository
|
|
38
|
+
* @returns Root directory of the Git repository
|
|
39
|
+
*/
|
|
40
|
+
export declare function getGitRoot(dirPath: string): Promise<string>;
|
|
41
|
+
//# sourceMappingURL=staged-files.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Reporter - GitHub Actions annotations
|
|
3
|
+
*
|
|
4
|
+
* @requirements 30.2
|
|
5
|
+
*/
|
|
6
|
+
import type { Reporter, ReportData } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* GitHub Actions reporter for CI annotations
|
|
9
|
+
*/
|
|
10
|
+
export declare class GitHubReporter implements Reporter {
|
|
11
|
+
generate(data: ReportData): string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=github-reporter.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitLab Reporter - GitLab CI code quality format
|
|
3
|
+
*
|
|
4
|
+
* @requirements 30.3
|
|
5
|
+
*/
|
|
6
|
+
import type { Reporter, ReportData } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* GitLab CI reporter for code quality reports
|
|
9
|
+
*
|
|
10
|
+
* Generates reports in GitLab Code Quality format:
|
|
11
|
+
* https://docs.gitlab.com/ee/ci/testing/code_quality.html
|
|
12
|
+
*/
|
|
13
|
+
export declare class GitLabReporter implements Reporter {
|
|
14
|
+
generate(data: ReportData): string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=gitlab-reporter.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reporters module exports
|
|
3
|
+
*/
|
|
4
|
+
export * from './types.js';
|
|
5
|
+
export { TextReporter } from './text-reporter.js';
|
|
6
|
+
export { JsonReporter } from './json-reporter.js';
|
|
7
|
+
export { GitHubReporter } from './github-reporter.js';
|
|
8
|
+
export { GitLabReporter } from './gitlab-reporter.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Reporter - Machine-readable JSON output
|
|
3
|
+
*
|
|
4
|
+
* @requirements 30.1
|
|
5
|
+
*/
|
|
6
|
+
import type { Reporter, ReportData } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* JSON reporter for machine-readable output
|
|
9
|
+
*/
|
|
10
|
+
export declare class JsonReporter implements Reporter {
|
|
11
|
+
generate(data: ReportData): string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=json-reporter.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text Reporter - Human-readable text output
|
|
3
|
+
*
|
|
4
|
+
* @requirements 29.7
|
|
5
|
+
*/
|
|
6
|
+
import type { Reporter, ReportData } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Text reporter for human-readable output
|
|
9
|
+
*/
|
|
10
|
+
export declare class TextReporter implements Reporter {
|
|
11
|
+
generate(data: ReportData): string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=text-reporter.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boundary Scanner Service
|
|
3
|
+
*
|
|
4
|
+
* Scans files to detect data access patterns and boundaries.
|
|
5
|
+
* Tracks which code accesses which database tables/fields.
|
|
6
|
+
*/
|
|
7
|
+
import { type BoundaryStore, type BoundaryScanResult } from 'driftdetect-core';
|
|
8
|
+
export interface BoundaryScannerConfig {
|
|
9
|
+
rootDir: string;
|
|
10
|
+
verbose?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class BoundaryScanner {
|
|
13
|
+
private config;
|
|
14
|
+
private store;
|
|
15
|
+
constructor(config: BoundaryScannerConfig);
|
|
16
|
+
initialize(): Promise<void>;
|
|
17
|
+
scanFiles(files: string[]): Promise<BoundaryScanResult>;
|
|
18
|
+
getStore(): BoundaryStore;
|
|
19
|
+
}
|
|
20
|
+
export declare function createBoundaryScanner(config: BoundaryScannerConfig): BoundaryScanner;
|
|
21
|
+
//# sourceMappingURL=boundary-scanner.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
|
@@ -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,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
|
|
@@ -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
|