Skip to content

feat(boards): ✨ Implement azdo boards work-item relation remove command - #332

Merged
tmeckel merged 8 commits into
masterfrom
tmeckel/issue274
Aug 15, 2026
Merged

feat(boards): ✨ Implement azdo boards work-item relation remove command#332
tmeckel merged 8 commits into
masterfrom
tmeckel/issue274

Conversation

@tmeckel

@tmeckel tmeckel commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Closes #274

Summary

Adds the azdo boards work-item relation remove command to detach one or more relations from an existing work item:

  • azdo boards work-item relation remove [ORG:]PROJECT/ID --relation-type <name> --target-id <ID> — remove relations to other work items
  • Relation type names resolve case-insensitively against the organization's relation types (friendly names, e.g. parent, child, related)
  • Multiple targets accepted per flag (repeatable flags and comma-separated values)
  • Verifies the source work item and every target belong to the requested project before sending the patch (System.TeamProject mismatch is rejected)
  • Builds a JSON-Patch document of /relations/{index} remove operations applied in reverse index order and fails with the canonical Id(s) supplied in --target-id is not valid message when the match count differs from the requested targets
  • Destructive: confirmation prompt (Are you sure you want to remove this relation(s)?), skippable with --yes
  • Table output lists the refreshed relations with friendly type names; --json / --jq / --template supported

Changes

  • refactor(boards): shared relation helpers (ResolveRelationType, PopulateFriendlyNames) now accept a pre-fetched relation-types slice, removing a duplicate GetRelationTypes round-trip per invocation (applies to add too)
  • feat(boards): remove subcommand under boards work-item relation, wired into the command tree
  • test(boards): hermetic tests covering patch construction (single/multiple/comma-separated targets, reverse index order), count validation, project-mismatch rejection for source and targets, confirmation prompt paths, and output formats
  • docs: regenerated command reference

Verification

  • go build ./... — OK
  • gofumpt — clean
  • golangci-lint — 0 issues
  • go test ./internal/cmd/boards/... — all pass

Commits are topologically sorted: shared helpers → add refactor → remove command → tree wiring → tests → docs.

ResolveRelationType and PopulateFriendlyNames now take a pre-fetched
*[]workitemtracking.WorkItemRelationType slice instead of fetching relation
types themselves. Callers perform a single GetRelationTypes call and share
the result between type resolution and friendly-name population, removing a
duplicate API round-trip per command invocation.
Fetch work item relation types once and pass the slice to the shared
ResolveRelationType and PopulateFriendlyNames helpers, halving the
GetRelationTypes calls issued by the add command.
Add 'azdo boards work-item relation remove [ORG:]PROJECT/ID' to detach one or
more relations from a work item. Targets are repeatable --target-id values;
the relation type is a friendly name from 'list-type'. The command verifies
the source and every target belong to the requested project, prompts for
confirmation (--yes skips it), builds a JSON-Patch document of
/relations/{index} remove operations in reverse index order, and fails with
the canonical 'Id(s) supplied in --target-id is not valid' message when the
match count differs from the requested targets. Implements #274.
Register the remove leaf under the boards work-item relation group so it is
reachable via 'azdo boards work-item relation remove'.
Cover patch construction for single, multiple, and comma-separated targets
with reverse index ordering, match-count validation, project-mismatch
rejection for source and targets, confirmation prompt paths, JSON export,
and table output.
Add the remove leaf to the boards work-item relation group index.
Document the remove command's options, aliases, JSON fields, and examples.
Regenerate the help reference index to include the new remove command.
@tmeckel
tmeckel merged commit 2d51746 into master Aug 15, 2026
4 of 5 checks passed
@tmeckel
tmeckel deleted the tmeckel/issue274 branch August 15, 2026 22:17
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.

Implement azdo boards work-item relation remove command

1 participant