Help us shape the future of Go! Take the 2026 Go Developer Survey

profile

package
v0.1.1528 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package profile stores named snapshots of every agent's settings, and of who gets what from the library, so a whole setup can be switched in one move.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFields added in v0.1.58

func ApplyFields(p map[string]string) (int, error)

ApplyFields writes every value in p that differs from what is set now. Only agents found on this computer are written: a profile synced from another one may name agents missing here, and writing their config would make them look installed. It returns the number of changes made and the first error encountered.

func Delete

func Delete(name string) error

Delete removes a profile.

func Fields added in v0.1.58

func Fields() map[string]string

Fields captures the current value of every detected agent's fields, including empty values that restore the agent's own defaults.

func InUse added in v0.1.1209

func InUse(p Profile, agents []*agent.Agent, now map[string]map[string]string) bool

InUse reports whether p is the setup in use now: applying it would change none of what it puts back, the detected agents' fields, their model lists and the library's setup. It is not "the profile applied last": a setting changed by hand since makes it no longer the one in use, and one saved with the setup as it is is in use at once. now is each detected agent's values by id, as Agent.Values reads them; an agent missing from it is read here. A profile that names nothing found on this computer (one synced from another) is not in use, as applying it would do nothing.

func Load

func Load() (map[string]Profile, error)

Load reads every profile.

func LongSummary added in v0.1.58

func LongSummary(p Profile) string

LongSummary is Summary, and what the profile gives out from the library.

func ModelLists added in v0.1.1133

func ModelLists() map[string]provider.ModelList

ModelLists captures every detected agent's model list, one the user never picked for included: applied, it shows that agent every model again.

func Names

func Names(ps map[string]Profile) []string

Names lists profiles alphabetically.

func Path

func Path() string

Path is the profiles file.

func Report added in v0.1.58

func Report(a Applied) []string

Report is what applying a profile did to the library, a line each, for the terminal: none for a profile without the library's setup.

func Save

func Save(name string, p Profile) error

Save stores p under name, replacing any existing profile.

func Summary

func Summary(p Profile) string

Summary renders a profile's non-default models as a short one-line description.

Types

type Applied added in v0.1.58

type Applied struct {
	Changed int // agent fields changed, and model lists
	// Library is what bringing the library's setup back wrote into the
	// agents; nil for a profile that carries none.
	Library *library.Result
}

Applied is what applying a profile did.

func Apply

func Apply(p Profile) (Applied, error)

Apply puts back the agents' model lists p carries, writes every field in p that differs from what is set now, then brings the library's setup back when p carries one and writes it into the agents (their files kept aside first). It stops at the first error. The lists go first, so the files that list an agent's models are written for the list it is switched to, and its model is set last, over them.

type Group added in v0.1.605

type Group struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Icon   string `json:"icon,omitempty"`
	Fields []Item `json:"fields"`
	// Servers and Skills are the library's it gets, by name; Instructions
	// whether it gets the instructions (their text is left out)
	Servers      []string `json:"servers,omitempty"`
	Skills       []string `json:"skills,omitempty"`
	Instructions bool     `json:"instructions,omitempty"`
	// Models is the model list it is switched to (#1368); nil when the
	// profile keeps none for it, which leaves its list as it is
	Models *Models `json:"models,omitempty"`
}

Group is what a profile holds for one agent, to be read before it is applied (#467): its fields, in the order the agent lists them, and what the library's setup gives it.

func Details added in v0.1.605

func Details(p Profile) []Group

Details is what p holds, by agent: the agents magpie knows in the order it lists them, then any it no longer does by id. A quiet field left empty is left out, as the agent's row leaves it out, unless it says which field it follows: Claude Code's four tiers are all there, one that follows the main model saying so (#480: opus and fable, following it, were missing, and read as not set). What applying the profile writes is unchanged.

type Item added in v0.1.605

type Item struct {
	Key     string `json:"key"`
	Label   string `json:"label"`
	Value   string `json:"value"`
	Follows string `json:"follows,omitempty"`
	Hidden  bool   `json:"hidden,omitempty"`
}

Item is one saved field. Value "" is the agent's own default, or, with Follows, the key of the field it takes after (a Claude Code tier that follows the main model, #480). Hidden is a value that looked like a key or a token: it is left out, never shown.

type Models added in v0.1.1133

type Models struct {
	Hidden int  `json:"hidden"`
	Only   bool `json:"only,omitempty"`
	Picked int  `json:"picked,omitempty"`
}

Models is a model list as a profile's details tell it: how many models are taken out, or, Only, how many are the only ones picked.

type Profile

type Profile struct {
	// Fields maps "agent.field" to a value.
	Fields map[string]string
	// Library is which agents got which servers and skills, and the
	// instructions; nil for a profile saved while the library was empty,
	// or before profiles kept it, which leaves the library as it is.
	Library *library.Setup
	// Models are the agents' model lists (#1368), by the id their lists are
	// kept under (agent.ListsFor): which of magpie's models each shows and
	// in what order. An agent not named, every one in a profile saved
	// before profiles kept them, keeps the list it has.
	Models map[string]provider.ModelList
}

Profile is every agent's fields, and the library's setup.

func Snapshot

func Snapshot() (Profile, error)

Snapshot captures every detected agent's fields and model list, and the library's setup unless the library is empty.

func (Profile) MarshalJSON added in v0.1.58

func (p Profile) MarshalJSON() ([]byte, error)

MarshalJSON writes the fields and the library's setup side by side.

func (*Profile) UnmarshalJSON added in v0.1.58

func (p *Profile) UnmarshalJSON(b []byte) error

UnmarshalJSON reads what MarshalJSON writes, and a profile of before, which was the fields alone.

Jump to

Keyboard shortcuts

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