Update Azure DevOps work items after implementation completion by linking git commits, adding implementation summaries, and updating status to 'Ready for Testing'...
Automate updating Azure DevOps work items after implementation with git commit links, implementation summaries, and status updates.
Update task after commit:
"Update Azure DevOps task 1234 with git commit abc123, add summary 'Implemented singleton pattern', set status to Ready for Testing"
Update from git log:
"Update work items referenced in last 3 commits with implementation summaries and set to Ready for Testing"
From explicit work item ID:
From git commit message:
feat(#1234): Description or fix: Description (#1234)From recent commits:
git log -3 --oneline
# Extract work item IDs from commit messages
Query Azure DevOps for current work item:
mcp__azure-devops__wit_get_work_item(
project: "ProjectName",
id: 1234
)
Capture:
Create summary from:
Format:
Implementation Summary:
- Implemented [feature/fix description]
- Files modified: [list key files]
- Git commit: [commit SHA]
- Completed on: [date]
Add git commit as external link:
mcp__azure-devops__wit_update_work_items_batch(
project: "ProjectName",
updates: [{
id: 1234,
updates: [{
op: "add",
path: "/relations/-",
value: {
rel: "Hyperlink",
url: "https://github.com/org/repo/commit/abc123def456",
attributes: {
comment: "Implementation commit"
}
}
}]
}]
)
Add comment with implementation summary:
mcp__azure-devops__wit_update_work_items_batch(
project: "ProjectName",
updates: [{
id: 1234,
updates: [{
op: "add",
path: "/fields/System.History",
value: "<p><b>Implementation Complete</b></p><p>[Implementation summary from Step 3]</p>"
}]
}]
)
Update work item state:
mcp__azure-devops__wit_update_work_items_batch(
project: "ProjectName",
updates: [{
id: 1234,
updates: [{
op: "add",
path: "/fields/System.State",
value: "Ready for Testing"
}]
}]
)
Note: For User Stories, may use "Resolved" state instead based on workflow.
Work Item Types:
State Transitions:
Git Commit Linking:
Implementation Summary:
scripts/extract_work_item_from_commit.py — Extract work item ID from git commit message
python scripts/extract_work_item_from_commit.py --commit-sha abc123
# Returns: work_item_id: 1234
scripts/generate_update_payload.py — Generate Azure DevOps update payload
python scripts/generate_update_payload.py \
--work-item-id 1234 \
--commit-sha abc123 \
--commit-url "https://github.com/org/repo/commit/abc123" \
--summary "Implemented singleton pattern for ConfigManager" \
--files-changed "src/services/ConfigManager.ts,tests/ConfigManager.test.ts" \
--target-state "Ready for Testing"
# Returns: Formatted payload for MCP tool
scripts/batch_update_from_commits.py — Update multiple work items from commit range
python scripts/batch_update_from_commits.py \
--git-range "HEAD~5..HEAD" \
--project "ProjectName" \
--repo-url "https://github.com/org/repo"
# Returns: Batch payload for multiple work items
Situation: Completed implementation of a task, made git commit
Steps:
Example:
# Git commit made
git commit -m "feat(#1234): Implement ConfigManager singleton"
# Update work item
python scripts/generate_update_payload.py \
--work-item-id 1234 \
--commit-sha $(git rev-parse HEAD) \
--commit-url "https://github.com/org/repo/commit/$(git rev-parse HEAD)" \
--summary "Implemented ConfigManager as singleton pattern" \
--target-state "Ready for Testing"
Situation: Completed all tasks for a user story
Steps:
Example:
# Get all tasks for user story
# Update each task with its commit
# Update parent user story with summary
python scripts/batch_update_from_commits.py \
--git-range "feature/us-5678..main" \
--project "ProjectName" \
--parent-story 5678
Situation: Fixed a bug, made commit
Steps:
Example:
python scripts/generate_update_payload.py \
--work-item-id 9999 \
--commit-sha abc123 \
--commit-url "https://github.com/org/repo/commit/abc123" \
--summary "Fixed null pointer exception in authentication flow" \
--target-state "Resolved" \
--work-item-type "Bug"
Situation: Merged feature branch, need to update all referenced work items
Steps:
Example:
python scripts/batch_update_from_commits.py \
--git-range "feature/epic-5..main" \
--project "ProjectName" \
--repo-url "https://github.com/org/repo" \
--target-state "Ready for Testing"
Update Payload Structure:
{
"mcp_tool": "mcp__azure-devops__wit_update_work_items_batch",
"parameters": {
"project": "ProjectName",
"updates": [
{
"id": 1234,
"updates": [
{
"op": "add",
"path": "/relations/-",
"value": {
"rel": "Hyperlink",
"url": "https://github.com/org/repo/commit/abc123",
"attributes": {
"comment": "Implementation commit"
}
}
},
{
"op": "add",
"path": "/fields/System.History",
"value": "<p><b>Implementation Complete</b></p><p>Implemented ConfigManager as singleton pattern.</p><p>Files changed: src/services/ConfigManager.ts, tests/ConfigManager.test.ts</p><p>Git commit: abc123</p>"
},
{
"op": "add",
"path": "/fields/System.State",
"value": "Ready for Testing"
}
]
}
]
}
}
/implement-waves integration:
## Step 6: Update Azure DevOps Work Items
After git commit and before closing wave:
- Extract work item IDs from commits
- Invoke `azure-devops-work-item-update` skill
- Link commits to work items
- Add implementation summaries
- Update status to Ready for Testing
- Verify work items updated successfully
Git Workflow Integration:
## Post-Commit Hook
After making commit:
1. Parse commit message for work item ID
2. If work item ID found, offer to update work item
3. Generate implementation summary from commit
4. Update work item automatically
feat(#1234): Description)Problem: Work item ID doesn't exist Solution: Verify work item ID is correct, check project name
Problem: Can't transition from current state to target state
Solution: Check references/state-transitions.md for valid transitions, use intermediate state if needed
Problem: Commit already linked to work item Solution: Check existing relations before adding, skip if already exists
Problem: MCP server lacks permission to update work item Solution: Verify Azure DevOps permissions, ensure PAT has "Work Items (Read & Write)" scope
Before updating work item:
After updating work item:
# Step 1: Extract work item from recent commit
git log -1 --pretty=format:"%H %s"
# Output: abc123def456 feat(#1234): Implement ConfigManager singleton
python scripts/extract_work_item_from_commit.py --commit-sha abc123def456
# Output: {"work_item_id": 1234, "commit_message": "Implement ConfigManager singleton"}
# Step 2: Generate update payload
python scripts/generate_update_payload.py \
--work-item-id 1234 \
--commit-sha abc123def456 \
--commit-url "https://github.com/myorg/myrepo/commit/abc123def456" \
--summary "Implemented ConfigManager as singleton pattern with thread-safe getInstance()" \
--files-changed "src/services/ConfigManager.ts,tests/ConfigManager.test.ts" \
--target-state "Ready for Testing" \
--pretty
# Output: Formatted JSON payload
# Step 3: Apply update via MCP
mcp__azure-devops__wit_update_work_items_batch(
project: "MyProject",
updates: [{
id: 1234,
updates: [...]
}]
)
# Output: {"count": 1, "updated": [1234]}
# Step 4: Verify update
mcp__azure-devops__wit_get_work_item(
project: "MyProject",
id: 1234
)
# Verify:
# - State = "Ready for Testing"
# - History contains implementation comment
# - Relations contain commit link
Last Updated: 2025-01-21