remove pre-commit and pre-push hooks (#9157)

This commit is contained in:
Jack Amadeo
2026-05-13 11:03:35 -04:00
committed by GitHub
parent e16f8e8f9b
commit 0e270373c2
5 changed files with 1 additions and 222 deletions
-39
View File
@@ -1,39 +0,0 @@
#!/usr/bin/env bash
set -e
# Only auto-format desktop TS code if relevant files are modified
if git diff --cached --no-renames --name-only | grep -q "^ui/desktop/"; then
if [ -d "ui/desktop" ]; then
(cd ui/desktop && pnpm exec lint-staged)
else
echo "Warning: ui/desktop directory does not exist, skipping lint-staged"
fi
fi
# 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 that biome can process, then re-stage them.
# Exclude justfile and .swift files — biome doesn't understand these formats
# and would fail with "no files were processed" when only such files are staged.
STAGED_FILES=$(git diff --cached --no-renames --diff-filter=ACMR --name-only \
| grep '^ui/goose2/' \
| grep -v -E '(^ui/goose2/justfile$|\.swift$)' \
| 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
-71
View File
@@ -1,71 +0,0 @@
#!/usr/bin/env bash
# Run goose2 pre-push checks if any commits being pushed include goose2 changes.
# --- Helper functions ---
# Check if any ref being pushed includes changes under a given path prefix.
# Reads git's pre-push stdin (local_ref local_oid remote_ref remote_oid).
push_touches() {
local prefix="$1"
local z40="0000000000000000000000000000000000000000"
while read local_ref local_oid remote_ref remote_oid; do
[ "$local_oid" = "$z40" ] && continue # deleting ref
if [ "$remote_oid" = "$z40" ]; then
# New branch — compare against the merge base with the default branch
range="$(git merge-base HEAD main 2>/dev/null || echo "$local_oid")...$local_oid"
else
range="$remote_oid...$local_oid"
fi
if git diff --no-renames --name-only "$range" -- 2>/dev/null | grep -q "^${prefix}"; then
return 0
fi
done
return 1
}
# Run commands in parallel, exit 1 if any fail.
# Usage: run_parallel "label1" "cmd1" "label2" "cmd2" ...
run_parallel() {
local -a labels=() pids=()
while [[ $# -ge 2 ]]; do
labels+=("$1"); shift
( eval "$1" ) & pids+=($!); shift
done
local -a failed=()
for i in "${!pids[@]}"; do
wait "${pids[$i]}" || failed+=("${labels[$i]}")
done
if [[ ${#failed[@]} -gt 0 ]]; then
echo "Failed: ${failed[*]}"
return 1
fi
}
# --- Hook body ---
push_touches "ui/goose2/" || exit 0
echo "Detected ui/goose2/ changes — running pre-push checks..."
run_parallel \
"fmt-check" "just goose2 fmt-check" \
"clippy" "just goose2 clippy" \
"check" "just goose2 check" \
"test" "just goose2 test" \
"build" "just goose2 build" \
"tauri-check" "just goose2 tauri-check"
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "All goose2 pre-push checks passed."
else
echo "goose2 pre-push checks failed."
exit 1
fi
+1 -13
View File
@@ -144,10 +144,8 @@
"eslint": "^9.39.2",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"husky": "^9.1.7",
"jsdom": "^28.1.0",
"knip": "^5.85.0",
"lint-staged": "^16.2.7",
"postcss": "^8.5.6",
"prettier": "^3.8.1",
"tailwindcss": "^4.2.1",
@@ -156,15 +154,5 @@
"vitest": "^4.0.18"
},
"keywords": [],
"license": "Apache-2.0",
"lint-staged": {
"src/**/*.{ts,tsx}": [
"bash -c 'pnpm run typecheck'",
"eslint --fix --max-warnings 0 --no-warn-ignored",
"prettier --write"
],
"src/**/*.{css,json}": [
"prettier --write"
]
}
"license": "Apache-2.0"
}
-1
View File
@@ -10,7 +10,6 @@ default:
# Install dependencies, build workspace packages, and activate git hooks
setup:
git config core.hooksPath .husky
cd ../ && pnpm install
cd ../sdk && pnpm build
cargo build --manifest-path ../../Cargo.toml -p goose-cli --bin goose
-98
View File
@@ -310,18 +310,12 @@ importers:
eslint-plugin-react-hooks:
specifier: ^5.2.0
version: 5.2.0(eslint@9.39.4(jiti@2.6.1))
husky:
specifier: ^9.1.7
version: 9.1.7
jsdom:
specifier: ^28.1.0
version: 28.1.0
knip:
specifier: ^5.85.0
version: 5.88.1(@types/node@25.5.0)(typescript@5.9.3)
lint-staged:
specifier: ^16.2.7
version: 16.4.0
postcss:
specifier: ^8.5.6
version: 8.5.8
@@ -4463,10 +4457,6 @@ packages:
resolution: {integrity: sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
cli-cursor@5.0.0:
resolution: {integrity: sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==}
engines: {node: '>=18'}
cli-highlight@2.1.11:
resolution: {integrity: sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==}
engines: {node: '>=8.0.0', npm: '>=5.0.0'}
@@ -5755,11 +5745,6 @@ packages:
humanize-ms@1.2.1:
resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==}
husky@9.1.7:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
engines: {node: '>=18'}
hasBin: true
i18next-resources-to-backend@1.2.1:
resolution: {integrity: sha512-okHbVA+HZ7n1/76MsfhPqDou0fptl2dAlhRDu2ideXloRRduzHsqDOznJBef+R3DFZnbvWoBW+KxJ7fnFjd6Yw==}
@@ -6319,19 +6304,10 @@ packages:
linkify-it@3.0.3:
resolution: {integrity: sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==}
lint-staged@16.4.0:
resolution: {integrity: sha512-lBWt8hujh/Cjysw5GYVmZpFHXDCgZzhrOm8vbcUdobADZNOK/bRshr2kM3DfgrrtR1DQhfupW9gnIXOfiFi+bw==}
engines: {node: '>=20.17'}
hasBin: true
listr2@7.0.2:
resolution: {integrity: sha512-rJysbR9GKIalhTbVL2tYbF2hVyDnrf7pFUZBwjPaMIdadYHmeT+EVi/Bu3qd7ETQPahTotg2WRCatXwRBW554g==}
engines: {node: '>=16.0.0'}
listr2@9.0.5:
resolution: {integrity: sha512-ME4Fb83LgEgwNw96RKNvKV4VTLuXfoKudAmm2lP8Kk87KaMK0/Xrx/aAkMWmT8mDb+3MlFDspfbCs7adjRxA2g==}
engines: {node: '>=20.0.0'}
load-json-file@2.0.0:
resolution: {integrity: sha512-3p6ZOGNbiX4CdvEd1VcE6yi78UrGNpjHO33noGwHCnT/o2fyllJDepsm8+mFFv/DvtwFHht5HIHSyOy5a+ChVQ==}
engines: {node: '>=4'}
@@ -6383,10 +6359,6 @@ packages:
resolution: {integrity: sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
log-update@6.1.0:
resolution: {integrity: sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==}
engines: {node: '>=18'}
longest-streak@3.1.0:
resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==}
@@ -6710,10 +6682,6 @@ packages:
resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}
engines: {node: '>=6'}
mimic-function@5.0.1:
resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==}
engines: {node: '>=18'}
mimic-response@1.0.1:
resolution: {integrity: sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==}
engines: {node: '>=4'}
@@ -6961,10 +6929,6 @@ packages:
resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==}
engines: {node: '>=6'}
onetime@7.0.0:
resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==}
engines: {node: '>=18'}
oniguruma-parser@0.12.1:
resolution: {integrity: sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==}
@@ -7684,10 +7648,6 @@ packages:
resolution: {integrity: sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
restore-cursor@5.1.0:
resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==}
engines: {node: '>=18'}
retry@0.12.0:
resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==}
engines: {node: '>= 4'}
@@ -7900,10 +7860,6 @@ packages:
resolution: {integrity: sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==}
engines: {node: '>=12'}
slice-ansi@7.1.2:
resolution: {integrity: sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==}
engines: {node: '>=18'}
slice-ansi@8.0.0:
resolution: {integrity: sha512-stxByr12oeeOyY2BlviTNQlYV5xOj47GirPr4yA1hE9JCtxfQN0+tVbkxwCtYDQWhEKWFHsEK48ORg5jrouCAg==}
engines: {node: '>=20'}
@@ -8000,10 +7956,6 @@ packages:
react: ^19.2.4
react-dom: ^19.2.4
string-argv@0.3.2:
resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==}
engines: {node: '>=0.6.19'}
string-width@4.2.3:
resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
engines: {node: '>=8'}
@@ -13007,10 +12959,6 @@ snapshots:
dependencies:
restore-cursor: 4.0.0
cli-cursor@5.0.0:
dependencies:
restore-cursor: 5.1.0
cli-highlight@2.1.11:
dependencies:
chalk: 4.1.2
@@ -14634,8 +14582,6 @@ snapshots:
dependencies:
ms: 2.1.3
husky@9.1.7: {}
i18next-resources-to-backend@1.2.1:
dependencies:
'@babel/runtime': 7.29.2
@@ -15190,15 +15136,6 @@ snapshots:
dependencies:
uc.micro: 1.0.6
lint-staged@16.4.0:
dependencies:
commander: 14.0.3
listr2: 9.0.5
picomatch: 4.0.3
string-argv: 0.3.2
tinyexec: 1.0.4
yaml: 2.8.2
listr2@7.0.2:
dependencies:
cli-truncate: 3.1.0
@@ -15208,15 +15145,6 @@ snapshots:
rfdc: 1.4.1
wrap-ansi: 8.1.0
listr2@9.0.5:
dependencies:
cli-truncate: 5.2.0
colorette: 2.0.20
eventemitter3: 5.0.4
log-update: 6.1.0
rfdc: 1.4.1
wrap-ansi: 9.0.2
load-json-file@2.0.0:
dependencies:
graceful-fs: 4.2.11
@@ -15266,14 +15194,6 @@ snapshots:
strip-ansi: 7.2.0
wrap-ansi: 8.1.0
log-update@6.1.0:
dependencies:
ansi-escapes: 7.3.0
cli-cursor: 5.0.0
slice-ansi: 7.1.2
strip-ansi: 7.2.0
wrap-ansi: 9.0.2
longest-streak@3.1.0: {}
loose-envify@1.4.0:
@@ -15847,8 +15767,6 @@ snapshots:
mimic-fn@2.1.0: {}
mimic-function@5.0.1: {}
mimic-response@1.0.1: {}
mimic-response@3.1.0: {}
@@ -16079,10 +15997,6 @@ snapshots:
dependencies:
mimic-fn: 2.1.0
onetime@7.0.0:
dependencies:
mimic-function: 5.0.1
oniguruma-parser@0.12.1: {}
oniguruma-to-es@4.3.5:
@@ -16931,11 +16845,6 @@ snapshots:
onetime: 5.1.2
signal-exit: 3.0.7
restore-cursor@5.1.0:
dependencies:
onetime: 7.0.0
signal-exit: 4.1.0
retry@0.12.0: {}
reusify@1.1.0: {}
@@ -17217,11 +17126,6 @@ snapshots:
ansi-styles: 6.2.3
is-fullwidth-code-point: 4.0.0
slice-ansi@7.1.2:
dependencies:
ansi-styles: 6.2.3
is-fullwidth-code-point: 5.1.0
slice-ansi@8.0.0:
dependencies:
ansi-styles: 6.2.3
@@ -17330,8 +17234,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
string-argv@0.3.2: {}
string-width@4.2.3:
dependencies:
emoji-regex: 8.0.0