helpers

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 41 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package helpers holds the target-side helpers: small programs Lectern runs on an agent machine to read or change something there — a workspace file operation, a native conversation search, an agent hook.

They used to be Python scripts passed to `python3 -c`, which made python3 a requirement on every agent machine. Each has a Go port here with the same arguments, the same output and the same exit status, run as `lectern helper NAME ARG…`. A target without a lectern binary keeps running the Python version (see Command), so an SSH box that has never had Lectern installed works exactly as before (docs/ptyhost.md §5).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(ex executor.Executor, name string, args []string, fallback string) string

Command renders a helper invocation for the target ex drives: the Go port when the target has a lectern binary, otherwise fallback, the Python command line it replaces. args are quoted here.

The target's session backend travels with the call as LECTERN_SESSION_BACKEND, so a helper that asks about a session's pane asks the right multiplexer (see Mux).

func Invocation

func Invocation(bin, name string, args []string) string

Invocation renders `BIN helper NAME ARG…` with every word quoted.

func Main

func Main(args []string) int

Main is `lectern helper NAME ARG…`.

func Mux

func Mux(args ...string) *exec.Cmd

Mux returns the command that runs a tmux-language command (display-message, list-panes, …) against this machine's session backend: tmux, or this very binary's `pty` subcommand when LECTERN_SESSION_BACKEND=pty.

func Names

func Names() []string

Names lists the registered helpers, sorted.

func Register

func Register(name string, fn Func)

Register adds a helper. Helpers register themselves from init.

Types

type Func

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

Func runs one helper. It returns the process exit status.

func Lookup

func Lookup(name string) (Func, bool)

Lookup returns a registered helper.

Directories

Path Synopsis
Package helperstest runs target-side helpers the way a target does — as a separate process with its own environment, working directory, stdin and exit status — so a test can hold a Go helper and the Python script it replaces to the same observable behaviour.
Package helperstest runs target-side helpers the way a target does — as a separate process with its own environment, working directory, stdin and exit status — so a test can hold a Go helper and the Python script it replaces to the same observable behaviour.

Jump to

Keyboard shortcuts

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