Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions skills/session-handoff/scripts/validate_handoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ def check_required_sections(content: str) -> tuple[bool, list[str]]:
"""Check that required sections exist and have content."""
missing = []
for section in REQUIRED_SECTIONS:
# Look for section header
pattern = rf'(?:^|\n)##?\s*{re.escape(section)}'
# Look for section header at any heading depth (# through ######)
pattern = rf'(?:^|\n)#{{1,6}}\s*{re.escape(section)}'
match = re.search(pattern, content, re.IGNORECASE)
if not match:
missing.append(f"{section} (missing)")
else:
# Check if section has meaningful content (not just placeholder)
section_start = match.end()
next_section = re.search(r'\n##?\s+', content[section_start:])
next_section = re.search(r'\n#{1,6}\s+', content[section_start:])
section_end = section_start + next_section.start() if next_section else len(content)
section_content = content[section_start:section_end].strip()

Expand All @@ -87,7 +87,7 @@ def check_recommended_sections(content: str) -> list[str]:
"""Check which recommended sections are missing."""
missing = []
for section in RECOMMENDED_SECTIONS:
pattern = rf'(?:^|\n)##?\s*{re.escape(section)}'
pattern = rf'(?:^|\n)#{{1,6}}\s*{re.escape(section)}'
if not re.search(pattern, content, re.IGNORECASE):
missing.append(section)
return missing
Expand Down