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.
- 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 +3 -3
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Staged Files - Get list of staged files from Git
|
|
3
|
+
*
|
|
4
|
+
* @requirements 37.2
|
|
5
|
+
*/
|
|
6
|
+
import { exec } from 'node:child_process';
|
|
7
|
+
import { promisify } from 'node:util';
|
|
8
|
+
const execAsync = promisify(exec);
|
|
9
|
+
/**
|
|
10
|
+
* Get list of staged files from Git
|
|
11
|
+
*
|
|
12
|
+
* @param rootDir - Root directory of the repository
|
|
13
|
+
* @returns Array of staged file paths (relative to rootDir)
|
|
14
|
+
*/
|
|
15
|
+
export async function getStagedFiles(rootDir) {
|
|
16
|
+
try {
|
|
17
|
+
const { stdout } = await execAsync('git diff --cached --name-only --diff-filter=ACMR', {
|
|
18
|
+
cwd: rootDir,
|
|
19
|
+
encoding: 'utf-8',
|
|
20
|
+
});
|
|
21
|
+
const files = stdout
|
|
22
|
+
.split('\n')
|
|
23
|
+
.map((line) => line.trim())
|
|
24
|
+
.filter((line) => line.length > 0);
|
|
25
|
+
return files;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
const err = error;
|
|
29
|
+
if (err.code === 'ENOENT') {
|
|
30
|
+
throw new Error('Git is not installed or not in PATH');
|
|
31
|
+
}
|
|
32
|
+
throw new Error(`Failed to get staged files: ${err.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get list of all changed files (staged and unstaged)
|
|
37
|
+
*
|
|
38
|
+
* @param rootDir - Root directory of the repository
|
|
39
|
+
* @returns Array of changed file paths (relative to rootDir)
|
|
40
|
+
*/
|
|
41
|
+
export async function getChangedFiles(rootDir) {
|
|
42
|
+
try {
|
|
43
|
+
const { stdout } = await execAsync('git diff --name-only --diff-filter=ACMR HEAD', {
|
|
44
|
+
cwd: rootDir,
|
|
45
|
+
encoding: 'utf-8',
|
|
46
|
+
});
|
|
47
|
+
const files = stdout
|
|
48
|
+
.split('\n')
|
|
49
|
+
.map((line) => line.trim())
|
|
50
|
+
.filter((line) => line.length > 0);
|
|
51
|
+
return files;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const err = error;
|
|
55
|
+
throw new Error(`Failed to get changed files: ${err.message}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get list of untracked files
|
|
60
|
+
*
|
|
61
|
+
* @param rootDir - Root directory of the repository
|
|
62
|
+
* @returns Array of untracked file paths (relative to rootDir)
|
|
63
|
+
*/
|
|
64
|
+
export async function getUntrackedFiles(rootDir) {
|
|
65
|
+
try {
|
|
66
|
+
const { stdout } = await execAsync('git ls-files --others --exclude-standard', {
|
|
67
|
+
cwd: rootDir,
|
|
68
|
+
encoding: 'utf-8',
|
|
69
|
+
});
|
|
70
|
+
const files = stdout
|
|
71
|
+
.split('\n')
|
|
72
|
+
.map((line) => line.trim())
|
|
73
|
+
.filter((line) => line.length > 0);
|
|
74
|
+
return files;
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
const err = error;
|
|
78
|
+
throw new Error(`Failed to get untracked files: ${err.message}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Check if a path is inside a Git repository
|
|
83
|
+
*
|
|
84
|
+
* @param dirPath - Directory path to check
|
|
85
|
+
* @returns True if inside a Git repository
|
|
86
|
+
*/
|
|
87
|
+
export async function isGitRepository(dirPath) {
|
|
88
|
+
try {
|
|
89
|
+
await execAsync('git rev-parse --git-dir', {
|
|
90
|
+
cwd: dirPath,
|
|
91
|
+
encoding: 'utf-8',
|
|
92
|
+
});
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get the root directory of the Git repository
|
|
101
|
+
*
|
|
102
|
+
* @param dirPath - Directory path inside the repository
|
|
103
|
+
* @returns Root directory of the Git repository
|
|
104
|
+
*/
|
|
105
|
+
export async function getGitRoot(dirPath) {
|
|
106
|
+
try {
|
|
107
|
+
const { stdout } = await execAsync('git rev-parse --show-toplevel', {
|
|
108
|
+
cwd: dirPath,
|
|
109
|
+
encoding: 'utf-8',
|
|
110
|
+
});
|
|
111
|
+
return stdout.trim();
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
const err = error;
|
|
115
|
+
throw new Error(`Failed to get Git root: ${err.message}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=staged-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staged-files.js","sourceRoot":"","sources":["../../src/git/staged-files.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAe;IAClD,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,kDAAkD,EAAE;YACrF,GAAG,EAAE,OAAO;YACZ,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,MAAM;aACjB,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,C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face for Drift
|
|
3
|
+
*
|
|
4
|
+
* This package provides CLI commands:
|
|
5
|
+
* - drift init: Initialize Drift in a project
|
|
6
|
+
* - drift scan: Scan codebase for patterns
|
|
7
|
+
* - drift check: Check for violations
|
|
8
|
+
* - drift status: Show current drift status
|
|
9
|
+
* - drift approve: Approve a pattern
|
|
10
|
+
* - drift ignore: Ignore a pattern
|
|
11
|
+
* - drift report: Generate reports
|
|
12
|
+
*/
|
|
13
|
+
export declare const VERSION: string;
|
|
14
|
+
export * from './types/index.js';
|
|
15
|
+
export * from './ui/index.js';
|
|
16
|
+
export { initCommand, scanCommand, checkCommand, statusCommand, approveCommand, ignoreCommand, reportCommand, } from './commands/index.js';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @drift/cli - Command-line interface for Drift
|
|
3
|
+
*
|
|
4
|
+
* This package provides CLI commands:
|
|
5
|
+
* - drift init: Initialize Drift in a project
|
|
6
|
+
* - drift scan: Scan codebase for patterns
|
|
7
|
+
* - drift check: Check for violations
|
|
8
|
+
* - drift status: Show current drift status
|
|
9
|
+
* - drift approve: Approve a pattern
|
|
10
|
+
* - drift ignore: Ignore a pattern
|
|
11
|
+
* - drift report: Generate reports
|
|
12
|
+
*/
|
|
13
|
+
import { createRequire } from 'node:module';
|
|
14
|
+
// Read version from package.json to avoid hardcoding
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
const pkg = require('../package.json');
|
|
17
|
+
export const VERSION = pkg.version;
|
|
18
|
+
// Type exports
|
|
19
|
+
export * from './types/index.js';
|
|
20
|
+
// UI exports
|
|
21
|
+
export * from './ui/index.js';
|
|
22
|
+
// Command exports (for programmatic use)
|
|
23
|
+
export { initCommand, scanCommand, checkCommand, statusCommand, approveCommand, ignoreCommand, reportCommand, } from './commands/index.js';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,qDAAqD;AACrD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAC9D,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;AAEnC,eAAe;AACf,cAAc,kBAAkB,CAAC;AAEjC,aAAa;AACb,cAAc,eAAe,CAAC;AAE9B,yCAAyC;AACzC,OAAO,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,qBAAqB,CAAC"}
|
|
@@ -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,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.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -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,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Reporter - Machine-readable JSON output
|
|
3
|
+
*
|
|
4
|
+
* @requirements 30.1
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* JSON reporter for machine-readable output
|
|
8
|
+
*/
|
|
9
|
+
export class JsonReporter {
|
|
10
|
+
generate(data) {
|
|
11
|
+
const output = {
|
|
12
|
+
violations: data.violations.map((v) => ({
|
|
13
|
+
id: v.id,
|
|
14
|
+
patternId: v.patternId,
|
|
15
|
+
severity: v.severity,
|
|
16
|
+
file: v.file,
|
|
17
|
+
line: v.range.start.line,
|
|
18
|
+
column: v.range.start.character,
|
|
19
|
+
endLine: v.range.end.line,
|
|
20
|
+
endColumn: v.range.end.character,
|
|
21
|
+
message: v.message,
|
|
22
|
+
explanation: v.explanation,
|
|
23
|
+
expected: v.expected,
|
|
24
|
+
actual: v.actual,
|
|
25
|
+
})),
|
|
26
|
+
summary: {
|
|
27
|
+
total: data.summary.total,
|
|
28
|
+
errors: data.summary.errors,
|
|
29
|
+
warnings: data.summary.warnings,
|
|
30
|
+
infos: data.summary.infos,
|
|
31
|
+
hints: data.summary.hints,
|
|
32
|
+
},
|
|
33
|
+
patterns: data.patterns.map((p) => ({
|
|
34
|
+
id: p.id,
|
|
35
|
+
name: p.name,
|
|
36
|
+
category: p.category,
|
|
37
|
+
severity: p.severity,
|
|
38
|
+
})),
|
|
39
|
+
timestamp: data.timestamp,
|
|
40
|
+
};
|
|
41
|
+
return JSON.stringify(output, null, 2);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=json-reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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;gBACR,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,QAAQ,EAAE,CAAC,CAAC,QAAQ;gBACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;aACrB,CAAC,CAAC;YACH,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/reporters/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 type { BoundaryScanResult } from 'driftdetect-core';
|
|
9
|
+
export interface BoundaryScannerConfig {
|
|
10
|
+
rootDir: string;
|
|
11
|
+
verbose?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class BoundaryScanner {
|
|
14
|
+
private config;
|
|
15
|
+
private store;
|
|
16
|
+
constructor(config: BoundaryScannerConfig);
|
|
17
|
+
initialize(): Promise<void>;
|
|
18
|
+
scanFiles(files: string[]): Promise<BoundaryScanResult>;
|
|
19
|
+
getStore(): BoundaryStore;
|
|
20
|
+
}
|
|
21
|
+
export declare function createBoundaryScanner(config: BoundaryScannerConfig): BoundaryScanner;
|
|
22
|
+
//# sourceMappingURL=boundary-scanner.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Service Factory for CLI
|
|
3
|
+
*
|
|
4
|
+
* Provides a convenient way to create a PatternService from the CLI context.
|
|
5
|
+
* This enables CLI commands to use the new unified pattern system.
|
|
6
|
+
*
|
|
7
|
+
* @module services/pattern-service-factory
|
|
8
|
+
*/
|
|
9
|
+
import { PatternStore, type IPatternService } from 'driftdetect-core';
|
|
10
|
+
/**
|
|
11
|
+
* Create a PatternService for CLI commands.
|
|
12
|
+
*
|
|
13
|
+
* The service auto-initializes on first use, so you don't need to
|
|
14
|
+
* call initialize() manually.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const service = createCLIPatternService(rootDir);
|
|
19
|
+
* const status = await service.getStatus();
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @param rootDir The project root directory
|
|
23
|
+
* @returns A PatternService instance
|
|
24
|
+
*/
|
|
25
|
+
export declare function createCLIPatternService(rootDir: string): IPatternService;
|
|
26
|
+
/**
|
|
27
|
+
* Create both a PatternStore and PatternService for CLI commands
|
|
28
|
+
* that need access to both (for backward compatibility during migration).
|
|
29
|
+
*
|
|
30
|
+
* @param rootDir The project root directory
|
|
31
|
+
* @returns Both the store and service
|
|
32
|
+
*/
|
|
33
|
+
export declare function createCLIPatternStoreAndService(rootDir: string): {
|
|
34
|
+
store: PatternStore;
|
|
35
|
+
service: IPatternService;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=pattern-service-factory.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Service Factory for CLI
|
|
3
|
+
*
|
|
4
|
+
* Provides a convenient way to create a PatternService from the CLI context.
|
|
5
|
+
* This enables CLI commands to use the new unified pattern system.
|
|
6
|
+
*
|
|
7
|
+
* @module services/pattern-service-factory
|
|
8
|
+
*/
|
|
9
|
+
import { PatternStore, createPatternServiceFromStore, } from 'driftdetect-core';
|
|
10
|
+
/**
|
|
11
|
+
* Create a PatternService for CLI commands.
|
|
12
|
+
*
|
|
13
|
+
* The service auto-initializes on first use, so you don't need to
|
|
14
|
+
* call initialize() manually.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const service = createCLIPatternService(rootDir);
|
|
19
|
+
* const status = await service.getStatus();
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @param rootDir The project root directory
|
|
23
|
+
* @returns A PatternService instance
|
|
24
|
+
*/
|
|
25
|
+
export function createCLIPatternService(rootDir) {
|
|
26
|
+
const store = new PatternStore({ rootDir });
|
|
27
|
+
return createPatternServiceFromStore(store, rootDir);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create both a PatternStore and PatternService for CLI commands
|
|
31
|
+
* that need access to both (for backward compatibility during migration).
|
|
32
|
+
*
|
|
33
|
+
* @param rootDir The project root directory
|
|
34
|
+
* @returns Both the store and service
|
|
35
|
+
*/
|
|
36
|
+
export function createCLIPatternStoreAndService(rootDir) {
|
|
37
|
+
const store = new PatternStore({ rootDir });
|
|
38
|
+
const service = createPatternServiceFromStore(store, rootDir);
|
|
39
|
+
return { store, service };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=pattern-service-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-service-factory.js","sourceRoot":"","sources":["../../src/services/pattern-service-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,YAAY,EACZ,6BAA6B,GAE9B,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5C,OAAO,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,+BAA+B,CAAC,OAAe;IAI7D,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9D,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC"}
|