Reconcile Azure DevOps work item states with increment statuses. Fixes drift by closing work items for completed increments and reactivating work items for resumed increments.
Fix Azure DevOps work item drift by reconciling states with local metadata. Use after manual edits, git pulls, or as a health check to automatically close completed items and reactivate resumed work.
/plugin marketplace add anton-abyzov/specweave/plugin install sw-ado@specweaveScan all increments and fix any drift between local metadata.json status and ADO work item states.
/sw-ado:reconcile [options]
--dry-run: Preview changes without making them--verbose: Show detailed output for each work item checkedmetadata=completed + ADO=Active ā Close the work itemmetadata=in-progress + ADO=Closed ā Reactivate the work itemRun the reconciliation using the AdoReconciler:
import { AdoReconciler } from '../../../src/sync/ado-reconciler.js';
const reconciler = new AdoReconciler({
projectRoot: process.cwd(),
dryRun: args.includes('--dry-run'),
});
const result = await reconciler.reconcile();
// Report results
console.log(`\nReconciliation complete:`);
console.log(` Scanned: ${result.scanned} increments`);
console.log(` Fixed: ${result.closed} closed, ${result.reopened} reopened`);
if (result.errors.length > 0) {
console.log(` Errors: ${result.errors.length}`);
}
š Scanning 5 increment(s) for ADO state drift...
ā
Work Item #1234 (0056-plugin-fix/US-001): State matches (Active)
ā Work Item #1240 (0066-import-wizard/US-003): Active but should be CLOSED (status=completed)
ā
Closed work item #1240
ā Work Item #1238 (0063-multi-repo/US-001): CLOSED but should be ACTIVE (status=in-progress)
ā
Reactivated work item #1238
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
š ADO RECONCILIATION SUMMARY
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Increments scanned: 5
Mismatches found: 2
Work items closed: 1
Work items reopened: 1
Errors: 0
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
/sw-ado:reconcile --dry-run
Shows what would be changed without making any modifications:
ā Work Item #1240 (0066-import-wizard/US-003): Active but should be CLOSED
[DRY RUN] Would close work item #1240
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
š ADO RECONCILIATION SUMMARY
ā ļø DRY RUN - No changes were made
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
AZURE_DEVOPS_PAT)sync.ado.enabled = true in config.jsonsync.settings.canUpdateExternalItems = true in config.json| SpecWeave Status | Expected ADO State |
|---|---|
completed | Closed, Done, Resolved |
abandoned | Closed, Removed |
in-progress | Active, In Progress |
active | Active, New |
planning | New |
/sw-ado:status: View sync status for increments/sw-ado:sync: Manual sync to ADO/sw:done: Close increment (triggers auto-close)/sw:resume: Resume increment (now triggers auto-reopen)