cli

package
v0.83.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: AGPL-3.0 Imports: 28 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 cli is the `lich` command line — the surface a provider CLI running inside a lich session uses to reach the sessions beside it.

It exists because an agent has a shell and nothing else: no lich window, no RPC client, no knowledge of this app. Every command here reads the loopback coordinates lich already exports into each PTY (LICH_PORT / LICH_TOKEN / LICH_SESSION_ID, see docs/hooks/README.md) and talks to the running lich over the same listener the window uses.

It also works from any other shell on the machine — a script, a scheduled job, the user's own terminal. With no coordinates in the environment it reads them from the running instance's runtime file (internal/singleton), the same one install.sh uses to reach a running lich for /restart. Such a caller has no session of its own, and the message it relays says so.

One command is not about the other sessions at all: `lich rage` collects a bug report from this machine, and answers to the failure where there is no window to ask through (internal/rage). It is here because it is part of the same command line, and because it must work when nothing else does.

The contract is docs/cli.md; the lich-plugin slash commands are written against it, so a flag or an output line that moves here breaks a repo this one cannot see.

Index

Constants

View Source
const (
	// ExitPending is a send, wait or control that ran out of time and handed back
	// a live ticket or command id: nothing failed, and no answer is in hand yet.
	ExitPending = 2
	// ExitNoAnswer is an errand or a control over with no answer coming through
	// lich: never read, never delivered, answered elsewhere, a worker closed
	// before it answered, or the session ended.
	ExitNoAnswer = 3
)

Exit codes past 0 (done) and 1 (failed) are outcomes a script branches on without parsing --json. docs/cli.md is the contract for them.

View Source
const NotACommand = -1

NotACommand is returned when the arguments name no lich subcommand at all, which is how main tells "the user ran a command" apart from "the user opened the app" (and from `lich --no-window`).

Variables

This section is empty.

Functions

func Run

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

Run executes one subcommand and returns the process exit code, or NotACommand when args name none. env reads the process environment, and version is the running build's, which only the bug report needs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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