Add configurable sort policy for GetReadyWork (bd-147)
- Add SortPolicy type with hybrid, priority, oldest constants - Add SortPolicy field to WorkFilter - Implement buildOrderByClause() for SQL generation - Add --sort flag to bd ready command - Add comprehensive tests for all 3 sort policies - Update RPC protocol to support sort policy - Update documentation with sort policy examples Enables autonomous systems like VC to use strict priority ordering while preserving hybrid behavior for interactive use. Amp-Thread-ID: https://ampcode.com/threads/T-9d7ea9db-8d6d-4498-9daa-48a7e104ce1f Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -104,9 +104,10 @@ type ShowArgs struct {
|
||||
|
||||
// ReadyArgs represents arguments for the ready operation
|
||||
type ReadyArgs struct {
|
||||
Assignee string `json:"assignee,omitempty"`
|
||||
Priority *int `json:"priority,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
Assignee string `json:"assignee,omitempty"`
|
||||
Priority *int `json:"priority,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
SortPolicy string `json:"sort_policy,omitempty"`
|
||||
}
|
||||
|
||||
// DepAddArgs represents arguments for adding a dependency
|
||||
|
||||
@@ -1177,9 +1177,10 @@ func (s *Server) handleReady(req *Request) Response {
|
||||
}
|
||||
|
||||
wf := types.WorkFilter{
|
||||
Status: types.StatusOpen,
|
||||
Priority: readyArgs.Priority,
|
||||
Limit: readyArgs.Limit,
|
||||
Status: types.StatusOpen,
|
||||
Priority: readyArgs.Priority,
|
||||
Limit: readyArgs.Limit,
|
||||
SortPolicy: types.SortPolicy(readyArgs.SortPolicy),
|
||||
}
|
||||
if readyArgs.Assignee != "" {
|
||||
wf.Assignee = &readyArgs.Assignee
|
||||
|
||||
Reference in New Issue
Block a user