beads-orchestration 2.0.0 → 2.0.1
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/package.json
CHANGED
|
@@ -25,7 +25,7 @@ if echo "$COMMAND" | grep -qE '\-\-force'; then
|
|
|
25
25
|
fi
|
|
26
26
|
|
|
27
27
|
# Extract the ID being closed (handles: bd close ID, bd close ID && ..., etc.)
|
|
28
|
-
CLOSE_ID=$(echo "$COMMAND" | sed -E 's/.*bd
|
|
28
|
+
CLOSE_ID=$(echo "$COMMAND" | sed -E 's/.*bd[[:space:]]+close[[:space:]]+([A-Za-z0-9._-]+).*/\1/')
|
|
29
29
|
|
|
30
30
|
if [ -z "$CLOSE_ID" ]; then
|
|
31
31
|
exit 0
|
|
@@ -55,23 +55,23 @@ EOF
|
|
|
55
55
|
fi
|
|
56
56
|
|
|
57
57
|
# === CHECK 2: Epic children validation ===
|
|
58
|
-
# Check if this is an epic by looking
|
|
59
|
-
|
|
58
|
+
# Check if this is an epic by looking at issue_type
|
|
59
|
+
ISSUE_TYPE=$(bd show "$CLOSE_ID" --json 2>/dev/null | jq -r '.[0].issue_type // ""' 2>/dev/null || echo "")
|
|
60
60
|
|
|
61
|
-
if [
|
|
62
|
-
# Not an epic
|
|
61
|
+
if [ "$ISSUE_TYPE" != "epic" ]; then
|
|
62
|
+
# Not an epic, allow close
|
|
63
63
|
exit 0
|
|
64
64
|
fi
|
|
65
65
|
|
|
66
66
|
# This is an epic - check if all children are complete
|
|
67
67
|
INCOMPLETE=$(bd list --json 2>/dev/null | jq -r --arg epic "$CLOSE_ID" '
|
|
68
|
-
[.[] | select(.
|
|
68
|
+
[.[] | select((.id | startswith($epic + ".")) and .status != "done" and .status != "closed")] | length
|
|
69
69
|
' 2>/dev/null || echo "0")
|
|
70
70
|
|
|
71
71
|
if [ "$INCOMPLETE" != "0" ] && [ "$INCOMPLETE" != "" ]; then
|
|
72
72
|
# Get list of incomplete children for the error message
|
|
73
73
|
INCOMPLETE_LIST=$(bd list --json 2>/dev/null | jq -r --arg epic "$CLOSE_ID" '
|
|
74
|
-
[.[] | select(.
|
|
74
|
+
[.[] | select((.id | startswith($epic + ".")) and .status != "done" and .status != "closed")] | .[] | "\(.id) (\(.status))"
|
|
75
75
|
' 2>/dev/null | tr '\n' ', ' | sed 's/,$//')
|
|
76
76
|
|
|
77
77
|
cat << EOF
|