cli

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

package cli contains reusable implemeations of cli subcommands. The struct types contain field tags that github.com/alecthomas/kong reads and interprets to provide automatic documentation, default flag values and so on.

In general, code in this package should not depend on any sand/mux details besides the sand/daemon#Client type. That type handles the transport details for communicating with the sandd daemon, whether by unix domain socket (when running on the host OS) or by TCP socket (when running inside a container).

Index

Constants

View Source
const (
	DefaultImageName = "ghcr.io/banksean/sand/default:latest"
)

Variables

This section is empty.

Functions

func NewSandboxNamePredictor

func NewSandboxNamePredictor(mc daemon.Client) complete.Predictor

Types

type CLIContext

type CLIContext struct {
	AppBaseDir string
	LogFile    string
	LogLevel   string
	CloneRoot  string
	Context    context.Context
	Daemon     daemon.Client
}

type DiffCmd

type DiffCmd struct {
	SandboxNameFlag
	Branch             string `` /* 126-byte string literal not displayed */
	IncludeUncommitted bool   `short:"u" default:"false" help:"include uncommitted changes from sandbox working tree"`
}

func (*DiffCmd) Run

func (c *DiffCmd) Run(cctx *CLIContext) error

type ExecCmd

type ExecCmd struct {
	SandboxCreationFlags
	SandboxNameFlag
	Arg []string `arg:"" passthrough:"" help:"command args to exec in the container"`
}

func (*ExecCmd) Run

func (c *ExecCmd) Run(cctx *CLIContext) error

type ExportCmd added in v0.0.4

type ExportCmd struct {
	SandboxNameFlag
	ImageName string `short:"i" placeholder:"<container-image-name>" help:"name of container image to export"`
}

func (*ExportCmd) Run added in v0.0.4

func (c *ExportCmd) Run(cctx *CLIContext) error

type GitCmd

type GitCmd struct {
	Diff   DiffCmd   `cmd:"" help:"diff current working directory with sandbox clone"`
	Status StatusCmd `cmd:"" help:"show git status of sandbox working tree"`
	Log    LogCmd    `cmd:"" help:"show git log of sandbox working tree"`
}

type InstallEBPFSupportCmd

type InstallEBPFSupportCmd struct{}

InstallEBPFSupportCmd downloads a linux kernel binary that has been built with flags to enable BPFFS, which enables kernel-level packet filtering for sand's sandbox containers.

func (*InstallEBPFSupportCmd) Run

func (c *InstallEBPFSupportCmd) Run(cctx *CLIContext) error

type LogCmd

type LogCmd struct {
	SandboxNameFlag
}

func (*LogCmd) Run

func (c *LogCmd) Run(cctx *CLIContext) error

type LsCmd

type LsCmd struct{}

func (*LsCmd) Run

func (c *LsCmd) Run(cctx *CLIContext) error

type MultiSandboxNameFlags

type MultiSandboxNameFlags struct {
	SandboxName string `arg:"" completion-predictor:"sandbox-name" optional:"" help:"name of the sandbox"`
	All         bool   `short:"a" help:"all sandboxes"`
}

MultiSandboxNameFlags are shared by commands that operate on a sandbox by name or on all sandboxes.

type NewCmd

type NewCmd struct {
	SandboxCreationFlags
	ShellFlags
	Cloner      string `short:"c" default:"default" placeholder:"<claude|default|opencode>" help:"name of workspace cloner to use"`
	Branch      bool   `short:"b" help:"create a new git branch inside the sandbox _container_ (not on your host workdir)"`
	Prompt      string `` /* 130-byte string literal not displayed */
	SandboxName string `arg:"" optional:"" help:"name of the sandbox to create"`
}

func (*NewCmd) Run

func (c *NewCmd) Run(cctx *CLIContext) error

type RmCmd

type RmCmd struct {
	MultiSandboxNameFlags
}

func (*RmCmd) Run

func (c *RmCmd) Run(cctx *CLIContext) error

type SandboxCreationFlags

type SandboxCreationFlags struct {
	ImageName          string   `short:"i" placeholder:"<container-image-name>" help:"name of container image to use"`
	CloneFromDir       string   `` /* 130-byte string literal not displayed */
	EnvFile            string   `short:"e" default:".env" placholder:"<file-path>" help:"path to env file to use when creating a new shell"`
	Rm                 bool     `help:"remove the sandbox after the command terminates"`
	AllowedDomainsFile string   `placeholder:"<file-path>" help:"path to allowed-domains.txt file for DNS egress filtering (overrides the init image default)"`
	Volume             []string `short:"v" placeholder:"<host-path:container-path>" help:"bind mount a volume (can be specified multiple times)"`
}

SandboxCreationFlags are shared by commands that create a sandbox.

type SandboxNameFlag

type SandboxNameFlag struct {
	SandboxName string `arg:"" completion-predictor:"sandbox-name" help:"name of the sandbox"`
}

SandboxNameFlag is shared by commands that require a single sandbox name argument.

type ShellCmd

type ShellCmd struct {
	ShellFlags
	SandboxNameFlag
}

func (*ShellCmd) Run

func (c *ShellCmd) Run(cctx *CLIContext) error

type ShellFlags

type ShellFlags struct {
	Shell string `short:"s" default:"/bin/zsh" placeholder:"<shell-command>" help:"shell command to exec in the container"`
}

ShellFlags are shared by commands that exec a shell inside a container.

type StartCmd added in v0.0.4

type StartCmd struct {
	MultiSandboxNameFlags
}

func (*StartCmd) Run added in v0.0.4

func (c *StartCmd) Run(cctx *CLIContext) error

type StatusCmd

type StatusCmd struct {
	SandboxNameFlag
}

func (*StatusCmd) Run

func (c *StatusCmd) Run(cctx *CLIContext) error

type StopCmd

type StopCmd struct {
	MultiSandboxNameFlags
}

func (*StopCmd) Run

func (c *StopCmd) Run(cctx *CLIContext) error

type VersionCmd

type VersionCmd struct{}

func (*VersionCmd) Run

func (c *VersionCmd) Run(cctx *CLIContext) error

type VscCmd

type VscCmd struct{}

func (*VscCmd) Run

func (c *VscCmd) Run(cctx *CLIContext) error

Jump to

Keyboard shortcuts

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