123 lines
4.3 KiB
Bash
Executable File
123 lines
4.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# DevReview - Developer-Reviewer Workflow
|
|
# Usage: ./scripts/DevReview <backend> <workdir>
|
|
|
|
set -e
|
|
|
|
if [ $# -ne 2 ]; then
|
|
echo "Usage: $0 <backend> <workdir>"
|
|
echo " backend: claude, kiro-cli"
|
|
exit 1
|
|
fi
|
|
|
|
BACKEND="$1"
|
|
PROJECT_PATH="$2"
|
|
PROJECT_NAME=$(basename "$PROJECT_PATH")
|
|
|
|
# Generate a random short identifier
|
|
RANDOM_WORD=$(shuf -n1 -e alpha beta gamma delta zeta theta kappa sigma omega lambda)
|
|
RANDOM_NUM=$(printf "%02d" $((RANDOM % 100)))
|
|
ALIAS_NAME="${RANDOM_WORD}${RANDOM_NUM}"
|
|
|
|
echo "Setting up Developer-Reviewer workflow for: $PROJECT_NAME"
|
|
echo "Project path: $PROJECT_PATH"
|
|
echo "Session alias: $ALIAS_NAME"
|
|
|
|
NAMESPACE=$(namespace)
|
|
if [ -z "$NAMESPACE" ]; then
|
|
echo "Error: No namespace found. Is anvillm running?"
|
|
exit 1
|
|
fi
|
|
|
|
AGENT_MOUNT="agent"
|
|
|
|
echo "Creating developer session..."
|
|
before=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
|
echo "new $BACKEND $PROJECT_PATH role=developer tasks=git,editor,go,rust,python,nodejs,docker,podman,maven,gradle,plan9,gpg,github-cli,agent-q" | 9p write $AGENT_MOUNT/ctl
|
|
after=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
|
DEV_ID=$(comm -13 <(echo "$before") <(echo "$after") | head -1)
|
|
echo "Developer session ID: $DEV_ID"
|
|
|
|
echo "Creating reviewer session..."
|
|
before=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
|
echo "new $BACKEND $PROJECT_PATH role=reviewer tasks=git,github-cli,plan9,agent-q" | 9p write $AGENT_MOUNT/ctl
|
|
after=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
|
REVIEWER_ID=$(comm -13 <(echo "$before") <(echo "$after") | head -1)
|
|
echo "Reviewer session ID: $REVIEWER_ID"
|
|
|
|
# Set aliases
|
|
echo "Setting aliases..."
|
|
echo "${ALIAS_NAME}-dev" | 9p write $AGENT_MOUNT/$DEV_ID/alias
|
|
echo "${ALIAS_NAME}-reviewer" | 9p write $AGENT_MOUNT/$REVIEWER_ID/alias
|
|
|
|
# Set developer context
|
|
cat <<EOF | 9p write $AGENT_MOUNT/$DEV_ID/context
|
|
# DEVELOPER AGENT ROLE
|
|
|
|
You are the developer agent in a two-agent AnviLLM workflow. Your peer is the reviewer agent.
|
|
|
|
## Your workflow:
|
|
|
|
1. When given a task, implement it fully
|
|
2. After implementation, stage all changes using git
|
|
3. Send REVIEW_REQUEST to the reviewer (find by alias containing "reviewer")
|
|
4. When you receive REVIEW_RESPONSE with "LGTM", send LOG_INFO to user summarizing what was done, then you're done
|
|
5. When you receive REVIEW_RESPONSE with suggested changes, implement them and repeat from step 2
|
|
|
|
## MANDATORY: Status Update to User
|
|
|
|
When your task is complete (after receiving LGTM), you MUST send LOG_INFO to user with a summary of what was accomplished and key changes made.
|
|
|
|
**Never finish without sending this status update to the user.**
|
|
|
|
Remember: You are working collaboratively with the reviewer to ensure code quality.
|
|
|
|
For communication with other agents or the user, load the anvillm-communication skill.
|
|
EOF
|
|
|
|
# Set reviewer context
|
|
cat <<EOF | 9p write $AGENT_MOUNT/$REVIEWER_ID/context
|
|
# REVIEWER AGENT ROLE
|
|
|
|
You are the code reviewer agent in a two-agent AnviLLM workflow. Your peer is the developer agent.
|
|
|
|
## Your workflow:
|
|
|
|
1. When you receive a REVIEW_REQUEST, review the staged changes
|
|
2. Use git commands to examine what's been staged:
|
|
- git diff --cached
|
|
- Look for bugs, code quality issues, security concerns
|
|
3. Send REVIEW_RESPONSE to the developer (find by alias containing "dev"):
|
|
- If code is good: body should be "LGTM"
|
|
- If changes needed: body should contain detailed feedback
|
|
|
|
## Review Criteria:
|
|
|
|
- Code correctness
|
|
- Security (no SQL injection, XSS, command injection, etc.)
|
|
- Code style and readability
|
|
- Test coverage
|
|
- Error handling
|
|
|
|
Remember: Be thorough but constructive in your reviews. The goal is high-quality code.
|
|
|
|
For communication with other agents, load the anvillm-communication skill.
|
|
EOF
|
|
|
|
echo ""
|
|
echo "✓ Developer-Reviewer workflow setup complete!"
|
|
echo ""
|
|
echo "Sessions created:"
|
|
echo " Developer: $DEV_ID (alias: ${ALIAS_NAME}-dev)"
|
|
echo " Reviewer: $REVIEWER_ID (alias: ${ALIAS_NAME}-reviewer)"
|
|
echo ""
|
|
echo "To start development:"
|
|
echo " 1. Open the developer agent and give it a task"
|
|
echo " 2. The developer will implement, then automatically request review"
|
|
echo " 3. The reviewer will provide feedback"
|
|
echo " 4. The cycle continues until the reviewer gives LGTM"
|
|
echo ""
|
|
echo "To interact with the agents:"
|
|
echo " - Open developer: echo open $DEV_ID | 9p write $AGENT_MOUNT/ctl"
|
|
echo " - Open reviewer: echo open $REVIEWER_ID | 9p write $AGENT_MOUNT/ctl"
|