cli

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cli provides a Unix-domain-socket-based command server that enables `jumpgate logs`, `jumpgate status`, and other CLI subcommands to communicate with the running JumpGate daemon without adding any web dashboard or REST API overhead.

Index

Constants

View Source
const (
	ActionLogs     = "logs"
	ActionStatus   = "status"
	ActionEnv      = "env"
	ActionRollback = "rollback"
)

Action constants for CLI commands sent over the Unix socket.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// Action is one of "logs", "status", "env", or "rollback".
	Action string `json:"action"`

	// AppName is the JumpGate application name to query.
	AppName string `json:"app_name"`

	// DeploymentID is an optional specific deployment to query (for logs).
	DeploymentID string `json:"deployment_id,omitempty"`
}

Command is a JSON-encoded request sent from the CLI client to the daemon over the Unix socket.

type Handler

type Handler func(s *store.Store, cmd Command) Response

Handler is a function that processes a Command and returns a Response.

type Response

type Response struct {
	Success bool   `json:"success"`
	Data    any    `json:"data,omitempty"`
	Error   string `json:"error,omitempty"`
}

Response is a JSON-encoded reply from the daemon to the CLI client.

func SendCommand

func SendCommand(socketPath string, cmd Command) (*Response, error)

SendCommand connects to the JumpGate daemon via the Unix socket at socketPath, sends the given Command, and returns the Response.

type SocketServer

type SocketServer struct {
	// contains filtered or unexported fields
}

SocketServer listens on a Unix domain socket for CLI commands and dispatches them to registered handlers.

func NewSocketServer

func NewSocketServer(s *store.Store, socketPath string, pipeline *deploy.Pipeline) *SocketServer

NewSocketServer creates a SocketServer that listens on the given Unix socket path and dispatches commands using the provided Store. The pipeline reference is used by the rollback handler to trigger re-deployments.

func (*SocketServer) Listen

func (ss *SocketServer) Listen(ctx context.Context) error

Listen starts accepting connections on the Unix socket. It blocks until ctx is cancelled, then performs a graceful shutdown.

Jump to

Keyboard shortcuts

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