Documentation
¶
Overview ¶
Package winsvc registers the clawtool daemon as a Windows Service so it survives logout and starts on boot — the missing piece of the Windows installer's "drop binary → register service → firewall" flow (PR-E stage 2).
On non-Windows platforms every operation returns ErrUnsupported; Linux keeps running the daemon as a detached process and macOS uses a LaunchAgent (handled elsewhere). The Windows Service Control Manager interaction lives in winsvc_windows.go behind a build tag; this file holds the platform-agnostic Config + validation so the argument-shaping logic is unit-testable on any OS.
Verification note: the SCM calls (create / start / delete / query) can only be exercised on Windows with Administrator rights — CI runs Linux + macOS, so those paths are cross-compile-checked but not runtime-tested here. The Config validation below is.
Index ¶
Constants ¶
const DefaultDisplayName = "clawtool daemon"
DefaultDisplayName is the services.msc label used when Config.DisplayName is empty.
const DefaultName = "clawtool"
DefaultName is the SCM service key clawtool registers under when Config.Name is empty.
Variables ¶
var ErrUnsupported = errors.New("winsvc: Windows Service registration is only supported on Windows")
ErrUnsupported is returned by every operation on non-Windows platforms. Callers should treat it as "skip, not a failure" — the daemon's other lifecycle paths cover those OSes.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Name is the SCM service name (the key, no spaces). Defaults to
// DefaultName when empty.
Name string
// DisplayName is the human-readable name shown in services.msc.
DisplayName string
// Description is the longer blurb shown in the service properties.
Description string
// BinPath is the absolute path to clawtool.exe.
BinPath string
// Args are the daemon launch arguments, e.g.
// ["serve","--listen","127.0.0.1:52828","--no-auth","--mcp-http"].
Args []string
// AutoStart registers the service as start-on-boot (SERVICE_AUTO_
// START) rather than manual.
AutoStart bool
}
Config describes the clawtool daemon service to register.