cve-lite-cli 1.5.4 → 1.6.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/README.md CHANGED
@@ -59,7 +59,7 @@ It is built for the moment right before release: fast, local-first, and honest a
59
59
 
60
60
  **Key differentiators:**
61
61
 
62
- - **Copy-and-run fix commands** — turns findings into package-manager-aware `npm install`, `pnpm add`, or `yarn add` commands you can run immediately
62
+ - **Copy-and-run fix commands** — turns findings into package-manager-aware `npm install`, `pnpm add`, `yarn add`, or `bun add` commands you can run immediately
63
63
  - **Direct vs transitive visibility** — shows whether the risk comes from something you installed directly or a nested dependency
64
64
  - **Offline advisory DB** — sync advisory data ahead of time and scan with zero runtime API calls, useful for enterprise and restricted-network environments
65
65
  - **No account required** — no sign-up, no cloud dashboard, no source code upload
@@ -70,7 +70,7 @@ It is built for the moment right before release: fast, local-first, and honest a
70
70
  | Capability | CVE Lite CLI | npm audit | OSV-Scanner | Snyk CLI | Socket CLI |
71
71
  |---|:---:|:---:|:---:|:---:|:---:|
72
72
  | JS/TS lockfile scanning | ✅ | ✅ | ✅ | ✅ | ✅ |
73
- | npm + pnpm + Yarn support | ✅ | ❌ | ✅ | ✅ | ✅ |
73
+ | npm + pnpm + Yarn + Bun support | ✅ | ❌ | ✅ | ✅ | ✅ |
74
74
  | No account required | ✅ | ✅ | ✅ | ❌ | ❌ |
75
75
  | **Free to use** | ✅ | ✅ | ✅ | ❌ | ❌ |
76
76
  | Direct vs transitive visibility | ✅ | ⚠️ | ✅ | ✅ | ✅ |
@@ -159,7 +159,7 @@ cve-lite --version
159
159
 
160
160
  In the current version it:
161
161
  - applies only direct dependency fixes with a validated lowest known non-vulnerable target
162
- - uses `npm install`, `pnpm add`, or `yarn add` based on your lockfile
162
+ - uses `npm install`, `pnpm add`, `yarn add`, or `bun add` based on your lockfile
163
163
  - rescans automatically after applying fixes
164
164
  - does **not** auto-apply transitive overrides or guarantee application compatibility
165
165
 
@@ -227,7 +227,7 @@ CVE Lite CLI is a good fit for:
227
227
  - **Startups and small teams** — lightweight CI gate at no cost
228
228
  - **Consultants** — run a scan on a client project in seconds, with a clear fix plan to hand over
229
229
  - **Enterprise teams with restricted networks** — offline advisory DB workflow removes the need for runtime outbound calls during scans
230
- - **Teams running npm, pnpm, and Yarn** — unified scanning across all three package managers in one tool
230
+ - **Teams running npm, pnpm, Yarn, and Bun** — unified scanning across all four package managers in one tool
231
231
 
232
232
  See the [CI and Workflow Integration guide](docs/ci-integration.md) for concrete patterns across these scenarios.
233
233
 
package/dist/index.js CHANGED
@@ -327,6 +327,9 @@ function buildFixCommandParts(packageManager, targets) {
327
327
  if (packageManager === "pnpm") {
328
328
  return ["pnpm", "add", ...targets.map(target => `${target.package}@${target.targetVersion}`)];
329
329
  }
330
+ if (packageManager === "bun") {
331
+ return ["bun", "add", ...targets.map(target => `${target.package}@${target.targetVersion}`)];
332
+ }
330
333
  return ["yarn", "add", ...targets.map(target => `${target.package}@${target.targetVersion}`)];
331
334
  }
332
335
  async function runInstallCommand(command, args, cwd) {
@@ -350,6 +353,8 @@ function commandLabelForPackageManager(packageManager) {
350
353
  return "npm install";
351
354
  if (packageManager === "pnpm")
352
355
  return "pnpm add";
356
+ if (packageManager === "bun")
357
+ return "bun add";
353
358
  return "yarn add";
354
359
  }
355
360
  function countBySeverity(findings) {
@@ -1,6 +1,7 @@
1
1
  import { chalk, stripAnsi } from "../utils/chalk.js";
2
2
  import { severityOrder } from "../constants.js";
3
3
  import { buildSuggestedFixCommandPlan } from "../remediation/fix-commands.js";
4
+ import { isMajorVersionBump } from "../utils/version.js";
4
5
  import { formatSeverityLabel, formatRelationshipLabel, getPrimaryParent, getRecommendedAction, summarizeRisk, summarizeNextAction } from "./formatters.js";
5
6
  export function printSummary(findings, packageCount, scanInput) {
6
7
  if (findings.length === 0) {
@@ -134,7 +135,10 @@ export function printSuggestedFixCommands(findings, scanInput) {
134
135
  if (section.kind === "direct" || section.kind === "direct-adjusted" || (section.kind === "urgent" && hasDirectTargets)) {
135
136
  const validationSummary = summarizeAdjustedValidation(section.targets);
136
137
  const remainingNotes = [];
137
- printDirectTargetsTable(section.targets, remainingNotes, validationSummary, sharedDirectTableWidths);
138
+ // Urgent sections compute their own widths so the "breaking change" annotation
139
+ // is not truncated by widths derived from smaller non-urgent sections.
140
+ const tableWidths = section.kind === "urgent" ? undefined : sharedDirectTableWidths;
141
+ printDirectTargetsTable(section.targets, remainingNotes, validationSummary, tableWidths);
138
142
  for (const note of remainingNotes) {
139
143
  console.log(chalk.gray(` Note: ${note}`));
140
144
  }
@@ -479,6 +483,8 @@ function packageManagerCommandPrefix(packageManager) {
479
483
  return "npm install";
480
484
  if (packageManager === "pnpm")
481
485
  return "pnpm add";
486
+ if (packageManager === "bun")
487
+ return "bun add";
482
488
  return "yarn add";
483
489
  }
484
490
  function summarizeAdjustedValidation(targets) {
@@ -503,10 +509,14 @@ function printDirectTargetsTable(targets, remainingNotes, validationSummary, wid
503
509
  remainingNotes.push(target.adjustmentNote);
504
510
  }
505
511
  }
512
+ const isBreaking = !!target.currentVersion && isMajorVersionBump(target.currentVersion, target.targetVersion);
513
+ const targetCell = isBreaking
514
+ ? chalk.cyan(target.targetVersion) + chalk.yellow(" (breaking change)")
515
+ : chalk.cyan(target.targetVersion);
506
516
  return [
507
517
  target.package,
508
518
  target.currentVersion ?? "-",
509
- chalk.cyan(target.targetVersion),
519
+ targetCell,
510
520
  target.scannedVersions !== null && target.scannedVersions !== undefined
511
521
  ? chalk.blue(String(target.scannedVersions))
512
522
  : "-",
@@ -0,0 +1,49 @@
1
+ import fs from "node:fs";
2
+ import { upsertPackage } from "./utils.js";
3
+ function parseJsonc(text) {
4
+ // bun.lock uses JSONC (trailing commas). Strip them before parsing.
5
+ return JSON.parse(text.replace(/,(\s*[}\]])/g, "$1"));
6
+ }
7
+ export function loadFromBunLock(filePath, prodOnly) {
8
+ const raw = parseJsonc(fs.readFileSync(filePath, "utf8"));
9
+ const packages = raw?.packages ?? {};
10
+ const workspaces = raw?.workspaces ?? {};
11
+ const map = new Map();
12
+ // Collect direct dependency names from all workspaces to detect dev-only packages
13
+ const prodNames = new Set();
14
+ const devNames = new Set();
15
+ for (const workspace of Object.values(workspaces)) {
16
+ for (const name of Object.keys(workspace?.dependencies ?? {})) {
17
+ prodNames.add(name);
18
+ }
19
+ for (const name of Object.keys(workspace?.devDependencies ?? {})) {
20
+ devNames.add(name);
21
+ }
22
+ }
23
+ for (const [pkgName, entry] of Object.entries(packages)) {
24
+ if (!Array.isArray(entry) || entry.length < 1)
25
+ continue;
26
+ const nameAtVersion = String(entry[0] ?? "");
27
+ // Split on last @ to handle scoped packages (e.g. @babel/core@7.0.0)
28
+ const atIndex = nameAtVersion.lastIndexOf("@");
29
+ if (atIndex <= 0)
30
+ continue;
31
+ const name = nameAtVersion.slice(0, atIndex);
32
+ const version = nameAtVersion.slice(atIndex + 1);
33
+ if (!name || !version)
34
+ continue;
35
+ // A package is dev-only if it appears in devDependencies but not in dependencies
36
+ // (transitive packages not listed directly are treated as prod)
37
+ const dev = devNames.has(pkgName) && !prodNames.has(pkgName);
38
+ if (prodOnly && dev)
39
+ continue;
40
+ upsertPackage(map, {
41
+ name,
42
+ version,
43
+ ecosystem: "npm",
44
+ dev,
45
+ paths: [["project", name]],
46
+ });
47
+ }
48
+ return [...map.values()];
49
+ }
@@ -1,14 +1,30 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { findFiles, findNearestPackageJson, chooseBestLockfile, safeReadText, relativeOrName } from "../utils/file.js";
4
+ import { loadFromBunLock } from "./bun-lock.js";
4
5
  import { loadFromPackageJson } from "./package-json.js";
5
6
  import { loadFromPackageLock } from "./package-lock.js";
6
7
  import { loadFromPnpmLock } from "./pnpm-lock.js";
7
8
  import { loadFromYarnLock } from "./yarn-lock.js";
8
9
  export function loadPackages(projectRoot, prodOnly, maxDepth) {
10
+ const rootBunLock = path.join(projectRoot, "bun.lock");
9
11
  const rootPackageLock = path.join(projectRoot, "package-lock.json");
10
12
  const rootPnpmLock = path.join(projectRoot, "pnpm-lock.yaml");
11
13
  const rootYarnLock = path.join(projectRoot, "yarn.lock");
14
+ if (fs.existsSync(rootBunLock)) {
15
+ return {
16
+ mode: "resolved-lockfile",
17
+ source: "bun-lock",
18
+ filePath: rootBunLock,
19
+ packages: loadFromBunLock(rootBunLock, prodOnly),
20
+ notes: [
21
+ "Scanned resolved dependency versions from bun.lock.",
22
+ "Dependency paths are approximated from the workspace dependency manifest."
23
+ ],
24
+ warnings: [],
25
+ skippedDependencies: []
26
+ };
27
+ }
12
28
  if (fs.existsSync(rootPackageLock)) {
13
29
  return {
14
30
  mode: "resolved-lockfile",
@@ -51,10 +67,24 @@ export function loadPackages(projectRoot, prodOnly, maxDepth) {
51
67
  skippedDependencies: []
52
68
  };
53
69
  }
54
- const discoveredLockfiles = findFiles(projectRoot, ["package-lock.json", "pnpm-lock.yaml", "yarn.lock"], maxDepth);
70
+ const discoveredLockfiles = findFiles(projectRoot, ["bun.lock", "package-lock.json", "pnpm-lock.yaml", "yarn.lock"], maxDepth);
55
71
  if (discoveredLockfiles.length > 0) {
56
72
  const selected = chooseBestLockfile(discoveredLockfiles);
57
73
  const selectedName = path.basename(selected);
74
+ if (selectedName === "bun.lock") {
75
+ return {
76
+ mode: "resolved-lockfile",
77
+ source: "bun-lock",
78
+ filePath: selected,
79
+ packages: loadFromBunLock(selected, prodOnly),
80
+ notes: [
81
+ `Scanned resolved dependency versions from ${relativeOrName(projectRoot, selected)}.`,
82
+ "Dependency paths are approximated from the workspace dependency manifest."
83
+ ],
84
+ warnings: ["No supported lockfile was found at the repo root, so a nested lockfile was used instead."],
85
+ skippedDependencies: []
86
+ };
87
+ }
58
88
  if (selectedName === "package-lock.json") {
59
89
  return {
60
90
  mode: "resolved-lockfile",
@@ -136,7 +166,7 @@ export function loadPackages(projectRoot, prodOnly, maxDepth) {
136
166
  export function buildNoPackagesMessage(projectRoot) {
137
167
  return [
138
168
  "No scannable packages were found.",
139
- "Supported inputs: package-lock.json, pnpm-lock.yaml, yarn.lock, or package.json with exact pinned versions.",
169
+ "Supported inputs: bun.lock, package-lock.json, pnpm-lock.yaml, yarn.lock, or package.json with exact pinned versions.",
140
170
  `Searched under: ${projectRoot}`
141
171
  ].join(" ");
142
172
  }
@@ -159,6 +159,8 @@ function inferPackageManager(scanInput) {
159
159
  return "pnpm";
160
160
  if (scanInput.source === "yarn-lock")
161
161
  return "yarn";
162
+ if (scanInput.source === "bun-lock")
163
+ return "bun";
162
164
  return null;
163
165
  }
164
166
  function commandPrefix(packageManager) {
@@ -166,6 +168,8 @@ function commandPrefix(packageManager) {
166
168
  return "npm install";
167
169
  if (packageManager === "pnpm")
168
170
  return "pnpm add";
171
+ if (packageManager === "bun")
172
+ return "bun add";
169
173
  return "yarn add";
170
174
  }
171
175
  function packageManagerSourceLabel(scanInput) {
@@ -178,6 +182,8 @@ function packageManagerSourceLabel(scanInput) {
178
182
  return "pnpm-lock.yaml";
179
183
  if (scanInput.source === "yarn-lock")
180
184
  return "yarn.lock";
185
+ if (scanInput.source === "bun-lock")
186
+ return "bun.lock";
181
187
  return scanInput.source;
182
188
  }
183
189
  function upsertTarget(targetsByPackage, next) {
@@ -67,7 +67,9 @@ export function chooseBestLockfile(candidates) {
67
67
  return 1;
68
68
  if (name === "yarn.lock")
69
69
  return 2;
70
- return 3;
70
+ if (name === "bun.lock")
71
+ return 3;
72
+ return 4;
71
73
  };
72
74
  return score(a) - score(b);
73
75
  })[0];
@@ -27,6 +27,11 @@ export function parseExactManifestVersion(spec) {
27
27
  return cleaned;
28
28
  return null;
29
29
  }
30
+ export function isMajorVersionBump(from, to) {
31
+ const fromMajor = Number(from.split(".")[0]);
32
+ const toMajor = Number(to.split(".")[0]);
33
+ return !Number.isNaN(fromMajor) && !Number.isNaN(toMajor) && toMajor > fromMajor;
34
+ }
30
35
  export function normalizeRawVersion(value) {
31
36
  if (typeof value !== "string")
32
37
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cve-lite-cli",
3
- "version": "1.5.4",
3
+ "version": "1.6.0",
4
4
  "description": "Developer-friendly CLI for scanning JS/TS projects for dependency vulnerabilities using local lockfiles and OSV",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,7 +37,8 @@
37
37
  "owasp",
38
38
  "npm",
39
39
  "pnpm",
40
- "yarn"
40
+ "yarn",
41
+ "bun"
41
42
  ],
42
43
  "license": "MIT",
43
44
  "engines": {
package/dist/banner.js DELETED
@@ -1,10 +0,0 @@
1
- import { chalk } from "./chalk";
2
- export const CLI_BANNER = [
3
- `${chalk.green(">_")} ${chalk.bold.whiteBright("CVE Lite CLI")}`,
4
- chalk.gray("────────────────────────────────"),
5
- `${chalk.green("✔")} Scan dependencies`,
6
- `${chalk.green("✔")} Highlight critical issues`,
7
- `${chalk.green("✔")} Show a clear fix plan`,
8
- "",
9
- chalk.gray("Fast. Local. Developer-first.")
10
- ].join("\n");
package/dist/chalk.js DELETED
@@ -1,44 +0,0 @@
1
- import process from "node:process";
2
- const ansi = {
3
- reset: "\x1b[0m",
4
- bold: "\x1b[1m",
5
- red: "\x1b[31m",
6
- redBright: "\x1b[91m",
7
- green: "\x1b[32m",
8
- greenBright: "\x1b[92m",
9
- yellow: "\x1b[33m",
10
- blue: "\x1b[34m",
11
- blueBright: "\x1b[94m",
12
- magenta: "\x1b[35m",
13
- cyan: "\x1b[36m",
14
- white: "\x1b[37m",
15
- whiteBright: "\x1b[97m",
16
- gray: "\x1b[90m"
17
- };
18
- const colorEnabled = Boolean(process.stdout.isTTY) && process.env.NO_COLOR !== "1";
19
- function paint(code, text) {
20
- if (!colorEnabled)
21
- return text;
22
- return `${code}${text}${ansi.reset}`;
23
- }
24
- export const chalk = {
25
- bold: Object.assign((text) => paint(ansi.bold, text), {
26
- cyan: (text) => paint(ansi.bold + ansi.cyan, text),
27
- green: (text) => paint(ansi.bold + ansi.green, text),
28
- magenta: (text) => paint(ansi.bold + ansi.magenta, text),
29
- blue: (text) => paint(ansi.bold + ansi.blue, text),
30
- yellow: (text) => paint(ansi.bold + ansi.yellow, text)
31
- }),
32
- cyan: (text) => paint(ansi.cyan, text),
33
- green: (text) => paint(ansi.green, text),
34
- greenBright: (text) => paint(ansi.greenBright, text),
35
- red: (text) => paint(ansi.red, text),
36
- redBright: (text) => paint(ansi.redBright, text),
37
- yellow: (text) => paint(ansi.yellow, text),
38
- blue: (text) => paint(ansi.blue, text),
39
- blueBright: (text) => paint(ansi.blueBright, text),
40
- magenta: (text) => paint(ansi.magenta, text),
41
- gray: (text) => paint(ansi.gray, text),
42
- white: (text) => paint(ansi.white, text),
43
- whiteBright: (text) => paint(ansi.whiteBright, text)
44
- };
package/dist/osv/api.js DELETED
@@ -1,26 +0,0 @@
1
- export async function osvQueryBatch(packages) {
2
- const response = await fetch("https://api.osv.dev/v1/querybatch", {
3
- method: "POST",
4
- headers: { "content-type": "application/json" },
5
- body: JSON.stringify({
6
- queries: packages.map(pkg => ({
7
- package: {
8
- ecosystem: pkg.ecosystem,
9
- name: pkg.name
10
- },
11
- version: pkg.version
12
- }))
13
- })
14
- });
15
- if (!response.ok) {
16
- throw new Error(`OSV batch query failed: ${response.status} ${response.statusText}`);
17
- }
18
- return response.json();
19
- }
20
- export async function osvGetVuln(id) {
21
- const response = await fetch(`https://api.osv.dev/v1/vulns/${encodeURIComponent(id)}`);
22
- if (!response.ok) {
23
- throw new Error(`OSV vuln fetch failed for ${id}`);
24
- }
25
- return response.json();
26
- }