@gitguard/cli 1.1.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/LICENSE +21 -0
- package/README.md +356 -0
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +135 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +2 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +26 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/scan.d.ts +14 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +85 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/whoami.d.ts +2 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +46 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api-client.d.ts +21 -0
- package/dist/lib/api-client.d.ts.map +1 -0
- package/dist/lib/api-client.js +54 -0
- package/dist/lib/api-client.js.map +1 -0
- package/dist/lib/config.d.ts +19 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +93 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/file-scanner.d.ts +6 -0
- package/dist/lib/file-scanner.d.ts.map +1 -0
- package/dist/lib/file-scanner.js +131 -0
- package/dist/lib/file-scanner.js.map +1 -0
- package/dist/lib/repo-detector.d.ts +6 -0
- package/dist/lib/repo-detector.d.ts.map +1 -0
- package/dist/lib/repo-detector.js +116 -0
- package/dist/lib/repo-detector.js.map +1 -0
- package/dist/lib/reporter.d.ts +18 -0
- package/dist/lib/reporter.d.ts.map +1 -0
- package/dist/lib/reporter.js +178 -0
- package/dist/lib/reporter.js.map +1 -0
- package/dist/types/index.d.ts +70 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Reporter = void 0;
|
|
4
|
+
const COLORS = {
|
|
5
|
+
reset: '\x1b[0m',
|
|
6
|
+
bright: '\x1b[1m',
|
|
7
|
+
dim: '\x1b[2m',
|
|
8
|
+
red: '\x1b[31m',
|
|
9
|
+
green: '\x1b[32m',
|
|
10
|
+
yellow: '\x1b[33m',
|
|
11
|
+
blue: '\x1b[34m',
|
|
12
|
+
cyan: '\x1b[36m',
|
|
13
|
+
};
|
|
14
|
+
class Reporter {
|
|
15
|
+
useColors;
|
|
16
|
+
config;
|
|
17
|
+
constructor(config, useColors = true) {
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.useColors = useColors && process.stdout.isTTY;
|
|
20
|
+
}
|
|
21
|
+
color(text, color) {
|
|
22
|
+
if (!this.useColors) {
|
|
23
|
+
return text;
|
|
24
|
+
}
|
|
25
|
+
return `${COLORS[color]}${text}${COLORS.reset}`;
|
|
26
|
+
}
|
|
27
|
+
success(message) {
|
|
28
|
+
console.log(this.color('✓ ', 'green') + message);
|
|
29
|
+
}
|
|
30
|
+
error(message) {
|
|
31
|
+
console.error(this.color('✗ ', 'red') + message);
|
|
32
|
+
}
|
|
33
|
+
warning(message) {
|
|
34
|
+
console.warn(this.color('⚠ ', 'yellow') + message);
|
|
35
|
+
}
|
|
36
|
+
info(message) {
|
|
37
|
+
console.log(this.color('ℹ ', 'blue') + message);
|
|
38
|
+
}
|
|
39
|
+
reportScan(result) {
|
|
40
|
+
console.log(this.color('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━', 'dim'));
|
|
41
|
+
console.log(this.color(' GitGuard Security Scan Results', 'bright'));
|
|
42
|
+
console.log(this.color('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n', 'dim'));
|
|
43
|
+
// Show scan metadata
|
|
44
|
+
console.log(this.color(`Files scanned: ${result.filesScanned}`, 'dim'));
|
|
45
|
+
console.log(this.color(`Duration: ${(result.duration / 1000).toFixed(2)}s`, 'dim'));
|
|
46
|
+
// Show enhanced features status
|
|
47
|
+
const hasAI = result.vulnerabilities.some(v => v.aiRemediation);
|
|
48
|
+
const preferences = this.config.getPreferences();
|
|
49
|
+
if (hasAI) {
|
|
50
|
+
console.log(this.color('AI-Enhanced: Yes', 'cyan'));
|
|
51
|
+
}
|
|
52
|
+
if (preferences.dependencyScanEnabled) {
|
|
53
|
+
console.log(this.color('Dependency Scan: Enabled', 'cyan'));
|
|
54
|
+
}
|
|
55
|
+
if (preferences.secretScanEnabled) {
|
|
56
|
+
console.log(this.color('Secret Scan: Enabled', 'cyan'));
|
|
57
|
+
}
|
|
58
|
+
console.log();
|
|
59
|
+
if (result.vulnerabilities.length === 0) {
|
|
60
|
+
this.success('No vulnerabilities found');
|
|
61
|
+
console.log(this.color('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n', 'dim'));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const { summary } = result;
|
|
65
|
+
console.log(this.color(`Found ${result.vulnerabilities.length} issue(s):`, 'bright'));
|
|
66
|
+
if (summary.critical > 0) {
|
|
67
|
+
console.log(this.color(` CRITICAL: ${summary.critical}`, 'red'));
|
|
68
|
+
}
|
|
69
|
+
if (summary.high > 0) {
|
|
70
|
+
console.log(this.color(` HIGH: ${summary.high}`, 'red'));
|
|
71
|
+
}
|
|
72
|
+
if (summary.medium > 0) {
|
|
73
|
+
console.log(this.color(` MEDIUM: ${summary.medium}`, 'yellow'));
|
|
74
|
+
}
|
|
75
|
+
if (summary.low > 0) {
|
|
76
|
+
console.log(this.color(` LOW: ${summary.low}`, 'blue'));
|
|
77
|
+
}
|
|
78
|
+
if (summary.info > 0) {
|
|
79
|
+
console.log(this.color(` INFO: ${summary.info}`, 'cyan'));
|
|
80
|
+
}
|
|
81
|
+
console.log();
|
|
82
|
+
const sorted = this.sortBySeverity(result.vulnerabilities);
|
|
83
|
+
for (const vuln of sorted.slice(0, 10)) {
|
|
84
|
+
this.reportVulnerability(vuln);
|
|
85
|
+
}
|
|
86
|
+
if (result.vulnerabilities.length > 10) {
|
|
87
|
+
console.log(this.color(`\n... and ${result.vulnerabilities.length - 10} more issue(s)\n`, 'dim'));
|
|
88
|
+
}
|
|
89
|
+
console.log(this.color('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━', 'dim'));
|
|
90
|
+
console.log(this.color(`View full results: ${this.config.get().apiUrl.replace('/api/v1', '')}/dashboard/scans?scan=${result.scanId}`, 'cyan'));
|
|
91
|
+
console.log(this.color('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n', 'dim'));
|
|
92
|
+
}
|
|
93
|
+
reportVulnerability(vuln) {
|
|
94
|
+
const severityColor = this.getSeverityColor(vuln.severity);
|
|
95
|
+
const severityLabel = vuln.severity.toUpperCase().padEnd(8);
|
|
96
|
+
// Header with severity and type
|
|
97
|
+
console.log(this.color('┌─', 'dim') + this.color(` ${severityLabel}`, severityColor) + this.color('─────────────────────────────────────────', 'dim'));
|
|
98
|
+
console.log(this.color('│ ', 'dim') + this.color(vuln.type, 'bright'));
|
|
99
|
+
console.log(this.color('│ ', 'dim') + this.color(`${vuln.file}:${vuln.line}`, 'cyan'));
|
|
100
|
+
console.log(this.color('├─────────────────────────────────────────────────────', 'dim'));
|
|
101
|
+
// Description
|
|
102
|
+
console.log(this.color('│ ', 'dim') + this.color('Description:', 'bright'));
|
|
103
|
+
const descLines = this.wrapText(vuln.description, 50);
|
|
104
|
+
for (const line of descLines) {
|
|
105
|
+
console.log(this.color('│ ', 'dim') + ` ${line}`);
|
|
106
|
+
}
|
|
107
|
+
// Code snippet if available
|
|
108
|
+
if (vuln.code) {
|
|
109
|
+
console.log(this.color('│ ', 'dim'));
|
|
110
|
+
console.log(this.color('│ ', 'dim') + this.color('Code:', 'bright'));
|
|
111
|
+
const codeLines = vuln.code.split('\n');
|
|
112
|
+
for (const line of codeLines.slice(0, 3)) {
|
|
113
|
+
if (line.trim()) {
|
|
114
|
+
console.log(this.color('│ ', 'dim') + this.color(` ${line.trim().substring(0, 50)}`, 'dim'));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Standard remediation
|
|
119
|
+
if (vuln.remediation) {
|
|
120
|
+
console.log(this.color('│ ', 'dim'));
|
|
121
|
+
console.log(this.color('│ ', 'dim') + this.color('How to fix:', 'bright'));
|
|
122
|
+
const remLines = this.wrapText(vuln.remediation, 50);
|
|
123
|
+
for (const line of remLines.slice(0, 5)) {
|
|
124
|
+
console.log(this.color('│ ', 'dim') + ` ${line}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// AI remediation if available
|
|
128
|
+
if (vuln.aiRemediation) {
|
|
129
|
+
console.log(this.color('│ ', 'dim'));
|
|
130
|
+
console.log(this.color('│ ', 'dim') + this.color('AI Suggestion:', 'cyan') + this.color(' ✨', 'bright'));
|
|
131
|
+
const aiLines = this.wrapText(vuln.aiRemediation, 50);
|
|
132
|
+
for (const line of aiLines.slice(0, 5)) {
|
|
133
|
+
console.log(this.color('│ ', 'dim') + ` ${line}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
console.log(this.color('└─────────────────────────────────────────────────────', 'dim'));
|
|
137
|
+
console.log();
|
|
138
|
+
}
|
|
139
|
+
wrapText(text, maxWidth) {
|
|
140
|
+
const words = text.split(' ');
|
|
141
|
+
const lines = [];
|
|
142
|
+
let currentLine = '';
|
|
143
|
+
for (const word of words) {
|
|
144
|
+
if ((currentLine + ' ' + word).length <= maxWidth) {
|
|
145
|
+
currentLine = currentLine ? currentLine + ' ' + word : word;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
if (currentLine)
|
|
149
|
+
lines.push(currentLine);
|
|
150
|
+
currentLine = word;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (currentLine)
|
|
154
|
+
lines.push(currentLine);
|
|
155
|
+
return lines;
|
|
156
|
+
}
|
|
157
|
+
getSeverityColor(severity) {
|
|
158
|
+
switch (severity) {
|
|
159
|
+
case 'critical':
|
|
160
|
+
case 'high':
|
|
161
|
+
return 'red';
|
|
162
|
+
case 'medium':
|
|
163
|
+
return 'yellow';
|
|
164
|
+
case 'low':
|
|
165
|
+
return 'blue';
|
|
166
|
+
case 'info':
|
|
167
|
+
return 'cyan';
|
|
168
|
+
default:
|
|
169
|
+
return 'reset';
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
sortBySeverity(vulnerabilities) {
|
|
173
|
+
const order = { critical: 0, high: 1, medium: 2, low: 3, info: 4 };
|
|
174
|
+
return [...vulnerabilities].sort((a, b) => order[a.severity] - order[b.severity]);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.Reporter = Reporter;
|
|
178
|
+
//# sourceMappingURL=reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../../src/lib/reporter.ts"],"names":[],"mappings":";;;AAGA,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,MAAa,QAAQ;IACX,SAAS,CAAU;IACnB,MAAM,CAAgB;IAE9B,YAAY,MAAqB,EAAE,YAAqB,IAAI;QAC1D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,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;gBACX,OAAO,QAAQ,CAAC;YAClB,KAAK,KAAK;gBACR,OAAO,MAAM,CAAC;YAChB,KAAK,MAAM;gBACT,OAAO,MAAM,CAAC;YAChB;gBACE,OAAO,OAAO,CAAC;QACnB,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,eAAgC;QACrD,MAAM,KAAK,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACnE,OAAO,CAAC,GAAG,eAAe,CAAC,CAAC,IAAI,CAC9B,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAChD,CAAC;IACJ,CAAC;CACF;AAvMD,4BAuMC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface Config {
|
|
2
|
+
apiUrl: string;
|
|
3
|
+
apiToken?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
subscription?: 'free' | 'pro' | 'premier';
|
|
6
|
+
preferences?: {
|
|
7
|
+
aiScanEnabled?: boolean;
|
|
8
|
+
dependencyScanEnabled?: boolean;
|
|
9
|
+
secretScanEnabled?: boolean;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface AuthResponse {
|
|
13
|
+
token: string;
|
|
14
|
+
user: {
|
|
15
|
+
id: string;
|
|
16
|
+
email: string;
|
|
17
|
+
subscription: 'free' | 'pro' | 'premier';
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface ScanRequest {
|
|
21
|
+
files: Record<string, string>;
|
|
22
|
+
repository?: string;
|
|
23
|
+
options?: {
|
|
24
|
+
includeAI?: boolean;
|
|
25
|
+
includeDependencies?: boolean;
|
|
26
|
+
includeSecrets?: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface Vulnerability {
|
|
30
|
+
id: string;
|
|
31
|
+
severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
|
|
32
|
+
type: string;
|
|
33
|
+
file: string;
|
|
34
|
+
line: number;
|
|
35
|
+
code?: string;
|
|
36
|
+
description: string;
|
|
37
|
+
remediation?: string;
|
|
38
|
+
aiRemediation?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ScanResponse {
|
|
41
|
+
scanId: string;
|
|
42
|
+
status: 'completed' | 'failed' | 'processing';
|
|
43
|
+
vulnerabilities: Vulnerability[];
|
|
44
|
+
summary: {
|
|
45
|
+
total: number;
|
|
46
|
+
critical: number;
|
|
47
|
+
high: number;
|
|
48
|
+
medium: number;
|
|
49
|
+
low: number;
|
|
50
|
+
info: number;
|
|
51
|
+
};
|
|
52
|
+
filesScanned: number;
|
|
53
|
+
duration: number;
|
|
54
|
+
}
|
|
55
|
+
export interface UserProfile {
|
|
56
|
+
id: string;
|
|
57
|
+
email: string;
|
|
58
|
+
subscription: 'free' | 'pro' | 'premier';
|
|
59
|
+
limits: {
|
|
60
|
+
dailyScans: number;
|
|
61
|
+
scansRemaining: number;
|
|
62
|
+
resetsAt: string;
|
|
63
|
+
};
|
|
64
|
+
preferences: {
|
|
65
|
+
aiScanEnabled: boolean;
|
|
66
|
+
dependencyScanEnabled: boolean;
|
|
67
|
+
secretScanEnabled: boolean;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IAC1C,WAAW,CAAC,EAA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AAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IACzC,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,WAAW,EAAE;QACX,aAAa,EAAE,OAAO,CAAC;QACvB,qBAAqB,EAAE,OAAO,CAAC;QAC/B,iBAAiB,EAAE,OAAO,CAAC;KAC5B,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gitguard/cli",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "GitGuard CLI - Security scanning for developers",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"gitguard": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"dev": "tsx src/index.ts",
|
|
12
|
+
"prepublishOnly": "yarn build",
|
|
13
|
+
"test": "echo \"Tests coming soon\""
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"security",
|
|
17
|
+
"scanner",
|
|
18
|
+
"cli",
|
|
19
|
+
"vulnerability",
|
|
20
|
+
"code-analysis",
|
|
21
|
+
"static-analysis"
|
|
22
|
+
],
|
|
23
|
+
"author": "GitGuard",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/git-guard/gitguard-cli.git"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/git-guard/gitguard-cli/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://gitguard.net",
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18.0.0"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"axios": "^1.7.7",
|
|
38
|
+
"commander": "^14.0.2",
|
|
39
|
+
"ignore": "^7.0.5",
|
|
40
|
+
"open": "^8.4.2"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.0.0",
|
|
44
|
+
"tsx": "^4.20.0",
|
|
45
|
+
"typescript": "^5.6.0"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"dist",
|
|
49
|
+
"LICENSE",
|
|
50
|
+
"README.md"
|
|
51
|
+
]
|
|
52
|
+
}
|