| name | jira-close-merged |
| description | Marks Jira tickets as Done when their commits have been merged into the current branch. Use whenever the user wants to sync Jira with merged commits — e.g. "mark done", "close tickets from commits", "sync Jira with merged PRs", "any Jira tickets to close?", or after a batch of PRs lands. Works with any Jira project key.
|
Jira: Close Merged Tickets
Scans the git log for Jira ticket IDs, checks their current status, and
transitions any non-Done tickets to Done. For unassigned tickets, also
assigns them to the author of the most recent commit that referenced the
ticket.
Steps
1. Collect ticket IDs and commit authors
Run the following, substituting the project key(s) the user specifies (or
ask if unclear):
git log --format='%ae|%s' -50
Adjust the commit depth (default 50) to match the user's context. If the
user says "last 100 commits" or names a specific release tag, use that
range instead.
Parse each line as author_email|subject. Git log is newest-first, so the
first line mentioning a ticket ID is the most recent commit for that
ticket — record that line's author_email as the ticket's commit author.
Extract ticket IDs with the pattern [A-Z]+-\d+. If the user specifies a
project key like PROJ, only keep IDs matching \bPROJ-\d+\b. Build:
- a unique list of ticket IDs to process
- a map of
ticket_id → author_email (most recent commit author per ticket)
2. Look up Jira status
Use searchJiraIssuesUsingJql with a query like:
issueKey in (PROJECT-1, PROJECT-2, ...)
Request only summary, , and fields to keep the
response small. Use to resolve the
cloud ID if you don't already have it in context.