@arifbiswas/git-pre-push 1.0.3 → 1.0.4

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/package.json +1 -1
  2. package/src/installer.js +22 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arifbiswas/git-pre-push",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Zero-dependency pre-push security guard that stops malware, injected scripts, and leaked secrets from reaching GitHub.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/installer.js CHANGED
@@ -12,6 +12,14 @@ function generateHookContent() {
12
12
 
13
13
  run_scanner() {
14
14
  # 1. Try local node_modules
15
+ if [ -f "./node_modules/@arifbiswas/git-pre-push/bin/cli.js" ]; then
16
+ node "./node_modules/@arifbiswas/git-pre-push/bin/cli.js" scan-push "$@"
17
+ return $?
18
+ fi
19
+ if [ -f "./node_modules/git-pre-push/bin/cli.js" ]; then
20
+ node "./node_modules/git-pre-push/bin/cli.js" scan-push "$@"
21
+ return $?
22
+ fi
15
23
  if [ -f "./node_modules/git-safty/bin/cli.js" ]; then
16
24
  node "./node_modules/git-safty/bin/cli.js" scan-push "$@"
17
25
  return $?
@@ -23,19 +31,27 @@ run_scanner() {
23
31
  return $?
24
32
  fi
25
33
 
26
- # 3. Try npx
27
- if command -v npx >/dev/null 2>&1; then
28
- npx --no-install git-safty scan-push "$@"
34
+ # 3. Try global commands if in PATH
35
+ if command -v git-pre-push >/dev/null 2>&1; then
36
+ git-pre-push scan-push "$@"
29
37
  return $?
30
38
  fi
31
-
32
- # 4. Try global command
33
39
  if command -v git-safty >/dev/null 2>&1; then
34
40
  git-safty scan-push "$@"
35
41
  return $?
36
42
  fi
37
43
 
38
- # 5. Shell Fallback Guard (if Node is not available in current subshell)
44
+ # 4. Try bunx or npx with published package @arifbiswas/git-pre-push
45
+ if command -v bunx >/dev/null 2>&1; then
46
+ bunx --yes @arifbiswas/git-pre-push scan-push "$@" 2>/dev/null
47
+ if [ $? -eq 0 ]; then return 0; fi
48
+ fi
49
+ if command -v npx >/dev/null 2>&1; then
50
+ npx --yes @arifbiswas/git-pre-push scan-push "$@" 2>/dev/null
51
+ if [ $? -eq 0 ]; then return 0; fi
52
+ fi
53
+
54
+ # 5. Shell Fallback Guard (if Node/package is not available in current subshell)
39
55
  echo "[GitSafty Fallback] Scanning push payload..."
40
56
  ZERO_OID="0000000000000000000000000000000000000000"
41
57
  SUSPICIOUS_FILES="temp_auto_push\\.bat|temp_interactive_push\\.bat|config\\.bat|autorun\\.bat|hidden_push\\.sh|.*\\.exe$|.*\\.vbs$|.*\\.ps1$|.*\\.scr$"