Repository navigation
fix(hook): scope enforce_gh_english to this repository - #404
Merged
Merged
Conversation
The same machine hosts a sibling repo (ycpss91255/worktool) whose issues and PRs are written in zh-TW, and its `gh --repo <other>` calls run from this repo's cwd, so this PreToolUse Bash hook fired on them and denied their CJK bodies. The English-only rule is this repository's rule, not the host's. The hook now allows early when a `gh issue|pr create|comment` command demonstrably targets another repository: an explicit --repo / -R / --repo= naming a repo other than this one (owner/name, host/owner/name, URL, .git and quoted forms normalised, case-insensitive), else $GH_REPO, else the origin of the directory the command runs in (`cd <dir> &&`, payload .cwd, or $PWD). "This repo" is derived from the checkout's `git remote get-url origin` with a literal ycpss91255/initialization fallback. An undeterminable target keeps the guard; behaviour for this repo is unchanged; settings.json untouched. Tests: six new cases in test/unit/hook/enforce_gh_english_spec.bats (RED before the change, GREEN after). CHANGELOG entry under [Unreleased] / Fixed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NX5H2vuMTv4mBmjpPYoS3s
ycpss91255
enabled auto-merge (squash)
September 19, 2026 10:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scope the
enforce_gh_english.shPreToolUse hook to this repository..agents/hook/enforce_gh_english.shnow allows early when agh issue|pr create|commentcommand demonstrably targets another repository:--repo <ref>/-R <ref>/--repo=<ref>naming a repo other than this one (owner/name, host/owner/name, https/ssh URL,git@host:owner/name, optional.gitand quotes are normalised to lower-caseowner/name), else$GH_REPO, elsecd <dir> &&, the payload's.cwd, or$PWD) resolving to another repo."This repo" is derived from the checkout's
git remote get-url origin(a linked worktree shares it), with a literalycpss91255/initializationfallback when origin is unreadable. An undeterminable target keeps the guard (conservative), and behaviour for this repo is unchanged..claude/settings.jsonis untouched.Why
The same machine now hosts a second repo (
ycpss91255/worktool) whose issues and PRs are written in zh-TW, and itsgh --repo ycpss91255/worktool ...commands run from this repo's cwd, so this repo's PreToolUse Bash hooks fire on them and the English-only hook denied their CJK bodies. The English-only rule is this repository's rule, not the host's.Test plan
TDD: six cases were added to
test/unit/hook/enforce_gh_english_spec.batsfirst and run in Docker against the unchanged hook (RED), then the scoping was implemented (GREEN).RED (before the change):
GREEN (after the change):
Gates (Docker):
just -f justfile.ci lintjust -f justfile.ci test-unitjust -f justfile.ci linttail:just -f justfile.ci test-unittail (full unit tree, 1..7499, 7499 ok, 0 not ok):