Documentation
¶
Overview ¶
Package library keeps what every agent should know, once: the instructions each reads before a conversation, the MCP servers it can call and the skills it can load. magpie writes them into each agent's own files in that agent's own format, and takes back only what it wrote — whatever else is in those files stays as it was.
Index ¶
- Constants
- func BackupDir() string
- func Changed() time.Time
- func Dir() string
- func Icon(u string) ([]byte, string, error)
- func ProjectSkillsDir(agent string) string
- func RTKLatest() string
- func RTKNewer(a, b string) bool
- func RTKTakes(q string) (string, error)
- func SkillPath(name string) string
- func SkillText(name string) (string, error)
- func SkillsAbout(ids []string) map[string]string
- func Takes(q, kind string) (string, error)
- type AgentInstructions
- type AgentView
- type Applied
- type Bundle
- type Candidate
- type CarriedSkill
- type Found
- type FoundSkill
- type Input
- type InstrSet
- type Instructions
- type InstructionsChange
- type InstructionsView
- type Library
- type MarketServer
- type MarketSkill
- type Probe
- type Problem
- type Project
- type ProjectView
- type RTKAgent
- type RTKDay
- type RTKGain
- type RTKView
- type Result
- func AddProject(dir string) (*Result, error)
- func ImportInstructions(id string) (*Result, error)
- func ImportServer(name string) (*Result, error)
- func ImportSkill(name string) (*Result, error)
- func ImportSkills(names []string) (*Result, error)
- func InstallMarketSkill(source, id string, agents []string) (*Result, error)
- func InstallServer(id string, values map[string]string, agents []string) (*Result, error)
- func InstallSkills(input string, paths, agents []string) (*Result, error)
- func KeepAgentSkill(name, agentID string) (*Result, error)
- func ProjectCopy(dir string, copy bool) (*Result, error)
- func ProjectSkill(dir, name string, agents []string) (*Result, error)
- func Put(b *Bundle) (*Result, error)
- func RemoveProject(dir string) (*Result, error)
- func RemoveServer(name string) (*Result, error)
- func RemoveSkill(name string) (*Result, error)
- func Restore(s *Setup) (*Result, error)
- func SaveInstructions(c InstructionsChange) (*Result, error)
- func SaveServer(old string, s Server) (*Result, error)
- func ServerAgents(name string, agents []string) (*Result, error)
- func SkillAgents(name string, agents []string) (*Result, error)
- func Sync() (*Result, error)
- func UpdateSkill(name string) (*Result, error)
- func UpdateSkills() (*Result, error)
- func UpdateSomeSkills(names []string) (*Result, error)
- func UseLibrarySkill(name, agentID string) (*Result, error)
- type Server
- type ServerView
- type SetView
- type Setup
- type SetupInstructions
- type Skill
- type SkillCheck
- type SkillView
- type Source
- type Target
- type View
Constants ¶
const RTKURL = "https://www.rtk-ai.app"
RTKURL is where rtk is installed from.
Variables ¶
This section is empty.
Functions ¶
func BackupDir ¶
func BackupDir() string
BackupDir is where a file is copied before magpie first changes it in a change: one folder a change, named by when, a folder an agent in it.
func Changed ¶ added in v0.1.182
Changed is when the library was last changed: library.json, or a file of its own (links not followed).
func Dir ¶
func Dir() string
Dir is where the library's own files are: the instructions and the skills.
func Icon ¶
Icon is a market icon, fetched once and kept on disk: only an icon the market gave out is fetched, so the page can't have magpie fetch anything else.
func ProjectSkillsDir ¶ added in v0.1.243
ProjectSkillsDir is the folder, in a project, an agent reads its skills from: "" for one magpie can't give a project's skills to.
func RTKLatest ¶ added in v0.1.328
func RTKLatest() string
RTKLatest is rtk's latest release, from GitHub unless it was read lately; "" when GitHub can't be reached and never could.
func RTKTakes ¶ added in v0.1.124
RTKTakes is the id of the agent q names when rtk can be given to it.
func SkillsAbout ¶
SkillsAbout is what each skill says of itself, by id (owner/repo/skill), from its SKILL.md; kept on disk once known.
Types ¶
type AgentInstructions ¶
type AgentInstructions struct {
Agent string `json:"agent"`
Name string `json:"name"`
Icon string `json:"icon"`
Path string `json:"path"`
On bool `json:"on"`
Extra string `json:"extra"` // what this agent gets besides
Own int `json:"own"` // lines of the user's own in the file
Edited bool `json:"edited,omitempty"` // magpie's part was changed in the file
Override string `json:"override,omitempty"` // a file the agent reads instead
}
AgentInstructions is one agent's instructions file as the page shows it.
type AgentView ¶
type AgentView struct {
ID string `json:"id"`
Name string `json:"name"`
Icon string `json:"icon"`
Instructions string `json:"instructions,omitempty"`
MCP string `json:"mcp,omitempty"`
Skills string `json:"skills,omitempty"`
// ProjectSkills is the folder in a project it reads skills from
ProjectSkills string `json:"projectSkills,omitempty"`
SkillsAlso []string `json:"skillsAlso,omitempty"`
Note string `json:"note,omitempty"`
NoSSE bool `json:"noSSE,omitempty"`
NoRemote bool `json:"noRemote,omitempty"`
MCPVia string `json:"mcpVia,omitempty"`
}
AgentView is an agent as the page lists it, with where it keeps each.
type Applied ¶
type Applied struct {
Instructions bool `json:"instructions,omitempty"`
InstrHash string `json:"instrHash,omitempty"` // of the part last written
MCP []string `json:"mcp,omitempty"`
Skills []string `json:"skills,omitempty"`
}
Applied is what magpie last wrote into one agent.
type Bundle ¶ added in v0.1.182
type Bundle struct {
Instructions Instructions `json:"instructions"`
Texts map[string]string `json:"texts,omitempty"` // set → its text
Extra map[string]string `json:"extra,omitempty"` // agent → what it gets besides
MCP []*Server `json:"mcp"`
Skills []*CarriedSkill `json:"skills"`
Icons map[string]string `json:"icons,omitempty"`
}
Bundle is the library as a backup carries it to another computer: the instruction sets and the one on, what each agent gets besides, the MCP servers and the skills with their files. What magpie wrote into each agent (Applied) is this computer's own and stays out. It is made the same way every time — no times, everything in order — so two computers with the same library carry the same bundle.
func (*Bundle) WithSecrets ¶ added in v0.1.182
WithSecrets is b with the values WithoutSecrets emptied filled from the servers of the same name in have, so a bundle made without keys doesn't take away the ones kept here.
func (*Bundle) WithoutSecrets ¶ added in v0.1.182
WithoutSecrets empties the values of the servers' environment variables and headers that secret says hold one; their names stay, to be filled in.
type Candidate ¶
type Candidate struct {
Path string `json:"path"` // in the repository or the folder; "" for its root
Name string `json:"name"`
Description string `json:"description"`
Have bool `json:"have"` // the library has a skill by that name
}
Candidate is a skill found where the user pointed: in a repository, or in a folder.
type CarriedSkill ¶ added in v0.1.182
type CarriedSkill struct {
Name string `json:"name"`
Source *Source `json:"source,omitempty"`
Agents []string `json:"agents"`
Files map[string][]byte `json:"files"` // by path in the folder, with /
Exec []string `json:"exec,omitempty"` // the files that run
Left []string `json:"left,omitempty"` // files too big to carry
}
CarriedSkill is a skill with its folder's files.
type Found ¶
type Found struct {
Server *Server `json:"server"`
Others []string `json:"others,omitempty"`
Icon string `json:"icon,omitempty"`
// Own: the agent's app puts it there itself, each time it starts
// (Codex's node_repl and cua_repl): it isn't one to bring in, and
// taking it out doesn't last.
Own bool `json:"own,omitempty"`
}
Found is a server an agent has that the library doesn't: the agents that have it as it is, and those that have another by that name.
type FoundSkill ¶
type FoundSkill struct {
Name string `json:"name"`
Description string `json:"description"`
Agents []string `json:"agents"` // the agents that have this very folder
Others []string `json:"others,omitempty"` // agents with another by that name
// Copies are the agents with another folder by that name holding the
// very same files (CC Switch copies a skill into each agent): brought
// in, they get the library's in its place
Copies []string `json:"copies,omitempty"`
Link string `json:"link,omitempty"` // where it really is, when it's a link
// there; the agents that have it are those whose entry is a link (or a
// junction) to the very same folder
Shared string `json:"shared,omitempty"`
// contains filtered or unexported fields
}
FoundSkill is a skill an agent has that the library doesn't.
type Input ¶
type Input struct {
Key string `json:"key"`
Where string `json:"where"` // env, header or arg
Label string `json:"label"`
Description string `json:"description,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Secret bool `json:"secret,omitempty"`
Required bool `json:"required,omitempty"`
// contains filtered or unexported fields
}
Input is something a server needs from the user before it can start: a key in its environment, a header it sends, or an argument.
type InstrSet ¶ added in v0.1.181
type InstrSet struct {
ID string `json:"id"`
Name string `json:"name"` // "" for the first, which the page calls Default
}
InstrSet is one set of shared instructions: its text is in its own file.
type Instructions ¶
type Instructions struct {
Agents []string `json:"agents"` // the agents the shared text is written to
// Sets are the named texts to pick the shared one from; with none kept
// there is the one magpie always had, "default"
Sets []InstrSet `json:"sets,omitempty"`
Active string `json:"active,omitempty"` // the set agents get; "" is "default"
}
Instructions are one shared text, and for each agent whether it gets it and what it gets besides (kept in files beside library.json). The shared text is one of several sets kept to switch between (#106), the one on.
type InstructionsChange ¶
type InstructionsChange struct {
Agents []string `json:"agents,omitempty"`
Extra map[string]*string `json:"extra,omitempty"`
// Rewrite writes magpie's part again into these agents' files, over
// edits made there.
Rewrite []string `json:"rewrite,omitempty"`
// The sets: texts by set, a set to switch the agents to, one to add
// (id and name), one to rename and one to remove. Shared is the text
// of the set on, as it is after Activate.
Texts map[string]*string `json:"texts,omitempty"`
Activate string `json:"activate,omitempty"`
Create *InstrSet `json:"create,omitempty"`
Rename *InstrSet `json:"rename,omitempty"`
Remove string `json:"remove,omitempty"`
}
InstructionsChange is what the page saves: the shared text, which agents get it, and what each gets besides. A nil field is left as it is.
type InstructionsView ¶
type InstructionsView struct {
Sets []SetView `json:"sets"`
Agents []AgentInstructions `json:"agents"`
}
InstructionsView is the Instructions page.
func ReadInstructions ¶
func ReadInstructions() (*InstructionsView, error)
ReadInstructions is the shared text and each agent's file.
type Library ¶
type Library struct {
Instructions Instructions `json:"instructions"`
MCP []*Server `json:"mcp"`
Skills []*Skill `json:"skills"`
// Projects are folders whose agents get some of the skills there
Projects []*Project `json:"projects,omitempty"`
// Applied is what magpie wrote into each agent, so that what it takes
// away is only ever its own.
Applied map[string]*Applied `json:"applied,omitempty"`
// Icons are the icons of the servers added from the market, by what
// each runs, for the page to show them by
Icons map[string]string `json:"icons,omitempty"`
// contains filtered or unexported fields
}
Library is library.json: what magpie keeps, and which agents get it.
type MarketServer ¶
type MarketServer struct {
ID string `json:"id"`
Name string `json:"name"` // what the library calls it
Title string `json:"title"`
Description string `json:"description"`
Publisher string `json:"publisher,omitempty"`
Icon string `json:"icon,omitempty"`
Homepage string `json:"homepage,omitempty"`
Transport string `json:"transport"`
// Runs is what starts a local one: npx, uvx or docker
Runs string `json:"runs,omitempty"`
// SignIn is a remote one that has the agent sign in, in the browser,
// the first time it's used
SignIn bool `json:"signIn,omitempty"`
Featured bool `json:"featured,omitempty"`
// OptIn is one no agent is given unless it is picked for it
OptIn bool `json:"optIn,omitempty"`
Inputs []Input `json:"inputs"`
// Have is the library's server that is this one
Have string `json:"have,omitempty"`
// contains filtered or unexported fields
}
MarketServer is a server the market offers.
func MarketServers ¶
func MarketServers(q string) ([]MarketServer, error)
MarketServers is what the market shows for a search: the featured servers that match it, then the registry's.
type MarketSkill ¶
type MarketSkill struct {
ID string `json:"id"` // owner/repo/skill
Source string `json:"source"` // owner/repo
SkillID string `json:"skillId"`
Name string `json:"name"`
Installs int `json:"installs"`
Official bool `json:"official,omitempty"`
Icon string `json:"icon"`
// Description is known once it has been fetched
Description string `json:"description,omitempty"`
Have string `json:"have,omitempty"`
}
MarketSkill is a skill the market offers, from a GitHub repository.
func MarketSkills ¶
func MarketSkills(q string) ([]MarketSkill, error)
MarketSkills is what the market shows for a search: the most installed skills that match it, then what skills.sh finds for it.
type Probe ¶
type Probe struct {
Source string `json:"source"`
Kind string `json:"kind"`
Candidates []Candidate `json:"candidates"`
// contains filtered or unexported fields
}
Probe is what was found at a source.
func ProbeSkills ¶
ProbeSkills looks for skills at what the user typed: a GitHub repository (or a folder in one), or a folder on this machine.
type Problem ¶
type Problem struct {
Agent string `json:"agent"`
What string `json:"what"` // instructions, mcp:<name>, skill:<name>
Error string `json:"error"`
// Own is a skill the agent has a folder of its own for, not the
// library's: the page offers to use the library's or keep the agent's
Own bool `json:"own,omitempty"`
}
Problem is one thing that couldn't be given to an agent.
type Project ¶ added in v0.1.243
type Project struct {
Dir string `json:"dir"`
// Copy puts copies of the skills there, not links to the library's
// (for Windows, or a folder synced or shared where a link won't do);
// a copy is made again when the library's skill changes
Copy bool `json:"copy,omitempty"`
// Skills are the library's skills the project has, and for which agents
Skills map[string][]string `json:"skills,omitempty"`
// Placed are the entries magpie put in the folder (.claude/skills/pdf),
// the only ones it ever takes away
Placed []string `json:"placed,omitempty"`
// Made are the folders magpie made to place them in, taken away again
// once they're empty; Gitignore is whether it made the .gitignore
Made []string `json:"made,omitempty"`
Gitignore bool `json:"gitignore,omitempty"`
}
Project is a folder of the user's whose agents get some of the library's skills there, as the project's own: each is placed in the folder the agent reads a project's skills from, and kept out of git.
type ProjectView ¶ added in v0.1.243
type ProjectView struct {
Dir string `json:"dir"`
Name string `json:"name"`
Copy bool `json:"copy"`
Skills map[string][]string `json:"skills"`
Placed []string `json:"placed"`
Missing bool `json:"missing,omitempty"` // the folder is gone
// Problems are, by skill ("" for the project's own), what couldn't be done
Problems map[string]string `json:"problems,omitempty"`
}
ProjectView is a project as the page shows it.
type RTKAgent ¶ added in v0.1.124
type RTKAgent struct {
ID string `json:"id"`
Name string `json:"name"`
Icon string `json:"icon"`
On bool `json:"on"`
// Blocked says why rtk can't be switched on for it here (OpenCode 2);
// one that has it can still be switched off
Blocked string `json:"blocked,omitempty"`
}
RTKAgent is one agent rtk can be given to, and whether it has it.
type RTKDay ¶ added in v0.1.328
type RTKDay struct {
Date string `json:"date"` // 2006-01-02, local
Commands int `json:"commands"`
Input int64 `json:"input"`
Saved int64 `json:"saved"`
Pct float64 `json:"pct"`
}
RTKDay is what rtk saved on one day it ran commands.
type RTKGain ¶ added in v0.1.124
type RTKGain struct {
Commands int `json:"commands"`
Input int64 `json:"input"`
Saved int64 `json:"saved"`
Pct float64 `json:"pct"`
}
RTKGain is what rtk says it saved, over every command it has recorded.
type RTKView ¶ added in v0.1.124
type RTKView struct {
Path string `json:"path,omitempty"` // "" when rtk isn't installed
Version string `json:"version,omitempty"`
Gain *RTKGain `json:"gain,omitempty"`
// Days are what it saved each day it ran commands, oldest first
Days []RTKDay `json:"days,omitempty"`
// Latest is rtk's latest release, "" when it isn't known (see
// CheckLatest); Upgrade the command Upgrade RTK runs, "" when magpie
// doesn't know how this rtk was installed
Latest string `json:"latest,omitempty"`
Upgrade string `json:"upgrade,omitempty"`
// Note is what an upgrade left to say: Homebrew's rtk behind rtk's
// own release
Note string `json:"note,omitempty"`
Agents []RTKAgent `json:"agents"`
URL string `json:"url"`
// Install is the command Install RTK runs, shown before it is clicked
Install string `json:"install,omitempty"`
// Restart are the agents a change reached, to be restarted to see it
Restart []string `json:"restart,omitempty"`
Backup string `json:"backup,omitempty"`
}
RTKView is the RTK part of the Library page.
func InstallRTK ¶ added in v0.1.131
InstallRTK installs rtk, when the user asks for it.
func ReadRTK ¶ added in v0.1.124
func ReadRTK() *RTKView
ReadRTK says whether rtk is installed, what it saved, and which agents have it.
func SetRTK ¶ added in v0.1.124
SetRTK gives rtk to an agent with rtk's own installer, or takes it away by taking out what that put in — which needs no rtk, so an agent left with the hook of an rtk since removed can be put right.
func UpgradeRTK ¶ added in v0.1.328
UpgradeRTK brings rtk up to its latest release the way it was installed.
func (*RTKView) CheckLatest ¶ added in v0.1.328
func (v *RTKView) CheckLatest()
CheckLatest fills in rtk's latest release (see RTKLatest).
type Result ¶
type Result struct {
Changed []string `json:"changed"` // agents whose files were written
Problems []Problem `json:"problems"` // what couldn't be written, and why
Backup string `json:"backup,omitempty"`
// Missing are the servers and skills (mcp:<name>, skill:<name>) a
// profile named that the library no longer has
Missing []string `json:"missing,omitempty"`
// Updated and Unupdated are, for an update of every skill, the ones
// fetched again and the ones that couldn't be (What is skill:<name>)
Updated []string `json:"updated,omitempty"`
Unupdated []Problem `json:"unupdated,omitempty"`
// Unimported are, for skills brought in together, the ones that
// couldn't be (What is skill:<name>)
Unimported []Problem `json:"unimported,omitempty"`
}
Result is what a change did to the agents.
func AddProject ¶ added in v0.1.243
AddProject adds a folder whose agents can be given library skills.
func ImportInstructions ¶
ImportInstructions moves the user's own instructions out of an agent's file into the library: they are added to the shared text, taken out of the file (which is kept aside first), and the agent gets the shared text from then on — so what it reads is what it read before.
func ImportServer ¶
ImportServer takes a server the agents have into the library: the agents that have it as it is get the library's from then on, the same entry.
func ImportSkill ¶
ImportSkill takes a skill the agents have of their own into the library: a folder is moved in, a link to a folder elsewhere is linked to from the library, and the agents that had it get the library's from then on.
func ImportSkills ¶ added in v0.1.491
ImportSkills is ImportSkill for several skills at once, written to the agents once. One that can't be brought in is said in Unimported, and the others are brought in all the same.
func InstallMarketSkill ¶
InstallMarketSkill adds a skill from the market, found in its repository, and gives it to the agents named — to every agent that can have skills when none are.
func InstallServer ¶
InstallServer adds a market server to the library, filled in with values (by input key), and gives it to the agents named — to every agent that can have it when none are.
func InstallSkills ¶
InstallSkills adds the skills at those paths of the source to the library and gives them to the agents named.
func KeepAgentSkill ¶ added in v0.1.498
KeepAgentSkill settles it the other way: the agent keeps its own, and the library no longer gives it that skill (nor any agent that reads the very same folder).
func ProjectCopy ¶ added in v0.1.243
ProjectCopy sets whether a project gets copies of its skills rather than links; those there are made again the other way.
func ProjectSkill ¶ added in v0.1.243
ProjectSkill sets which agents get a library skill in a project; none takes it out of the project.
func Put ¶ added in v0.1.182
Put makes the library what b says — its instructions, servers and skills in place of the ones here — and writes it into the agents, which keep whatever of theirs isn't magpie's. The skills are written aside first, and only once all of them are there does any go in; a skill replaced or taken out is kept with the backups, and so is an instructions file that changes. A skill that comes linked to a folder this computer has too is linked to it; else it comes as its files. A skill whose files are as they are here is left alone.
func RemoveProject ¶ added in v0.1.243
RemoveProject takes every skill magpie placed out of a project, and the project off the list; what's left, it couldn't take away and says why.
func RemoveServer ¶
RemoveServer takes a server out of the library and out of every agent magpie gave it to.
func RemoveSkill ¶
RemoveSkill takes a skill out of the library and every agent; its folder is kept aside with the backups, never just deleted.
func Restore ¶ added in v0.1.58
Restore gives the servers and skills to the agents s names and puts the instructions back as they were, then writes the library into the agents. A server or skill s names that the library no longer has is left out and listed in Result.Missing; one added to the library since s was taken is left with the agents it has, as s knows nothing of it. The library's own instructions files that change are kept aside with the agents' files, in the same backup.
func SaveInstructions ¶
func SaveInstructions(c InstructionsChange) (*Result, error)
SaveInstructions saves the change and writes it into the agents.
func SaveServer ¶
SaveServer adds a server, or replaces the one called old (renaming it).
func ServerAgents ¶
ServerAgents sets which agents get a server.
func SkillAgents ¶
SkillAgents sets which agents get a skill.
func Sync ¶
Sync writes the library into the agents again: after an agent is installed, or a profile brings another library in.
func UpdateSkill ¶
UpdateSkill fetches a skill from GitHub again, in place: the agents' links go on pointing at it.
func UpdateSkills ¶ added in v0.1.151
UpdateSkills fetches again every skill that came from GitHub, each repository once, and writes the agents once. A skill that couldn't be fetched is said in Unupdated; the others are updated all the same.
func UpdateSomeSkills ¶ added in v0.1.240
UpdateSomeSkills is UpdateSkills for the skills named only: those a check found GitHub to have changed.
func UseLibrarySkill ¶ added in v0.1.498
UseLibrarySkill settles an agent's own skill that stands in the way of the library's by that name for the library's: the agent's folder is kept aside with the backups, and the library's linked in its place.
type Server ¶
type Server struct {
Name string `json:"name"`
// Transport is stdio for a command, http (streamable) or sse for a URL.
Transport string `json:"transport"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
URL string `json:"url,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Agents []string `json:"agents"`
}
Server is one MCP server: a command magpie's agents start, or a URL they reach.
type ServerView ¶
type ServerView struct {
*Server
Icon string `json:"icon,omitempty"`
// Problems are the agents it couldn't be given to, and why
Problems map[string]string `json:"problems,omitempty"`
}
ServerView is a library server, and what each agent it's on made of it.
type SetView ¶ added in v0.1.181
type SetView struct {
ID string `json:"id"`
Name string `json:"name"`
Text string `json:"text"`
Active bool `json:"active,omitempty"`
}
SetView is one set of shared instructions as the page shows it.
type Setup ¶ added in v0.1.58
type Setup struct {
Instructions SetupInstructions `json:"instructions"`
MCP map[string][]string `json:"mcp"` // server → the agents that get it
Skills map[string][]string `json:"skills"` // skill → the agents that get it
}
Setup is which agents get what from the library, and the instructions, as a profile keeps them to switch back to. The servers and the skills themselves stay in the library: a setup only names them.
func (*Setup) Empty ¶ added in v0.1.58
Empty reports whether the library had nothing in it when s was taken.
func (*Setup) GivesInstructions ¶ added in v0.1.58
GivesInstructions reports whether any agent gets instructions from it.
type SetupInstructions ¶ added in v0.1.58
type SetupInstructions struct {
Set string `json:"set,omitempty"` // the set it is the text of
Agents []string `json:"agents"`
Extra map[string]string `json:"extra,omitempty"`
}
SetupInstructions is the shared text, the agents it is written to, and what each agent gets besides.
type Skill ¶
type Skill struct {
Name string `json:"name"`
Source *Source `json:"source,omitempty"`
Agents []string `json:"agents"`
// Hash is of the skill's files as last fetched from GitHub, and Commit
// the last commit to have touched its folder there, once a check has
// found the two to agree: together they tell whether GitHub has
// changed the skill since.
Hash string `json:"hash,omitempty"`
Commit string `json:"commit,omitempty"`
}
Skill is a folder with a SKILL.md, kept in the library and linked into the agents that get it.
type SkillCheck ¶ added in v0.1.240
type SkillCheck struct {
Name string `json:"name"`
// Status is current when GitHub has the skill as the library does,
// update when it has changed it since, and unknown when it couldn't be
// told (Error says why)
Status string `json:"status"`
Commit string `json:"commit,omitempty"` // the last commit to touch the skill's folder
Date string `json:"date,omitempty"` // when it was made
Message string `json:"message,omitempty"` // its first line
// URL shows what changed: the commits since the one installed, or the
// folder's history when which that was isn't known
URL string `json:"url,omitempty"`
Error string `json:"error,omitempty"`
}
SkillCheck is what a check for updates found of one skill from GitHub.
func CheckSkills ¶ added in v0.1.240
func CheckSkills() ([]SkillCheck, error)
CheckSkills asks GitHub, for every skill installed from there, for the last commit to touch its folder, and tells whether it's newer than what the library has: by the commit a skill is known to be at, or, while that isn't known yet, by fetching the repository once and comparing the folder's files with the skill's. A skill GitHub couldn't be asked about is unknown, and the others are checked all the same; once GitHub limits requests, the rest aren't asked about.
type SkillView ¶
type SkillView struct {
Name string `json:"name"`
Description string `json:"description"`
Source string `json:"source,omitempty"`
Kind string `json:"kind"` // github, folder, or "" for one kept in the library
Origin string `json:"origin,omitempty"` // on GitHub, as CC Switch installed it: it can be updated from there
Icon string `json:"icon,omitempty"`
Agents []string `json:"agents"`
Missing bool `json:"missing,omitempty"` // its folder is gone
Problems map[string]string `json:"problems,omitempty"`
Check *SkillCheck `json:"check,omitempty"` // what the last check for updates found
}
SkillView is a library skill as the page shows it.
type Source ¶
type Source struct {
Kind string `json:"kind"` // github | folder
Repo string `json:"repo,omitempty"`
Ref string `json:"ref,omitempty"`
Path string `json:"path,omitempty"` // in the repository
Dir string `json:"dir,omitempty"` // the folder, for kind folder
}
Source is where a skill came from: a GitHub repository it can be updated from, or a folder on this machine the library links to, so that editing the folder is editing the skill.
type Target ¶
type Target struct {
Agent *agent.Agent
// Instructions is the file the agent reads before every conversation;
// Override, when it exists, is read instead of it (Codex's
// AGENTS.override.md), which the page warns of.
Instructions, Override string
MCP *mcpFile
Skills string // the folder the agent finds skills in
// SkillsAlso are agents whose skills this one reads as well, as
// OpenCode reads Claude Code's.
SkillsAlso []string
// MCPVia is the extension the agent reads its MCP servers through, for
// one that has none of its own.
MCPVia string
// Note is what the page says of the agent's instructions file.
Note string
// Copy is an agent that gets a copy of each skill, made again when
// the library's changes, rather than a link: one in a WSL distro,
// which can't follow a link to a Windows folder.
Copy bool
}
Target is where one agent keeps each of the three: an empty path is something it has no user-wide place for.
type View ¶
type View struct {
Agents []AgentView `json:"agents"`
Servers []ServerView `json:"servers"`
FoundServers []Found `json:"foundServers"`
Skills []SkillView `json:"skills"`
FoundSkills []FoundSkill `json:"foundSkills"`
Projects []ProjectView `json:"projects"`
Instructions *InstructionsView `json:"instructions"`
Dir string `json:"dir"`
Backups string `json:"backups"`
}
View is the Library page.