feat: add runner conversion scripts and strengthen cutover automation
This commit is contained in:
58
runners-conversion/periodVault/validate-sdd.sh
Executable file
58
runners-conversion/periodVault/validate-sdd.sh
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
# validate-sdd.sh
|
||||
# Ensures changed spec folders keep mandatory SDD artifacts.
|
||||
set -euo pipefail
|
||||
|
||||
BASE_REF="${1:-origin/main}"
|
||||
|
||||
if ! git rev-parse --verify "$BASE_REF" >/dev/null 2>&1; then
|
||||
BASE_REF="HEAD~1"
|
||||
fi
|
||||
|
||||
CHANGED_SPEC_FILES=()
|
||||
while IFS= read -r line; do
|
||||
[[ -n "$line" ]] && CHANGED_SPEC_FILES+=("$line")
|
||||
done < <(git diff --name-only "$BASE_REF"...HEAD -- 'specs/**')
|
||||
|
||||
if [[ ${#CHANGED_SPEC_FILES[@]} -eq 0 ]]; then
|
||||
echo "[validate-sdd] No changes under specs/."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
SPEC_DIRS=()
|
||||
add_unique_dir() {
|
||||
local candidate="$1"
|
||||
local existing
|
||||
for existing in "${SPEC_DIRS[@]:-}"; do
|
||||
[[ "$existing" == "$candidate" ]] && return 0
|
||||
done
|
||||
SPEC_DIRS+=("$candidate")
|
||||
}
|
||||
|
||||
for path in "${CHANGED_SPEC_FILES[@]}"; do
|
||||
if [[ "$path" =~ ^specs/[^/]+/ ]]; then
|
||||
spec_dir="$(echo "$path" | cut -d/ -f1-2)"
|
||||
add_unique_dir "$spec_dir"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#SPEC_DIRS[@]} -eq 0 ]]; then
|
||||
echo "[validate-sdd] PASS (no feature spec directories changed)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
FAILED=0
|
||||
for dir in "${SPEC_DIRS[@]}"; do
|
||||
for required in spec.md plan.md tasks.md allowed-files.txt; do
|
||||
if [[ ! -f "$dir/$required" ]]; then
|
||||
echo "[validate-sdd] Missing required file: $dir/$required"
|
||||
FAILED=1
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [[ $FAILED -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[validate-sdd] PASS ($BASE_REF...HEAD)"
|
||||
Reference in New Issue
Block a user