refactor: extract shared dep parser to lib/parse-deps.py (Closes #20)

Single source of truth for dependency parsing, replacing three copies:
- dev-poll.sh get_deps() now calls parse-deps.py
- supervisor P3b/P3c import parse_deps() via importlib

Supports stdin, argument, and --json modes for different callers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
johba 2026-03-16 21:16:49 +01:00
parent acab6c95c8
commit 6cf580c010
3 changed files with 78 additions and 52 deletions

View file

@ -115,18 +115,8 @@ dep_is_merged() {
# =============================================================================
get_deps() {
local issue_body="$1"
# Extract #NNN references from "Depends on" / "Blocked by" sections
# Capture the header line AND subsequent lines until next ## section
{
echo "$issue_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 "$issue_body" | grep -iE '(depends on|blocked by)' | grep -oP '#\K[0-9]+' || true
} | sort -un
# Shared parser: lib/parse-deps.py (single source of truth)
echo "$issue_body" | python3 "${FACTORY_ROOT}/lib/parse-deps.py"
}
# =============================================================================