@maverick006/vibeguard 1.0.9 → 1.0.11
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/formatter.js +8 -5
- package/dist/index.js +12 -9
- package/package.json +1 -1
- package/src/formatter.ts +8 -5
- package/src/index.ts +14 -10
package/dist/formatter.js
CHANGED
|
@@ -36,9 +36,11 @@ function padVisible(str, targetWidth) {
|
|
|
36
36
|
return str + ' '.repeat(diff);
|
|
37
37
|
}
|
|
38
38
|
function getGitInfo(cwd = process.cwd()) {
|
|
39
|
-
|
|
39
|
+
const resolvedCwd = path_1.default.resolve(cwd);
|
|
40
|
+
let name = path_1.default.basename(resolvedCwd);
|
|
40
41
|
let branch = 'main';
|
|
41
42
|
let commit = '4f2c1ab';
|
|
43
|
+
let remoteUrl = '';
|
|
42
44
|
try {
|
|
43
45
|
const branchOut = (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', { cwd, stdio: ['pipe', 'pipe', 'ignore'] }).toString().trim();
|
|
44
46
|
if (branchOut)
|
|
@@ -52,15 +54,16 @@ function getGitInfo(cwd = process.cwd()) {
|
|
|
52
54
|
}
|
|
53
55
|
catch { }
|
|
54
56
|
try {
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
|
|
57
|
+
const gitRemote = (0, child_process_1.execSync)('git config --get remote.origin.url', { cwd, stdio: ['pipe', 'pipe', 'ignore'] }).toString().trim();
|
|
58
|
+
if (gitRemote) {
|
|
59
|
+
remoteUrl = gitRemote;
|
|
60
|
+
const match = gitRemote.match(/\/([^/]+?)(\.git)?$/);
|
|
58
61
|
if (match && match[1])
|
|
59
62
|
name = match[1];
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
catch { }
|
|
63
|
-
return { name, branch, commit, policy: 'enterprise' };
|
|
66
|
+
return { name, branch, commit, remoteUrl, policy: 'enterprise' };
|
|
64
67
|
}
|
|
65
68
|
function calculateScore(findings) {
|
|
66
69
|
let critical = 0;
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const program = new commander_1.Command();
|
|
|
17
17
|
program
|
|
18
18
|
.name('vibeguard')
|
|
19
19
|
.description('AI-Powered DevSecOps Orchestrator CLI')
|
|
20
|
-
.version('1.0.
|
|
20
|
+
.version('1.0.11');
|
|
21
21
|
program
|
|
22
22
|
.command('scan [path]')
|
|
23
23
|
.description('Run a security scan on the current directory or target path')
|
|
@@ -25,7 +25,7 @@ program
|
|
|
25
25
|
.option('--fix', 'Automatically generate AI remediation fixes and interactive diff')
|
|
26
26
|
.option('--ci', 'Run in non-interactive CI mode and exit with policy status code')
|
|
27
27
|
.action(async (targetPath, options) => {
|
|
28
|
-
const scanDir = targetPath || options.dir || process.cwd();
|
|
28
|
+
const scanDir = (0, path_1.resolve)(targetPath || options.dir || process.cwd());
|
|
29
29
|
const startTime = Date.now();
|
|
30
30
|
let hasSystemError = false;
|
|
31
31
|
// Use a minimal spinner if in CI mode, or bypass ora entirely if preferred.
|
|
@@ -145,8 +145,10 @@ program
|
|
|
145
145
|
isSilent: options.ci
|
|
146
146
|
}).start();
|
|
147
147
|
try {
|
|
148
|
-
const API_URL = process.env.VIBEGUARD_API_URL || '
|
|
149
|
-
const API_KEY = process.env.VIBEGUARD_API_KEY;
|
|
148
|
+
const API_URL = process.env.VIBEGUARD_API_URL || 'https://vibeguard-eep3.onrender.com';
|
|
149
|
+
const API_KEY = process.env.VIBEGUARD_API_KEY || 'dev-api-key-123';
|
|
150
|
+
const repoName = gitInfo.name || 'Local Project';
|
|
151
|
+
const repoUrl = gitInfo.remoteUrl || gitInfo.name || 'local';
|
|
150
152
|
const response = await fetch(`${API_URL}/api/scans/upload`, {
|
|
151
153
|
method: 'POST',
|
|
152
154
|
headers: {
|
|
@@ -154,22 +156,23 @@ program
|
|
|
154
156
|
'Authorization': `Bearer ${API_KEY}`
|
|
155
157
|
},
|
|
156
158
|
body: JSON.stringify({
|
|
157
|
-
repositoryName:
|
|
158
|
-
repositoryUrl:
|
|
159
|
+
repositoryName: repoName,
|
|
160
|
+
repositoryUrl: repoUrl,
|
|
159
161
|
numericScore: stats.score,
|
|
160
162
|
score: stats.riskLevel,
|
|
161
163
|
findings: findings
|
|
162
164
|
})
|
|
163
165
|
});
|
|
164
166
|
if (response.ok) {
|
|
165
|
-
|
|
167
|
+
const dashboardUrl = `https://vibeguard-web-eight.vercel.app/dashboard?repo=${encodeURIComponent(repoName)}`;
|
|
168
|
+
syncSpinner.succeed(chalk_1.default.green(`Results synced to dashboard: ${chalk_1.default.cyan.underline(dashboardUrl)}`));
|
|
166
169
|
}
|
|
167
170
|
else {
|
|
168
|
-
syncSpinner.fail(chalk_1.default.
|
|
171
|
+
syncSpinner.fail(chalk_1.default.red(`Failed to sync results to dashboard (${response.status} ${response.statusText}).`));
|
|
169
172
|
}
|
|
170
173
|
}
|
|
171
174
|
catch (e) {
|
|
172
|
-
syncSpinner.warn(chalk_1.default.
|
|
175
|
+
syncSpinner.warn(chalk_1.default.yellow('Dashboard API unreachable. Skipping sync.'));
|
|
173
176
|
}
|
|
174
177
|
// Exit codes
|
|
175
178
|
if (hasSystemError) {
|
package/package.json
CHANGED
package/src/formatter.ts
CHANGED
|
@@ -40,9 +40,11 @@ function padVisible(str: string, targetWidth: number): string {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export function getGitInfo(cwd: string = process.cwd()) {
|
|
43
|
-
|
|
43
|
+
const resolvedCwd = path.resolve(cwd);
|
|
44
|
+
let name = path.basename(resolvedCwd);
|
|
44
45
|
let branch = 'main';
|
|
45
46
|
let commit = '4f2c1ab';
|
|
47
|
+
let remoteUrl = '';
|
|
46
48
|
|
|
47
49
|
try {
|
|
48
50
|
const branchOut = execSync('git rev-parse --abbrev-ref HEAD', { cwd, stdio: ['pipe', 'pipe', 'ignore'] }).toString().trim();
|
|
@@ -55,14 +57,15 @@ export function getGitInfo(cwd: string = process.cwd()) {
|
|
|
55
57
|
} catch {}
|
|
56
58
|
|
|
57
59
|
try {
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
|
|
60
|
+
const gitRemote = execSync('git config --get remote.origin.url', { cwd, stdio: ['pipe', 'pipe', 'ignore'] }).toString().trim();
|
|
61
|
+
if (gitRemote) {
|
|
62
|
+
remoteUrl = gitRemote;
|
|
63
|
+
const match = gitRemote.match(/\/([^/]+?)(\.git)?$/);
|
|
61
64
|
if (match && match[1]) name = match[1];
|
|
62
65
|
}
|
|
63
66
|
} catch {}
|
|
64
67
|
|
|
65
|
-
return { name, branch, commit, policy: 'enterprise' };
|
|
68
|
+
return { name, branch, commit, remoteUrl, policy: 'enterprise' };
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
export function calculateScore(findings: NormalizedFinding[]): ScanStats {
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import ora from 'ora';
|
|
|
6
6
|
import { ContextualExplainer } from '@maverick006/ai-engine';
|
|
7
7
|
import { NormalizedFinding, Severity } from '@maverick006/types';
|
|
8
8
|
import { readFileSync, existsSync } from 'fs';
|
|
9
|
-
import { join } from 'path';
|
|
9
|
+
import { join, resolve } from 'path';
|
|
10
10
|
import { renderDashboard, calculateScore, getGitInfo } from './formatter';
|
|
11
11
|
|
|
12
12
|
const program = new Command();
|
|
@@ -14,7 +14,7 @@ const program = new Command();
|
|
|
14
14
|
program
|
|
15
15
|
.name('vibeguard')
|
|
16
16
|
.description('AI-Powered DevSecOps Orchestrator CLI')
|
|
17
|
-
.version('1.0.
|
|
17
|
+
.version('1.0.11');
|
|
18
18
|
|
|
19
19
|
program
|
|
20
20
|
.command('scan [path]')
|
|
@@ -23,7 +23,7 @@ program
|
|
|
23
23
|
.option('--fix', 'Automatically generate AI remediation fixes and interactive diff')
|
|
24
24
|
.option('--ci', 'Run in non-interactive CI mode and exit with policy status code')
|
|
25
25
|
.action(async (targetPath, options) => {
|
|
26
|
-
const scanDir = targetPath || options.dir || process.cwd();
|
|
26
|
+
const scanDir = resolve(targetPath || options.dir || process.cwd());
|
|
27
27
|
const startTime = Date.now();
|
|
28
28
|
let hasSystemError = false;
|
|
29
29
|
|
|
@@ -157,8 +157,11 @@ program
|
|
|
157
157
|
}).start();
|
|
158
158
|
|
|
159
159
|
try {
|
|
160
|
-
const API_URL = process.env.VIBEGUARD_API_URL || '
|
|
161
|
-
const API_KEY = process.env.VIBEGUARD_API_KEY;
|
|
160
|
+
const API_URL = process.env.VIBEGUARD_API_URL || 'https://vibeguard-eep3.onrender.com';
|
|
161
|
+
const API_KEY = process.env.VIBEGUARD_API_KEY || 'dev-api-key-123';
|
|
162
|
+
const repoName = gitInfo.name || 'Local Project';
|
|
163
|
+
const repoUrl = (gitInfo as any).remoteUrl || gitInfo.name || 'local';
|
|
164
|
+
|
|
162
165
|
const response = await fetch(`${API_URL}/api/scans/upload`, {
|
|
163
166
|
method: 'POST',
|
|
164
167
|
headers: {
|
|
@@ -166,8 +169,8 @@ program
|
|
|
166
169
|
'Authorization': `Bearer ${API_KEY}`
|
|
167
170
|
},
|
|
168
171
|
body: JSON.stringify({
|
|
169
|
-
repositoryName:
|
|
170
|
-
repositoryUrl:
|
|
172
|
+
repositoryName: repoName,
|
|
173
|
+
repositoryUrl: repoUrl,
|
|
171
174
|
numericScore: stats.score,
|
|
172
175
|
score: stats.riskLevel,
|
|
173
176
|
findings: findings
|
|
@@ -175,12 +178,13 @@ program
|
|
|
175
178
|
});
|
|
176
179
|
|
|
177
180
|
if (response.ok) {
|
|
178
|
-
|
|
181
|
+
const dashboardUrl = `https://vibeguard-web-eight.vercel.app/dashboard?repo=${encodeURIComponent(repoName)}`;
|
|
182
|
+
syncSpinner.succeed(chalk.green(`Results synced to dashboard: ${chalk.cyan.underline(dashboardUrl)}`));
|
|
179
183
|
} else {
|
|
180
|
-
syncSpinner.fail(chalk.
|
|
184
|
+
syncSpinner.fail(chalk.red(`Failed to sync results to dashboard (${response.status} ${response.statusText}).`));
|
|
181
185
|
}
|
|
182
186
|
} catch (e) {
|
|
183
|
-
syncSpinner.warn(chalk.
|
|
187
|
+
syncSpinner.warn(chalk.yellow('Dashboard API unreachable. Skipping sync.'));
|
|
184
188
|
}
|
|
185
189
|
|
|
186
190
|
// Exit codes
|