cli

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Overview

Package cli provides the Cobra command adapter for the coding application. Command handlers delegate to internal application packages and never own an agent loop.

Index

Constants

View Source
const (
	ExitSuccess     = 0
	ExitFailure     = 1
	ExitUsage       = 2
	ExitInput       = 3
	ExitApproval    = ExitInput
	ExitSecurity    = 4
	ExitInterrupted = 130
	ExitTerminated  = 143
)

Stable process exit codes for the Pips CLI.

Variables

View Source
var ErrUsage = errors.New("coding cli: invalid usage")

ErrUsage means command-line input or local configuration is invalid.

Functions

func ExitCode

func ExitCode(err error) int

ExitCode classifies one error tree without relying on display text.

func New

func New(dependencies Dependencies) (*cobra.Command, error)

New constructs a fresh command tree. Callers must not reuse a command after execution because Cobra retains parsed flag state.

Types

type ACPControllerOpener

type ACPControllerOpener func(context.Context, coding.OpenOptions) (codingacp.Controller, error)

ACPControllerOpener opens one lifecycle controller owned by an ACP session.

type ACPRunner

type ACPRunner func(context.Context, codingacp.Config, io.Reader, io.Writer) error

ACPRunner serves one ACP connection over the supplied protocol streams.

type AgentRunOpener

type AgentRunOpener func(context.Context, coding.OpenOptions) (AgentRunRuntime, error)

AgentRunOpener opens one Runtime suitable for an explicit user-selected Agent invocation.

type AgentRunRuntime

type AgentRunRuntime interface {
	RunAgent(context.Context, coding.AgentRunRequest) (subagent.Result, error)
	Close(context.Context) error
}

AgentRunRuntime is the narrow lifecycle surface used by `pips agents run`. It intentionally avoids coupling the non-interactive command to the full TUI controller interface.

type BuildInfo

type BuildInfo struct {
	Version string
	Commit  string
	Date    string
}

BuildInfo is populated by release linker flags.

func ResolveBuildInfo

func ResolveBuildInfo(stamped BuildInfo) BuildInfo

ResolveBuildInfo completes stamped build information from the Go build metadata. Release builds inject every field with -ldflags, but `go install github.com/rsbin1178/pips/cmd/pips@<version>` cannot, so those binaries fall back to the module version and the VCS revision Go embeds in them. Values the build already stamped always win.

type ControllerOpener

type ControllerOpener func(context.Context, coding.OpenOptions) (tui.Controller, error)

ControllerOpener opens the lifecycle controller consumed by the TUI.

type Dependencies

type Dependencies struct {
	Build        BuildInfo
	Paths        paths.Layout
	LookupEnv    credential.LookupEnv
	WorkingDir   func() (string, error)
	SandboxProbe SandboxProbe
	Terminal     TerminalDetector
	RunTUI       TUIRunner
	RunSSH       SSHRunner
	OpenControl  ControllerOpener
	OpenAgentRun AgentRunOpener
	OpenACP      ACPControllerOpener
	RunACP       ACPRunner
	Environment  []string
}

Dependencies are process-level inputs shared by command handlers.

type SSHRunner

type SSHRunner func(context.Context, sshclient.Options) error

SSHRunner starts one fixed OpenSSH terminal bridge.

type SandboxProbe

SandboxProbe checks the native workspace-write boundary for one Workspace. It is injectable so command tests do not depend on the host sandbox.

type TUIRunner

type TUIRunner func(context.Context, tui.Options) error

TUIRunner starts one interactive Program.

type TerminalDetector

type TerminalDetector func(io.Reader, io.Writer) (bool, bool)

TerminalDetector reports whether both interactive streams are terminals.

Jump to

Keyboard shortcuts

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