@vibgrate/cli 1.0.24 → 1.0.26
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.
|
@@ -1053,13 +1053,15 @@ function formatArchitectureDiagram(arch) {
|
|
|
1053
1053
|
const layer = visibleLayers[i];
|
|
1054
1054
|
const icon = LAYER_ICONS[layer.layer] ?? "\xB7";
|
|
1055
1055
|
const label = LAYER_LABELS[layer.layer] ?? layer.layer;
|
|
1056
|
-
const
|
|
1056
|
+
const hasScore = layer.packages.length > 0;
|
|
1057
|
+
const ds = layer.driftScore;
|
|
1058
|
+
const scoreColor = !hasScore ? chalk.dim : ds >= 70 ? chalk.green : ds >= 40 ? chalk.yellow : chalk.red;
|
|
1057
1059
|
const riskBadgeStr = layer.riskLevel === "low" ? chalk.bgGreen.black(" LOW ") : layer.riskLevel === "moderate" ? chalk.bgYellow.black(" MOD ") : chalk.bgRed.white(" HIGH ");
|
|
1058
1060
|
if (i === 0) {
|
|
1059
1061
|
lines.push(chalk.cyan(` \u250C${"\u2500".repeat(boxWidth)}\u2510`));
|
|
1060
1062
|
}
|
|
1061
1063
|
const nameStr = `${icon} ${label}`;
|
|
1062
|
-
const scoreStr = `${layer.driftScore}/100
|
|
1064
|
+
const scoreStr = hasScore ? `${layer.driftScore}/100` : "n/a";
|
|
1063
1065
|
const fileSuffix = `${layer.fileCount} file${layer.fileCount !== 1 ? "s" : ""}`;
|
|
1064
1066
|
const leftContent = ` ${nameStr}`;
|
|
1065
1067
|
const rightContent = `${fileSuffix} ${scoreStr} `;
|
|
@@ -1070,11 +1072,17 @@ function formatArchitectureDiagram(arch) {
|
|
|
1070
1072
|
chalk.cyan(" \u2502") + ` ${icon} ${chalk.bold(label)}` + " ".repeat(padLen) + chalk.dim(fileSuffix) + " " + scoreColor.bold(scoreStr) + " " + chalk.cyan("\u2502")
|
|
1071
1073
|
);
|
|
1072
1074
|
const barWidth = boxWidth - 8;
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
)
|
|
1075
|
+
if (hasScore) {
|
|
1076
|
+
const filled = Math.round(layer.driftScore / 100 * barWidth);
|
|
1077
|
+
const empty = barWidth - filled;
|
|
1078
|
+
lines.push(
|
|
1079
|
+
chalk.cyan(" \u2502") + " " + scoreColor("\u2588".repeat(filled)) + chalk.dim("\u2591".repeat(empty)) + " " + chalk.cyan("\u2502")
|
|
1080
|
+
);
|
|
1081
|
+
} else {
|
|
1082
|
+
lines.push(
|
|
1083
|
+
chalk.cyan(" \u2502") + " " + chalk.dim("\xB7".repeat(barWidth)) + " " + chalk.cyan("\u2502")
|
|
1084
|
+
);
|
|
1085
|
+
}
|
|
1078
1086
|
if (layer.techStack.length > 0) {
|
|
1079
1087
|
const techNames = layer.techStack.slice(0, 6).map((t) => t.name);
|
|
1080
1088
|
const moreCount = layer.techStack.length > 6 ? ` +${layer.techStack.length - 6}` : "";
|
|
@@ -1623,6 +1631,7 @@ async function npmViewJson(args, cwd) {
|
|
|
1623
1631
|
return new Promise((resolve7, reject) => {
|
|
1624
1632
|
const child = spawn("npm", ["view", ...args, "--json"], {
|
|
1625
1633
|
cwd,
|
|
1634
|
+
shell: true,
|
|
1626
1635
|
stdio: ["ignore", "pipe", "pipe"]
|
|
1627
1636
|
});
|
|
1628
1637
|
let out = "";
|
|
@@ -1659,19 +1668,30 @@ var NpmCache = class {
|
|
|
1659
1668
|
if (existing) return existing;
|
|
1660
1669
|
const p = this.sem.run(async () => {
|
|
1661
1670
|
let latest = null;
|
|
1662
|
-
try {
|
|
1663
|
-
const dist = await npmViewJson([pkg2, "dist-tags"], this.cwd);
|
|
1664
|
-
if (dist && typeof dist === "object" && typeof dist.latest === "string") {
|
|
1665
|
-
latest = dist.latest;
|
|
1666
|
-
}
|
|
1667
|
-
} catch {
|
|
1668
|
-
}
|
|
1669
1671
|
let versions = [];
|
|
1670
1672
|
try {
|
|
1671
|
-
const
|
|
1672
|
-
if (
|
|
1673
|
-
|
|
1673
|
+
const data = await npmViewJson([pkg2, "dist-tags.latest", "versions"], this.cwd);
|
|
1674
|
+
if (data && typeof data === "object") {
|
|
1675
|
+
const dt = data["dist-tags.latest"];
|
|
1676
|
+
if (typeof dt === "string") latest = dt;
|
|
1677
|
+
const v = data.versions;
|
|
1678
|
+
if (Array.isArray(v)) versions = v.map(String);
|
|
1679
|
+
else if (typeof v === "string") versions = [v];
|
|
1680
|
+
}
|
|
1674
1681
|
} catch {
|
|
1682
|
+
try {
|
|
1683
|
+
const dist = await npmViewJson([pkg2, "dist-tags"], this.cwd);
|
|
1684
|
+
if (dist && typeof dist === "object" && typeof dist.latest === "string") {
|
|
1685
|
+
latest = dist.latest;
|
|
1686
|
+
}
|
|
1687
|
+
} catch {
|
|
1688
|
+
}
|
|
1689
|
+
try {
|
|
1690
|
+
const v = await npmViewJson([pkg2, "versions"], this.cwd);
|
|
1691
|
+
if (Array.isArray(v)) versions = v.map(String);
|
|
1692
|
+
else if (typeof v === "string") versions = [v];
|
|
1693
|
+
} catch {
|
|
1694
|
+
}
|
|
1675
1695
|
}
|
|
1676
1696
|
const stable = stableOnly(versions);
|
|
1677
1697
|
const latestStableOverall = maxStable(stable);
|
|
@@ -1682,6 +1702,14 @@ var NpmCache = class {
|
|
|
1682
1702
|
return p;
|
|
1683
1703
|
}
|
|
1684
1704
|
};
|
|
1705
|
+
async function checkRegistryAccess(cwd) {
|
|
1706
|
+
try {
|
|
1707
|
+
const result = await npmViewJson(["npm", "dist-tags.latest"], cwd);
|
|
1708
|
+
return typeof result === "string" && result.length > 0;
|
|
1709
|
+
} catch {
|
|
1710
|
+
return false;
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1685
1713
|
function isSemverSpec(spec) {
|
|
1686
1714
|
const s = spec.trim();
|
|
1687
1715
|
if (!s) return false;
|
|
@@ -5378,6 +5406,24 @@ async function runScan(rootDir, opts) {
|
|
|
5378
5406
|
];
|
|
5379
5407
|
progress.setSteps(steps);
|
|
5380
5408
|
progress.completeStep("config", "loaded");
|
|
5409
|
+
const registryOk = await checkRegistryAccess(rootDir);
|
|
5410
|
+
if (!registryOk) {
|
|
5411
|
+
progress.finish();
|
|
5412
|
+
const msg = [
|
|
5413
|
+
"",
|
|
5414
|
+
chalk5.red.bold(" \u2716 Vibgrate cannot connect to the npm registry to check package versions."),
|
|
5415
|
+
"",
|
|
5416
|
+
chalk5.dim(" Possible causes:"),
|
|
5417
|
+
chalk5.dim(" \u2022 No internet connection"),
|
|
5418
|
+
chalk5.dim(" \u2022 Corporate proxy/firewall blocking registry.npmjs.org"),
|
|
5419
|
+
chalk5.dim(" \u2022 npm is not installed or not in PATH"),
|
|
5420
|
+
"",
|
|
5421
|
+
chalk5.dim(" Try running: ") + chalk5.cyan("npm view npm dist-tags.latest"),
|
|
5422
|
+
""
|
|
5423
|
+
].join("\n");
|
|
5424
|
+
console.error(msg);
|
|
5425
|
+
process.exit(1);
|
|
5426
|
+
}
|
|
5381
5427
|
progress.startStep("discovery");
|
|
5382
5428
|
const treeCount = await quickTreeCount(rootDir, excludePatterns);
|
|
5383
5429
|
progress.updateStats({ treeSummary: treeCount });
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-GN3IWKSY.js";
|
|
5
5
|
import {
|
|
6
6
|
baselineCommand
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7EEUYKZI.js";
|
|
8
8
|
import {
|
|
9
9
|
VERSION,
|
|
10
10
|
dsnCommand,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
readJsonFile,
|
|
16
16
|
scanCommand,
|
|
17
17
|
writeDefaultConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-27LB7QTA.js";
|
|
19
19
|
|
|
20
20
|
// src/cli.ts
|
|
21
21
|
import { Command as Command4 } from "commander";
|
|
@@ -38,7 +38,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
|
|
|
38
38
|
console.log(chalk.green("\u2714") + ` Created ${chalk.bold("vibgrate.config.ts")}`);
|
|
39
39
|
}
|
|
40
40
|
if (opts.baseline) {
|
|
41
|
-
const { runBaseline } = await import("./baseline-
|
|
41
|
+
const { runBaseline } = await import("./baseline-KXUPTMQ2.js");
|
|
42
42
|
await runBaseline(rootDir);
|
|
43
43
|
}
|
|
44
44
|
console.log("");
|
package/dist/index.d.ts
CHANGED
|
@@ -268,9 +268,9 @@ interface LayerSummary {
|
|
|
268
268
|
layer: ArchitectureLayer;
|
|
269
269
|
/** Number of files in this layer */
|
|
270
270
|
fileCount: number;
|
|
271
|
-
/** Drift score for dependencies used in this layer (0–100) */
|
|
271
|
+
/** Drift score for dependencies used in this layer (0–100, 100 when no packages) */
|
|
272
272
|
driftScore: number;
|
|
273
|
-
/** Risk level derived from drift score */
|
|
273
|
+
/** Risk level derived from drift score ('low' when no packages in layer) */
|
|
274
274
|
riskLevel: RiskLevel;
|
|
275
275
|
/** Tech stack components detected in this layer */
|
|
276
276
|
techStack: InventoryItem[];
|
package/dist/index.js
CHANGED