core

package
v0.1.27-rc3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 31 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"
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 CheckForUpdates

func CheckForUpdates(currentVersion string)

func DocCmd

func DocCmd() *cobra.Command

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 GetAppURL

func GetAppURL() string

func GetBaseURL

func GetBaseURL() string

func GetClient

func GetClient() *sdk.ClientWithResponses

GetClient returns the current client

func GetCommand

func GetCommand(name string) *cobra.Command

GetCommand returns a registered command

func GetCommandSecrets

func GetCommandSecrets() []string

func GetCommit

func GetCommit() string

func GetDate

func GetDate() string

func GetEnvFiles

func GetEnvFiles() []string

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.

func GetOutputFormat

func GetOutputFormat() string

GetOutputFormat returns the current output format

func GetRegistryURL

func GetRegistryURL() string

func GetRunURL

func GetRunURL() string

func GetVersion

func GetVersion() string

func GetWorkspace

func GetWorkspace() string

GetWorkspace returns the current workspace

func LoadCommandSecrets

func LoadCommandSecrets(commandSecrets []string)

func ModuleLanguage

func ModuleLanguage(directory string) string

func Output

func Output(resource Resource, slices []interface{}, outputFormat string)

func ReadConfigToml

func ReadConfigToml(folder string)

func ReadSecrets

func ReadSecrets(folder string, envFiles []string)

func RegisterCommand

func RegisterCommand(name string, cmdFunc func() *cobra.Command)

RegisterCommand allows commands to register themselves

func SeedCache

func SeedCache(cwd string) error

func SetCommandSecrets

func SetCommandSecrets(secrets []string)

func SetEnvs

func SetEnvs()

func SetWorkspace

func SetWorkspace(ws string)

SetWorkspace sets the current workspace

Types

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

func GetConfig

func GetConfig() Config

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 GetSecrets

func GetSecrets() []Env

GetSecrets returns the current secrets

func GetUniqueEnvs

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) CliCommand

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

type Package

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

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
	WithImage  bool
}

func GetResources

func GetResources() []*Resource

GetResources returns the resources slice

func (*Resource) ListExec

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

ListExec method for Resource

func (*Resource) PostFn

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

PostFn method for Resource - placeholder implementation

func (*Resource) PutFn

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

PutFn method for Resource - placeholder implementation

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

func GetResults(action string, filePath string, recursive bool) ([]Result, error)

GetResults is a public wrapper for getResults

func (*Result) ToString

func (r *Result) ToString() string

type ResultMetadata

type ResultMetadata struct {
	Workspace string
	Name      string
}

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
}

func CreateDefaultTemplateOptions

func CreateDefaultTemplateOptions(directory, templateName string, templates Templates) TemplateOptions

CreateDefaultTemplateOptions creates default options when template is specified via flag

type Templates

type Templates []Template

func RetrieveTemplates

func RetrieveTemplates(templateType string) (Templates, error)

func (Templates) FilterByLanguage

func (t Templates) FilterByLanguage(language string) Templates

func (Templates) Find

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

func (Templates) GetLanguages

func (t Templates) GetLanguages() []string

Jump to

Keyboard shortcuts

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