@westbayberry/dg 1.0.58 → 1.0.59

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 +37 -3
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -47020,6 +47020,20 @@ var init_config = __esm({
47020
47020
  });
47021
47021
 
47022
47022
  // src/commands/npm-wrapper.ts
47023
+ var npm_wrapper_exports = {};
47024
+ __export(npm_wrapper_exports, {
47025
+ handleWrapCommand: () => handleWrapCommand,
47026
+ parseNpmArgs: () => parseNpmArgs,
47027
+ parsePackageSpec: () => parsePackageSpec,
47028
+ pinTopLevelArgs: () => pinTopLevelArgs,
47029
+ readBareInstallPackages: () => readBareInstallPackages,
47030
+ readBareInstallPackagesTyped: () => readBareInstallPackagesTyped,
47031
+ readLockfilePins: () => readLockfilePins,
47032
+ resolvePackages: () => resolvePackages,
47033
+ resolveTreeNpm: () => resolveTreeNpm,
47034
+ resolveVersion: () => resolveVersion,
47035
+ runNpm: () => runNpm
47036
+ });
47023
47037
  import { spawn as spawn2 } from "node:child_process";
47024
47038
  import { readFileSync as readFileSync4, existsSync as existsSync4, mkdtempSync, writeFileSync as writeFileSync2, rmSync } from "node:fs";
47025
47039
  import { join as join6 } from "node:path";
@@ -85578,12 +85592,24 @@ var init_protect = __esm({
85578
85592
  # echo 'source ~/.dependency-guardian/aliases.sh' >> ~/.zshrc # or ~/.bashrc
85579
85593
  # To turn it off, remove that line.
85580
85594
 
85581
- # Only alias if dg is on PATH (avoids breaking the shell when dg is uninstalled).
85582
- if command -v dg >/dev/null 2>&1; then
85595
+ # Only alias if a real dg binary is on PATH.
85596
+ #
85597
+ # We use \`type -p\` (bash + zsh) rather than POSIX \`command -v\`
85598
+ # because command -v ALSO returns true for shell functions and
85599
+ # aliases. If your rc defines a wrapper function like
85600
+ # dg() { ... command dg "$@"; }
85601
+ # command -v passes even when the dg binary isn't installed \u2014 and
85602
+ # the npm alias below then rewrites every \`npm install\` into a
85603
+ # command that fails silently. type -p returns ONLY the path of
85604
+ # an external executable, so this check is honest about whether
85605
+ # dg is actually reachable.
85606
+ __dg_bin=$(type -p dg 2>/dev/null)
85607
+ if [ -n "$__dg_bin" ] && [ -x "$__dg_bin" ]; then
85583
85608
  alias npm='dg npm'
85584
85609
  alias pip='dg pip'
85585
85610
  alias pip3='dg pip'
85586
85611
  fi
85612
+ unset __dg_bin
85587
85613
  `;
85588
85614
  USAGE3 = `
85589
85615
  dg protect \u2014 opt-in low-friction protection for a project
@@ -97238,7 +97264,15 @@ async function main() {
97238
97264
  const strictFlags = rawCommand !== "npm" && rawCommand !== "pip";
97239
97265
  const config3 = parseConfig(process.argv, strictFlags);
97240
97266
  const updatePromise = checkForUpdate(CLI_VERSION).catch(() => null);
97241
- if (rawCommand === "scan" || rawCommand === "npm" || rawCommand === "pip") {
97267
+ let needsTermsGate = rawCommand === "scan";
97268
+ if (rawCommand === "npm") {
97269
+ const { parseNpmArgs: parseNpmArgs2 } = await Promise.resolve().then(() => (init_npm_wrapper(), npm_wrapper_exports));
97270
+ needsTermsGate = parseNpmArgs2(process.argv.slice(3)).shouldScan;
97271
+ } else if (rawCommand === "pip") {
97272
+ const { parsePipArgs: parsePipArgs2 } = await Promise.resolve().then(() => (init_pip_wrapper(), pip_wrapper_exports));
97273
+ needsTermsGate = parsePipArgs2(process.argv.slice(3)).shouldScan;
97274
+ }
97275
+ if (needsTermsGate) {
97242
97276
  const { gateOrExit: gateOrExit2 } = await Promise.resolve().then(() => (init_terms_gate(), terms_gate_exports));
97243
97277
  await gateOrExit2();
97244
97278
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@westbayberry/dg",
3
- "version": "1.0.58",
3
+ "version": "1.0.59",
4
4
  "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.",
5
5
  "bin": {
6
6
  "dependency-guardian": "dist/index.mjs",