Show sibling projects' versions, and let version update them
shellcheck / shellcheck (push) Failing after 19s

A sibling's version is its latest git tag (v1.4.0, or v1.4.0+3 for commits
after it), or, without tags, its commit's date and short hash, like
CoreDesktop's own. The version shown as available is that of the newest
commit on the default branch, which is what update installs.

sibling list shows each sibling's version. sibling check fetches every
sibling at once and shows which have a newer version, and sibling update
[name...] updates the named siblings or all of them. 71-siblings.sh now
runs sibling update, so update and version share one way of updating.

version lists the installed siblings with any newer version and, when run
in a terminal, asks for each one whether to update it now. version --check
and the update notification still only look at CoreDesktop.

The sibling skill docs describe how to release a version by tagging it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 10:26:51 -07:00
co-authored by Claude Opus 5.5
parent 318e858021
commit ee7451600b
8 changed files with 401 additions and 37 deletions
+47 -3
View File
@@ -4,15 +4,19 @@ load test_helper
# version runs from a fake checkout with fake git, uname, pacman and
# checkupdates. The running kernel's modules never exist here, so the kernel
# line always also says a newer one is installed.
# line always also says a newer one is installed. Sibling projects are real git
# repositories: only git commands on the fake checkout are faked.
setup() {
common_setup
CD="$HOME/.local/share/coredesktop"
mkdir -p "$CD"
cp "$REPO/version" "$REPO/utils.sh" "$CD/"
cp "$REPO/version" "$REPO/utils.sh" "$REPO/sibling" "$CD/"
stub git 'case "$3" in
export CD REAL_GIT
REAL_GIT="$(command -v git)"
stub git '[ "$2" = "$CD" ] || exec "$REAL_GIT" "$@"
case "$3" in
rev-parse) exit 0 ;;
log) echo "2026.10.31 (6bc4fdc)" ;;
fetch) exit 1 ;;
@@ -89,3 +93,43 @@ setup() {
[ "$status" -eq 0 ]
[[ "$output" != *"mirror"* ]]
}
# sibling_repo NAME: a sibling at v1.0.0 whose origin has a newer v1.1.0
sibling_repo() {
export GIT_AUTHOR_NAME=Test GIT_AUTHOR_EMAIL=test@example.com
export GIT_COMMITTER_NAME=Test GIT_COMMITTER_EMAIL=test@example.com
local origin="$BATS_TEST_TMPDIR/origins/$1"
git init -q -b main "$origin"
echo 'echo "$PWD" >> "$HOME/updated"' > "$origin/update.sh"
git -C "$origin" add -A
git -C "$origin" commit -qm first
git -C "$origin" tag v1.0.0
git clone -q "$origin" "$HOME/.local/share/siblings/$1"
git -C "$origin" commit -q --allow-empty -m second
git -C "$origin" tag v1.1.0
}
@test "version leaves out sibling projects when none are installed" {
run bash "$CD/version"
[ "$status" -eq 0 ]
[[ "$output" != *"Sibling"* ]]
}
@test "version lists sibling projects, and doesn't ask to update without a terminal" {
sibling_repo tools
run bash "$CD/version" < /dev/null
[ "$status" -eq 0 ]
[[ "$output" == *"Sibling projects"$'\n'" tools v1.0.0, v1.1.0 is available"* ]]
[[ "$output" != *"Update tools"* ]]
[ ! -f "$HOME/updated" ]
}
@test "version updates the sibling projects the user says yes to" {
sibling_repo keep
sibling_repo tools
run script -qec "bash '$CD/version'" /dev/null <<< $'n\ny'
[ "$status" -eq 0 ]
[[ "$output" == *"Update keep to v1.1.0? [y/N]"* ]]
[[ "$output" == *"tools is at v1.1.0."* ]]
[ "$(cat "$HOME/updated")" = "$HOME/.local/share/siblings/tools" ]
}