Documentation
¶
Index ¶
- Constants
- Variables
- func BuildServerEnvWarning(language string, resourceType string) string
- func CaptureException(err error)
- func CheckForUpdates(currentVersion string)
- func CheckServerEnvUsage(folder string, language string) bool
- func CleanTemplate(dir string)
- func ClearBlaxelTomlWarning()
- func CloneTemplateWithSpinner(opts TemplateOptions, templates Templates, noTTY bool, errorPrefix string, ...) error
- func ConvertRuntimeTimeouts(runtime map[string]interface{}) error
- func ConvertTriggersTimeouts(triggers *[]map[string]interface{}) error
- func DocCmd() *cobra.Command
- func EditBlaxelTomlInCurrentDir(resourceType string, resourceName string, resourcePath string) error
- func ErrorHandler(request *http.Request, kind string, name string, body string) error
- func Execute(releaseVersion string, releaseCommit string, releaseDate string) error
- func Exit(code int)
- func ExitWithError(err error)
- func ExitWithMessage(msg string)
- func FlushSentry(timeout time.Duration)
- func GetAppURL() string
- func GetBaseURL() string
- func GetBlaxelTomlWarning() string
- func GetClient() *sdk.ClientWithResponses
- func GetCommand(name string) *cobra.Command
- func GetCommandSecrets() []string
- func GetCommit() string
- func GetDate() string
- func GetDependencyManager(language, directory string) (string, string)
- func GetDeployDocURL(resourceType string) string
- func GetEnvFiles() []string
- func GetHuhTheme() *huh.Theme
- func GetOutputFormat() string
- func GetRegistryURL() string
- func GetRunURL() string
- func GetVerbose() bool
- func GetVersion() string
- func GetWorkspace() string
- func HasGoEntryFile(directory string) bool
- func HasPythonEntryFile(directory string) bool
- func HasTypeScriptEntryFile(directory string) bool
- func InitSentry(cfg SentryConfig) error
- func IsCIEnvironment() bool
- func IsInteractiveMode() bool
- func IsTerminalInteractive() bool
- func IsVolumeTemplate(resourceType string) bool
- func LoadCommandSecrets(commandSecrets []string)
- func LookupSecret(name string) string
- func ModuleLanguage(directory string) string
- func Output(resource Resource, slices []interface{}, outputFormat string)
- func ParseDuration(duration string) (time.Duration, error)
- func ParseDurationToSeconds(duration string) (int, error)
- func Pluralize(word string) string
- func Print(message string)
- func PrintError(operation string, err error)
- func PrintInfo(message string)
- func PrintInfoWithCommand(message string, command string)
- func PrintSuccess(message string)
- func PrintWarning(message string)
- func PromptForDeploymentType() string
- func ReadConfigToml(folder string, setDefaultType bool)
- func ReadSecrets(folder string, envFiles []string)
- func RecoverWithSentry()
- func RegisterCommand(name string, cmdFunc func() *cobra.Command)
- func RunAgentAppCreation(dirArg string, templateName string, noTTY bool)
- func RunInstallationWithTea(t Template, opts TemplateOptions) error
- func RunJobCreation(dirArg string, templateName string, noTTY bool)
- func RunMCPCreation(dirArg string, templateName string, noTTY bool)
- func RunSandboxCreation(dirArg string, templateName string, noTTY bool)
- func RunVolumeTemplateCreation(dirArg string, templateName string, noTTY bool)
- func SeedCache(cwd string) error
- func SetCommandSecrets(secrets []string)
- func SetConfigType(t string)
- func SetEnvs()
- func SetInteractiveMode(interactive bool)
- func SetSentryTag(key, value string)
- func SetWorkspace(ws string)
- func Slugify(s string) string
- type CommandEnv
- type Config
- type CreateFlowConfig
- type Entrypoints
- type Env
- type Envs
- type ErrorModel
- type Field
- type IgnoreDir
- type IgnoreFile
- type Model
- type NameRetriever
- type Operations
- type Package
- type Resource
- type Result
- type ResultMetadata
- type Secrets
- type SentryConfig
- type Status
- type Step
- type Template
- type TemplateOptions
- type Templates
Constants ¶
const MaxDurationSeconds = 365 * 24 * 60 * 60 // 31,536,000 seconds
MaxDurationSeconds is the maximum allowed duration in seconds (1 year). This prevents integer overflow attacks with absurdly large timeout values.
Variables ¶
var APP_URL = "https://app.blaxel.ai"
var BASE_URL = "https://api.blaxel.ai/v0"
var GITHUB_RELEASES_URL = "https://api.github.com/repos/blaxel-ai/toolkit/releases"
var REGISTRY_URL = "https://us.registry.blaxel.ai"
var RUN_URL = "https://run.blaxel.ai"
var SentryDSN = ""
SentryDSN is the default Sentry DSN for the CLI
var UPDATE_CLI_DOC_URL = "https://docs.blaxel.ai/cli-reference/introduction#update"
Functions ¶
func BuildServerEnvWarning ¶ added in v0.1.65
BuildServerEnvWarning returns a formatted warning message with language-specific sample code for using HOST and PORT environment variables.
func CaptureException ¶ added in v0.1.62
func CaptureException(err error)
CaptureException captures an error and sends it to Sentry
func CheckForUpdates ¶
func CheckForUpdates(currentVersion string)
func CheckServerEnvUsage ¶ added in v0.1.65
CheckServerEnvUsage scans project files to check if the code uses HOST/PORT or BL_SERVER_HOST/BL_SERVER_PORT environment variables. Returns true if any of these patterns are found in the code.
func CleanTemplate ¶ added in v0.1.34
func CleanTemplate(dir string)
func ClearBlaxelTomlWarning ¶ added in v0.1.62
func ClearBlaxelTomlWarning()
ClearBlaxelTomlWarning clears the blaxel.toml warning
func CloneTemplateWithSpinner ¶ added in v0.1.34
func CloneTemplateWithSpinner(opts TemplateOptions, templates Templates, noTTY bool, errorPrefix string, spinnerTitle string) error
CloneTemplateWithSpinner clones a template with optional spinner based on noTTY flag
func ConvertRuntimeTimeouts ¶ added in v0.1.71
ConvertRuntimeTimeouts converts human-readable timeout values in a runtime config to seconds. This modifies the runtime map in place, converting string timeout values to integers.
func ConvertTriggersTimeouts ¶ added in v0.1.71
ConvertTriggersTimeouts converts human-readable timeout values in triggers config to seconds. This modifies the triggers slice in place, converting string timeout values to integers.
func EditBlaxelTomlInCurrentDir ¶ added in v0.1.34
func EditBlaxelTomlInCurrentDir(resourceType string, resourceName string, resourcePath string) error
editBlaxelTomlInCurrentDir checks if blaxel.toml exists in the current working directory and appends text to it. If the file doesn't exist, it returns without error.
func ErrorHandler ¶
func Exit ¶ added in v0.1.62
func Exit(code int)
Exit captures to Sentry and exits with the given code
func ExitWithError ¶ added in v0.1.62
func ExitWithError(err error)
ExitWithError captures the error to Sentry and exits with code 1
func ExitWithMessage ¶ added in v0.1.62
func ExitWithMessage(msg string)
ExitWithMessage captures a message to Sentry and exits with code 1
func FlushSentry ¶ added in v0.1.62
FlushSentry flushes buffered events before the program exits
func GetBaseURL ¶
func GetBaseURL() string
func GetBlaxelTomlWarning ¶ added in v0.1.62
func GetBlaxelTomlWarning() string
GetBlaxelTomlWarning returns any warning from parsing blaxel.toml
func GetCommand ¶
GetCommand returns a registered command
func GetCommandSecrets ¶
func GetCommandSecrets() []string
func GetDependencyManager ¶ added in v0.1.34
GetDependencyManager returns the dependency manager and version for a given language
func GetDeployDocURL ¶ added in v0.1.65
GetDeployDocURL returns the documentation URL for deploying a specific resource type
func GetEnvFiles ¶
func GetEnvFiles() []string
func GetHuhTheme ¶
getTheme returns a custom theme configuration for the CLI interface using the Dracula color scheme. It customizes various UI elements like buttons, text inputs, and selection indicators.
func GetOutputFormat ¶
func GetOutputFormat() string
GetOutputFormat returns the current output format
func GetRegistryURL ¶
func GetRegistryURL() string
func GetVerbose ¶ added in v0.1.57
func GetVerbose() bool
func GetVersion ¶
func GetVersion() string
func HasGoEntryFile ¶ added in v0.1.59
HasGoEntryFile checks if common Go entry files exist in the given directory
func HasPythonEntryFile ¶ added in v0.1.59
HasPythonEntryFile checks if common Python entry files exist in the given directory
func HasTypeScriptEntryFile ¶ added in v0.1.59
HasTypeScriptEntryFile checks if common TypeScript/JavaScript entry files exist in the given directory or if package.json has a start script defined
func InitSentry ¶ added in v0.1.62
func InitSentry(cfg SentryConfig) error
InitSentry initializes the Sentry SDK with the given configuration
func IsCIEnvironment ¶ added in v0.1.44
func IsCIEnvironment() bool
IsCIEnvironment returns true when running in a known CI environment. It checks common CI environment variables used by providers like GitHub and GitLab.
func IsInteractiveMode ¶ added in v0.1.44
func IsInteractiveMode() bool
func IsTerminalInteractive ¶ added in v0.1.44
func IsTerminalInteractive() bool
IsTerminalInteractive returns true if both stdin and stdout are terminals (TTY).
func IsVolumeTemplate ¶ added in v0.1.46
func LoadCommandSecrets ¶
func LoadCommandSecrets(commandSecrets []string)
func LookupSecret ¶ added in v0.1.33
func ModuleLanguage ¶
func ParseDuration ¶ added in v0.1.71
ParseDuration parses a human-readable duration string and returns a time.Duration. Supported formats: "30s", "5m", "1h", "2d", "1w" (seconds, minutes, hours, days, weeks) Also accepts plain integers (interpreted as seconds). Maximum allowed duration is 1 year to prevent overflow.
func ParseDurationToSeconds ¶ added in v0.1.71
ParseDurationToSeconds parses a human-readable duration string and returns the number of seconds. Supported formats: "30s", "5m", "1h", "2d", "1w" (seconds, minutes, hours, days, weeks) Also accepts plain integers (interpreted as seconds). Returns the value in seconds and any error encountered. Maximum allowed duration is 1 year (31,536,000 seconds) to prevent overflow.
func PrintError ¶ added in v0.1.34
PrintError prints a formatted error message with colors
func PrintInfoWithCommand ¶ added in v0.1.70
PrintInfoWithCommand prints an info message followed by a command in white
func PrintSuccess ¶ added in v0.1.34
func PrintSuccess(message string)
PrintSuccess prints a formatted success message with colors
func PrintWarning ¶ added in v0.1.34
func PrintWarning(message string)
PrintWarning prints a formatted warning message with colors
func PromptForDeploymentType ¶ added in v0.1.59
func PromptForDeploymentType() string
promptForDeploymentType prompts the user to select what they want to deploy when no blaxel.toml file is found
func ReadConfigToml ¶
func ReadSecrets ¶
func RecoverWithSentry ¶ added in v0.1.62
func RecoverWithSentry()
RecoverWithSentry recovers from a panic and sends it to Sentry Usage: defer core.RecoverWithSentry()
func RegisterCommand ¶
RegisterCommand allows commands to register themselves
func RunAgentAppCreation ¶ added in v0.1.65
RunAgentAppCreation is a reusable wrapper that executes the agent creation flow. It can be called by both the dedicated command and the unified `bl new` command.
func RunInstallationWithTea ¶ added in v0.1.34
func RunInstallationWithTea(t Template, opts TemplateOptions) error
RunInstallationWithTea runs the installation process with Bubble Tea UI
func RunJobCreation ¶ added in v0.1.65
RunJobCreation is a reusable wrapper that executes the job creation flow.
func RunMCPCreation ¶ added in v0.1.65
RunMCPCreation is a reusable wrapper that executes the MCP server creation flow.
func RunSandboxCreation ¶ added in v0.1.65
RunSandboxCreation is a reusable wrapper that executes the sandbox creation flow.
func RunVolumeTemplateCreation ¶ added in v0.1.65
RunVolumeTemplateCreation is a reusable wrapper that executes the volume template creation flow.
func SetCommandSecrets ¶
func SetCommandSecrets(secrets []string)
func SetConfigType ¶ added in v0.1.59
func SetConfigType(t string)
SetConfigType sets the config type
func SetInteractiveMode ¶ added in v0.1.44
func SetInteractiveMode(interactive bool)
func SetSentryTag ¶ added in v0.1.62
func SetSentryTag(key, value string)
SetSentryTag sets a tag on the current scope
Types ¶
type CommandEnv ¶
func (*CommandEnv) AddClientEnv ¶
func (c *CommandEnv) AddClientEnv()
func (*CommandEnv) Set ¶
func (c *CommandEnv) Set(key, value string)
func (*CommandEnv) ToEnv ¶
func (c *CommandEnv) ToEnv() []string
type Config ¶
type Config struct {
Name string `toml:"name"`
Workspace string `toml:"workspace"`
Type string `toml:"type"`
Protocol string `toml:"protocol"`
Functions []string `toml:"functions"`
Models []string `toml:"models"`
Agents []string `toml:"agents"`
Entrypoint Entrypoints `toml:"entrypoint"`
Env Envs `toml:"env"`
Function map[string]Package `toml:"function"`
Agent map[string]Package `toml:"agent"`
Job map[string]Package `toml:"job"`
SkipRoot bool `toml:"skipRoot"`
Runtime *map[string]interface{} `toml:"runtime"`
Triggers *[]map[string]interface{} `toml:"triggers"`
Volumes *[]map[string]interface{} `toml:"volumes,omitempty"`
Policies []string `toml:"policies,omitempty"`
DefaultSize *int `toml:"defaultSize,omitempty"`
Directory string `toml:"directory,omitempty"`
Region string `toml:"region,omitempty"`
}
readConfigToml reads the config.toml file and upgrade config according to content
type CreateFlowConfig ¶ added in v0.1.39
type CreateFlowConfig struct {
// Template topic used to filter templates: e.g., "agent", "job", "mcp", "sandbox".
TemplateType string
// Non-interactive flag; true means skip TTY UI and use defaults.
NoTTY bool
// Name used for progress/error messages, like "Agent creation".
ErrorPrefix string
// One-line spinner title while cloning, like "Creating your blaxel agent app...".
SpinnerTitle string
// Optional: when set, append a section to blaxel.toml with this resource type (e.g., "agent" or "function").
BlaxelTomlResourceType string
}
CreateFlowConfig captures the knobs that differ between create commands.
type Entrypoints ¶
type Env ¶
func GetUniqueEnvs ¶
func GetUniqueEnvs() []Env
type ErrorModel ¶
type IgnoreFile ¶
type Model ¶ added in v0.1.34
type Model struct {
// contains filtered or unexported fields
}
Model holds the state of our installation UI
func NewInstallationModel ¶ added in v0.1.34
func NewInstallationModel() Model
NewInstallationModel creates a new installation progress model
func (*Model) CompleteStep ¶ added in v0.1.34
type NameRetriever ¶
type NameRetriever struct {
Metadata struct {
Name string `yaml:"name"`
} `yaml:"metadata"`
}
type Operations ¶
func (*Operations) CliCommand ¶
func (o *Operations) CliCommand(ctx context.Context, operationId string, fn interface{})
type Resource ¶
type Resource struct {
Kind string
Short string
Plural string
Singular string
Aliases []string
SpecType reflect.Type
List interface{}
Get interface{}
Delete interface{}
Put interface{}
Post interface{}
Fields []Field // ordered slice of fields - e.g., {Key: "STATUS", Value: "status"}
}
type Result ¶
type Result struct {
ApiVersion string `yaml:"apiVersion" json:"apiVersion"`
Kind string `yaml:"kind" json:"kind"`
Metadata interface{} `yaml:"metadata" json:"metadata"`
Spec interface{} `yaml:"spec" json:"spec"`
Status string `yaml:"status,omitempty" json:"status,omitempty"`
}
func GetResults ¶
GetResults is a public wrapper for getResults
type ResultMetadata ¶
type SentryConfig ¶ added in v0.1.62
SentryConfig holds the configuration for Sentry initialization
type TemplateOptions ¶
type TemplateOptions struct {
Directory string // Target directory for the new agent app
ProjectName string // Name of the project
ProjectPrompt string // Description of the project
Language string // Language to use for the project
TemplateName string // Name of the template to use for the project
Author string // Author of the project
}
func CreateDefaultTemplateOptions ¶
func CreateDefaultTemplateOptions(directory, templateName string, templates Templates) TemplateOptions
CreateDefaultTemplateOptions creates default options when template is specified via flag
func PromptTemplateOptions ¶ added in v0.1.39
func PromptTemplateOptions(directory string, templates Templates, resource string, includeLanguage bool, templateHeight int) TemplateOptions
PromptTemplateOptions presents a unified interactive form to collect TemplateOptions. It can optionally include a language selector and will always include a template selector. The name field is included only when directory is empty. resource is used in messages, e.g. "agent app", "job", "mcp server".
type Templates ¶
type Templates []Template
func RetrieveTemplates ¶
func RetrieveTemplatesWithSpinner ¶ added in v0.1.34
func RetrieveTemplatesWithSpinner(templateType string, noTTY bool, errorPrefix string) (Templates, error)
RetrieveTemplatesWithSpinner retrieves templates with optional spinner based on noTTY flag