guardrail-cli 1.0.5 → 2.0.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.
- package/README.md +483 -10
- package/dist/commands/baseline.d.ts +7 -0
- package/dist/commands/baseline.d.ts.map +1 -0
- package/dist/commands/baseline.js +79 -0
- package/dist/commands/baseline.js.map +1 -0
- package/dist/commands/cache.d.ts +13 -0
- package/dist/commands/cache.d.ts.map +1 -0
- package/dist/commands/cache.js +165 -0
- package/dist/commands/cache.js.map +1 -0
- package/dist/commands/evidence.d.ts +45 -0
- package/dist/commands/evidence.d.ts.map +1 -0
- package/dist/commands/evidence.js +197 -0
- package/dist/commands/evidence.js.map +1 -0
- package/dist/commands/index.d.ts +8 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +15 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/scan-secrets.d.ts +47 -0
- package/dist/commands/scan-secrets.d.ts.map +1 -0
- package/dist/commands/scan-secrets.js +225 -0
- package/dist/commands/scan-secrets.js.map +1 -0
- package/dist/commands/scan-vulnerabilities-enhanced.d.ts +41 -0
- package/dist/commands/scan-vulnerabilities-enhanced.d.ts.map +1 -0
- package/dist/commands/scan-vulnerabilities-enhanced.js +368 -0
- package/dist/commands/scan-vulnerabilities-enhanced.js.map +1 -0
- package/dist/commands/scan-vulnerabilities-osv.d.ts +58 -0
- package/dist/commands/scan-vulnerabilities-osv.d.ts.map +1 -0
- package/dist/commands/scan-vulnerabilities-osv.js +716 -0
- package/dist/commands/scan-vulnerabilities-osv.js.map +1 -0
- package/dist/commands/scan-vulnerabilities.d.ts +32 -0
- package/dist/commands/scan-vulnerabilities.d.ts.map +1 -0
- package/dist/commands/scan-vulnerabilities.js +283 -0
- package/dist/commands/scan-vulnerabilities.js.map +1 -0
- package/dist/commands/secrets-allowlist.d.ts +7 -0
- package/dist/commands/secrets-allowlist.d.ts.map +1 -0
- package/dist/commands/secrets-allowlist.js +85 -0
- package/dist/commands/secrets-allowlist.js.map +1 -0
- package/dist/fix/applicator.d.ts +44 -0
- package/dist/fix/applicator.d.ts.map +1 -0
- package/dist/fix/applicator.js +144 -0
- package/dist/fix/applicator.js.map +1 -0
- package/dist/fix/backup.d.ts +38 -0
- package/dist/fix/backup.d.ts.map +1 -0
- package/dist/fix/backup.js +154 -0
- package/dist/fix/backup.js.map +1 -0
- package/dist/fix/engine.d.ts +55 -0
- package/dist/fix/engine.d.ts.map +1 -0
- package/dist/fix/engine.js +285 -0
- package/dist/fix/engine.js.map +1 -0
- package/dist/fix/index.d.ts +5 -0
- package/dist/fix/index.d.ts.map +1 -0
- package/dist/fix/index.js +12 -0
- package/dist/fix/index.js.map +1 -0
- package/dist/fix/interactive.d.ts +22 -0
- package/dist/fix/interactive.d.ts.map +1 -0
- package/dist/fix/interactive.js +172 -0
- package/dist/fix/interactive.js.map +1 -0
- package/dist/formatters/index.d.ts +6 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +11 -0
- package/dist/formatters/index.js.map +1 -0
- package/dist/formatters/sarif-enhanced.d.ts +78 -0
- package/dist/formatters/sarif-enhanced.d.ts.map +1 -0
- package/dist/formatters/sarif-enhanced.js +144 -0
- package/dist/formatters/sarif-enhanced.js.map +1 -0
- package/dist/formatters/sarif-v2.d.ts +121 -0
- package/dist/formatters/sarif-v2.d.ts.map +1 -0
- package/dist/formatters/sarif-v2.js +356 -0
- package/dist/formatters/sarif-v2.js.map +1 -0
- package/dist/formatters/sarif.d.ts +72 -0
- package/dist/formatters/sarif.d.ts.map +1 -0
- package/dist/formatters/sarif.js +146 -0
- package/dist/formatters/sarif.js.map +1 -0
- package/dist/index.js +3362 -1397
- package/dist/index.js.map +1 -1
- package/dist/init/ci-generator.d.ts +18 -0
- package/dist/init/ci-generator.d.ts.map +1 -0
- package/dist/init/ci-generator.js +251 -0
- package/dist/init/ci-generator.js.map +1 -0
- package/dist/init/detect-framework.d.ts +15 -0
- package/dist/init/detect-framework.d.ts.map +1 -0
- package/dist/init/detect-framework.js +299 -0
- package/dist/init/detect-framework.js.map +1 -0
- package/dist/init/hooks-installer.d.ts +22 -0
- package/dist/init/hooks-installer.d.ts.map +1 -0
- package/dist/init/hooks-installer.js +302 -0
- package/dist/init/hooks-installer.js.map +1 -0
- package/dist/init/index.d.ts +8 -0
- package/dist/init/index.d.ts.map +1 -0
- package/dist/init/index.js +22 -0
- package/dist/init/index.js.map +1 -0
- package/dist/init/templates.d.ts +401 -0
- package/dist/init/templates.d.ts.map +1 -0
- package/dist/init/templates.js +240 -0
- package/dist/init/templates.js.map +1 -0
- package/dist/reality/reality-runner.d.ts +76 -0
- package/dist/reality/reality-runner.d.ts.map +1 -0
- package/dist/reality/reality-runner.js +454 -0
- package/dist/reality/reality-runner.js.map +1 -0
- package/dist/runtime/auth-utils.d.ts +43 -0
- package/dist/runtime/auth-utils.d.ts.map +1 -0
- package/dist/runtime/auth-utils.js +126 -0
- package/dist/runtime/auth-utils.js.map +1 -0
- package/dist/runtime/client.d.ts +74 -0
- package/dist/runtime/client.d.ts.map +1 -0
- package/dist/runtime/client.js +222 -0
- package/dist/runtime/client.js.map +1 -0
- package/dist/runtime/creds.d.ts +48 -0
- package/dist/runtime/creds.d.ts.map +1 -0
- package/dist/runtime/creds.js +245 -0
- package/dist/runtime/creds.js.map +1 -0
- package/dist/runtime/exit-codes.d.ts +47 -0
- package/dist/runtime/exit-codes.d.ts.map +1 -0
- package/dist/runtime/exit-codes.js +91 -0
- package/dist/runtime/exit-codes.js.map +1 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +25 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/semver.d.ts +37 -0
- package/dist/runtime/semver.d.ts.map +1 -0
- package/dist/runtime/semver.js +110 -0
- package/dist/runtime/semver.js.map +1 -0
- package/dist/scanner/baseline.d.ts +52 -0
- package/dist/scanner/baseline.d.ts.map +1 -0
- package/dist/scanner/baseline.js +85 -0
- package/dist/scanner/baseline.js.map +1 -0
- package/dist/scanner/incremental.d.ts +30 -0
- package/dist/scanner/incremental.d.ts.map +1 -0
- package/dist/scanner/incremental.js +82 -0
- package/dist/scanner/incremental.js.map +1 -0
- package/dist/scanner/parallel.d.ts +43 -0
- package/dist/scanner/parallel.d.ts.map +1 -0
- package/dist/scanner/parallel.js +99 -0
- package/dist/scanner/parallel.js.map +1 -0
- package/dist/ui/frame.d.ts +68 -0
- package/dist/ui/frame.d.ts.map +1 -0
- package/dist/ui/frame.js +165 -0
- package/dist/ui/frame.js.map +1 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +16 -0
- package/dist/ui/index.js.map +1 -0
- package/package.json +42 -9
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Baseline support for suppressing known findings
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BaselineManager = void 0;
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
class BaselineManager {
|
|
10
|
+
/**
|
|
11
|
+
* Generate stable fingerprint for a finding
|
|
12
|
+
* fingerprint = sha256(category + title + file + line + snippetNormalized)
|
|
13
|
+
*/
|
|
14
|
+
static generateFingerprint(finding) {
|
|
15
|
+
const category = finding.category || finding.type || 'unknown';
|
|
16
|
+
const title = finding.title || '';
|
|
17
|
+
const file = finding.file || '';
|
|
18
|
+
const line = finding.line || 0;
|
|
19
|
+
// Normalize snippet by removing whitespace variations
|
|
20
|
+
let snippet = finding.snippet || finding.match || '';
|
|
21
|
+
snippet = snippet.replace(/\s+/g, ' ').trim();
|
|
22
|
+
const data = `${category}:${title}:${file}:${line}:${snippet}`;
|
|
23
|
+
return (0, crypto_1.createHash)('sha256').update(data).digest('hex');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Load baseline from file
|
|
27
|
+
*/
|
|
28
|
+
static loadBaseline(path) {
|
|
29
|
+
if (!(0, fs_1.existsSync)(path)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const content = (0, fs_1.readFileSync)(path, 'utf8');
|
|
34
|
+
return JSON.parse(content);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Save baseline to file
|
|
42
|
+
*/
|
|
43
|
+
static saveBaseline(path, findings) {
|
|
44
|
+
const baseline = {
|
|
45
|
+
version: '1.0.0',
|
|
46
|
+
createdAt: new Date().toISOString(),
|
|
47
|
+
findings: findings.map(f => ({
|
|
48
|
+
fingerprint: this.generateFingerprint(f),
|
|
49
|
+
category: f.category || f.type || 'unknown',
|
|
50
|
+
title: f.title,
|
|
51
|
+
file: f.file,
|
|
52
|
+
line: f.line,
|
|
53
|
+
suppressedAt: new Date().toISOString(),
|
|
54
|
+
})),
|
|
55
|
+
};
|
|
56
|
+
(0, fs_1.writeFileSync)(path, JSON.stringify(baseline, null, 2), 'utf8');
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if a finding is suppressed by baseline
|
|
60
|
+
*/
|
|
61
|
+
static isSuppressed(finding, baseline) {
|
|
62
|
+
if (!baseline) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const fingerprint = this.generateFingerprint(finding);
|
|
66
|
+
return baseline.findings.some(bf => bf.fingerprint === fingerprint);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Filter findings by baseline
|
|
70
|
+
*/
|
|
71
|
+
static filterFindings(findings, baselinePath) {
|
|
72
|
+
if (!baselinePath) {
|
|
73
|
+
return { filtered: findings, suppressed: 0 };
|
|
74
|
+
}
|
|
75
|
+
const baseline = this.loadBaseline(baselinePath);
|
|
76
|
+
if (!baseline) {
|
|
77
|
+
return { filtered: findings, suppressed: 0 };
|
|
78
|
+
}
|
|
79
|
+
const filtered = findings.filter(f => !this.isSuppressed(f, baseline));
|
|
80
|
+
const suppressed = findings.length - filtered.length;
|
|
81
|
+
return { filtered, suppressed };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.BaselineManager = BaselineManager;
|
|
85
|
+
//# sourceMappingURL=baseline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline.js","sourceRoot":"","sources":["../../src/scanner/baseline.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,mCAAoC;AACpC,2BAA6D;AA2B7D,MAAa,eAAe;IAC1B;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,OAAgB;QACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,IAAI,SAAS,CAAC;QAC/D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC;QAE/B,sDAAsD;QACtD,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;QACrD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QAE9C,MAAM,IAAI,GAAG,GAAG,QAAQ,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;QAC/D,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,IAAY;QAC9B,IAAI,CAAC,IAAA,eAA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IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,cAAc,CAAoB,QAAa,EAAE,YAAqB;QAC3E,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;QAC/C,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;QAC/C,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QACvE,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAErD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAClC,CAAC;CACF;AArFD,0CAqFC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Incremental scanning with git diff support
|
|
3
|
+
*/
|
|
4
|
+
export interface IncrementalOptions {
|
|
5
|
+
since?: string;
|
|
6
|
+
projectPath: string;
|
|
7
|
+
}
|
|
8
|
+
export interface IncrementalResult {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
changedFiles: string[];
|
|
11
|
+
baseCommit?: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class IncrementalScanner {
|
|
15
|
+
/**
|
|
16
|
+
* Get list of changed files since a commit
|
|
17
|
+
* Returns all files if not a git repo or if since is not provided
|
|
18
|
+
*/
|
|
19
|
+
static getChangedFiles(options: IncrementalOptions): IncrementalResult;
|
|
20
|
+
/**
|
|
21
|
+
* Filter files to scan based on incremental mode
|
|
22
|
+
* Only applies to secrets scan - vulnerabilities/compliance run full
|
|
23
|
+
*/
|
|
24
|
+
static shouldScanFile(filePath: string, incrementalResult: IncrementalResult): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Get explanation message for incremental mode
|
|
27
|
+
*/
|
|
28
|
+
static getIncrementalMessage(incrementalResult: IncrementalResult): string;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=incremental.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incremental.d.ts","sourceRoot":"","sources":["../../src/scanner/incremental.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,kBAAkB;IAC7B;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,iBAAiB;IA8CtE;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,OAAO;IAWtF;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,MAAM;CAW3E"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Incremental scanning with git diff support
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IncrementalScanner = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
class IncrementalScanner {
|
|
11
|
+
/**
|
|
12
|
+
* Get list of changed files since a commit
|
|
13
|
+
* Returns all files if not a git repo or if since is not provided
|
|
14
|
+
*/
|
|
15
|
+
static getChangedFiles(options) {
|
|
16
|
+
if (!options.since) {
|
|
17
|
+
return {
|
|
18
|
+
enabled: false,
|
|
19
|
+
changedFiles: [],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
// Check if this is a git repository
|
|
23
|
+
const gitDir = (0, path_1.join)(options.projectPath, '.git');
|
|
24
|
+
if (!(0, fs_1.existsSync)(gitDir)) {
|
|
25
|
+
return {
|
|
26
|
+
enabled: false,
|
|
27
|
+
changedFiles: [],
|
|
28
|
+
error: 'Not a git repository',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
// Get changed files using git diff
|
|
33
|
+
const output = (0, child_process_1.execSync)(`git diff --name-only ${options.since}...HEAD`, {
|
|
34
|
+
cwd: options.projectPath,
|
|
35
|
+
encoding: 'utf8',
|
|
36
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
37
|
+
});
|
|
38
|
+
const changedFiles = output
|
|
39
|
+
.split('\n')
|
|
40
|
+
.map(f => f.trim())
|
|
41
|
+
.filter(f => f.length > 0);
|
|
42
|
+
return {
|
|
43
|
+
enabled: true,
|
|
44
|
+
changedFiles,
|
|
45
|
+
baseCommit: options.since,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
// Git command failed (invalid commit, not a repo, etc.)
|
|
50
|
+
return {
|
|
51
|
+
enabled: false,
|
|
52
|
+
changedFiles: [],
|
|
53
|
+
error: error.message || 'Git diff failed',
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Filter files to scan based on incremental mode
|
|
59
|
+
* Only applies to secrets scan - vulnerabilities/compliance run full
|
|
60
|
+
*/
|
|
61
|
+
static shouldScanFile(filePath, incrementalResult) {
|
|
62
|
+
if (!incrementalResult.enabled) {
|
|
63
|
+
return true; // Scan all files if incremental mode disabled
|
|
64
|
+
}
|
|
65
|
+
// Check if file is in changed files list
|
|
66
|
+
return incrementalResult.changedFiles.some(changed => filePath.includes(changed) || changed.includes(filePath));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get explanation message for incremental mode
|
|
70
|
+
*/
|
|
71
|
+
static getIncrementalMessage(incrementalResult) {
|
|
72
|
+
if (!incrementalResult.enabled) {
|
|
73
|
+
return '';
|
|
74
|
+
}
|
|
75
|
+
if (incrementalResult.error) {
|
|
76
|
+
return `Incremental mode disabled: ${incrementalResult.error}`;
|
|
77
|
+
}
|
|
78
|
+
return `Incremental mode: scanning ${incrementalResult.changedFiles.length} changed files since ${incrementalResult.baseCommit}`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.IncrementalScanner = IncrementalScanner;
|
|
82
|
+
//# sourceMappingURL=incremental.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incremental.js","sourceRoot":"","sources":["../../src/scanner/incremental.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iDAAyC;AACzC,2BAAgC;AAChC,+BAA4B;AAc5B,MAAa,kBAAkB;IAC7B;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,OAA2B;QAChD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACnB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,EAAE;aACjB,CAAC;QACJ,CAAC;QAED,oCAAoC;QACpC,MAAM,MAAM,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,IAAA,eAAU,EAAC,MAAM,CAAC,EAAE,CAAC;YACxB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,EA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AqB,CAAC,iBAAoC;QAC/D,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;YAC/B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,iBAAiB,CAAC,KAAK,EAAE,CAAC;YAC5B,OAAO,8BAA8B,iBAAiB,CAAC,KAAK,EAAE,CAAC;QACjE,CAAC;QAED,OAAO,8BAA8B,iBAAiB,CAAC,YAAY,CAAC,MAAM,wBAAwB,iBAAiB,CAAC,UAAU,EAAE,CAAC;IACnI,CAAC;CACF;AAhFD,gDAgFC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parallel scanning orchestrator with multi-stage progress
|
|
3
|
+
*/
|
|
4
|
+
import { ScanSecretsResult } from '../commands/scan-secrets';
|
|
5
|
+
import { ScanVulnResult } from '../commands/scan-vulnerabilities';
|
|
6
|
+
export interface ParallelScanOptions {
|
|
7
|
+
path: string;
|
|
8
|
+
type: 'all' | 'secrets' | 'vulnerabilities' | 'compliance';
|
|
9
|
+
format: 'table' | 'json' | 'sarif' | 'markdown';
|
|
10
|
+
output?: string;
|
|
11
|
+
excludeTests?: boolean;
|
|
12
|
+
minConfidence?: number;
|
|
13
|
+
failOnDetection?: boolean;
|
|
14
|
+
failOnCritical?: boolean;
|
|
15
|
+
failOnHigh?: boolean;
|
|
16
|
+
evidence?: boolean;
|
|
17
|
+
complianceFramework?: string;
|
|
18
|
+
since?: string;
|
|
19
|
+
baseline?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ParallelScanResult {
|
|
22
|
+
secrets?: ScanSecretsResult;
|
|
23
|
+
vulnerabilities?: ScanVulnResult;
|
|
24
|
+
compliance?: any;
|
|
25
|
+
duration: number;
|
|
26
|
+
timestamp: string;
|
|
27
|
+
}
|
|
28
|
+
interface ScanProgress {
|
|
29
|
+
stage: string;
|
|
30
|
+
message: string;
|
|
31
|
+
completed: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare class ParallelScanner {
|
|
34
|
+
private progressCallbacks;
|
|
35
|
+
onProgress(module: string, callback: (progress: ScanProgress) => void): void;
|
|
36
|
+
private updateProgress;
|
|
37
|
+
scan(projectPath: string, options: ParallelScanOptions): Promise<ParallelScanResult>;
|
|
38
|
+
private runSecretsScanner;
|
|
39
|
+
private runVulnerabilitiesScanner;
|
|
40
|
+
private runComplianceScanner;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=parallel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallel.d.ts","sourceRoot":"","sources":["../../src/scanner/parallel.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAe,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAuB,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAEvF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,GAAG,SAAS,GAAG,iBAAiB,GAAG,YAAY,CAAC;IAC3D,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,eAAe,CAAC,EAAE,cAAc,CAAC;IACjC,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,iBAAiB,CAA4D;IAErF,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;IAI5E,OAAO,CAAC,cAAc;IAOhB,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;YA0C5E,iBAAiB;YAkBjB,yBAAyB;YAgBzB,oBAAoB;CAoBnC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parallel scanning orchestrator with multi-stage progress
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ParallelScanner = void 0;
|
|
7
|
+
const scan_secrets_1 = require("../commands/scan-secrets");
|
|
8
|
+
const scan_vulnerabilities_1 = require("../commands/scan-vulnerabilities");
|
|
9
|
+
class ParallelScanner {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.progressCallbacks = new Map();
|
|
12
|
+
}
|
|
13
|
+
onProgress(module, callback) {
|
|
14
|
+
this.progressCallbacks.set(module, callback);
|
|
15
|
+
}
|
|
16
|
+
updateProgress(module, stage, message, completed = false) {
|
|
17
|
+
const callback = this.progressCallbacks.get(module);
|
|
18
|
+
if (callback) {
|
|
19
|
+
callback({ stage, message, completed });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async scan(projectPath, options) {
|
|
23
|
+
const startTime = Date.now();
|
|
24
|
+
const tasks = [];
|
|
25
|
+
const result = {
|
|
26
|
+
duration: 0,
|
|
27
|
+
timestamp: new Date().toISOString(),
|
|
28
|
+
};
|
|
29
|
+
// Secrets scan
|
|
30
|
+
if (options.type === 'all' || options.type === 'secrets') {
|
|
31
|
+
tasks.push(this.runSecretsScanner(projectPath, options).then(res => {
|
|
32
|
+
result.secrets = res;
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
// Vulnerabilities scan
|
|
36
|
+
if (options.type === 'all' || options.type === 'vulnerabilities') {
|
|
37
|
+
tasks.push(this.runVulnerabilitiesScanner(projectPath, options).then(res => {
|
|
38
|
+
result.vulnerabilities = res;
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
// Compliance scan (if selected)
|
|
42
|
+
if (options.type === 'compliance') {
|
|
43
|
+
tasks.push(this.runComplianceScanner(projectPath, options).then(res => {
|
|
44
|
+
result.compliance = res;
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
// Run all scans in parallel
|
|
48
|
+
await Promise.all(tasks);
|
|
49
|
+
result.duration = Date.now() - startTime;
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
async runSecretsScanner(projectPath, options) {
|
|
53
|
+
this.updateProgress('secrets', 'init', 'Initializing secret scanner...');
|
|
54
|
+
this.updateProgress('secrets', 'scan', 'Scanning files for secrets...');
|
|
55
|
+
const result = await (0, scan_secrets_1.scanSecrets)(projectPath, {
|
|
56
|
+
path: projectPath,
|
|
57
|
+
format: options.format,
|
|
58
|
+
output: options.output,
|
|
59
|
+
excludeTests: options.excludeTests || false,
|
|
60
|
+
minConfidence: options.minConfidence,
|
|
61
|
+
failOnDetection: options.failOnDetection || false,
|
|
62
|
+
evidence: options.evidence || false,
|
|
63
|
+
});
|
|
64
|
+
this.updateProgress('secrets', 'complete', `Found ${result.findings.length} secrets`, true);
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
async runVulnerabilitiesScanner(projectPath, options) {
|
|
68
|
+
this.updateProgress('vulnerabilities', 'init', 'Initializing vulnerability scanner...');
|
|
69
|
+
this.updateProgress('vulnerabilities', 'scan', 'Analyzing dependencies...');
|
|
70
|
+
const result = await (0, scan_vulnerabilities_1.scanVulnerabilities)(projectPath, {
|
|
71
|
+
format: options.format,
|
|
72
|
+
output: options.output,
|
|
73
|
+
failOnCritical: options.failOnCritical,
|
|
74
|
+
failOnHigh: options.failOnHigh,
|
|
75
|
+
});
|
|
76
|
+
const total = result.summary.critical + result.summary.high + result.summary.medium + result.summary.low;
|
|
77
|
+
this.updateProgress('vulnerabilities', 'complete', `Found ${total} vulnerabilities`, true);
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
async runComplianceScanner(projectPath, options) {
|
|
81
|
+
this.updateProgress('compliance', 'init', 'Initializing compliance scanner...');
|
|
82
|
+
this.updateProgress('compliance', 'scan', `Running ${options.complianceFramework || 'SOC2'} checks...`);
|
|
83
|
+
// Mock compliance result
|
|
84
|
+
const result = {
|
|
85
|
+
projectPath,
|
|
86
|
+
framework: options.complianceFramework || 'SOC2',
|
|
87
|
+
overallScore: 78,
|
|
88
|
+
categories: [
|
|
89
|
+
{ name: 'Access Control', score: 85, status: 'pass', checks: 12, passed: 10 },
|
|
90
|
+
{ name: 'Data Encryption', score: 92, status: 'pass', checks: 8, passed: 7 },
|
|
91
|
+
{ name: 'Audit Logging', score: 65, status: 'warning', checks: 10, passed: 6 },
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
this.updateProgress('compliance', 'complete', `Score: ${result.overallScore}%`, true);
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.ParallelScanner = ParallelScanner;
|
|
99
|
+
//# sourceMappingURL=parallel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallel.js","sourceRoot":"","sources":["../../src/scanner/parallel.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,2DAA0E;AAC1E,2EAAuF;AAgCvF,MAAa,eAAe;IAA5B;QACU,sBAAiB,GAAkD,IAAI,GAAG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,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;gBAC7E,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;gBAC5E,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;aAC/E;SACF,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,MAAM,CAAC,YAAY,GAAG,EAAE,IAAI,CAAC,CAAC;QACtF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA9GD,0CA8GC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI UI utilities for consistent header rendering across commands.
|
|
3
|
+
*
|
|
4
|
+
* Provides ANSI-safe width calculation and respects NO_COLOR environment variable.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Strip ANSI escape codes from a string for accurate width calculation.
|
|
8
|
+
*/
|
|
9
|
+
export declare function stripAnsi(s: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Pad string to width, accounting for ANSI codes.
|
|
12
|
+
*/
|
|
13
|
+
export declare function padRight(s: string, width: number): string;
|
|
14
|
+
/**
|
|
15
|
+
* Check if colors should be disabled (respects NO_COLOR and --no-color).
|
|
16
|
+
*/
|
|
17
|
+
export declare function isNoColor(): boolean;
|
|
18
|
+
export declare const frameStyles: {
|
|
19
|
+
reset: string;
|
|
20
|
+
bold: string;
|
|
21
|
+
dim: string;
|
|
22
|
+
brightCyan: string;
|
|
23
|
+
brightGreen: string;
|
|
24
|
+
brightYellow: string;
|
|
25
|
+
brightMagenta: string;
|
|
26
|
+
};
|
|
27
|
+
export interface FrameOptions {
|
|
28
|
+
padding?: number;
|
|
29
|
+
title?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Render lines inside a styled frame with ANSI-safe width calculation.
|
|
33
|
+
*/
|
|
34
|
+
export declare function frameLines(lines: string[], opts?: FrameOptions): string[];
|
|
35
|
+
export interface CommandHeaderOptions {
|
|
36
|
+
/** Command title (e.g., "CODE SMELL ANALYSIS") */
|
|
37
|
+
title: string;
|
|
38
|
+
/** Icon to display before title */
|
|
39
|
+
icon: string;
|
|
40
|
+
/** Project name */
|
|
41
|
+
projectName: string;
|
|
42
|
+
/** Project path */
|
|
43
|
+
projectPath: string;
|
|
44
|
+
/** Additional metadata lines (key-value pairs) */
|
|
45
|
+
metadata?: Array<{
|
|
46
|
+
key: string;
|
|
47
|
+
value: string;
|
|
48
|
+
}>;
|
|
49
|
+
/** User tier (free/starter/pro/enterprise) */
|
|
50
|
+
tier?: string;
|
|
51
|
+
/** Whether user is authenticated */
|
|
52
|
+
authenticated?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Truncate path for display, keeping end portion visible.
|
|
56
|
+
*/
|
|
57
|
+
export declare function truncatePath(path: string, maxLength?: number): string;
|
|
58
|
+
/**
|
|
59
|
+
* Render a consistent command header frame with project metadata.
|
|
60
|
+
*
|
|
61
|
+
* Used by scan, ship, smells, and other commands for visual consistency.
|
|
62
|
+
*/
|
|
63
|
+
export declare function renderCommandHeader(opts: CommandHeaderOptions): string;
|
|
64
|
+
/**
|
|
65
|
+
* Print command header to console with surrounding newlines.
|
|
66
|
+
*/
|
|
67
|
+
export declare function printCommandHeader(opts: CommandHeaderOptions): void;
|
|
68
|
+
//# sourceMappingURL=frame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/ui/frame.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;GAEG;AAC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4
|
+
*
|
|
5
|
+
* Provides ANSI-safe width calculation and respects NO_COLOR environment variable.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.frameStyles = void 0;
|
|
9
|
+
exports.stripAnsi = stripAnsi;
|
|
10
|
+
exports.padRight = padRight;
|
|
11
|
+
exports.isNoColor = isNoColor;
|
|
12
|
+
exports.frameLines = frameLines;
|
|
13
|
+
exports.truncatePath = truncatePath;
|
|
14
|
+
exports.renderCommandHeader = renderCommandHeader;
|
|
15
|
+
exports.printCommandHeader = printCommandHeader;
|
|
16
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
17
|
+
// ANSI UTILITIES
|
|
18
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
19
|
+
const ANSI_RE = /\x1b\[[0-9;]*m/g;
|
|
20
|
+
/**
|
|
21
|
+
* Strip ANSI escape codes from a string for accurate width calculation.
|
|
22
|
+
*/
|
|
23
|
+
function stripAnsi(s) {
|
|
24
|
+
return s.replace(ANSI_RE, '');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Pad string to width, accounting for ANSI codes.
|
|
28
|
+
*/
|
|
29
|
+
function padRight(s, width) {
|
|
30
|
+
const len = stripAnsi(s).length;
|
|
31
|
+
if (len >= width)
|
|
32
|
+
return s;
|
|
33
|
+
return s + ' '.repeat(width - len);
|
|
34
|
+
}
|
|
35
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
36
|
+
// COLOR SUPPORT DETECTION
|
|
37
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
38
|
+
/**
|
|
39
|
+
* Check if colors should be disabled (respects NO_COLOR and --no-color).
|
|
40
|
+
*/
|
|
41
|
+
function isNoColor() {
|
|
42
|
+
return !!(process.env.NO_COLOR ||
|
|
43
|
+
process.env.GUARDRAIL_NO_COLOR === '1' ||
|
|
44
|
+
process.argv.includes('--no-color'));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Conditionally apply ANSI style codes based on NO_COLOR setting.
|
|
48
|
+
*/
|
|
49
|
+
function applyStyle(code) {
|
|
50
|
+
return isNoColor() ? '' : code;
|
|
51
|
+
}
|
|
52
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
53
|
+
// STYLE DEFINITIONS
|
|
54
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
55
|
+
exports.frameStyles = {
|
|
56
|
+
reset: '\x1b[0m',
|
|
57
|
+
bold: '\x1b[1m',
|
|
58
|
+
dim: '\x1b[2m',
|
|
59
|
+
brightCyan: '\x1b[96m',
|
|
60
|
+
brightGreen: '\x1b[92m',
|
|
61
|
+
brightYellow: '\x1b[93m',
|
|
62
|
+
brightMagenta: '\x1b[95m',
|
|
63
|
+
};
|
|
64
|
+
function getStyle(key) {
|
|
65
|
+
return applyStyle(exports.frameStyles[key]);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Render lines inside a styled frame with ANSI-safe width calculation.
|
|
69
|
+
*/
|
|
70
|
+
function frameLines(lines, opts) {
|
|
71
|
+
const padding = opts?.padding ?? 1;
|
|
72
|
+
const noColor = isNoColor();
|
|
73
|
+
// Compute inner width based on visible length (ANSI stripped)
|
|
74
|
+
const innerWidth = Math.max(...lines.map((l) => stripAnsi(l).length), ...(opts?.title ? [stripAnsi(opts.title).length] : [0]));
|
|
75
|
+
const contentWidth = innerWidth + padding * 2;
|
|
76
|
+
const borderStyle = noColor ? '' : `${exports.frameStyles.brightCyan}${exports.frameStyles.bold}`;
|
|
77
|
+
const reset = noColor ? '' : exports.frameStyles.reset;
|
|
78
|
+
const top = `${borderStyle}╔${'═'.repeat(contentWidth + 2)}╗${reset}`;
|
|
79
|
+
const bottom = `${borderStyle}╚${'═'.repeat(contentWidth + 2)}╝${reset}`;
|
|
80
|
+
const framed = [];
|
|
81
|
+
framed.push(top);
|
|
82
|
+
// Optional title row
|
|
83
|
+
if (opts?.title) {
|
|
84
|
+
const title = padRight(opts.title, innerWidth);
|
|
85
|
+
framed.push(`${borderStyle}║${reset} ${' '.repeat(padding)}${title}${' '.repeat(padding)} ${borderStyle}║${reset}`);
|
|
86
|
+
framed.push(`${borderStyle}║${reset} ${' '.repeat(contentWidth)} ${borderStyle}║${reset}`);
|
|
87
|
+
}
|
|
88
|
+
for (const line of lines) {
|
|
89
|
+
const padded = padRight(line, innerWidth);
|
|
90
|
+
framed.push(`${borderStyle}║${reset} ${' '.repeat(padding)}${padded}${' '.repeat(padding)} ${borderStyle}║${reset}`);
|
|
91
|
+
}
|
|
92
|
+
framed.push(bottom);
|
|
93
|
+
return framed;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Truncate path for display, keeping end portion visible.
|
|
97
|
+
*/
|
|
98
|
+
function truncatePath(path, maxLength = 60) {
|
|
99
|
+
if (path.length <= maxLength)
|
|
100
|
+
return path;
|
|
101
|
+
const start = path.substring(0, 15);
|
|
102
|
+
const end = path.substring(path.length - (maxLength - 18));
|
|
103
|
+
return `${start}...${end}`;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Format tier badge for display.
|
|
107
|
+
*/
|
|
108
|
+
function formatTierBadge(tier) {
|
|
109
|
+
const noColor = isNoColor();
|
|
110
|
+
const tierUpper = tier.toUpperCase();
|
|
111
|
+
if (noColor) {
|
|
112
|
+
return `[${tierUpper}]`;
|
|
113
|
+
}
|
|
114
|
+
const colors = {
|
|
115
|
+
free: exports.frameStyles.dim,
|
|
116
|
+
starter: exports.frameStyles.brightGreen,
|
|
117
|
+
pro: exports.frameStyles.brightMagenta,
|
|
118
|
+
enterprise: exports.frameStyles.brightCyan,
|
|
119
|
+
};
|
|
120
|
+
const color = colors[tier.toLowerCase()] || exports.frameStyles.dim;
|
|
121
|
+
return `${color}${exports.frameStyles.bold}[${tierUpper}]${exports.frameStyles.reset}`;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Render a consistent command header frame with project metadata.
|
|
125
|
+
*
|
|
126
|
+
* Used by scan, ship, smells, and other commands for visual consistency.
|
|
127
|
+
*/
|
|
128
|
+
function renderCommandHeader(opts) {
|
|
129
|
+
const noColor = isNoColor();
|
|
130
|
+
const reset = noColor ? '' : exports.frameStyles.reset;
|
|
131
|
+
const bold = noColor ? '' : exports.frameStyles.bold;
|
|
132
|
+
const dim = noColor ? '' : exports.frameStyles.dim;
|
|
133
|
+
const brightCyan = noColor ? '' : exports.frameStyles.brightCyan;
|
|
134
|
+
const headerLines = [];
|
|
135
|
+
// Title line with icon
|
|
136
|
+
headerLines.push(`${brightCyan}${bold}${opts.icon} ${opts.title}${reset}`);
|
|
137
|
+
headerLines.push('');
|
|
138
|
+
// Project info
|
|
139
|
+
headerLines.push(`${dim}Project:${reset} ${bold}${opts.projectName}${reset}`);
|
|
140
|
+
headerLines.push(`${dim}Path:${reset} ${truncatePath(opts.projectPath)}`);
|
|
141
|
+
// Additional metadata
|
|
142
|
+
if (opts.metadata) {
|
|
143
|
+
for (const { key, value } of opts.metadata) {
|
|
144
|
+
const paddedKey = key.padEnd(10);
|
|
145
|
+
headerLines.push(`${dim}${paddedKey}:${reset} ${value}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// Started timestamp
|
|
149
|
+
headerLines.push(`${dim}Started:${reset} ${new Date().toLocaleString()}`);
|
|
150
|
+
// Tier badge if authenticated
|
|
151
|
+
if (opts.authenticated && opts.tier) {
|
|
152
|
+
headerLines.push(`${dim}Mode:${reset} ${formatTierBadge(opts.tier)}`);
|
|
153
|
+
}
|
|
154
|
+
const framed = frameLines(headerLines, { padding: 2 });
|
|
155
|
+
return framed.join('\n');
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Print command header to console with surrounding newlines.
|
|
159
|
+
*/
|
|
160
|
+
function printCommandHeader(opts) {
|
|
161
|
+
console.log('');
|
|
162
|
+
console.log(renderCommandHeader(opts));
|
|
163
|
+
console.log('');
|
|
164
|
+
}
|
|
165
|
+
//# sourceM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AE,CAAC,CAAC;IACvD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,IAA0B;IAC3D,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI UI utilities - shared styling and rendering components.
|
|
3
|
+
*/
|
|
4
|
+
export { stripAnsi, padRight, isNoColor, frameStyles, frameLines, truncatePath, renderCommandHeader, printCommandHeader, type FrameOptions, type CommandHeaderOptions, } from './frame';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,oBAAoB,GAC1B,MAAM,SAAS,CAAC"}
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.printCommandHeader = exports.renderCommandHeader = exports.truncatePath = exports.frameLines = exports.frameStyles = exports.isNoColor = exports.padRight = exports.stripAnsi = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* CLI UI utilities - shared styling and rendering components.
|
|
6
|
+
*/
|
|
7
|
+
var frame_1 = require("./frame");
|
|
8
|
+
Object.defineProperty(exports, "stripAnsi", { enumerable: true, get: function () { return frame_1.stripAnsi; } });
|
|
9
|
+
Object.defineProperty(exports, "padRight", { enumerable: true, get: function () { return frame_1.padRight; } });
|
|
10
|
+
Object.defineProperty(exports, "isNoColor", { enumerable: true, get: function () { return frame_1.isNoColor; } });
|
|
11
|
+
Object.defineProperty(exports, "frameStyles", { enumerable: true, get: function () { return frame_1.frameStyles; } });
|
|
12
|
+
Object.defineProperty(exports, "frameLines", { enumerable: true, get: function () { return frame_1.frameLines; } });
|
|
13
|
+
Object.defineProperty(exports, "truncatePath", { enumerable: true, get: function () { return frame_1.truncatePath; } });
|
|
14
|
+
Object.defineProperty(exports, "renderCommandHeader", { enumerable: true, get: function () { return frame_1.renderCommandHeader; } });
|
|
15
|
+
Object.defineProperty(exports, "printCommandHeader", { enumerable: true, get: function () { return frame_1.printCommandHeader; } });
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,iCAWiB;AAVf,kGAAA,SAAS,OAAA;AACT,iGAAA,QAAQ,OAAA;AACR,kGAAA,SAAS,OAAA;AACT,oGAAA,WAAW,OAAA;AACX,mGAAA,UAAU,OAAA;AACV,qGAAA,YAAY,OAAA;AACZ,4GAAA,mBAAmB,OAAA;AACnB,2GAAA,kBAAkB,OAAA"}
|