diff --git a/cmd/bd/daemon.go b/cmd/bd/daemon.go index 5af4a062..97171833 100644 --- a/cmd/bd/daemon.go +++ b/cmd/bd/daemon.go @@ -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) diff --git a/cmd/bd/main.go b/cmd/bd/main.go index 62f21384..185f36b7 100644 --- a/cmd/bd/main.go +++ b/cmd/bd/main.go @@ -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 diff --git a/internal/rpc/client.go b/internal/rpc/client.go index 0fad4a2f..06781a78 100644 --- a/internal/rpc/client.go +++ b/internal/rpc/client.go @@ -11,7 +11,8 @@ import ( // ClientVersion is the version of this RPC client // This should match the bd CLI version for proper compatibility checks -var ClientVersion = "0.9.10" +// It's set dynamically by main.go from cmd/bd/version.go before making RPC calls +var ClientVersion = "0.0.0" // Placeholder; overridden at startup // Client represents an RPC client that connects to the daemon type Client struct { diff --git a/internal/rpc/server.go b/internal/rpc/server.go index ef102d69..3ed4c69e 100644 --- a/internal/rpc/server.go +++ b/internal/rpc/server.go @@ -26,8 +26,8 @@ import ( // ServerVersion is the version of this RPC server // This should match the bd CLI version for proper compatibility checks -// It's set as a var so it can be initialized from main -var ServerVersion = "0.9.10" +// It's set dynamically by daemon.go from cmd/bd/version.go before starting the server +var ServerVersion = "0.0.0" // Placeholder; overridden by daemon startup const ( statusUnhealthy = "unhealthy"