Files
llmgw/internal/cli/root.go
Ilker ManapandClaude Opus 5.5 fde1501e8a ComfyUI as an engine of the cluster's own
A model whose profiles run engine comfyui is placed on a node's card like
any other, and makes pictures there. ComfyUI asks for no key, so the agent
starts it behind llmgw comfyui-gate: ComfyUI on the loopback, the gate on
the replica's port demanding the replica's key and letting through only
what the router asks — queueing, waiting, fetching, cancelling. The gate
answers the agent's /health and /v1/models, shows ComfyUI the fetched
weights by their own names, and gives each replica its own base directory.
ComfyUI runs as the gate's child, so its card memory is the replica's.

A node offers the engine when agent.yaml names its ComfyUI
(engines.comfyui.dir). The model's comfyui: block names the workflow and,
for a source that is a set of files, the checkpoint.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 00:39:10 +02:00

75 lines
1.9 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})
},
// Bare, in a terminal: the setup screens or the console. Otherwise
// the help, as before.
RunE: func(cmd *cobra.Command, _ []string) error {
if interactive(cmd) {
return runHome(cmd)
}
return cmd.Help()
},
}
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(),
newTenancyCmd(),
newUsersCmd(),
newOrgCmd(),
newMirrorCmd(),
newBundleCmd(),
newSimEngineCmd(),
newComfyUIGateCmd(),
newDoctorCmd(),
newNodeCmd(),
newSelfUpgradeCmd(),
newReleaseCmd(),
newJoinCmd(),
newFirewallCmd(),
newWipeCmd(),
newDocsCmd(),
)
// status, start, stop and restart: the whole system; service: this
// machine's services.
root.AddCommand(newSystemCmds()...)
root.AddCommand(newServiceCmd())
return root
}
func logger() *slog.Logger { return slog.Default() }