Files
leo-claude-mktplace/plugins/project-hygiene/hooks/cleanup.sh
lmiranda da6e81260e fix(hooks): convert ALL hooks to command type with proper prefixes
ALL hooks now use command type (bash scripts) instead of prompt type.
Prompt hooks are unreliable - model ignores instructions.

Changes:
- projman: SessionStart → startup-check.sh with [projman] prefix
- pr-review: SessionStart → startup-check.sh with [pr-review] prefix
- project-hygiene: cleanup.sh now has [project-hygiene] prefix
- doc-guardian: already fixed (notify.sh with [doc-guardian] prefix)
- code-sentinel: already fixed (security-check.sh with [code-sentinel] prefix)

All hook output now guaranteed to have plugin name prefix.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 12:18:40 -05:00

29 lines
748 B
Bash
Executable File

#!/bin/bash
# project-hygiene cleanup hook
# Runs after file edits to clean up temp files
# All output MUST have [project-hygiene] prefix
set -euo pipefail
PREFIX="[project-hygiene]"
# Read tool input from stdin (discard - we don't need it for cleanup)
cat > /dev/null
PROJECT_ROOT="${PROJECT_ROOT:-.}"
DELETED_COUNT=0
# Silently delete temp files
for pattern in "*.tmp" "*.bak" "*.swp" "*~" ".DS_Store"; do
while IFS= read -r -d '' file; do
rm -f "$file" 2>/dev/null && ((DELETED_COUNT++)) || true
done < <(find "$PROJECT_ROOT" -name "$pattern" -type f -print0 2>/dev/null || true)
done
# Only output if we deleted something
if [[ $DELETED_COUNT -gt 0 ]]; then
echo "$PREFIX Cleaned $DELETED_COUNT temp files"
fi
exit 0