NAME

Langertha::Raider::CLI::REPL - Internal interactive loop of the raider CLI

VERSION

version 0.503

SYNOPSIS

# Internal to Langertha-Raider -- no API promise.
Langertha::Raider::CLI::REPL->new(app => $app, output => $out)->run(@first_prompt);

DESCRIPTION

Internal module. Its interface may change without notice.

The raider REPL: banner, line reading, slash commands via Langertha::Raider::CLI::Commands, every other line a prompt via Langertha::Raider::CLI::Runner, until /quit, /exit, :q, quit, exit or the end of input.

A line !CMD runs CMD in the shell and nothing else ("run_shell"); a line ?CMD runs it and then sends the command, its exit status and its output to the model as the next prompt ("run_shell_prompt"). A line that is only ! or ? is a prompt.

On a terminal, lines come from Term::ReadLine::Gnu (line editing, ~/.raider_history) or IO::Prompt::Tiny.

The first SIGINT (Ctrl-C) while a prompt runs cancels that turn ("cancel_run" in Langertha::Raider::CLI::Runner): the tool commands still running are ended, the raid stops at its next safe point, turn cancelled is printed, the session journal ends the run as cancelled, and the REPL reads the next line. At the prompt the first Ctrl-C only warns. A second one within two seconds, or a SIGTERM, leaves the REPL with exit status 0, after ending the tool commands still running ("terminate_children" in Langertha::Raider::CLI::Runner). While a !CMD or ?CMD runs, raider ignores SIGINT, so Ctrl-C ends the command alone. When "in" is not a terminal, lines are read from it as they are, without prompt, so piped input ends the REPL at its end.

app

The Langertha::Raider::CLI. Required.

output

The Langertha::Raider::CLI::Output to print to. Required.

in

Filehandle lines are read from when it is not a terminal. Defaults to STDIN.

active_profiles

Agent profiles to show in the banner (claude, openai).

saved_profiles

Profiles saved to the config file by this start, marked (saved).

customize_prompt

Start with the prompt-builder (--customize-prompt).

session_store

The Langertha::Raider::SessionStore a new session is created in, with the first prompt. Without one (--no-session) nothing is recorded.

session

The Langertha::Raider::Session the prompts are recorded in, once there is one. A /clear is recorded there too, as history.cleared, so resuming the session starts with an empty history again.

notes

Lines printed right after the banner: what resuming "session" found ("restore" in Langertha::Raider::CLI::Sessions).

$repl->banner($readline_impl);

Prints the logo and the live configuration: mission source, profiles, skills, packs, ignored agent files, engine, model, API key, root.

run

$repl->run(@first_prompt);

Runs the REPL; @first_prompt (the words given on the command line) is sent first. Returns when the user leaves.

run_prompt

$repl->run_prompt($text);

Runs one prompt through the runner, recorded in "session". The first prompt with a "session_store" starts the session and names it.

run_shell

my $status = $repl->run_shell('git status');

The REPL's !CMD: runs the command with $SHELL -c (/bin/sh without SHELL) in the app's root, on the terminal raider runs on, so less or vim work. A non-zero exit status is printed, as exit status N, a command ended by a signal as interrupted (SIGINT) or killed by SIGTERM. Nothing goes to the model or into the session journal. Returns the wait status, or undef when the command could not be started.

run_shell_prompt

my $ok = $repl->run_shell_prompt('make test');

The REPL's ?CMD: runs the command as "run_shell" does, but with its standard output and standard error shown as they come and captured, and standard input from /dev/null. Then the command, its exit status and the captured output ("shell_prompt") go to the model through "run_prompt", as any prompt: the model answers, the session journal records the turn. A command ended by Ctrl-C (SIGINT) sends nothing, since Ctrl-C in the REPL cancels the turn. Returns what "run_prompt" returns, false when nothing was sent.

shell_prompt

my $prompt = $repl->shell_prompt($command, $wait_status, $output);

The prompt "run_shell_prompt" sends: where the command ran, the command, its exit status and its output. An output longer than "shell_output_limit" characters keeps its head and its tail, half the limit each, with a line [... N characters omitted ...] between them.

shell_output_limit

How many characters of a ?CMD output reach the model: 20000.

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.