Skip to content

feat(hooks): add Husky git hooks for ui/goose2#8577

Merged
matt2e merged 8 commits into
mainfrom
git-hooks
Apr 21, 2026
Merged

feat(hooks): add Husky git hooks for ui/goose2#8577
matt2e merged 8 commits into
mainfrom
git-hooks

Conversation

@matt2e
Copy link
Copy Markdown
Collaborator

@matt2e matt2e commented Apr 16, 2026

Summary

  • Add pre-commit hook for ui/goose2 that auto-formats with Biome and runs checks (biome check, file sizes, i18n, typecheck)
  • Add pre-push hook that detects goose2 changes in pushed commits and runs fmt-check, clippy, check, test, build, and tauri-check in parallel
  • Extract reusable helper functions (push_touches, run_parallel) for hook plumbing (these came for free in lefthook)

Test plan

  • Verify pre-commit hook triggers when staging files under ui/goose2/
  • Verify pre-push hook triggers when pushing commits with ui/goose2/ changes
  • Verify hooks are skipped when no goose2 files are involved

🤖 Generated with Claude Code

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e1432515c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .husky/pre-push
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac5d310aee

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .husky/pre-commit
Add pre-commit and pre-push hooks for ui/goose2/ using the existing
Husky setup, replicating the checks that were previously run via
Lefthook in block/goose2.

Pre-commit (when staged files touch ui/goose2/):
- Biome auto-format and auto-fix with staged file re-add
- `just goose2 check` (biome check + file sizes + i18n + typecheck)

Pre-push (when pushed commits touch ui/goose2/):
- fmt-check, clippy, check, test, build, and tauri-check run in
  parallel via `just goose2 <recipe>` calls

Hook plumbing (ref-parsing, path-detection, parallel execution) is
extracted into reusable helper functions so the hook body reads as a
simple list of recipes. `just goose2 setup` now also activates the
hooks by setting core.hooksPath.

Signed-off-by: Matt Toohey <contact@matttoohey.com>

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The cargo clippy and cargo check commands fail without the release
binary present. Set TAURI_CONFIG to clear externalBin, matching the
dev config behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a4d063749

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .husky/pre-commit Outdated
Comment thread .husky/pre-commit Outdated
…iles

Add `set -e` so any command failure (e.g. lint-staged) aborts the hook
instead of being silently masked when the next `if` condition resets $?.

Scope biome format/check to only staged goose2 files instead of the
entire ui/goose2/ tree, preventing unintended rewrites of unstaged
work-in-progress during partial commits.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4170a56330

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .husky/pre-commit Outdated
Comment thread .husky/pre-push
matt2e and others added 3 commits April 21, 2026 14:55
The `cd ui/desktop && pnpm exec lint-staged` left the working directory
inside ui/desktop, causing the subsequent `[ -d "ui/goose2" ]` check to
evaluate false and silently skip all goose2 pre-commit checks whenever
both areas were staged together. Wrapping in a subshell keeps the
parent shell's cwd intact.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Without a shebang, Git runs hooks via /bin/sh on ENOEXEC. The pre-push
hook uses Bash-only syntax (local -a, [[ ]], arrays) that fails to
parse under POSIX sh, blocking all pushes. Add #!/usr/bin/env bash to
both hooks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Commits that delete ui/goose2/ files fed non-existent paths into
biome format/check via git diff --cached --name-only. With set -e
this aborted the hook and blocked valid deletion commits. Add
--diff-filter=ACMR to only pass files that still exist on disk.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 705b8eb02e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .husky/pre-commit Outdated
When STAGED_FILES is empty (deletion-only commits), xargs still runs
biome with no paths, which errors out and blocks the commit under
set -e. Guard the biome format/check/re-stage block behind a -n check,
and add || true to the grep so an empty match doesn't abort under
set -e before reaching the guard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e94160ae8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .husky/pre-commit Outdated
Comment thread .husky/pre-push Outdated
With diff.renames enabled (default since Git 2.9), git diff --name-only
reports only the destination path for renames. Files moved out of
ui/goose2/ or ui/desktop/ silently bypass the hook gate because the
source path is never shown. Add --no-renames so renames decompose into
delete + add, ensuring the source directory always appears in the output
and triggers the correct hook block.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@matt2e matt2e enabled auto-merge April 21, 2026 06:06
@matt2e matt2e added this pull request to the merge queue Apr 21, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5fc915392a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .husky/pre-commit
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve partial staging when re-adding goose2 files

Re-staging with git add on all goose2 paths will stage the entire file contents, not just the hunks the user originally staged. If a developer has partially staged a file under ui/goose2/ (common during split commits), this line will silently pull unstaged WIP edits into the commit after formatting/checks run, which can ship unintended code. This should use a stash/restore flow (like lint-staged) or another approach that keeps partial index state intact.

Useful? React with 👍 / 👎.

Merged via the queue into main with commit cbf893c Apr 21, 2026
23 checks passed
@matt2e matt2e deleted the git-hooks branch April 21, 2026 06:18
lifeizhou-ap added a commit that referenced this pull request Apr 21, 2026
* main:
  feat(hooks): add Husky git hooks for ui/goose2 (#8577)
  fix: links in chat could not be opened (#8544)
  fix: run setup before dev and dev-debug in goose2 justfile (#8718)
  Manage skills as sources over ACP (#8675)
  handle full node paths in goose2 kill recipe (#8709)
  overhaul provider inventory and agent/model selection (#8652)
  Remove unused import (#8676)
  delete the goose2 migration plan prompt (#8678)
  Add health score badge to README (#8677)
  feat(goose2): voice dictation via direct-ACP pattern (#8609)
  consistently use actions-rust-lang/setup-rust-toolchain (#8671)
  fix(developer): run shell tool under bash/sh regardless of login shell (#8659)
  refactor(providers): extract shared OAuth device-flow helper (#8619)
  Add a goose2 release workflow (#8629)
  chore(deps): bump ncipollo/release-action from 1.20.0 to 1.21.0 (#8664)
  docs: add blog post about Mesh LLM provider option (#8655)
  fix: append /chat/completions for prefixed v1 base URLs (#8521)
  Reset ChatGPT Codex auth during OAuth setup (#8569)
  chore(deps): bump EmbarkStudios/cargo-deny-action from 2.0.15 to 2.0.17 (#8665)
  Add dependabot config for pnpm workspace, cargo, and actions (#8660)
spikewang pushed a commit to spikewang/goose that referenced this pull request Apr 22, 2026
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lifeizhou-ap added a commit that referenced this pull request Apr 22, 2026
* main: (41 commits)
  removed the specific code owner for documentation change (#8749)
  fix(providers): handle missing delta field in streaming chunks (#8700)
  refactor(providers): extract http_status module and rename handle_status_openai_compat (#8620)
  fix(providers/openai): accept streaming chunks with both reasoning fields (#8715)
  feat: associate threads with projects (#8745)
  upgrade goose sdk and tui to be compatible with the latest agentclientprotocol/sdk package (#8667)
  feat: extend goose2 context window ux with auto-compaction (#8721)
  improve goose2 agent management flows (#8737)
  alexhancock/tui-improvements (#8736)
  fix: add strict:false to Responses API tools and gpt-5.4 to known models (#8636)
  persist and reliably apply chat model selection (#8734)
  merge goose-acp crate into goose (#8726)
  docs: AGENTS.md section on goose2 desktop backend architecture (#8732)
  feat: goose2 message bubble + action tray (#8720)
  consolidate provider ACP methods onto inventory (#8710)
  ci: declare and enforce MSRV of 1.91.1 (#8670)
  fix(ui): correct grammar in apps view description (#8668) (#8679)
  Stop load openai fast model for openapi compatible custom endpoint (#8644)
  feat(hooks): add Husky git hooks for ui/goose2 (#8577)
  fix: links in chat could not be opened (#8544)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants