claude-flow-novice 2.14.7 โ 2.14.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/cfn-product-owner-decision/execute-decision.sh +81 -14
- package/.claude/skills/cfn-product-owner-decision/test-backlog-integration.sh +148 -0
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +8 -6
- package/claude-assets/skills/cfn-product-owner-decision/execute-decision.sh +81 -14
- package/claude-assets/skills/cfn-product-owner-decision/test-backlog-integration.sh +148 -0
- package/dist/agents/agent-loader.js +146 -165
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/cli/config-manager.js +91 -109
- package/dist/cli/config-manager.js.map +1 -1
- package/package.json +1 -1
- package/scripts/switch-api.sh +7 -7
|
@@ -124,24 +124,34 @@ if [ $PO_EXIT_CODE -eq 124 ]; then
|
|
|
124
124
|
CONFIDENCE=0.0
|
|
125
125
|
else
|
|
126
126
|
# Parse decision from output
|
|
127
|
-
|
|
127
|
+
# Defensive file handling - TEST 5 fix
|
|
128
|
+
if [ -f "$PO_OUTPUT_FILE" ] && [ -s "$PO_OUTPUT_FILE" ]; then
|
|
129
|
+
PO_OUTPUT=$(cat "$PO_OUTPUT_FILE")
|
|
128
130
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
# Try multiple parsing patterns
|
|
132
|
+
DECISION_TYPE=$(echo "$PO_OUTPUT" | grep -oiE "Decision:\s*(PROCEED|ITERATE|ABORT)" | grep -oiE "(PROCEED|ITERATE|ABORT)" | head -1 | tr '[:lower:]' '[:upper:]' || echo "")
|
|
131
133
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if [ -z "$DECISION_TYPE" ]; then
|
|
137
|
-
DECISION_TYPE=$(echo "$PO_OUTPUT" | grep -oiE "(proceed|iterate|abort)" | head -1 | tr '[:lower:]' '[:upper:]' || echo "")
|
|
138
|
-
fi
|
|
134
|
+
if [ -z "$DECISION_TYPE" ]; then
|
|
135
|
+
DECISION_TYPE=$(echo "$PO_OUTPUT" | grep -oE "(PROCEED|ITERATE|ABORT)" | head -1 || echo "")
|
|
136
|
+
fi
|
|
139
137
|
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
if [ -z "$DECISION_TYPE" ]; then
|
|
139
|
+
DECISION_TYPE=$(echo "$PO_OUTPUT" | grep -oiE "(proceed|iterate|abort)" | head -1 | tr '[:lower:]' '[:upper:]' || echo "")
|
|
140
|
+
fi
|
|
142
141
|
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
# Parse reasoning
|
|
143
|
+
REASONING=$(echo "$PO_OUTPUT" | grep -oiE "Reasoning:\s*.*" | sed 's/Reasoning:\s*//' || echo "No reasoning provided")
|
|
144
|
+
|
|
145
|
+
# Parse confidence
|
|
146
|
+
CONFIDENCE=$(echo "$PO_OUTPUT" | grep -oE "Confidence:\s*[0-9]+\.?[0-9]*" | grep -oE "[0-9]+\.?[0-9]*" || echo "0.85")
|
|
147
|
+
else
|
|
148
|
+
echo -e "${RED}โ ERROR: Product Owner output file missing or empty${NC}"
|
|
149
|
+
echo "Expected: $PO_OUTPUT_FILE"
|
|
150
|
+
PO_OUTPUT=""
|
|
151
|
+
DECISION_TYPE="ABORT"
|
|
152
|
+
REASONING="Product Owner output file missing or empty: $PO_OUTPUT_FILE"
|
|
153
|
+
CONFIDENCE=0.0
|
|
154
|
+
fi
|
|
145
155
|
fi
|
|
146
156
|
|
|
147
157
|
# Validate decision parsing
|
|
@@ -187,6 +197,63 @@ Next iteration MUST create actual deliverables, not just plans.
|
|
|
187
197
|
fi
|
|
188
198
|
fi
|
|
189
199
|
|
|
200
|
+
# Process deferred items for backlog
|
|
201
|
+
echo -e "${YELLOW}๐ Processing deferred items for backlog...${NC}"
|
|
202
|
+
|
|
203
|
+
# Extract deferred items from Product Owner output
|
|
204
|
+
# Look for sections: "Out of Scope", "Deferred", "Future Work", "Defer"
|
|
205
|
+
DEFERRED_SECTION=$(echo "$PO_OUTPUT" | grep -iA 20 "out of scope\|deferred\|future work\|defer:" || echo "")
|
|
206
|
+
|
|
207
|
+
if [ -n "$DEFERRED_SECTION" ]; then
|
|
208
|
+
echo -e "${YELLOW}Found deferred items section, extracting items...${NC}"
|
|
209
|
+
|
|
210
|
+
# Parse deferred items (lines starting with -, *, or bullet points after marker)
|
|
211
|
+
DEFERRED_ITEMS=$(echo "$DEFERRED_SECTION" | grep -E "^\s*[-*โข]" | sed 's/^\s*[-*โข]\s*//' || echo "")
|
|
212
|
+
|
|
213
|
+
if [ -n "$DEFERRED_ITEMS" ]; then
|
|
214
|
+
ITEMS_ADDED=0
|
|
215
|
+
|
|
216
|
+
# Process each deferred item
|
|
217
|
+
while IFS= read -r item; do
|
|
218
|
+
# Skip empty lines or section headers
|
|
219
|
+
if [ -n "$item" ] && ! echo "$item" | grep -iqE "^(out of scope|deferred|future work)" && [ ${#item} -ge 10 ]; then
|
|
220
|
+
echo -e "${YELLOW} Adding to backlog: ${item:0:60}...${NC}"
|
|
221
|
+
|
|
222
|
+
# Invoke backlog skill (defensive - don't fail decision on backlog error)
|
|
223
|
+
set +e
|
|
224
|
+
/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-backlog-management/add-backlog-item.sh \
|
|
225
|
+
--item "$item" \
|
|
226
|
+
--why "Deferred during Product Owner decision (Task: $TASK_ID, Iteration: $ITERATION)" \
|
|
227
|
+
--solution "To be determined during sprint planning" \
|
|
228
|
+
--priority "P2" \
|
|
229
|
+
--category "Technical-Debt" \
|
|
230
|
+
--sprint "Sprint-Backlog-$ITERATION" \
|
|
231
|
+
--force >/dev/null 2>&1
|
|
232
|
+
|
|
233
|
+
if [ $? -eq 0 ]; then
|
|
234
|
+
ITEMS_ADDED=$((ITEMS_ADDED + 1))
|
|
235
|
+
else
|
|
236
|
+
echo -e "${YELLOW} Warning: Failed to add backlog item (non-critical)${NC}" >&2
|
|
237
|
+
fi
|
|
238
|
+
set -e
|
|
239
|
+
fi
|
|
240
|
+
done <<< "$DEFERRED_ITEMS"
|
|
241
|
+
|
|
242
|
+
if [ $ITEMS_ADDED -gt 0 ]; then
|
|
243
|
+
echo -e "${GREEN}โ
Backlog updated with $ITEMS_ADDED deferred item(s)${NC}"
|
|
244
|
+
|
|
245
|
+
# Store backlog metadata in Redis
|
|
246
|
+
redis-cli HSET "swarm:${TASK_ID}:${AGENT_ID}:result" "backlog_items_added" "$ITEMS_ADDED"
|
|
247
|
+
else
|
|
248
|
+
echo -e "${YELLOW}โ ๏ธ No valid backlog items extracted${NC}"
|
|
249
|
+
fi
|
|
250
|
+
else
|
|
251
|
+
echo -e "${YELLOW}โ ๏ธ Deferred section found but no items extracted${NC}"
|
|
252
|
+
fi
|
|
253
|
+
else
|
|
254
|
+
echo -e "${GREEN}No deferred items detected in Product Owner output${NC}"
|
|
255
|
+
fi
|
|
256
|
+
|
|
190
257
|
# Build decision JSON
|
|
191
258
|
DECISION_JSON=$(cat <<EOF
|
|
192
259
|
{
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Test script for backlog integration in execute-decision.sh
|
|
3
|
+
# Version: 1.0.0
|
|
4
|
+
# Purpose: Verify deferred items are correctly extracted and added to backlog
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
RED='\033[0;31m'
|
|
9
|
+
GREEN='\033[0;32m'
|
|
10
|
+
YELLOW='\033[1;33m'
|
|
11
|
+
NC='\033[0m'
|
|
12
|
+
|
|
13
|
+
echo -e "${GREEN}๐งช Testing Backlog Integration in execute-decision.sh${NC}"
|
|
14
|
+
|
|
15
|
+
# Create mock Product Owner output with deferred items
|
|
16
|
+
MOCK_PO_OUTPUT=$(cat <<'EOF'
|
|
17
|
+
Decision: PROCEED
|
|
18
|
+
Reasoning: All acceptance criteria met, but some items deferred for future sprints.
|
|
19
|
+
|
|
20
|
+
Out of Scope:
|
|
21
|
+
- Advanced logging with structured JSON format
|
|
22
|
+
- Performance monitoring dashboard
|
|
23
|
+
- Integration with external analytics platform
|
|
24
|
+
- Custom alert webhooks for critical events
|
|
25
|
+
|
|
26
|
+
Confidence: 0.92
|
|
27
|
+
EOF
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Test 1: Extract deferred section
|
|
31
|
+
echo -e "${YELLOW}Test 1: Extracting deferred section...${NC}"
|
|
32
|
+
DEFERRED_SECTION=$(echo "$MOCK_PO_OUTPUT" | grep -iA 20 "out of scope|deferred|future work|defer:" || echo "")
|
|
33
|
+
|
|
34
|
+
if [ -n "$DEFERRED_SECTION" ]; then
|
|
35
|
+
echo -e "${GREEN}โ
Deferred section extracted${NC}"
|
|
36
|
+
echo "Preview:"
|
|
37
|
+
echo "$DEFERRED_SECTION" | head -5
|
|
38
|
+
else
|
|
39
|
+
echo -e "${RED}โ Failed to extract deferred section${NC}"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Test 2: Parse individual items
|
|
44
|
+
echo -e "\n${YELLOW}Test 2: Parsing individual items...${NC}"
|
|
45
|
+
DEFERRED_ITEMS=$(echo "$DEFERRED_SECTION" | grep -E "^\s*[-*โข]" | sed 's/^\s*[-*โข]\s*//' || echo "")
|
|
46
|
+
|
|
47
|
+
if [ -n "$DEFERRED_ITEMS" ]; then
|
|
48
|
+
ITEM_COUNT=$(echo "$DEFERRED_ITEMS" | wc -l)
|
|
49
|
+
echo -e "${GREEN}โ
Extracted $ITEM_COUNT deferred items${NC}"
|
|
50
|
+
echo "Items:"
|
|
51
|
+
echo "$DEFERRED_ITEMS" | nl
|
|
52
|
+
else
|
|
53
|
+
echo -e "${RED}โ Failed to parse individual items${NC}"
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Test 3: Validate item filtering
|
|
58
|
+
echo -e "\n${YELLOW}Test 3: Validating item filtering...${NC}"
|
|
59
|
+
VALID_ITEMS=0
|
|
60
|
+
|
|
61
|
+
while IFS= read -r item; do
|
|
62
|
+
# Skip empty lines or section headers
|
|
63
|
+
if [ -n "$item" ] && ! echo "$item" | grep -iqE "^(out of scope|deferred|future work)" && [ ${#item} -ge 10 ]; then
|
|
64
|
+
VALID_ITEMS=$((VALID_ITEMS + 1))
|
|
65
|
+
echo -e " ${GREEN}โ${NC} Valid item ($VALID_ITEMS): ${item:0:60}..."
|
|
66
|
+
else
|
|
67
|
+
echo -e " ${YELLOW}โท${NC} Filtered out: ${item:0:60}..."
|
|
68
|
+
fi
|
|
69
|
+
done <<< "$DEFERRED_ITEMS"
|
|
70
|
+
|
|
71
|
+
if [ $VALID_ITEMS -eq 4 ]; then
|
|
72
|
+
echo -e "${GREEN}โ
Correctly filtered to $VALID_ITEMS valid items${NC}"
|
|
73
|
+
else
|
|
74
|
+
echo -e "${YELLOW}โ ๏ธ Expected 4 items, got $VALID_ITEMS${NC}"
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# Test 4: Mock backlog skill invocation (dry run)
|
|
78
|
+
echo -e "\n${YELLOW}Test 4: Testing backlog skill invocation (dry run)...${NC}"
|
|
79
|
+
|
|
80
|
+
# Check if backlog skill exists
|
|
81
|
+
BACKLOG_SKILL="/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-backlog-management/add-backlog-item.sh"
|
|
82
|
+
|
|
83
|
+
if [ -f "$BACKLOG_SKILL" ]; then
|
|
84
|
+
echo -e "${GREEN}โ
Backlog skill found: $BACKLOG_SKILL${NC}"
|
|
85
|
+
|
|
86
|
+
# Test with one sample item (dry run - check parameters only)
|
|
87
|
+
SAMPLE_ITEM="Advanced logging with structured JSON format"
|
|
88
|
+
|
|
89
|
+
echo -e "${YELLOW} Testing parameter construction...${NC}"
|
|
90
|
+
echo " Command: $BACKLOG_SKILL \\"
|
|
91
|
+
echo " --item \"$SAMPLE_ITEM\" \\"
|
|
92
|
+
echo " --why \"Deferred during Product Owner decision (Task: test-task-123, Iteration: 1)\" \\"
|
|
93
|
+
echo " --solution \"To be determined during sprint planning\" \\"
|
|
94
|
+
echo " --priority \"P2\" \\"
|
|
95
|
+
echo " --category \"Technical-Debt\" \\"
|
|
96
|
+
echo " --sprint \"Sprint-Backlog-1\" \\"
|
|
97
|
+
echo " --force"
|
|
98
|
+
|
|
99
|
+
echo -e "${GREEN}โ
Parameter construction valid${NC}"
|
|
100
|
+
else
|
|
101
|
+
echo -e "${RED}โ Backlog skill not found at: $BACKLOG_SKILL${NC}"
|
|
102
|
+
exit 1
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
# Test 5: Integration point verification
|
|
106
|
+
echo -e "\n${YELLOW}Test 5: Verifying integration point in execute-decision.sh...${NC}"
|
|
107
|
+
|
|
108
|
+
SCRIPT_PATH="/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-product-owner-decision/execute-decision.sh"
|
|
109
|
+
|
|
110
|
+
if grep -q "Processing deferred items for backlog" "$SCRIPT_PATH"; then
|
|
111
|
+
echo -e "${GREEN}โ
Integration point found in execute-decision.sh${NC}"
|
|
112
|
+
|
|
113
|
+
# Check if backlog skill is invoked
|
|
114
|
+
if grep -q "cfn-backlog-management/add-backlog-item.sh" "$SCRIPT_PATH"; then
|
|
115
|
+
echo -e "${GREEN}โ
Backlog skill invocation found${NC}"
|
|
116
|
+
else
|
|
117
|
+
echo -e "${RED}โ Backlog skill invocation missing${NC}"
|
|
118
|
+
exit 1
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
# Check if error handling is present
|
|
122
|
+
if grep -q "set +e" "$SCRIPT_PATH" && grep -q "set -e" "$SCRIPT_PATH"; then
|
|
123
|
+
echo -e "${GREEN}โ
Defensive error handling found${NC}"
|
|
124
|
+
else
|
|
125
|
+
echo -e "${YELLOW}โ ๏ธ Error handling may be missing${NC}"
|
|
126
|
+
fi
|
|
127
|
+
else
|
|
128
|
+
echo -e "${RED}โ Integration point not found in execute-decision.sh${NC}"
|
|
129
|
+
exit 1
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# Summary
|
|
133
|
+
echo -e "\n${GREEN}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${NC}"
|
|
134
|
+
echo -e "${GREEN}โ
All tests passed!${NC}"
|
|
135
|
+
echo -e "${GREEN}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${NC}"
|
|
136
|
+
echo -e "\nBacklog integration features verified:"
|
|
137
|
+
echo " - Deferred section extraction: โ"
|
|
138
|
+
echo " - Item parsing and filtering: โ"
|
|
139
|
+
echo " - Backlog skill invocation: โ"
|
|
140
|
+
echo " - Integration point in execute-decision.sh: โ"
|
|
141
|
+
echo " - Defensive error handling: โ"
|
|
142
|
+
echo ""
|
|
143
|
+
echo "Expected behavior:"
|
|
144
|
+
echo " - When Product Owner output contains 'Out of Scope', 'Deferred', or 'Future Work' sections"
|
|
145
|
+
echo " - Items are extracted (lines starting with -, *, or โข)"
|
|
146
|
+
echo " - Each item is added to readme/BACKLOG.md with P2 priority"
|
|
147
|
+
echo " - Metadata stored in Redis (backlog_items_added)"
|
|
148
|
+
echo " - Failures are non-blocking (warnings only)"
|
|
@@ -286,7 +286,7 @@ if AGENTS=$(bash ./.claude/skills/cfn-agent-selector/select-agents.sh --task-typ
|
|
|
286
286
|
PRODUCT_OWNER=$(echo "$AGENTS" | jq -r '.loop4')
|
|
287
287
|
else
|
|
288
288
|
# FALLBACK: Use hardcoded defaults for software-development
|
|
289
|
-
LOOP3_AGENTS="backend-
|
|
289
|
+
LOOP3_AGENTS="backend-developer"
|
|
290
290
|
LOOP2_AGENTS="reviewer,tester"
|
|
291
291
|
PRODUCT_OWNER="product-owner"
|
|
292
292
|
fi
|
|
@@ -294,16 +294,18 @@ fi
|
|
|
294
294
|
|
|
295
295
|
**STEP 3: INVOKE ORCHESTRATOR (REQUIRED - NOT OPTIONAL)**
|
|
296
296
|
|
|
297
|
-
|
|
297
|
+
**CRITICAL:** You MUST invoke orchestrator by iteration 3. DO NOT complete tasks yourself.
|
|
298
|
+
|
|
299
|
+
Execute this immediately after Step 2 (use hardcoded fallback if agent selector fails):
|
|
298
300
|
|
|
299
301
|
```bash
|
|
300
|
-
#
|
|
302
|
+
# ALWAYS invoke orchestrator - do NOT complete task directly
|
|
301
303
|
./.claude/skills/cfn-loop-orchestration/orchestrate.sh \
|
|
302
304
|
--task-id "$TASK_ID" \
|
|
303
305
|
--mode "standard" \
|
|
304
|
-
--loop3-agents "
|
|
305
|
-
--loop2-agents "
|
|
306
|
-
--product-owner "
|
|
306
|
+
--loop3-agents "backend-developer" \
|
|
307
|
+
--loop2-agents "reviewer,tester" \
|
|
308
|
+
--product-owner "product-owner" \
|
|
307
309
|
--max-iterations 10 \
|
|
308
310
|
--success-criteria '{"deliverables":[],"acceptanceCriteria":["Implementation complete"]}'
|
|
309
311
|
|
|
@@ -124,24 +124,34 @@ if [ $PO_EXIT_CODE -eq 124 ]; then
|
|
|
124
124
|
CONFIDENCE=0.0
|
|
125
125
|
else
|
|
126
126
|
# Parse decision from output
|
|
127
|
-
|
|
127
|
+
# Defensive file handling - TEST 5 fix
|
|
128
|
+
if [ -f "$PO_OUTPUT_FILE" ] && [ -s "$PO_OUTPUT_FILE" ]; then
|
|
129
|
+
PO_OUTPUT=$(cat "$PO_OUTPUT_FILE")
|
|
128
130
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
# Try multiple parsing patterns
|
|
132
|
+
DECISION_TYPE=$(echo "$PO_OUTPUT" | grep -oiE "Decision:\s*(PROCEED|ITERATE|ABORT)" | grep -oiE "(PROCEED|ITERATE|ABORT)" | head -1 | tr '[:lower:]' '[:upper:]' || echo "")
|
|
131
133
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if [ -z "$DECISION_TYPE" ]; then
|
|
137
|
-
DECISION_TYPE=$(echo "$PO_OUTPUT" | grep -oiE "(proceed|iterate|abort)" | head -1 | tr '[:lower:]' '[:upper:]' || echo "")
|
|
138
|
-
fi
|
|
134
|
+
if [ -z "$DECISION_TYPE" ]; then
|
|
135
|
+
DECISION_TYPE=$(echo "$PO_OUTPUT" | grep -oE "(PROCEED|ITERATE|ABORT)" | head -1 || echo "")
|
|
136
|
+
fi
|
|
139
137
|
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
if [ -z "$DECISION_TYPE" ]; then
|
|
139
|
+
DECISION_TYPE=$(echo "$PO_OUTPUT" | grep -oiE "(proceed|iterate|abort)" | head -1 | tr '[:lower:]' '[:upper:]' || echo "")
|
|
140
|
+
fi
|
|
142
141
|
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
# Parse reasoning
|
|
143
|
+
REASONING=$(echo "$PO_OUTPUT" | grep -oiE "Reasoning:\s*.*" | sed 's/Reasoning:\s*//' || echo "No reasoning provided")
|
|
144
|
+
|
|
145
|
+
# Parse confidence
|
|
146
|
+
CONFIDENCE=$(echo "$PO_OUTPUT" | grep -oE "Confidence:\s*[0-9]+\.?[0-9]*" | grep -oE "[0-9]+\.?[0-9]*" || echo "0.85")
|
|
147
|
+
else
|
|
148
|
+
echo -e "${RED}โ ERROR: Product Owner output file missing or empty${NC}"
|
|
149
|
+
echo "Expected: $PO_OUTPUT_FILE"
|
|
150
|
+
PO_OUTPUT=""
|
|
151
|
+
DECISION_TYPE="ABORT"
|
|
152
|
+
REASONING="Product Owner output file missing or empty: $PO_OUTPUT_FILE"
|
|
153
|
+
CONFIDENCE=0.0
|
|
154
|
+
fi
|
|
145
155
|
fi
|
|
146
156
|
|
|
147
157
|
# Validate decision parsing
|
|
@@ -187,6 +197,63 @@ Next iteration MUST create actual deliverables, not just plans.
|
|
|
187
197
|
fi
|
|
188
198
|
fi
|
|
189
199
|
|
|
200
|
+
# Process deferred items for backlog
|
|
201
|
+
echo -e "${YELLOW}๐ Processing deferred items for backlog...${NC}"
|
|
202
|
+
|
|
203
|
+
# Extract deferred items from Product Owner output
|
|
204
|
+
# Look for sections: "Out of Scope", "Deferred", "Future Work", "Defer"
|
|
205
|
+
DEFERRED_SECTION=$(echo "$PO_OUTPUT" | grep -iA 20 "out of scope\|deferred\|future work\|defer:" || echo "")
|
|
206
|
+
|
|
207
|
+
if [ -n "$DEFERRED_SECTION" ]; then
|
|
208
|
+
echo -e "${YELLOW}Found deferred items section, extracting items...${NC}"
|
|
209
|
+
|
|
210
|
+
# Parse deferred items (lines starting with -, *, or bullet points after marker)
|
|
211
|
+
DEFERRED_ITEMS=$(echo "$DEFERRED_SECTION" | grep -E "^\s*[-*โข]" | sed 's/^\s*[-*โข]\s*//' || echo "")
|
|
212
|
+
|
|
213
|
+
if [ -n "$DEFERRED_ITEMS" ]; then
|
|
214
|
+
ITEMS_ADDED=0
|
|
215
|
+
|
|
216
|
+
# Process each deferred item
|
|
217
|
+
while IFS= read -r item; do
|
|
218
|
+
# Skip empty lines or section headers
|
|
219
|
+
if [ -n "$item" ] && ! echo "$item" | grep -iqE "^(out of scope|deferred|future work)" && [ ${#item} -ge 10 ]; then
|
|
220
|
+
echo -e "${YELLOW} Adding to backlog: ${item:0:60}...${NC}"
|
|
221
|
+
|
|
222
|
+
# Invoke backlog skill (defensive - don't fail decision on backlog error)
|
|
223
|
+
set +e
|
|
224
|
+
/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-backlog-management/add-backlog-item.sh \
|
|
225
|
+
--item "$item" \
|
|
226
|
+
--why "Deferred during Product Owner decision (Task: $TASK_ID, Iteration: $ITERATION)" \
|
|
227
|
+
--solution "To be determined during sprint planning" \
|
|
228
|
+
--priority "P2" \
|
|
229
|
+
--category "Technical-Debt" \
|
|
230
|
+
--sprint "Sprint-Backlog-$ITERATION" \
|
|
231
|
+
--force >/dev/null 2>&1
|
|
232
|
+
|
|
233
|
+
if [ $? -eq 0 ]; then
|
|
234
|
+
ITEMS_ADDED=$((ITEMS_ADDED + 1))
|
|
235
|
+
else
|
|
236
|
+
echo -e "${YELLOW} Warning: Failed to add backlog item (non-critical)${NC}" >&2
|
|
237
|
+
fi
|
|
238
|
+
set -e
|
|
239
|
+
fi
|
|
240
|
+
done <<< "$DEFERRED_ITEMS"
|
|
241
|
+
|
|
242
|
+
if [ $ITEMS_ADDED -gt 0 ]; then
|
|
243
|
+
echo -e "${GREEN}โ
Backlog updated with $ITEMS_ADDED deferred item(s)${NC}"
|
|
244
|
+
|
|
245
|
+
# Store backlog metadata in Redis
|
|
246
|
+
redis-cli HSET "swarm:${TASK_ID}:${AGENT_ID}:result" "backlog_items_added" "$ITEMS_ADDED"
|
|
247
|
+
else
|
|
248
|
+
echo -e "${YELLOW}โ ๏ธ No valid backlog items extracted${NC}"
|
|
249
|
+
fi
|
|
250
|
+
else
|
|
251
|
+
echo -e "${YELLOW}โ ๏ธ Deferred section found but no items extracted${NC}"
|
|
252
|
+
fi
|
|
253
|
+
else
|
|
254
|
+
echo -e "${GREEN}No deferred items detected in Product Owner output${NC}"
|
|
255
|
+
fi
|
|
256
|
+
|
|
190
257
|
# Build decision JSON
|
|
191
258
|
DECISION_JSON=$(cat <<EOF
|
|
192
259
|
{
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Test script for backlog integration in execute-decision.sh
|
|
3
|
+
# Version: 1.0.0
|
|
4
|
+
# Purpose: Verify deferred items are correctly extracted and added to backlog
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
RED='\033[0;31m'
|
|
9
|
+
GREEN='\033[0;32m'
|
|
10
|
+
YELLOW='\033[1;33m'
|
|
11
|
+
NC='\033[0m'
|
|
12
|
+
|
|
13
|
+
echo -e "${GREEN}๐งช Testing Backlog Integration in execute-decision.sh${NC}"
|
|
14
|
+
|
|
15
|
+
# Create mock Product Owner output with deferred items
|
|
16
|
+
MOCK_PO_OUTPUT=$(cat <<'EOF'
|
|
17
|
+
Decision: PROCEED
|
|
18
|
+
Reasoning: All acceptance criteria met, but some items deferred for future sprints.
|
|
19
|
+
|
|
20
|
+
Out of Scope:
|
|
21
|
+
- Advanced logging with structured JSON format
|
|
22
|
+
- Performance monitoring dashboard
|
|
23
|
+
- Integration with external analytics platform
|
|
24
|
+
- Custom alert webhooks for critical events
|
|
25
|
+
|
|
26
|
+
Confidence: 0.92
|
|
27
|
+
EOF
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Test 1: Extract deferred section
|
|
31
|
+
echo -e "${YELLOW}Test 1: Extracting deferred section...${NC}"
|
|
32
|
+
DEFERRED_SECTION=$(echo "$MOCK_PO_OUTPUT" | grep -iA 20 "out of scope|deferred|future work|defer:" || echo "")
|
|
33
|
+
|
|
34
|
+
if [ -n "$DEFERRED_SECTION" ]; then
|
|
35
|
+
echo -e "${GREEN}โ
Deferred section extracted${NC}"
|
|
36
|
+
echo "Preview:"
|
|
37
|
+
echo "$DEFERRED_SECTION" | head -5
|
|
38
|
+
else
|
|
39
|
+
echo -e "${RED}โ Failed to extract deferred section${NC}"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Test 2: Parse individual items
|
|
44
|
+
echo -e "\n${YELLOW}Test 2: Parsing individual items...${NC}"
|
|
45
|
+
DEFERRED_ITEMS=$(echo "$DEFERRED_SECTION" | grep -E "^\s*[-*โข]" | sed 's/^\s*[-*โข]\s*//' || echo "")
|
|
46
|
+
|
|
47
|
+
if [ -n "$DEFERRED_ITEMS" ]; then
|
|
48
|
+
ITEM_COUNT=$(echo "$DEFERRED_ITEMS" | wc -l)
|
|
49
|
+
echo -e "${GREEN}โ
Extracted $ITEM_COUNT deferred items${NC}"
|
|
50
|
+
echo "Items:"
|
|
51
|
+
echo "$DEFERRED_ITEMS" | nl
|
|
52
|
+
else
|
|
53
|
+
echo -e "${RED}โ Failed to parse individual items${NC}"
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Test 3: Validate item filtering
|
|
58
|
+
echo -e "\n${YELLOW}Test 3: Validating item filtering...${NC}"
|
|
59
|
+
VALID_ITEMS=0
|
|
60
|
+
|
|
61
|
+
while IFS= read -r item; do
|
|
62
|
+
# Skip empty lines or section headers
|
|
63
|
+
if [ -n "$item" ] && ! echo "$item" | grep -iqE "^(out of scope|deferred|future work)" && [ ${#item} -ge 10 ]; then
|
|
64
|
+
VALID_ITEMS=$((VALID_ITEMS + 1))
|
|
65
|
+
echo -e " ${GREEN}โ${NC} Valid item ($VALID_ITEMS): ${item:0:60}..."
|
|
66
|
+
else
|
|
67
|
+
echo -e " ${YELLOW}โท${NC} Filtered out: ${item:0:60}..."
|
|
68
|
+
fi
|
|
69
|
+
done <<< "$DEFERRED_ITEMS"
|
|
70
|
+
|
|
71
|
+
if [ $VALID_ITEMS -eq 4 ]; then
|
|
72
|
+
echo -e "${GREEN}โ
Correctly filtered to $VALID_ITEMS valid items${NC}"
|
|
73
|
+
else
|
|
74
|
+
echo -e "${YELLOW}โ ๏ธ Expected 4 items, got $VALID_ITEMS${NC}"
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# Test 4: Mock backlog skill invocation (dry run)
|
|
78
|
+
echo -e "\n${YELLOW}Test 4: Testing backlog skill invocation (dry run)...${NC}"
|
|
79
|
+
|
|
80
|
+
# Check if backlog skill exists
|
|
81
|
+
BACKLOG_SKILL="/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-backlog-management/add-backlog-item.sh"
|
|
82
|
+
|
|
83
|
+
if [ -f "$BACKLOG_SKILL" ]; then
|
|
84
|
+
echo -e "${GREEN}โ
Backlog skill found: $BACKLOG_SKILL${NC}"
|
|
85
|
+
|
|
86
|
+
# Test with one sample item (dry run - check parameters only)
|
|
87
|
+
SAMPLE_ITEM="Advanced logging with structured JSON format"
|
|
88
|
+
|
|
89
|
+
echo -e "${YELLOW} Testing parameter construction...${NC}"
|
|
90
|
+
echo " Command: $BACKLOG_SKILL \\"
|
|
91
|
+
echo " --item \"$SAMPLE_ITEM\" \\"
|
|
92
|
+
echo " --why \"Deferred during Product Owner decision (Task: test-task-123, Iteration: 1)\" \\"
|
|
93
|
+
echo " --solution \"To be determined during sprint planning\" \\"
|
|
94
|
+
echo " --priority \"P2\" \\"
|
|
95
|
+
echo " --category \"Technical-Debt\" \\"
|
|
96
|
+
echo " --sprint \"Sprint-Backlog-1\" \\"
|
|
97
|
+
echo " --force"
|
|
98
|
+
|
|
99
|
+
echo -e "${GREEN}โ
Parameter construction valid${NC}"
|
|
100
|
+
else
|
|
101
|
+
echo -e "${RED}โ Backlog skill not found at: $BACKLOG_SKILL${NC}"
|
|
102
|
+
exit 1
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
# Test 5: Integration point verification
|
|
106
|
+
echo -e "\n${YELLOW}Test 5: Verifying integration point in execute-decision.sh...${NC}"
|
|
107
|
+
|
|
108
|
+
SCRIPT_PATH="/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-product-owner-decision/execute-decision.sh"
|
|
109
|
+
|
|
110
|
+
if grep -q "Processing deferred items for backlog" "$SCRIPT_PATH"; then
|
|
111
|
+
echo -e "${GREEN}โ
Integration point found in execute-decision.sh${NC}"
|
|
112
|
+
|
|
113
|
+
# Check if backlog skill is invoked
|
|
114
|
+
if grep -q "cfn-backlog-management/add-backlog-item.sh" "$SCRIPT_PATH"; then
|
|
115
|
+
echo -e "${GREEN}โ
Backlog skill invocation found${NC}"
|
|
116
|
+
else
|
|
117
|
+
echo -e "${RED}โ Backlog skill invocation missing${NC}"
|
|
118
|
+
exit 1
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
# Check if error handling is present
|
|
122
|
+
if grep -q "set +e" "$SCRIPT_PATH" && grep -q "set -e" "$SCRIPT_PATH"; then
|
|
123
|
+
echo -e "${GREEN}โ
Defensive error handling found${NC}"
|
|
124
|
+
else
|
|
125
|
+
echo -e "${YELLOW}โ ๏ธ Error handling may be missing${NC}"
|
|
126
|
+
fi
|
|
127
|
+
else
|
|
128
|
+
echo -e "${RED}โ Integration point not found in execute-decision.sh${NC}"
|
|
129
|
+
exit 1
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# Summary
|
|
133
|
+
echo -e "\n${GREEN}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${NC}"
|
|
134
|
+
echo -e "${GREEN}โ
All tests passed!${NC}"
|
|
135
|
+
echo -e "${GREEN}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${NC}"
|
|
136
|
+
echo -e "\nBacklog integration features verified:"
|
|
137
|
+
echo " - Deferred section extraction: โ"
|
|
138
|
+
echo " - Item parsing and filtering: โ"
|
|
139
|
+
echo " - Backlog skill invocation: โ"
|
|
140
|
+
echo " - Integration point in execute-decision.sh: โ"
|
|
141
|
+
echo " - Defensive error handling: โ"
|
|
142
|
+
echo ""
|
|
143
|
+
echo "Expected behavior:"
|
|
144
|
+
echo " - When Product Owner output contains 'Out of Scope', 'Deferred', or 'Future Work' sections"
|
|
145
|
+
echo " - Items are extracted (lines starting with -, *, or โข)"
|
|
146
|
+
echo " - Each item is added to readme/BACKLOG.md with P2 priority"
|
|
147
|
+
echo " - Metadata stored in Redis (backlog_items_added)"
|
|
148
|
+
echo " - Failures are non-blocking (warnings only)"
|