detect

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package detect scans the local environment for OS, package manager, developer toolchain, and Multiversa state. Used by `multiversa detect` and `multiversa doctor` to render a single consultive report.

Detection is read-only: no installs, no network, no mutation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentState added in v0.9.0

type AgentState struct {
	ID               string           `json:"id"`
	Name             string           `json:"name"`
	Author           string           `json:"author"`
	Repo             string           `json:"repo"`
	License          string           `json:"license"`
	OptIn            bool             `json:"opt_in"`
	State            capability.State `json:"state"`
	Installed        bool             `json:"installed"`
	Configured       bool             `json:"configured"`
	Connected        bool             `json:"connected"`
	Version          string           `json:"version,omitempty"`
	Path             string           `json:"path,omitempty"`
	Evidence         []string         `json:"evidence,omitempty"`
	Missing          []string         `json:"missing,omitempty"`
	NextActions      []string         `json:"next_actions,omitempty"`
	RequiresApproval bool             `json:"requires_approval"`
}

AgentState is the evidence-only view of an optional agent runtime. Agent runtimes are deliberately separate from stack engines and skills.

type BinaryState added in v0.9.0

type BinaryState struct {
	Path    string `json:"path"`
	Version string `json:"version,omitempty"`
	Active  bool   `json:"active"`
}

BinaryState records each known CLI installation without deciding which one should be deleted. Active is the binary currently selected by PATH.

type EngineState

type EngineState struct {
	ID               string           `json:"id"`
	Name             string           `json:"name"`
	Author           string           `json:"author"`
	Installed        bool             `json:"installed"`
	Version          string           `json:"version,omitempty"`
	OptIn            bool             `json:"opt_in"`
	State            capability.State `json:"state"`
	Path             string           `json:"path,omitempty"`
	Evidence         []string         `json:"evidence,omitempty"`
	Missing          []string         `json:"missing,omitempty"`
	NextActions      []string         `json:"next_actions,omitempty"`
	RequiresApproval bool             `json:"requires_approval"`
}

EngineState is the per-engine slice of the Multiversa report.

type MultiversaState

type MultiversaState struct {
	CLIInstalled bool          `json:"cli_installed"`
	CLIVersion   string        `json:"cli_version,omitempty"`
	CLIPath      string        `json:"cli_path,omitempty"`
	CLIBinaries  []BinaryState `json:"cli_binaries,omitempty"`
	HomeDir      string        `json:"home_dir,omitempty"` // ~/.multiversa, if it exists
	Engines      []EngineState `json:"engines"`
	Repos        []string      `json:"repos,omitempty"` // detected repo paths under common locations
}

MultiversaState describes how much of the Multiversa ecosystem is wired up on this host: the CLI itself, each curated engine, and any locally detected repos.

type OSInfo

type OSInfo struct {
	Kind    string `json:"kind"`    // "darwin" | "linux" | "windows"
	Arch    string `json:"arch"`    // "amd64" | "arm64" | "386"
	Distro  string `json:"distro"`  // "macos" | "ubuntu" | "debian" | "fedora" | "arch" | "windows" | "unknown"
	Version string `json:"version"` // human-readable OS version
	PkgMgr  string `json:"pkg_mgr"` // "brew" | "apt" | "dnf" | "pacman" | "winget" | "scoop" | "" (none detected)
}

OSInfo describes the host operating system and chosen package manager.

type Report

type Report struct {
	OS         OSInfo          `json:"os"`
	Tools      []Tool          `json:"tools"`
	Multiversa MultiversaState `json:"multiversa"`
	Agents     []AgentState    `json:"agents"`
}

Report is the canonical detection result. Render() turns it into a Charm-styled string for the terminal; the same struct can be JSON-encoded for the skill layer in Claude Code.

func Run

func Run() Report

Run executes a full local scan and returns the populated Report. It does not return an error — partial data is preferable to none.

func (Report) ReadyAgents added in v0.9.0

func (r Report) ReadyAgents() (ready, total int)

ReadyAgents returns how many optional agent runtimes are usable locally.

func (Report) ReadyEngines

func (r Report) ReadyEngines() (installed, total int)

ReadyEngines returns how many Multiversa engines are installed.

func (Report) ReadyTools

func (r Report) ReadyTools() (installed, total int)

ReadyTools returns how many of the inspected tools are installed.

func (Report) Render

func (r Report) Render(w io.Writer)

Render writes the report to w using the Multiversa theme. The output is meant to be copy-pasteable; no ANSI hyperlinks, only colors.

func (Report) Summarize

func (r Report) Summarize() Summary

Summarize computes the Summary for this report.

type Summary

type Summary struct {
	ToolsReady   int `json:"tools_ready"`
	ToolsTotal   int `json:"tools_total"`
	EnginesReady int `json:"engines_ready"`
	EnginesTotal int `json:"engines_total"`
	AgentsReady  int `json:"agents_ready"`
	AgentsTotal  int `json:"agents_total"`
}

Summary is the aggregate readiness view included in JSON output so agents can branch on totals without re-deriving them.

type Tool

type Tool struct {
	Name       string           `json:"name"`
	Installed  bool             `json:"installed"`
	Version    string           `json:"version,omitempty"`
	Advisory   bool             `json:"advisory"` // true = informational only, not a "missing" failure
	Warn       bool             `json:"warn"`     // true = present but flagged (e.g. npm policy violation)
	Category   string           `json:"category"`
	Path       string           `json:"path,omitempty"`
	State      capability.State `json:"state"`
	ProbeError string           `json:"probe_error,omitempty"`
}

Tool describes one developer-stack binary being probed. Advisory=true means presence is informational only (e.g. npm — banned by policy, we flag it but don't fail).

Jump to

Keyboard shortcuts

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