cli

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: GPL-3.0 Imports: 55 Imported by: 0

Documentation

Overview

Package cli implements leather's command dispatch and serve loop.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDevtoolsHandler

func NewDevtoolsHandler(deps DevtoolsHandlerDeps) http.Handler

NewDevtoolsHandler builds all /api/devtools routes.

func Run

func Run(args []string, stdout, stderr io.Writer, version, commit string) int

Run is leather's main entry point. It parses the first argument as a subcommand and dispatches to the appropriate handler, returning an exit code. version and commit are set by -ldflags at build time.

func RunAttach added in v0.2.0

func RunAttach(args []string, stdout, stderr io.Writer) int

RunAttach connects to a running serve instance and streams pretty-printed DevTools events to stdout.

func RunChat

func RunChat(args []string, stdin io.Reader, stdout, stderr io.Writer) int

RunChat starts an interactive chat session backed by the leather session abstraction (token budget, automatic context summarization). Usage: leather chat [flags]

func RunDoctor added in v0.1.3

func RunDoctor(args []string, stdout, stderr io.Writer) int

RunDoctor prints the effective configuration with source attribution and redacts secret-bearing values.

Usage: leather doctor [flags]

func RunIngest

func RunIngest(args []string, stdout, stderr io.Writer) int

RunIngest implements the "leather ingest" subcommand. Returns exit code: 0 success, 1 error, 2 usage error.

func RunInit added in v0.1.3

func RunInit(args []string, stdout, stderr io.Writer) int

RunInit scaffolds a new leather project directory with a config, example agent, and Makefile. Fails closed on existing files unless --overwrite is set.

Usage: leather init [--dir <path>] [--overwrite]

func RunOnce

func RunOnce(args []string, stdout, stderr io.Writer) int

RunOnce loads and executes a single agent definition, then exits. Usage: leather run [flags] <path-to-agent.agent.md>

func RunReplay

func RunReplay(args []string, stdout, stderr io.Writer, version, commit string) int

RunReplay implements `leather replay <file> [serve flags...]` as a thin wrapper around `leather serve --replay <file> --api`. The replay subsystem runs inside the serve loop; exposing a top-level `replay` subcommand makes the entry point discoverable (T6.8).

Usage:

leather replay <snapshot.json> [--addr 127.0.0.1:7749] [other serve flags]
leather replay --live <dir>     [other serve flags]

func RunServe

func RunServe(args []string, stdout, stderr io.Writer, version, commit string) int

RunServe starts the leather scheduler loop and blocks until signalled. It exits cleanly on SIGINT or SIGTERM, draining in-flight jobs first.

func RunSnapshot added in v0.2.0

func RunSnapshot(args []string, stdout, stderr io.Writer) int

RunSnapshot dispatches to save or restore sub-subcommands.

func RunSnapshotRestore added in v0.2.0

func RunSnapshotRestore(args []string, stdout, stderr io.Writer) int

RunSnapshotRestore extracts a snapshot archive into the configured state directory.

Usage: leather snapshot restore --input <path> [--force]

func RunSnapshotSave added in v0.2.0

func RunSnapshotSave(args []string, stdout, stderr io.Writer) int

RunSnapshotSave creates a point-in-time tar.gz archive of runtime state.

Usage: leather snapshot save [--output <path>]

func RunStatus

func RunStatus(args []string, stdout, stderr io.Writer) int

RunStatus prints scheduler state and token budget information.

func RunTestAgent

func RunTestAgent(args []string, stdout, stderr io.Writer) int

RunTestAgent implements the "leather test-agent" subcommand. It loads an agent definition, runs it using a MockLLM (no real LLM calls), prints the turn transcript, and exits 0 on success, 1 on error, 2 on usage error.

Usage: leather test-agent <agent-file> [flags]

--lifecycle <file>            apply a *.lifecycle.yaml before running
--mock-response <text>        LLM response text (default: "mock response")
--tool-response <name>=<text> tool name to response text (repeatable, reserved for future use)
--max-tokens <n>              token budget (default 8192)

func RunValidate

func RunValidate(args []string, stdout, stderr io.Writer) int

RunValidate parses and validates all agent, skill, and worker definition files. Exits 0 if all files are valid, 1 if any have errors, 2 on usage errors.

Output format:

ok:     <name>  (<path>)           — file parsed and schema-clean
error:  <file>: <message>          — parse or semantic error
schema: <file>:  field "<name>": <msg>  — schema violation

func RunVersion

func RunVersion(_ []string, stdout, _ io.Writer, version, commit string) int

RunVersion prints build version and platform information to stdout.

Types

type DevtoolsHandlerDeps

type DevtoolsHandlerDeps struct {
	Bus          *bus.Bus
	Causality    *causality.Engine
	QueueMgr     *queue.Manager
	GetWorkerSup func() *worker.Supervisor
	StartedAt    time.Time
	Version      string
	Commit       string
}

DevtoolsHandlerDeps provides data dependencies for DevTools handlers.

Jump to

Keyboard shortcuts

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