Commit 89ecb8a8 authored by Dimitrios Gogos's avatar Dimitrios Gogos
Browse files

chore(scripts): add check-spec-versions.sh that ADR-0021 relies on

ADR-0021 links to the script and names it as the enforcement for the
Release 2 version pin, but it was never committed. It checks every
tracked spec outside the ADR-0021/ADR-0071 exceptions and fails on any
frontmatter version other than "2.0".

Co-Authored-By: default avatarClaude Opus 5.5 <noreply@anthropic.com>
parent 1cb4c77f
Loading
Loading
Loading
Loading
+1 −0
Changes for README.md: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -50,4 +50,5 @@ This repository is an [Open Knowledge Format (OKF) v0.1](https://github.com/Goog
| [ai2/](ai2/) | AI² — agent and MCP server over OEG's APIs |
| [decisions/](decisions/) | Architecture Decision Records |
| [external-specs/](external-specs/) | Vendored third-party API definitions |
| [scripts/](scripts/) | Repo checks, such as the Release 2 version pin (ADR-0021) |
| `archive/` (planned) | Superseded working documents, created when needed |
+18 −0
Changes for scripts/check-spec-versions.sh: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/usr/bin/env bash
# Fails if any Release 2 spec's frontmatter version is not exactly "2.0" (ADR-0021, ADR-0071).
set -euo pipefail

cd "$(dirname "$0")/.."

status=0
while IFS= read -r file; do
    version=$(awk 'NR == 1 && $0 != "---" { exit } NR > 1 && $0 == "---" { exit } /^version:/ { sub(/^version:[ \t]*/, ""); gsub(/"/, ""); print; exit }' "$file")
    if [[ "$version" != "2.0" ]]; then
        echo "$file: version is '${version:-missing}', expected '2.0'" >&2
        status=1
    fi
done < <(git ls-files '*/*.md' \
    | grep -vE '^(decisions|archive|external-specs|ih|data-lab)/' \
    | grep -vE '(^|/)index\.md$')

exit $status