profile

package
v0.6.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: 8 Imported by: 0

Documentation

Overview

Package profile persists the per-user wizard profile across Multiversa CLI invocations. The TOML file at `~/.multiversa/profile.toml` is the primary store; a best-effort mirror to Engram (`multiversa/profile` topic key) lets other agents on the user's machine surface the same context.

The profile is intentionally minimal: who the user is (level), what language to speak (locale), when we last saw them, and what engines they already have. Everything else stays in the engines' own state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectLocale

func DetectLocale(lang string) string

DetectLocale extracts the BCP-47 family from a POSIX LANG value. Mapping rules:

  • "es_*" → "es-LA" (Spanish Latin neutral, the Multiversa default)
  • "en_*" → "en"
  • empty / "C" → "en" (safe English fallback)
  • anything else → "en" (Multiversa only ships EN/ES today)

func MirrorEngram

func MirrorEngram(p Profile) error

MirrorEngram persists a JSON snapshot of the profile into Engram under topic_key "multiversa/profile". If the `engram` binary is not on PATH, the call is a no-op — Engram integration is opt-in and must never block the local TOML write.

Returns the engram CLI exit error if the call ran but failed, nil otherwise. Callers should ignore non-nil returns for routine flows; the function is logging-only.

func Path

func Path() (string, error)

Path returns the canonical filesystem path of the profile.

Types

type Layer

type Layer string

Layer is one of the consultive configuration layers in the `multiversa lab` meta-wizard. Each layer groups a related set of Steps (e.g. detect/stack/init in Técnica) and is shown as a section in the sidebar.

Negocio (clients/billing/contracts) is intentionally absent here. It belongs to MultiversaGroup, the private commercial entity, not to the MIT Lab.

const (
	// Tecnica covers the OS-level toolchain and curated engines.
	Tecnica Layer = "tecnica"
	// Identitaria covers the user's identity, brain, and private
	// workspace (SSH/GPG/repos/vault).
	Identitaria Layer = "identitaria"
	// Operacional covers operational artifacts that aren't strictly
	// dev-tool nor identity: encrypted USB, credits attribution,
	// housekeeping.
	Operacional Layer = "operacional"
)

func AllLayers

func AllLayers() []Layer

AllLayers returns the layers shown in `multiversa lab`, in the order they appear in the sidebar.

func (Layer) DisplayName

func (l Layer) DisplayName() string

DisplayName returns the human label rendered in the sidebar. Display names are always Spanish — the Lab tone is bilingual but the layer names themselves are part of the brand vocabulary.

func (Layer) Tagline

func (l Layer) Tagline() string

Tagline returns a one-line description shown under each layer header in the sidebar.

type Level

type Level string

Level expresses how much explanation the user wants per step. Maps to tui.Verbosity at render time.

const (
	Newcomer   Level = "newcomer"
	Enthusiast Level = "enthusiast"
	Expert     Level = "expert"
)

func (Level) IsValid

func (l Level) IsValid() bool

IsValid reports whether the level is one of the canonical values.

type Profile

type Profile struct {
	Level            Level     `toml:"level"`
	Locale           string    `toml:"locale"`
	LastRun          time.Time `toml:"last_run"`
	InstalledEngines []string  `toml:"installed_engines"`
}

Profile is the on-disk shape persisted as TOML.

func Default

func Default() Profile

Default returns a freshly-initialized profile with the locale detected from the host environment. Callers should ask the user for their preferred Level on first run and overwrite the zero value before saving.

func Load

func Load() (Profile, error)

Load reads the profile from ~/.multiversa/profile.toml. If the file does not exist, Load returns (Default(), os.ErrNotExist) so callers can distinguish "first run" from a real error.

func (Profile) HasEngine

func (p Profile) HasEngine(engineID string) bool

HasEngine reports whether the named engine appears in the installed-engines list.

func (*Profile) MarkInstalled

func (p *Profile) MarkInstalled(engineID string)

MarkInstalled appends an engine id to InstalledEngines if it is not already present. The list stays sorted-by-insertion-order so the user can see what they installed in what order.

func (*Profile) Save

func (p *Profile) Save() error

Save writes the profile to disk and best-effort mirrors to Engram. A failure to mirror is logged (in caller code via the returned bool) but never blocks the disk write.

Jump to

Keyboard shortcuts

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