Skip to content

Lint_adr

FieldValue
TypeSkill Resource
Source~/.copilot/skills/architecture/scripts/lint_adr.sh
DescriptionNot specified

Source Content

#!/usr/bin/env bash
# Validate an ADR/design doc against the house skeleton in
# ~/.claude/skills/adr/templates/adr-template.md: frontmatter id/status, and
# the load-bearing Decision/Why/Applies-when headings. Also fails on any
# unresolved [TODO]/[TBD] marker left in a doc whose status is not itself
# draft/WIP. Pure text/frontmatter parsing (python3 stdlib, no deps) — there
# is no external CLI for "does this ADR follow our skeleton", so this check
# is 100% custom, honestly labeled as such below.
#
# Usage:
# lint_adr.sh [adr.md]
#
# Example:
# scripts/lint_adr.sh ./docs/adr/ADR-042-event-log-store.md
set -uo pipefail
DOC="${1:-./adr.md}"
fail=0
warn() { printf '⚠️ %s\n' "$1"; }
error() { printf '❌ %s\n' "$1"; fail=1; }
ok() { printf '✅ %s\n' "$1"; }
if [[ ! -f "$DOC" ]]; then
echo "Usage: $0 [adr.md]" >&2
echo "File not found: $DOC" >&2
exit 2
fi
echo "== ADR skeleton (frontmatter id/status + Decision/Why/Applies-when headings) + [TODO]/[TBD] check (python3 stdlib — no external CLI exists for this) =="
py_out=$(python3 "$(dirname "$0")/lint_adr.py" "$DOC")
py_status=$?
while IFS= read -r line; do
case "$line" in
OK::*) ok "${line#OK::}" ;;
ERROR::*) error "${line#ERROR::}" ;;
*) [[ -n "$line" ]] && echo "$line" ;;
esac
done <<< "$py_out"
if [[ "$py_status" -ne 0 ]]; then
fail=1
fi
echo
if [[ "$fail" -eq 0 ]]; then
echo "All checks passed."
else
echo "One or more checks failed — see ❌ lines above."
fi
exit "$fail"