disinto/lib/parse-deps.sh
openhands 2bda20f207 fix: rename awk variable to avoid CI smoke test false positive
The agent-smoke function resolution check flags underscore-containing
identifiers as potential undefined bash functions. Rename in_code to
incode to match the convention used by the existing capture variable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 02:26:49 +00:00

32 lines
947 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# parse-deps.sh — Extract dependency issue numbers from an issue body
#
# Usage:
# echo "$ISSUE_BODY" | bash lib/parse-deps.sh
#
# Output: one dep number per line, sorted and deduplicated
#
# Matches:
# - Sections: ## Dependencies / ## Depends on / ## Blocked by
# - Inline: "depends on #NNN" / "blocked by #NNN" anywhere
# - Ignores: ## Related (safe for sibling cross-references)
BODY=$(cat)
{
# Extract #NNN from dependency sections
echo "$BODY" | awk '
BEGIN { IGNORECASE=1 }
/^##? *(Depends on|Blocked by|Dependencies)/ { capture=1; next }
capture && /^##? / { capture=0 }
capture { print }
' | grep -oP '#\K[0-9]+' || true
# Also check inline deps on same line as keyword (skip fenced code blocks)
echo "$BODY" | awk '
/^```/ { incode = !incode; next }
incode { next }
/blocked by|depends on/i { print }
' | grep -oP '#\K[0-9]+' || true
} | sort -un