feat: skm, pin agent skills from git repos via Nix
CLI (add, remove, list, outdated, update, import) over a skills.json manifest and a skills.lock.json pinned with nix flake prefetch, plus a home-manager module that links each locked skill via builtins.fetchTree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
65a96ada8e
26 files changed
+2843
No files matched your search
@@ -0,0 +1,45 @@
|
||||
// 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"`
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
Reference in new issue
Block a user