#!/bin/bash
# 以指定agent身份提交

if [[ $# -lt 2 ]]; then
    echo "用法: ./commit_as_agent.sh <agent名称> \"提交信息\" [文件...]"
    exit 1
fi

AGENT_NAME=$1
MESSAGE=$2
shift 2
FILES=$@

echo "📝 Agent $AGENT_NAME 正在提交..."
python3 -c "
import sys
sys.path.append('agents')
from agent_identity_manager import AgentIdentityManager
manager = AgentIdentityManager()
try:
    manager.commit_as_agent('$AGENT_NAME', '$MESSAGE', '$FILES'.split() if '$FILES' else None)
    print('✅ 提交成功')
except Exception as e:
    print(f'❌ 提交失败: {e}')
    exit(1)
"
