setup

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package setup installs Volcano agent skills/plugins into the coding-agent harnesses present on the machine. With no targeting flags it autodetects the installed harnesses, installs into each, and returns a per-harness report; when none are detected it falls back to a manual install under ~/.volcano.

Index

Constants

View Source
const (
	FlameHex      = theme.FlameHex
	LavaHex       = theme.LavaHex
	Volcano400Hex = theme.Volcano400Hex
	VolcanoHex    = theme.VolcanoHex
	Volcano600Hex = theme.Volcano600Hex
	OutdatedHex   = theme.OutdatedHex
	GrayHex       = theme.GrayHex
)

The Volcano CLI palette lives in internal/theme (the CLI-wide source of truth). These aliases keep the picker/report and eruption animation on the same names they already use.

Variables

This section is empty.

Functions

func RenderReport

func RenderReport(w io.Writer, r Report)

RenderReport writes a human-readable per-harness summary to w. The footer is derived from the actual result statuses, so a dry run says "would install" and only a genuine no-detection fallback claims none was detected.

func RenderReportString added in v0.9.0

func RenderReportString(r Report, on bool, width int) string

RenderReportString returns the same report as a string, colored when on is true regardless of the destination. RenderReport uses it for direct output; the interactive completion animation uses it to reveal the identical content line by line, so the animated finish mirrors the non-interactive report. width is the terminal width to wrap detail lines to; 0 disables width wrapping (the writer is a strings.Builder, so the caller — the interactive animation — supplies the width it tracks from the terminal).

Types

type CommandRunner

type CommandRunner interface {
	Run(ctx context.Context, name string, args ...string) ([]byte, error)
}

CommandRunner runs an external command (used for marketplace-based installs). Production uses the package's execRunner; tests inject a fake. runtime.Deps has no general-purpose runner to reuse (only Local/Update/Git), so setup owns its default rather than wiring one through the CLI.

type Detected added in v0.9.0

type Detected struct {
	Name             string
	Installed        bool
	InstalledVersion string // "" when unknown or versionless (file-drop harnesses)
	LatestVersion    string // locally-cached latest; "" when unknown or versionless
}

Detected is one harness present on the machine, with whether Volcano is already installed into it and (for version-bearing harnesses) the installed and locally-known-latest versions, so an interactive picker can label each option with the same status vocabulary the non-interactive report uses.

func Detect added in v0.9.0

func Detect(opts Options) ([]Detected, error)

Detect returns the coding-agent harnesses present on this machine, in the same order Run would install them, each flagged with whether Volcano is already installed. It performs detection only — no install, no network — so an interactive front-end can seed a selection prompt before anything is written.

func (Detected) StatusMark added in v0.9.0

func (d Detected) StatusMark() string

StatusMark returns the picker's install-state mark for a detected harness, padded to a fixed width so options align. The picker describes install *state* (pick what to set up): [available] not installed, [installed] current, [outdated] installed but behind. This differs from the report's outcome marks ([installed] = "installed this run", [detected] = "install failed"). The caller colors the mark and leaves the harness name in the terminal's default foreground.

func (Detected) Updatable added in v0.12.0

func (d Detected) Updatable() bool

Updatable reports whether Volcano is installed but behind the locally-known latest version. Best-effort: the "latest" comes from the harness's cached marketplace snapshot, which can itself be stale, so this never reports a false positive (unparseable/ahead versions compare as not-updatable) but may miss an update newer than the last local refresh.

func (Detected) VersionNote added in v0.12.0

func (d Detected) VersionNote() string

VersionNote is the trailing "(0.2.14 → 0.2.16 available)" hint appended to an outdated harness's picker label, or "" when there is nothing to add.

type HTTPDoer

type HTTPDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPDoer is the subset of *http.Client used to fetch skill content. It is satisfied by both http.DefaultClient and apiclient.HttpRequestDoer.

type Options

type Options struct {
	HTTPDoer      HTTPDoer                     // skills fetch; default http.DefaultClient
	CommandRunner CommandRunner                // marketplace shell-out; default os/exec
	SkillsBaseURL string                       // skills source; default the volcano-skills GitHub raw base (tests inject a mock)
	HomeDir       string                       // default os.UserHomeDir()
	Getenv        func(string) string          // default os.Getenv
	LookPath      func(string) (string, error) // default exec.LookPath
	Only          []string                     // explicit --agent targets (bypasses autodetect)
	BestEffort    bool                         // downgrade Only-target install failures to detected (interactive default); --agent stays strict
	Manual        bool                         // force the ~/.volcano fallback
	DryRun        bool                         // report the plan without writing
}

Options configures Run. Zero-value fields default to real implementations, so production callers can pass an empty Options; tests inject fakes.

type Report

type Report struct {
	Results []Result
	// ManualFallback is true only when no harness was detected and setup fell
	// back to ~/.volcano. An explicit --manual (or --agent manual) produces a
	// "manual" result but leaves this false: it was requested, not a fallback.
	ManualFallback bool
}

Report is the full setup outcome.

func Run

func Run(ctx context.Context, opts Options) (Report, error)

Run detects/targets harnesses and installs Volcano into each. It returns an error only for setup-wide problems (e.g. an unknown --agent). Autodetect is best-effort: a detected harness whose install fails is reported as detected (not installed) rather than failed. Only an explicit --agent target records a failure — inspect Report.Failed.

func (Report) Failed

func (r Report) Failed() bool

Failed reports whether any targeted harness failed to install.

type Result

type Result struct {
	Harness string
	Status  Status
	Detail  string
}

Result is one harness's outcome.

type Status

type Status string

Status is the outcome for one harness.

const (
	// StatusInstalled means the harness was set up successfully (fresh install).
	StatusInstalled Status = "installed"
	// StatusUpdated means the harness already had Volcano and was bumped to a
	// newer version.
	StatusUpdated Status = "updated"
	// StatusUpToDate means the harness already had the latest Volcano; the run
	// changed nothing.
	StatusUpToDate Status = "up to date"
	// StatusDetected means the harness was found on the machine but its install
	// didn't complete (autodetect best-effort, not a command failure).
	StatusDetected Status = "detected"
	// StatusSkipped means the harness was not detected on this machine.
	StatusSkipped Status = "skipped"
	// StatusFailed means the harness was targeted but its install failed.
	StatusFailed Status = "failed"
	// StatusPlanned is a dry-run entry: what would be installed.
	StatusPlanned Status = "planned"
)

Jump to

Keyboard shortcuts

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