Build Script to Auto-Generate INDEX.md from Directory Structure

taskdone

Create a generate-index script that deterministically produces INDEX.md files from directory contents, per docs-doctrine §5 and §10.2.

INDEX.md is always derived (never hand-edited). The script must be idempotent — running it twice produces identical output.

Acceptance Criteria

  • [ ] Write scripts/generate-index (Python or Node) that walks a directory tree
  • [ ] Output a Markdown index listing all files with their classification type
  • [ ] Include file headers (type, source) in the index where available
  • [ ] Mark generated INDEX.md files with type: derived, source: directory structure, sync: script, sla: on-change
  • [ ] Add a pre-commit hook or CI step that regenerates and diffs INDEX.md
  • [ ] Fail CI if INDEX.md is stale (generated output differs from committed)

Source

docs/governance/docs-doctrine.md — Migration Phase 3 ("Introduce generation") + §10.2