Documentation
¶
Overview ¶
Package commands provides shared command factory functions and configuration types for CLIs that use the Deploy CLI SDK.
Index ¶
- func RunPreCommandStep(step precommand.Step, confProvider *config.Provider, commandName string, ...) error
- func SetupCleanupCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)
- func SetupDeployCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)
- func SetupDestroyCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)
- func SetupInstancesCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)
- func SetupLogger(cliName string) (*zap.Logger, *os.File, error)
- func SetupStageCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)
- func SetupStateCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)
- type CLIConfig
- type PreflightFactory
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 ¶
SetupCleanupCommand registers a cleanup command on the root command, parameterized by CLIConfig for branding and defaults.
func SetupDeployCommand ¶
SetupDeployCommand registers a deploy command on the root command, parameterized by CLIConfig for branding and defaults.
func SetupDestroyCommand ¶
SetupDestroyCommand registers a destroy command on the root command, parameterized by CLIConfig for branding and defaults.
func SetupInstancesCommand ¶
SetupInstancesCommand registers an instances command with inspect and list subcommands on the root command, parameterized by CLIConfig for branding.
func SetupLogger ¶
SetupLogger creates a zap logger instance that writes to a file named after the CLI (e.g. "celerity.log", "bluelink.log").
func SetupStageCommand ¶
SetupStageCommand registers a stage command on the root command, parameterized by CLIConfig for branding and defaults.
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.