NAME
Skilletor::Spec - Resolve an add shorthand (owner/repo, a forge link, a URL, a path) to a source
VERSION
version 0.001
SYNOPSIS
use Skilletor::Spec qw( resolve_spec );
my $r = resolve_spec( 'Getty/karr', $probe );
# { kind => 'git', value => 'https://github.com/Getty/karr', derivedName => 'karr' }
my $t = resolve_spec( 'https://github.com/Getty/skills/tree/main/perl', $probe );
# { kind => 'git', value => 'https://github.com/Getty/skills', derivedName => 'getty',
# ref => 'main', path => 'perl' }
DESCRIPTION
The reference's spec.ts (spec §4.2): what skilletor add makes of what the user typed, once, at add time – the config always stores the explicit form. Local paths, explicit URLs (any scheme, scp-like, git's transport::address), github:owner/repo, known forges (GitHub, GitLab, Codeberg, Hugging Face) including their tree, commit, tag and release links, bare owners and owner/repo resolve without the network; only a generic host.tld[/path] is probed. The probe is the caller's: a code reference called with the base URL, answering { git => 1 }, { tarball => 1 } or neither.
Errors are Skilletor::Error::Spec with the reference's messages. The derived name is always a valid source name (source when nothing of the spec is left).
resolve_spec
resolve_spec( $spec, $probe );
{ kind => 'git' | 'url' | 'local', value, derivedName, ref?, path? } – the reference's field names.
normalize_name
Lower case, a trailing .git dropped, every run of other characters than a-z0-9- one -, no - at either end.
decode_uri_component
decodeURIComponent; undef where it throws.
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.