| name | codemie-mr |
| description | Manages git commits with Jira tickets (EPMCDME-xxx format), pushes, and GitLab MR creation. Use when user says "commit changes", "push changes", "create MR", "make merge request", or similar GitLab workflow requests. Enforces Jira ticket format in commits. |
GitLab Merge Request Workflow
Instructions
1. Check Current State
Always start by checking git status:
git branch --show-current
git status --short
glab mr list --source-branch=$(git branch --show-current) 2>/dev/null || echo "No MR"
1b. Check for Code Review Spec
After checking git state, look for a code review spec for this branch/ticket.
Extract ticket from current branch name (pattern EPMCDME-XXXXX).
Try to read the spec:
Read: .codemie/reviews/<TICKET>/review.md
# Fallback (if no ticket found):
Read: .codemie/reviews/<branch-name>/review.md
If spec is found → extract for MR description:
- Issues found: count of
- [ ] + - [x] + - [~] under CRITICAL and MAJOR
- Issues fixed: count of
- [x] items
- Issues rejected: count of
- [~] items with justifications
- Clean: if no issues were found at all
Keep this data — it will be injected into the MR description in Step 4.
2. Validate Jira Ticket (Required for Commits)
Before any commit, verify Jira ticket exists in context:
- Look for
EPMCDME-xxx pattern in conversation history
- Check if user provided ticket number
- If no ticket found: Ask user: "What is the Jira ticket number (EPMCDME-xxx)?"
Do NOT proceed with commit without Jira ticket.
3. Handle Based on User Request
"commit changes" → Commit only (requires Jira ticket):
git add .
git commit -m "EPMCDME-xxx: Action and message"
"push changes" → Push only:
git push --set-upstream origin $(git branch --show-current)
"create MR" → Full workflow below.
4. Create MR Workflow
If on main branch:
- Create feature branch first:
git checkout -b <type>/<description>
- Then proceed with commit/push/MR
If MR already exists:
git push --set-upstream origin $(git branch --show-current)
If no MR exists:
git push --set-upstream origin $(git branch --show-current)
Build the MR title from the Jira ticket and a concise description of the work done (read commit history since main if needed to understand what was implemented):
git log main..HEAD --oneline
Title rules:
- Pattern:
EPMCDME-xxx: <Short description starting with capital letter>
- Max ~70 characters
- Describe the feature/fix, not the process ("Add SharePoint datasource support", not "Implement EPMCDME-123")
Build the description — always include Summary and Changes. If a code review spec was found in Step 1b, include the Code Review section:
glab mr create \
--title "EPMCDME-xxx: <Short feature description>" \
--description "## Summary
[2-4 sentence overview of what was implemented and why]
## Changes
- [Key change 1]
- [Key change 2]
## Code Review
<!-- Include ONLY if review spec was found in Step 1b -->
AI code review completed (AI-Code-Review marker in commit history).
- Issues found: <N critical, N major> / No issues found (clean)
- Issues fixed: <N> / N/A
- Issues rejected: <N with justification> / N/A
:white_check_mark: Reviewed and approved by AI Code Reviewer
## Checklist
- [ ] Self-reviewed
- [ ] Manual testing performed
- [ ] Documentation updated (if needed)
- [ ] No breaking changes (or documented)"
If no review spec was found → omit the ## Code Review section entirely from the description.
After MR is created, immediately approve it using the MR IID returned by glab mr create:
glab mr approve <MR_IID>
This adds the AI reviewer's +1 to the MR. If glab mr approve fails (e.g., self-approval not allowed on this GitLab instance), inform the user but do not treat it as a blocking error.
After the MR is created, hand off to the babysit-mr skill to monitor it:
- Invoke
babysit-mr with the MR URL returned by glab mr create
- It will watch for CI failures, reviewer comments, and merge conflicts, fixing them autonomously until the MR merges
Commit Format
Enforced by Tekton CI — invalid messages will block the pipeline.
Regex: ^((EPMCDME)-(?!0+)\d+:\s[A-Z][a-z]*.*|Generate release notes for version \d+\.\d+\.\d+|Revert "(EPMCDME|AMNAAIRN)-(?!0+)\d+:\s[A-Z][a-z]*.*")$
Required Pattern: EPMCDME-xxx: Capital sentence (description must start with uppercase letter)
Valid examples:
git commit -m "EPMCDME-123: Add new documentation"
git commit -m "EPMCDME-456: Fix authentication bug"
git commit -m "Generate release notes for version 1.2.3"
git commit -m "Revert \"EPMCDME-123: Fix authentication bug\""
Invalid (will be rejected by Tekton):
git commit -m "Add new feature"
git commit -m "feat: add feature"
git commit -m "EPMCDME-123 add feature"
git commit -m "EPMCDME-123: fix bug"
git commit -m "EPMCDME-0: Fix bug"
Branch Format
Pattern: <type>/<description> (Jira ticket optional)
Examples:
feat/add-user-profile
fix/auth-timeout
docs/api-guide
feat/EPMCDME-123-user-settings (ticket optional but allowed)
MR Title Format
Pattern: EPMCDME-xxx: Brief description
Always start with Jira ticket number.
Troubleshooting
Error: "glab: command not found"
Solution: Install GitLab CLI:
brew install glab
snap install glab
Error: No Jira ticket in context
Action: Ask user: "What is the Jira ticket number (EPMCDME-xxx) for this commit?"
- Wait for user response
- Validate format matches
EPMCDME-\d+
- Then proceed with commit
Error: Already on main branch
Solution: Create feature branch first:
git checkout -b <type>/<short-description>
Error: No changes to commit
Solution: Check git status - nothing to commit or changes already staged.
MR already exists
Action: Just push updates to existing MR, don't create new one.
Examples
Example 1: User provides ticket upfront
User: "commit these auth changes for EPMCDME-456"
git add .
git commit -m "EPMCDME-456: Fix OAuth2 token refresh"
Example 2: No ticket in context
User: "commit the changes"
Claude: "What is the Jira ticket number (EPMCDME-xxx) for this commit?"
User: "EPMCDME-789"
git add .
git commit -m "EPMCDME-789: Update user profile API"
Example 3: Full MR creation
User: "push and create MR for EPMCDME-321"
- Check for existing MR
- Commit with ticket:
EPMCDME-321: Add payment gateway
- Push changes
- Create MR with title:
EPMCDME-321: Add payment gateway
Example 4: Push to existing MR
User: "push my changes"
- Check MR status
- If exists: push to existing
- If not: push only (no MR creation unless requested)