#!/bin/bash
# 健康检查脚本

echo "========================================="
echo "🔍 系统健康检查报告"
echo "时间: $(date '+%Y-%m-%d %H:%M:%S')"
echo "========================================="
echo ""

echo "📊 1. 文件系统状态:"
echo "  当前目录: $(pwd)"
echo "  权限检查:"
if touch test_health.tmp 2>/dev/null; then
  echo "  ✅ 文件系统可写"
  rm test_health.tmp
else
  echo "  ❌ 文件系统不可写"
fi

echo ""
echo "📁 2. 目录结构:"
echo "  tasks/pending: $(ls management/tasks/pending/ 2>/dev/null | wc -l) 个文件"
echo "  tasks/assigned: $(ls management/tasks/assigned/ 2>/dev/null | wc -l) 个文件"
echo "  agents/pangtong: $(ls management/agents/pangtong/ 2>/dev/null | wc -l) 个文件"

echo ""
echo "🔄 3. Git状态:"
git status --porcelain 2>/dev/null | head -10

echo ""
echo "🎯 4. 工作流验证:"
if [ -f "management/tasks/assigned/TASK-20260322230434.md" ]; then
  echo "  ✅ 任务文件存在"
  if [ -f "management/agents/pangtong/TASK-20260322230434.task" ]; then
    echo "  ✅ Agent通知文件存在"
  else
    echo "  ❌ Agent通知文件不存在"
  fi
else
  echo "  ❌ 任务文件不存在"
fi

echo ""
echo "========================================="
echo "🎉 健康检查完成 - 系统正常"
echo "========================================="