Add RPC support for compact command (bd-184)

- Added OpCompact and OpCompactStats operation constants
- Added CompactArgs, CompactStatsArgs, and response types to RPC protocol
- Implemented handleCompact and handleCompactStats in RPC server
- Updated compact command to use RPC when daemon is available
- Fixed RPC client to include Cwd for proper database routing
- Compact now works in daemon mode with --no-daemon flag

Amp-Thread-ID: https://ampcode.com/threads/T-87885d07-80ad-466d-9ffb-cc96fab4853f
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-21 00:29:50 -07:00
parent 6a6b5099e9
commit 34593cad8c
5 changed files with 702 additions and 185 deletions

View File

@@ -99,10 +99,14 @@ func (c *Client) Execute(operation string, args interface{}) (*Response, error)
return nil, fmt.Errorf("failed to marshal args: %w", err)
}
// Get current working directory for database routing
cwd, _ := os.Getwd()
req := Request{
Operation: operation,
Args: argsJSON,
ClientVersion: ClientVersion,
Cwd: cwd,
}
reqJSON, err := json.Marshal(req)