mirror of
https://github.com/luongnv89/claude-howto.git
synced 2026-04-21 21:45:58 +02:00
487c96d950
Update 23 files across all 10 tutorial directories and 7 reference documents to match the latest Claude Code v2.1+ features and correct outdated content including model names (4.5→4.6), permission modes, hook events, CLI syntax, MCP config paths, plugin manifest format, checkpoint commands, session management, and URLs. Add documentation for new features: Auto Memory, Remote Control, Web Sessions, Desktop App, Agent Teams, MCP OAuth, Task List, Sandboxing, and more.
51 lines
1.2 KiB
Bash
51 lines
1.2 KiB
Bash
#!/bin/bash
|
|
# Run tests before commit
|
|
# Hook: PreToolUse (matcher: Bash) - checks if the command is a git commit
|
|
# Note: There is no "PreCommit" hook event. Use PreToolUse with a Bash matcher
|
|
# and inspect the command to detect git commit operations.
|
|
|
|
echo "🧪 Running tests before commit..."
|
|
|
|
# Check if package.json exists (Node.js project)
|
|
if [ -f "package.json" ]; then
|
|
if grep -q "\"test\":" package.json; then
|
|
npm test
|
|
if [ $? -ne 0 ]; then
|
|
echo "❌ Tests failed! Commit blocked."
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# Check if pytest is available (Python project)
|
|
if [ -f "pytest.ini" ] || [ -f "setup.py" ]; then
|
|
if command -v pytest &> /dev/null; then
|
|
pytest
|
|
if [ $? -ne 0 ]; then
|
|
echo "❌ Tests failed! Commit blocked."
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# Check if go.mod exists (Go project)
|
|
if [ -f "go.mod" ]; then
|
|
go test ./...
|
|
if [ $? -ne 0 ]; then
|
|
echo "❌ Tests failed! Commit blocked."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Check if Cargo.toml exists (Rust project)
|
|
if [ -f "Cargo.toml" ]; then
|
|
cargo test
|
|
if [ $? -ne 0 ]; then
|
|
echo "❌ Tests failed! Commit blocked."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "✅ All tests passed! Proceeding with commit."
|
|
exit 0
|