diff --git a/cmd/bd/ready.go b/cmd/bd/ready.go index 7044d560..79eac289 100644 --- a/cmd/bd/ready.go +++ b/cmd/bd/ready.go @@ -20,6 +20,7 @@ var readyCmd = &cobra.Command{ sortPolicy, _ := cmd.Flags().GetString("sort") labels, _ := cmd.Flags().GetStringSlice("label") labelsAny, _ := cmd.Flags().GetStringSlice("label-any") + issueType, _ := cmd.Flags().GetString("type") // Use global jsonOutput set by PersistentPreRun (respects config.yaml + env vars) // Normalize labels: trim, dedupe, remove empty @@ -28,6 +29,7 @@ var readyCmd = &cobra.Command{ filter := types.WorkFilter{ // Leave Status empty to get both 'open' and 'in_progress' (bd-165) + Type: issueType, Limit: limit, Unassigned: unassigned, SortPolicy: types.SortPolicy(sortPolicy), @@ -52,6 +54,7 @@ var readyCmd = &cobra.Command{ readyArgs := &rpc.ReadyArgs{ Assignee: assignee, Unassigned: unassigned, + Type: issueType, Limit: limit, SortPolicy: sortPolicy, Labels: labels, @@ -336,6 +339,7 @@ func init() { readyCmd.Flags().StringP("sort", "s", "hybrid", "Sort policy: hybrid (default), priority, oldest") readyCmd.Flags().StringSliceP("label", "l", []string{}, "Filter by labels (AND: must have ALL). Can combine with --label-any") readyCmd.Flags().StringSlice("label-any", []string{}, "Filter by labels (OR: must have AT LEAST ONE). Can combine with --label") + readyCmd.Flags().StringP("type", "t", "", "Filter by issue type (task, bug, feature, epic, merge-request)") rootCmd.AddCommand(readyCmd) rootCmd.AddCommand(blockedCmd) rootCmd.AddCommand(statsCmd) diff --git a/internal/rpc/protocol.go b/internal/rpc/protocol.go index c1826082..b823e745 100644 --- a/internal/rpc/protocol.go +++ b/internal/rpc/protocol.go @@ -214,6 +214,7 @@ type ReadyArgs struct { Assignee string `json:"assignee,omitempty"` Unassigned bool `json:"unassigned,omitempty"` Priority *int `json:"priority,omitempty"` + Type string `json:"type,omitempty"` Limit int `json:"limit,omitempty"` SortPolicy string `json:"sort_policy,omitempty"` Labels []string `json:"labels,omitempty"` diff --git a/internal/storage/sqlite/ready.go b/internal/storage/sqlite/ready.go index 0e809264..d60b84c2 100644 --- a/internal/storage/sqlite/ready.go +++ b/internal/storage/sqlite/ready.go @@ -27,6 +27,12 @@ func (s *SQLiteStorage) GetReadyWork(ctx context.Context, filter types.WorkFilte args = append(args, filter.Status) } + // Filter by issue type (gt-ktf3: MQ integration) + if filter.Type != "" { + whereClauses = append(whereClauses, "i.issue_type = ?") + args = append(args, filter.Type) + } + if filter.Priority != nil { whereClauses = append(whereClauses, "i.priority = ?") args = append(args, *filter.Priority) diff --git a/internal/types/types.go b/internal/types/types.go index 34ada925..8efa1128 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -478,6 +478,7 @@ func (s SortPolicy) IsValid() bool { // WorkFilter is used to filter ready work queries type WorkFilter struct { Status Status + Type string // Filter by issue type (task, bug, feature, epic, merge-request, etc.) Priority *int Assignee *string Unassigned bool // Filter for issues with no assignee