cli

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package cli implements the command-line interface for LocalCloud

internal/cli/config.go

internal/cli/create.go

internal/cli/database.go

internal/cli/debug.go

internal/cli/doctor.go

internal/cli/helpers.go

internal/cli/info.go

internal/cli/init.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/ps.go

internal/cli/reset.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 AddTemplateCommands

func AddTemplateCommands(setupCmd, templatesCmd *cobra.Command)

AddTemplateCommands adds template-related commands to root

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 IsProjectInitialized

func IsProjectInitialized() bool

IsProjectInitialized checks if the current directory is a LocalCloud project

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 SetupCmd

func SetupCmd(fs embed.FS) *cobra.Command

SetupCmd creates the setup command (for external initialization)

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

Jump to

Keyboard shortcuts

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