CLI/TUI for drafting, repeating, and publishing daily standup updates as GitHub issues
github go cli golang management project tui daily
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(scripts): parse new JSON metadata format for field tracking

+53 -4
+53 -4
.github/scripts/daily_update_workflow.py
··· 378 378 return extract_section(body, patterns, clean_empty=clean_empty) 379 379 380 380 381 + def parse_body_metadata(body: str) -> dict[str, str]: 382 + """Extract field ID mapping from <!-- pad:fields:{...} --> metadata.""" 383 + metadata_pattern = re.compile(r"(?m)^<!--\s*pad:fields:(\{.*?\})\s*-->$") 384 + match = metadata_pattern.search(body) 385 + if not match: 386 + return {} 387 + 388 + try: 389 + metadata = json.loads(match.group(1)) 390 + fields = metadata.get("fields", []) 391 + return { 392 + normalize_heading(f.get("label", "")): f.get("id", "") 393 + for f in fields 394 + if f.get("id") and f.get("label") 395 + } 396 + except json.JSONDecodeError: 397 + return {} 398 + 399 + 400 + def normalize_heading(heading: str) -> str: 401 + """Normalize heading text for comparison (lowercase, no extra spaces).""" 402 + return re.sub(r"\s+", " ", heading.strip().lower()) 403 + 404 + 381 405 def split_sections_by_field_id(body: str) -> dict[str, str]: 382 406 sections: dict[str, str] = {} 383 407 current_id = "" 384 408 current_lines: list[str] = [] 385 - heading_pattern = re.compile( 409 + 410 + # Build heading -> ID mapping from metadata (new format) 411 + metadata_ids = parse_body_metadata(body) 412 + 413 + # Pattern for inline IDs (legacy format fallback) 414 + inline_id_pattern = re.compile( 386 415 r"^#{2,6} .*?<!--\s*pad:id:([A-Za-z0-9._-]+)\s*-->\s*$" 387 416 ) 388 417 418 + # Pattern to extract heading text without inline ID comments 419 + heading_text_pattern = re.compile(r"^#{2,6}\s*(.*?)(?:<!--.*?-->)?\s*$") 420 + 389 421 for line in body.splitlines(): 390 - match = heading_pattern.match(line.strip()) 391 - if match: 422 + stripped = line.strip() 423 + 424 + # Check for inline ID (legacy format) 425 + inline_match = inline_id_pattern.match(stripped) 426 + if inline_match: 392 427 if current_id: 393 428 sections[current_id] = "\n".join(current_lines).strip() 394 - current_id = match.group(1) 429 + current_id = inline_match.group(1) 395 430 current_lines = [] 396 431 continue 432 + 433 + # Check for heading that might have metadata ID 434 + heading_match = heading_text_pattern.match(stripped) 435 + if heading_match: 436 + heading_text = heading_match.group(1).strip() 437 + normalized = normalize_heading(heading_text) 438 + field_id = metadata_ids.get(normalized) 439 + 440 + if field_id: 441 + if current_id: 442 + sections[current_id] = "\n".join(current_lines).strip() 443 + current_id = field_id 444 + current_lines = [] 445 + continue 397 446 398 447 if current_id: 399 448 current_lines.append(line)