commands

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Overview

Package commands provides shared command factory functions and configuration types for CLIs that use the Deploy CLI SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunPreCommandStep

func RunPreCommandStep(
	step precommand.Step,
	confProvider *config.Provider,
	commandName string,
	styles *stylespkg.Styles,
	headless bool,
	writer io.Writer,
) error

RunPreCommandStep runs the pre-command step with visual progress feedback. In interactive mode, it runs a mini bubbletea program with a spinner. In headless mode, it writes structured progress to the writer. This runs before the main TUI starts, so the pre-command step can modify the deploy config that the TUI/engine will read.

func SetupCleanupCommand

func SetupCleanupCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)

SetupCleanupCommand registers a cleanup command on the root command, parameterized by CLIConfig for branding and defaults.

func SetupDeployCommand

func SetupDeployCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)

SetupDeployCommand registers a deploy command on the root command, parameterized by CLIConfig for branding and defaults.

func SetupDestroyCommand

func SetupDestroyCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)

SetupDestroyCommand registers a destroy command on the root command, parameterized by CLIConfig for branding and defaults.

func SetupInstancesCommand

func SetupInstancesCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)

SetupInstancesCommand registers an instances command with inspect and list subcommands on the root command, parameterized by CLIConfig for branding.

func SetupLogger

func SetupLogger(cliName string) (*zap.Logger, *os.File, error)

SetupLogger creates a zap logger instance that writes to a file named after the CLI (e.g. "celerity.log", "bluelink.log").

func SetupStageCommand

func SetupStageCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)

SetupStageCommand registers a stage command on the root command, parameterized by CLIConfig for branding and defaults.

func SetupStateCommand

func SetupStateCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)

SetupStateCommand registers a state command with import and export subcommands on the root command, parameterized by CLIConfig for branding.

Types

type CLIConfig

type CLIConfig struct {
	// CLIName is used in help text and log file naming (e.g. "celerity", "bluelink").
	CLIName string

	// EnvVarPrefix is prepended to environment variable names for config binding
	// (e.g. "CELERITY_CLI", "BLUELINK_CLI").
	EnvVarPrefix string

	// DefaultBlueprintFile is the default blueprint file name
	// (e.g. "app.blueprint.yaml", "project.blueprint.yaml").
	DefaultBlueprintFile string

	// DefaultDeployConfig is the default deploy configuration file name
	// (e.g. "celerity.deploy.json", "bluelink.deploy.json").
	DefaultDeployConfig string

	// DefaultConfigFile is the default CLI configuration file name
	// (e.g. "celerity.config.toml", "bluelink.config.toml").
	DefaultConfigFile string

	// Palette provides the color scheme for TUI styling.
	Palette styles.ColorPalette

	// PreflightFactory optionally creates a preflight check model
	// (e.g. plugin dependency verification). Nil to skip preflight checks.
	PreflightFactory PreflightFactory

	// PreCommandStep is called before stage/deploy commands interact with
	// the deploy engine. For example, Celerity uses this to trigger a build
	// step and inject build artifact context variables.
	// Nil to skip pre-command steps.
	PreCommandStep precommand.Step

	// EnableCodeOnlyApproval enables the --auto-approve-code-only flag on deploy.
	// When true, the flag is registered and the code-only approval logic is available.
	// This is intended for CLIs that use transformer plugins with resource category annotations.
	EnableCodeOnlyApproval bool
}

CLIConfig holds the configuration that differentiates one CLI from another when using shared deployment command factories.

type PreflightFactory

type PreflightFactory interface {
	// CreatePreflight creates a bubbletea model for preflight checks.
	// Returns nil if no preflight checks are needed.
	CreatePreflight(
		confProvider *config.Provider,
		commandName string,
		styles *styles.Styles,
		headless bool,
		writer io.Writer,
		jsonMode bool,
	) tea.Model
}

PreflightFactory creates a preflight check TUI model for plugin dependency verification or other pre-command checks.

Jump to

Keyboard shortcuts

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