27 lines
628 B
Bash
27 lines
628 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Example: use the swarm to review a PR diff.
|
||
|
|
|
||
|
|
cd "$(dirname "$0")/.."
|
||
|
|
|
||
|
|
TOPIC=$(cat <<'EOF'
|
||
|
|
Review the following PR diff for correctness, performance, and style.
|
||
|
|
Only discuss the diff; do not invent unrelated improvements.
|
||
|
|
|
||
|
|
EOF
|
||
|
|
)
|
||
|
|
|
||
|
|
# Append the actual diff, e.g. from stdin or a file
|
||
|
|
if [ -p /dev/stdin ]; then
|
||
|
|
TOPIC="${TOPIC}$(cat)"
|
||
|
|
else
|
||
|
|
echo "Usage: cat diff.patch | ./examples/code-review.sh"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
python3 scripts/swarm_chat.py \
|
||
|
|
--topic "$TOPIC" \
|
||
|
|
--agents swarm-critic swarm-reviewer swarm-coder \
|
||
|
|
--roles critic reviewer coder \
|
||
|
|
--rounds 2 \
|
||
|
|
--room project:swarm:code_review
|