{"modulePath":"github.com/newstack-cloud/deploy-cli-sdk","version":"v0.10.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package commands\n\nPackage commands provides shared command factory functions and configuration types for CLIs that use the Deploy CLI SDK.\n\n## Functions\n\n```go\nfunc RunPreCommandStep(\n\tctx context.Context,\n\tstep precommand.Step,\n\tconfProvider *config.Provider,\n\tcommandName string,\n\tstyles *stylespkg.Styles,\n\theadless bool,\n\twriter io.Writer,\n) error\n```\nRunPreCommandStep 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.\n\n```go\nfunc SetupCleanupCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)\n```\nSetupCleanupCommand registers a cleanup command on the root command, parameterized by CLIConfig for branding and defaults.\n\n```go\nfunc SetupDeployCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)\n```\nSetupDeployCommand registers a deploy command on the root command, parameterized by CLIConfig for branding and defaults.\n\n```go\nfunc SetupDestroyCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)\n```\nSetupDestroyCommand registers a destroy command on the root command, parameterized by CLIConfig for branding and defaults.\n\n```go\nfunc SetupInstancesCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)\n```\nSetupInstancesCommand registers an instances command with inspect and list subcommands on the root command, parameterized by CLIConfig for branding.\n\n```go\nfunc SetupLogger(cliName string) (*zap.Logger, *os.File, error)\n```\nSetupLogger creates a zap logger instance that writes to a file named after the CLI (e.g. \"celerity.log\", \"bluelink.log\").\n\n```go\nfunc SetupStageCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)\n```\nSetupStageCommand registers a stage command on the root command, parameterized by CLIConfig for branding and defaults.\n\n```go\nfunc SetupStateCommand(rootCmd *cobra.Command, confProvider *config.Provider, cfg *CLIConfig)\n```\nSetupStateCommand registers a state command with import and export subcommands on the root command, parameterized by CLIConfig for branding.\n\n## Types\n\n```go\ntype CLIConfig struct {\n\t// CLIName is used in help text and log file naming (e.g. \"celerity\", \"bluelink\").\n\tCLIName string\n\n\t// EnvVarPrefix is prepended to environment variable names for config binding\n\t// (e.g. \"CELERITY_CLI\", \"BLUELINK_CLI\").\n\tEnvVarPrefix string\n\n\t// DefaultBlueprintFile is the default blueprint file name\n\t// (e.g. \"app.blueprint.yaml\", \"project.blueprint.yaml\").\n\tDefaultBlueprintFile string\n\n\t// DefaultDeployConfig is the default deploy configuration file name\n\t// (e.g. \"celerity.deploy.json\", \"bluelink.deploy.json\").\n\tDefaultDeployConfig string\n\n\t// DefaultConfigFile is the default CLI configuration file name\n\t// (e.g. \"celerity.config.toml\", \"bluelink.config.toml\").\n\tDefaultConfigFile string\n\n\t// Palette provides the color scheme for TUI styling.\n\tPalette styles.ColorPalette\n\n\t// PreflightFactory optionally creates a preflight check model\n\t// (e.g. plugin dependency verification). Nil to skip preflight checks.\n\tPreflightFactory PreflightFactory\n\n\t// PreCommandStep is called before stage/deploy commands interact with\n\t// the deploy engine. For example, Celerity uses this to trigger a build\n\t// step and inject build artifact context variables.\n\t// Nil to skip pre-command steps.\n\tPreCommandStep precommand.Step\n\n\t// EnableCodeOnlyApproval enables the --auto-approve-code-only flag on deploy.\n\t// When true, the flag is registered and the code-only approval logic is available.\n\t// This is intended for CLIs that use transformer plugins with resource category annotations.\n\tEnableCodeOnlyApproval bool\n}\n```\nCLIConfig holds the configuration that differentiates one CLI from another when using shared deployment command factories.\n\n```go\ntype PreflightFactory interface {\n\t// CreatePreflight creates a bubbletea model for preflight checks.\n\t// Returns nil if no preflight checks are needed. The context should be\n\t// bound to any long-running work the preflight model performs (e.g. plugin\n\t// dependency resolution/installation) so it is cancellable.\n\tCreatePreflight(\n\t\tctx context.Context,\n\t\tconfProvider *config.Provider,\n\t\tcommandName string,\n\t\tstyles *styles.Styles,\n\t\theadless bool,\n\t\twriter io.Writer,\n\t\tjsonMode bool,\n\t) tea.Model\n}\n```\nPreflightFactory creates a preflight check TUI model for plugin dependency verification or other pre-command checks.\n\n","path":"github.com/newstack-cloud/deploy-cli-sdk/commands","name":"commands","synopsis":"Package commands provides shared command factory functions and configuration types for CLIs that use the Deploy CLI SDK.","isRedistributable":true}
