Documentation
¶
Overview ¶
Package skilljson provides utilities for reading and surgically modifying individual skill.json files. Updates are performed as byte-level substitutions so the original key order, indentation, and trailing newline of the file are preserved across rewrites.
Index ¶
- Constants
- type SkillFile
- func (sf *SkillFile) Bytes() []byte
- func (sf *SkillFile) DockyardOCIPackage() (idx int, skillName, currentTag string)
- func (sf *SkillFile) GitPackage() int
- func (sf *SkillFile) SetIdentifier(idx int, newIdentifier string) error
- func (sf *SkillFile) SetRef(idx int, newRef string) error
- func (sf *SkillFile) Write() error
Constants ¶
const DockyardSkillPrefix = "ghcr.io/stacklok/dockyard/skills/"
DockyardSkillPrefix is the OCI identifier prefix for skills published by the stacklok/dockyard pipeline.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SkillFile ¶
type SkillFile struct {
// Path is the filesystem path to the skill.json file.
Path string
// Skill is the parsed skill structure.
Skill thvregistry.Skill
// contains filtered or unexported fields
}
SkillFile represents a loaded skill.json with both its parsed structure and its original bytes for round-trip fidelity.
func (*SkillFile) Bytes ¶
Bytes returns the current (possibly modified) raw bytes of the skill.json.
func (*SkillFile) DockyardOCIPackage ¶
DockyardOCIPackage returns the index of the first OCI package whose identifier starts with DockyardSkillPrefix, along with the parsed skill name and current tag from the identifier. Returns idx == -1 when no such package is present.
func (*SkillFile) GitPackage ¶
GitPackage returns the index of the first git package, or -1 if none.
func (*SkillFile) SetIdentifier ¶
SetIdentifier replaces the OCI identifier of the package at idx with a byte-level substitution. The old identifier must occur exactly once in the raw file bytes.