setup

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: Apache-2.0 Imports: 12 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   = "#f54019" // lava flame: key hints (space/enter/esc)
	LavaHex    = "#f37a58" // lava-500 brand primary: titles, main lines, CTA
	VolcanoHex = "#f97316" // volcano-500: options — selectors, checkboxes, marks
)

The Volcano CLI palette, taken from volcano-web. Shared by the interactive picker and the report so the CLI keeps one color identity across both.

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

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
}

Detected is one harness present on the machine, with whether Volcano is already installed into it, 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. The picker describes install *state* (pick what to set up), so it uses [installed]/[available], describing install state rather than the report's outcome ([installed] there means "installed this run", and [detected] means "install failed" — not "not yet installed"). Both marks are 11 columns wide, so options align without padding. The caller colors the mark and leaves the harness name in the terminal's default foreground.

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 --harness targets (bypasses autodetect)
	BestEffort    bool                         // downgrade Only-target install failures to detected (interactive default); --harness 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 --harness 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 --harness). Autodetect is best-effort: a detected harness whose install fails is reported as detected (not installed) rather than failed. Only an explicit --harness 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.
	StatusInstalled Status = "installed"
	// 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