cli

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvURL   = "SUPERPLANE_URL"
	EnvToken = "SUPERPLANE_TOKEN"
)
View Source
const (
	DefaultAPIURL           = "http://localhost:8000"
	ConfigKeyOutput         = "output"
	ConfigKeyContexts       = "contexts"
	ConfigKeyCurrentContext = "currentContext"
)

Variables

View Source
var OutputFormat string
View Source
var RootCmd = &cobra.Command{
	Use:   "superplane",
	Short: "SuperPlane command line interface",
	Long:  "SuperPlane CLI - Command line interface for the SuperPlane API\n\n" + core.AgentSkillsHelp(),
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		if !Verbose {
			log.SetOutput(io.Discard)
		}
		return ValidateEnvironmentContext()
	},
}
View Source
var Verbose bool
View Source
var Version = "dev"

Version is set at build time via -ldflags. Defaults to "dev" for development builds.

Functions

func CheckWithMessage

func CheckWithMessage(err error, message string)

Checks if an error is present.

If it is present, it displays the provided message and exits with status 1.

func ContextSelector added in v0.9.0

func ContextSelector(context ConfigContext) string

func DefaultClient

func DefaultClient() *openapi_client.APIClient

func Exit

func Exit(code int)

func GetAPIToken

func GetAPIToken() string

func GetAPIURL

func GetAPIURL() string

func GetOutputFormat

func GetOutputFormat() string

func NewAPIClient

func NewAPIClient(config *ClientConfig) *openapi_client.APIClient

func NewCurrentContext added in v0.9.0

func NewCurrentContext(context ConfigContext) core.ConfigContext

func NewEnvironmentContext added in v0.21.0

func NewEnvironmentContext(context ConfigContext) core.ConfigContext

func PrintUpdateNotice added in v0.14.0

func PrintUpdateNotice()

PrintUpdateNotice prints an upgrade notice to stderr if a newer version is available. It waits at most 1 second for the background check to finish.

func SaveContexts added in v0.9.0

func SaveContexts(contexts []ConfigContext) error

func ShouldStartUpdateCheck added in v0.14.0

func ShouldStartUpdateCheck(args []string) bool

func StartUpdateCheck added in v0.14.0

func StartUpdateCheck()

StartUpdateCheck begins an async check for a newer CLI version. It is a no-op for dev builds.

func ValidateEnvironmentContext added in v0.21.0

func ValidateEnvironmentContext() error

func WriteConfig added in v0.9.0

func WriteConfig() error

Types

type ClientConfig

type ClientConfig struct {
	BaseURL    string
	APIToken   string
	HTTPClient *http.Client
}

func NewClientConfig

func NewClientConfig() *ClientConfig

type ConfigContext added in v0.9.0

type ConfigContext struct {
	URL            string  `json:"url" yaml:"url"`
	Organization   string  `json:"organization" yaml:"organization"`
	OrganizationID string  `json:"organizationId,omitempty" yaml:"organizationId,omitempty"`
	APIToken       string  `json:"apiToken" yaml:"apiToken"`
	Canvas         *string `json:"canvas,omitempty" yaml:"canvas,omitempty"`
}

func GetContexts added in v0.9.0

func GetContexts() []ConfigContext

func GetCurrentContext added in v0.9.0

func GetCurrentContext() (ConfigContext, bool)

func GetEnvironmentContext added in v0.21.0

func GetEnvironmentContext() (ConfigContext, bool)

func SwitchContext added in v0.20.0

func SwitchContext(baseURL, org string) (*ConfigContext, error)

SwitchContext makes the context identified by (baseURL, org) current. The org argument matches on organization ID first and then on organization name.

func SwitchContextByOrganization added in v0.20.0

func SwitchContextByOrganization(orgOrID, urlFilter string) (*ConfigContext, error)

SwitchContextByOrganization sets the current context using organization id or name across saved installations. When urlFilter is non-empty, only contexts at that base URL are considered (so multiple matches are always same-installation duplicates, never cross-installation ambiguity). Multiple matches on different base URLs without urlFilter returns an error that lists installations and suggests --url.

func UpsertContext added in v0.9.0

func UpsertContext(context ConfigContext) (ConfigContext, error)

type ConnectCommand added in v0.9.0

type ConnectCommand struct{}

func (*ConnectCommand) Execute added in v0.9.0

func (c *ConnectCommand) Execute(ctx core.CommandContext) error

type ContextCommand added in v0.20.0

type ContextCommand struct{}

func (*ContextCommand) Execute added in v0.20.0

func (c *ContextCommand) Execute(ctx core.CommandContext) error

type ContextsCommand added in v0.9.0

type ContextsCommand struct{}

func (*ContextsCommand) Execute added in v0.9.0

func (c *ContextsCommand) Execute(ctx core.CommandContext) error

type CurrentContext added in v0.9.0

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

* Implementation of the core.ConfigContext interface, * which uses the current context as the source for operations..

func (*CurrentContext) GetActiveCanvas added in v0.9.0

func (c *CurrentContext) GetActiveCanvas() string

func (*CurrentContext) GetURL added in v0.21.0

func (c *CurrentContext) GetURL() string

func (*CurrentContext) SetActiveCanvas added in v0.9.0

func (c *CurrentContext) SetActiveCanvas(canvasID string) error

Directories

Path Synopsis
commands

Jump to

Keyboard shortcuts

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