feat: Add 'bd count' command for counting and grouping issues

Implements a new 'bd count' command that provides efficient issue counting
with filtering and grouping capabilities.

Features:
- Basic count: Returns total count of issues matching filters
- All filtering options from 'bd list' (status, priority, type, assignee, labels, dates, etc.)
- Grouping via --by-* flags: status, priority, type, assignee, label
- JSON output support for both simple and grouped counts
- Both daemon and direct mode support

Implementation:
- Added OpCount operation and CountArgs to RPC protocol
- Added Count() method to RPC client
- Implemented handleCount() server-side handler with optimized bulk label fetching
- Created cmd/bd/count.go with full CLI implementation

Performance optimization:
- Pre-fetches all labels in a single query when using --by-label to avoid N+1 queries

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-21 19:20:09 -05:00
parent 897e952ac3
commit d7f4189e3e
5 changed files with 740 additions and 0 deletions

View File

@@ -294,6 +294,11 @@ func (c *Client) List(args *ListArgs) (*Response, error) {
return c.Execute(OpList, args)
}
// Count counts issues via the daemon
func (c *Client) Count(args *CountArgs) (*Response, error) {
return c.Execute(OpCount, args)
}
// Show shows an issue via the daemon
func (c *Client) Show(args *ShowArgs) (*Response, error) {
return c.Execute(OpShow, args)