Smithy definitions for the Build Server Protocol (BSP), enabling type-safe BSP client and server implementations in Scala.
This project converts the official BSP specification into Smithy format, allowing you to generate type-safe Scala code using Smithy4s. The generated code can be used with jsonrpclib's smithy4s integration to build BSP clients and servers.
Contains the Smithy4s-generated BSP data types and protocol definitions.
sbt:
libraryDependencies += "org.polyvariant.smithy4s-bsp" %% "codegen" % "x.y.z"Mill:
ivy"org.polyvariant.smithy4s-bsp::codegen:x.y.z"scala-cli:
//> using dep org.polyvariant.smithy4s-bsp::codegen:x.y.zThis artifact includes:
- Complete BSP protocol data types generated from Smithy definitions
- Type-safe representations of all BSP requests, responses, and notifications
The main entrypoint providing codecs and utilities for building BSP clients and servers.
sbt:
libraryDependencies += "org.polyvariant.smithy4s-bsp" %% "bsp4s" % "x.y.z"Mill:
ivy"org.polyvariant.smithy4s-bsp::bsp4s:x.y.z"scala-cli:
//> using dep org.polyvariant.smithy4s-bsp::bsp4s:x.y.zThis artifact includes:
BSPCodecs- Helper utilities for creating BSP clients and servers with proper encoding/decoding- Depends on
codegen, so you get all the generated types automatically
Contains custom Smithy trait definitions used in the BSP specification (not typically needed as a direct dependency).
To build BSP clients or servers, use the bsp4s artifact. You'll also need:
- jsonrpclib for JSON-RPC communication
- A transport layer (e.g., fs2-io for stdio communication)
The library provides BSPCodecs.clientStub and BSPCodecs.serverEndpoints helpers that handle BSP-specific encoding requirements, making it easy to create type-safe BSP clients and servers.
See the example module for a complete working example of a BSP server and a BSP client.
For a real-world usage example, check out SLS (Simple Language Server), a Scala language server that uses this library to communicate with BSP build servers.
This project tracks the official BSP specification. The Smithy definitions are kept up-to-date with the latest BSP protocol version.
This project relies on:
- jsonrpclib - JSON-RPC implementation
- Smithy4s - Smithy code generation for Scala
- alloy-core - Additional Smithy traits
Apache 2.0 - See LICENSE for details.
Contributions are welcome! The Smithy definitions are transformed from the official BSP specification.