2026-04-21 18:08:27 +12:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -e
|
|
|
|
|
|
2025-02-19 15:00:44 -05:00
|
|
|
# Only auto-format desktop TS code if relevant files are modified
|
2026-04-21 18:08:27 +12:00
|
|
|
if git diff --cached --no-renames --name-only | grep -q "^ui/desktop/"; then
|
2025-05-29 14:29:21 -05:00
|
|
|
if [ -d "ui/desktop" ]; then
|
2026-04-21 18:08:27 +12:00
|
|
|
(cd ui/desktop && pnpm exec lint-staged)
|
2025-05-29 14:29:21 -05:00
|
|
|
else
|
|
|
|
|
echo "Warning: ui/desktop directory does not exist, skipping lint-staged"
|
|
|
|
|
fi
|
2025-04-28 07:20:00 -07:00
|
|
|
fi
|
2026-04-21 18:08:27 +12:00
|
|
|
|
|
|
|
|
# Run goose2 checks if any staged files are under ui/goose2/
|
|
|
|
|
if git diff --cached --no-renames --name-only | grep -q '^ui/goose2/'; then
|
|
|
|
|
if [ -d "ui/goose2" ]; then
|
|
|
|
|
REPO_ROOT="$(pwd)"
|
|
|
|
|
echo "Running goose2 pre-commit checks..."
|
|
|
|
|
|
|
|
|
|
# Auto-format only staged files and re-stage them
|
|
|
|
|
STAGED_FILES=$(git diff --cached --no-renames --diff-filter=ACMR --name-only | grep '^ui/goose2/' | sed 's|^ui/goose2/||' || true)
|
|
|
|
|
if [ -n "$STAGED_FILES" ]; then
|
|
|
|
|
cd ui/goose2
|
|
|
|
|
echo "$STAGED_FILES" | xargs npx biome format --write
|
|
|
|
|
echo "$STAGED_FILES" | xargs npx biome check --fix
|
|
|
|
|
cd "$REPO_ROOT"
|
|
|
|
|
git diff --cached --no-renames --diff-filter=ACMR --name-only | grep '^ui/goose2/' | xargs git add
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Run checks (biome check + file sizes + i18n + typecheck)
|
|
|
|
|
just goose2 check
|
|
|
|
|
else
|
|
|
|
|
echo "Warning: ui/goose2 directory does not exist, skipping goose2 checks"
|
|
|
|
|
fi
|
|
|
|
|
fi
|