JSPM

  • Created
  • Published
  • Downloads 75
  • Score
    100M100P100Q89454F
  • License MIT

SDK and CLI to start opencode and optionally expose it over HTTPS via Tailscale.

Package Exports

  • @whatcode-ai/sdk

Readme

@whatcode-ai/sdk

SDK to start opencode and optionally expose it over HTTPS via Tailscale.

Install

npm install @whatcode-ai/sdk

Usage

import { createWhatcodeServer } from '@whatcode-ai/sdk';

await createWhatcodeServer({
  tailscale: true, // optional
});

createWhatcodeServer(config)

Option Type Default Description
tailscale boolean undefined When true, exposes opencode via Tailscale serve
hostname string 0.0.0.0 Hostname to bind the opencode server to
port number 4096 Port to bind the opencode server to
timeout number undefined Timeout in milliseconds for the opencode server to start
signal AbortSignal undefined AbortSignal to stop the opencode server programmatically

How it works

  1. Checks if opencode is already running on port 4096.
  2. If not, starts the opencode server bound to 0.0.0.0.
  3. If tailscale: true, verifies Tailscale is installed and authenticated, runs tailscale serve --bg 4096, and prints the HTTPS URL to use in your app.

CLI

Looking for the CLI? Use @whatcode-ai/whatcode.

Requirements

  • Node.js 20+
  • opencode installed
  • Tailscale installed and authenticated (only for tailscale: true)

License

MIT