Skip to content

notBlubbll/OpenCodeWebService

Repository files navigation

OpencodeLauncher

Windows Service that launches and manages the opencode CLI as a persistent web server (opencode web).

How it works

  • Runs as a Windows Service named OpencodeWeb
  • Spawns opencode web --port <port> --hostname <hostname> on startup
  • Sets OPENCODE_SERVER_USERNAME and OPENCODE_SERVER_PASSWORD environment variables for the child process
  • Captures stdout/stderr and forwards them to the Windows Event Log
  • Auto-restarts opencode after a 5-second delay if the process exits unexpectedly

Prerequisites

Configuration

Edit appsettings.json in the publish output (or appsettings.Development.json for debug runs):

{
  "Opencode": {
    "Path": "opencode",
    "Port": "4096",
    "Hostname": "127.0.0.1",
    "Username": "opencode",
    "Password": ""
  }
}
Key Description
Path Fallback command name if PATH resolution fails (default: opencode)
Port TCP port for the web server (default: 4096)
Hostname Bind hostname (default: 127.0.0.1)
Username HTTP Basic Auth username via OPENCODE_SERVER_USERNAME
Password HTTP Basic Auth password via OPENCODE_SERVER_PASSWORD

Build

dotnet build -c Release

Publish (single-file, self-contained, win-x64)

dotnet publish -c Release -o .\dist

Install as a Windows Service

sc create OpencodeWeb binPath="<full-path>\dist\OpenCodeWebService.exe"
sc start OpencodeWeb

Uninstall

sc stop OpencodeWeb
sc delete OpencodeWeb

About

simple windows service wrapper for opencode web

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors