Skip to content

feat(boards): ✨ implement azdo boards work-item delete command - #327

Merged
tmeckel merged 6 commits into
masterfrom
tmeckel/issue269
Aug 13, 2026
Merged

feat(boards): ✨ implement azdo boards work-item delete command#327
tmeckel merged 6 commits into
masterfrom
tmeckel/issue269

Conversation

@tmeckel

@tmeckel tmeckel commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Description

Implement azdo boards work-item delete per #269, mirroring az boards work-item delete. Deletes a single work item by ID; without --destroy the item moves to the Recycle Bin, with --destroy it is permanently removed.

Key decisions from the issue spec

  • Project-scoped target [ORG:]PROJECT/ID parsed with util.ParseProjectTargetWithDefaultOrganization; positive-integer ID validation before any SDK call.
  • Preflight ownership check: fetches the work item with GetWorkItem (fields limited to System.TeamProject) and verifies the project matches before prompting or deleting. Mismatch/missing project is an error and never calls DeleteWorkItem.
  • Confirmation prompt (Are you sure you want to delete this work item?, escalated wording with --destroy) unless --yes; cancellation returns util.ErrCancel.
  • JSON output passes the raw *workitemtracking.WorkItemDelete to the exporter (no view struct); plain output prints Deleted work item <id> / Permanently deleted work item <id>.
  • Uses the vendored workitemtracking.Client.DeleteWorkItem; no new mocks needed.
  • New shared helper BelongsToProject + TeamProjectField in internal/cmd/boards/workitem/shared for reuse by sibling work-item commands.

Files changed

  • internal/cmd/boards/workitem/delete/delete.go — new command
  • internal/cmd/boards/workitem/delete/delete_test.go — table-driven tests covering success, destroy, confirmation, cancel, non-interactive, ID validation, project mismatch, API errors, and JSON output
  • internal/cmd/boards/workitem/shared/shared.go (+ shared_test.go) — BelongsToProject ownership check
  • internal/cmd/boards/workitem/workitem.go — command registration
  • docs/ — regenerated CLI docs

Verification

  • go test ./internal/cmd/boards/workitem/... — 128 tests pass
  • golangci-lint run internal/cmd/boards/workitem/... — clean

Closes #269

@tmeckel
tmeckel merged commit af18405 into master Aug 13, 2026
4 of 5 checks passed
@tmeckel
tmeckel deleted the tmeckel/issue269 branch August 13, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Implement azdo boards work-item delete command

1 participant