#!/usr/bin/env bash set -euo pipefail if [[ $# -lt 1 || $# -gt 2 ]]; then echo "usage: $0 [version]" >&2 exit 1 fi slug="$1" version="${2:-1}" root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cycle_dir="$root/cycles/$slug" status_file="$cycle_dir/05-status-v$version.md" if [[ ! -d "$cycle_dir" ]]; then echo "missing cycle: $cycle_dir" >&2 exit 1 fi status_of() { local path="$1" if [[ ! -f "$path" ]]; then printf 'missing' return fi if rg -q '^Pending\.$' "$path"; then printf 'stub' return fi if ! rg -q '^[[:space:]]*(-[[:space:]]+[A-Za-z0-9]|\d+\.[[:space:]]+[A-Za-z0-9]|[^#[:space:]\-`])' "$path"; then printf 'stub' return fi if rg -q '^# [A-Za-z ]+$' "$path" && [[ "$(wc -l < "$path")" -lt 8 ]]; then printf 'stub' return fi printf 'written' } cat > "$status_file" <