feat: add a group filter to project list - #689
Draft
NickJosevski wants to merge 1 commit into
Draft
Conversation
`octopus project list` had no way to narrow to a single project group, so finding the projects in a group meant either `project-group view`, whose output is group metadata with the projects nested inside it, or filtering the full list client side. Add an optional `-g/--group` filter taking a group name or ID, matching the flag `project create` and `project clone` already use. With no flag the command behaves exactly as before. When a group is given the projects come from that group's own Projects link, which the server pages for us, rather than fetching every project in the space and discarding most of them. An unknown group reports `cannot find a project group with name or ID of 'X'`, the wording the delete commands use, rather than the SDK's bare "cannot find the item". Other lookup errors pass through untouched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an optional group filter to
octopus project list:Why
There was no way to narrow
project listto a single project group. The nearest thing wasproject-group view, which shows group metadata with the projects nested inside it — fine for a look, awkward when the projects are what you actually want.This is the alternative shape proposed on #388, which added a
project-group projects listcommand instead. Putting the filter onproject listis more discoverable (people looking for projects reach forproject list), matches the-g/--groupflagproject createandproject clonealready use, and avoids a three-levelproject-group projects listwhose middle noun would exist to hold a single verb. Credit for spotting the gap goes to @nate-christensen.Behaviour
Projects.GetAll(), same output and columns as before.Projectslink, which the server pages for us rather than us fetching every project and discarding most of them. (The projects collection has noprojectGroupIdfilter, so this is the available route either way.)cannot find a project group with name or ID of 'X', matching the wording in thedeletecommands, rather than the SDK's barecannot find the item. Other lookup errors pass through untouched.The selection logic sits in a small
getProjectsfunction taking callbacks, so it is unit-testable without a factory mock — five tests cover no-filter, filter, unknown group, nil group and unrelated-error paths.Verification
Build, vet, gofmt and tests clean. Against a local instance: created a throwaway group and project, confirmed the filter discriminates by both name and ID (16 projects total, 1 in the temp group, 15 in the default), then removed them. Also diffed the raw field sets returned by
/projectsand/projectgroups/X/projects— identical,ProjectTagsincluded, so theTAGScolumn behaves the same on either path.Draft because
Raised as a draft pending a decision on #388 — if we go this way, that PR should be closed in favour of this one.
🤖 Generated with Claude Code