From b0158e4b023824f972c0175b0c10c2f7004e6db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?deniz=20g=C3=B6k=C3=A7in?= <33603535+dgokcin@users.noreply.github.com> Date: Mon, 5 Oct 2026 09:50:02 +0200 Subject: [PATCH] chore(claude): remove require-jira-key hook - delete require-jira-key.sh script and its symlink in claude.mk - drop hook entry from settings.json - remove JIRA_SKIP handling from create-pr skill - restrict log-work skill to explicit user requests --- ai-stuff/claude/scripts/require-jira-key.sh | 18 ------------------ ai-stuff/claude/settings.json | 4 ---- ai-stuff/skills/create-pr/SKILL.md | 3 +-- ai-stuff/skills/log-work/SKILL.md | 6 +++--- makefiles/claude.mk | 1 - 5 files changed, 4 insertions(+), 28 deletions(-) delete mode 100755 ai-stuff/claude/scripts/require-jira-key.sh diff --git a/ai-stuff/claude/scripts/require-jira-key.sh b/ai-stuff/claude/scripts/require-jira-key.sh deleted file mode 100755 index e6eb3ce5..00000000 --- a/ai-stuff/claude/scripts/require-jira-key.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -# PreToolUse(Bash): block PR/MR creation until the branch or title carries a Jira key. - -input=$(cat) -cmd=$(jq -r '.tool_input.command // ""' <<<"$input") -cwd=$(jq -r '.cwd // "."' <<<"$input") - -pr_re='(gh pr create|glab mr create)' -key_re='[A-Z][A-Z0-9]+-[0-9]+' - -[[ $cmd =~ $pr_re ]] || exit 0 -[[ $cmd == *JIRA_SKIP=1* ]] && exit 0 - -branch=$(git -C "$cwd" branch --show-current 2>/dev/null) -[[ "$branch $cmd" =~ $key_re ]] && exit 0 - -echo "No Jira key on branch '$branch' or in the PR title. Call the Skill tool with \"log-work\", then retry with the key it returns at the start of the PR title, or prefix the command with JIRA_SKIP=1 if it returns that." >&2 -exit 2 diff --git a/ai-stuff/claude/settings.json b/ai-stuff/claude/settings.json index de209d37..1116fa99 100644 --- a/ai-stuff/claude/settings.json +++ b/ai-stuff/claude/settings.json @@ -142,10 +142,6 @@ { "type": "command", "command": "rtk hook claude" - }, - { - "type": "command", - "command": "~/.claude/scripts/require-jira-key.sh" } ] } diff --git a/ai-stuff/skills/create-pr/SKILL.md b/ai-stuff/skills/create-pr/SKILL.md index 82c78a24..4b476aa3 100644 --- a/ai-stuff/skills/create-pr/SKILL.md +++ b/ai-stuff/skills/create-pr/SKILL.md @@ -135,7 +135,7 @@ Create a PR/MR with optional VCS hint to skip detection. Permission system handl 7. Extract ticket from branch name if present (e.g., `feature/DEVX-123-something`) 8. Craft title: - If Jira ticket found: `DEVX-123: Title here` (normal sentence casing!) - - If no ticket: Use conventional commit format: `feat|fix|docs|refactor|...: Title here`, and prefix the create command with `JIRA_SKIP=1` (`JIRA_SKIP=1 gh pr create ...` or `JIRA_SKIP=1 glab mr create ...`) so the require-jira-key hook lets it through. Never stop or call `log-work` because a key is missing. + - If no ticket: Use conventional commit format: `feat|fix|docs|refactor|...: Title here` 9. Build body with mandatory sections: Summary, Changes, Additional Notes 10. For GitHub: Push branch with `git push -u origin HEAD` before PR creation (handles both worktree and main repo) 11. Execute the pr/mr create command (permission system prompts user) @@ -147,7 +147,6 @@ Create a PR/MR with optional VCS hint to skip detection. Permission system handl - If in worktree: Check whether commits need to sync to main repo first (cherry-pick or reset target branch) - If PR/MR exists: Use `gh pr edit` or `glab mr update` to update title and description - If no PR/MR: Use `gh pr create` or `glab mr create` to create new -- **No Jira key**: prefix the create command with `JIRA_SKIP=1`. If the hook still blocks it, retry once with the prefix, never fail the PR over a missing key - **GitHub**: Push branch first with `git push -u origin HEAD` before creating PR (works in both worktree and main) - **GitLab**: Push handled by `glab mr create --push` (works in both worktree and main) - Permission system will prompt user for confirmation diff --git a/ai-stuff/skills/log-work/SKILL.md b/ai-stuff/skills/log-work/SKILL.md index 89bfac28..93fe604d 100644 --- a/ai-stuff/skills/log-work/SKILL.md +++ b/ai-stuff/skills/log-work/SKILL.md @@ -1,6 +1,6 @@ --- name: log-work -description: Create a DEVX story for work already done on the current branch, written as a to-do, and move it to Code Review. Use when a PR or MR has no Jira key, a hook asks for one, or the user says "log this work" or "make a ticket for what I did". +description: Create a DEVX story for work already done on the current branch, written as a to-do, and move it to Code Review. Use only when the user explicitly says "log this work" or "make a ticket for what I did". Never invoke it from create-pr. allowed-tools: Bash(git log:*), Bash(git diff:*), Bash(git branch:*), AskUserQuestion, mcp__claude_ai_Atlassian_MCP__createJiraIssue, mcp__claude_ai_Atlassian_MCP__transitionJiraIssue, Read --- @@ -20,11 +20,11 @@ Read [jira config](../_shared/config/jira-config.md). Never call lookup APIs. 3. Call `AskUserQuestion` before creating anything. Put the drafted summary and reason in the question text, header `Jira`, with these options: - **Create story (Recommended)**: create it as drafted - **Use existing ticket**: the user types the key via "Other" - - **Skip ticket**: open the PR without a Jira key + - **Skip ticket**: don't create anything 4. Act on the answer: - **Create story**: continue to step 5. If the user typed edits via "Other", apply them first. - **Use existing ticket**: reply with that key and stop. - - **Skip ticket**: reply `JIRA_SKIP=1` and stop. The caller prefixes the PR command with it (`JIRA_SKIP=1 gh pr create ...`) so the hook lets it through. + - **Skip ticket**: stop. 5. Call `createJiraIssue`: - cloudId `56552dac-b6cf-4e59-aa06-5e075dca9f8e`, projectKey `DEVX`, issueTypeName `Story` - assignee `currentUserAccountId` from the config diff --git a/makefiles/claude.mk b/makefiles/claude.mk index bea13e9a..1c92aeb7 100644 --- a/makefiles/claude.mk +++ b/makefiles/claude.mk @@ -58,7 +58,6 @@ claude-scripts: claude-dirs ## Symlink Claude Code scripts (statusline, hooks, e $(call symlink,ai-stuff/claude/scripts/session-start.sh,${CLAUDE_HOME}/scripts/session-start.sh) $(call symlink,ai-stuff/_shared/scripts/auto-approve-tools.sh,${CLAUDE_HOME}/scripts/auto-approve-tools.sh) $(call symlink,ai-stuff/claude/scripts/notify.sh,${CLAUDE_HOME}/scripts/notify.sh) - $(call symlink,ai-stuff/claude/scripts/require-jira-key.sh,${CLAUDE_HOME}/scripts/require-jira-key.sh) $(call symlink,ai-stuff/_shared/scripts/focus-iterm.applescript,${CLAUDE_HOME}/scripts/focus-iterm.applescript) @chmod +x ${CLAUDE_HOME}/scripts/*.sh