Skip to content

feat(boards): ✨ Implement azdo boards work-item relation show command - #333

Merged
tmeckel merged 20 commits into
masterfrom
tmeckel/issue275
Aug 16, 2026
Merged

feat(boards): ✨ Implement azdo boards work-item relation show command#333
tmeckel merged 20 commits into
masterfrom
tmeckel/issue275

Conversation

@tmeckel

@tmeckel tmeckel commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the azdo boards work-item relation show command: lists all relations of a single Azure Boards work item, mirroring az boards work-item relation show. The work item is fetched with expand=All, relation referenceNames are replaced with friendly names, and results render as a table or JSON.

Changes

  • relation show commandshow [ORG:]PROJECT/ID (alias s); table columns TYPE / ORGANIZATION / PROJECT / ID / TITLE; --json emits the raw SDK work item; relation titles fetched with per-ID dedup; artifact and remote links fall back to URL parsing.
  • Cross-project targets in relation add--target-id accepts [PROJECT/]ID (bare IDs resolve in the source project scope); organization-prefixed forms rejected (cross-org links require --target-url); new -T/-u shorthands; BelongsToProject enforced on source and targets.
  • Central URL parsing — new azdo.ParseURL/IsVisualStudioHost/ErrNotAzDO/ErrInvalidPath in internal/azdo; repo.go and gitcredential migrated onto it, removing duplicated host/path parsing while preserving legacy error text.
  • Scope parser optionsutil.Parse gains DisallowOrganization and AllowBareTargets; docs overhauled.
  • Shared helpersParseWorkItemURL (workitem/shared) and relation target resolution (ResolveRelationTarget, FetchRelationTarget, WorkItemIDFromURL) in relation/shared, reused by add and show.
  • Commits are topologically ordered: parser → consumers → shared helpers → commands → tests → docs.

Verification

  • go test ./... -count=1: 2341 passed in 178 packages
  • go vet ./...: clean
  • golangci-lint (changed packages): clean
  • gofumpt: clean

Fixes #275

tmeckel added 20 commits August 16, 2026 14:26
Introduce ParseURL/URLIdentity/IsVisualStudioHost plus ErrNotAzDO/ErrInvalidPath
sentinels, consolidating dev.azure.com and *.visualstudio.com host/path parsing
previously duplicated across repo.go and gitcredential. Strict mode rejects
non-AzDO hosts and pathless URLs; lax mode is best-effort for forgiving
fallbacks such as relation URL parsing. Foundation for subsequent refactors;
no behavior change yet.
Table-driven coverage for strict and lax modes, both host styles, ssh host,
nil and empty-host URLs, exact legacy error text, and errors.Is sentinels.
OrganizationFromURL, ProjectFromURL, and RepositoryFromURL now use azdo.ParseURL,
removing duplicated host/path logic and the dead organization guard. Preserves
exact legacy error text (invalid path %q) and hostname-matching behavior.
gitcredential delegates organization extraction to azdo.ParseURL and classifies
ErrNotAzDO/ErrInvalidPath via errors.Is while preserving legacy error messages.
Removes the last inline .visualstudio.com parsing outside internal/azdo.
Cover get-operation URL parsing: visualstudio.com subdomain, dev.azure.com path,
missing path, non-AzDO host, wrong protocol, and missing token.
…ions

util.Parse gains ParseOptions to reject organization-prefixed targets (used by
relation add, which handles cross-org links via --target-url instead) and to
accept bare IDs when the project is implied by scope. Overhauls ParseOptions
and Parse docs with input grammar, examples, and error conditions.
Cover DisallowOrganization rejections, AllowBareTargets bare-ID resolution, and
rejection of the legacy ORGANIZATION/PROJECT slash form.
Extracts organization and project from work-item URLs: subdomain for
visualstudio.com hosts, first path segment for dev.azure.com, and the path
segment directly before /_apis as project with first-segment fallback.
Delegates organization extraction to azdo.ParseURL lax mode; best-effort to
keep relation fallbacks forgiving.
Cover both host styles, the _apis project rule, first-segment fallback, and
malformed/non-AzDO input.
Add RelationTarget, ResolveRelationTarget with dedup cache, FetchRelationTarget,
and WorkItemIDFromURL to relation shared so cross-project target resolution is
reusable by both add and the new show command.
Cover cache hit/miss and nil-cache behavior, fallback fetching, and non-work-item
URL handling.
--target-id now accepts [PROJECT/]ID, with bare IDs resolving in the source
project's scope; organization-prefixed forms are rejected and point to
--target-url for cross-org links. Adds -T/--target-id and -u/--target-url
shorthands and enforces BelongsToProject on both source and targets.
Cover bare-ID and PROJECT/ID target forms, org-prefix rejection, cross-project
routing, and BelongsToProject enforcement on source and targets.
azdo boards work-item relation show [ORG:]PROJECT/ID lists a work item's
relations with TYPE, ORGANIZATION, PROJECT, ID, and TITLE columns; --json emits
the raw SDK work item. Fetches relation titles with per-ID dedup; artifact and
remote links fall back to URL parsing. Alias: s.
Cover table rendering, remote-link fallback, artifact relations with empty ID,
and JSON output.
Register show.NewCmd in the relation group alongside add and remove.
Document [PROJECT/]ID target syntax, -T/-u shorthands, and cross-org guidance.
Generated from the command's cobra help, including the --json and --format
output options.
Add the show subcommand to the relation group listing.
Rebuild the full help reference so relation show appears in the command tree.
@tmeckel tmeckel self-assigned this Aug 16, 2026
@tmeckel
tmeckel merged commit 44a9a9f into master Aug 16, 2026
4 of 5 checks passed
@tmeckel
tmeckel deleted the tmeckel/issue275 branch August 16, 2026 14:38
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 show command

1 participant