v1.2.3 release: remove ShoeGaze CLI scaffolding (ShoeGaze now standalone)
This commit is contained in:
+143
@@ -0,0 +1,143 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# prepare_release.sh — replicate the Lyrebird dev repo's committed tree into the
|
||||
# public LyrebirdRelease (mooo) repo, minus the maintainer-only paths that never ship.
|
||||
#
|
||||
# Replaces the manual "export → hand-copy in Finder" step. Works from a clean
|
||||
# `git archive HEAD` of the dev repo (so untracked build junk and Finder " 2"/" 3"
|
||||
# duplicate cruft never leak in), strips the intentional exclusions, then rsyncs the
|
||||
# result over the release working tree with --delete (cleaning stale files) while
|
||||
# preserving the release repo's own .git and local .build.
|
||||
#
|
||||
# Dry-run by default. Pass --apply to actually modify the release working tree.
|
||||
#
|
||||
# Usage:
|
||||
# prepare_release.sh [--dev PATH] [--release PATH] [--apply] [--allow-dirty]
|
||||
#
|
||||
# Defaults:
|
||||
# --dev ~/Documents/src/Lyrebird
|
||||
# --release ~/Documents/src/LyrebirdRelease
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
DEV="${HOME}/Documents/src/Lyrebird"
|
||||
RELEASE="${HOME}/Documents/src/LyrebirdRelease"
|
||||
APPLY=0
|
||||
ALLOW_DIRTY=0
|
||||
|
||||
# Paths that are git-tracked in dev but must NOT ship in the public release.
|
||||
# (Verified: these exactly account for the dev↔release tracked-file delta.)
|
||||
EXCLUSIONS=(
|
||||
"legacy"
|
||||
"PLAN.md"
|
||||
".claude"
|
||||
".githooks"
|
||||
".swiftpm"
|
||||
)
|
||||
|
||||
# Regex the release repo's origin URL must match — a guard so --apply can never
|
||||
# nuke the wrong directory. Requires the mooo host AND the `Lyrebird` repo path
|
||||
# (so a sibling mooo repo like ShoeGaze can't be mistaken for the release repo).
|
||||
RELEASE_REMOTE_REGEX='realizedsound\.mooo\.com.*/Lyrebird(\.git)?/?$'
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--dev) DEV="$2"; shift 2 ;;
|
||||
--release) RELEASE="$2"; shift 2 ;;
|
||||
--apply) APPLY=1; shift ;;
|
||||
--allow-dirty) ALLOW_DIRTY=1; shift ;;
|
||||
-h|--help)
|
||||
tail -n +2 "$0" | grep '^#' | sed 's/^# \{0,1\}//'
|
||||
exit 0 ;;
|
||||
*) echo "ERROR: unknown argument '$1'" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
fail() { echo "ERROR: $*" >&2; exit 1; }
|
||||
|
||||
# --- Validate repos ---------------------------------------------------------
|
||||
[ -d "$DEV/.git" ] || fail "dev repo not a git repo: $DEV"
|
||||
[ -d "$RELEASE/.git" ] || fail "release repo not a git repo: $RELEASE"
|
||||
|
||||
RELEASE_URL="$(git -C "$RELEASE" remote get-url origin 2>/dev/null || echo "")"
|
||||
if [[ ! "$RELEASE_URL" =~ $RELEASE_REMOTE_REGEX ]]; then
|
||||
fail "release origin ('$RELEASE_URL') is not the Lyrebird mooo release repo (must match /$RELEASE_REMOTE_REGEX/) — refusing to sync. Wrong --release path?"
|
||||
fi
|
||||
|
||||
# --- Guard: dev working tree should be committed (we archive HEAD) -----------
|
||||
if [ -n "$(git -C "$DEV" status --porcelain)" ]; then
|
||||
if [ "$ALLOW_DIRTY" -eq 1 ]; then
|
||||
echo "WARNING: dev repo has uncommitted changes — they will NOT ship (archiving HEAD). Continuing (--allow-dirty)."
|
||||
else
|
||||
fail "dev repo ($DEV) has uncommitted changes. Commit them first (only HEAD ships), or pass --allow-dirty to archive HEAD anyway."
|
||||
fi
|
||||
fi
|
||||
|
||||
DEV_HEAD="$(git -C "$DEV" rev-parse --short HEAD)"
|
||||
echo "Dev HEAD: $DEV_HEAD ($(git -C "$DEV" log -1 --format=%s))"
|
||||
echo "Release repo: $RELEASE (origin: $RELEASE_URL)"
|
||||
echo "Mode: $([ "$APPLY" -eq 1 ] && echo APPLY || echo DRY-RUN)"
|
||||
echo
|
||||
|
||||
# --- Stage a pristine tree from git archive ---------------------------------
|
||||
STAGING="$(mktemp -d "${TMPDIR:-/tmp}/lyrebird-release-prep.XXXXXX")"
|
||||
trap 'rm -rf "$STAGING"' EXIT
|
||||
|
||||
git -C "$DEV" archive --format=tar HEAD | tar -x -C "$STAGING"
|
||||
|
||||
# Strip the intentional exclusions from the staged tree.
|
||||
echo "Excluding (maintainer-only, never shipped):"
|
||||
for p in "${EXCLUSIONS[@]}"; do
|
||||
if [ -e "$STAGING/$p" ]; then
|
||||
echo " - $p"
|
||||
rm -rf "$STAGING/$p"
|
||||
fi
|
||||
done
|
||||
echo
|
||||
|
||||
# --- Sync staging → release -------------------------------------------------
|
||||
# --delete removes release files not present in the staged tree (clears stale
|
||||
# files + accumulated Finder duplicates). Excludes protect the release repo's own
|
||||
# .git and local, non-shipped build/editor state from both transfer and deletion.
|
||||
RSYNC_ARGS=(
|
||||
-a -c --delete --itemize-changes
|
||||
--exclude='.git/'
|
||||
--exclude='.build/'
|
||||
--exclude='.swiftpm/'
|
||||
--exclude='.DS_Store'
|
||||
--exclude='xcuserdata/'
|
||||
--exclude='*.xcuserstate'
|
||||
)
|
||||
[ "$APPLY" -eq 1 ] || RSYNC_ARGS+=(--dry-run)
|
||||
|
||||
# Capture itemized output; filter to meaningful lines for display. rsync itemize
|
||||
# codes: leading '>' = content transfer, 'c' = created dir/file, '*deleting' =
|
||||
# removal. Leading '.' = metadata-only (mtime/perms) churn — harmless (git ignores
|
||||
# it), so suppress it from the summary. Content is authoritative via -c (checksum).
|
||||
ITEMS="$(rsync "${RSYNC_ARGS[@]}" "$STAGING/" "$RELEASE/")"
|
||||
MEANINGFUL="$(printf '%s\n' "$ITEMS" | grep -E '^(\*deleting|[>c])' || true)"
|
||||
|
||||
echo "Content changes + deletions ($([ "$APPLY" -eq 1 ] && echo applied || echo would apply)):"
|
||||
if [ -n "$MEANINGFUL" ]; then
|
||||
printf '%s\n' "$MEANINGFUL" | sed 's/^/ /'
|
||||
else
|
||||
echo " (none — release tree already matches dev content)"
|
||||
fi
|
||||
META_COUNT="$(printf '%s\n' "$ITEMS" | grep -cE '^\.' || true)"
|
||||
echo " [$META_COUNT files: mtime/perms normalized only — no content change, git-invisible]"
|
||||
echo
|
||||
|
||||
if [ "$APPLY" -eq 1 ]; then
|
||||
echo "Sync complete. Release working tree now mirrors dev HEAD ($DEV_HEAD) minus exclusions."
|
||||
echo
|
||||
echo "Release git status:"
|
||||
git -C "$RELEASE" status --short | sed 's/^/ /'
|
||||
echo
|
||||
echo "Next (run in $RELEASE — pushes need your key/touch):"
|
||||
echo " git -C \"$RELEASE\" add -A"
|
||||
echo " git -C \"$RELEASE\" commit -m \"<release message>\""
|
||||
echo " git -C \"$RELEASE\" tag -a vX.Y.Z -m \"vX.Y.Z: <summary>\""
|
||||
echo " git -C \"$RELEASE\" push origin main && git -C \"$RELEASE\" push origin vX.Y.Z"
|
||||
else
|
||||
echo "Dry-run only. Re-run with --apply to modify the release working tree."
|
||||
fi
|
||||
@@ -0,0 +1,112 @@
|
||||
---
|
||||
name: lyrebird_release_prep
|
||||
description: Prepare the public LyrebirdRelease (mooo) repo from the Lyrebird dev repo, replacing the manual "export → hand-copy in Finder" step. Syncs the dev repo's committed tree into the release working tree, excluding maintainer-only paths that never ship (legacy/, PLAN.md, .claude/, .githooks/, .swiftpm/) and cleaning accumulated Finder duplicate cruft. Dry-run first, then apply, then guides commit + tag + push to mooo. Use when cutting a new Lyrebird release (e.g. bumping to a new vX.Y.Z tag).
|
||||
---
|
||||
|
||||
# Lyrebird Release Prep
|
||||
|
||||
Replicates the Lyrebird **dev** repo (`~/Documents/src/Lyrebird`, origin = bitbucket) into
|
||||
the public **release** repo (`~/Documents/src/LyrebirdRelease`, origin = `realizedsound.mooo.com`)
|
||||
that SwiftPM consumers resolve from — without the manual Finder export/hand-copy.
|
||||
|
||||
## What it does (and why it's safe)
|
||||
|
||||
Works from a clean `git archive HEAD` of the dev repo, so:
|
||||
- only **committed, tracked** files ship (no `.build`, no editor state),
|
||||
- accumulated Finder duplicate cruft (` 2`/` 3` suffixed dirs) never leaks in, and
|
||||
- the release's own `.git` and local `.build` are preserved.
|
||||
|
||||
Then it strips the maintainer-only paths that are tracked in dev but must **not** ship
|
||||
(verified to exactly account for the dev↔release tracked-file delta):
|
||||
|
||||
| Excluded | Why |
|
||||
|---|---|
|
||||
| `legacy/` | old pre-modernization reference code |
|
||||
| `PLAN.md` | private planning doc |
|
||||
| `.claude/` | agent working-copy mirror (release ships `claude/` installer source only) |
|
||||
| `.githooks/` | dev-only pre-commit hooks |
|
||||
| `.swiftpm/` | local Xcode package state |
|
||||
|
||||
The sync uses `rsync -a -c --delete` (checksum-based, so only real content differences
|
||||
transfer; `--delete` clears stale files + Finder cruft on the release side). A moo-URL guard
|
||||
on the release remote prevents `--apply` from ever touching the wrong directory.
|
||||
|
||||
`docs/` (including `00-working-order.md` / `01-completed-working-order.md`) **does** ship —
|
||||
only top-level `PLAN.md` is excluded from the planning material.
|
||||
|
||||
## Steps
|
||||
|
||||
### 1. Pre-flight
|
||||
|
||||
Confirm the dev repo has the release commit already made (the script archives `HEAD` — uncommitted changes do **not** ship):
|
||||
|
||||
```bash
|
||||
git -C ~/Documents/src/Lyrebird status --short # should be clean
|
||||
git -C ~/Documents/src/Lyrebird log -1 --oneline
|
||||
```
|
||||
|
||||
If dirty, commit first (or the maintainer may pass `--allow-dirty` to archive HEAD anyway).
|
||||
|
||||
### 2. Dry run
|
||||
|
||||
```bash
|
||||
~/.claude/skills/lyrebird_release_prep/prepare_release.sh
|
||||
```
|
||||
|
||||
Read the summary: it lists the excluded paths, the deletions (Finder cruft cleanup), and the
|
||||
**content changes** (should match exactly the files changed since the last release). Metadata-
|
||||
only (mtime/perms) churn is reported as a count and is git-invisible.
|
||||
|
||||
Stop and investigate if the content-change list contains anything unexpected.
|
||||
|
||||
### 3. Apply
|
||||
|
||||
```bash
|
||||
~/.claude/skills/lyrebird_release_prep/prepare_release.sh --apply
|
||||
```
|
||||
|
||||
This mirrors the dev tree into the release working tree. It prints the release repo's
|
||||
`git status --short` afterward — this is the authoritative content diff.
|
||||
|
||||
### 4. Commit, tag, push (maintainer runs — push needs your key/touch)
|
||||
|
||||
The script prints these; fill in the version and message:
|
||||
|
||||
```bash
|
||||
R=~/Documents/src/LyrebirdRelease
|
||||
git -C "$R" add -A
|
||||
git -C "$R" commit -m "vX.Y.Z release: <summary>"
|
||||
git -C "$R" tag -a vX.Y.Z -m "vX.Y.Z: <summary>"
|
||||
git -C "$R" push origin main && git -C "$R" push origin vX.Y.Z
|
||||
```
|
||||
|
||||
Verify the tag landed:
|
||||
|
||||
```bash
|
||||
git -C "$R" ls-remote --tags origin | grep vX.Y.Z
|
||||
```
|
||||
|
||||
### 5. Point consumers at the new tag
|
||||
|
||||
For a downstream package pinned to a local `swift package edit` override during development
|
||||
(e.g. ShoeGaze), drop the override and bump the dependency once the tag is live:
|
||||
|
||||
```bash
|
||||
cd <consumer-pkg>
|
||||
swift package unedit Lyrebird
|
||||
swift package update Lyrebird # resolves to the new tag if Package.swift `from:` allows it
|
||||
swift build && swift test
|
||||
```
|
||||
|
||||
## Flags
|
||||
|
||||
- `--dev PATH` / `--release PATH` — override the default repo locations.
|
||||
- `--apply` — actually modify the release working tree (default is dry-run).
|
||||
- `--allow-dirty` — proceed even if the dev repo has uncommitted changes (still archives HEAD).
|
||||
|
||||
## Maintaining the exclusion list
|
||||
|
||||
If a new maintainer-only top-level path is added to the dev repo, add it to the `EXCLUSIONS`
|
||||
array in `prepare_release.sh`. Sanity check: after a dry run, the release tracked-file count
|
||||
plus the excluded tracked-file counts should equal the dev tracked-file count
|
||||
(`git ls-files | wc -l` in each; `git ls-files <path> | wc -l` per exclusion).
|
||||
Reference in New Issue
Block a user