Skip to content

feat: add PR stop hooks and watch baselines - #40

Merged
roderik merged 5 commits into
mainfrom
feat/stop-hook-and-watch-baseline
Apr 1, 2026
Merged

feat: add PR stop hooks and watch baselines#40
roderik merged 5 commits into
mainfrom
feat/stop-hook-and-watch-baseline

Conversation

@roderik

@roderik roderik commented Apr 1, 2026

Copy link
Copy Markdown
Owner

Why

  • prevent agents from stopping on branches with open PRs that are not merge-ready
  • make watch mode return on newly actionable CI/review work instead of timing out on long-running healthy cycles

How

  • install Bellwether Stop hooks for Claude Code and Codex and teach hooks check to run bellwether check <pr> non-interactively for the current branch PR
  • keep stop-hook execution loop-safe with stop_hook_active, preserve the existing PostToolUse reminder flow, and update the bundled hook config/docs
  • add installer coverage plus stop-hook tests, and include the watch-baseline/readiness updates already present in this worktree

Tests

  • npm test -- test/commands/hook-check.test.ts test/commands/hook-add.test.ts test/commands/check.test.ts
  • npm run check
  • npm run build

Copilot AI review requested due to automatic review settings April 1, 2026 05:41
@pkg-pr-new

pkg-pr-new Bot commented Apr 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/bellwether@40

commit: 5ae0a48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Stop-event hook support to prevent agents from stopping on non–merge-ready PR branches, and refines check --watch to wait for new actionable changes (with an inactivity-based timeout) rather than timing out during healthy CI cycles.

Changes:

  • Extend hooks check to handle Stop events by resolving the current branch PR and running bellwether check <pr> --format json non-interactively.
  • Update hook installer to install both PostToolUse and Stop hooks for Claude Code and Codex without duplicating entries.
  • Adjust check --watch to track a baseline and reset inactivity timeouts on meaningful state changes (e.g., new head SHA / CI progress / new actionable reviews).

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/commands/hook-check.test.ts Adds mocking + test cases for Stop hook behavior and non-interactive bellwether check execution.
test/commands/hook-add.test.ts Adds installer test coverage to ensure hooks are installed/cleaned properly for Claude and Codex.
test/commands/check.test.ts Adds a regression test ensuring watch inactivity timeout resets on new CI cycle (new head SHA).
src/commands/hook-check.ts Implements Stop hook handling via PR resolution + spawnSync check; expands output schema.
src/commands/hook-add.ts Installs Stop hooks, de-duplicates bellwether entries, and refactors hook group construction.
src/commands/check.ts Introduces baseline/snapshot tracking for watch mode and redefines “actionable reviews” behavior.
hooks/hooks.json Bundles a default Stop hook config entry.
README.md Documents new Stop hook behavior and updated check --watch semantics.
.agents/skills/para-memory-files Adds a local absolute-path skill reference (likely unintended for repo).
.agents/skills/paperclip-create-plugin Adds a local absolute-path skill reference (likely unintended for repo).
.agents/skills/paperclip-create-agent Adds a local absolute-path skill reference (likely unintended for repo).
.agents/skills/paperclip Adds a local absolute-path skill reference (likely unintended for repo).
.agents/skills/bellwether-hook-add--2d3a0cd890 Adds a local absolute-path skill reference (likely unintended for repo).
Comments suppressed due to low confidence (1)

.agents/skills/para-memory-files:1

  • These newly added .agents/skills/* files contain machine-specific absolute paths (including a username/home directory). This will break for other developers/CI and may leak local environment details. Recommend removing these files from the repo (and adding an ignore rule for .agents/skills/* if they’re generated), or replacing contents with repo-relative/configurable paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/commands/hook-check.ts Outdated
Comment thread src/commands/hook-check.ts Outdated
Comment thread src/commands/check.ts
Comment thread src/commands/check.ts Outdated
Copilot AI review requested due to automatic review settings April 1, 2026 07:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

.agents/skills/para-memory-files:1

  • This commits an absolute, machine-specific local path (including username/home directory and transient npx cache folder). That’s both non-portable and potentially sensitive metadata leakage. These .agents/skills/* path-pointer files should generally be removed from the repo and added to .gitignore (or replaced with repository-relative, reproducible references if they are intended to be shared).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/commands/hook-check.ts
Comment thread src/commands/hook-check.ts
@roderik
roderik merged commit 1ff51fe into main Apr 1, 2026
6 checks passed
@roderik
roderik deleted the feat/stop-hook-and-watch-baseline branch April 1, 2026 07:28
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