Files
llm-intelligence/scripts/review/backlog_revocation_guard.sh
2026-05-29 18:48:48 +08:00

32 lines
1020 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
BACKLOG_PATH="${1:?backlog path required}"
python3 - <<'PY' "$BACKLOG_PATH"
from pathlib import Path
import re
import sys
text = Path(sys.argv[1]).read_text(encoding='utf-8')
lines = text.splitlines()
inside = False
current_rows = []
for line in lines:
if line.startswith('## 当前未修复问题速查表'):
inside = True
continue
if inside and line.startswith('---'):
break
if inside and line.startswith('|') and not line.startswith('| #') and not line.startswith('|---'):
current_rows.append(line)
resolved_ids = set(re.findall(r'#### 问题 ([0-9]+) 状态更新:已修复(从 current 表移除)', text))
for issue_id in resolved_ids:
for row in current_rows:
if row.startswith(f'| {issue_id} |') or row.startswith(f'| {issue_id} |'.replace(' ', '')):
print('resolved issue still present in current table', file=sys.stderr)
raise SystemExit(1)
print('BACKLOG_REVOCATION_GUARD: PASS')
PY