You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update a team's name and/or description in a project. Mirrors az devops team update from the Python extension. The team is identified by its name or GUID inside the project; at least one of --name or --description must be provided. The updated team is returned and rendered as a single-object table (or full JSON).
Positional argument is [ORGANIZATION/]PROJECT/TEAM_ID_OR_NAME (org optional, project required, team required) via util.ParseProjectTargetWithDefaultOrganization (defined in internal/cmd/util/scope.go:183-188).
Mirrors az devops team update --team TEAM --project PROJECT.
5
Require at least one of --name or --description; reject with util.FlagErrorf if both are unset.
Mirrors Python az devops team update (knack marks both flags as mutually-exclusive-or-mandatory).
6
Build the core.WebApiTeam payload from opts.name (or empty if only --description is set) and opts.description (or empty if only --name is set); never send a fully-empty payload.
The REST PATCH accepts partial bodies; the SDK marshals the whole struct.
7
When opts.exporter != nil, emit the raw *core.WebApiTeam to JSON.
§4. Test fixture (copy from internal/cmd/boards/workitem/list/list_test.go:765-844 + a Core-client stub)
Add a setupCoreFakeDeps(t, organization) variant that stubs MockCoreClient.UpdateTeam with a *core.WebApiTeam payload. Reuse the gomock patterns from internal/cmd/boards/workitem/list/list_test.go:765-844. The Core mock is internal/mocks/core_client_mock.go (see MockCoreClient).
API Surface
core.Client.UpdateTeam(ctx, UpdateTeamArgs) (*WebApiTeam, error) — see vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/core/client.go:880.
TestUpdate_RequiresNameOrDescription — set neither flag; expect util.FlagErrorf from PreRunE.
TestUpdate_MissingTeamArg — zero positional args; expect util.FlagErrorf from ExactArgs.
TestUpdate_TargetArg_ParsesOrgSlashProjectSlashTeam — "myOrg/myProject/My Team"; assert args.ProjectId == "myProject", args.TeamId == "My Team", and the org used in ClientFactory.Core(...) is "myOrg".
TestUpdate_DefaultsToConfiguredOrganization — "myProject/My Team"; assert ClientFactory.Core was called with the default org from config.
TestUpdate_PayloadContainsNameOnly — set --name NewName; assert the recorded UpdateTeamArgs.TeamData.Name == "NewName".
TestUpdate_PayloadContainsDescriptionOnly — set --description NewDesc; assert the recorded UpdateTeamArgs.TeamData.Description == "NewDesc".
TestUpdate_PayloadContainsBoth — set --name N --description D; assert both fields are set.
TestUpdate_JSONOutput — set --json id,name,description; assert the JSON contains only those keys.
TestUpdate_PropagatesSDKError — MockCoreClient.UpdateTeam returns an error; assert the error is wrapped and returned to the caller.
Phase 2 — GREEN (minimal implementation).
Implement update.go per the §3 skeleton; no new helpers outside what is sketched.
Reuse util.ParseProjectTargetWithDefaultOrganization, util.FlagErrorWrap, util.AddJSONFlags, types.ToPtr, types.GetValue. No new helpers unless mandated.
Keep the file under ~110 LOC.
Tooling and Verification Checklist
gofmt -w and goimports -w on the new files.
gofumpt -w after the implementation lands (acceptable to lag during drafts).
go build ./... — must succeed.
go test ./... — must pass.
make lint — must pass.
make docs — must regenerate without warnings; new flags appear in docs/team_update.md.
Command Description
Update a team's name and/or description in a project. Mirrors
az devops team updatefrom the Python extension. The team is identified by its name or GUID inside the project; at least one of--nameor--descriptionmust be provided. The updated team is returned and rendered as a single-object table (or full JSON).REST endpoint:
Locked Decisions (do not re-derive)
core.Client.UpdateTeamSDK method (vendor/.../core/client.go:880); do not hand-roll HTTP.WebApiTeampayload,ProjectIdroute value, andTeamId.UpdateTeamalready exists atinternal/mocks/core_client_mock.go:416-428; no new mock generation required.grep.ctx.ClientFactory().Core(ctx.Context(), scope.Organization).internal/cmd/project/create/create.go:122.[ORGANIZATION/]PROJECT/TEAM_ID_OR_NAME(org optional, project required, team required) viautil.ParseProjectTargetWithDefaultOrganization(defined ininternal/cmd/util/scope.go:183-188).az devops team update --team TEAM --project PROJECT.--nameor--description; reject withutil.FlagErrorfif both are unset.az devops team update(knack marks both flags as mutually-exclusive-or-mandatory).core.WebApiTeampayload fromopts.name(or empty if only--descriptionis set) andopts.description(or empty if only--nameis set); never send a fully-empty payload.PATCHaccepts partial bodies; the SDK marshals the whole struct.opts.exporter != nil, emit the raw*core.WebApiTeamto JSON.WebApiTeamalready carries JSON tags.ID,NAME,DESCRIPTION,PROJECT,URL.az devops team updatetable output.--yesflag.Command Signature
Flags (mapped to SDK/REST)
--name stringWebApiTeam.Name--description stringWebApiTeam.Description--json/--jq/--templateutil.AddJSONFlagsregistrationWebApiTeamstruct tags.Pre-run validation: at least one of
--nameor--descriptionmust be set. Reject otherwise.JSON Output Contract
When
opts.exporter != nil, emit the*core.WebApiTeamreturned byUpdateTeam. Do not introduce a view struct.Command Wiring
internal/cmd/team/update/update.go,update_test.gointernal/cmd/team/team.go(filed in feat: Implementazdo teamcommand group #221) mustAddCommand(update.NewCmd(ctx)).internal/cmd/root/root.gomust registerteam.NewCmd(ctx)(filed in feat: Implementazdo teamcommand group #221).make docs.Code Skeleton (canonical, copy verbatim)
§1.
updateOptionsstruct§2.
NewCmdshape (no surprises)§3.
runUpdateskeleton§4. Test fixture (copy from
internal/cmd/boards/workitem/list/list_test.go:765-844+ a Core-client stub)Add a
setupCoreFakeDeps(t, organization)variant that stubsMockCoreClient.UpdateTeamwith a*core.WebApiTeampayload. Reuse thegomockpatterns frominternal/cmd/boards/workitem/list/list_test.go:765-844. The Core mock isinternal/mocks/core_client_mock.go(seeMockCoreClient).API Surface
core.Client.UpdateTeam(ctx, UpdateTeamArgs) (*WebApiTeam, error)— seevendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/core/client.go:880.UpdateTeamArgs— seevendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/core/client.go:910. Fields:TeamData *WebApiTeam(required),ProjectId *string(required),TeamId *string(required).WebApiTeammodel — seevendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/core/models.go:466-481.internal/mocks/core_client_mock.go:416-428(MockCoreClient.UpdateTeam).internal/azdo/connection.go:55(ClientFactory.Core).Implementation Approach (TDD, reuse-first, minimal)
Phase 1 — RED (tests first).
internal/cmd/team/update/update_test.go:TestUpdate_RequiresNameOrDescription— set neither flag; expectutil.FlagErrorffromPreRunE.TestUpdate_MissingTeamArg— zero positional args; expectutil.FlagErrorffromExactArgs.TestUpdate_TargetArg_ParsesOrgSlashProjectSlashTeam—"myOrg/myProject/My Team"; assertargs.ProjectId == "myProject",args.TeamId == "My Team", and the org used inClientFactory.Core(...)is"myOrg".TestUpdate_DefaultsToConfiguredOrganization—"myProject/My Team"; assertClientFactory.Corewas called with the default org from config.TestUpdate_PayloadContainsNameOnly— set--name NewName; assert the recordedUpdateTeamArgs.TeamData.Name == "NewName".TestUpdate_PayloadContainsDescriptionOnly— set--description NewDesc; assert the recordedUpdateTeamArgs.TeamData.Description == "NewDesc".TestUpdate_PayloadContainsBoth— set--name N --description D; assert both fields are set.TestUpdate_JSONOutput— set--json id,name,description; assert the JSON contains only those keys.TestUpdate_PropagatesSDKError—MockCoreClient.UpdateTeamreturns an error; assert the error is wrapped and returned to the caller.Phase 2 — GREEN (minimal implementation).
update.goper the §3 skeleton; no new helpers outside what is sketched.util.ParseProjectTargetWithDefaultOrganization,util.FlagErrorWrap,util.AddJSONFlags,types.ToPtr,types.GetValue. No new helpers unless mandated.Tooling and Verification Checklist
gofmt -wandgoimports -won the new files.gofumpt -wafter the implementation lands (acceptable to lag during drafts).go build ./...— must succeed.go test ./...— must pass.make lint— must pass.make docs— must regenerate without warnings; new flags appear indocs/team_update.md.Reference Existing Patterns
internal/cmd/project/create/create.go:39-106—NewCmdshape,util.ParseProjectScopeusage, table rendering, JSON output.internal/cmd/boards/workitem/list/list_test.go:765-844—setupFakeDepstest fixture (canonical hermetic pattern).internal/mocks/core_client_mock.go:416-428— pre-existingUpdateTeammock.internal/azdo/connection.go:55—ClientFactory.Coreaccessor.vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/core/client.go:880—UpdateTeam.References
update_team.commands.py#L105.vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/core/client.go:880(UpdateTeam),:910(UpdateTeamArgs).vendor/github.com/microsoft/azure-devops-go-api/azuredevops/v7/core/models.go:466-481(WebApiTeam).internal/mocks/core_client_mock.go:416-428(MockCoreClient.UpdateTeam).azdo teamcommand group #221 (azdo teamcommand group umbrella).