feat(boards): ✨ implement azdo boards work-item update command - #328
Merged
Conversation
Add reusable helpers to resolve descriptions from inline flags, files/stdin, or an interactive editor (with size/binary/utf8 validation and header stripping). Also provide field accessors that safely extract string values and identity display names from work item data maps. These utilities enable consistent description input and field formatting across azdo boards work-item commands.
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.
Description
Implement
azdo boards work-item updateper #270, mirroringaz boards work-item update. Updates one or more fields of an existing work item by ID via a JSON Patch document (Work Items - Update, REST 7.1).Key decisions from the issue spec
[ORG:]PROJECT/IDparsed withutil.ParseProjectTargetWithDefaultOrganization; positive-integer ID validation before any SDK call.GetWorkItem(fields limited toSystem.TeamProject) and verifies the project matches before updating. Mismatch/missing project is an error and never callsUpdateWorkItem.--fieldsops (split on first=) in user-given order. Tests assert this order.--description, repeatable--description-file(-reads stdin, concatenated with\n, 1 MB cap, binary/UTF-8 validation), and--description-editor(opens configured editor:AZDO_EDITOR-> configeditorkey viaconfig.DetermineEditor->$VISUAL->$EDITOR-> vi/notepad;#lines stripped, empty result errors). Precedence editor > file > inline with stderr warning — shared helper ininternal/cmd/boards/workitem/shared/description.gofor reuse by feat: Implementazdo boards work-item createcommand #203.--discussionappends a comment viawit.AddComment(v7AddCommentArgs.Request *CommentCreate); negative mock assertion when not set.--bypass-rules/--suppress-notificationsis set;--validate-only,--expand,--opensupported.*workitemtracking.WorkItemto the exporter (no view struct); default output renders the 7-column list row (ID, TYPE, STATE, TITLE, ASSIGNED TO, AREA, ITERATION).workitemtracking.Client.UpdateWorkItem; no new mocks needed.fieldString/fieldIdentityDisplayfromlistinto sharedFieldString/FieldIdentityDisplay(spec: sharedfields.go), shrinkinglist.go.Files changed
internal/cmd/boards/workitem/update/update.go— new command (aliasu)internal/cmd/boards/workitem/update/update_test.go— tests covering patch-doc order, custom fields, discussion side-effect, project mismatch, ID validation, description modes, precedence warnings, JSON and table outputinternal/cmd/boards/workitem/shared/description.go,shared/fields.go(+ refactor oflist.go/list_test.go) — shared helpersinternal/cmd/boards/workitem/workitem.go— command registrationdocs/— regenerated CLI docsVerification
go test ./...— all tests pass (175 in work-item packages)golangci-lint run ./internal/cmd/boards/workitem/...— cleanCloses #270