Sub-issue of #116. Hardened spec — do not re-derive decisions. Mirrors az pipelines list from the Azure CLI and the Python implementation at azure-dev-ops-cli-extension/azure-dev-ops-cli-extension/azure-dev-ops/azure-devops/azext_devops/dev/pipelines/pipeline.py#L26-L41.
Command Description
List pipeline definitions (YAML or classic) in a project. The command fetches the matching definitions via the Definitions REST 7.1 endpoint with optional filters and renders them as a default table (with optional JSON export). Output passes through ctx.Printer("list") for the table and opts.exporter.Write(ios, view) for JSON.
GET https://dev.azure.com/{organization}/{project}/_apis/build/definitions?name={filter}&repositoryId={repoId}&repositoryType={tfsgit|github}&top={n}&path={folderPath}&queryOrder={order}&api-version=7.1
Locked Decisions (do not re-derive)
| # |
Decision |
Rationale |
| 1 |
Use the vendored SDK build.Client.GetDefinitions (not raw HTTP). Mock already generated at internal/mocks/build_client_mock.go:837. |
Consistent with the other pipelines siblings. |
| 2 |
Pipelines are project-scoped: positional [ORGANIZATION/]PROJECT (via util.ParseProjectScope). |
Mirrors az pipelines list and consistent with the broader pipelines group. |
| 3 |
Optional filter --name (string) maps to GetDefinitionsArgs.Name. Mirrors az pipelines list --name. |
Accepts a prefix or exact name. |
| 4 |
Optional --repository (string) maps to GetDefinitionsArgs.RepositoryId (resolved by name when not a UUID). Optional --repository-type (enum tfsgit |
github) maps to GetDefinitionsArgs.RepositoryType. When --repository is given, --repository-type defaults to tfsgit. |
| 5 |
Optional --top (int) maps to GetDefinitionsArgs.Top. Optional --folder-path (string) maps to GetDefinitionsArgs.Path. Optional --query-order (enum) maps to GetDefinitionsArgs.QueryOrder. |
Mirrors Python pipeline_list parameters. |
| 6 |
Default output is a table. JSON output via --json passes a dedicated view struct []pipelineJSON to opts.exporter.Write. The view struct flattens Path (truncated to 50 chars + .. if longer) and Queue (name only) with omitempty. |
Mirrors pipelines/variablegroup/list/list.go. |
| 7 |
JSON view struct fields: id, name, path (truncated), revision, type (BuildDefinitionType), quality (definition quality, drives the Draft column), queueStatus, defaultQueue (name only). |
Symmetric with the show sibling. |
| 8 |
--max-items (int, default 0 = no cap) — if positive, truncate the result slice client-side. |
Mirrors pipelines/variablegroup/list --max-items. |
| 9 |
Aliases: ls, l. |
Project convention. |
| 10 |
No new SDK client, no new helper, no new package beyond internal/cmd/pipelines/list. |
Mandate: minimal code. |
| 11 |
Mock for GetDefinitions is already generated at internal/mocks/build_client_mock.go:837. Do not regenerate. |
Verified. |
Command Signature
azdo pipelines list [ORGANIZATION/]PROJECT
[--name NAME] (string, prefix or exact)
[--repository REPOSITORY] (string: name or UUID)
[--repository-type tfsgit|github] (enum; default: tfsgit if --repository given)
[--top TOP] (int, max definitions to return)
[--folder-path FOLDER_PATH] (string, e.g. "user1/production")
[--query-order definitionNameAscending|definitionNameDescending|lastModifiedAscending|lastModifiedDescending|none]
[--max-items MAX] (int, 0 = no cap)
[--json ...]
- Aliases:
ls, l
cobra.ExactArgs(1) — args[0] → project scope (via util.ParseProjectScope).
Flags
| Flag |
Maps to |
Notes |
--name (string) |
GetDefinitionsArgs.Name |
Optional name filter (prefix or exact) |
--repository (string) |
GetDefinitionsArgs.RepositoryId |
Resolved by name when not a UUID |
--repository-type (enum) |
GetDefinitionsArgs.RepositoryType |
tfsgit (default) or github; uses util.StringEnumFlag |
--top (int) |
GetDefinitionsArgs.Top |
Server-side cap on results |
--folder-path (string) |
GetDefinitionsArgs.Path |
Folder path within the project |
--query-order (enum) |
GetDefinitionsArgs.QueryOrder |
One of 5 enum values; uses util.StringEnumFlag |
--max-items (int) |
client-side cap |
0 = no cap; truncates after SDK returns |
--json / --jq / --template |
util.AddJSONFlags |
JSON export |
JSON Output Contract
type pipelineJSON struct {
ID *int `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Path *string `json:"path,omitempty"`
Revision *int `json:"revision,omitempty"`
Type *string `json:"type,omitempty"`
Quality *string `json:"quality,omitempty"`
QueueStatus *string `json:"queueStatus,omitempty"`
DefaultQueue *string `json:"defaultQueue,omitempty"`
}
Path is truncated to 50 chars + .. suffix when longer, mirroring the Python _transform_pipeline_row truncation. DefaultQueue is the queue name only (not the full AgentPoolQueue).
Table Output Contract
Default columns: ID, PATH, NAME, [DRAFT?], STATUS, DEFAULT QUEUE (mirrors transform_pipelines_table_output from _format.py). The DRAFT column is included only when at least one definition in the result has quality: draft. Results sorted by ID asc, matching the existing list-sibling convention.
Command Wiring
- Package path:
internal/cmd/pipelines/list
- Files:
list.go — NewCmd(ctx util.CmdContext) *cobra.Command + listOptions + runList
list_test.go — table-driven gomock tests
- Update
internal/cmd/pipelines/pipelines.go to add list.NewCmd(ctx) as a top-level leaf (cmd.AddCommand(...)). Update the Example block.
- Higher-level parents must already remain wired:
pipelines → list (top-level).
API Surface
Reuse the already-vendored client. No new SDK clients or mocks required.
build.Client.GetDefinitions → Definitions - List (REST 7.1)
build.GetDefinitionsArgs struct: {Project *string, Name *string, RepositoryId *string, RepositoryType *string, Top *int, Path *string, QueryOrder *string}.
build.GetDefinitionsResponseValue struct: {Value *[]BuildDefinitionReference, Count *int}.
Mock for GetDefinitions is already generated at internal/mocks/build_client_mock.go:837. No mock regeneration needed.
Reference Existing Patterns
References
Sub-issue of #116. Hardened spec — do not re-derive decisions. Mirrors
az pipelines listfrom the Azure CLI and the Python implementation atazure-dev-ops-cli-extension/azure-dev-ops-cli-extension/azure-dev-ops/azure-devops/azext_devops/dev/pipelines/pipeline.py#L26-L41.Command Description
List pipeline definitions (YAML or classic) in a project. The command fetches the matching definitions via the Definitions REST 7.1 endpoint with optional filters and renders them as a default table (with optional JSON export). Output passes through
ctx.Printer("list")for the table andopts.exporter.Write(ios, view)for JSON.Locked Decisions (do not re-derive)
build.Client.GetDefinitions(not raw HTTP). Mock already generated atinternal/mocks/build_client_mock.go:837.pipelinessiblings.[ORGANIZATION/]PROJECT(viautil.ParseProjectScope).az pipelines listand consistent with the broaderpipelinesgroup.--name(string) maps toGetDefinitionsArgs.Name. Mirrorsaz pipelines list --name.--repository(string) maps toGetDefinitionsArgs.RepositoryId(resolved by name when not a UUID). Optional--repository-type(enumtfsgitgithub) maps toGetDefinitionsArgs.RepositoryType. When--repositoryis given,--repository-typedefaults totfsgit.--top(int) maps toGetDefinitionsArgs.Top. Optional--folder-path(string) maps toGetDefinitionsArgs.Path. Optional--query-order(enum) maps toGetDefinitionsArgs.QueryOrder.pipeline_listparameters.--jsonpasses a dedicated view struct[]pipelineJSONtoopts.exporter.Write. The view struct flattensPath(truncated to 50 chars +..if longer) andQueue(name only) withomitempty.pipelines/variablegroup/list/list.go.id,name,path(truncated),revision,type(BuildDefinitionType),quality(definition quality, drives theDraftcolumn),queueStatus,defaultQueue(name only).--max-items(int, default 0 = no cap) — if positive, truncate the result slice client-side.pipelines/variablegroup/list--max-items.ls,l.internal/cmd/pipelines/list.GetDefinitionsis already generated atinternal/mocks/build_client_mock.go:837. Do not regenerate.Command Signature
ls,lcobra.ExactArgs(1)—args[0]→ project scope (viautil.ParseProjectScope).Flags
--name(string)GetDefinitionsArgs.Name--repository(string)GetDefinitionsArgs.RepositoryId--repository-type(enum)GetDefinitionsArgs.RepositoryTypetfsgit(default) orgithub; usesutil.StringEnumFlag--top(int)GetDefinitionsArgs.Top--folder-path(string)GetDefinitionsArgs.Path--query-order(enum)GetDefinitionsArgs.QueryOrderutil.StringEnumFlag--max-items(int)--json/--jq/--templateutil.AddJSONFlagsJSON Output Contract
Pathis truncated to 50 chars +..suffix when longer, mirroring the Python_transform_pipeline_rowtruncation.DefaultQueueis the queue name only (not the fullAgentPoolQueue).Table Output Contract
Default columns:
ID, PATH, NAME, [DRAFT?], STATUS, DEFAULT QUEUE(mirrorstransform_pipelines_table_outputfrom_format.py). TheDRAFTcolumn is included only when at least one definition in the result hasquality: draft. Results sorted by ID asc, matching the existing list-sibling convention.Command Wiring
internal/cmd/pipelines/listlist.go—NewCmd(ctx util.CmdContext) *cobra.Command+listOptions+runListlist_test.go— table-driven gomock testsinternal/cmd/pipelines/pipelines.goto addlist.NewCmd(ctx)as a top-level leaf (cmd.AddCommand(...)). Update theExampleblock.pipelines→list(top-level).API Surface
Reuse the already-vendored client. No new SDK clients or mocks required.
build.Client.GetDefinitions→ Definitions - List (REST 7.1)build.GetDefinitionsArgsstruct:{Project *string, Name *string, RepositoryId *string, RepositoryType *string, Top *int, Path *string, QueryOrder *string}.build.GetDefinitionsResponseValuestruct:{Value *[]BuildDefinitionReference, Count *int}.Mock for
GetDefinitionsis already generated atinternal/mocks/build_client_mock.go:837. No mock regeneration needed.Reference Existing Patterns
azure-dev-ops-cli-extension/azure-dev-ops-cli-extension/azure-dev-ops/azure-devops/azext_devops/dev/pipelines/pipeline.py#L26-L41—pipeline_listPython implementation.azure-dev-ops-cli-extension/azure-dev-ops-cli-extension/azure-dev-ops/azure-devops/azext_devops/dev/pipelines/commands.py#L77—g.command('list', 'pipeline_list', table_transformer=transform_pipelines_table_output).azure-dev-ops-cli-extension/azure-dev-ops-cli-extension/azure-dev-ops/azure-devops/azext_devops/dev/pipelines/_format.py—transform_pipelines_table_outputand_transform_pipeline_row(row builder, includes theDraftcolumn toggle andPathtruncation).internal/cmd/pipelines/variablegroup/list/list.go— primary list reference (modern list pattern with JSON view struct, table printer,--max-itemscap).internal/cmd/pipelines/build/list/list.go(feat: Implementazdo pipelines build listcommand #211) — closest list sibling; samebuild.Clientaccessor, same project-scope parser. Differs only in the JSON view struct shape and the SDK method called.internal/cmd/boards/workitem/list/list_test.go:765-844—setupFakeDeps/stub*fixture.internal/mocks/build_client_mock.go:837— mock forGetDefinitions(already generated).internal/azdo/factory.go:61—ClientFactory().Build(...)accessor (reuse).References
azext_devops/dev/pipelines/pipeline.pyazext_devops/dev/pipelines/commands.pyazext_devops/dev/pipelines/_format.py