Skip to content

fix(claude): repair caveman hook node path and linux setup #1250

fix(claude): repair caveman hook node path and linux setup

fix(claude): repair caveman hook node path and linux setup #1250

Workflow file for this run

name: Test Sjust Installation
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
jobs:
test-sjust:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-15, macos-26]
env:
TERM: xterm-256color
SHELL: /bin/zsh
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup sparkdock directory
run: |
echo "Creating /opt/sparkdock directory and copying files..."
sudo mkdir -p /opt/sparkdock
sudo cp -R . /opt/sparkdock/
sudo chown -R $(whoami):staff /opt/sparkdock
echo "Verifying sparkdock directory structure..."
ls -la /opt/sparkdock/sjust/
- name: Install Just command runner
run: |
echo "Installing Just command runner..."
brew install just
- name: Install Homebrew bash and yq required by sjust recipes
run: |
# macOS ships /bin/bash 3.2; sjust scripts use bash 4+ idioms
# (declare -A, mapfile). The full provisioner installs `bash` via
# homebrew_packages.yml, but this lighter test job runs sjust directly
# and so must pull bash and yq in itself.
brew install bash yq
- name: Test sjust library files syntax
run: |
echo "Testing libcolors.sh syntax..."
/bin/zsh -n sjust/libs/libcolors.sh
echo "Testing libformatting.sh syntax..."
/bin/zsh -n sjust/libs/libformatting.sh
echo "Testing sjust.sh syntax..."
/bin/zsh -n sjust/sjust.sh
- name: Test Just recipe files syntax
run: |
echo "Testing main justfile syntax..."
just --justfile sjust/justfile --dry-run --list > /dev/null
echo "Testing individual recipe files..."
just --justfile sjust/recipes/00-default.just --dry-run --list > /dev/null
just --justfile sjust/recipes/01-lima.just --dry-run --list > /dev/null
# 03-macos-defaults.just intentionally consumes `sparkdock_path` from
# 00-default.just and so cannot be parsed standalone. It is exercised
# via the unified justfile a few lines above and `--evaluate` below.
- name: Test make install-sjust with git check disabled
run: |
echo "Testing make install-sjust command..."
cd /opt/sparkdock
# Run install-sjust with git check disabled
SKIP_GIT_CHECK=1 make install-sjust
echo "Testing sjust command is available..."
which sjust
echo "Testing sjust can list commands without errors..."
sjust --list
- name: Test zsh completion generation
run: |
echo "Testing zsh completion for sjust..."
# Check if completion file was created
BREW_PREFIX=$(brew --prefix 2>/dev/null || echo "/usr/local")
COMPLETION_FILE="$BREW_PREFIX/share/zsh/site-functions/_sjust"
if [ -f "$COMPLETION_FILE" ]; then
echo "✅ Completion file created at: $COMPLETION_FILE"
echo "Checking completion file content..."
cat "$COMPLETION_FILE"
# Verify compdef targets sjust
if head -1 "$COMPLETION_FILE" | grep -q '#compdef sjust'; then
echo "✅ Completion file has correct #compdef sjust header"
else
echo "❌ Completion file missing #compdef sjust header"
exit 1
fi
# Verify it defines an _sjust function with scoped JUST_JUSTFILE
if grep -q '_sjust()' "$COMPLETION_FILE"; then
echo "✅ Completion file defines _sjust() function"
else
echo "❌ Completion file does not define _sjust() function"
exit 1
fi
# Verify JUST_JUSTFILE is scoped to the subprocess (not exported globally)
if grep -q 'JUST_JUSTFILE="/opt/sparkdock/sjust/Justfile"' "$COMPLETION_FILE" && ! grep -q 'export JUST_JUSTFILE' "$COMPLETION_FILE"; then
echo "✅ JUST_JUSTFILE is correctly scoped to subprocess"
else
echo "❌ JUST_JUSTFILE should be scoped, not exported"
exit 1
fi
else
echo "❌ Completion file not found at: $COMPLETION_FILE"
exit 1
fi
- name: Test library functions can be sourced
run: |
echo "Testing that library files can be sourced without errors..."
# Test sourcing libcolors.sh
/bin/zsh -c "source sjust/libs/libcolors.sh && echo 'libcolors.sh sourced successfully'"
# Test sourcing libformatting.sh
/bin/zsh -c "source sjust/libs/libformatting.sh && echo 'libformatting.sh sourced successfully'"
# Test that functions are available after sourcing
/bin/zsh -c "source sjust/libs/libformatting.sh && echo 'Testing Urllink function:' && Urllink 'https://example.com' 'Example Link'"
- name: Test specific sjust commands (dry-run mode)
run: |
echo "Testing specific sjust commands in dry-run mode..."
# Test that device-info command can be parsed (dry-run)
sjust --dry-run system-device-info
# Test that docker-ps command can be parsed (dry-run)
sjust --dry-run docker-ps
# Test that upgrade-system command can be parsed (dry-run)
sjust --dry-run system-upgrade
- name: Test sjust with non-interactive environment
env:
NON_INTERACTIVE: "true"
run: |
echo "Testing sjust works in non-interactive environment..."
sjust --list > /dev/null
echo "✅ Sjust works correctly in non-interactive mode"
- name: Test sjust recipe imports
run: |
echo "Testing that recipe imports work correctly..."
# Verify that the main justfile can import all recipes
just --justfile sjust/justfile --evaluate > /dev/null
echo "✅ All recipe imports work correctly"
- name: Test macos-defaults sjust commands
run: |
set -euo pipefail
macos_major=$(sw_vers -productVersion | cut -d. -f1)
if [[ "${macos_major}" -lt 26 ]]; then
echo "macOS ${macos_major} detected — skipping macos-defaults lifecycle test (requires 26+)"
exit 0
fi
probe_domain="com.apple.desktopservices"
probe_key="DSDontWriteNetworkStores"
# Reset to a known un-applied state.
defaults delete "${probe_domain}" "${probe_key}" 2>/dev/null || true
rm -rf "${HOME}/.local/spark/macos-defaults"
echo "::group::macos-defaults-info raw"
out=$(sjust macos-defaults-info raw)
echo "$out" | head -20
echo "$out" | grep -q "Sparkdock — curated macOS defaults"
echo "::endgroup::"
echo "::group::macos-defaults-init-overrides (creates file, idempotent)"
sjust macos-defaults-init-overrides
test -f "${HOME}/.local/spark/macos-defaults/overrides.yml"
sjust macos-defaults-init-overrides # idempotent — must not clobber
echo "::endgroup::"
echo "::group::dry-run on un-applied system reports drift"
out=$(sjust macos-defaults dry-run)
echo "$out"
echo "$out" | grep -q "MACOS_DEFAULTS_STATUS: drift"
echo "::endgroup::"
echo "::group::dry-run strict on un-applied system exits 2"
rc=0; sjust macos-defaults dry-run strict || rc=$?
test "$rc" = "2"
echo "::endgroup::"
echo "::group::apply writes the curated defaults"
out=$(sjust macos-defaults)
echo "$out"
echo "$out" | grep -q "MACOS_DEFAULTS_STATUS: applied"
test "$(defaults read "${probe_domain}" "${probe_key}")" = "1"
echo "::endgroup::"
echo "::group::second apply is idempotent (no drift, status aligned)"
out=$(sjust macos-defaults)
echo "$out"
echo "$out" | grep -q "MACOS_DEFAULTS_STATUS: aligned"
echo "::endgroup::"
echo "::group::dry-run strict after apply exits 0 (no drift)"
sjust macos-defaults dry-run strict
echo "::endgroup::"
echo "::group::undo list shows the snapshot"
out=$(sjust macos-defaults-undo)
echo "$out"
echo "$out" | grep -qE 'Available snapshots|^[[:space:]]+[0-9]{4}-[0-9]{2}-[0-9]{2}T'
echo "::endgroup::"
echo "::group::undo restores the un-applied state"
sjust macos-defaults-undo restore
test "$(defaults read "${probe_domain}" "${probe_key}" 2>/dev/null || echo unset)" = "unset"
echo "::endgroup::"
echo "✅ macos-defaults full lifecycle (info / init-overrides / apply / dry-run / undo) verified"
- name: Clean up test installations
if: always()
run: |
echo "Cleaning up..."
sudo rm -f /usr/local/bin/sjust
# Clean up completion file
BREW_PREFIX=$(brew --prefix 2>/dev/null || echo "/usr/local")
sudo rm -f "$BREW_PREFIX/share/zsh/site-functions/_sjust"
# Clean up sparkdock directory
sudo rm -rf /opt/sparkdock