plugin

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneTemplateRepo added in v0.5.0

func CloneTemplateRepo(opts GitTemplateOptions) error

func ConfigureTemplateRemotes added in v0.5.0

func ConfigureTemplateRemotes(opts GitTemplateOptions) error

func ContextPluginSupports added in v0.11.0

func ContextPluginSupports(contextPlugin, requestedPlugin string) bool

Types

type CommandExecOptions added in v0.11.0

type CommandExecOptions struct {
	Context    context.Context
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
	Capture    bool
	LiveStderr bool
}

type Config

type Config struct {
	LogLevel string
	Context  string
	APIUrl   string
	Format   string
}

Config holds common plugin configuration

type ContextJob added in v0.13.0

type ContextJob interface {
	BindFlags(cmd *cobra.Command)
	Run(cmd *cobra.Command, ctx *config.Context) error
}

type FileAccessor added in v0.12.0

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

func NewFileAccessor added in v0.12.0

func NewFileAccessor(ctx *config.Context) (*FileAccessor, error)

func NewFileAccessorWithSSH added in v0.12.0

func NewFileAccessorWithSSH(ctx *config.Context, client *ssh.Client, ownsSSH bool) (*FileAccessor, error)

func (*FileAccessor) Close added in v0.12.0

func (a *FileAccessor) Close() error

func (*FileAccessor) ListFiles added in v0.12.0

func (a *FileAccessor) ListFiles(root string) ([]string, error)

func (*FileAccessor) MatchFiles added in v0.12.0

func (a *FileAccessor) MatchFiles(root, pattern string) ([]string, error)

func (*FileAccessor) MatchFilesInDir added in v0.12.0

func (a *FileAccessor) MatchFilesInDir(root, pattern string) ([]string, error)

func (*FileAccessor) ReadFile added in v0.12.0

func (a *FileAccessor) ReadFile(path string) ([]byte, error)

func (*FileAccessor) ReadFileContext added in v0.12.0

func (a *FileAccessor) ReadFileContext(ctx context.Context, path string) ([]byte, error)

func (*FileAccessor) ReadFiles added in v0.12.0

func (a *FileAccessor) ReadFiles(paths []string) (map[string][]byte, error)

func (*FileAccessor) ReadFilesContext added in v0.12.0

func (a *FileAccessor) ReadFilesContext(ctx context.Context, paths []string) (map[string][]byte, error)

type GitTemplateOptions added in v0.5.0

type GitTemplateOptions struct {
	TemplateRepo       string
	TemplateBranch     string
	ProjectDir         string
	GitRemoteURL       string
	GitRemoteName      string
	TemplateRemoteName string
	Quiet              bool
}

type InstalledPlugin added in v0.10.0

type InstalledPlugin struct {
	Name         string
	BinaryName   string
	Path         string
	Version      string
	Description  string
	Author       string
	TemplateRepo string
	CanCreate    bool
	Includes     []string
}

func DiscoverInstalled added in v0.10.0

func DiscoverInstalled() []InstalledPlugin

func DiscoverInstalledFromPath added in v0.10.0

func DiscoverInstalledFromPath(pathEnv string) []InstalledPlugin

func FindInstalled added in v0.11.0

func FindInstalled(name string) (InstalledPlugin, bool)

func ParsePluginInfoOutput added in v0.10.0

func ParsePluginInfoOutput(output string) InstalledPlugin

type Metadata

type Metadata struct {
	Name         string
	Version      string
	Description  string
	Author       string
	TemplateRepo string
	Includes     []string
}

Metadata contains information about a plugin

type ProgressLine added in v0.13.0

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

func NewProgressLine added in v0.13.0

func NewProgressLine(w io.Writer, title, detail string) *ProgressLine

func (*ProgressLine) Close added in v0.13.0

func (p *ProgressLine) Close()

func (*ProgressLine) Report added in v0.13.0

func (p *ProgressLine) Report(title, detail string)

type RegisteredJob added in v0.13.0

type RegisteredJob struct {
	Spec    job.Spec
	Command *cobra.Command
}

type SDK

type SDK struct {
	Metadata Metadata
	Config   Config
	RootCmd  *cobra.Command
	// contains filtered or unexported fields
}

SDK provides common functionality for plugins

func NewSDK

func NewSDK(metadata Metadata) *SDK

NewSDK creates a new plugin SDK instance

func (*SDK) AddCommand

func (s *SDK) AddCommand(cmd *cobra.Command)

AddCommand adds a subcommand to the plugin

func (*SDK) CloneTemplateRepo added in v0.5.0

func (s *SDK) CloneTemplateRepo(opts GitTemplateOptions) error

func (*SDK) Close added in v0.12.0

func (s *SDK) Close() error

func (*SDK) ConfigureTemplateRemotes added in v0.5.0

func (s *SDK) ConfigureTemplateRemotes(opts GitTemplateOptions) error

func (*SDK) ContextValidators added in v0.9.0

func (s *SDK) ContextValidators() []validate.Validator

func (*SDK) ExecContainer added in v0.12.0

func (s *SDK) ExecContainer(ctx context.Context, opts docker.ExecOptions) (int, error)

ExecContainer executes a command in a Docker container using the shared SDK Docker path.

func (*SDK) ExecInContainer

func (s *SDK) ExecInContainer(ctx context.Context, containerID string, cmd []string) (int, error)

ExecInContainer executes a command in a Docker container. This is a convenience wrapper for plugins.

func (*SDK) ExecInContainerInteractive

func (s *SDK) ExecInContainerInteractive(ctx context.Context, containerID string, cmd []string) (int, error)

ExecInContainerInteractive executes an interactive command in a Docker container with TTY. This is a convenience wrapper for plugins.

func (*SDK) Execute

func (s *SDK) Execute()

Execute runs the plugin

func (*SDK) GetComponentManager added in v0.5.0

func (s *SDK) GetComponentManager() (*component.Manager, error)

GetComponentManager creates a component manager bound to the active sitectl context.

func (*SDK) GetContext

func (s *SDK) GetContext() (*config.Context, error)

GetContext loads the sitectl context configuration This is useful for plugins that need to access context-specific settings If no context is specified, returns the current context from config

func (*SDK) GetDockerClient

func (s *SDK) GetDockerClient() (*docker.DockerClient, error)

GetDockerClient creates a Docker client respecting the sitectl context This is a helper for plugins that need to interact with Docker Returns the existing DockerClient which handles both local and remote contexts

func (*SDK) GetFileAccessor added in v0.12.0

func (s *SDK) GetFileAccessor() (*FileAccessor, error)

func (*SDK) GetMetadataCommand

func (s *SDK) GetMetadataCommand() *cobra.Command

GetMetadataCommand returns a command that displays plugin metadata

func (*SDK) GetSSHClient added in v0.12.0

func (s *SDK) GetSSHClient() (*ssh.Client, error)

func (*SDK) InvokeIncludedPluginCommand added in v0.11.0

func (s *SDK) InvokeIncludedPluginCommand(pluginName string, args []string, opts CommandExecOptions) (string, error)

func (*SDK) InvokeIncludedPlugins added in v0.11.0

func (s *SDK) InvokeIncludedPlugins(args []string) ([]string, error)

func (*SDK) InvokePluginCommand added in v0.11.0

func (s *SDK) InvokePluginCommand(pluginName string, args []string, opts CommandExecOptions) (string, error)

func (*SDK) PromptAndSaveLocalContext added in v0.5.0

func (s *SDK) PromptAndSaveLocalContext(opts config.LocalContextCreateOptions) (*config.Context, error)

PromptAndSaveLocalContext creates or updates a local sitectl context using the shared config prompts and save behavior.

func (*SDK) RegisterContextJob added in v0.13.0

func (s *SDK) RegisterContextJob(spec job.Spec, runner ContextJob)

func (*SDK) RegisterContextValidator added in v0.9.0

func (s *SDK) RegisterContextValidator(validator validate.Validator)

func (*SDK) RegisterJob added in v0.13.0

func (s *SDK) RegisterJob(spec job.Spec, cmd *cobra.Command)

func (*SDK) SetVersionInfo added in v0.6.1

func (s *SDK) SetVersionInfo(version, commit, date string)

SetVersionInfo formats plugin version metadata like the main sitectl binary.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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