provisioning-code/scripts/sync-catalog-schemas.nu

38 lines
2.2 KiB
Text

#!/usr/bin/env nu
# scripts/sync-catalog-schemas.nu — vendor code/schemas/ into catalog/schemas/.
#
# STOPGAP, not the intended end-state. catalog/ (remote prvng_extensions.git) has
# plural independent consumers beyond this one code/ checkout — per this
# project's own accepted ADR-046 and the monorepo-vs-split tension in
# provisioning/.ontoref/ontology/core.ncl, a shared structural contract (like
# schemas/lib/concerns.ncl, which virtually every component's defaults.ncl/
# contracts.ncl imports to typecheck) must NOT be vendored by copy — it should
# be distributed as a content-addressed OCI Domain artifact via the zot registry
# (core/nulib/platform/oci/contract_resolver.nu already implements exactly this
# mechanism for schemas/catalog/manifest.ncl). That mechanism has never been
# exercised for real (no catalog.lock.ncl exists anywhere), and its prerequisite
# chain (.ontology/manifest.ncl's registry_provides → a sops vault at
# ~/.config/ontoref/vaults/provisioning/ → an age master key → an encrypted
# credential) doesn't exist yet either — bootstrapping it is its own WO. Until
# then, this plain `cp -R` is the honest bootstrap-cheap bridge: it works for
# THIS checkout, on THIS machine, and makes no claim beyond that.
#
# NOTE: this script no longer syncs the witness mechanism (scripts/witness.nu,
# sow/laws.ncl) — those retired from code/ entirely on 2026-07-04. catalog/ is
# their sole, native, canonical home now (no consumer, code/ included, ever
# needed its own copy of catalog's own governance rules) — see
# provisioning/.coder/2026-07-03_laws-catalogo-provisioning.plan.md §12.
#
# Usage: nu scripts/sync-catalog-schemas.nu
# Run from provisioning/code/. Does NOT commit — catalog/ is its own repo;
# staging and committing the synced files there is a deliberate human act.
def main []: nothing -> nothing {
print "syncing schemas/ (stopgap cp -R — see header for why this isn't the end-state)..."
^mkdir -p "catalog/schemas"
^cp -R "schemas/." "catalog/schemas/"
print "synced schemas/ -> catalog/schemas/"
print ""
print "This does NOT commit — review and commit inside catalog/ yourself:"
print " cd catalog && git add schemas/ && git commit -m \"sync: schemas/ from code/ (stopgap, see header)\""
}