runnercli

package
v0.2.34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package runnercli holds the launch logic shared by the standalone railgrid-runner binary (cmd/railgrid-runner) and the `railgrid runner run` subcommand of the main CLI (pkg/cli/cmd/runner.go). Both entry points parse their own flags — one with stdlib flag, the other with pflag — and then hand the identical Options to Run, so the two can never diverge on refusals (uid 0, non-loopback listener) or on how a harness adapter is configured.

Index

Constants

View Source
const (
	// HarnessCodex is the default coding harness, for backwards compatibility:
	// a command line that predates --harness keeps behaving exactly as it did.
	HarnessCodex = "codex"
	// HarnessClaude runs headless Claude Code.
	HarnessClaude = "claude"

	// DefaultCodexBinary is the Codex executable looked up on PATH.
	DefaultCodexBinary = "codex"
	// DefaultClaudeBinary is the Claude Code executable looked up on PATH.
	DefaultClaudeBinary = "claude"
)

Variables

View Source
var Harnesses = []string{HarnessCodex, HarnessClaude} //nolint:gochecknoglobals

Harnesses are the accepted --harness values.

Functions

func Run

func Run(ctx context.Context, opts Options) (runErr error)

Run serves the loopback runner until ctx is cancelled. It refuses to run as root: the runner executes a coding harness, and the harness boundaries are configuration isolation, not a privilege boundary.

func WriteVersion

func WriteVersion(w io.Writer) error

WriteVersion emits the build and protocol metadata as JSON. It deliberately loads no enrollment, credentials, or harness state, so it stays usable as a local health check on a host whose configuration is broken.

Types

type Options

type Options struct {
	Config            string
	StateDir          string
	Listen            string
	TokenFile         string
	EnvironmentConfig string

	// Harness selects the adapter: "codex" (default) or "claude".
	Harness string
	// VersionPin optionally requires an exact version of the selected harness.
	// Empty means no version pin.
	VersionPin string

	CodexHome         string
	CodexBinary       string
	CodexRegistryURLs []string

	ClaudeHome   string
	ClaudeBinary string
	ClaudeModel  string
	// ClaudePermissionMode is acceptEdits (default) or bypassPermissions.
	ClaudePermissionMode string
	// ClaudeAllowedTools are tool patterns granted up front, e.g. "Bash(git *)".
	ClaudeAllowedTools []string
}

Options are the runner's launch inputs. Everything durable (identity, enrollment, token) lives in the JSON configuration file; these only select the file, the harness, and a handful of paths.

One runner process drives exactly ONE harness. That is deliberate: the capabilities response advertises a single harness entry, and a coordinator that dispatches to a runner needs to know what it will get without negotiating.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns the defaults both front ends advertise.

func (*Options) Validate

func (o *Options) Validate() error

Validate normalizes and checks the harness selection without touching the filesystem or starting anything. Run calls it; the CLI front ends can call it early to fail on a bad flag combination before any other work.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL