{"modulePath":"github.com/lichdotdev/lich","version":"v0.93.1","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package cli\n\nPackage cli is the \\`lich\\` command line — the surface a provider CLI running inside a lich session uses to reach the sessions beside it.\n\nIt 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.\n\nIt 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.\n\nOne 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.\n\nThe 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.\n\n## Constants\n\n```go\nconst (\n\t// ExitPending is a send, wait or control that ran out of time and handed back\n\t// a live ticket or command id: nothing failed, and no answer is in hand yet.\n\tExitPending = 2\n\t// ExitNoAnswer is an errand or a control over with no answer coming through\n\t// lich: never read, never delivered, answered elsewhere, a worker closed\n\t// before it answered, or the session ended.\n\tExitNoAnswer = 3\n)\n```\nExit codes past 0 (done) and 1 (failed) are outcomes a script branches on without parsing --json. docs/cli.md is the contract for them.\n\n```go\nconst NotACommand = -1\n```\nNotACommand 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\\`).\n\n## Functions\n\n```go\nfunc Run(args []string, version string, env func(string) string, stdout, stderr io.Writer) int\n```\nRun 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.\n\n","path":"github.com/lichdotdev/lich/internal/cli","name":"cli","synopsis":"Package cli is the `lich` command line — the surface a provider CLI running inside a lich session uses to reach the sessions beside it.","isRedistributable":true}
