feat(boards): ✨ Implement azdo boards work-item relation remove command - #332
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #274
Summary
Adds the
azdo boards work-item relation removecommand 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 itemsparent,child,related)/relations/{index}removeoperations applied in reverse index order and fails with the canonicalId(s) supplied in --target-id is not validmessage when the match count differs from the requested targetsAre you sure you want to remove this relation(s)?), skippable with--yes--json/--jq/--templatesupportedChanges
ResolveRelationType,PopulateFriendlyNames) now accept a pre-fetched relation-types slice, removing a duplicateGetRelationTypesround-trip per invocation (applies toaddtoo)removesubcommand underboards work-item relation, wired into the command treeVerification
go build ./...— OKgofumpt— cleangolangci-lint— 0 issuesgo test ./internal/cmd/boards/...— all passCommits are topologically sorted: shared helpers → add refactor → remove command → tree wiring → tests → docs.