blib/lib/Langertha/Raider/CLI/Commands.pm

filter: Statementstmt 95.1% 197 / 207 Branchbran 78.2% 61 / 78 Conditioncond 76.9% 30 / 39 MC/DCmcdc 56.5% 13 / 23 Subroutinesub 100% 23 / 23 Podpod 12.5% 2 / 16 totaltotal 84.4% 326 / 386 CC 62 SCAR 24.6
CC
62
Cov
89%
cmd_model
24.8
cmd_pack
15.4
collapse_model_list
10.2
CRAP 11.8
« blib/lib/Langertha/Raider/CLI/Runner.pm ↑ Summary blib/lib/Langertha/Raider/Application.pm »
1 package Langertha::Raider::CLI::Commands;
2 # ABSTRACT: Internal slash commands of the raider REPL
3 59 our $VERSION = '0.503';
4 59 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 59 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 59 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 59 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 59 ▶use Langertha::Raider::CLI::PromptBuilder;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 59 ▶use Langertha::Raider::Skill;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 59 has app => (
13 is => 'ro',
14 isa => 'Langertha::Raider::CLI',
15 required => 1,
16 );
17  
18 59 has output => (
19 is => 'ro',
20 isa => 'Langertha::Raider::CLI::Output',
21 required => 1,
22 );
23  
24 has in => (
25 is => 'ro',
26 26 ▶ default => sub { \*STDIN },
Subroutine __ANON__: called CC=1 SCAR=0.0
27 59 );
28  
29 6 ▶sub prompt_builder_class { 'Langertha::Raider::CLI::PromptBuilder' }
Subroutine prompt_builder_class: called CC=1 SCAR=0.0
Pod undocumented
30 3 ▶sub skill_class { 'Langertha::Raider::Skill' }
Subroutine skill_class: called CC=1 SCAR=0.0
Pod undocumented
31  
32  
33 51 ▶sub dispatch {
Subroutine dispatch: called CC=2 SCAR=6.9
Pod documented
34 51 my ( $self, $line ) = @_;
35 51 my ( $cmd, @rest ) = split /\s+/, $line;
36 51 $cmd =~ s{^/}{};
37 51 my $method = 'cmd_'.($cmd =~ tr/-/_/r);
38 51 ▶ unless ($self->can($method)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->can($method)) 2 49 51
39 2 $self->output->say_error('unknown command: /'.$cmd.' (try /help)');
40 2 return 0;
41 }
42 49 $self->$method(join ' ', @rest);
43 49 return 1;
44 }
45  
46 4 ▶sub cmd_help {
Subroutine cmd_help: called CC=2 SCAR=6.9
Pod undocumented
47 4 my ($self) = @_;
48 4 $self->output->say_meta($_) for (
49 'commands:',
50 ' /help show this help',
51 ' /clear reset conversation history',
52 ' /metrics show cumulative raid metrics',
53 ' /stats show token usage (when trace is on)',
54 ' /reload reload the instructions file, re-detect packs',
55 ' /prompt launch the prompt-builder (edits the instructions file)',
56 ' /skill [PATH] export plain-markdown skill doc',
57 ' /skill-claude [PATH] export Claude Code SKILL.md with frontmatter',
58 ' /config show each setting and where it came from',
59 ' /model [NAME] set+save model to the config file',
60 ' /model list [FILTER] list available models (optionally filtered)',
61 ' /packs list all available packs and their state',
62 ' /pack on NAME enable a pack (toggle on)',
63 ' /pack off NAME disable a pack',
64 ' /pack NAME toggle pack on/off',
65 ' !CMD run CMD in the shell (not sent to the model)',
66 ' ?CMD run CMD, then send it and its output to the model',
67 ' /quit /exit :q leave the REPL',
68 );
69 4 return;
70 }
71  
72 4 ▶sub cmd_clear {
Subroutine cmd_clear: called CC=2 SCAR=7.0
Pod undocumented
73 4 my ($self) = @_;
74 4 my $app = $self->app;
75 4 $app->raider->clear_history;
76 4 my $t = $app->trace_plugin;
77 4 ▶ $t->token_stats({ prompt => 0, completion => 0, total => 0, calls => 0 }) if $t;
Branch: 1 branch
BranchTrueFalseTotal
if $t 0 4 4
78 4 $self->output->say_meta('history cleared.');
79 4 return;
80 }
81  
82 1 ▶sub cmd_metrics {
Subroutine cmd_metrics: called CC=1 SCAR=0.0
Pod undocumented
83 1 my ($self) = @_;
84 1 my $m = $self->app->raider->metrics;
85 $self->output->say_meta(sprintf(
86 'raids=%d iterations=%d tool_calls=%d time_ms=%d',
87 $m->{raids}, $m->{iterations}, $m->{tool_calls}, $m->{time_ms},
88 1 ));
89 1 return;
90 }
91  
92 1 ▶sub cmd_stats {
Subroutine cmd_stats: called CC=2 SCAR=8.4
Pod undocumented
93 1 my ($self) = @_;
94 1 my $s = $self->app->token_stats;
95 1 ▶ return $self->output->say_meta('stats unavailable (trace is off — start without --no-trace).')
Branch: 1 branch
BranchTrueFalseTotal
unless $s 1 0 1
96 unless $s;
97 $self->output->say_meta(sprintf(
98 'llm calls: %d | tokens in: %d | out: %d | total: %d',
99 $s->{calls}, $s->{prompt}, $s->{completion}, $s->{total},
100 0 ));
101 0 return;
102 }
103  
104 9 ▶sub cmd_reload {
Subroutine cmd_reload: called CC=4 SCAR=13.9
Pod undocumented
105 9 my ($self) = @_;
106 9 my $app = $self->app;
107 9 my @detected = $app->redetect_packs;
108 9 my $new = $app->reload_mission;
109 9 my $source = $app->mission_source;
110 9 my $file = $app->instructions->label;
111 9 ▶ my $status = $source eq '-M' ? '-M mission kept, '.$file.' not used'
Branch: 2 branches
BranchTrueFalseTotal
$source eq '-M' ? : 3 6 9
$source eq $file ? : 2 4 6
112 : $source eq $file ? 'custom ('.$file.' loaded)'
113 : 'Langertha (default, no '.$file.')';
114 9 $self->output->say_meta('mission reloaded: '.$status.' ('.length($new).' chars)');
115 9 ▶ $self->output->say_meta('detected packs: '.join(', ', @detected)) if @detected;
Branch: 1 branch
BranchTrueFalseTotal
if @detected 2 7 9
116 9 return;
117 }
118  
119 6 ▶sub cmd_prompt {
Subroutine cmd_prompt: called CC=1 SCAR=0.0
Pod undocumented
120 6 my ($self) = @_;
121 6 $self->prompt_builder_class->new(app => $self->app, output => $self->output, in => $self->in)->run;
122 6 return;
123 }
124  
125 4 ▶sub cmd_config {
Subroutine cmd_config: called CC=2 SCAR=6.9
Pod undocumented
126 4 my ($self) = @_;
127 4 my $report = eval { $self->app->explain_config };
128 4 ▶ unless ($report) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($report) 1 3 4
129 1 my $err = $@; chomp $err;
130 1 return $self->output->say_error($err);
131 }
132 3 $self->output->config_report($report);
133 3 return;
134 }
135  
136 2 ▶sub cmd_skill {
Subroutine cmd_skill: called CC=2 SCAR=7.0
Pod undocumented
137 2 my ( $self, $arg ) = @_;
138 2 ▶ my $path = $arg || path($self->app->root)->child('RAIDER-SKILL.md')->stringify;
Condition66%2/3
$arg || path($self->app->root)->child('RAIDER-SKILL.md')->stringify
l!l&&r!l&&!r
110
MC/DC0%0/2
$arg || path($self->app->root)->child('RAIDER-SKILL.md')->stringify
$arg path($self->app->root)->child('RAIDER-SKILL.md')->stringify
Truth table66%2/3
A || B
A= $argB= path($self->app->root)->child('RAIDER-SKILL.md')->stringify
ABresult
1X1
011
000
139 2 my $p = $self->skill_class->new(app => $self->app)->write_markdown($path);
140 2 $self->output->say_meta('wrote '.$p);
141 2 return;
142 }
143  
144 1 ▶sub cmd_skill_claude {
Subroutine cmd_skill_claude: called CC=3 SCAR=11.2
Pod undocumented
145 1 my ( $self, $arg ) = @_;
146 1 my $skill = $self->skill_class->new(app => $self->app);
147 1 ▶ my $p = $skill->write_claude_skill(length $arg ? $arg : undef);
Branch: 1 branch
BranchTrueFalseTotal
length $arg ? : 0 1 1
148 1 $self->output->say_meta('wrote '.$p);
149 1 ▶ if (my $old = $skill->legacy_claude_skill) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $old = $skill->legacy_claude_skill) 1 0 1
150 1 $self->output->say_meta('note: '.$old.' is left over from an older raider, remove it');
151 }
152 1 return;
153 }
154  
155 5 ▶sub cmd_model {
Subroutine cmd_model: called CC=22 SCAR=32.1
Pod undocumented
156 5 my ( $self, $arg ) = @_;
157 5 my $app = $self->app;
158 5 my $out = $self->output;
159 5 my ( $subcmd, $filter ) = split /\s+/, $arg, 2;
160  
161 5 ▶ if (!length $arg || $subcmd eq 'list') {
Branch: 1 branch
BranchTrueFalseTotal
if (not length $arg or $subcmd eq "list") 3 2 5
Condition100%3/3
not length $arg or $subcmd eq "list"
l!l&&r!l&&!r
122
MC/DC100%2/2
not length $arg or $subcmd eq "list"
not length $arg $subcmd eq "list"
Truth table100%3/3
not(A) or B
A= not length $argB= $subcmd eq "list"
ABresult
1X1
011
000
162 3 ▶ my $current = $app->has_model ? $app->model : '';
Branch: 1 branch
BranchTrueFalseTotal
$app->has_model ? : 3 0 3
163 3 $out->emit($out->c(meta => 'engine: '), $out->c(title => $app->engine_name), "\n");
164 3 ▶ $out->emit($out->c(meta => 'model: '), $out->c(title => length $current ? $current : '(engine default)'), "\n");
Branch: 1 branch
BranchTrueFalseTotal
length $current ? : 3 0 3
165 3 my $engine = eval { $app->_engine };
166 3 ▶ return unless $engine && $engine->can('list_models');
Branch: 1 branch
BranchTrueFalseTotal
unless $engine and $engine->can("list_models") 0 3 3
Condition33%1/3
$engine and $engine->can("list_models")
!ll&&!rl&&r
003
MC/DC0%0/2
$engine and $engine->can("list_models")
$engine $engine->can("list_models")
Truth table33%1/3
A and B
A= $engineB= $engine->can("list_models")
ABresult
0X0
100
111
167 3 my $list = eval { $engine->list_models };
168 3 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 1 2 3
169 1 my $err = $@; chomp $err;
170 1 return $out->say_error('list_models failed: '.$err);
171 }
172 2 ▶ return unless @$list;
Branch: 1 branch
BranchTrueFalseTotal
unless @$list 0 2 2
173 my @filtered = length($filter // '')
174 2 ▶ ? grep { index($_, $filter) >= 0 } @$list
Branch: 1 branch
BranchTrueFalseTotal
length($filter // '') ? : 1 1 2
Condition100%2/2
$filter // ""
l!l
11
MC/DC100%1/1
$filter // ""
$filter
Truth table100%2/2
A
A= $filter
Aresult
11
00
175 : @$list;
176 2 my @rows = $self->collapse_model_list(\@filtered, $current);
177 2 my $total = scalar @rows;
178 2 ▶ my $cap = (defined $subcmd && $subcmd eq 'list') ? $total : 20;
Branch: 1 branch
BranchTrueFalseTotal
defined $subcmd && $subcmd eq 'list' ? : 2 0 2
Condition33%1/3
defined $subcmd and $subcmd eq "list"
!ll&&!rl&&r
002
MC/DC0%0/2
defined $subcmd and $subcmd eq "list"
defined $subcmd $subcmd eq "list"
Truth table33%1/3
A and B
A= defined $subcmdB= $subcmd eq "list"
ABresult
0X0
100
111
179 2 ▶ my @show = @rows[0 .. ($cap < $total ? $cap - 1 : $total - 1)];
Branch: 1 branch
BranchTrueFalseTotal
$cap < $total ? : 0 2 2
180 2 ▶ $out->emit($out->c(meta => 'models'.(length($filter // '') ? ' (/'.$filter.'/)' : '').':'), "\n");
Branch: 1 branch
BranchTrueFalseTotal
length($filter // '') ? : 1 1 2
Condition100%2/2
$filter // ""
l!l
11
MC/DC100%1/1
$filter // ""
$filter
Truth table100%2/2
A
A= $filter
Aresult
11
00
181 2 for my $row (@show) {
182 4 ▶ my $star = $row->{current} ? $out->c(accent => '*') : ' ';
Branch: 1 branch
BranchTrueFalseTotal
$$row{'current'} ? : 2 2 4
183 4 my $n = scalar @{ $row->{snaps} };
184 4 ▶ my $snaps = $n ? $out->c(meta => ' [+'.$n.($n == 1 ? ' snapshot]' : ' snapshots]')) : '';
Branch: 2 branches
BranchTrueFalseTotal
$n ? : 2 2 4
$n == 1 ? : 1 1 2
185 4 $out->emit(' '.$star.' '.$out->c(title => $row->{id}).$snaps."\n");
186 }
187 2 ▶ $out->emit($out->c(meta => ' … '.$cap.' of '.$total.' shown — /model list [filter] for all'), "\n")
Branch: 1 branch
BranchTrueFalseTotal
if $cap < $total 0 2 2
188 if $cap < $total;
189 2 return;
190 }
191 2 ▶ unless (eval { $app->config->set_model($arg); 1 }) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { $app->config->set_model($arg); 1 } }) 0 2 2
192 0 my $err = $@; chomp $err;
193 0 return $out->say_error($err);
194 }
195 2 $out->emit($out->c(meta => 'model saved: '), $out->c(title => $arg),
196 $out->c(meta => ' (takes effect on next start)'), "\n");
197 2 return;
198 }
199  
200  
201 2 ▶sub collapse_model_list {
Subroutine collapse_model_list: called CC=10 SCAR=23.2
Pod documented
202 2 my ( $self, $list, $current ) = @_;
203 2 my %groups; # base => [snapshot variants]
204 my %is_snap; # id => 1
205  
206 2 for my $id (@$list) {
207 6 ▶ if (my ($base) = ($id =~ /^(.+?)-\d{4}-\d{2}-\d{2}(?:-.+)?$/)) {
Branch: 2 branches
BranchTrueFalseTotal
if (my($base) = $id =~ /^(.+?)-\d{4}-\d{2}-\d{2}(?:-.+)?$/) { } 3 3 6
elsif (my($base2) = $id =~ /^(.+)-\d{4}$/) { } 0 3 3
208 3 push @{$groups{$base}}, $id;
209 3 $is_snap{$id} = 1;
210 }
211 elsif (my ($base2) = ($id =~ /^(.+)-\d{4}$/)) {
212 0 push @{$groups{$base2}}, $id;
213 0 $is_snap{$id} = 1;
214 }
215 }
216  
217 2 my @rows;
218 2 for my $id (sort @$list) {
219 6 ▶ next if $is_snap{$id};
Branch: 1 branch
BranchTrueFalseTotal
if $is_snap{$id} 3 3 6
220 3 ▶ my @snaps = sort @{$groups{$id} // []};
Condition100%2/2
$groups{$id} // []
l!l
12
MC/DC100%1/1
$groups{$id} // []
$groups{$id}
Truth table100%2/2
A
A= $groups{$id}
Aresult
11
00
221 push @rows, {
222 id => $id,
223 snaps => \@snaps,
224 3 ▶ current => ($id eq $current || !!(grep { $_ eq $current } @snaps)),
Condition66%2/3
$id eq $current || !!grep({$_ eq $current;} @snaps)
l!l&&r!l&&!r
201
MC/DC50%1/2
$id eq $current || !!grep({$_ eq $current;} @snaps)
$id eq $current !!grep({$_ eq $current;} @snaps)
Truth table66%2/3
A || B
A= $id eq $currentB= !!grep({$_ eq $current;} @snaps)
ABresult
1X1
011
000
225 };
226 }
227  
228 # orphaned snapshot families whose base isn't a standalone model
229 2 my %seen = map { $_->{id} => 1 } @rows;
230 2 for my $base (sort keys %groups) {
231 2 ▶ next if $seen{$base};
Branch: 1 branch
BranchTrueFalseTotal
if $seen{$base} 1 1 2
232 1 my @snaps = sort @{$groups{$base}};
233 push @rows, {
234 id => $base,
235 snaps => \@snaps,
236 orphan => 1,
237 1 current => !!(grep { $_ eq $current } @snaps),
238 };
239 }
240  
241 2 return sort { $a->{id} cmp $b->{id} } @rows;
242 }
243  
244 3 ▶sub cmd_packs {
Subroutine cmd_packs: called CC=7 SCAR=19.5
Pod undocumented
245 3 my ($self) = @_;
246 3 my $out = $self->output;
247 3 my $collection = $self->app->packs;
248 3 my @all = @{$collection->all_pack_names};
249 3 ▶ return $out->say_meta('no packs available.') unless @all;
Branch: 1 branch
BranchTrueFalseTotal
unless @all 0 3 3
250 3 my %why = map { $_->{name} => $out->pack_reason($_) } @{$collection->activation_report};
251 3 $out->say_meta('packs:');
252 3 for my $name (sort @all) {
253 26 my $info = $collection->pack_info($name);
254 26 ▶ my $active = $info->{is_active} ? $out->c(accent => '*') : ' ';
Branch: 1 branch
BranchTrueFalseTotal
$$info{'is_active'} ? : 7 19 26
255 $out->emit(' '.$active.' '.$name.' ', $out->c(meta => '('.$info->{exclusive_group}.')'),
256 26 ▶ ( length($why{$name} // '') ? ( ' ', $out->c(meta => $why{$name}) ) : () ), "\n");
Branch: 1 branch
BranchTrueFalseTotal
length($why{$name} // '') ? : 12 14 26
Condition100%2/2
$why{$name} // ""
l!l
1214
MC/DC100%1/1
$why{$name} // ""
$why{$name}
Truth table100%2/2
A
A= $why{$name}
Aresult
11
00
257 }
258 3 for my $s (@{$collection->skipped_packs}) {
259 1 $out->emit(' ', $out->c(warn => 'skipped pack '.$s->{name}.' ('.$s->{origin}.' '.$s->{path}.'): '.$s->{reason}), "\n");
260 }
261 3 return;
262 }
263  
264 15 ▶sub cmd_pack {
Subroutine cmd_pack: called CC=15 SCAR=27.4
Pod undocumented
265 15 my ( $self, $arg ) = @_;
266 15 my $app = $self->app;
267 15 my $out = $self->output;
268 15 my $collection = $app->packs;
269 15 my ( $subcmd, $name ) = split /\s+/, $arg, 2;
270 15 ▶ $name //= '';
Condition100%2/2
$name //= ""
l!l
114
MC/DC100%1/1
$name //= ""
$name
Truth table100%2/2
A
A= $name
Aresult
11
00
271 15 ▶ $subcmd //= '';
Condition100%2/2
$subcmd //= ""
l!l
141
MC/DC100%1/1
$subcmd //= ""
$subcmd
Truth table100%2/2
A
A= $subcmd
Aresult
11
00
272 15 my $usage = 'usage: /pack on NAME, /pack off NAME, or /pack NAME (toggle)';
273  
274 # /packs lists; a bare /pack is a usage error.
275 15 ▶ return $out->say_error($usage) if !$name && ($subcmd eq '' || $subcmd eq 'list');
Branch: 1 branch
BranchTrueFalseTotal
if not $name and $subcmd eq "" || $subcmd eq "list" 1 14 15
Condition83%5/6
not $name and $subcmd eq "" || $subcmd eq "list"
!ll&&!rl&&r
1131
$subcmd eq "" or $subcmd eq "list"
l!l&&r!l&&!r
103
MC/DC66%2/3
not $name and $subcmd eq "" || $subcmd eq "list"
not $name $subcmd eq "" $subcmd eq "list"
Truth table75%3/4
not(A) and B or C
A= not $nameB= $subcmd eq ""C= $subcmd eq "list"
ABCresult
0XX0
1000
11X1
1011
276  
277 14 ▶ if ($subcmd eq 'on') {
Branch: 1 branch
BranchTrueFalseTotal
if ($subcmd eq "on") 6 8 14
278 6 $collection->enable($name);
279 6 $app->reload_mission;
280 6 return $out->say_meta('pack enabled: '.$name);
281 }
282 8 ▶ if ($subcmd eq 'off') {
Branch: 1 branch
BranchTrueFalseTotal
if ($subcmd eq "off") 4 4 8
283 4 $collection->disable($name);
284 4 $app->reload_mission;
285 4 return $out->say_meta('pack disabled: '.$name);
286 }
287  
288 # Toggle
289 4 ▶ if ($subcmd eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($subcmd eq "") 0 4 4
290 0 $subcmd = $name;
291 0 $name = '';
292 }
293 4 ▶ if ($name eq '' && grep { $subcmd eq $_ } @{$collection->all_pack_names}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "" and grep {$subcmd eq $_;} @{$collection->all_pack_names;}) 3 1 4
Condition66%2/3
$name eq "" and grep {$subcmd eq $_;} @{$collection->all_pack_names;}
!ll&&!rl&&r
103
MC/DC50%1/2
$name eq "" and grep {$subcmd eq $_;} @{$collection->all_pack_names;}
$name eq "" grep {$subcmd eq $_;} @{$collection->all_pack_names;}
Truth table66%2/3
A and B
A= $name eq ""B= grep {$subcmd eq $_;} @{$collection->all_pack_names;}
ABresult
0X0
100
111
294 # Direct /pack NAME (no subcmd)
295 3 $name = $subcmd;
296 3 $subcmd = '';
297 }
298 4 ▶ return $out->say_error($usage) if $name eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "" 0 4 4
299  
300 4 ▶ if ($subcmd eq '' || $subcmd eq 'toggle') {
Branch: 1 branch
BranchTrueFalseTotal
if ($subcmd eq "" or $subcmd eq "toggle") 3 1 4
Condition66%2/3
$subcmd eq "" or $subcmd eq "toggle"
l!l&&r!l&&!r
301
MC/DC50%1/2
$subcmd eq "" or $subcmd eq "toggle"
$subcmd eq "" $subcmd eq "toggle"
Truth table66%2/3
A or B
A= $subcmd eq ""B= $subcmd eq "toggle"
ABresult
1X1
011
000
301 3 $collection->toggle($name);
302 3 $app->reload_mission;
303 3 ▶ my $now = $collection->is_active($name) ? 'enabled' : 'disabled';
Branch: 1 branch
BranchTrueFalseTotal
$collection->is_active($name) ? : 3 0 3
304 3 return $out->say_meta('pack '.$name.' '.$now.'.');
305 }
306  
307 1 return $out->say_error('unknown /pack subcommand: '.$subcmd.' (try /help)');
308 }
309  
310 59 __PACKAGE__->meta->make_immutable;
311  
312 59 1;
313  
314 __END__
315  
316 =pod
317  
318 =encoding UTF-8
319  
320 =head1 NAME
321  
322 Langertha::Raider::CLI::Commands - Internal slash commands of the raider REPL
323  
324 =head1 VERSION
325  
326 version 0.503
327  
328 =head1 SYNOPSIS
329  
330 # Internal to Langertha-Raider -- no API promise.
331 my $commands = Langertha::Raider::CLI::Commands->new(app => $app, output => $out);
332 $commands->dispatch('/pack on polite');
333  
334 =head1 DESCRIPTION
335  
336 B<Internal module.> Its interface may change without notice.
337  
338 The slash commands of the F<raider> REPL (C</help>, C</clear>, C</metrics>,
339 C</stats>, C</reload>, C</prompt>, C</skill>, C</skill-claude>, C</config>,
340 C</model>, C</packs>, C</pack>). Each command C</name> is the method
341 C<cmd_name> (dashes become underscores) and gets the rest of the line as
342 its argument. Leaving the REPL (C</quit>) is the REPL's business.
343  
344 =head2 app
345  
346 The L<Langertha::Raider::CLI> the commands act on. Required.
347  
348 =head2 output
349  
350 The L<Langertha::Raider::CLI::Output> to print to. Required.
351  
352 =head2 in
353  
354 Filehandle C</prompt> reads its conversation from. Defaults to C<STDIN>.
355  
356 =head2 dispatch
357  
358 $commands->dispatch('/model list gpt');
359  
360 Runs one slash command line. Returns false for an unknown command (after
361 saying so), true otherwise.
362  
363 =head2 collapse_model_list
364  
365 my @rows = $commands->collapse_model_list(\@ids, $current);
366  
367 Folds dated snapshots (C<gpt-4o-2024-08-06>, C<claude-3-5-sonnet-20241022>
368 style C<-YYYY> suffixes) under their base model. Returns sorted rows
369 C<{ id, snaps, current, orphan }>; C<orphan> marks a snapshot family whose
370 base is not listed itself.
371  
372 =head1 SEE ALSO
373  
374 =over
375  
376 =item * L<Langertha::Raider::CLI>
377  
378 =back
379  
380 =head1 SUPPORT
381  
382 =head2 Issues
383  
384 Please report bugs and feature requests on GitHub at
385 L<https://github.com/Getty/langertha-raider/issues>.
386  
387 =head2 IRC
388  
389 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
390  
391 =head1 CONTRIBUTING
392  
393 Contributions are welcome! Please fork the repository and submit a pull request.
394  
395 =head1 AUTHOR
396  
397 Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>
398  
399 =head1 COPYRIGHT AND LICENSE
400  
401 This software is copyright (c) 2026 by Torsten Raudssus.
402  
403 This is free software; you can redistribute it and/or modify it under
404 the same terms as the Perl 5 programming language system itself.
405  
406 =cut
« blib/lib/Langertha/Raider/CLI/Runner.pm ↑ Summary blib/lib/Langertha/Raider/Application.pm »