@westbayberry/dg 1.1.4 → 1.1.5

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.
Files changed (2) hide show
  1. package/dist/index.mjs +63 -15
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -44516,7 +44516,29 @@ function findingFingerprint(pkg, f) {
44516
44516
  function buildSarif(response, opts = {}) {
44517
44517
  const ruleMap = /* @__PURE__ */ new Map();
44518
44518
  const results = [];
44519
+ const INCOMPLETE_RULE = "dg.analysis_incomplete";
44519
44520
  for (const pkg of response.packages) {
44521
+ if (pkg.action === "analysis_incomplete") {
44522
+ if (!ruleMap.has(INCOMPLETE_RULE)) {
44523
+ ruleMap.set(INCOMPLETE_RULE, {
44524
+ id: INCOMPLETE_RULE,
44525
+ name: INCOMPLETE_RULE,
44526
+ shortDescription: { text: "Package could not be fully analyzed \u2014 treat as unverified" },
44527
+ defaultConfiguration: { level: "warning" }
44528
+ });
44529
+ }
44530
+ results.push({
44531
+ ruleId: INCOMPLETE_RULE,
44532
+ level: "warning",
44533
+ message: { text: `${pkg.name} ${pkg.version}: analysis incomplete \u2014 the scanner could not fully evaluate this package. Treat as unverified, not safe.` },
44534
+ locations: [{
44535
+ physicalLocation: {
44536
+ artifactLocation: { uri: opts.lockfileUri ?? `dg:${pkg.name}@${pkg.version}` }
44537
+ }
44538
+ }],
44539
+ partialFingerprints: { dg_finding: `${pkg.name}@${pkg.version}#${INCOMPLETE_RULE}`.slice(0, 240) }
44540
+ });
44541
+ }
44520
44542
  const findings = pkg.findings ?? [];
44521
44543
  for (const f of findings) {
44522
44544
  const id = findingId(f);
@@ -44941,6 +44963,7 @@ function handleFreeCapReached2(error, jsonMode = false) {
44941
44963
  function actionColor(action) {
44942
44964
  if (action === "block") return import_chalk5.default.red;
44943
44965
  if (action === "warn") return import_chalk5.default.yellow;
44966
+ if (action === "analysis_incomplete") return import_chalk5.default.cyan;
44944
44967
  return import_chalk5.default.green;
44945
44968
  }
44946
44969
  function actionBadge(pkg) {
@@ -44957,6 +44980,9 @@ function isBlocked(p) {
44957
44980
  function isWarned(p) {
44958
44981
  return p.action === "warn";
44959
44982
  }
44983
+ function isIncomplete(p) {
44984
+ return p.action === "analysis_incomplete";
44985
+ }
44960
44986
  function renderResultClean(result, _config) {
44961
44987
  const lines = [];
44962
44988
  const total = result.packages.length;
@@ -44968,7 +44994,8 @@ function renderResultClean(result, _config) {
44968
44994
  }
44969
44995
  const blocked = result.packages.filter(isBlocked);
44970
44996
  const warned = result.packages.filter(isWarned);
44971
- if (result.action === "pass" && blocked.length === 0 && warned.length === 0) {
44997
+ const incomplete = result.packages.filter(isIncomplete);
44998
+ if (result.action === "pass" && blocked.length === 0 && warned.length === 0 && incomplete.length === 0) {
44972
44999
  lines.push("");
44973
45000
  lines.push(` ${import_chalk5.default.green("\u2713")} ${import_chalk5.default.bold("Dependency Guardian")} checked ${total} package${total !== 1 ? "s" : ""}. ${import_chalk5.default.green("No risky behavior found.")}`);
44974
45001
  if (result.durationMs) {
@@ -44977,11 +45004,18 @@ function renderResultClean(result, _config) {
44977
45004
  lines.push("");
44978
45005
  return lines.join("\n");
44979
45006
  }
44980
- const headerColor = result.action === "block" ? import_chalk5.default.red : import_chalk5.default.yellow;
44981
- const headerLabel = result.action === "block" ? "BLOCK" : "WARN";
45007
+ const headerLabel = result.action === "block" ? "BLOCK" : result.action === "warn" ? "WARN" : result.action === "analysis_incomplete" ? "UNKNOWN" : "PASS";
45008
+ const headerColor = actionColor(result.action);
45009
+ const cleanCount = total - blocked.length - warned.length - incomplete.length;
45010
+ const countParts = [
45011
+ `${blocked.length} block`,
45012
+ `${warned.length} warn`,
45013
+ ...incomplete.length > 0 ? [`${incomplete.length} unknown`] : [],
45014
+ `${cleanCount} clean`
45015
+ ];
44982
45016
  lines.push("");
44983
45017
  lines.push(` ${headerColor(import_chalk5.default.bold(headerLabel))} ${import_chalk5.default.bold("Dependency Guardian")} ${import_chalk5.default.dim(`(score ${result.score})`)}`);
44984
- lines.push(` ${import_chalk5.default.dim(`${total} package${total !== 1 ? "s" : ""} scanned \xB7 ${blocked.length} block \xB7 ${warned.length} warn \xB7 ${total - blocked.length - warned.length} clean`)}`);
45018
+ lines.push(` ${import_chalk5.default.dim(`${total} package${total !== 1 ? "s" : ""} scanned \xB7 ${countParts.join(" \xB7 ")}`)}`);
44985
45019
  lines.push("");
44986
45020
  const showFirst = (pkgs, color, label) => {
44987
45021
  if (pkgs.length === 0) return;
@@ -44997,10 +45031,13 @@ function renderResultClean(result, _config) {
44997
45031
  };
44998
45032
  showFirst(blocked, import_chalk5.default.red, "Blocked");
44999
45033
  showFirst(warned, import_chalk5.default.yellow, "Warnings");
45034
+ showFirst(incomplete, import_chalk5.default.cyan, "Could not analyze");
45000
45035
  if (result.action === "block") {
45001
45036
  lines.push(` ${import_chalk5.default.dim("Next step:")} review the findings above, then either pin a safe version or use ${import_chalk5.default.bold("--dg-force")} to bypass.`);
45002
45037
  } else if (result.action === "warn") {
45003
45038
  lines.push(` ${import_chalk5.default.dim("Next step:")} review the warnings; install proceeds unless you set ${import_chalk5.default.bold("--mode block")}.`);
45039
+ } else if (result.action === "analysis_incomplete") {
45040
+ lines.push(` ${import_chalk5.default.dim("Next step:")} one or more packages could not be fully analyzed \u2014 treat as unverified, not safe. Re-run to retry.`);
45004
45041
  }
45005
45042
  lines.push("");
45006
45043
  return lines.join("\n");
@@ -45019,13 +45056,21 @@ function renderResultDetails(result, _config) {
45019
45056
  lines.push("");
45020
45057
  const blocked = result.packages.filter(isBlocked);
45021
45058
  const warned = result.packages.filter(isWarned);
45022
- const passWithScore = result.packages.filter((p) => p.score > 0 && p.score < 60);
45023
- const clean = result.packages.filter((p) => p.score === 0);
45059
+ const incomplete = result.packages.filter(isIncomplete);
45060
+ const rest = result.packages.filter((p) => !isBlocked(p) && !isWarned(p) && !isIncomplete(p));
45061
+ const passWithScore = rest.filter((p) => p.score > 0 && p.score < 60);
45062
+ const clean = rest.filter((p) => p.score === 0);
45024
45063
  const total = result.packages.length;
45025
45064
  const needsAttention = blocked.length + warned.length;
45026
- if (needsAttention > 0) {
45065
+ if (needsAttention > 0 || incomplete.length > 0) {
45066
+ const segs = [
45067
+ import_chalk5.default.red(`${blocked.length} block`),
45068
+ import_chalk5.default.yellow(`${warned.length} warn`),
45069
+ ...incomplete.length > 0 ? [import_chalk5.default.cyan(`${incomplete.length} unknown`)] : [],
45070
+ import_chalk5.default.green(`${clean.length + passWithScore.length} pass`)
45071
+ ];
45027
45072
  lines.push(
45028
- ` ${total} package${total !== 1 ? "s" : ""} scanned ${import_chalk5.default.dim("\u2502")} ${import_chalk5.default.red(`${blocked.length} block`)} ${import_chalk5.default.dim("\u2502")} ${import_chalk5.default.yellow(`${warned.length} warn`)} ${import_chalk5.default.dim("\u2502")} ${import_chalk5.default.green(`${clean.length + passWithScore.length} pass`)}`
45073
+ ` ${total} package${total !== 1 ? "s" : ""} scanned ${import_chalk5.default.dim("\u2502")} ${segs.join(` ${import_chalk5.default.dim("\u2502")} `)}`
45029
45074
  );
45030
45075
  } else {
45031
45076
  lines.push(
@@ -45038,8 +45083,8 @@ function renderResultDetails(result, _config) {
45038
45083
  lines.push("");
45039
45084
  return lines.join("\n");
45040
45085
  }
45041
- if (needsAttention > 0) {
45042
- const groups = groupPackages([...blocked, ...warned]);
45086
+ if (needsAttention > 0 || incomplete.length > 0) {
45087
+ const groups = groupPackages([...blocked, ...warned, ...incomplete]);
45043
45088
  lines.push(` ${import_chalk5.default.bold("Needs Attention")}`);
45044
45089
  lines.push(` ${import_chalk5.default.dim("\u2500".repeat(60))}`);
45045
45090
  for (const group of groups) {
@@ -46763,11 +46808,11 @@ var init_InteractiveResultsView = __esm({
46763
46808
  const scanUsage = usageDisplay ? usageDisplay.text : result.freeScansRemaining !== void 0 ? `${result.freeScansRemaining.toLocaleString()} packages left` : scanUsageProp;
46764
46809
  const usageNearLimit = usageDisplay?.nearLimit ?? false;
46765
46810
  const flagged = (0, import_react30.useMemo)(
46766
- () => result.packages.filter((p) => p.score > 0),
46811
+ () => result.packages.filter((p) => p.score > 0 || p.action === "analysis_incomplete"),
46767
46812
  [result.packages]
46768
46813
  );
46769
46814
  const clean = (0, import_react30.useMemo)(
46770
- () => result.packages.filter((p) => p.score === 0),
46815
+ () => result.packages.filter((p) => p.score === 0 && p.action !== "analysis_incomplete"),
46771
46816
  [result.packages]
46772
46817
  );
46773
46818
  const total = result.packages.length;
@@ -51787,8 +51832,8 @@ var init_ResultsView = __esm({
51787
51832
  config: _config,
51788
51833
  durationMs
51789
51834
  }) => {
51790
- const flagged = result.packages.filter((p) => p.score > 0);
51791
- const clean = result.packages.filter((p) => p.score === 0);
51835
+ const flagged = result.packages.filter((p) => p.score > 0 || p.action === "analysis_incomplete");
51836
+ const clean = result.packages.filter((p) => p.score === 0 && p.action !== "analysis_incomplete");
51792
51837
  const total = result.packages.length;
51793
51838
  const groups = groupPackages(flagged);
51794
51839
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
@@ -51943,13 +51988,15 @@ function reasonTag(pkg) {
51943
51988
  function countSummary(result) {
51944
51989
  let block = 0;
51945
51990
  let warn = 0;
51991
+ let unknown = 0;
51946
51992
  let clean = 0;
51947
51993
  for (const p of result.packages) {
51948
51994
  if (p.action === "block") block++;
51949
51995
  else if (p.action === "warn") warn++;
51996
+ else if (p.action === "analysis_incomplete") unknown++;
51950
51997
  else clean++;
51951
51998
  }
51952
- return { block, warn, clean };
51999
+ return { block, warn, unknown, clean };
51953
52000
  }
51954
52001
  var import_jsx_runtime17, WrapperVerdictLine;
51955
52002
  var init_WrapperVerdictLine = __esm({
@@ -52020,6 +52067,7 @@ var init_WrapperVerdictLine = __esm({
52020
52067
  const parts = [];
52021
52068
  if (counts.block > 0) parts.push(`${counts.block} block`);
52022
52069
  if (counts.warn > 0) parts.push(`${counts.warn} warn`);
52070
+ if (counts.unknown > 0) parts.push(`${counts.unknown} unknown`);
52023
52071
  if (counts.clean > 0) parts.push(`${counts.clean} clean`);
52024
52072
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Box_default, { flexDirection: "row", children: [
52025
52073
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text, { color, children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@westbayberry/dg",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "type": "module",
5
5
  "description": "Supply chain security scanner for npm and Python dependencies — 35 behavioral detectors catch zero-day attacks CVE databases miss. 99.66% catch rate on 155K packages.",
6
6
  "bin": {