@vibedrift/cli 0.5.1 → 0.5.3
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/index.js +46 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4318,35 +4318,47 @@ var complexityAnalyzer = {
|
|
|
4318
4318
|
const fns = file.tree ? extractFunctions(file.tree.rootNode, file.relativePath, file.language) : extractFunctionsRegex(file.content, file.relativePath);
|
|
4319
4319
|
allFunctions.push(...fns);
|
|
4320
4320
|
}
|
|
4321
|
-
const
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
})
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
}
|
|
4348
|
-
|
|
4349
|
-
|
|
4321
|
+
for (const fn of allFunctions) {
|
|
4322
|
+
if (fn.complexity > 20) {
|
|
4323
|
+
findings.push({
|
|
4324
|
+
analyzerId: "complexity",
|
|
4325
|
+
severity: "error",
|
|
4326
|
+
confidence: 0.9,
|
|
4327
|
+
message: `Function "${fn.name}" has cyclomatic complexity ${fn.complexity} (threshold: 20)`,
|
|
4328
|
+
locations: [{
|
|
4329
|
+
file: fn.file,
|
|
4330
|
+
line: fn.line,
|
|
4331
|
+
snippet: `${fn.name}() \u2014 ${fn.lineCount} lines, complexity ${fn.complexity}`
|
|
4332
|
+
}],
|
|
4333
|
+
tags: ["complexity", "critical"]
|
|
4334
|
+
});
|
|
4335
|
+
} else if (fn.complexity > 15) {
|
|
4336
|
+
findings.push({
|
|
4337
|
+
analyzerId: "complexity",
|
|
4338
|
+
severity: "warning",
|
|
4339
|
+
confidence: 0.75,
|
|
4340
|
+
message: `Function "${fn.name}" has cyclomatic complexity ${fn.complexity} (threshold: 15)`,
|
|
4341
|
+
locations: [{
|
|
4342
|
+
file: fn.file,
|
|
4343
|
+
line: fn.line,
|
|
4344
|
+
snippet: `${fn.name}() \u2014 ${fn.lineCount} lines, complexity ${fn.complexity}`
|
|
4345
|
+
}],
|
|
4346
|
+
tags: ["complexity", "high"]
|
|
4347
|
+
});
|
|
4348
|
+
} else if (fn.complexity > 10) {
|
|
4349
|
+
findings.push({
|
|
4350
|
+
analyzerId: "complexity",
|
|
4351
|
+
severity: "info",
|
|
4352
|
+
confidence: 0.5,
|
|
4353
|
+
message: `Function "${fn.name}" has cyclomatic complexity ${fn.complexity} (threshold: 10)`,
|
|
4354
|
+
locations: [{
|
|
4355
|
+
file: fn.file,
|
|
4356
|
+
line: fn.line,
|
|
4357
|
+
snippet: `${fn.name}() \u2014 ${fn.lineCount} lines, complexity ${fn.complexity}`
|
|
4358
|
+
}],
|
|
4359
|
+
tags: ["complexity", "moderate"]
|
|
4360
|
+
});
|
|
4361
|
+
}
|
|
4350
4362
|
}
|
|
4351
4363
|
if (allFunctions.length > 0) {
|
|
4352
4364
|
const avgComplexity = allFunctions.reduce((s, f) => s + f.complexity, 0) / allFunctions.length;
|
|
@@ -8520,7 +8532,7 @@ async function resolveAuthAndBanner(options) {
|
|
|
8520
8532
|
console.error("");
|
|
8521
8533
|
console.error(chalk2.red(" \u2717 Deep scans require a VibeDrift account."));
|
|
8522
8534
|
console.error("");
|
|
8523
|
-
console.error(chalk2.bgYellow.black.bold(" \u{1F381}
|
|
8535
|
+
console.error(chalk2.bgYellow.black.bold(" \u{1F381} Free accounts get 3 deep scans per month. "));
|
|
8524
8536
|
console.error("");
|
|
8525
8537
|
console.error(" Run " + chalk2.bold("vibedrift login") + " to sign in and claim it.");
|
|
8526
8538
|
console.error(" Or set " + chalk2.bold("VIBEDRIFT_TOKEN") + " in your environment for CI.");
|
|
@@ -8545,15 +8557,15 @@ async function resolveAuthAndBanner(options) {
|
|
|
8545
8557
|
const credits = await fetchCredits(bearerToken, { apiUrl });
|
|
8546
8558
|
if (credits.has_free_deep_scan && !credits.unlimited) {
|
|
8547
8559
|
console.log("");
|
|
8548
|
-
console.log(chalk2.bgYellow.black.bold(" \u{1F381}
|
|
8549
|
-
console.log(chalk2.yellow(" Run with
|
|
8560
|
+
console.log(chalk2.bgYellow.black.bold(" \u{1F381} 3 FREE DEEP SCANS EVERY MONTH "));
|
|
8561
|
+
console.log(chalk2.yellow(" Run with --deep to use AI-powered analysis (3 free per month)."));
|
|
8550
8562
|
console.log("");
|
|
8551
8563
|
}
|
|
8552
8564
|
} catch {
|
|
8553
8565
|
}
|
|
8554
8566
|
} else {
|
|
8555
8567
|
console.log("");
|
|
8556
|
-
console.log(chalk2.dim(" Tip: ") + chalk2.yellow("sign up free
|
|
8568
|
+
console.log(chalk2.dim(" Tip: ") + chalk2.yellow("sign up free \u2014 3 deep scans per month included"));
|
|
8557
8569
|
console.log(chalk2.dim(" Run ") + chalk2.bold("vibedrift login") + chalk2.dim(" to claim it (no card required)."));
|
|
8558
8570
|
console.log("");
|
|
8559
8571
|
}
|
|
@@ -9088,7 +9100,7 @@ async function handleLoginSuccess(result, options) {
|
|
|
9088
9100
|
});
|
|
9089
9101
|
if (credits.has_free_deep_scan && !credits.unlimited) {
|
|
9090
9102
|
console.log(
|
|
9091
|
-
chalk4.bgYellow.black.bold(" \u{1F381}
|
|
9103
|
+
chalk4.bgYellow.black.bold(" \u{1F381} 3 FREE deep scans every month with your account ")
|
|
9092
9104
|
);
|
|
9093
9105
|
console.log("");
|
|
9094
9106
|
console.log(
|