#!/usr/bin/env python3 """ analysis_to_index.py — STAGE 3 of the video -> docs pipeline. Reads the committed per-video analyses (written by the /analyze-videos skill) plus the hand-authored UI-topic registry, and builds the reference indices the editor reads: references/video-analysis/.md + references/topics/ui-topics.md -> references/indices/videos.json + mentions.json + topics.json videos.json = { "videos": [ { id, type, date, title, url, duration } ] } topics.json = { "topics": { "ui:": { term, parent, synonyms, classes, docFile } } } (docFile points at references/topics/ui/.md — the editor loads it lazily) mentions.json = { "op:" | "ui:": [ { video, startSecond, duration, url, depth, style, purpose, confidence, note } ] } Each mention line is `[→] [Op]/[ui:Id] · ·