hooks.json 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {
  2. "$schema": "https://docs.anthropic.com/schemas/hooks.json",
  3. "description": "Sprint skill automation hooks - MVP version",
  4. "version": "1.0.0",
  5. "hooks": {
  6. "SessionStart": [
  7. {
  8. "matcher": "*",
  9. "hooks": [
  10. {
  11. "type": "command",
  12. "comment": "Check sprint plan staleness on session start",
  13. "command": "if [ -f docs/PLAN.md ] && [ -d .git ]; then days_old=$(( ($(date +%s) - $(git log -1 --format=%ct docs/PLAN.md 2>/dev/null || echo 0)) / 86400 )); if [ $days_old -gt 3 ]; then echo \"⚠️ Sprint plan is $days_old days old. Run /sprint sync to update.\"; fi; fi"
  14. }
  15. ]
  16. }
  17. ],
  18. "PostToolUse": [
  19. {
  20. "matcher": "Bash",
  21. "hooks": [
  22. {
  23. "type": "command",
  24. "comment": "Suggest sprint sync after git commits",
  25. "command": "cmd=$(echo \"$TOOL_INPUT\" | jq -r '.command // empty' 2>/dev/null); if echo \"$cmd\" | grep -q 'git commit' 2>/dev/null; then echo \"💡 Committed changes. Run /sprint sync to update your plan.\"; fi"
  26. }
  27. ]
  28. },
  29. {
  30. "matcher": "TodoWrite",
  31. "hooks": [
  32. {
  33. "type": "command",
  34. "comment": "Suggest sprint sync after completing multiple tasks",
  35. "command": "completions=$(echo \"$TOOL_INPUT\" | jq '[.todos[] | select(.status == \"completed\")] | length' 2>/dev/null); if [ \"$completions\" -ge 2 ] 2>/dev/null; then echo \"✓ $completions tasks completed! Run /sprint sync to update PLAN.md\"; fi"
  36. }
  37. ]
  38. }
  39. ]
  40. }
  41. }