project

package
v0.0.55 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version string

Functions

func DeleteProjects added in v0.0.23

func DeleteProjects(logger logger.Logger, baseUrl string, token string, ids []string) ([]string, error)

func ProjectExists

func ProjectExists(dir string) bool

func ProjectWithNameExists added in v0.0.23

func ProjectWithNameExists(logger logger.Logger, baseUrl string, token string, name string) (bool, error)

func ResolveProjectDir added in v0.0.42

func ResolveProjectDir(logger logger.Logger, cmd *cobra.Command) string

Types

type AgentBundlerConfig added in v0.0.23

type AgentBundlerConfig struct {
	Dir string `yaml:"dir" json:"dir"`
}

type AgentConfig added in v0.0.23

type AgentConfig struct {
	ID          string `json:"id" yaml:"id" hc:"The ID of the Agent which is automatically generated"`
	Name        string `json:"name" yaml:"name" hc:"The name of the Agent which is editable"`
	Description string `json:"description,omitempty" yaml:"description,omitempty" hc:"The description of the Agent which is editable"`
}

type Bundler added in v0.0.17

type Bundler struct {
	Enabled     bool               `yaml:"enabled" json:"enabled"`
	Identifier  string             `yaml:"identifier" json:"identifier"`
	Language    string             `yaml:"language" json:"language"`
	Framework   string             `yaml:"framework,omitempty" json:"framework,omitempty"`
	Runtime     string             `yaml:"runtime,omitempty" json:"runtime,omitempty"`
	AgentConfig AgentBundlerConfig `yaml:"agents" json:"agents"`
	Ignore      []string           `yaml:"ignore,omitempty" json:"ignore,omitempty"`
	CLIVersion  string             `yaml:"-" json:"-"`
}

type CleanupFunc

type CleanupFunc func()

type Deployment

type Deployment struct {
	Command   string     `json:"command" yaml:"command"`
	Args      []string   `json:"args" yaml:"args"`
	Resources *Resources `json:"resources" yaml:"resources" hc:"You should tune the resources for the deployment"`
}

type DeploymentConfig

type DeploymentConfig struct {
	Provider   string   `yaml:"provider" json:"provider"`
	Language   string   `yaml:"language" json:"language"`
	Runtime    string   `yaml:"runtime,omitempty" json:"runtime,omitempty"`
	MinVersion string   `yaml:"min_version,omitempty" json:"min_version,omitempty"` // FIXME
	WorkingDir string   `yaml:"working_dir,omitempty" json:"working_dir,omitempty"`
	Command    []string `yaml:"command,omitempty" json:"command,omitempty"`
	Env        []string `yaml:"env,omitempty" json:"env,omitempty"`
}

func NewDeploymentConfig

func NewDeploymentConfig() *DeploymentConfig

func (*DeploymentConfig) Write

func (c *DeploymentConfig) Write(logger logger.Logger, dir string) (CleanupFunc, error)

type Development added in v0.0.23

type Development struct {
	Port    int      `` /* 135-byte string literal not displayed */
	Watch   Watch    `json:"watch" yaml:"watch"`
	Command string   `json:"command" yaml:"command" hc:"The command to run the development server"`
	Args    []string `json:"args" yaml:"args" hc:"The arguments to pass to the development server"`
}

type InitProjectArgs

type InitProjectArgs struct {
	BaseURL           string
	Dir               string
	Token             string
	OrgId             string
	Provider          string
	Name              string
	Description       string
	EnableWebhookAuth bool
	AgentName         string
	AgentDescription  string
	AgentID           string
}

type Project

type Project struct {
	Version     string        `json:"version" yaml:"version" hc:"The version semver range required to run this project"`
	ProjectId   string        `json:"project_id" yaml:"project_id" hc:"The ID of the project which is automatically generated"`
	Name        string        `json:"name" yaml:"name" hc:"The name of the project which is editable"`
	Description string        `json:"description" yaml:"description" hc:"The description of the project which is editable"`
	Development *Development  `json:"development,omitempty" yaml:"development,omitempty" hc:"The development configuration for the project"`
	Deployment  *Deployment   `json:"deployment,omitempty" yaml:"deployment,omitempty"`
	Bundler     *Bundler      `json:"bundler,omitempty" yaml:"bundler,omitempty" hc:"You should not need to change these value"`
	Agents      []AgentConfig `json:"agents" yaml:"agents" hc:"The agents that are part of this project"`
}

func NewProject

func NewProject() *Project

NewProject will create a new project that is empty.

func (*Project) DeleteProjectEnv

func (p *Project) DeleteProjectEnv(logger logger.Logger, baseUrl string, token string, env []string, secrets []string) error

func (*Project) GetProject added in v0.0.39

func (p *Project) GetProject(logger logger.Logger, baseUrl string, token string) (*ProjectData, error)

func (*Project) Load

func (p *Project) Load(dir string) error

Load will load the project from a file in the given directory.

func (*Project) Save

func (p *Project) Save(dir string) error

Save will save the project to a file in the given directory.

func (*Project) SetProjectEnv

func (p *Project) SetProjectEnv(logger logger.Logger, baseUrl string, token string, env map[string]string, secrets map[string]string) (*ProjectData, error)

type ProjectContext added in v0.0.42

type ProjectContext struct {
	Logger  logger.Logger
	Project *Project
	Dir     string
	APIURL  string
	APPURL  string
	Token   string
}

func EnsureProject added in v0.0.42

func EnsureProject(cmd *cobra.Command) ProjectContext

func LoadProject added in v0.0.42

func LoadProject(logger logger.Logger, dir string, apiUrl string, appUrl string, token string) ProjectContext

type ProjectData

type ProjectData struct {
	APIKey           string            `json:"api_key"`
	ProjectId        string            `json:"id"`
	OrgId            string            `json:"orgId"`
	Env              map[string]string `json:"env"`
	Secrets          map[string]string `json:"secrets"`
	WebhookAuthToken string            `json:"webhookAuthToken,omitempty"`
	AgentID          string            `json:"agentId"`
}

func InitProject

func InitProject(logger logger.Logger, args InitProjectArgs) (*ProjectData, error)

InitProject will create a new project in the organization. It will return the API key and project ID if the project is initialized successfully.

type ProjectListData added in v0.0.23

type ProjectListData struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

func ListProjects added in v0.0.23

func ListProjects(logger logger.Logger, baseUrl string, token string) ([]ProjectListData, error)

type ProjectResponse

type ProjectResponse = Response[ProjectData]

type Resources

type Resources struct {
	Memory string `json:"memory,omitempty" yaml:"memory,omitempty" hc:"The memory requirements"`
	CPU    string `json:"cpu,omitempty" yaml:"cpu,omitempty" hc:"The CPU requirements"`
	Disk   string `json:"disk,omitempty" yaml:"disk,omitempty" hc:"The disk size requirements"`

	CPUQuantity    resource.Quantity `json:"-" yaml:"-"`
	MemoryQuantity resource.Quantity `json:"-" yaml:"-"`
	DiskQuantity   resource.Quantity `json:"-" yaml:"-"`
}

type Response

type Response[T any] struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Data    T      `json:"data"`
}

type Watch added in v0.0.32

type Watch struct {
	Enabled bool     `json:"enabled" yaml:"enabled" hc:"Whether to watch for changes and automatically restart the server"`
	Files   []string `json:"files" yaml:"files" hc:"Rules for files to watch for changes"`
}

Jump to

Keyboard shortcuts

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