Skip to content

chore: add dev loop hook scripts and remove completed design TODOs#44

Open
koenighotze wants to merge 15 commits into
mainfrom
feature/workflows-cleanup
Open

chore: add dev loop hook scripts and remove completed design TODOs#44
koenighotze wants to merge 15 commits into
mainfrom
feature/workflows-cleanup

Conversation

@koenighotze

Copy link
Copy Markdown
Owner

Summary

Hook scripts

Script Event Effect
guard-branch.sh PreToolUse on Edit/Write Blocks file edits when on main or master
test-on-edit.sh PostToolUse on Edit/Write Runs make test after every .go file edit
loop-reminder.sh Stop Injects next-step reminder into Claude's context at the end of each turn

The hooks are wired via .claude/settings.local.json (not committed — local override per developer).

Test plan

  • Checkout main, attempt a file edit — hook should block with "Create a feature branch first"
  • On a feature branch, edit a .go file — hook should run make test automatically
  • After Claude finishes a turn with uncommitted changes, next turn shows loop reminder in system context

🤖 Generated with Claude Code

koenighotze and others added 6 commits June 16, 2026 10:00
…ion header

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three Claude Code hooks enforce the branch→TDD→verify→PR→review loop:
- scripts/hooks/guard-branch.sh blocks edits on main/master
- scripts/hooks/test-on-edit.sh runs make test after every .go edit
- scripts/hooks/loop-reminder.sh injects next-step context at turn end

Remove the six design/TODO_*.md files that were already merged as PRs #36#41.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 16, 2026 09:06
@codacy-production

codacy-production Bot commented Jun 16, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage · +0.00% coverage variation

Metric Results
Coverage variation +0.00% coverage variation (-1.00%)
Diff coverage diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (7c79a9f) 183 180 98.36%
Head commit (9c91aa0) 183 (+0) 180 (+0) 98.36% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#44) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

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 local Claude Code hook scripts to encourage a branch→test→verify→PR→review development loop, cleans up shipped design TODO docs, and adjusts local tooling/CI configuration accordingly.

Changes:

  • Add three hook scripts under scripts/hooks/ (branch guard, test-on-edit, loop reminder).
  • Remove completed design/TODO_*.md documents that are already delivered via prior PRs.
  • Tweak local Make targets and refine CI workflow Go version wiring + govulncheck invocation.

Reviewed changes

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

Show a summary per file
File Description
scripts/hooks/test-on-edit.sh New PostToolUse hook to run make test after .go edits
scripts/hooks/loop-reminder.sh New Stop hook to inject “next step” reminders into context
scripts/hooks/guard-branch.sh New PreToolUse hook to block edits on main/master
Makefile Rename some targets to *.local and add local tooling install bits
design/TODO_07_Remove_dead_test_fixture.md Removed completed design TODO doc
design/TODO_06_Drop_log_Default.md Removed completed design TODO doc
design/TODO_05_Fix_repositoy_typo.md Removed completed design TODO doc
design/TODO_03_Use_io_Reader_in_config.md Removed completed design TODO doc
design/TODO_02_Remove_panic_for_expected_failures.md Removed completed design TODO doc
design/TODO_01_Fix_secret_error_message.md Removed completed design TODO doc
CLAUDE.md Minor header text cleanup
.gitignore Ignore .commit_msg_tmp
.github/workflows/build.yml Centralize Go version and switch security scan to govulncheck action

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

Comment thread scripts/hooks/guard-branch.sh
Comment thread scripts/hooks/test-on-edit.sh Outdated
Comment thread Makefile
Comment thread Makefile
Comment thread .github/workflows/build.yml
- .claude/commands/watch-pr.md: slash command that waits for CI checks,
  reads Copilot/reviewer feedback, fixes warranted issues, and re-pushes
  until the PR is green and review-addressed
- loop-reminder.sh: adds PR-open state — when CI/review is pending the
  hook now reminds to run /watch-pr instead of going silent
- guard-branch.sh + loop-reminder.sh: scope branch guard to main only
  (drop master check per project convention)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 16, 2026 09:17

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 14 changed files in this pull request and generated 7 comments.

Comment thread scripts/hooks/test-on-edit.sh Outdated
Comment thread scripts/hooks/guard-branch.sh Outdated
Comment thread scripts/hooks/loop-reminder.sh Outdated
Comment thread Makefile
Comment thread Makefile
Comment thread Makefile
Comment thread Makefile
koenighotze and others added 2 commits June 17, 2026 11:04
- guard-branch.sh: add exit 0 so allow path never exits non-zero; fix comment
- test-on-edit.sh: set -o pipefail preserves make exit code; guard cd against empty TOPLEVEL
- Makefile: add lint, install.tools, deps.vulncheck aliases for backwards compat
- .claude/commands/ship.md: new /ship command for full commit→PR→CI→review loop

Dismissed: master branch suggestions (deliberate choice), brew guard (.local suffix
signals macOS-only), duplicate setup-go in CI (needed by make get.dependencies).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- test-on-edit.sh: cd with || exit guard (SC2164)
- loop-reminder.sh: use grep -c instead of grep|wc -l (SC2126); quote @{u}.. refspec (SC1083)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 17, 2026 09:08

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 14 out of 15 changed files in this pull request and generated 5 comments.

Comment thread scripts/hooks/guard-branch.sh Outdated
Comment thread scripts/hooks/test-on-edit.sh
Comment thread scripts/hooks/loop-reminder.sh Outdated
Comment thread scripts/hooks/loop-reminder.sh
Comment thread Makefile
koenighotze and others added 2 commits June 17, 2026 11:22
Add blank lines around fenced code blocks (MD031) and before list items
(MD032) in ship.md and watch-pr.md to satisfy Codacy static analysis.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously the stop hook kept injecting /watch-pr on every turn even
after CI was fully green. Now it only fires if CI has failing, pending,
or action-required checks — stays silent once the PR is ready to merge.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 17, 2026 09:27

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 14 out of 15 changed files in this pull request and generated 8 comments.

Comment thread scripts/hooks/test-on-edit.sh
Comment thread scripts/hooks/test-on-edit.sh
Comment thread scripts/hooks/test-on-edit.sh Outdated
Comment thread scripts/hooks/guard-branch.sh Outdated
Comment thread scripts/hooks/guard-branch.sh Outdated
Comment thread scripts/hooks/loop-reminder.sh
Comment thread Makefile
Comment thread scripts/hooks/loop-reminder.sh Outdated
@koenighotze

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflict in Makefile (commit b5c0762). The only conflict was in Makefile — I kept the backward-compat alias targets (install.tools, lint, deps.vulncheck) from this branch while incorporating the changes from main. All tests pass.

- guard-branch.sh: add early exit when not in a git repo; extend
  branch check to cover both main and master
- test-on-edit.sh: add errexit + nounset to complement existing
  pipefail; use explicit exit 1 when cd fails
- loop-reminder.sh: extend branch check to cover master and
  interpolate the actual branch name into the reminder message

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 17, 2026 13:32
@koenighotze

Copy link
Copy Markdown
Owner Author

Copilot review follow-up

Commit 28c552e fixes:

  • guard-branch.sh — early exit when not in a git repo; extend branch check to main || master
  • test-on-edit.sh — add errexit + nounset to complement existing pipefail; exit 1 instead of bare exit on cd failure
  • loop-reminder.sh — extend branch check to main || master; interpolate actual branch name into message

Three findings are intentionally left open:

guard-branch.sh — strict mode (errexit/nounset) not added
The hook must be fault-tolerant: if jq fails the script must still exit 0 so edits are never blocked by a tooling error. The explicit exit 0 at the bottom already ensures the allow-path exits cleanly. Adding set -e would invert that guarantee.

test-on-edit.shmake test depends on get.dependencies / go mod tidy
The coupling lives in Makefile:44 (test: get.dependencies). Decoupling it affects CI, build, and test.all and is a separate refactoring concern. Changing the hook to bypass make would diverge from what developers and CI run.

Makefileinstall.tools.local uses brew install golangci-lint
The .local suffix is intentional: this target is macOS developer tooling only. CI installs golangci-lint via golangci-lint-action and never calls this target.

loop-reminder.shtimeout not available natively on macOS
If timeout is not installed, the command substitution returns empty, $PR_NUM is empty, and the elif block is silently skipped. No crash, no blocking — graceful degradation.

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 14 changed files in this pull request and generated 3 comments.

Comment thread scripts/hooks/test-on-edit.sh Outdated
Comment thread scripts/hooks/guard-branch.sh
Comment thread scripts/hooks/loop-reminder.sh
…hook

With set -o errexit active, a failing jq call (invalid stdin) or git
rev-parse (outside a repo) would terminate the hook immediately instead
of falling through to the existing guards. Add || exit 0 so failures
produce a clean no-op rather than an unexpected abort.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

3 participants