NAME
Skilletor::Frontmatter - The reference's YAML subset – agent frontmatter and bundle files
VERSION
version 0.001
SYNOPSIS
use Skilletor::Frontmatter qw( split_frontmatter parse_yaml_document );
my $fm = split_frontmatter($agent_markdown);
# { data => { name => 'reviewer', tools => [ 'Read', 'Grep' ] }, body => "You review…\n" }
my $bundle = parse_yaml_document($bundle_yaml); # line numbers from 1
DESCRIPTION
The reference's frontmatter.ts: a deliberately small subset of YAML, enough for what agent files and bundle files (spec §15.1) use – nested block mappings, block and flow sequences of scalars, flat flow mappings, plain, quoted and block (|, >) scalars, comments. Anything else – anchors, aliases, tags, mappings inside sequences, nested flow collections – is a Skilletor::Error::Frontmatter naming the line, worded as the reference words it. Ported rather than taken from a YAML module, so a file reads the same and fails the same in both implementations.
Values: mappings are insertion-ordered hashes ("js_ordered" in Skilletor::JSON), sequences array references, null undef, booleans JSON::MaybeXS booleans, integers numbers (a non-safe integer stays its text), floats "Skilletor::Frontmatter::Float" objects.
split_frontmatter
my $fm = split_frontmatter($text); # { data, body }
Without an opening --- line the data is empty and the body the whole text. The body is what follows the closing fence, leading blank lines removed.
parse_yaml_document
A whole document in the same subset (a bundle file); errors count lines from 1.
is_yaml_float
True for a "Skilletor::Frontmatter::Float".
Skilletor::Frontmatter::Float
A YAML float; ->value is the number.
SUPPORT
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.