Documentation
¶
Overview ¶
Package cli implements leather's command dispatch and serve loop.
Index ¶
- func NewDevtoolsHandler(deps DevtoolsHandlerDeps) http.Handler
- func Run(args []string, stdout, stderr io.Writer, version, commit string) int
- func RunAttach(args []string, stdout, stderr io.Writer) int
- func RunChat(args []string, stdin io.Reader, stdout, stderr io.Writer) int
- func RunDoctor(args []string, stdout, stderr io.Writer) int
- func RunIngest(args []string, stdout, stderr io.Writer) int
- func RunInit(args []string, stdout, stderr io.Writer) int
- func RunOnce(args []string, stdout, stderr io.Writer) int
- func RunReplay(args []string, stdout, stderr io.Writer, version, commit string) int
- func RunServe(args []string, stdout, stderr io.Writer, version, commit string) int
- func RunSnapshot(args []string, stdout, stderr io.Writer) int
- func RunSnapshotRestore(args []string, stdout, stderr io.Writer) int
- func RunSnapshotSave(args []string, stdout, stderr io.Writer) int
- func RunStatus(args []string, stdout, stderr io.Writer) int
- func RunTestAgent(args []string, stdout, stderr io.Writer) int
- func RunValidate(args []string, stdout, stderr io.Writer) int
- func RunVersion(_ []string, stdout, _ io.Writer, version, commit string) int
- type DevtoolsHandlerDeps
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 ¶
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
RunAttach connects to a running serve instance and streams pretty-printed DevTools events to stdout.
func RunChat ¶
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
RunDoctor prints the effective configuration with source attribution and redacts secret-bearing values.
Usage: leather doctor [flags]
func RunIngest ¶
RunIngest implements the "leather ingest" subcommand. Returns exit code: 0 success, 1 error, 2 usage error.
func RunInit ¶ added in v0.1.3
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 ¶
RunOnce loads and executes a single agent definition, then exits. Usage: leather run [flags] <path-to-agent.agent.md>
func RunReplay ¶
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 ¶
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
RunSnapshot dispatches to save or restore sub-subcommands.
func RunSnapshotRestore ¶ added in v0.2.0
RunSnapshotRestore extracts a snapshot archive into the configured state directory.
Usage: leather snapshot restore --input <path> [--force]
func RunSnapshotSave ¶ added in v0.2.0
RunSnapshotSave creates a point-in-time tar.gz archive of runtime state.
Usage: leather snapshot save [--output <path>]
func RunTestAgent ¶
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 ¶
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