Files
boshu2__agentops/scripts/lib/docs-scope.sh
Bo 1d4c003e05 Cut plan: gate registry diet, legacy bash gate removal, CI collapse, pawl warm-service removal (#906)
## Summary
- **Wave 1** — remove the `always.wiring-closure` meta-gate, demote
`docs.skill-refs` to Full tier, delete 8 orphan scripts.
- **Wave 2** — delete the legacy bash pre-push gate (`pre-push-gate.sh`,
2,279 lines) and its parity machinery; collapse `validate.yml` from 18
jobs to 5.
- **Wave 3** — remove the pawl warm NTM standing service; the cold
review spine (pawl-review / pawl-verdict / pre-push check) is untouched.
- **Wave 4** — gate registry diet: cut 24 doctrine/meta check IDs and
~70 backing scripts/workflows/bats; trim nightly knowledge-cycle job.

Net: gate registry 112 → 83 checks (incl. main's additions), ~24k lines
of scripts/CI/bats deleted. Routine one-file fast gate now runs in ~19s.

## Test plan
- [x] `go build` / `go vet` / gates+goals+ports package tests green
- [x] `ao gate check --fast --scope range:origin/main..HEAD` — 66
passed, 0 failed, 1 skipped (199 changed files)
- [x] `validate-ci-policy-parity.sh` PASS; validate.yml / nightly.yml
parse
- [x] `regen-changed-scope --check` green; registry.json regenerated
- [x] Grepped tree for dangling references to every deleted script/check
ID

Made with [Cursor](https://cursor.com)

---------

Co-authored-by: boshu <241868352+boshu2@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-13 14:45:20 -04:00

71 lines
3.2 KiB
Bash

#!/usr/bin/env bash
# shellcheck shell=bash
# scripts/lib/docs-scope.sh — sourced library: shared LIVE-doc scope resolution
# and the "is this doc historical-by-design" exemption test.
#
# Source it (do NOT execute it):
# . "$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/lib/docs-scope.sh"
#
# Shared LIVE-doc scope helper (age-gate-the-ungated-egwt.1)
# so any docs-scoped gate resolves the SAME live-doc set and the SAME
# historical-exemption rule from one place. The retired-tech line-level
# REMOVAL_LANG past-tense exemption is retired-tech-specific and stays in that
# check script — it is deliberately NOT part of this lib.
#
# IMPORTANT — behavior-preserving contract: this lib does NOT `set -euo pipefail`
# on behalf of its callers. Historical extractor
# sets strict mode itself; forcing it here could change a different caller's
# behavior. The functions below are pure/idempotent and safe under either mode.
#
# Scope resolution is anchored at DOCS_ROOT (default: the current directory).
# Callers that `cd` to the repo root before use get the historical relative
# `docs/...` paths unchanged; tests inject DOCS_ROOT to point at a fixture tree.
# docs_scope_live_files — emit the LIVE docs/**/*.md set (one path per line),
# NUL-safe ordering via `sort`. Paths are emitted relative to DOCS_ROOT and
# always begin with `docs/` (matching the extracting script's historical output).
#
# The exclude list is the dated/historical-archive set copied verbatim from
docs_scope_live_files() {
local root="${DOCS_ROOT:-.}"
( cd "$root" && find docs -name '*.md' \
-not -path 'docs/adr/*' \
-not -path 'docs/audits/*' -not -path 'docs/plans/*' -not -path 'docs/brainstorms/*' \
-not -path 'docs/council*/*' -not -path 'docs/handoffs/*' -not -path 'docs/learnings/*' \
-not -path 'docs/evidence/*' -not -path 'docs/releases/*' -not -path 'docs/convergence/*' \
-not -path 'docs/rescope/*' -not -path 'docs/reduction/*' -not -path 'docs/migration-trackers/*' \
-not -path 'docs/sovereignty-proof/*' -not -path 'docs/rfcs/*' -not -path 'docs/code-map/*' \
| sort )
}
# docs_scope_is_exempt FILE — return 0 (exempt / historical-by-design) if the
# doc opts out of live-staleness scanning by ANY of:
# - a migration/upgrade/retirement/closeout/index filename glob
# - a RETIRED / HISTORICAL / SUPERSEDED banner in its FIRST 15 lines
# - living under docs/adr/
# Otherwise return 1 (a live doc, in scope).
#
# FILE is resolved relative to DOCS_ROOT when it is not already readable as-is,
# so callers that pass a `docs/...` path after `cd`-ing to the root keep working
# unchanged, while a test can point DOCS_ROOT at a fixture tree.
docs_scope_is_exempt() {
local f="$1"
case "$f" in
*-migration*|*-retirement*|*-sunset*|*-closeout*|*CHANGELOG*) return 0 ;;
*MIGRATION*|*UPGRADING*|*documentation-index*) return 0 ;;
esac
# docs/adr/ is historical by design.
case "$f" in
docs/adr/*|*/docs/adr/*) return 0 ;;
esac
# self-declared historical banner in the first 15 lines
local path="$f"
if [ ! -r "$path" ] && [ -n "${DOCS_ROOT:-}" ] && [ -r "${DOCS_ROOT%/}/$f" ]; then
path="${DOCS_ROOT%/}/$f"
fi
if head -n 15 "$path" 2>/dev/null | grep -qiE 'RETIRED|HISTORICAL|SUPERSEDED'; then
return 0
fi
return 1
}