#!/bin/bash
# 检查我的任务脚本
AGENT="$1"

if [ -z "$AGENT" ]; then
  echo "使用方法: ./check_my_tasks.sh <agent_name>"
  echo "例如: ./check_my_tasks.sh zhugeliang"
  exit 1
fi

AGENT_DIR="management/agents/${AGENT}"

echo "检查 $AGENT 的任务..."
echo "时间: $(date)"
echo ""

# 检查.task文件
TASK_FILES=$(ls ${AGENT_DIR}/*.task 2>/dev/null)

if [ -n "$TASK_FILES" ]; then
  echo "发现 $(echo "$TASK_FILES" | wc -l) 个任务:"
  echo ""
  
  for TASK_FILE in $TASK_FILES; do
    TASK_ID=$(basename "$TASK_FILE" .task | sed 's/_.*//')
    echo "任务ID: $TASK_ID"
    echo "文件: $(basename $TASK_FILE)"
    echo "内容预览:"
    head -10 "$TASK_FILE"
    echo "---"
    echo ""
  done
else
  echo "没有发现任务"
fi