Knarr/CLI.pm

filter: Statementstmt 26.0% 13 / 50 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 1 totaltotal 26.6% 16 / 60 CC 2 SCAR 9.7
CC
2
Cov
25%
__ANON__
6.0
__ANON__
2.0
execute
2.0
CRAP 2.6
« Knarr/Protocol/ACP.pm ↑ Summary Knarr/Handler/Tracing.pm »
1 package Langertha::Knarr::CLI;
2 # ABSTRACT: CLI entry point for Knarr LLM Proxy
3 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use MooX::Cmd;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use MooX::Options protect_argv => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 1 our $VERSION = '1.100';
9  
10 option config => (
11 is => 'ro',
12 format => 's',
13 short => 'c',
14 doc => 'Config file path (default: ./knarr.yaml)',
15 0 ▶ default => sub { './knarr.yaml' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
16 1 );
17  
18  
19 option verbose => (
20 is => 'ro',
21 short => 'v',
22 doc => 'Enable verbose logging (or set KNARR_DEBUG=1)',
23 0 ▶ default => sub { $ENV{KNARR_DEBUG} ? 1 : 0 },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'KNARR_DEBUG'} ? : 0 0 0
24 1 negativable => 1,
25 );
26  
27  
28 sub execute {
29 0 ▶ my ($self) = @_;
Subroutine execute: not called CC=1 SCAR=6.9
Pod undocumented
30 0 print _banner();
31 0 print "\n";
32 0 print "USAGE\n";
33 0 print " knarr <command> [options]\n\n";
34 0 print "COMMANDS\n";
35 0 print " start Start the proxy server\n";
36 0 print " init Scan environment and generate configuration\n";
37 0 print " models List configured models and their backends\n";
38 0 print " check Validate configuration file\n\n";
39 0 print "GLOBAL OPTIONS\n";
40 0 print " -c, --config <path> Config file (default: ./knarr.yaml)\n";
41 0 print " -v, --verbose Enable verbose logging\n\n";
42 0 print "QUICK START (Docker)\n";
43 0 print " docker run -e OPENAI_API_KEY=sk-... -p 8080:8080 raudssus/langertha-knarr\n\n";
44 0 print "QUICK START (Local)\n";
45 0 print " knarr init > knarr.yaml\n";
46 0 print " knarr start\n\n";
47 0 print "EXAMPLES\n";
48 0 print " knarr start # Start with ./knarr.yaml\n";
49 0 print " knarr start -c production.yaml -p 9090 # Custom config and port\n";
50 0 print " knarr start --from-env # Auto-detect from ENV\n";
51 0 print " knarr start --from-env -p 8080 -p 11434 # ENV config, custom ports\n";
52 0 print " knarr init > knarr.yaml # Generate config\n";
53 0 print " knarr models # List configured models\n";
54 0 print " knarr check # Validate config\n\n";
55 0 print "ENVIRONMENT\n";
56 0 print " OPENAI_API_KEY OpenAI API key\n";
57 0 print " ANTHROPIC_API_KEY Anthropic API key\n";
58 0 print " LANGFUSE_PUBLIC_KEY Langfuse public key (enables tracing)\n";
59 0 print " LANGFUSE_SECRET_KEY Langfuse secret key\n";
60 0 print " LANGFUSE_URL Langfuse URL (default: https://cloud.langfuse.com)\n";
61 0 print " KNARR_API_KEY Proxy authentication key (optional)\n\n";
62 0 print "Version $VERSION | https://github.com/Getty/langertha-knarr\n";
63 }
64  
65 sub _banner {
66 0 ▶ return <<'BANNER';
Subroutine _banner: not called CC=1 SCAR=6.9
67 . * .
68 . _/|_ . KNARR
69 . /| |\ . Langertha LLM Proxy
70 ~~~~~|______|~~~~~
71 ~~ ~~~~~~~~~~~~~ ~~ Cargo transport for your LLM calls
72 ~~~~~~~~~~~~~~~~~~~~
73 BANNER
74 }
75  
76 1 1;
77  
78 __END__
79  
80 =pod
81  
82 =encoding UTF-8
83  
84 =head1 NAME
85  
86 Langertha::Knarr::CLI - CLI entry point for Knarr LLM Proxy
87  
88 =head1 VERSION
89  
90 version 1.100
91  
92 =head1 DESCRIPTION
93  
94 MooX::Cmd entry point for the C<knarr> CLI. Dispatches to subcommand classes
95 under C<Langertha::Knarr::CLI::Cmd::*>. When invoked without a subcommand,
96 prints a banner and usage summary.
97  
98 For full CLI documentation see L<knarr> and L<Langertha::Knarr>.
99  
100 =head1 SEE ALSO
101  
102 =over
103  
104 =item * L<knarr> — CLI synopsis and option reference
105  
106 =item * L<Langertha::Knarr> — Full documentation
107  
108 =item * L<Langertha::Knarr::CLI::Cmd::Start> — C<knarr start>
109  
110 =item * L<Langertha::Knarr::CLI::Cmd::Init> — C<knarr init>
111  
112 =item * L<Langertha::Knarr::CLI::Cmd::Models> — C<knarr models>
113  
114 =item * L<Langertha::Knarr::CLI::Cmd::Check> — C<knarr check>
115  
116 =back
117  
118 =head2 --config
119  
120 Path to the YAML configuration file. Short form: C<-c>. Defaults to
121 C<./knarr.yaml>. Applies to all subcommands.
122  
123 =head2 --verbose
124  
125 Enable verbose logging to stderr. Short form: C<-v>. Applies to all
126 subcommands.
127  
128 =head1 SUPPORT
129  
130 =head2 Issues
131  
132 Please report bugs and feature requests on GitHub at
133 L<https://github.com/Getty/langertha-knarr/issues>.
134  
135 =head2 IRC
136  
137 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
138  
139 =head1 CONTRIBUTING
140  
141 Contributions are welcome! Please fork the repository and submit a pull request.
142  
143 =head1 AUTHOR
144  
145 Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>
146  
147 =head1 COPYRIGHT AND LICENSE
148  
149 This software is copyright (c) 2026 by Torsten Raudssus.
150  
151 This is free software; you can redistribute it and/or modify it under
152 the same terms as the Perl 5 programming language system itself.
153  
154 =cut
« Knarr/Protocol/ACP.pm ↑ Summary Knarr/Handler/Tracing.pm »