polish: discovery hardening per code review (review round 2 minors)
- Fail fast with clear RuntimeError when themes/ directory is missing - Document underscore-prefix skip rule - Tests: broken-manifest/mismatch/no-manifest skip case, missing-dir fail-fast - tests/test_theme_pro_v3.py: drop fourth hardcoded list, import from core Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -13,8 +13,12 @@ ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
def discover_themes():
|
||||
"""Discover built-in themes from themes/*/manifest.json (single source of truth)."""
|
||||
themes_dir = ROOT / 'themes'
|
||||
if not themes_dir.is_dir():
|
||||
raise RuntimeError(f'themes directory missing: {themes_dir}')
|
||||
found = []
|
||||
for entry in sorted((ROOT / 'themes').iterdir()):
|
||||
for entry in sorted(themes_dir.iterdir()):
|
||||
# Underscore prefix marks non-theme assets (e.g. _professional_components.html).
|
||||
if not entry.is_dir() or entry.name.startswith('_'):
|
||||
continue
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user