Files
document_analyzer/scripts/start_qe_agent.sh
T
2026-05-31 17:14:01 +08:00

55 lines
2.4 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# QE-Agent 启动脚本 — 在 Git Bash 中运行
# 用法: bash scripts/start_qe_agent.sh
set -e
export GITEA_API_TOKEN="59117246ec418d5d87042de073b0d4197d8054bf"
export GITEA_URL="http://localhost:3000"
export GITEA_REPO="pzhang_zywl/document_analyzer"
cd "$(dirname "$0")/.."
echo "============================================"
echo " QE-Agent 启动器"
echo "============================================"
echo ""
echo "模式选择:"
echo " [1] 单次任务 - 检查一次 test-dev Issue 并处理"
echo " [2] 持续轮询 - 每 10 分钟检查一次 (推荐)"
echo " [3] 交互模式 - 进入对话手动操作"
echo ""
read -r -p "请输入 (1/2/3): " MODE
case "$MODE" in
1)
echo ""
echo "正在执行单次检查..."
claude -p --agent agents/QE_AGENT.md \
"你是 QE-Agent。检查 Gitea 上的 test-dev 和 acceptance-failure 标签 Issue--action list --labels test-dev 和 --labels acceptance-failure)。对 test-dev Issue:分析内容 → 开发验收测试到 tests/acceptance/ → pytest 本地验证 → commit 'test: <描述> - Closes #N' → push → create-pr → comment Issue → 等 CI 通过 → merge-pr。对 acceptance-failure Issue:分析失败原因 → 如果是测试本身问题修复测试 → 如果是管道问题开 test-dev issue 跟踪。"
;;
2)
echo ""
echo "启动持续轮询模式 (每 10 分钟)..."
echo "按 Ctrl+C 停止"
claude -p --agent agents/QE_AGENT.md \
"你是 QE-Agent。用 loop 模式每 10 分钟检查一次 Gitea 上的 test-dev 和 acceptance-failure 标签 Issue。对 test-dev Issue 走完整闭环:分析→开发验收测试→pytest验证→commit('test:' 前缀)→push→create-pr→comment→CI→merge-pr。对 acceptance-failure 分析失败原因→修复→push→PR。每个步骤用 agent_poller.py 对应命令。如果没有待处理 Issue,报告 '当前没有 QE 相关 Issuemain branch 质量正常'。"
;;
3)
echo ""
echo "启动交互模式 (默认 10 分钟轮询)..."
echo "按 Ctrl+C 停止"
echo ""
echo "可用命令速查:"
echo " agent_poller.py --action list --labels test-dev"
echo " agent_poller.py --action list --labels acceptance-failure"
echo " agent_poller.py --action get --issue <N>"
echo " python -m pytest tests/acceptance/ -v --run-acceptance"
claude --agent agents/QE_AGENT.md
;;
*)
echo "无效选择。"
exit 1
;;
esac