Comments, doc comments, test names, error and log messages, CLI help, README, Makefile, CI step names and the design document are now all in English. No behaviour changes; the full suite passes under the race detector. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
// Package cli builds llmgw's command line surface.
|
|
package cli
|
|
|
|
import (
|
|
"log/slog"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/obs"
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/version"
|
|
)
|
|
|
|
type globalFlags struct {
|
|
logLevel string
|
|
logFormat string
|
|
}
|
|
|
|
var global globalFlags
|
|
|
|
// Root returns the root command with all subcommands attached.
|
|
func Root() *cobra.Command {
|
|
root := &cobra.Command{
|
|
Use: "llmgw",
|
|
Short: "LLM gateway for multi-fabric InfiniBand and heterogeneous GPU clusters",
|
|
Long: "llmgw serves LLMs running on your own GPU servers behind a single\n" +
|
|
"OpenAI-compatible endpoint. One binary, different roles per subcommand.",
|
|
Version: version.Version,
|
|
SilenceUsage: true,
|
|
SilenceErrors: true,
|
|
PersistentPreRun: func(_ *cobra.Command, _ []string) {
|
|
obs.Setup(obs.Options{Level: global.logLevel, Format: global.logFormat})
|
|
},
|
|
}
|
|
|
|
pf := root.PersistentFlags()
|
|
pf.StringVar(&global.logLevel, "log-level", "info", "log level: debug|info|warn|error")
|
|
pf.StringVar(&global.logFormat, "log-format", "text", "log format: text|json")
|
|
|
|
root.AddCommand(
|
|
newServerCmd(),
|
|
newAgentCmd(),
|
|
newCtlCmd(),
|
|
newSimEngineCmd(),
|
|
)
|
|
return root
|
|
}
|
|
|
|
func logger() *slog.Logger { return slog.Default() }
|