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
Parse the single positional with util.ParseProjectPathTargetWithDefaultOrganization(ctx, args[0], ...). The wrapper is added as part of the create sub-issue's implementation (or this one — whichever is implemented first).
No existing helper supports the 3-segment form.
6
Destructive: requires confirmation unless--yes is provided. Prompt text: This will delete all pipelines in this folder. Are you sure you want to delete this folder?.
Mirrors the AzDO Extension's pipeline_folder_delete confirmation. On cancellation, return util.ErrCancel.
7
Plain output: print Deleted folder <PROJECT>/<PATH> to stdout on success.
Mirrors variable-group delete.
8
JSON output: N/A. DeleteFolder returns error only — no body.
9
Uses vendored build.Client.DeleteFolder.
Vendor verified at vendor/.../v7/build/client.go:757.
Predecessors: must be implemented after the create sub-issue (so the ParseProjectPathTargetWithDefaultOrganization wrapper exists), but the two can be filed in either order.
12
No go mod tidy / go mod vendor / scripts/generate_mocks.sh work.
Command Signature
vardeleteCmd=&cobra.Command{
Use: "delete [ORGANIZATION/]PROJECT/PATH",
Aliases: []string{"d", "del", "rm"},
Short: "Delete a folder.",
Long: `Delete a build definition folder at PATH under PROJECT.Mirrors 'az pipelines folder delete'. The folder, all build definitionsin it, and all builds for those definitions are deleted. This action isnot reversible.`,
Args: cobra.ExactArgs(1),
RunE: func(cmd*cobra.Command, args []string) error {
returnrunDelete(cmd.Context(), opts, args[0])
},
}
Flags
Flag
Type
Default
Required
Description
--yes
bool
false
no
Skip the confirmation prompt.
--organization
string
$AZDO_ORGANIZATION or default config
no
Azure DevOps organization. Omit to use the default.
--project
string
""
no
Project name or ID. Omit to use the project from the positional target.
JSON Output Contract
N/A. DeleteFolder returns error only.
Table Output Contract
N/A. On success, print one line to stdout:
Deleted folder <PROJECT>/<PATH>
Command Wiring
Create internal/cmd/pipelines/folder/delete/delete.go with package delete, factory func NewCmd(ctx util.CmdContext) *cobra.Command.
Add import "github.com/tmeckel/azdo-cli/internal/cmd/pipelines/folder/delete" to internal/cmd/pipelines/folder/folder.go.
Register in folder.go with cmd.AddCommand(delete.NewCmd(ctx)).
Use the util.Prompter from ctx.IOStreams() (or ctx.Prompter() if the codebase has a centralized prompter) to ask for confirmation. The existing pattern in internal/cmd/pipelines/variablegroup/delete/delete.go is the precedent.
The vendored SDK enforces args.Project != "" and args.Path != nil — will return ArgumentNilOrEmptyError / ArgumentNilError if missing. No extra validation needed in our wrapper.
Reference Existing Patterns
internal/cmd/pipelines/variablegroup/delete/delete.go — closest sibling. Mirrors the Use, the Aliases, the confirmation prompt, the success message, and the destructive Delete call.
internal/cmd/pipelines/folder/create/create.go — closest sibling for the parsing of [ORGANIZATION/]PROJECT/PATH.
Azure DevOps REST API: Folders — Delete (DELETE, route id a906531b-d2da-4f55-bda7-f3e676cc50d9, API version 7.1-preview.2). Deleting a folder also deletes its definitions and builds.
Sub-issue of #262. Hardened spec — do not re-derive decisions.
Command Description
Delete a build definition folder (and all its definitions and builds) at
PATHunderPROJECT. Mirrorsaz pipelines folder delete.Locked Decisions
Use: "delete [ORGANIZATION/]PROJECT/PATH".variable-group delete'sUse: "delete [ORGANIZATION/]PROJECT/GROUP"(internal/cmd/pipelines/variablegroup/delete/delete.go:34).Aliases: []string{"d", "del", "rm"}.cobra.ExactArgs(1).util.ParseProjectPathTargetWithDefaultOrganization(ctx, args[0], ...). The wrapper is added as part of thecreatesub-issue's implementation (or this one — whichever is implemented first).--yesis provided. Prompt text:This will delete all pipelines in this folder. Are you sure you want to delete this folder?.pipeline_folder_deleteconfirmation. On cancellation, returnutil.ErrCancel.Deleted folder <PROJECT>/<PATH>to stdout on success.variable-group delete.DeleteFolderreturnserroronly — no body.build.Client.DeleteFolder.vendor/.../v7/build/client.go:757.internal/mocks/build_client_mock.go:254-265already mocksDeleteFolder.createsub-issue (so theParseProjectPathTargetWithDefaultOrganizationwrapper exists), but the two can be filed in either order.go mod tidy/go mod vendor/scripts/generate_mocks.shwork.Command Signature
Flags
--yesboolfalse--organizationstring$AZDO_ORGANIZATIONor default config--projectstring""JSON Output Contract
N/A.
DeleteFolderreturnserroronly.Table Output Contract
N/A. On success, print one line to stdout:
Command Wiring
internal/cmd/pipelines/folder/delete/delete.gowithpackage delete, factoryfunc NewCmd(ctx util.CmdContext) *cobra.Command.import "github.com/tmeckel/azdo-cli/internal/cmd/pipelines/folder/delete"tointernal/cmd/pipelines/folder/folder.go.folder.gowithcmd.AddCommand(delete.NewCmd(ctx)).util.Prompterfromctx.IOStreams()(orctx.Prompter()if the codebase has a centralized prompter) to ask for confirmation. The existing pattern ininternal/cmd/pipelines/variablegroup/delete/delete.gois the precedent.API Surface
Vendored SDK call (from
vendor/.../v7/build/client.go:757):The vendored SDK enforces
args.Project != ""andargs.Path != nil— will returnArgumentNilOrEmptyError/ArgumentNilErrorif missing. No extra validation needed in our wrapper.Reference Existing Patterns
internal/cmd/pipelines/variablegroup/delete/delete.go— closest sibling. Mirrors theUse, theAliases, the confirmation prompt, the success message, and the destructiveDeletecall.internal/cmd/pipelines/folder/create/create.go— closest sibling for the parsing of[ORGANIZATION/]PROJECT/PATH.TDD Test Plan
TestNewCmd_deleteUse == "delete [ORGANIZATION/]PROJECT/PATH",Aliases == ["d", "del", "rm"],Args == cobra.ExactArgs(1).Test_runDelete_success_withYesDeleteFolderreturns nil.opts.yes = true.Deleted folder MyProject/Footo stdout.Test_runDelete_success_confirmedDeleteFolderreturns nil.opts.yes = false. Prompter is stubbed to returntrue.Deleted folder MyProject/Footo stdout.Test_runDelete_cancelledfalse.util.ErrCancel. The SDK is not called.Test_runDelete_APIErrorerrors.New("boom").opts.yes = true.Test_runDelete_missingPathazdo pipelines folder deletewith no args.References
vendor/.../v7/build/client.go:757(DeleteFolder),:779(DeleteFolderArgs).internal/mocks/build_client_mock.go:254-265(DeleteFolder).internal/azdo/factory.go:61—ClientFactory().Build(ctx, organization).a906531b-d2da-4f55-bda7-f3e676cc50d9, API version7.1-preview.2). Deleting a folder also deletes its definitions and builds.internal/cmd/pipelines/variablegroup/delete/delete.go(destructive confirmation, success message,DeleteSDK call).createsub-issue (so theParseProjectPathTargetWithDefaultOrganizationwrapper exists).