opencode
opencode copied to clipboard
feat(server): add scalar ui support for api documentation
This PR adds Scalar UI support to the opencode server as a modern alternative to traditional API documentation interfaces.
Changes
- Added
@scalar/hono-api-referencedependency - Integrated Scalar middleware at
/uiendpoint (can be changed to/scalar) - UI automatically reads from existing OpenAPI spec at
/doc
Implementation
Following the standard Hono integration approach from Scalar's official documentation, this provides a minimal one-line integration that leverages our existing OpenAPI specification.
Proposal: support both Swagger UI and Scalar UI
See also #790 which implements Swagger UI on /ui. I propose we support both interfaces simultaneously, but I'm open to changes:
-
Swagger UI at
/ui- The familiar, industry-standard interface -
Scalar UI at
/scalar- Modern UI with dark mode, better search, and enhanced UX
I think supporting both could be really interesting for future documentation needs, but I'm also happy to go with whatever the team prefers. What do you guys think?