#!/bin/sh # Copy the installers from the source repo into this one. # # agent-standups is canonical: install.sh and install.ps1 are tracked there, # the probe harness reads them from the repo root (run-all.sh passes # $REPO/install.sh to the R06 probes), and P8-24 copies them. This repo is the # public face, so the files are copied rather than symlinked -- Gitea's raw/ # endpoint serves a symlink's link text, which would pipe a path into the # user's shell instead of a script. # # Run this before committing here, whenever the installers change. set -eu SRC="${1:-../agent-standups}" [ -f "$SRC/install.sh" ] || { echo "error: no install.sh under $SRC" >&2; exit 1; } changed=0 for f in install.sh install.ps1; do if ! cmp -s "$SRC/$f" "$f" 2>/dev/null; then cp "$SRC/$f" "$f" echo " updated $f" changed=1 fi done chmod +x install.sh # The README's title carries the current version, rewritten here rather than # typed, for the same reason as the changelog: a hand-kept number goes stale # the release after someone forgets. Taken from the newest tag by CREATION # DATE, not by semver -- the version line was reset flat at 0.1.0, so # v0.7.0-rc1 sorts higher than the current release (the same trap C24 hit). ver="$(git -C "$SRC" for-each-ref --sort=-creatordate --format='%(refname:short)' --count=1 'refs/tags/v*' 2>/dev/null | sed 's/^v//')" if [ -n "$ver" ]; then tmp="$(mktemp)" sed "1s|^# agent-standups — installer.*|# agent-standups — installer (current version: $ver)|" README.md > "$tmp" if ! cmp -s "$tmp" README.md; then mv "$tmp" README.md echo " updated README.md title to $ver" changed=1 else rm -f "$tmp" fi fi # CHANGELOG.md is docs/release-notes.md from 0.1.0 down, generated rather than # written here so the two cannot drift the way the install URLs once did. # # It stops at 0.1.0 on purpose. Below it the file carries the retired rc # lineage -- 0.5.0-rc3, 0.3.0, 0.2.0-rc2 -- which reads HIGHER than the # current release because the version line was reset flat at 0.1.0. Shipping # those to users invites "why is 0.5 older than 0.1?" on every read. NOTES="$SRC/docs/release-notes.md" if [ -f "$NOTES" ]; then end="$(grep -n '^# 0\.5\.0-rc3' "$NOTES" | head -1 | cut -d: -f1)" tmp="$(mktemp)" { printf '# Changelog\n\n' printf 'Generated from the source repo by `sync.sh`; do not edit here.\n' printf 'Starts at 0.1.0, where the version line was reset flat.\n\n' if [ -n "$end" ]; then # Back past the 0.5.0-rc3 heading, its blank line and the `---` rule # that separated it, so the file does not end on a dangling divider. head -n "$((end - 3))" "$NOTES" else cat "$NOTES" fi } > "$tmp" if ! cmp -s "$tmp" CHANGELOG.md 2>/dev/null; then mv "$tmp" CHANGELOG.md echo " updated CHANGELOG.md" changed=1 else rm -f "$tmp" fi fi [ "$changed" = 1 ] || echo " already in sync with $SRC"