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:
@@ -442,6 +442,36 @@ func (c *Client) GetWorkerStatus(args *GetWorkerStatusArgs) (*GetWorkerStatusRes
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
// GetConfig retrieves a config value from the daemon's database
|
||||
func (c *Client) GetConfig(args *GetConfigArgs) (*GetConfigResponse, error) {
|
||||
resp, err := c.Execute(OpGetConfig, args)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var result GetConfigResponse
|
||||
if err := json.Unmarshal(resp.Data, &result); err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal config response: %w", err)
|
||||
}
|
||||
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
// MolStale retrieves stale molecules (complete-but-unclosed) via the daemon
|
||||
func (c *Client) MolStale(args *MolStaleArgs) (*MolStaleResponse, error) {
|
||||
resp, err := c.Execute(OpMolStale, args)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var result MolStaleResponse
|
||||
if err := json.Unmarshal(resp.Data, &result); err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal mol stale response: %w", err)
|
||||
}
|
||||
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
// cleanupStaleDaemonArtifacts removes stale daemon.pid file when socket is missing and lock is free.
|
||||
// This prevents stale artifacts from accumulating after daemon crashes.
|
||||
// Only removes pid file - lock file is managed by OS (released on process exit).
|
||||
|
||||
Reference in New Issue
Block a user