feat: add daemon RPC endpoints for config and mol stale (bd-ag35)

Add two new RPC endpoints to allow CLI commands to work in daemon mode:

1. GetConfig (OpGetConfig) - Retrieves config values from the daemon database.
   Used by bd create to validate issue prefix in daemon mode.

2. MolStale (OpMolStale) - Finds stale molecules (complete-but-unclosed
   epics). Used by bd mol stale command in daemon mode.

Changes:
- internal/rpc/protocol.go: Add operation constants and request/response types
- internal/rpc/client.go: Add client methods GetConfig() and MolStale()
- internal/rpc/server_issues_epics.go: Add handler implementations
- internal/rpc/server_routing_validation_diagnostics.go: Register handlers
- cmd/bd/create.go: Use GetConfig RPC instead of skipping validation
- cmd/bd/mol_stale.go: Use MolStale RPC instead of requiring --no-daemon
- internal/rpc/coverage_test.go: Add tests for new endpoints

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-30 06:59:51 -08:00
parent 7f5378ba26
commit 06c8855873
7 changed files with 423 additions and 13 deletions

View File

@@ -43,6 +43,8 @@ const (
OpShutdown = "shutdown"
OpDelete = "delete"
OpGetWorkerStatus = "get_worker_status"
OpGetConfig = "get_config"
OpMolStale = "mol_stale"
// Gate operations
OpGateCreate = "gate_create"
@@ -558,3 +560,39 @@ type MoleculeProgress struct {
Assignee string `json:"assignee"`
Steps []MoleculeStep `json:"steps"`
}
// GetConfigArgs represents arguments for getting daemon config
type GetConfigArgs struct {
Key string `json:"key"` // Config key to retrieve (e.g., "issue_prefix")
}
// GetConfigResponse represents the response from get_config operation
type GetConfigResponse struct {
Key string `json:"key"`
Value string `json:"value"`
}
// MolStaleArgs represents arguments for the mol stale operation
type MolStaleArgs struct {
BlockingOnly bool `json:"blocking_only"` // Only show molecules blocking other work
UnassignedOnly bool `json:"unassigned_only"` // Only show unassigned molecules
ShowAll bool `json:"show_all"` // Include molecules with 0 children
}
// StaleMolecule holds info about a stale molecule (for RPC response)
type StaleMolecule struct {
ID string `json:"id"`
Title string `json:"title"`
TotalChildren int `json:"total_children"`
ClosedChildren int `json:"closed_children"`
Assignee string `json:"assignee,omitempty"`
BlockingIssues []string `json:"blocking_issues,omitempty"`
BlockingCount int `json:"blocking_count"`
}
// MolStaleResponse holds the result of the mol stale operation
type MolStaleResponse struct {
StaleMolecules []*StaleMolecule `json:"stale_molecules"`
TotalCount int `json:"total_count"`
BlockingCount int `json:"blocking_count"`
}