diff --git a/git/.claude-plugin/plugin.json b/git/.claude-plugin/plugin.json index a79fbb7..c1e2353 100644 --- a/git/.claude-plugin/plugin.json +++ b/git/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "git", - "version": "1.2.0", + "version": "1.3.0", "description": "Dynamic git instructions via SessionStart hook with mainline detection, conventional commits, fork handling, and safety guardrails", "author": { "name": "cblecker", diff --git a/git/CLAUDE.md b/git/CLAUDE.md index 91c20f3..7dd9f92 100644 --- a/git/CLAUDE.md +++ b/git/CLAUDE.md @@ -76,6 +76,7 @@ contextually. - Claude Code attribution line removed from PR body template - Assisted-by trailer used instead of Co-Authored-By (follows Linux kernel AI attribution standard) - Signed-off-by safety rule added (AI must never add DCO sign-off) +- "NEVER commit directly to mainline" safety rule added (upstream has no equivalent) ## Maintenance diff --git a/git/scripts/git-instructions.sh b/git/scripts/git-instructions.sh index 09b1fcf..cfd345b 100755 --- a/git/scripts/git-instructions.sh +++ b/git/scripts/git-instructions.sh @@ -170,6 +170,8 @@ IMPORTANT: If you can see duplicate git instructions in your context (e.g. both Only create commits when requested by the user. If unclear, ask first. When the user asks you to create a new git commit, follow these steps carefully: +You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. The numbered steps below indicate which commands should be batched in parallel. + Git Safety Protocol: - NEVER update the git config - NEVER run destructive git commands (push --force, reset --hard, checkout ., restore ., clean -f, branch -D) unless the user explicitly requests these actions. Taking unauthorized destructive actions is unhelpful and can result in lost work, so it's best to ONLY run these commands when given direct instructions @@ -181,7 +183,7 @@ Git Safety Protocol: - NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive - NEVER add Signed-off-by tags to commits. If asked to do so, abort the request and let the user know. Only humans can certify the Developer Certificate of Origin (DCO). The human submitter is responsible for adding their own Signed-off-by tag. -1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel, each using the Bash tool: +1. Run the following bash commands in parallel, each using the Bash tool: - Run a git status command to see all untracked files. IMPORTANT: Never use the -uall flag as it can cause memory issues on large repos. - Run a git diff command to see both staged and unstaged changes that will be committed. - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style. @@ -190,7 +192,7 @@ Git Safety Protocol: - Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files - Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what" - Ensure it accurately reflects the changes and their purpose -3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands: +3. Run the following commands in parallel: - Add relevant untracked files to the staging area. - Create the commit with a message ending with the Assisted-by trailer, in the format \`Assisted-by: Claude:\` where you substitute your actual model identifier (e.g. claude-opus-4-6). - Run git status after the commit completes to verify success. @@ -199,7 +201,7 @@ Git Safety Protocol: Important notes: - NEVER run additional commands to read or explore code, besides git bash commands -- NEVER use the TodoWrite or Agent tools +- NEVER use the TaskCreate, TaskUpdate, or Agent tools - DO NOT push to the remote repository unless the user explicitly asks you to do so - IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported. - IMPORTANT: Do not use --no-edit with git rebase commands, as the --no-edit flag is not a valid option for git rebase. @@ -219,7 +221,7 @@ ${CONVENTIONAL_SECTION} IMPORTANT: When the user asks you to create a pull request, follow these steps carefully: -1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from ${MAINLINE}: +1. Run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from ${MAINLINE}: - Run a git status command to see all untracked files (never use -uall flag) - Run a git diff command to see both staged and unstaged changes that will be committed - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote @@ -227,7 +229,7 @@ IMPORTANT: When the user asks you to create a pull request, follow these steps c 2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request title and summary: - Keep the PR title short (under 70 characters) - Use the description/body for details, not the title -3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands in parallel: +3. Run the following commands in parallel: - Create new branch if needed (if on ${MAINLINE}, create a feature branch first) - Push to remote with -u flag if needed - Create PR using GitHub MCP tools (mcp__plugin_github_github__create_pull_request) with: owner, repo, title, head, base (${MAINLINE}), body @@ -241,7 +243,7 @@ IMPORTANT: When the user asks you to create a pull request, follow these steps c Important: -- DO NOT use the TodoWrite or Agent tools +- DO NOT use the TaskCreate, TaskUpdate, or Agent tools - Return the PR URL when you're done, so the user can see it ${FORK_SECTION} # Branch workflow