Closes Azure DevOps work item after verifying completion, running final checks, and documenting resolution.
Closes Azure DevOps work items after verifying completion, running quality checks, and documenting resolution.
/plugin marketplace add rafaelkamimura/claude-tools/plugin install rafaelkamimura-claude-tools@rafaelkamimura/claude-toolsCloses Azure DevOps work item after verifying completion, running final checks, and documenting resolution.
This command requires Azure DevOps MCP server to be installed and configured.
If not installed, follow: https://github.com/microsoft/azure-devops-mcp-server
Check if work item number was provided as argument.
If no work item number provided: Output: "Usage: /close-azure-task [work_item_number]
Example: /close-azure-task 12345" Exit command.
Use mcp__azuredevops__get_work_item tool (if available):
If tool not available: Output: "Azure DevOps MCP server not configured.
Install and configure following: /fetch-azure-task documentation" Exit command.
If work item not found: Output: "Work item [number] not found or access denied." Exit command.
Extract work item information:
Check current state of work item.
If state is already "Closed": Output: "Work item #[ID] is already closed.
Closed Date: [closed date] Closed By: [closed by]
No action needed." Exit command.
If state is "New" or "Active": Output: "Warning: Work item #[ID] is currently '[state]', not 'Resolved'.
Typically work items should be:
Do you want to proceed with closure anyway? (yes/no):" WAIT for user confirmation.
If user says no: Output: "Closure cancelled. Consider using /update-azure-task to set status to 'Resolved' first." Exit command.
Use Bash tool to check git status:
git status --porcelainIf uncommitted changes exist: Output: "Warning: You have uncommitted changes.
Uncommitted files: [list of uncommitted files]
Commit these changes before closing work item? (yes/no/ignore):" WAIT for user response.
If user chooses 'yes', exit command and suggest running /commit first.
If user chooses 'ignore', continue with warning.
Use Bash tool to check current branch:
git branch --show-currentUse Bash tool to check if branch has been pushed:
git rev-list --count @{upstream}..HEAD 2>/dev/null || echo "not-pushed"If branch has unpushed commits: Output: "Warning: Current branch has unpushed commits.
Push commits before closing work item? (yes/no/ignore):" WAIT for user response.
If user chooses 'yes': Output: "Please run: git push
Then re-run this command." Exit command.
Use Bash tool to check for saved work item context:
ls .claude/azure-tasks/work-item-[ID].md 2>/dev/nullIf context file exists, use Read tool to read it.
Check if acceptance criteria was defined in work item.
If acceptance criteria exists: Output: "## Acceptance Criteria Verification
[Display acceptance criteria]
Have all acceptance criteria been met? (yes/no):" WAIT for user confirmation.
If user says no: Output: "Work item closure cancelled.
Remaining acceptance criteria should be completed before closing.
Options:
Closure aborted." Exit command.
Output: "Running quality checks before closure..."
Use Bash tool to run tests (if test command exists):
make test 2>/dev/null || npm test 2>/dev/null || pytest 2>/dev/null || go test ./... 2>/dev/null || echo "no-test-found"If tests fail: Output: "Warning: Tests are failing!
Failing tests detected. Work items should only be closed when all tests pass.
Proceed with closure anyway? (yes/no):" WAIT for user confirmation.
If user says no: Output: "Closure cancelled. Fix failing tests first." Exit command.
Use Bash tool to run linter (if available):
make lint 2>/dev/null || npm run lint 2>/dev/null || rye run lint 2>/dev/null || echo "no-lint-found"If linter shows errors: Output: "Warning: Linter found issues.
Consider fixing linting issues before closing work item."
Use Bash tool to find base branch:
for base in main master develop development staging; do git rev-parse --verify $base >/dev/null 2>&1 && echo $base && break; doneUse Bash tool to get all commits for this work:
git log --oneline [base_branch]..HEADUse Bash tool to get file change summary:
git diff --stat [base_branch]..HEADGenerate completion summary:
## Work Item Closure Summary
### Completed Work
[Brief description of work completed]
### Commits
[List of commit hashes and messages]
### Changes
- [N] files modified
- [N] files added
- [N] files deleted
- [Total lines changed]
### Quality Checks
- Tests: [Passed/Failed/Not Run]
- Linting: [Passed/Issues Found/Not Run]
- Code Review: [Indicate if reviewed]
### Verification
- All acceptance criteria met: [Yes/Partial/No]
- Branch merged to: [branch name or "Not merged"]
### Resolution Notes
[Additional notes about completion]
Output: "## Ready to Close Work Item #[ID]
Title: [work item title] Type: [work item type] Current State: [current state]
[Display generated closure summary]
This action will:
Close work item #[ID]? (yes/no):"
WAIT for final user confirmation.
If user says no: Output: "Closure cancelled." Exit command.
Use mcp__azuredevops__update_work_item tool:
Use mcp__azuredevops__add_work_item_comment tool:
Use mcp__azuredevops__get_work_item tool to fetch updated work item:
Confirm work item is now closed.
Output: "Work item #[ID] closed successfully!
Status: Closed Closed Date: [closure timestamp] Closed By: [user]
View in Azure DevOps: [work_item_url]"
Output: "Archive local work item context? (yes/no):" WAIT for user response.
If user says yes:
Use Bash tool to create archive directory:
mkdir -p .claude/azure-tasks/archivedUse Bash tool to move work item file to archive:
mv .claude/azure-tasks/work-item-[ID].md .claude/azure-tasks/archived/work-item-[ID]-$(date +%Y%m%d).mdOutput: "Work item context archived to: .claude/azure-tasks/archived/"
If user says no: Output: "Work item context kept in: .claude/azure-tasks/work-item-[ID].md"
If on feature branch related to work item:
Output: "You're currently on branch: [branch_name]
This work item is now closed. Would you like to:
Choose option (1-3):"
WAIT for user choice.
If option 1:
Use Bash tool: git checkout [main_branch], description: "Switch to main branch"
If option 2: Output: "Confirm deletion of branch '[branch_name]'? This cannot be undone. (yes/no):" WAIT for confirmation.
If confirmed:
Use Bash tool: git checkout [main_branch] && git branch -D [branch_name], description: "Delete feature branch"
If option 3: Continue without branch cleanup.
If work item has parent work items:
Check for associated merge/pull requests:
If Azure DevOps has time tracking:
If user lacks permission to close:
If critical checks fail:
If Azure DevOps API fails:
/fetch-azure-task [ID] → development → /commit → /update-azure-task [ID] → code review → /close-azure-task [ID]
Before closure, verify: