"""HTML views for branches/ worktree hygiene dashboard (#432).""" from __future__ import annotations import html from webui.layout import render_page from webui.worktree_scanner import HygieneSnapshot, WorktreeEntry def _escape(text: str) -> str: return html.escape(text, quote=True) def _badge(classification: str) -> str: return ( f'' f"{_escape(classification)}" ) def _entry_row(entry: WorktreeEntry) -> str: branch = entry.branch or "โ" head = entry.head_sha[:12] if entry.head_sha else "โ" dirty = ( f"{entry.dirty_tracked} tracked" + (" + untracked" if entry.dirty_untracked else "") if entry.dirty_tracked or entry.dirty_untracked else "clean" ) return ( "
{_escape(entry.rel_path)}{_escape(branch)}{_escape(head)}Partial scan: ' f"{_escape(snapshot.scan_error)}
| Path | Class | Branch | HEAD | " "Dirty | Detached | Notes | " "
|---|
No directories under branches/.
Read-only scan of local branches/ worktrees. "
"No deletion actions โ copy the canonical cleanup prompt when merge is confirmed.
{_escape(snapshot.cleanup_prompt)}'
''
""
f"{WORKTREE_PAGE_STYLES}"
f"{WORKTREE_PAGE_SCRIPT}"
)
return render_page(title="Worktrees", body_html=body)