cli

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package cli implements the AgentPaaS CLI command surface using cobra.

The CLI is structured as a tree of commands rooted at `agent`:

agent [--json] [--socket <path>] [--home <dir>]
  version              — Print CLI version information
  daemon               — Daemon lifecycle commands
    status             — Query daemon version and readiness
    start              — Start the control daemon
    stop               — Stop the control daemon
    restart            — Restart the control daemon
    install            — Install as a system service (not yet implemented)
    uninstall          — Remove from system services (not yet implemented)
  doctor               — Run system diagnostics (v0 stub)
  pack                 — Build an agent image
  run                  — Start a new agent run
  stop                 — Terminate a running agent
  logs                 — Follow agent logs
  policy               — Policy management commands
  secrets              — Secret management commands
  audit                — Audit log commands
  validate             — Validate an agent project
  summarize            — Summarize a completed run
  explain-failure      — Analyze a failed run
  explain-denial       — Explain a policy denial
  recommend-patch      — Suggest a policy patch
  timeline             — Show run timeline
  next-action          — Recommend next action

Global flags:

--json        Output in JSON format instead of human-readable text.
--socket      Override the daemon Unix socket path. Defaults to the
              AGENTPAAS_SOCKET environment variable or <home>/daemon.sock.
--home        Override the agentpaas home directory. Defaults to the
              AGENTPAAS_HOME environment variable or ~/.agentpaas.

Commands that interact with a running daemon use gRPC over a Unix domain socket. The connection helper in connection.go handles dialing and presents a clear error when the daemon is not running.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentCmd

func AgentCmd() *cobra.Command

AgentCmd returns the root cobra command for the agent CLI. It is called once during CLI startup to build the full command tree.

func ConnectToDaemon

func ConnectToDaemon(socketPath string) (controlv1.ControlServiceClient, *grpc.ClientConn, error)

ConnectToDaemon dials the daemon's Unix socket and returns a ControlService client and the underlying gRPC connection.

If the daemon is not running, the returned error is clear and actionable, suggesting the user run 'agentpaas daemon start'.

func DaemonStatusText

func DaemonStatusText(s DaemonStatusOutput) string

DaemonStatusText returns a human-readable summary of DaemonStatusOutput.

func DoctorText

func DoctorText(o DoctorOutput) string

DoctorText returns human-readable doctor output.

func VersionText

func VersionText(v VersionOutput) string

VersionText returns a human-readable summary of VersionOutput.

Types

type DaemonStatusOutput

type DaemonStatusOutput struct {
	DaemonVersion    string `json:"daemon_version"`
	ProtoVersion     string `json:"proto_version"`
	GitCommit        string `json:"git_commit"`
	OsArch           string `json:"os_arch"`
	DockerContext    string `json:"docker_context"`
	DockerAPIVersion string `json:"docker_api_version"`
	Ready            bool   `json:"ready"`
}

DaemonStatusOutput holds daemon version and readiness information.

type DoctorCheck

type DoctorCheck struct {
	Name    string `json:"name"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

DoctorCheck is a single diagnostic check result.

type DoctorOutput

type DoctorOutput struct {
	Checks        []DoctorCheck `json:"checks"`
	OverallStatus string        `json:"overall_status"`
}

DoctorOutput holds the aggregated doctor diagnostics output.

type JSONError

type JSONError struct {
	Error   string `json:"error"`
	Message string `json:"message,omitempty"`
	Hint    string `json:"hint,omitempty"`
}

JSONError is a structured error representation for JSON output.

type VersionOutput

type VersionOutput struct {
	CLIVersion       string `json:"cli_version"`
	ProtoVersion     string `json:"proto_version"`
	GitCommit        string `json:"git_commit"`
	OsArch           string `json:"os_arch"`
	DockerContext    string `json:"docker_context"`
	DockerAPIVersion string `json:"docker_api_version"`
}

VersionOutput holds the CLI version information for display.

Jump to

Keyboard shortcuts

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