Skip to content

feat(boards): ✨ implement azdo boards work-item update command - #328

Merged
tmeckel merged 5 commits into
masterfrom
tmeckel/issue270
Aug 13, 2026
Merged

feat(boards): ✨ implement azdo boards work-item update command#328
tmeckel merged 5 commits into
masterfrom
tmeckel/issue270

Conversation

@tmeckel

@tmeckel tmeckel commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Description

Implement azdo boards work-item update per #270, mirroring az 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

  • 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 updating. Mismatch/missing project is an error and never calls UpdateWorkItem.
  • Canonical patch-doc order: Title, Description, AssignedTo, State, AreaPath, IterationPath, Reason, then raw --fields ops (split on first =) in user-given order. Tests assert this order.
  • Description input modes: inline --description, repeatable --description-file (- reads stdin, concatenated with \n, 1 MB cap, binary/UTF-8 validation), and --description-editor (opens configured editor: AZDO_EDITOR -> config editor key via config.DetermineEditor -> $VISUAL -> $EDITOR -> vi/notepad; # lines stripped, empty result errors). Precedence editor > file > inline with stderr warning — shared helper in internal/cmd/boards/workitem/shared/description.go for reuse by feat: Implement azdo boards work-item create command #203.
  • --discussion appends a comment via wit.AddComment (v7 AddCommentArgs.Request *CommentCreate); negative mock assertion when not set.
  • Stderr warning when --bypass-rules/--suppress-notifications is set; --validate-only, --expand, --open supported.
  • JSON output passes the raw *workitemtracking.WorkItem to the exporter (no view struct); default output renders the 7-column list row (ID, TYPE, STATE, TITLE, ASSIGNED TO, AREA, ITERATION).
  • Uses the vendored workitemtracking.Client.UpdateWorkItem; no new mocks needed.
  • Promoted fieldString/fieldIdentityDisplay from list into shared FieldString/FieldIdentityDisplay (spec: shared fields.go), shrinking list.go.

Files changed

  • internal/cmd/boards/workitem/update/update.go — new command (alias u)
  • 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 output
  • internal/cmd/boards/workitem/shared/description.go, shared/fields.go (+ refactor of list.go/list_test.go) — shared helpers
  • internal/cmd/boards/workitem/workitem.go — command registration
  • docs/ — regenerated CLI docs

Verification

  • go test ./... — all tests pass (175 in work-item packages)
  • golangci-lint run ./internal/cmd/boards/workitem/... — clean

Closes #270

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.
@tmeckel
tmeckel merged commit 690e133 into master Aug 13, 2026
4 of 5 checks passed
@tmeckel
tmeckel deleted the tmeckel/issue270 branch August 13, 2026 21:07
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 update command

1 participant