Skip to content

Commit c595b77

Browse files
committed
block committing bad lockfile
1 parent 3f22a6b commit c595b77

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.husky/pre-commit

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1+
#!/bin/bash
2+
3+
# Load .env file if it exists
4+
if [ -f .env ]; then
5+
export $(grep -v '^#' .env | grep -v '^[[:space:]]*$' | xargs 2>/dev/null)
6+
fi
7+
8+
# Check if AGENT_PACKAGE_LOCATION is set and lockfile is being committed
9+
if [ -n "$AGENT_PACKAGE_LOCATION" ]; then
10+
if git diff --cached --name-only | grep -q "pnpm-lock.yaml"; then
11+
echo "❌ Error: Cannot commit pnpm-lock.yaml when AGENT_PACKAGE_LOCATION is set"
12+
echo " You have a local agent override active in .env"
13+
echo " Either:"
14+
echo " - Comment out AGENT_PACKAGE_LOCATION in .env and run bin/setup"
15+
echo " - Unstage pnpm-lock.yaml: git reset pnpm-lock.yaml"
16+
exit 1
17+
fi
18+
fi
19+
120
pnpm lint-staged

0 commit comments

Comments
 (0)