Install command
Provided
Generates a comprehensive report when Claude Code workflow stops, including files modified, tests run, and git status.
Open the source and read safety notes before installing.
Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.
Decision playbook
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
0
78
—
No baseline selected
No major trust-signal divergence detected in the current selection.
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Source provenance statusRequired
Marked as source-backed.
Metadata reviewed
Registry metadata indicates a reviewed listing.
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Trust level risk gateRequired
Trust level does not block evaluation.
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Package verification flag
No package verification flag provided.
Checksum metadata
No checksum provided for downloaded artifact.
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
Baseline comparison available
No baseline peer selected yet.
Diverging trust signals identified
No major trust-signal divergence found.
Setup at a glance
Copy-ready — paste the snippet to get started.
Install command
Provided
Config snippet
Provided
Copy snippet
Provided
Prerequisites
None
Platforms
1 listed
Difficulty
0/100
Adoption plan
Current risk score 16/100. Use staged verification before broader rollout.
Validate source and review signals before any execution.
Confirm source provenanceRequired
Source URL/provenance metadata is present.
Confirm metadata review state
Listing has review metadata.
Verify install payload
Install/config payload exists and can be inspected.
Confirm safety, privacy, and package integrity signals.
Review safety notesRequired
Safety notes are present.
Review privacy notesRequired
Privacy notes are present.
Verify package integrity metadata
No package verification/checksum metadata.
Adopt in controlled steps based on the selected plan.
Run in isolated sandbox firstRequired
Use a constrained sandbox and observe behavior across multiple tasks.
Roll out graduallyRequired
Roll out to a small cohort before wider usage.
Set monitoring and fallback
Define rollback path and monitor errors after adoption.
Evidence readiness
Required evidence gates are covered (5/6 signals complete).
Source repository/provenance is listed.
Required in this preset
Review metadata is present.
Required in this preset
Safety notes are present.
Required in this preset
Privacy notes are present.
Optional in this preset
Package integrity metadata is missing.
Optional in this preset
Install payload is available.
Required in this preset
Required evidence gates are covered for this preset.
Decision timeline
5/6 steps complete with no blocking gaps for this preset.
triage
Source/provenance metadata is available.
triage
Review metadata is available.
verify
Safety notes are available.
verify
Privacy notes are available.
verify
Package integrity metadata is missing.
rollout
Install payload is available.
No required blockers for this timeline preset.
Safety & privacy surface
1 safety and 1 privacy notes across 2 risk areas. Review closely: credentials & tokens, permissions & scopes.
#!/bin/bash
echo "📊 ═══════════════════════════════════════════════════"
echo "🎯 WORKFLOW COMPLETION REPORT"
echo "📅 Session Completed: $(date)"
echo "═══════════════════════════════════════════════════"
# Session metadata
SESSION_ID="session-$(date +%Y%m%d_%H%M%S)"
COMPLETION_TIME=$(date)
START_TIME="unknown"
USER=$(whoami 2>/dev/null || echo "developer")
HOST=$(hostname 2>/dev/null || echo "unknown")
WORKDIR=$(pwd)
PROJECT_NAME=$(basename "$WORKDIR" 2>/dev/null || echo "project")
echo "🏷️ Session Info:"
echo " • Session ID: $SESSION_ID"
echo " • Project: $PROJECT_NAME"
echo " • User: $USER@$HOST"
echo " • Directory: $WORKDIR"
# Attempt to determine session duration
if [ -d ".claude" ] && [ "$(find .claude -type f 2>/dev/null | wc -l)" -gt 0 ]; then
START_TIMESTAMP=$(stat -f %B .claude/*.log 2>/dev/null | sort | head -1 || date +%s)
END_TIMESTAMP=$(date +%s)
DURATION=$((END_TIMESTAMP - START_TIMESTAMP))
HOURS=$((DURATION / 3600))
MINUTES=$(((DURATION % 3600) / 60))
echo " • Duration: ${HOURS}h ${MINUTES}m"
else
echo " • Duration: Unknown (no .claude directory)"
fi
echo ""
echo "📁 File System Analysis:"
echo "═══════════════════════════"
# Git analysis
if git rev-parse --git-dir >/dev/null 2>&1; then
echo "📊 Git Repository Status:"
BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
echo " • Current branch: $BRANCH"
# Count modified files
MODIFIED_FILES=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
echo " • Modified files: $MODIFIED_FILES"
# Show file status breakdown
if [ "$MODIFIED_FILES" -gt 0 ]; then
echo " • File status breakdown:"
git status --porcelain 2>/dev/null | cut -c1-2 | sort | uniq -c | while read -r count status; do
case "$status" in
"M "*) echo " - Modified: $count files" ;;
"A "*) echo " - Added: $count files" ;;
"D "*) echo " - Deleted: $count files" ;;
"??"*) echo " - Untracked: $count files" ;;
*) echo " - Other ($status): $count files" ;;
esac
done
fi
# Diff statistics
DIFF_STATS=$(git diff --stat 2>/dev/null)
if [ -n "$DIFF_STATS" ]; then
echo " • Changes summary:"
echo "$DIFF_STATS" | tail -1 | sed 's/^/ /' 2>/dev/null || echo " No statistics available"
fi
# List modified files (top 10)
if [ "$MODIFIED_FILES" -gt 0 ]; then
echo " • Modified files (top 10):"
git status --porcelain 2>/dev/null | head -10 | while read -r status file; do
echo " - $file ($status)"
done
fi
# Recent commits
echo " • Recent commits:"
git log --oneline -3 2>/dev/null | sed 's/^/ /' || echo " No recent commits"
else
echo "❓ Not a git repository"
echo " • Analyzing file system changes..."
# Alternative: look for recently modified files
echo " • Recently modified files (last 2 hours):"
find . -type f -newermt '2 hours ago' 2>/dev/null | head -10 | while read -r file; do
echo " - $file"
done
fi
echo ""
echo "🧪 Testing & Quality Analysis:"
echo "═══════════════════════════════"
# Test framework detection and analysis
TEST_FRAMEWORK="none"
TEST_COUNT=0
if [ -f "package.json" ]; then
echo "📦 Node.js Project Analysis:"
# Detect test framework
if grep -q '"jest"' package.json 2>/dev/null; then
TEST_FRAMEWORK="jest"
echo " • Testing framework: Jest"
elif grep -q '"vitest"' package.json 2>/dev/null; then
TEST_FRAMEWORK="vitest"
echo " • Testing framework: Vitest"
elif grep -q '"mocha"' package.json 2>/dev/null; then
TEST_FRAMEWORK="mocha"
echo " • Testing framework: Mocha"
else
echo " • Testing framework: Not detected"
fi
# Count test files
TEST_COUNT=$(find . -name "*.test.*" -o -name "*.spec.*" | grep -v node_modules | wc -l | tr -d ' ')
echo " • Test files found: $TEST_COUNT"
# Dependencies analysis
DEPS_COUNT=$(jq -r '.dependencies // {} | keys | length' package.json 2>/dev/null || echo "unknown")
DEV_DEPS_COUNT=$(jq -r '.devDependencies // {} | keys | length' package.json 2>/dev/null || echo "unknown")
echo " • Dependencies: $DEPS_COUNT production, $DEV_DEPS_COUNT development"
# Check for outdated packages
echo " • Checking for outdated packages..."
OUTDATED_COUNT=$(npm outdated 2>/dev/null | tail -n +2 | wc -l | tr -d ' ')
if [ "$OUTDATED_COUNT" -gt 0 ]; then
echo " - $OUTDATED_COUNT packages have updates available"
else
echo " - All packages are up to date"
fi
elif [ -f "requirements.txt" ] || [ -f "setup.py" ] || [ -f "pyproject.toml" ]; then
echo "🐍 Python Project Analysis:"
if command -v pytest >/dev/null 2>&1; then
TEST_FRAMEWORK="pytest"
echo " • Testing framework: pytest"
TEST_COUNT=$(find . -name "test_*.py" -o -name "*_test.py" | wc -l | tr -d ' ')
else
echo " • Testing framework: unittest (built-in)"
TEST_COUNT=$(find . -name "test*.py" | wc -l | tr -d ' ')
fi
echo " • Test files found: $TEST_COUNT"
elif [ -f "Cargo.toml" ]; then
echo "🦀 Rust Project Analysis:"
echo " • Testing framework: Built-in (cargo test)"
TEST_COUNT=$(find . -name "*.rs" -exec grep -l "#\[test\]" {} \; | wc -l | tr -d ' ')
echo " • Files with tests: $TEST_COUNT"
else
echo "❓ Project type not recognized"
fi
# Performance and metrics
echo ""
echo "📈 Performance & Metrics:"
echo "═══════════════════════════"
# Code complexity analysis (basic)
if [ "$TEST_COUNT" -gt 0 ]; then
echo "✅ Test Coverage Status:"
echo " • Test files available: $TEST_COUNT"
echo " • Testing framework: $TEST_FRAMEWORK"
else
echo "⚠️ No test files detected"
fi
# File type analysis
echo "📊 Codebase Composition:"
for ext in js ts jsx tsx py rs go java c cpp; do
count=$(find . -name "*.$ext" | grep -v node_modules | wc -l | tr -d ' ')
if [ "$count" -gt 0 ]; then
echo " • .$ext files: $count"
fi
done
# Lines of code estimation
TOTAL_LOC=$(find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.jsx" -o -name "*.tsx" -o -name "*.py" -o -name "*.rs" -o -name "*.go" \) | grep -v node_modules | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}' || echo "unknown")
echo " • Estimated lines of code: $TOTAL_LOC"
# Session archival
echo ""
echo "💾 Session Archival:"
echo "═══════════════════"
# Create session report file
REPORT_FILE=".claude-reports/$SESSION_ID.log"
mkdir -p .claude-reports
cat > "$REPORT_FILE" << EOF
CLAUDE CODE WORKFLOW COMPLETION REPORT
======================================
Session ID: $SESSION_ID
Completed: $COMPLETION_TIME
Project: $PROJECT_NAME
User: $USER@$HOST
Directory: $WORKDIR
FILE CHANGES:
$(git status --porcelain 2>/dev/null || echo "Not a git repository")
DIFF STATISTICS:
$(git diff --stat 2>/dev/null || echo "No git changes")
TEST STATUS:
- Framework: $TEST_FRAMEWORK
- Test files: $TEST_COUNT
PROJECT METRICS:
- Total LOC (estimated): $TOTAL_LOC
- Modified files: $MODIFIED_FILES
EOF
echo "📄 Session report saved: $REPORT_FILE"
echo "📁 Report directory: .claude-reports/"
# Cleanup old reports (keep last 30)
find .claude-reports -name "session-*.log" | sort | head -n -30 | xargs rm -f 2>/dev/null
echo ""
echo "💡 Workflow Summary:"
echo "═══════════════════"
echo " • Session completed successfully"
echo " • Files modified: $MODIFIED_FILES"
echo " • Test files available: $TEST_COUNT"
echo " • Project type: $([ -f package.json ] && echo 'Node.js' || [ -f requirements.txt ] && echo 'Python' || [ -f Cargo.toml ] && echo 'Rust' || echo 'Unknown')"
echo " • Git repository: $([ -d .git ] && echo 'Yes' || echo 'No')"
echo ""
echo "🎯 Next Steps:"
echo " • Review all changes before committing"
echo " • Run tests to ensure code quality"
echo " • Update documentation if needed"
echo " • Consider code review for significant changes"
echo ""
echo "📊 ═══════════════════════════════════════════════════"
echo "🎉 Workflow completion report generated successfully!"
echo "📋 Full report available at: $REPORT_FILE"
echo "═══════════════════════════════════════════════════"
exit 0{
"hooks": {
"stop": {
"script": "./.claude/hooks/workflow-completion-report.sh",
"matchers": [
"*"
]
}
}
}.claude/settings.local.json~/.claude/settings.json.claude/settings.json{
"hooks": {
"stop": {
"script": "./.claude/hooks/workflow-completion-report.sh",
"matchers": ["*"]
}
}
}
#!/bin/bash
echo "📊 ═══════════════════════════════════════════════════"
echo "🎯 WORKFLOW COMPLETION REPORT"
echo "📅 Session Completed: $(date)"
echo "═══════════════════════════════════════════════════"
# Session metadata
SESSION_ID="session-$(date +%Y%m%d_%H%M%S)"
COMPLETION_TIME=$(date)
START_TIME="unknown"
USER=$(whoami 2>/dev/null || echo "developer")
HOST=$(hostname 2>/dev/null || echo "unknown")
WORKDIR=$(pwd)
PROJECT_NAME=$(basename "$WORKDIR" 2>/dev/null || echo "project")
echo "🏷️ Session Info:"
echo " • Session ID: $SESSION_ID"
echo " • Project: $PROJECT_NAME"
echo " • User: $USER@$HOST"
echo " • Directory: $WORKDIR"
# Attempt to determine session duration
if [ -d ".claude" ] && [ "$(find .claude -type f 2>/dev/null | wc -l)" -gt 0 ]; then
START_TIMESTAMP=$(stat -f %B .claude/*.log 2>/dev/null | sort | head -1 || date +%s)
END_TIMESTAMP=$(date +%s)
DURATION=$((END_TIMESTAMP - START_TIMESTAMP))
HOURS=$((DURATION / 3600))
MINUTES=$(((DURATION % 3600) / 60))
echo " • Duration: ${HOURS}h ${MINUTES}m"
else
echo " • Duration: Unknown (no .claude directory)"
fi
echo ""
echo "📁 File System Analysis:"
echo "═══════════════════════════"
# Git analysis
if git rev-parse --git-dir >/dev/null 2>&1; then
echo "📊 Git Repository Status:"
BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
echo " • Current branch: $BRANCH"
# Count modified files
MODIFIED_FILES=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
echo " • Modified files: $MODIFIED_FILES"
# Show file status breakdown
if [ "$MODIFIED_FILES" -gt 0 ]; then
echo " • File status breakdown:"
git status --porcelain 2>/dev/null | cut -c1-2 | sort | uniq -c | while read -r count status; do
case "$status" in
"M "*) echo " - Modified: $count files" ;;
"A "*) echo " - Added: $count files" ;;
"D "*) echo " - Deleted: $count files" ;;
"??"*) echo " - Untracked: $count files" ;;
*) echo " - Other ($status): $count files" ;;
esac
done
fi
# Diff statistics
DIFF_STATS=$(git diff --stat 2>/dev/null)
if [ -n "$DIFF_STATS" ]; then
echo " • Changes summary:"
echo "$DIFF_STATS" | tail -1 | sed 's/^/ /' 2>/dev/null || echo " No statistics available"
fi
# List modified files (top 10)
if [ "$MODIFIED_FILES" -gt 0 ]; then
echo " • Modified files (top 10):"
git status --porcelain 2>/dev/null | head -10 | while read -r status file; do
echo " - $file ($status)"
done
fi
# Recent commits
echo " • Recent commits:"
git log --oneline -3 2>/dev/null | sed 's/^/ /' || echo " No recent commits"
else
echo "❓ Not a git repository"
echo " • Analyzing file system changes..."
# Alternative: look for recently modified files
echo " • Recently modified files (last 2 hours):"
find . -type f -newermt '2 hours ago' 2>/dev/null | head -10 | while read -r file; do
echo " - $file"
done
fi
echo ""
echo "🧪 Testing & Quality Analysis:"
echo "═══════════════════════════════"
# Test framework detection and analysis
TEST_FRAMEWORK="none"
TEST_COUNT=0
if [ -f "package.json" ]; then
echo "📦 Node.js Project Analysis:"
# Detect test framework
if grep -q '"jest"' package.json 2>/dev/null; then
TEST_FRAMEWORK="jest"
echo " • Testing framework: Jest"
elif grep -q '"vitest"' package.json 2>/dev/null; then
TEST_FRAMEWORK="vitest"
echo " • Testing framework: Vitest"
elif grep -q '"mocha"' package.json 2>/dev/null; then
TEST_FRAMEWORK="mocha"
echo " • Testing framework: Mocha"
else
echo " • Testing framework: Not detected"
fi
# Count test files
TEST_COUNT=$(find . -name "*.test.*" -o -name "*.spec.*" | grep -v node_modules | wc -l | tr -d ' ')
echo " • Test files found: $TEST_COUNT"
# Dependencies analysis
DEPS_COUNT=$(jq -r '.dependencies // {} | keys | length' package.json 2>/dev/null || echo "unknown")
DEV_DEPS_COUNT=$(jq -r '.devDependencies // {} | keys | length' package.json 2>/dev/null || echo "unknown")
echo " • Dependencies: $DEPS_COUNT production, $DEV_DEPS_COUNT development"
# Check for outdated packages
echo " • Checking for outdated packages..."
OUTDATED_COUNT=$(npm outdated 2>/dev/null | tail -n +2 | wc -l | tr -d ' ')
if [ "$OUTDATED_COUNT" -gt 0 ]; then
echo " - $OUTDATED_COUNT packages have updates available"
else
echo " - All packages are up to date"
fi
elif [ -f "requirements.txt" ] || [ -f "setup.py" ] || [ -f "pyproject.toml" ]; then
echo "🐍 Python Project Analysis:"
if command -v pytest >/dev/null 2>&1; then
TEST_FRAMEWORK="pytest"
echo " • Testing framework: pytest"
TEST_COUNT=$(find . -name "test_*.py" -o -name "*_test.py" | wc -l | tr -d ' ')
else
echo " • Testing framework: unittest (built-in)"
TEST_COUNT=$(find . -name "test*.py" | wc -l | tr -d ' ')
fi
echo " • Test files found: $TEST_COUNT"
elif [ -f "Cargo.toml" ]; then
echo "🦀 Rust Project Analysis:"
echo " • Testing framework: Built-in (cargo test)"
TEST_COUNT=$(find . -name "*.rs" -exec grep -l "#\[test\]" {} \; | wc -l | tr -d ' ')
echo " • Files with tests: $TEST_COUNT"
else
echo "❓ Project type not recognized"
fi
# Performance and metrics
echo ""
echo "📈 Performance & Metrics:"
echo "═══════════════════════════"
# Code complexity analysis (basic)
if [ "$TEST_COUNT" -gt 0 ]; then
echo "✅ Test Coverage Status:"
echo " • Test files available: $TEST_COUNT"
echo " • Testing framework: $TEST_FRAMEWORK"
else
echo "⚠️ No test files detected"
fi
# File type analysis
echo "📊 Codebase Composition:"
for ext in js ts jsx tsx py rs go java c cpp; do
count=$(find . -name "*.$ext" | grep -v node_modules | wc -l | tr -d ' ')
if [ "$count" -gt 0 ]; then
echo " • .$ext files: $count"
fi
done
# Lines of code estimation
TOTAL_LOC=$(find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.jsx" -o -name "*.tsx" -o -name "*.py" -o -name "*.rs" -o -name "*.go" \) | grep -v node_modules | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}' || echo "unknown")
echo " • Estimated lines of code: $TOTAL_LOC"
# Session archival
echo ""
echo "💾 Session Archival:"
echo "═══════════════════"
# Create session report file
REPORT_FILE=".claude-reports/$SESSION_ID.log"
mkdir -p .claude-reports
cat > "$REPORT_FILE" << EOF
CLAUDE CODE WORKFLOW COMPLETION REPORT
======================================
Session ID: $SESSION_ID
Completed: $COMPLETION_TIME
Project: $PROJECT_NAME
User: $USER@$HOST
Directory: $WORKDIR
FILE CHANGES:
$(git status --porcelain 2>/dev/null || echo "Not a git repository")
DIFF STATISTICS:
$(git diff --stat 2>/dev/null || echo "No git changes")
TEST STATUS:
- Framework: $TEST_FRAMEWORK
- Test files: $TEST_COUNT
PROJECT METRICS:
- Total LOC (estimated): $TOTAL_LOC
- Modified files: $MODIFIED_FILES
EOF
echo "📄 Session report saved: $REPORT_FILE"
echo "📁 Report directory: .claude-reports/"
# Cleanup old reports (keep last 30)
find .claude-reports -name "session-*.log" | sort | head -n -30 | xargs rm -f 2>/dev/null
echo ""
echo "💡 Workflow Summary:"
echo "═══════════════════"
echo " • Session completed successfully"
echo " • Files modified: $MODIFIED_FILES"
echo " • Test files available: $TEST_COUNT"
echo " • Project type: $([ -f package.json ] && echo 'Node.js' || [ -f requirements.txt ] && echo 'Python' || [ -f Cargo.toml ] && echo 'Rust' || echo 'Unknown')"
echo " • Git repository: $([ -d .git ] && echo 'Yes' || echo 'No')"
echo ""
echo "🎯 Next Steps:"
echo " • Review all changes before committing"
echo " • Run tests to ensure code quality"
echo " • Update documentation if needed"
echo " • Consider code review for significant changes"
echo ""
echo "📊 ═══════════════════════════════════════════════════"
echo "🎉 Workflow completion report generated successfully!"
echo "📋 Full report available at: $REPORT_FILE"
echo "═══════════════════════════════════════════════════"
exit 0
Complete hook script that automatically generates comprehensive workflow completion reports when Claude Code workflow stops
#!/bin/bash
echo "📊 ═══════════════════════════════════════════════════"
echo "🎯 WORKFLOW COMPLETION REPORT"
echo "📅 Session Completed: $(date)"
echo "═══════════════════════════════════════════════════"
SESSION_ID="session-$(date +%Y%m%d_%H%M%S)"
COMPLETION_TIME=$(date)
WORKDIR=$(pwd)
PROJECT_NAME=$(basename "$WORKDIR" 2>/dev/null || echo "project")
echo "🏷️ Session Info:"
echo " • Session ID: $SESSION_ID"
echo " • Project: $PROJECT_NAME"
echo " • Directory: $WORKDIR"
if git rev-parse --git-dir >/dev/null 2>&1; then
echo "📊 Git Repository Status:"
BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
echo " • Current branch: $BRANCH"
MODIFIED_FILES=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
echo " • Modified files: $MODIFIED_FILES"
if [ "$MODIFIED_FILES" -gt 0 ]; then
echo " • File status breakdown:"
git status --porcelain 2>/dev/null | cut -c1-2 | sort | uniq -c | while read -r count status; do
case "$status" in
"M "*) echo " - Modified: $count files" ;;
"A "*) echo " - Added: $count files" ;;
"D "*) echo " - Deleted: $count files" ;;
"??"*) echo " - Untracked: $count files" ;;
esac
done
fi
fi
REPORT_FILE=".claude-reports/$SESSION_ID.log"
mkdir -p .claude-reports
cat > "$REPORT_FILE" << EOF
CLAUDE CODE WORKFLOW COMPLETION REPORT
======================================
Session ID: $SESSION_ID
Completed: $COMPLETION_TIME
Project: $PROJECT_NAME
Directory: $WORKDIR
FILE CHANGES:
$(git status --porcelain 2>/dev/null || echo "Not a git repository")
EOF
echo "📄 Session report saved: $REPORT_FILE"
echo "🎉 Workflow completion report generated successfully!"
exit 0
Complete hook configuration for .claude/settings.json to enable automatic workflow completion reporting
{
"hooks": {
"stop": {
"script": "./.claude/hooks/workflow-completion-report.sh",
"matchers": ["*"]
}
}
}
Enhanced hook script with session duration tracking, Git diff statistics, test framework detection, and automatic report cleanup
#!/bin/bash
echo "📊 ═══════════════════════════════════════════════════"
echo "🎯 WORKFLOW COMPLETION REPORT"
echo "📅 Session Completed: $(date)"
echo "═══════════════════════════════════════════════════"
SESSION_ID="session-$(date +%Y%m%d_%H%M%S)"
COMPLETION_TIME=$(date)
START_TIME="unknown"
if [ -f ".claude/session-start" ]; then
START_TIMESTAMP=$(cat .claude/session-start 2>/dev/null || echo "")
if [ -n "$START_TIMESTAMP" ]; then
END_TIMESTAMP=$(date +%s)
DURATION=$((END_TIMESTAMP - START_TIMESTAMP))
HOURS=$((DURATION / 3600))
MINUTES=$(((DURATION % 3600) / 60))
echo " • Duration: ${HOURS}h ${MINUTES}m"
fi
fi
if git rev-parse --git-dir >/dev/null 2>&1; then
echo "📊 Git Repository Status:"
BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
MODIFIED_FILES=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
DIFF_STATS=$(git diff --stat 2>/dev/null)
if [ -n "$DIFF_STATS" ]; then
echo " • Changes summary:"
echo "$DIFF_STATS" | tail -1 | sed 's/^/ /' 2>/dev/null
fi
fi
if [ -f "package.json" ]; then
echo "📦 Node.js Project Analysis:"
if grep -q '"jest"' package.json 2>/dev/null; then
TEST_FRAMEWORK="jest"
echo " • Testing framework: Jest"
elif grep -q '"vitest"' package.json 2>/dev/null; then
TEST_FRAMEWORK="vitest"
echo " • Testing framework: Vitest"
fi
TEST_COUNT=$(find . -name "*.test.*" -o -name "*.spec.*" | grep -v node_modules | wc -l | tr -d ' ')
echo " • Test files found: $TEST_COUNT"
fi
REPORT_FILE=".claude-reports/$SESSION_ID.log"
mkdir -p .claude-reports
cat > "$REPORT_FILE" << EOF
CLAUDE CODE WORKFLOW COMPLETION REPORT
======================================
Session ID: $SESSION_ID
Completed: $COMPLETION_TIME
Duration: ${HOURS}h ${MINUTES}m
FILE CHANGES:
$(git status --porcelain 2>/dev/null || echo "Not a git repository")
DIFF STATISTICS:
$(git diff --stat 2>/dev/null || echo "No git changes")
TEST STATUS:
- Framework: $TEST_FRAMEWORK
- Test files: $TEST_COUNT
EOF
find .claude-reports -name "session-*.log" -type f -printf "%T@ %p\n" | sort -n | head -n -30 | cut -d" " -f2- | xargs rm -f 2>/dev/null
echo "📄 Session report saved: $REPORT_FILE"
echo "🎉 Workflow completion report generated successfully!"
exit 0
Enhanced hook script with multi-language project detection (Node.js, Python, Rust), dependency analysis, outdated package checking with timeout, and comprehensive metrics
#!/bin/bash
echo "📊 ═══════════════════════════════════════════════════"
echo "🎯 WORKFLOW COMPLETION REPORT"
echo "📅 Session Completed: $(date)"
echo "═══════════════════════════════════════════════════"
SESSION_ID="session-$(date +%Y%m%d_%H%M%S)"
COMPLETION_TIME=$(date)
WORKDIR=$(pwd)
PROJECT_NAME=$(basename "$WORKDIR" 2>/dev/null || echo "project")
if git rev-parse --git-dir >/dev/null 2>&1; then
echo "📊 Git Repository Status:"
BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
MODIFIED_FILES=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
echo " • Current branch: $BRANCH"
echo " • Modified files: $MODIFIED_FILES"
if [ "$MODIFIED_FILES" -gt 0 ]; then
echo " • Modified files (top 10):"
git status --porcelain 2>/dev/null | head -10 | while read -r status file; do
echo " - $file ($status)"
done
fi
echo " • Recent commits:"
git log --oneline -3 2>/dev/null | sed 's/^/ /' || echo " No recent commits"
fi
if [ -f "package.json" ]; then
echo "📦 Node.js Project Analysis:"
TEST_COUNT=$(find . -name "*.test.*" -o -name "*.spec.*" | grep -v node_modules | wc -l | tr -d ' ')
echo " • Test files found: $TEST_COUNT"
DEPS_COUNT=$(jq -r '.dependencies // {} | keys | length' package.json 2>/dev/null || echo "unknown")
DEV_DEPS_COUNT=$(jq -r '.devDependencies // {} | keys | length' package.json 2>/dev/null || echo "unknown")
echo " • Dependencies: $DEPS_COUNT production, $DEV_DEPS_COUNT development"
timeout 10 npm outdated 2>/dev/null | tail -n +2 | wc -l | tr -d ' ' | while read -r OUTDATED_COUNT; do
if [ "$OUTDATED_COUNT" -gt 0 ]; then
echo " • Outdated packages: $OUTDATED_COUNT"
else
echo " • All packages are up to date"
fi
done
elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
echo "🐍 Python Project Analysis:"
if command -v pytest >/dev/null 2>&1; then
TEST_FRAMEWORK="pytest"
echo " • Testing framework: pytest"
TEST_COUNT=$(find . -name "test_*.py" -o -name "*_test.py" | wc -l | tr -d ' ')
else
echo " • Testing framework: unittest (built-in)"
TEST_COUNT=$(find . -name "test*.py" | wc -l | tr -d ' ')
fi
echo " • Test files found: $TEST_COUNT"
elif [ -f "Cargo.toml" ]; then
echo "🦀 Rust Project Analysis:"
echo " • Testing framework: Built-in (cargo test)"
TEST_COUNT=$(find . -name "*.rs" -exec grep -l "#\\[test\\]" {} \; | wc -l | tr -d ' ')
echo " • Files with tests: $TEST_COUNT"
fi
TOTAL_LOC=$(find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.jsx" -o -name "*.tsx" -o -name "*.py" -o -name "*.rs" -o -name "*.go" \) | grep -v node_modules | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}' || echo "unknown")
echo "📊 Codebase Composition:"
echo " • Estimated lines of code: $TOTAL_LOC"
REPORT_FILE=".claude-reports/$SESSION_ID.log"
mkdir -p .claude-reports
cat > "$REPORT_FILE" << EOF
CLAUDE CODE WORKFLOW COMPLETION REPORT
======================================
Session ID: $SESSION_ID
Completed: $COMPLETION_TIME
Project: $PROJECT_NAME
FILE CHANGES:
$(git status --porcelain 2>/dev/null || echo "Not a git repository")
PROJECT METRICS:
- Total LOC (estimated): $TOTAL_LOC
- Modified files: $MODIFIED_FILES
- Test files: $TEST_COUNT
EOF
find .claude-reports -name "session-*.log" -type f -printf "%T@ %p\n" | sort -n | head -n -30 | cut -d" " -f2- | xargs rm -f 2>/dev/null
echo "📄 Session report saved: $REPORT_FILE"
echo "🎉 Workflow completion report generated successfully!"
exit 0
Example workflow completion report configuration for customizing report generation behavior
{
"workflow_completion_report": {
"enabled": true,
"report_directory": ".claude-reports",
"keep_reports": 30,
"session_tracking": true,
"git_analysis": true,
"test_analysis": true,
"dependency_analysis": true,
"outdated_check_timeout": 10,
"project_types": ["nodejs", "python", "rust", "go", "java"],
"exclude_patterns": [
"**/node_modules/**",
"**/vendor/**",
"**/target/**",
"**/dist/**",
"**/build/**"
]
}
}
Hook reads .claude/session-start file but file may not exist. Create marker: 'echo "$(date +%s)" > .claude/session-start' at init, then read: 'START_TIMESTAMP=$(cat .claude/session-start)'. Verify .claude directory exists. Check file permissions.
npm outdated performs network checks timing out on slow connections. Add wrapper: 'timeout 10 npm outdated 2>/dev/null || echo "Check skipped"'. Or comment out for speed. Verify timeout command available. Check network connectivity.
Sort bug: 'find | sort | head -n -30' removes newest alphabetically. Fix with time sort: 'find .claude-reports -type f -printf "%T@ %p\n" | sort -n | head -n -30 | cut -d" " -f2- | xargs rm -f'. Verify find supports -printf. Check file timestamps.
git diff excludes untracked files. Combine: 'git diff --stat; git diff --cached --stat' for staged. Or use: 'git diff HEAD --stat' showing all uncommitted modifications. Verify Git repository state. Check git diff command.
find without depth limit includes nodemodules. Add exclusion: 'find . -name ".test." -not -path "/nodemodules/" -not -path "/vendor/"' for accurate counts. Verify find command. Check exclusion patterns.
Verify .claude-reports directory exists and has write permissions: 'mkdir -p .claude-reports && chmod 755 .claude-reports'. Check disk space. Verify REPORT_FILE path. Test directory creation manually.
git branch --show-current returns empty in detached HEAD. Use: 'git rev-parse --abbrev-ref HEAD' or 'git describe --tags --exact-match HEAD 2>/dev/null || git rev-parse --short HEAD'. Verify Git repository state. Check HEAD reference.
wc -l may fail on binary files or very large files. Add file type filtering: 'find . -type f ( -name ".js" -o -name ".ts" ) | xargs wc -l 2>/dev/null'. Verify find command. Check file exclusions. Test wc command manually.
Show that Workflow Completion Report - Hooks is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/hooks/workflow-completion-report)Workflow Completion Report - Hooks side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | Generates a comprehensive report when Claude Code workflow stops, including files modified, tests run, and git status. Open dossier | Generates a comprehensive test coverage report when the coding session ends. Open dossier | Analyzes and reports final bundle sizes when the development session ends. Open dossier | Collects and reports detailed metrics about the coding session when Claude stops. Open dossier |
|---|---|---|---|---|
| Next steps | ||||
| Trust | ||||
| Review status | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed |
| Package trust | Package not verified | Package not verified | Package not verified | Package not verified |
| Source provenance | Source-backed | Source-backed | Source-backed | Source-backed |
| Submitter | — | — | — | — |
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Brand | — | — | — | — |
| Category | hooks | hooks | hooks | hooks |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | JSONbored | JSONbored | JSONbored | JSONbored |
| Added | 2025-09-19 | 2025-09-19 | 2025-09-19 | 2025-09-19 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | ✓Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling. | ✓Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling. | ✓Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling. | ✓Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling. |
| Privacy notes | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. |
| Prerequisites | — none listed | — none listed | — none listed | — none listed |
| Install | | | | |
| Config | | | | |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Source-backed guides for putting this to work.
Manage parallel Claude Code background sessions with agent view dispatch, peek/reply, attach/detach, and shell fleet commands.
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.