Skip to content

docs(#532): document force-push handoff pattern when pre-tool hook blocks - #563

Merged
admarble merged 1 commit into
mainfrom
feature/532-docs-document-force-push-handoff-pattern-when-
May 3, 2026
Merged

admarble merged 1 commit into
mainfrom
feature/532-docs-document-force-push-handoff-pattern-when-

Conversation

@admarble

@admarble admarble commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds .claude/skills/_shared/references/force-push.md documenting the user-handoff pattern when pre-tool.sh:106-111 blocks a force push. Adds a one-line pointer in CLAUDE.md so agents see the link.

What's covered

  • The !-prefix handoff pattern (present the command for the user to execute in-session)
  • Why bypass attempts fail (env-var read happens at harness level, before Bash subprocess)
  • Reference to pre-tool.sh:106-111
  • --force-with-lease over raw forced push, with rationale
  • Legitimate vs not-legitimate forced-push scenarios
  • The self-referential regex caveat — including a live demo: this commit's own message was initially blocked by the same regex when it contained the literal command strings

AC Coverage

AC Status
AC-1: Document the handoff pattern ✅ Met
AC-2: State that bypass is intentional / won't work ✅ Met
AC-3: Reference pre-tool.sh:106-111 ✅ Met
AC-4: Use --force-with-lease ✅ Met
AC-5: (Optional) Hook regex anchoring fix 🔄 Deferred to follow-up

AC-5 deferred per spec — that's a hook behavior change requiring regression tests for the four push variants. This PR is docs-only.

Test plan

  • Read both files end-to-end
  • npm run lint passes
  • npm run build passes
  • Verify CLAUDE.md link path resolves (relative path correct)

Verification of the documented pattern

This PR's commit + creation flow exercised the documented pattern itself:

  1. The commit message contained the literal strings that trip the regex → blocked by hook.
  2. Workaround applied per the new doc: write message to file, commit with git commit -F.
  3. Same applied to this PR body.

Self-referential evidence the pattern works.

Closes #532

…ocks

Adds .claude/skills/_shared/references/force-push.md describing the
!-prefix user-handoff pattern when pre-tool.sh:106-111 blocks a forced
push. Doc covers:

- The pattern: present the push command with --force-with-lease for the
  user to execute in-session via the ! prefix
- Why CLAUDE_HOOKS_DISABLED=true doesn't work (env-var read at
  harness level before Bash subprocess)
- Reference to pre-tool.sh:106-111 (the block definition)
- --force-with-lease over raw forced push (with rationale)
- Legitimate vs. not-legitimate forced-push scenarios
- The self-referential regex caveat (matches inside quoted bodies)

Adds a one-line pointer in CLAUDE.md under a new "Hooks" section so
agents see the link when CLAUDE.md is read.

AC-5 (regex anchoring fix) deferred to follow-up — that's a hook
behavior change requiring regression tests for the four push variants,
separate from this docs-only PR.

Note: this commit itself was initially blocked by the same regex when
the message contained the literal command strings — exactly the AC-5
caveat. Workaround applied per the new doc's pattern.
@admarble
admarble merged commit a337fbe into main May 3, 2026
5 checks passed
@admarble
admarble deleted the feature/532-docs-document-force-push-handoff-pattern-when- branch May 3, 2026 14:23
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.

docs: document force-push handoff pattern when pre-tool hook blocks

1 participant