cli

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APP_URL = "https://app.blaxel.ai"
View Source
var BASE_URL = "https://api.blaxel.ai/v0"
View Source
var GITHUB_RELEASES_URL = "https://api.github.com/repos/blaxel-ai/toolkit/releases/latest"
View Source
var REGISTRY_URL = "https://us.registry.blaxel.ai"
View Source
var RUN_URL = "https://run.blaxel.ai"
View Source
var UPDATE_CLI_DOC_URL = "https://docs.blaxel.ai/cli-reference/introduction#update"

Functions

func CheckWorkspaceAccess

func CheckWorkspaceAccess(workspaceName string, credentials sdk.Credentials) (sdk.Workspace, error)

func ErrorHandler

func ErrorHandler(request *http.Request, kind string, name string, body string) error

func Execute

func Execute(releaseVersion string, releaseCommit string, releaseDate string) error

func GetHuhTheme

func GetHuhTheme() *huh.Theme

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.

Types

type ApplyOption

type ApplyOption func(*applyOptions)

ApplyOption defines a function type for apply options

func WithRecursive

func WithRecursive(recursive bool) ApplyOption

WithRecursive sets the recursive option

type ApplyResult

type ApplyResult struct {
	Kind   string
	Name   string
	Result ResourceOperationResult
}

type CommandEnv

type CommandEnv map[string]string

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"`
	SkipRoot   bool                      `toml:"skipRoot"`
	Runtime    *map[string]interface{}   `toml:"runtime"`
	Triggers   *[]map[string]interface{} `toml:"triggers"`
	Policies   []string                  `toml:"policies,omitempty"`
}

readConfigToml reads the config.toml file and upgrade config according to content

type Deployment

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

func (*Deployment) Apply

func (d *Deployment) Apply() error

func (*Deployment) Generate

func (d *Deployment) Generate() error

func (*Deployment) GenerateDeployment

func (d *Deployment) GenerateDeployment() Result

func (*Deployment) IgnoredPaths

func (d *Deployment) IgnoredPaths() []string

func (*Deployment) Print

func (d *Deployment) Print() error

func (*Deployment) PrintZip

func (d *Deployment) PrintZip() error

func (*Deployment) Ready added in v0.1.15

func (d *Deployment) Ready()

func (*Deployment) Upload

func (d *Deployment) Upload(url string) error

func (*Deployment) Zip

func (d *Deployment) Zip() error

type Entrypoints

type Entrypoints struct {
	Production  string `toml:"prod"`
	Development string `toml:"dev"`
}

type Env

type Env struct {
	Name  string
	Value string
}

func GetEnvs

func GetEnvs() []Env

func GetUniqueEnvs added in v0.1.14

func GetUniqueEnvs() []Env

type Envs

type Envs map[string]string

type ErrorModel

type ErrorModel struct {
	Error string   `json:"error"`
	Code  int      `json:"code"`
	Stack []string `json:"stack"`
}

type IgnoreDir

type IgnoreDir struct {
	Folder string
	Skip   string
}

type IgnoreFile

type IgnoreFile struct {
	File string
	Skip string
}

type NameRetriever

type NameRetriever struct {
	Metadata struct {
		Name string `yaml:"name"`
	} `yaml:"metadata"`
}

type Operations

type Operations struct {
	BaseURL     string
	RunURL      string
	AppURL      string
	RegistryURL string
}

func (*Operations) ApiKeyLogin

func (r *Operations) ApiKeyLogin(workspace string)

func (*Operations) Apply

func (r *Operations) Apply(filePath string, opts ...ApplyOption) ([]ApplyResult, error)

func (*Operations) ApplyCmd

func (r *Operations) ApplyCmd() *cobra.Command

func (*Operations) ApplyResources

func (r *Operations) ApplyResources(results []Result) ([]ApplyResult, error)

func (*Operations) BootChat

func (r *Operations) BootChat(
	ctx context.Context,
	workspace string,
	resourceType string,
	resourceName string,
	debug bool,
	local bool,
	headerFlags []string,
) error

func (*Operations) Chat

func (r *Operations) Chat(
	ctx context.Context,
	workspace string,
	resourceType string,
	resourceName string,
	debug bool,
	local bool,
	headerFlags []string,
) error

func (*Operations) ChatCmd

func (r *Operations) ChatCmd() *cobra.Command

func (*Operations) CheckResource

func (r *Operations) CheckResource(
	ctx context.Context,
	workspace string,
	resourceType string,
	resourceName string,
) error

func (*Operations) CliCommand

func (r *Operations) CliCommand(ctx context.Context, operationId string, fn interface{})

func (*Operations) ClientCredentialsLogin

func (r *Operations) ClientCredentialsLogin(workspace string, clientCredentials string)

func (*Operations) CreateAgentAppCmd

func (r *Operations) CreateAgentAppCmd() *cobra.Command

CreateAgentAppCmd returns a cobra.Command that implements the 'create-agent-app' CLI command. The command creates a new Blaxel agent app in the specified directory after collecting necessary configuration through an interactive prompt. Usage: bl create-agent-app directory

func (*Operations) CreateJobCmd added in v0.1.15

func (r *Operations) CreateJobCmd() *cobra.Command

CreateJobCmd returns a cobra.Command that implements the 'create-job' CLI command. The command creates a new Blaxel job in the specified directory after collecting necessary configuration through an interactive prompt. Usage: bl create-job directory

func (*Operations) CreateMCPServerCmd

func (r *Operations) CreateMCPServerCmd() *cobra.Command

CreateMCPServerCmd returns a cobra.Command that implements the 'create-mcpserver' CLI command. The command creates a new Blaxel mcp server in the specified directory after collecting necessary configuration through an interactive prompt. Usage: bl create-mcpserver directory

func (*Operations) DeleteCmd

func (r *Operations) DeleteCmd() *cobra.Command

func (*Operations) DeployCmd

func (r *Operations) DeployCmd() *cobra.Command

func (*Operations) DeviceModeLogin

func (r *Operations) DeviceModeLogin(workspace string)

func (*Operations) DeviceModeLoginFinalize

func (r *Operations) DeviceModeLoginFinalize(deviceCode string, workspace string)

func (*Operations) DocCmd

func (r *Operations) DocCmd() *cobra.Command

func (*Operations) GetCmd

func (r *Operations) GetCmd() *cobra.Command

func (*Operations) GetRegistryURL

func (r *Operations) GetRegistryURL() string

func (*Operations) ListOrSetWorkspacesCmd

func (r *Operations) ListOrSetWorkspacesCmd() *cobra.Command

func (*Operations) LoginCmd

func (r *Operations) LoginCmd() *cobra.Command

func (*Operations) LogoutCmd

func (r *Operations) LogoutCmd() *cobra.Command

func (*Operations) RunCmd

func (r *Operations) RunCmd() *cobra.Command

func (*Operations) SeedCache

func (r *Operations) SeedCache(cwd string) error

func (*Operations) SendMessage

func (r *Operations) SendMessage(
	ctx context.Context,
	workspace string,
	resourceType string,
	resourceName string,
	message string,
	debug bool,
	local bool,
	headers []string,
) (string, error)

func (*Operations) ServeCmd

func (r *Operations) ServeCmd() *cobra.Command

func (*Operations) SetBaseURL

func (r *Operations) SetBaseURL(url string)

func (*Operations) VersionCmd

func (r *Operations) VersionCmd() *cobra.Command

type Package

type Package struct {
	Path string `toml:"path"`
	Port int    `toml:"port,omitempty"`
	Type string `toml:"type,omitempty"`
}

type PackageCommand

type PackageCommand struct {
	Name    string
	Cwd     string
	Command string
	Args    []string
	Color   string
	Envs    CommandEnv
}

type PackageJson

type PackageJson struct {
	Scripts map[string]string `json:"scripts"`
}

type RegisterImpl

type RegisterImpl struct {
}

type Resource

type Resource struct {
	Kind       string
	Short      string
	Plural     string
	Singular   string
	SpecType   reflect.Type
	List       interface{}
	Get        interface{}
	Delete     interface{}
	Put        interface{}
	Post       interface{}
	WithStatus bool
}

func (Resource) DeleteFn

func (resource Resource) DeleteFn(name string)

func (Resource) GetFn

func (resource Resource) GetFn(name string)

func (Resource) ListExec

func (resource Resource) ListExec() ([]interface{}, error)

func (Resource) ListFn

func (resource Resource) ListFn()

func (Resource) PostFn

func (resource Resource) PostFn(resourceName string, name string, resourceObject interface{}) *ResourceOperationResult

func (Resource) PutFn

func (resource Resource) PutFn(resourceName string, name string, resourceObject interface{}) *ResourceOperationResult

type ResourceOperationResult

type ResourceOperationResult struct {
	Status    string
	UploadURL string
}

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 (*Result) ToString

func (r *Result) ToString() string

type ResultMetadata

type ResultMetadata struct {
	Workspace string
	Name      string
}

type RootCmdConfig

type RootCmdConfig struct {
	Hotreload  bool
	Production bool
	Docker     bool
	Entrypoint Entrypoints
	Envs       CommandEnv
}

type Secrets

type Secrets []Env

readSecret from .env file at root of project

type Template

type Template struct {
	sdk.Template
	Language string
	Type     string
}

func (Template) Clone

func (t Template) Clone(opts TemplateOptions) error

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
}

type Templates

type Templates []Template

func RetrieveTemplates

func RetrieveTemplates(templateType string) (Templates, error)

func (Templates) Find added in v0.1.15

func (t Templates) Find(name string) (Template, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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