A source can install agents (agents/<name>.md files with a frontmatter name) alongside or instead of skills. - manifest: optional "agents" selection; lock: "agents" map - add --agent / --all-agents, remove --agent, list shows the kind - check/update diff agents like skills (files, not directories) - dashboard lists and removes agents - home-manager module: agentTargets (default .claude/agents) links <name>.md Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
// Package lock is skills.lock.json: what each source is pinned to. Only skm writes it.
|
|
package lock
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"skill-manager/internal/jsonfile"
|
|
)
|
|
|
|
const version = 1
|
|
|
|
type Lock struct {
|
|
Version int `json:"version"`
|
|
Sources map[string]*Source `json:"sources"`
|
|
}
|
|
|
|
type Source struct {
|
|
// Locked is passed verbatim to builtins.fetchTree.
|
|
Locked map[string]any `json:"locked"`
|
|
// Skills maps installed name to the skill's directory in the source.
|
|
Skills map[string]string `json:"skills"`
|
|
// Agents maps installed name to the agent's .md file in the source.
|
|
Agents map[string]string `json:"agents,omitempty"`
|
|
}
|
|
|
|
func (s Source) Rev() string {
|
|
rev, _ := s.Locked["rev"].(string)
|
|
return rev
|
|
}
|
|
|
|
func Load(path string) (*Lock, error) {
|
|
l := &Lock{Version: version}
|
|
if _, err := jsonfile.Read(path, l); err != nil {
|
|
return nil, err
|
|
}
|
|
if l.Version != version {
|
|
return nil, fmt.Errorf("%s: unsupported lock version %d", path, l.Version)
|
|
}
|
|
if l.Sources == nil {
|
|
l.Sources = map[string]*Source{}
|
|
}
|
|
return l, nil
|
|
}
|
|
|
|
func (l *Lock) Save(path string) error {
|
|
return jsonfile.Write(path, l)
|
|
}
|