Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: revert back to pre-commit

IgorHortaa252b1dbedad
diff --git a/.husky/pre-commit b/.husky/pre-commit
new file mode 100755
index 0000000000..e43b040102
--- /dev/null
+++ b/.husky/pre-commit
@@ -0,0 +1,14 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
+echo "πŸ”₯ Pre-commit hook is running!"
+
+# Check if infisical is installed
+if ! command -v infisical >/dev/null 2>&1; then
+ echo "\nError: Infisical CLI is not installed. Please install the Infisical CLI before committing.\n You can refer to the documentation at https://infisical.com/docs/cli/overview\n\n"
+ exit 1
+fi
+
+npx lint-staged
+
+infisical scan git-changes --staged -v
diff --git a/.husky/pre-push b/.husky/pre-push
deleted file mode 100755
index 45c89dfbf9..0000000000
--- a/.husky/pre-push
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/env sh
-. "$(dirname -- "$0")/_/husky.sh"
-
-echo "πŸš€ Pre-push hook is running!"
-
-# Determine the base branch to compare against
-if git rev-parse --abbrev-ref @{u} >/dev/null 2>&1; then
- # Use upstream if it exists
- base_ref="@{u}"
-else
- # Fall back to origin/main for new branches
- echo "No upstream branch found. Comparing against origin/main..."
- base_ref="origin/main"
-fi
-
-# Get changed files between base and HEAD
-# We use --diff-filter=d to exclude deleted files (lowercase = exclude)
-changed_files=$(git diff --name-only --diff-filter=d "$base_ref" HEAD)
-
-if [ -z "$changed_files" ]; then
- echo "No files changed. Skipping linting."
- exit 0
-fi
-
-frontend_files=""
-backend_files=""
-
-for file in $changed_files; do
- case "$file" in
- frontend/src/*.ts|frontend/src/*.tsx|frontend/src/*.js|frontend/src/*.jsx|frontend/src/*)
- case "$file" in
- *.ts|*.tsx|*.js|*.jsx)
- # Strip 'frontend/' prefix for running eslint inside the frontend directory
- frontend_files="$frontend_files ${file#frontend/}"
- ;;
- esac
- ;;
- backend/src/*.ts|backend/src/*.tsx|backend/src/*.js|backend/src/*.jsx|backend/src/*)
- case "$file" in
- *.ts|*.tsx|*.js|*.jsx)
- # Strip 'backend/' prefix for running eslint inside the backend directory
- backend_files="$backend_files ${file#backend/}"
- ;;
- esac
- ;;
- esac
-done
-
-exit_code=0
-
-if [ -n "$frontend_files" ]; then
- echo "Linting frontend files..."
- # We don't use --fix here because we are in pre-push;
- # the user should fix and commit if there are errors.
- (cd frontend && npx eslint --max-warnings 0 $frontend_files) || exit_code=1
-fi
-
-if [ -n "$backend_files" ]; then
- echo "Linting backend files..."
- (cd backend && npx eslint --max-warnings 0 $backend_files) || exit_code=1
-fi
-
-if [ $exit_code -ne 0 ]; then
- echo "❌ Linting failed. Please fix the errors before pushing."
- exit 1
-fi
-
-echo "βœ… Linting passed!"