#!/usr/bin/env nu # Project the ADR set into a flat reference map — the single source consumed by # both outreach surfaces: the site sidebar (merged into content_graph.json) and # the outreach/web linkifier. Source of truth: .ontoref/adrs/adr-NNN.ncl. # # Two-tier links (ADR-057 hook-static-prize-live): the map carries the ADR's # human title (the daemon-free static label) plus the live deep-links — # detail_url → daemon ADR page, graph_url → daemon graph focused on the node. # # Usage: # nu scripts/build/gen-adr-map.nu --root [--daemon ] [--out ] def main [ --root: string = "../.." # constellation root, relative to outreach/site --daemon: string = "https://ontoref.dev" # daemon base the deep-links resolve against --out: string = "site/public/r/adr-map.json" # output path, relative to cwd (outreach/site) ] { let adrs_dir = $"($root)/.ontoref/adrs" let ip_data = $"($root)/code/ontology" let files = ( glob $"($adrs_dir)/adr-*.ncl" | where {|f| ($f | path basename) =~ '^adr-[0-9]' } | sort ) mut map = {} for f in $files { let adr = (nickel export --format json --import-path $ip_data --import-path $adrs_dir $f | from json) let id = $adr.id let slug = ($id | str replace 'adr-' '') $map = ($map | insert $id { name: $adr.title, status: ($adr.status? | default "Unknown"), detail_url: $"($daemon)/adr/($slug)", graph_url: $"($daemon)/graph?focus=($id)", }) } $map | to json --indent 2 | save -f $out print $"adr-map: ($map | columns | length) ADRs → ($out)" }