Skip to content

Commit 11068f7

Browse files
committed
feat(scaffold): pre-commit runs webjs test + webjs check
Tool-agnostic git-level enforcement. Fires on every commit regardless of agent (Claude, Cursor, Windsurf, Copilot, human). Blocks commits that fail tests or convention checks. Skipped on fresh clones before npm install (when the CLI is not yet on PATH). To bypass in emergencies: git commit --no-verify.
1 parent ae71b88 commit 11068f7

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

packages/cli/templates/.hooks/pre-commit

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,28 @@ if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
2121
exit 1
2222
fi
2323

24+
# webjs test + webjs check on every commit. Tool-agnostic enforcement:
25+
# fires regardless of which agent (Claude, Cursor, Windsurf, Copilot,
26+
# human) is making the commit. Skipped if the CLI is not yet installed
27+
# (fresh clone before npm install).
28+
if command -v webjs >/dev/null 2>&1 || [ -x "node_modules/.bin/webjs" ]; then
29+
echo "Running webjs test..."
30+
if ! npx --no-install webjs test; then
31+
echo ""
32+
echo "ERROR: webjs test failed. Fix tests before committing."
33+
echo "To bypass (emergencies only): git commit --no-verify"
34+
echo ""
35+
exit 1
36+
fi
37+
38+
echo "Running webjs check..."
39+
if ! npx --no-install webjs check; then
40+
echo ""
41+
echo "ERROR: webjs check failed. Fix convention violations before committing."
42+
echo "To bypass (emergencies only): git commit --no-verify"
43+
echo ""
44+
exit 1
45+
fi
46+
fi
47+
2448
exit 0

0 commit comments

Comments
 (0)