@vibecodeqa/cli 0.18.0 → 0.19.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/dist/cli.js +25 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -40,6 +40,7 @@ const skipTests = flags.has("--skip-tests");
|
|
|
40
40
|
const watchMode = flags.has("--watch");
|
|
41
41
|
const badgeMode = flags.has("--badge");
|
|
42
42
|
const sarifMode = flags.has("--sarif");
|
|
43
|
+
const uploadMode = flags.has("--upload");
|
|
43
44
|
function color(grade) {
|
|
44
45
|
if (grade === "A")
|
|
45
46
|
return "\x1b[32m";
|
|
@@ -166,6 +167,30 @@ async function main() {
|
|
|
166
167
|
const { generateSARIF } = await import("./report/sarif.js");
|
|
167
168
|
writeFileSync(join(outputDir, "report.sarif"), generateSARIF(report));
|
|
168
169
|
}
|
|
170
|
+
// Upload to VibeCode QA dashboard
|
|
171
|
+
if (uploadMode) {
|
|
172
|
+
const repo = report.meta.repoUrl?.replace(/^https:\/\/github\.com\//, "") || cwd.split("/").pop() || "project";
|
|
173
|
+
const token = process.env.VCQA_TOKEN || "";
|
|
174
|
+
try {
|
|
175
|
+
const res = await fetch("https://api.vibecodeqa.online/api/reports", {
|
|
176
|
+
method: "POST",
|
|
177
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
178
|
+
body: JSON.stringify({ repo, report }),
|
|
179
|
+
});
|
|
180
|
+
if (res.ok) {
|
|
181
|
+
const data = await res.json();
|
|
182
|
+
if (!jsonOnly)
|
|
183
|
+
console.log(` \x1b[32m\u2713 Uploaded to dashboard\x1b[0m \x1b[2m(${data.totalReports || 1} reports)\x1b[0m`);
|
|
184
|
+
}
|
|
185
|
+
else if (!jsonOnly) {
|
|
186
|
+
console.log(` \x1b[33m\u26a0 Upload failed: ${res.status}\x1b[0m \x1b[2m(set VCQA_TOKEN env var)\x1b[0m`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
if (!jsonOnly)
|
|
191
|
+
console.log(` \x1b[33m\u26a0 Upload failed (network error)\x1b[0m`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
169
194
|
if (jsonOnly) {
|
|
170
195
|
console.log(JSON.stringify(report));
|
|
171
196
|
}
|