#!/usr/bin/env python3 """BT10 2차 보정: 부록 A를 C43~C44 사이에서 C47~P1 사이로 재이동. C 영역 연속성 회복. 현 구조: ...C43 / 부록A (2256) / C44~C47 (2285~) / P1 (2464) 목표 구조: ...C43 / C44~C47 / 부록A / P1 """ from __future__ import annotations from pathlib import Path REPO_ROOT = Path(__file__).resolve().parent.parent SKILL = REPO_ROOT / ".claude" / "skills" / "BurningTimes-코어룰" / "SKILL.md" def move_appendix() -> None: src = SKILL.read_text(encoding="utf-8") lines = src.splitlines(keepends=True) total = len(lines) print(f"총 라인: {total}") # 경계 식별 appendix_start = None c44_start = None p1_start = None for i, ln in enumerate(lines): if ln.startswith("# 📘 부록 A"): appendix_start = i elif ln.startswith("## C44. 팩트 우선주의"): c44_start = i elif ln.startswith("## P1. 호칭") and p1_start is None: p1_start = i assert appendix_start is not None, "부록 A 미발견" assert c44_start is not None, "C44 미발견" assert p1_start is not None, "P1 미발견" # 부록 A 앞 "---\n" 구분자도 함께 이동해야 자연스러움 # lines[appendix_start-1] = "---\n" 예상 # 확인 if lines[appendix_start-1].strip() == "---": appendix_start_with_sep = appendix_start - 1 else: appendix_start_with_sep = appendix_start # 부록 A 끝 = C44 직전 "---\n" 구분자 직전 # 실제로 C44 직전에도 "---\n" 구분자 있을 것 appendix_end = c44_start # C44 시작 직전까지 모두 부록 A 영역 # P1 앞 "---\n" 구분자 확인 # lines[p1_start-1] 확인 # 재조립: # part1: 0 ~ appendix_start_with_sep (부록 A + "---" 직전까지 = C43 말미) # appendix_block: appendix_start_with_sep ~ appendix_end (부록A 전체 + 앞뒤 구분자 포함) # c4447_block: appendix_end ~ p1_start (C44~C47 + 뒤 구분자) # part_last: p1_start ~ end (P1~P33) part1 = lines[0:appendix_start_with_sep] appendix_block = lines[appendix_start_with_sep:appendix_end] c4447_block = lines[appendix_end:p1_start] part_last = lines[p1_start:] # 신 구조: part1 + c4447_block + appendix_block + part_last new_lines = part1 + c4447_block + appendix_block + part_last new_content = "".join(new_lines) # 검증 c43_pos = new_content.index("## C43. PD 호칭별") c44_pos = new_content.index("## C44. 팩트 우선주의") c47_pos = new_content.index("## C47. 능동적 추론") appendix_pos = new_content.index("# 📘 부록 A") p1_pos = new_content.index("## P1. 호칭") print(f"C43 위치: {c43_pos}") print(f"C44 위치: {c44_pos}") print(f"C47 위치: {c47_pos}") print(f"부록A 위치: {appendix_pos}") print(f"P1 위치: {p1_pos}") assert c43_pos < c44_pos, "C43 → C44 순서" assert c44_pos < c47_pos, "C44 → C47 순서" assert c47_pos < appendix_pos, "C47 → 부록A 순서 (C 연속성 회복)" assert appendix_pos < p1_pos, "부록A → P1 순서" # 중복 제거 검증 assert new_content.count("## C44.") == 1 assert new_content.count("## P1. 호칭") == 1 assert new_content.count("# 📘 부록 A") == 1 SKILL.write_text(new_content, encoding="utf-8") print(f"[OK] 부록 A 재이동 완료 (C47 뒤 · P1 앞)") print(f"신 라인 수: {len(new_lines)}") if __name__ == "__main__": move_appendix()