Refactor workflow scripts and remove PID from session list
- Remove PID column from session list display in main.go - Rename workflow scripts: Claude-DevReview.sh -> DevReview, Kiro-Planning.sh -> Planning - Make workflow scripts backend-agnostic (accept backend as first argument) - Install workflow scripts to $INSTALL_PATH/Workflows/ in mkfile
This commit is contained in:
parent
ef8cc122fd
commit
a71a1ff8e8
12
main.go
12
main.go
|
|
@ -272,9 +272,9 @@ func refreshList(w *acme.Win, mgr *session.Manager) {
|
|||
var buf strings.Builder
|
||||
// Backends line
|
||||
buf.WriteString("Backends: [Kiro] [Claude]\n\n")
|
||||
// Header: ID=5, Backend=10, State=9, PID=8, Alias=16, Cwd=remaining
|
||||
buf.WriteString(fmt.Sprintf("%-5s %-10s %-9s %-8s %-16s %s\n", "ID", "Backend", "State", "PID", "Alias", "Cwd"))
|
||||
buf.WriteString(fmt.Sprintf("%-5s %-10s %-9s %-8s %-16s %s\n", "-----", "----------", "---------", "--------", "----------------", strings.Repeat("-", 40)))
|
||||
// Header: ID=5, Backend=10, State=9, Alias=16, Cwd=remaining
|
||||
buf.WriteString(fmt.Sprintf("%-5s %-10s %-9s %-16s %s\n", "ID", "Backend", "State", "Alias", "Cwd"))
|
||||
buf.WriteString(fmt.Sprintf("%-5s %-10s %-9s %-16s %s\n", "-----", "----------", "---------", "----------------", strings.Repeat("-", 40)))
|
||||
for _, id := range mgr.List() {
|
||||
sess := mgr.Get(id)
|
||||
if sess == nil {
|
||||
|
|
@ -294,11 +294,7 @@ func refreshList(w *acme.Win, mgr *session.Manager) {
|
|||
if alias == "" {
|
||||
alias = "-"
|
||||
}
|
||||
cwd := meta.Cwd
|
||||
if len(cwd) > 80 {
|
||||
cwd = "..." + cwd[len(cwd)-77:]
|
||||
}
|
||||
buf.WriteString(fmt.Sprintf("%-5s %-10s %-9s %-8d %-16s %s\n", sess.ID(), meta.Backend, sess.State(), meta.Pid, alias, cwd))
|
||||
buf.WriteString(fmt.Sprintf("%-5s %-10s %-9s %-16s %s\n", sess.ID(), meta.Backend, sess.State(), alias, meta.Cwd))
|
||||
}
|
||||
w.Addr(",")
|
||||
w.Write("data", []byte(buf.String()))
|
||||
|
|
|
|||
5
mkfile
5
mkfile
|
|
@ -6,6 +6,11 @@ build:V:
|
|||
go build -o $INSTALL_PATH/Assist .
|
||||
cp anvillm-notify $INSTALL_PATH/anvillm-notify
|
||||
chmod +x $INSTALL_PATH/anvillm-notify
|
||||
mkdir -p $INSTALL_PATH/Workflows
|
||||
cp scripts/DevReview $INSTALL_PATH/Workflows/DevReview
|
||||
chmod +x $INSTALL_PATH/Workflows/DevReview
|
||||
cp scripts/Planning $INSTALL_PATH/Workflows/Planning
|
||||
chmod +x $INSTALL_PATH/Workflows/Planning
|
||||
|
||||
install:V: build
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
#!/bin/bash
|
||||
# Claude Developer-Reviewer Workflow Template
|
||||
# Usage: ./scripts/Claude-DevReview.sh /path/to/project
|
||||
# DevReview - Developer-Reviewer Workflow
|
||||
# Usage: ./scripts/DevReview <backend> <workdir>
|
||||
|
||||
set -e
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 /path/to/project"
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: $0 <backend> <workdir>"
|
||||
echo " backend: claude, kiro-cli"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PROJECT_PATH="$1"
|
||||
BACKEND="$1"
|
||||
PROJECT_PATH="$2"
|
||||
PROJECT_NAME=$(basename "$PROJECT_PATH")
|
||||
|
||||
# Generate a random short identifier (Docker-style)
|
||||
# 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}"
|
||||
|
|
@ -21,7 +23,6 @@ echo "Setting up Developer-Reviewer workflow for: $PROJECT_NAME"
|
|||
echo "Project path: $PROJECT_PATH"
|
||||
echo "Session alias: $ALIAS_NAME"
|
||||
|
||||
# Get the 9p namespace
|
||||
NAMESPACE=$(namespace)
|
||||
if [ -z "$NAMESPACE" ]; then
|
||||
echo "Error: No namespace found. Is anvillm running?"
|
||||
|
|
@ -30,49 +31,31 @@ fi
|
|||
|
||||
AGENT_MOUNT="agent"
|
||||
|
||||
# Create developer session (non-blocking)
|
||||
# Helper to create session and capture ID
|
||||
create_session() {
|
||||
local backend="$1" cwd="$2"
|
||||
local before after
|
||||
before=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
||||
echo "new $backend $cwd" | 9p write $AGENT_MOUNT/ctl
|
||||
after=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
||||
comm -13 <(echo "$before") <(echo "$after") | head -1
|
||||
}
|
||||
|
||||
echo "Creating developer session..."
|
||||
BEFORE=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
||||
echo "new claude $PROJECT_PATH" | 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)
|
||||
DEV_ID=$(create_session "$BACKEND" "$PROJECT_PATH")
|
||||
echo "Developer session ID: $DEV_ID"
|
||||
|
||||
# Create reviewer session (non-blocking)
|
||||
echo "Creating reviewer session..."
|
||||
BEFORE=$(9p read $AGENT_MOUNT/list | awk '{print $1}' | sort)
|
||||
echo "new claude $PROJECT_PATH" | 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)
|
||||
REVIEWER_ID=$(create_session "$BACKEND" "$PROJECT_PATH")
|
||||
echo "Reviewer session ID: $REVIEWER_ID"
|
||||
|
||||
# Wait for both sessions to be ready
|
||||
echo "Waiting for sessions to initialize..."
|
||||
for i in {1..30}; do
|
||||
DEV_STATE=$(9p read $AGENT_MOUNT/$DEV_ID/state 2>/dev/null || echo "error")
|
||||
REV_STATE=$(9p read $AGENT_MOUNT/$REVIEWER_ID/state 2>/dev/null || echo "error")
|
||||
|
||||
if [ "$DEV_STATE" = "idle" ] && [ "$REV_STATE" = "idle" ]; then
|
||||
echo "Both sessions ready!"
|
||||
break
|
||||
fi
|
||||
|
||||
if [ $i -eq 30 ]; then
|
||||
echo "Error: Sessions failed to initialize (dev=$DEV_STATE, reviewer=$REV_STATE)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# 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
|
||||
echo "Configuring developer agent..."
|
||||
cat > /tmp/dev-context-$$.txt <<'DEVCONTEXT'
|
||||
cat <<EOF | 9p write $AGENT_MOUNT/$DEV_ID/context
|
||||
# DEVELOPER AGENT ROLE
|
||||
|
||||
You are the developer agent in a two-agent workflow. Your peer is the reviewer agent.
|
||||
|
|
@ -82,7 +65,7 @@ You are the developer agent in a two-agent workflow. Your peer is the reviewer a
|
|||
1. When given a task, implement it fully
|
||||
2. After implementation, stage all changes using git
|
||||
3. Find your reviewer peer:
|
||||
- Run: 9p read agent/list | grep reviewer | grep PROJECT_NAME
|
||||
- Run: 9p read agent/list | grep reviewer | grep $ALIAS_NAME
|
||||
- Extract the session ID from the output
|
||||
4. Send a review request to the reviewer:
|
||||
- Write to: agent/{reviewer-session-id}/in
|
||||
|
|
@ -99,15 +82,10 @@ You are the developer agent in a two-agent workflow. Your peer is the reviewer a
|
|||
- You will receive messages from the reviewer in your own input stream
|
||||
|
||||
Remember: You are working collaboratively with the reviewer to ensure code quality.
|
||||
DEVCONTEXT
|
||||
|
||||
# Replace PROJECT_NAME placeholder
|
||||
sed "s/PROJECT_NAME/$ALIAS_NAME/g" /tmp/dev-context-$$.txt | 9p write $AGENT_MOUNT/$DEV_ID/context
|
||||
rm /tmp/dev-context-$$.txt
|
||||
EOF
|
||||
|
||||
# Set reviewer context
|
||||
echo "Configuring reviewer agent..."
|
||||
cat > /tmp/reviewer-context-$$.txt <<'REVIEWERCONTEXT'
|
||||
cat <<EOF | 9p write $AGENT_MOUNT/$REVIEWER_ID/context
|
||||
# REVIEWER AGENT ROLE
|
||||
|
||||
You are the code reviewer agent in a two-agent workflow. Your peer is the developer agent.
|
||||
|
|
@ -119,7 +97,7 @@ You are the code reviewer agent in a two-agent workflow. Your peer is the develo
|
|||
- git diff --cached
|
||||
- Look for bugs, code quality issues, security concerns
|
||||
3. Find your developer peer:
|
||||
- Run: 9p read agent/list | grep dev | grep PROJECT_NAME
|
||||
- Run: 9p read agent/list | grep dev | grep $ALIAS_NAME
|
||||
- Extract the session ID from the output
|
||||
4. Send feedback to the developer:
|
||||
- If the code is good: write "LGTM" to agent/{dev-session-id}/in
|
||||
|
|
@ -143,11 +121,7 @@ You are the code reviewer agent in a two-agent workflow. Your peer is the develo
|
|||
- You will receive review requests in your own input stream
|
||||
|
||||
Remember: Be thorough but constructive in your reviews. The goal is high-quality code.
|
||||
REVIEWERCONTEXT
|
||||
|
||||
# Replace PROJECT_NAME placeholder
|
||||
sed "s/PROJECT_NAME/$ALIAS_NAME/g" /tmp/reviewer-context-$$.txt | 9p write $AGENT_MOUNT/$REVIEWER_ID/context
|
||||
rm /tmp/reviewer-context-$$.txt
|
||||
EOF
|
||||
|
||||
echo ""
|
||||
echo "✓ Developer-Reviewer workflow setup complete!"
|
||||
|
|
@ -165,4 +139,3 @@ 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"
|
||||
echo ""
|
||||
|
|
@ -1,16 +1,18 @@
|
|||
#!/bin/bash
|
||||
# KiroPlanning - Research/Engineering/Tech-Editor workflow
|
||||
# Usage: ./scripts/KiroPlanning.sh /path/to/docs [ticket-id]
|
||||
# Planning - Research/Engineering/Tech-Editor workflow
|
||||
# Usage: ./scripts/Planning <backend> <workdir> [ticket-id]
|
||||
|
||||
set -e
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: $0 /path/to/docs [ticket-id]"
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Usage: $0 <backend> <workdir> [ticket-id]"
|
||||
echo " backend: claude, kiro-cli"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DOC_PATH="$1"
|
||||
TICKET_ID="${2:-}"
|
||||
BACKEND="$1"
|
||||
DOC_PATH="$2"
|
||||
TICKET_ID="${3:-}"
|
||||
|
||||
# Generate random alias prefix
|
||||
RANDOM_WORD=$(shuf -n1 -e alpha beta gamma delta zeta theta kappa sigma omega lambda)
|
||||
|
|
@ -36,15 +38,15 @@ create_session() {
|
|||
}
|
||||
|
||||
echo "Creating research session..."
|
||||
RESEARCH_ID=$(create_session kiro-cli "$DOC_PATH")
|
||||
RESEARCH_ID=$(create_session "$BACKEND" "$DOC_PATH")
|
||||
echo " ID: $RESEARCH_ID"
|
||||
|
||||
echo "Creating engineering session..."
|
||||
ENG_ID=$(create_session kiro-cli "$DOC_PATH")
|
||||
ENG_ID=$(create_session "$BACKEND" "$DOC_PATH")
|
||||
echo " ID: $ENG_ID"
|
||||
|
||||
echo "Creating tech-editor session..."
|
||||
EDITOR_ID=$(create_session kiro-cli "$DOC_PATH")
|
||||
EDITOR_ID=$(create_session "$BACKEND" "$DOC_PATH")
|
||||
echo " ID: $EDITOR_ID"
|
||||
|
||||
# Set aliases
|
||||
|
|
@ -105,7 +107,7 @@ Do not actively await responses.
|
|||
EOF
|
||||
|
||||
echo ""
|
||||
echo "✓ KiroPlanning workflow ready ($ALIAS_PREFIX)"
|
||||
echo "✓ Planning workflow ready ($ALIAS_PREFIX)"
|
||||
echo ""
|
||||
echo "Sessions:"
|
||||
echo " ${ALIAS_PREFIX}-research: $RESEARCH_ID"
|
||||
Reference in New Issue