Files
claude-howto/06-hooks/pre-commit.sh
T
Luong NGUYEN 5caeff2f1c refactor: Reorganize repository structure for optimal learning path
Reorder folders based on learning dependencies, complexity, and frequency of use:
- 01-slash-commands (unchanged) - Quick wins for beginners
- 02-memory (was 03) - Essential foundation
- 03-skills (was 05) - Auto-invoked capabilities
- 04-subagents (was 02) - Task delegation
- 05-mcp (was 04) - External integration
- 06-hooks (was 07) - Event automation
- 07-plugins (was 06) - Bundled solutions
- 08-checkpoints (unchanged) - Safe experimentation
- 09-advanced-features (unchanged) - Power user tools

Documentation improvements:
- Add LEARNING-ROADMAP.md with detailed milestones and exercises
- Simplify README.md for better scannability
- Consolidate Quick Start and Getting Started sections
- Combine Feature Comparison and Use Case Matrix tables
- Reorder README sections: Learning Path → Quick Reference → Getting Started
- Update all cross-references across module READMEs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 17:54:58 +01:00

49 lines
996 B
Bash

#!/bin/bash
# Run tests before commit
# Hook: PreCommit
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