NAME

Langertha::Raider::CLI::Main - Internal command-line entry point behind bin/raider

VERSION

version 0.503

SYNOPSIS

# Internal to Langertha-Raider -- no API promise.
exit Langertha::Raider::CLI::Main->new->run(@ARGV);

DESCRIPTION

Internal module. Its interface may change without notice.

Everything raider does with its command line: the hall, acp, config explain, config migrate, session and provider inspect subcommands, option parsing, the skill exports, and then either the REPL (Langertha::Raider::CLI::REPL) or one prompt (Langertha::Raider::CLI::Runner). "run" returns the exit status.

Exit status

0 -- success, including --help, --version, the exports, config explain, config migrate (also with nothing to migrate, and --dry-run), session list, session show, session fork, session rm, provider inspect of a valid manifest and leaving the REPL.
1 -- the run failed: the engine, a tool or the network raised an error (with a machine format, the output is the failed document); for config migrate: the migration was refused (a new file or a backup already exists, .raider is no directory, the home directory) or a step failed; for provider inspect: the manifest was refused (address, redirect), could not be fetched or is not valid; for --provider also: its endpoint is not usable (another origin, not https, a refused address, a dialect or auth type this raider has no adapter for, no models, a model on several endpoints).
2 -- usage error: unknown option, a -o that is not KEY=VALUE, an unknown config subcommand, no prompt, more than one machine format, a machine format with -i, or an unknown machine format version; for config migrate: a word after it or a machine format; for sessions: a --session value that is no session id, more than one of --session, --continue and --no-session, an unknown or ambiguous session, or --continue without any session; for provider inspect: no target or more than one, a target that is no host or https origin, or a --stream-* flag; for --provider: a target that is none, -e, -o engine=, -o url= or config explain with it, a model the manifest does not list, no -m where it lists several models, or no -k where the endpoint needs a key; --allow-internal without --provider.
3 -- configuration error: the config file (.raider/config.yml, else .raider.yml; for config migrate the .raider.yml to migrate) cannot be read, the engine is unknown, or a pack detection rule is invalid.
4 -- the session to continue (--session, --continue, session resume) or to remove (session rm) is in use: another raider has it open for writing and holds its lock. Unlike a usage error the same command can work later, which is why it has a status of its own.
130, 143 -- a one-shot run was cancelled by SIGINT or interrupted by SIGTERM (see "run_prompt" in Langertha::Raider::CLI::Runner). It writes the cancelled or interrupted document (or a note), then dies of that same signal, which a shell reports as 128 plus the signal number; see "die_of_signal" in Langertha::Raider::CLI::Runner.

The hall and acp subcommands keep their own exit statuses. The REPL's two-strike Ctrl-C leaves with 0.

output

The Langertha::Raider::CLI::Output for everything but diagnostics. Defaults to one on STDOUT.

err

Filehandle for diagnostics. Defaults to STDERR.

in

Filehandle a prompt or the REPL input is read from. Defaults to STDIN.

usage

The --help text.

version_line

The --version line: raider's version (that of Langertha::Raider), then that of Langertha core.

raider 0.503 (Langertha 0.503)   # for example

parse_options

my ( $opt, @prompt ) = $main->parse_options(@argv);

Parses the options; returns the option hash (with -o pairs in engine_options, and a machine format in machine as format, stream and version) and the remaining words, or nothing after reporting a usage error.

app_args

my %args = $main->app_args($opt);

Constructor arguments for Langertha::Raider::CLI from the parsed options, without config and the skill sources. With a machine format the live trace is off unless --trace asks for it, and then goes to "err", so stdout carries only the machine output.

run

my $exit = $main->run(@argv);

Does what the command line says and returns the exit status.

resume_session

my ( $exit, $session, @notes ) = $main->resume_session($app, $ref);

Opens the session $ref names ("resolve_session"; the newest one of the project when undef, for --continue) for writing through "open_session" in Langertha::Raider::Application and replays it into the app's raider through "restore" in Langertha::Raider::CLI::Sessions. Returns undef, the Langertha::Raider::Session and the notes of the resume -- or, after reporting why, just the exit status: 2 when there is no such session or $ref is ambiguous, 4 when another raider has it open, 1 when it cannot be opened or replayed otherwise.

session_command

my $exit = $main->session_command(list => undef, $opt);
my $exit = $main->session_command(show => $id, $opt);

raider session list, show ID, fork ID and rm ID for the project in -r (or the working directory), through the Langertha::Raider::Application of that project and Langertha::Raider::CLI::Sessions; a document format (--json, --msgpack, --yaml) writes them as one document. rm of a session another raider has open ends with 4, as a resume of it would; a fork or removal that fails otherwise with 1.

migrate_usage

The raider config migrate --help text.

migrate_command

my $exit = $main->migrate_command(@argv);

raider config migrate [--dry-run] [options] through Langertha::Raider::Config::Migrate: the report ("migrate_report" in Langertha::Raider::CLI::Output) on "output", then, without --dry-run, the migration. A refusal or a failed step is reported on "err". Takes --dry-run, -r, --no-color and --help; the other options of raider are accepted and have no effect, as for the session commands. A word after it or a machine format is a usage error: the report is for humans only.

provider_usage

The raider provider inspect --help text.

provider_command

my $exit = $main->provider_command(inspect => @argv);

raider provider inspect TARGET [options] through Langertha::Raider::CLI::Provider. Takes --allow-internal, a document format (--json, --msgpack, --yaml; no stream), --no-color and --help; the other options of raider are accepted and have no effect, as for the session commands. Exactly one target is a must.

provider_usage_error

my $problem = $main->provider_usage_error($opt, $config_cmd);

Why --provider or --allow-internal cannot go with the rest of the command line, or undef. --provider decides the engine and its URL, so it excludes -e, -o engine= and -o url=, and it does not go with config explain; --allow-internal only goes with --provider.

resolve_session

my $id = $main->resolve_session($store, '3f2a');

The whole id of the session a command-line reference names -- the id, a unique start of it or its four hex digits ("resolve" in Langertha::Raider::SessionStore). An unknown or ambiguous reference is reported on "err" and gives undef.

new_session

my $session = $main->new_session($app, $machine);

Starts the session a one-shot run is recorded in ("create_session" in Langertha::Raider::Application) and names it on "err" (with a machine format the document names it instead). A session that cannot be written is reported and the run goes on without one.

interrupt_startup

$main->interrupt_startup(TERM => $machine, $t0);

Ends raider on a SIGINT or SIGTERM that arrives with a machine format before the run starts: the interrupted document (or its run.finished), then death by the signal, as for an interrupted run ("interrupt" in Langertha::Raider::CLI::Runner).

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha-raider/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.