#!/usr/bin/env python3
"""Extract each page's inline <script> body to /static/js/pages/{page}.js
and replace the inline block with an external src reference.

Why: the app enforces CSP `script-src 'self'` (no unsafe-inline), which blocks
inline scripts. External same-origin files comply without weakening security.
"""
import re
import sys
from pathlib import Path

STATIC = Path(__file__).resolve().parent.parent / "static"
PAGES_DIR = STATIC / "js" / "pages"
PAGES_DIR.mkdir(parents=True, exist_ok=True)

INLINE_RE = re.compile(r"<script>(.*?)</script>", re.S)

def process(html_path: Path) -> str:
    src = html_path.read_text(encoding="utf-8")
    name = html_path.stem
---
ls: cannot access '.gitignore': No such file or directory
