feat(milestone): add --include-descendants to milestone list

Description

Running glab milestone list --group only listed milestones defined directly on that group. There was no way to view milestones from subgroups or descendant projects.

I added the --include-descendants flag to glab milestone list. When used with --group, glab now fetches milestones from all subgroups and descendant projects.

Because results can now span multiple namespaces, I added an Owner column to the table output when --include-descendants is enabled. This column helps users see which subgroup or project owns each milestone.

A few decisions on the behavior:

  1. --include-descendants is mutually exclusive with --project. Project milestones do not have descendants, so combining them returns an error.
  2. The Owner column appears only when --include-descendants is set. Standard group and project listings keep their original table format.
  3. The Owner column shows the subgroup or project path from the milestone web URL. It falls back to group/<id> or project/<id> if the URL is unavailable.
  4. JSON output includes group_id and project_id fields for scripting.

Closes #8709 (closed)

How has this been tested?

I tested the mutual exclusivity check by hand using a built glab binary:

$ glab milestone list --project 123 --include-descendants
   ERROR  
  if any flags in the group [project include-descendants] are set none of the 
  others can be; [include-descendants project] were all set.                  

I added unit tests covering flag wiring, mock verification for IncludeDescendents, table output with the Owner column, and --show-id. I also added tests for mutual exclusivity with --project, JSON output, and milestone owner parsing edge cases.

Checks I ran locally on the changed package:

$ go test -count=1 ./internal/commands/milestone/list/...
ok  	gitlab.com/gitlab-org/cli/internal/commands/milestone/list	0.023s
$ go run ./scripts/comment-overlap -threshold 1.0 -max-findings 0 internal/commands/milestone/list/list.go internal/commands/milestone/list/list_test.go
# 0 findings across 2 files

I also regenerated the command documentation with make gen-docs.

The rest runs in the pipeline.

Implemented with AI assistance; I reviewed and tested the changes.

Merge request reports

Loading
Loading