Documentation
¶
Overview ¶
Package skillfrontmatter is the canonical structural parser for SKILL.md YAML front matter. It owns root-mapping validation, duplicate-key rejection, scalar field typing, and metadata string-map validation. Consumer-specific policy (required fields, standards warnings, sync semantics) stays with the consumers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct {
// Keys lists the non-empty top-level keys in document order, including
// unknown keys, which are tolerated at parse time.
Keys []string
// Name is the "name" field.
Name Field
// Description is the "description" field.
Description Field
// License is the "license" field.
License Field
// Compatibility is the "compatibility" field.
Compatibility Field
// AllowedTools is the "allowed-tools" field.
AllowedTools Field
// Metadata holds the "metadata" string map; nil when the key is absent
// or null, possibly empty when an empty map was supplied.
Metadata map[string]string
}
Document is the structural parse result of SKILL.md YAML front matter.
type Error ¶
type Error struct {
// Kind classifies the failure.
Kind ErrorKind
// Detail is a human-readable description of the failure.
Detail string
// Key is the offending key name for KindDuplicateKey errors.
Key string
// Err is the underlying YAML error, if any.
Err error
}
Error describes why front matter failed structural parsing.
type ErrorKind ¶
type ErrorKind int
ErrorKind classifies a structural front-matter parse failure so consumers can wrap it in their own message conventions.
const ( // KindSyntax reports YAML that could not be parsed at all. KindSyntax ErrorKind = iota + 1 // KindType reports a structural or type violation: a non-mapping root, // a non-string scalar field, or a malformed metadata map. KindType // KindDuplicateKey reports a duplicate top-level or metadata key. KindDuplicateKey )
type Field ¶
type Field struct {
// State reports whether the field was absent, null, or carried a value.
State FieldState
// Value is the raw string value; meaningful only when State is FieldValue.
Value string
// Multiline reports whether the value used a literal or folded block
// scalar style. Consumers apply their own policy to this evidence.
Multiline bool
}
Field is the structural parse result for one supported scalar field.
type FieldState ¶
type FieldState int
FieldState reports whether a supported scalar field appeared in the front matter and, if so, whether it carried a value.
const ( // FieldAbsent means the key did not appear in the front matter. FieldAbsent FieldState = iota // FieldNull means the key appeared with an explicit or implicit null value. FieldNull // FieldValue means the key appeared with a string value. FieldValue )