From 48e35eab660837cdbd6db3de7d0c338e923dce96 Mon Sep 17 00:00:00 2001 From: JacobPEvans <20714140+JacobPEvans@users.noreply.github.com> Date: Sun, 29 Mar 2026 13:20:05 -0400 Subject: [PATCH 1/3] fix(git-guards): replace 'branch' with 'worktree' in error messages Claude interprets 'main branch' literally and creates a git branch instead of a worktree. Use 'main worktree' consistently in all user-facing error messages. (claude) --- git-guards/scripts/main-branch-guard.py | 6 +++--- git-guards/scripts/main-branch-guard.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/git-guards/scripts/main-branch-guard.py b/git-guards/scripts/main-branch-guard.py index 0bb334d..dbe55ea 100755 --- a/git-guards/scripts/main-branch-guard.py +++ b/git-guards/scripts/main-branch-guard.py @@ -99,15 +99,15 @@ def main() -> None: if worktree_root and Path(worktree_root).name == "main": deny( f"BLOCKED: File '{file_path}' is in the main worktree. " - "Editing files on the main branch is not allowed.\n\n" + "Editing files in the main worktree is not allowed.\n\n" "Create a worktree using `/superpowers:using-git-worktrees`.", ) current_branch = get_current_branch(file_path) if current_branch == "main": deny( - f"BLOCKED: Current branch is 'main'. " - "Editing files on the main branch is not allowed.\n\n" + "BLOCKED: You are in the main worktree. " + "Editing files in the main worktree is not allowed.\n\n" "Create a worktree using `/superpowers:using-git-worktrees`.", ) diff --git a/git-guards/scripts/main-branch-guard.sh b/git-guards/scripts/main-branch-guard.sh index be4dc62..0bc6b23 100755 --- a/git-guards/scripts/main-branch-guard.sh +++ b/git-guards/scripts/main-branch-guard.sh @@ -34,7 +34,7 @@ if [[ -n "$worktree_root" ]] && [[ "$(basename "$worktree_root")" == "main" ]]; hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", - permissionDecisionReason: ("BLOCKED: File '\''\($path)'\'' is in the main worktree. Editing files on the main branch is not allowed.\n\nCreate a worktree using `/superpowers:using-git-worktrees`.") + permissionDecisionReason: ("BLOCKED: File '\''\($path)'\'' is in the main worktree. Editing files in the main worktree is not allowed.\n\nCreate a worktree using `/superpowers:using-git-worktrees`.") } }' >&2 exit 2 @@ -48,7 +48,7 @@ if [[ "$current_branch" == "main" ]]; then hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", - permissionDecisionReason: ("BLOCKED: Current branch is '\''main'\''. Editing files on the main branch is not allowed.\n\nCreate a worktree using `/superpowers:using-git-worktrees`.") + permissionDecisionReason: ("BLOCKED: You are in the main worktree. Editing files in the main worktree is not allowed.\n\nCreate a worktree using `/superpowers:using-git-worktrees`.") } }' >&2 exit 2 From af5c09d0700a12567ce6388794f43053b8513cd4 Mon Sep 17 00:00:00 2001 From: JacobPEvans <20714140+JacobPEvans@users.noreply.github.com> Date: Sun, 29 Mar 2026 13:27:43 -0400 Subject: [PATCH 2/3] fix(git-guards): include file path in fallback error message Add file path to the branch-name fallback check for consistency with the worktree directory check. Both error messages now show the blocked file. (claude) --- git-guards/scripts/main-branch-guard.py | 2 +- git-guards/scripts/main-branch-guard.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/git-guards/scripts/main-branch-guard.py b/git-guards/scripts/main-branch-guard.py index dbe55ea..6ef542b 100755 --- a/git-guards/scripts/main-branch-guard.py +++ b/git-guards/scripts/main-branch-guard.py @@ -106,7 +106,7 @@ def main() -> None: current_branch = get_current_branch(file_path) if current_branch == "main": deny( - "BLOCKED: You are in the main worktree. " + f"BLOCKED: File '{file_path}' is in the main worktree. " "Editing files in the main worktree is not allowed.\n\n" "Create a worktree using `/superpowers:using-git-worktrees`.", ) diff --git a/git-guards/scripts/main-branch-guard.sh b/git-guards/scripts/main-branch-guard.sh index 0bc6b23..7e30761 100755 --- a/git-guards/scripts/main-branch-guard.sh +++ b/git-guards/scripts/main-branch-guard.sh @@ -48,7 +48,7 @@ if [[ "$current_branch" == "main" ]]; then hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", - permissionDecisionReason: ("BLOCKED: You are in the main worktree. Editing files in the main worktree is not allowed.\n\nCreate a worktree using `/superpowers:using-git-worktrees`.") + permissionDecisionReason: ("BLOCKED: File '\''\($path)'\'' is in the main worktree. Editing files in the main worktree is not allowed.\n\nCreate a worktree using `/superpowers:using-git-worktrees`.") } }' >&2 exit 2 From e9910faaf51910dc094d1acbded4a0fa6a296972 Mon Sep 17 00:00:00 2001 From: JacobPEvans <20714140+JacobPEvans@users.noreply.github.com> Date: Sun, 29 Mar 2026 13:33:37 -0400 Subject: [PATCH 3/3] chore: trigger CodeQL scan (claude)