Skip to content

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

fix: prepush

IgorHortabcb3a1444ebe
diff --git a/.husky/pre-push b/.husky/pre-push
index 7e7f21eecb..45c89dfbf9 100755
--- a/.husky/pre-push
+++ b/.husky/pre-push
@@ -3,15 +3,19 @@
echo "🚀 Pre-push hook is running!"
-# Check if an upstream branch exists
-if ! git rev-parse --abbrev-ref @{u} >/dev/null 2>&1; then
- echo "No upstream branch found. Skipping linting."
- exit 0
+# 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 upstream and HEAD
-# We use --name-status to filter out deleted files (D)
-changed_files=$(git diff --name-status @{u} HEAD | awk '$1 != "D" { print $2 }')
+# 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."
diff --git a/backend/src/ee/services/ai-mcp-server/ai-mcp-server-dal.ts b/backend/src/ee/services/ai-mcp-server/ai-mcp-server-dal.ts
index 6b49a814a1..ab84087946 100644
--- a/backend/src/ee/services/ai-mcp-server/ai-mcp-server-dal.ts
+++ b/backend/src/ee/services/ai-mcp-server/ai-mcp-server-dal.ts
@@ -5,7 +5,7 @@ import { ormify } from "@app/lib/knex";
export type TAiMcpServerDALFactory = ReturnType<typeof aiMcpServerDALFactory>;
export const aiMcpServerDALFactory = (db: TDbClient) => {
- const aiMcpServerOrm = ormify(db, TableName.AiMcpServer);
+ const aiMcpServerOrm = ormify(db, TableName.AiMcpServer)
return aiMcpServerOrm
};
diff --git a/frontend/src/context/OrganizationContext/index.tsx b/frontend/src/context/OrganizationContext/index.tsx
index 29a617ace2..7c2b413048 100644
--- a/frontend/src/context/OrganizationContext/index.tsx
+++ b/frontend/src/context/OrganizationContext/index.tsx
@@ -1 +1,2 @@
-export { useOrganization } from "./OrganizationContext"
+export { useOrganization }
+from "./OrganizationContext"
diff --git a/scripts/lint-changed.sh b/scripts/lint-changed.sh
new file mode 100755
index 0000000000..c8fe8b26ad
--- /dev/null
+++ b/scripts/lint-changed.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env sh
+
+DIR=$1
+shift
+FILES="$@"
+
+if [ -z "$FILES" ]; then
+ exit 0
+fi
+
+# Strip the directory prefix from each file
+STRIPPED_FILES=""
+for file in $FILES; do
+ STRIPPED_FILES="$STRIPPED_FILES ${file#$DIR/}"
+done
+
+echo "Linting $DIR files: $STRIPPED_FILES"
+(cd "$DIR" && npx eslint --max-warnings 0 $STRIPPED_FILES)