From mach10
Runs a pre-merge checklist on a GitHub PR: checks branch freshness, updates documentation, version, CHANGELOG, and tests, then commits changes and presents a report.
How this command is triggered — by the user, by Claude, or both
Slash command
/mach10:pr-pre-merge <pr-number> [context]This command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# Pre-Merge Checklist You are running the pre-merge checklist for a PR that has passed review. Walk through each checklist item, perform the necessary updates, and commit the results. **User input:** $ARGUMENTS ## Step 0: Parse input and create task list The user's input contains: - A **PR number** (required) - Additional **context** or constraints (optional) Extract the PR number from the input. If the input is ambiguous, ask the user to clarify. If context was provided, note it for use in Step 5. After parsing input, create the progress-tracking task list. Create a task for Step 0 a...
You are running the pre-merge checklist for a PR that has passed review. Walk through each checklist item, perform the necessary updates, and commit the results.
User input: $ARGUMENTS
The user's input contains:
Extract the PR number from the input. If the input is ambiguous, ask the user to clarify. If context was provided, note it for use in Step 5.
After parsing input, create the progress-tracking task list. Create a task for Step 0 and immediately mark it in progress. Then create tasks for each of the remaining 7 steps one at a time, in step order, all starting as pending. Task list display order matches creation order, so each task must be a separate sequential call -- do not batch multiple task creations in a single message. Store each returned task ID for later use -- do not assume IDs are sequential.
| Task | Subject | activeForm |
|---|---|---|
| Step 0 | Step 0: Parse input and create task list | Parsing input |
| Step 1 | Step 1: Read contributing guidelines | Reading contributing guidelines |
| Step 2 | Step 2: Check out and prepare | Checking out PR branch |
| Step 3 | Step 3: Check branch freshness | Checking branch freshness |
| Step 4 | Step 4: Gather PR context | Gathering PR context |
| Step 5 | Step 5: Run pre-merge checklist | Running pre-merge checklist |
| Step 6 | Step 6: Commit checklist changes | Committing checklist changes |
| Step 7 | Step 7: Present pre-merge report | Presenting report |
Mark Step 0 complete.
Mark Step 1 in progress.
Look for project contribution guidelines in order of precedence:
CONTRIBUTING.md
DEVELOPMENT.md
.github/CONTRIBUTING.md
Read only the first file found; skip the rest.
If found, read the file and extract any pre-merge requirements (version bumps, changelog entries, documentation updates, test requirements, etc.).
If no contributing guide exists, use the standard checklist below.
Mark Step 1 complete.
Mark Step 2 in progress.
Ensure you are on the PR's branch with latest changes:
gh pr checkout <pr-number>
git pull
If either command fails (PR not found, authentication error, merge conflicts during pull), report the error to the user and stop -- the checklist cannot proceed without a clean, up-to-date working copy of the PR branch. Leave Step 2 as in_progress.
Mark Step 2 complete.
Mark Step 3 in progress.
Ensure the feature branch is up to date with the default branch before running the checklist.
Determine the default branch and fetch the latest remote state:
gh repo view --json defaultBranchRef --jq .defaultBranchRef.name
git fetch origin
If either command fails (authentication error, rate limit, network error), report the error to the user and stop -- the freshness check cannot proceed without knowing the default branch and having up-to-date remote state. Leave Step 3 as in_progress.
Count how many commits the branch is behind:
git rev-list --count HEAD..origin/<default-branch>
If the count is 0, the branch is current — continue to Step 4.
If the count is greater than 0, inform the user that the branch is N commits behind origin/<default-branch>, then use AskUserQuestion to ask how to proceed:
If the user selects Cancel, stop the session. Leave Step 3 as in_progress.
If the user selects Skip, note the skipped status for the report and continue to Step 4.
If the user selects Merge, run:
git merge origin/<default-branch>
If the merge succeeds cleanly, push the merge commit (git push). If the push fails, report the error to the user and stop — do not continue the checklist with an unpushed merge commit. Advise the user they can retry with git push, or undo the merge with git reset --hard HEAD~1. Leave Step 3 as in_progress. On success, continue to Step 4.
If the merge has conflicts, check whether all conflicted files are on the version-file allowlist: plugin.json, package.json, pyproject.toml, setup.cfg, Cargo.toml, build.gradle. Only files on this allowlist are eligible for auto-resolution.
git checkout --theirs <file> then git add <file>), then finalize the merge with git commit --no-edit. Push the result (git push). If the push fails, report the error and stop — advise the user they can retry with git push, or undo the merge with git reset --hard HEAD~1. Leave Step 3 as in_progress. Record which files were auto-resolved for the report.git merge --abort. Report the list of conflicted files to the user and stop the session — the user must resolve conflicts manually. Leave Step 3 as in_progress.If the merge fails for any reason other than conflicts (invalid ref, dirty working tree, internal error), report the full error output to the user and stop. Leave Step 3 as in_progress.
Mark Step 3 complete.
Mark Step 4 in progress.
Build a picture of what the PR changed so the checklist in Step 5 can make informed decisions:
gh pr diff <pr-number> --name-only and git diff origin/<default-branch>...HEAD --statgh pr view <pr-number>git log origin/<default-branch>..HEAD --onelineFrom these, identify what features, APIs, behaviors, or configurations were added, changed, or removed. Produce a brief change summary covering:
This summary provides the foundation for the documentation, version bump, CHANGELOG, and test items in Step 5.
Mark Step 4 complete.
Mark Step 5 in progress.
If the user provided context, honor it as guidance for this checklist:
Per-item confirmation gates inside a section that runs (e.g., the bump-level AskUserQuestion in 5b) remain authoritative -- context can skip the whole section, but it cannot pre-answer the gates inside a section that is executing.
Using the PR context gathered in Step 4, work through each item. For each, report whether action is needed and perform it if so.
AskUserQuestion to ask:
Run the project's test suite:
# Auto-detect test runner
# Python: pytest, unittest
# JavaScript: npm test, jest
# etc.
Report results. If tests fail, investigate and report — do NOT silently ignore failures.
Mark Step 5 complete.
Mark Step 6 in progress.
Check whether the checklist produced any uncommitted changes by running git status --porcelain. If the output is empty, no changes were made — mark Step 6 complete and proceed to Step 7.
If there are changes, commit and push them:
git add <file>...). If staging fails, report the error to the user, leave Step 6 as in_progress, and proceed to Step 7.in_progress, and proceed to Step 7.git push). If the push fails, report the error to the user and advise them to retry manually with git push. Leave Step 6 as in_progress and proceed to Step 7.If all three operations succeeded, mark Step 6 complete.
Mark Step 7 in progress.
Present a summary of what was done:
Recommend next step: /clear then /mach10:pr-merge <pr-number>
Mark Step 7 complete.
npx claudepluginhub leanandmean/mach10 --plugin mach10/git-workflowOrchestrates git workflow from code review and quality gates through commit, push, and PR creation to target branch. Supports flags: --skip-tests, --draft-pr, --no-push, --squash, --conventional, --trunk-based.
/self-reviewSelf-reviews a GitHub PR via <PR_URL>: checks CI status, merge conflicts, diff noise, description consistency, commits, reviewability; identifies issues and suggests fixes.
/prCreates a pull request from the current feature branch using GitHub CLI, with auto-generated title, summary, and testing notes based on project conventions. Supports draft, manual confirmation, and rebase options.
/prepare-prPrepares PR end-to-end: updates docs/README/tests, runs quality gates/linting/tests, dogfooding checks, workspace validation, and code review. Supports --no-code-review, --reviewer-scope, --skip-updates flags.
/finishCreates a pull request with comprehensive description following repo best practices, loading config, verifying git state, summarizing changes, gathering user input, pushing branch, and opening PR.
/commit-push-prCommits staged changes after build/test/lint/security verification, pushes branch, creates PR, optionally merges (merge/squash/rebase), and notifies. Supports flags like --draft, --no-verify, --skip-security.