cli

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2025 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Overview

internal/cli/component.go

internal/cli/config.go

internal/cli/database.go

internal/cli/debug.go

internal/cli/doctor.go

internal/cli/export.go

internal/cli/helpers.go

internal/cli/info.go

internal/cli/init_interactive.go Package cli implements the command-line interface for LocalCloud

internal/cli/logs.go

internal/cli/models.go

internal/cli/mongodb.go

internal/cli/ps.go

internal/cli/reset.go

internal/cli/restart.go

internal/cli/root.go

internal/cli/service.go

internal/cli/setup.go

internal/cli/start.go

internal/cli/status.go - Enhanced version with resource monitoring

internal/cli/stop.go

internal/cli/storage.go

internal/cli/tunnel.go

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDockerNotRunning = &CLIError{
		Type:    "docker_not_running",
		Message: "Docker is not running",
		Solution: `Start Docker:
  - macOS/Windows: Open Docker Desktop
  - Linux: sudo systemctl start docker

For installation: https://docs.docker.com/get-docker/`,
	}

	ErrPortInUse = &CLIError{
		Type:    "port_in_use",
		Message: "Port already in use",
	}

	ErrInsufficientMemory = &CLIError{
		Type:    "insufficient_memory",
		Message: "Insufficient memory",
		Solution: `LocalCloud requires at least 4GB of RAM.

To free up memory:
  - Close unnecessary applications
  - Use smaller AI models (gemma2:2b, phi3:mini)
  - Reduce memory limits in config`,
	}

	ErrDiskSpace = &CLIError{
		Type:    "disk_space",
		Message: "Insufficient disk space",
		Solution: `Free up disk space:
  - Remove unused Docker images: docker system prune -a
  - Clear logs: rm -rf .localcloud/logs/*
  - Remove unused models: lc models remove <model>`,
	}
)

Common error types

View Source
var (
	ServiceCmd = serviceCmd
)

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately.

func FormatBytes

func FormatBytes(bytes int64) string

FormatBytes converts bytes to human readable format

func FormatError

func FormatError(err error) string

FormatError formats an error with helpful information

func GetProjectRoot

func GetProjectRoot() (string, error)

GetProjectRoot finds the project root directory by looking for .localcloud folder

func InitializeTemplateFS added in v0.2.0

func InitializeTemplateFS(fs embed.FS)

InitializeTemplateFS sets the template filesystem for commands that need it

func IsProjectInitialized

func IsProjectInitialized() bool

IsProjectInitialized checks if a project is initialized

func PrintMongoDBServiceInfo added in v0.2.0

func PrintMongoDBServiceInfo(port int)

PrintMongoDBServiceInfo prints MongoDB service information

func PrintPgVectorServiceInfo

func PrintPgVectorServiceInfo(port int)

func PrintPostgreSQLServiceInfo

func PrintPostgreSQLServiceInfo(port int, extensions []string)

PrintPostgreSQLServiceInfo prints standard PostgreSQL service information

func PrintRedisCacheInfo

func PrintRedisCacheInfo(port int)

func PrintRedisQueueInfo

func PrintRedisQueueInfo(port int)

func RunInteractiveInit

func RunInteractiveInit(projectName string) error

RunInteractiveInit runs the interactive initialization wizard

func SetTemplateFS added in v0.2.0

func SetTemplateFS(fs embed.FS)

SetTemplateFS sets the template filesystem

func SetVersionInfo added in v0.2.2

func SetVersionInfo(v, c, d string)

SetVersionInfo sets the version information from build-time variables

func TemplatesCmd

func TemplatesCmd() *cobra.Command

TemplatesCmd creates the templates command

Types

type CLIError

type CLIError struct {
	Type     string
	Message  string
	Solution string
	Details  map[string]interface{}
}

CLIError represents a structured error with solutions

func (*CLIError) Error

func (e *CLIError) Error() string

type EmbeddingData added in v0.2.0

type EmbeddingData struct {
	ID         string                 `json:"id"`
	DocumentID string                 `json:"document_id"`
	Content    string                 `json:"content"`
	Embedding  []float64              `json:"embedding"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
	Collection string                 `json:"collection"`
	CreatedAt  time.Time              `json:"created_at"`
}

type ExportInfo added in v0.2.0

type ExportInfo struct {
	ExportedAt   time.Time `json:"exported_at"`
	Source       string    `json:"source"`
	Version      string    `json:"version"`
	TotalVectors int       `json:"total_vectors"`
	Dimension    int       `json:"dimension"`
}

type InteractiveConfig

type InteractiveConfig struct {
	ProjectName string
	ProjectType string
	Components  []string
	Models      map[string]string // component -> model mapping
	Services    map[string]bool   // enabled services
}

InteractiveConfig represents the configuration built during interactive init

type StorageCredentials

type StorageCredentials struct {
	Endpoint   string `json:"endpoint"`
	AccessKey  string `json:"access_key"`
	SecretKey  string `json:"secret_key"`
	UseSSL     bool   `json:"use_ssl"`
	ConsoleURL string `json:"console_url"`
	BucketName string `json:"default_bucket"`
}

StorageCredentials holds MinIO connection information

type VectorExportData added in v0.2.0

type VectorExportData struct {
	ExportInfo   ExportInfo      `json:"export_info"`
	Collections  []string        `json:"collections"`
	Embeddings   []EmbeddingData `json:"embeddings"`
	ImportScript string          `json:"import_script,omitempty"`
}

VectorExportData represents the structure for vector database export

Jump to

Keyboard shortcuts

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