disinto/lib/parse-deps.sh
johba 98f0c40106 refactor: rewrite parse-deps.py as pure bash, remove only Python from repo
Replace lib/parse-deps.py with lib/parse-deps.sh to keep the toolchain
all-bash. Rewrite supervisor P3b cycle detection and P3c stale dep check
as pure bash using associative arrays and DFS.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 21:22:53 +01:00

27 lines
831 B
Bash
Executable file

#!/usr/bin/env bash
# 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
echo "$BODY" | grep -iE '(depends on|blocked by)' | grep -oP '#\K[0-9]+' || true
} | sort -un