fix: Auto-sync RPC client/server versions from CLI version

- Set rpc.ServerVersion from Version in daemon startup
- Set rpc.ClientVersion from Version in main.go startup
- Eliminates need to manually update RPC versions
- Both now use 0.0.0 placeholder, overridden at runtime

Amp-Thread-ID: https://ampcode.com/threads/T-03c37f7f-f41e-4b87-8700-d346c21bad30
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-26 14:18:35 -07:00
parent d297848f76
commit 0ee45bf7de
4 changed files with 10 additions and 3 deletions

View File

@@ -858,6 +858,9 @@ func setupDaemonLock(pidFile string, global bool, log daemonLogger) (io.Closer,
}
func startRPCServer(ctx context.Context, socketPath string, store storage.Storage, log daemonLogger) (*rpc.Server, chan error, error) {
// Sync daemon version with CLI version
rpc.ServerVersion = Version
server := rpc.NewServer(socketPath, store)
serverErrChan := make(chan error, 1)

View File

@@ -123,6 +123,9 @@ var rootCmd = &cobra.Command{
noAutoImport = true
}
// Sync RPC client version with CLI version
rpc.ClientVersion = Version
// Set auto-flush based on flag (invert no-auto-flush)
autoFlushEnabled = !noAutoFlush