Files
Pier_v1/.hmcmkit/tools/checklist_generator.py
T
ahnyongjooandClaude Sonnet 5.5 964a841de1 chore(rebar): Pier_T_rebar 작업 폴더 초기 구성 및 외부 의존 파일 통합
- Code\rebar_pipeline, review_pipeline, pier-program을 정션에서 실제 폴더로 전환
- Code\rhino_mcp 및 CLAUDE_rhino배경.md 추가, .mcp.json은 PYTHONPATH로 새 위치 사용
- pier-program 내부 .git 제거(이력은 backup\pier-program_20261028.bundle에 보관)
- worktree 가이드 반영(CLAUDE.local.md, HANDOFF.md)
- D:\Rhino-MCP 경로 참조를 새 위치로 치환

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 11:20:18 +09:00

89 lines
3.0 KiB
Python

import sys
import re
import json
def extract_checklist(markdown_content):
checklist = []
lines = markdown_content.split('\n')
current_section = "General"
in_table = False
headers = []
for line in lines:
stripped = line.strip()
# Detect headers as sections
header_match = re.match(r'^(#{1,6})\s+(.+)', line)
if header_match:
current_section = header_match.group(2).strip()
in_table = False
continue
# Detect existing checkboxes
msg_match = re.match(r'^\s*-\s*\[([ x])\]\s+(.+)', line)
if msg_match:
status = "completed" if msg_match.group(1) == 'x' else "pending"
checklist.append({
"section": current_section,
"item": msg_match.group(2).strip(),
"type": "checkbox",
"status": status
})
continue
# Detect table start
if '|' in line and not in_table:
# check if it looks like a header row
parts = [p.strip() for p in line.split('|') if p.strip()]
if len(parts) > 1:
headers = parts
in_table = True
continue
# Detect table separator
if in_table and set(stripped.replace('|', '').replace('-', '').replace(' ', '')) == set():
continue
# Detect table rows
if in_table and '|' in line:
parts = [p.strip() for p in line.split('|') if p.strip()]
if len(parts) == len(headers):
# Heuristic: If first column looks like a File/ID/Method, treat as requirement
item_text = f"{parts[0]}: {parts[1]}" if len(parts) >= 2 else parts[0]
checklist.append({
"section": current_section,
"item": item_text,
"type": "table_row",
"status": "pending"
})
elif not stripped:
in_table = False
return checklist
def generate_verification_plan(checklist):
output = []
output.append("# Generated Gap Analysis Checklist")
output.append("\n## Gap Analysis Matrix\n")
output.append("| Category | Requirement | Implementation Status | Notes |")
output.append("|---|---|---|---|")
for item in checklist:
output.append(f"| {item['section']} | {item['item']} | Pending | |")
return "\n".join(output)
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python checklist_generator.py <input_md_file>")
sys.exit(1)
try:
with open(sys.argv[1], 'r', encoding='utf-8') as f:
content = f.read()
checklist = extract_checklist(content)
print(generate_verification_plan(checklist))
except Exception as e:
print(f"Error: {e}")
sys.exit(1)