detect

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 11 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 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"`
}

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"`
	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"`
}

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) 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"`
}

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"`
}

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