"""Single source of truth for statusline paths and naming conventions."""

import re
from pathlib import Path

PLUGIN_DIR = Path.home() / ".claude" / "statusline.d"
SESSION_BASE = Path("/tmp/claude-sessions")
PLUGIN_PATTERN = re.compile(r"^\d+-(.+)\.\w+$")


def session_dir(session_id: str) -> Path:
    """Return the session directory for a given session ID."""
    return SESSION_BASE / session_id


def plugin_name(path: Path) -> str:
    """Extract plugin name from NN-name.ext filename."""
    m = PLUGIN_PATTERN.match(path.name)
    return m.group(1) if m else path.stem
