NAME
Skilletor::CLI - The skilletor command line – arguments, usage, exit codes (spec §7)
VERSION
version 0.008000
SYNOPSIS
use Skilletor::CLI;
exit Skilletor::CLI::run(@ARGV);
DESCRIPTION
The command line of the Perl port, after the reference's src/cli.ts: the same usage text, version, options, error lines and exit codes, byte for byte – the shared conformance cases (../conformance, op cli) run either CLI against the same expectations.
It runs sync, check and status on Skilletor::Engine, with --scope, --force and --json as the reference reads them:
syncprints its report, orskilletor: up to datewhen no scope has anything to say;--jsonprints the report as JSON. A config error puts the report (text, or JSON with--json) on stderr and exits 2.checkprintschangedand exits 1 when a sync is due, elseup to dateand 0;--jsonprints the report. An error is the one lineskilletor: <error>on stderr, exit 2 – never JSON, with--jsontoo.statusprints the declared items per scope, naming its targets unless they are Claude Code alone;--jsonprints the report. An error goes to stdout as well, exit 2.
It runs add, trust, source list, source remove, available, install and uninstall through Skilletor::Commands:
add [<name>] <spec> [--project]resolves the spec (a generic host probed, Skilletor::Probe), adds the source to the user config, or the project config, trusts it and syncs:added source <name> (<fields as JSON>), orsource <name> already added (<fields as JSON>), kept as iswhen that config has the name at the same address, then the sync's text. A sync that stops at a config error exits 2: after an edit with the two lines naming the saved config file (k103), after a kept entry with the sync's own report.trust <source>trusts the source for the backend it would use now and printstrusted source <name> (<kind> <address>).source listprints one line per source,<name> [<origin>] <fields as JSON>;--jsonprints the list as JSON.source remove <name> [--project] [--force]removes the source from the user config, or the project config, then syncs: the sync's report, orremoved source <name>when it has nothing to say. A sync that stops at a config error exits 2 with two lines on stderr naming the saved config file (k103).available [<source>]lists what the trusted sources offer, or that one source, under the sync lock: per item a line of✓when it is installed (a blank when not), its type and<name>@<source>, then— <description>when it has one; under it, indented four spaces,error: <why>for an item that cannot be built. A bundle's line is always followed by one:error: <why>, its members joined by,, or(no items).--jsonprints the list as JSON. A source not trusted is skipped, even by name.install <item>... [--project]adds each item ([type:]name@source,type:*@source,bundle:name@source) to the user config, or the project config, then syncs and prints the sync's text. Every item is checked first, under the sync lock; one that fails changes nothing. A bundle naming sources by an address no configured source serves: on a terminal (stdin and stderr) each is asked for on stderr, a name, the proposed one ornto skip, and an added one is trusted asaddtrusts; elsewhere the command fails naming theskilletor addcommands. A sync that stops at a config error exits 2 with two lines on stderr naming the saved config file (k103).uninstall <item>... [--project]removes explicit item, wildcard or bundle entries from the user or project config, then syncs and prints its text. Every item is checked before any edit. An item still installed by a wildcard or bundle leaves a warning on stderr after its explicit entry is removed; an item with no explicit entry exits 1 and the diagnostic names the covering entry or where else it is declared. A sync that stops at a config error exits 2 and names the saved config file.
A refusal or a config file that does not load is skilletor: <why> on stderr, exit 1, nothing changed.
The engine runs on this machine: the home from $HOME, the project from --project-dir or the git top level of the working directory ("project_root_of"), state under $CLAUDE_CONFIG_DIR or ~/.claude, in skilletor/, and the real host and user for templates. The engine and the commands are loaded only for the commands that run, every other module by the first call that needs it, so --version, --help and a usage error in ASCII load none of them and stay quick.
hook <event> [--harness codex|hermes] runs a hook (Skilletor::Hooks): the input is stdin's JSON (none on a terminal; malformed input counts as none), the project $SKILLETOR_PROJECT_DIR, else $CLAUDE_PROJECT_DIR, else the git top level of the input's cwd. It prints one compact JSON line when the hook has something to say and exits 0 whatever happens – a failure is that line's systemMessage, its own setup's too. It is dispatched before any option check, so no option makes it fail. Its background sync re-runs this CLI ("self_command").
Beside them the CLI has the argument layer: --help, --version, the options each command accepts, an unknown option or command, an invalid --scope and a missing operand.
Output is UTF-8; every line a user's input reaches is escaped by "display_safe" in Skilletor::Report.
run
my $exit = Skilletor::CLI::run(@ARGV);
Runs one command line – the arguments as the operating system passes them, UTF-8 bytes – writing to STDOUT and STDERR, and returns the exit code: 0, 1 for a failure, 2 for a usage error.
parse_flags
my $flags = parse_flags(@args);
The arguments after the command: { scope, json, force, project, project_dir, options, rest }. options lists every option given, by name (--scope=user is --scope), in order; rest holds the operands and every option the parser does not know. scope is undef when --scope is the last argument.
project_root_of
my $root = project_root_of($cwd);
The project of a working directory as the reference's hooks and CLI find it; "project_root_of" in Skilletor::Hooks, exported here as well.
self_command
my $argv = self_command();
my $argv = self_command( packed => 0, perl => $^X, inc => \@INC, script => $0 );
my $argv = self_command( packed => 1, progname => $ENV{PAR_PROGNAME} );
The command line that runs this CLI once more, without its arguments – what the hooks' background sync starts. A PAR-packed binary ("is_packed") is its own program: [ $ENV{PAR_PROGNAME} ], the binary's full path (in a packed binary $^X is the bare name perl, and $0 the name it was called by). Plain perl runs $^X with the script $0, and every directory of @INC as -I, so the child loads the same modules. Each part can be given, for a test.
is_packed
True in a PAR-packed binary: PAR's loader is loaded ($INC{'PAR.pm'}) and names the program in PAR_PROGNAME.
unknown_option
my $option = unknown_option( $cmd, $flags );
The first option $cmd does not accept, or undef.
SUPPORT
Issues
Please report bugs and feature requests at https://github.com/Getty/skilletor/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)