package cli import ( "os/signal" "syscall" "github.com/spf13/cobra" "gitea.mynodes.xyz/ilker/llmgw/internal/strata" ) func newStrataServeCmd() *cobra.Command { var cfg strata.Config cmd := &cobra.Command{ Use: "strata-serve [flags] [-- setup.py flags]", Short: "Run Strata as an engine: prepare the model, then serve it (started by the agent)", Hidden: true, Long: "Started by the node agent for a replica whose engine is strata. Prepares the\n" + "model from the fetched GGUF files with Strata's setup, which skips what it has\n" + "done before, then becomes Strata's server on the replica's address. The key is\n" + "read from " + strata.KeyEnv + ".", RunE: func(cmd *cobra.Command, args []string) error { ctx, stop := signal.NotifyContext(cmd.Context(), syscall.SIGINT, syscall.SIGTERM) defer stop() cfg.Args = args cfg.Log = logger() return strata.Run(ctx, cfg) }, } f := cmd.Flags() f.StringVar(&cfg.Listen, "listen", "", "the replica's address") f.StringVar(&cfg.Model, "model", "", "the model's name, for /v1/models") f.StringVar(&cfg.Weights, "weights", "", "the fetched GGUF files' directory") f.StringVar(&cfg.State, "state", "", "the replica's own directory") f.StringVar(&cfg.Data, "data", "", "the node's directory for prepared models, shared by its replicas") f.StringVar(&cfg.Python, "python", "python3", "the interpreter of Strata's environment") f.StringVar(&cfg.Dir, "strata", "", "Strata's directory, where setup.py is") f.StringVar(&cfg.Engine, "engine", "", "Strata's engine directory, where the strata binary is") for _, n := range []string{"listen", "weights", "state", "data", "strata", "engine"} { _ = cmd.MarkFlagRequired(n) } return cmd }