bootstrap

package
v1.3.101 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package bootstrap handles local RepoSwarm installation setup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAgentGuide

func GenerateAgentGuide(env *Environment, installDir string, cfg *Config) string

GenerateAgentGuide creates a markdown file for a coding agent to follow.

func GenerateGuide

func GenerateGuide(env *Environment, installDir string, cfg *Config) string

GenerateGuide creates a markdown installation guide tailored to the detected environment.

func IsLocalInstall added in v1.3.83

func IsLocalInstall(installDir string) bool

IsLocalInstall checks whether a local installation exists at the given directory.

func LocalRestart added in v1.3.83

func LocalRestart(installDir string, service string, cfg *Config) error

LocalRestart stops then starts a service.

func LocalStart added in v1.3.83

func LocalStart(installDir string, service string, cfg *Config) error

LocalStart starts a service locally by spawning the process directly. This is the fallback when the API server is unreachable.

func LocalStop added in v1.3.83

func LocalStop(installDir string, service string, cfg *Config) error

LocalStop stops a locally running service.

func TemporalComposeLocal

func TemporalComposeLocal() string

TemporalComposeLocal returns the docker-compose YAML for local development. Uses postgres instead of the deprecated sqlite driver.

Types

type Config

type Config struct {
	WorkerRepoURL   string
	APIRepoURL      string
	UIRepoURL       string
	DynamoDBTable   string
	DefaultModel    string
	TemporalPort    string
	TemporalUIPort  string
	APIPort         string
	UIPort          string
	Region          string
	ProviderEnvVars map[string]string // Provider-specific env vars (CLAUDE_CODE_USE_BEDROCK, CLAUDE_PROVIDER, etc.)
}

Config is a subset of the full CLI config used by SetupLocal. Avoids importing the config package (which would create a cycle).

type Environment

type Environment struct {
	OS      string `json:"os"`
	Arch    string `json:"arch"`
	HomeDir string `json:"homeDir"`
	WorkDir string `json:"workDir"`
	Shell   string `json:"shell"`

	// Runtimes
	HasDocker     bool   `json:"hasDocker"`
	DockerRunning bool   `json:"dockerRunning"`
	DockerVer     string `json:"dockerVersion,omitempty"`
	HasCompose    bool   `json:"hasDockerCompose"`
	ComposeVer    string `json:"composeVersion,omitempty"`
	HasNode       bool   `json:"hasNode"`
	NodeVer       string `json:"nodeVersion,omitempty"`
	HasPython     bool   `json:"hasPython"`
	PythonVer     string `json:"pythonVersion,omitempty"`
	HasPythonVenv bool   `json:"hasPythonVenv"`
	HasGo         bool   `json:"hasGo"`
	GoVer         string `json:"goVersion,omitempty"`
	HasGit        bool   `json:"hasGit"`
	GitVer        string `json:"gitVersion,omitempty"`

	// Coding agents
	HasClaudeCode bool `json:"hasClaudeCode"`
	HasCursor     bool `json:"hasCursor"`
	HasCodex      bool `json:"hasCodex"`
	HasAider      bool `json:"hasAider"`

	// AWS
	HasAWSCLI  bool   `json:"hasAwsCli"`
	AWSRegion  string `json:"awsRegion,omitempty"`
	AWSProfile string `json:"awsProfile,omitempty"`

	// Package managers
	HasBrew bool `json:"hasBrew"`
	HasApt  bool `json:"hasApt"`
	HasPip  bool `json:"hasPip"`
	HasNpm  bool `json:"hasNpm"`
}

Environment holds detected local environment info.

func Detect

func Detect() *Environment

Detect scans the local environment.

func (*Environment) AgentName

func (e *Environment) AgentName() string

AgentName returns the best available coding agent name, or "".

func (*Environment) InstallDir

func (e *Environment) InstallDir() string

InstallDir returns the target installation directory.

func (*Environment) MissingDeps

func (e *Environment) MissingDeps() []string

MissingDeps returns a list of missing required dependencies. With Docker images, only Docker and Compose are required.

func (*Environment) Summary

func (e *Environment) Summary() string

Summary returns a human-readable environment summary.

type InstallLog added in v1.3.88

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

InstallLog captures detailed install/setup information to a file. It writes everything needed to debug issues remotely.

func NewInstallLog added in v1.3.88

func NewInstallLog(installDir string) *InstallLog

NewInstallLog creates a new install log in the given directory. Creates the directory if needed. Returns nil (no-op) if it can't create the file.

func (*InstallLog) Close added in v1.3.88

func (il *InstallLog) Close()

Close writes the footer and closes the file.

func (*InstallLog) CmdOutput added in v1.3.88

func (il *InstallLog) CmdOutput(cmd string, dir string, output []byte, err error)

CmdOutput logs a command and its combined output.

func (*InstallLog) Env added in v1.3.88

func (il *InstallLog) Env(env []string)

Env logs environment variables (redacting secrets).

func (*InstallLog) Error added in v1.3.88

func (il *InstallLog) Error(msg string)

Error logs an error.

func (*InstallLog) Info added in v1.3.88

func (il *InstallLog) Info(msg string)

Info logs an informational message.

func (*InstallLog) Path added in v1.3.88

func (il *InstallLog) Path() string

Path returns the log file path.

func (*InstallLog) RunCmd added in v1.3.88

func (il *InstallLog) RunCmd(dir string, name string, args ...string) ([]byte, error)

RunCmd executes a command, logs it, and returns the output.

func (*InstallLog) Section added in v1.3.88

func (il *InstallLog) Section(title string)

Section writes a section header.

func (*InstallLog) Success added in v1.3.88

func (il *InstallLog) Success(msg string)

Success logs a success message.

func (*InstallLog) Warning added in v1.3.88

func (il *InstallLog) Warning(msg string)

Warning logs a warning.

type LocalSetupResult

type LocalSetupResult struct {
	InstallDir string            `json:"installDir"`
	Token      string            `json:"token"`
	Steps      []LocalStepResult `json:"steps"`
	Success    bool              `json:"success"`
}

LocalSetupResult holds the outcome of each setup step.

func SetupLocal

func SetupLocal(env *Environment, installDir string, cfg *Config, printer Printer) (*LocalSetupResult, error)

SetupLocal orchestrates a complete local RepoSwarm environment. Config values drive repo URLs, ports, table names, and model IDs.

type LocalStepResult

type LocalStepResult struct {
	Name    string `json:"name"`
	Status  string `json:"status"` // ok, fail, skip
	Message string `json:"message,omitempty"`
}

LocalStepResult is one step in the setup process.

type Plan

type Plan struct {
	InstallDir     string
	TemporalPort   string
	TemporalUIPort string
	APIPort        string
	UIPort         string
	DynamoDBPort   string
	DynamoDBTable  string
	APIRepoURL     string
	WorkerRepoURL  string
	UIRepoURL      string
	Region         string
	DefaultModel   string
}

Plan represents the full setup plan shown to the user before starting.

func PlanFromConfig

func PlanFromConfig(cfg *Config, installDir string) *Plan

PlanFromConfig creates a Plan from the bootstrap config.

func (*Plan) Ports

func (p *Plan) Ports() [][]string

Ports returns the port mapping for display.

func (*Plan) Steps

func (p *Plan) Steps() []string

Steps returns a human-readable list of what will happen.

type Printer

type Printer interface {
	Section(title string)
	Info(msg string)
	Success(msg string)
	Warning(msg string)
	Error(msg string)
	Printf(format string, args ...any)
}

Printer abstracts formatted output so SetupLocal doesn't depend on the output package.

type ServiceStatus added in v1.3.83

type ServiceStatus struct {
	Name    string `json:"name"`
	Running bool   `json:"running"`
	PID     int    `json:"pid,omitempty"`
	Port    string `json:"port,omitempty"`
}

ServiceStatus holds runtime info about a locally managed service.

func LocalServiceStatus added in v1.3.83

func LocalServiceStatus(installDir string, service string, cfg *Config) (*ServiceStatus, error)

LocalServiceStatus returns the status of a locally installed service.

Jump to

Keyboard shortcuts

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