Skip to main content

mesh_llm_cli/parser/
runtime_surface_help.rs

1use super::normalization::RuntimeSurface;
2
3pub fn runtime_surface_help(surface: RuntimeSurface) -> String {
4    match surface {
5        RuntimeSurface::Serve => concat!(
6            "Serve local models and join or publish a mesh.\n\n",
7            "Usage: mesh-llm serve [OPTIONS]\n\n",
8            "Common serving options:\n",
9            "      --model <MODEL>          Startup model to serve from the catalog, a path, or a Hugging Face ref\n",
10            "      --gguf <GGUF>            Raw local GGUF file to serve directly\n",
11            "      --mmproj <MMPROJ>        Multimodal projector for the primary served model\n",
12            "      --auto                   Auto-join the best discovered mesh\n",
13            "      --join <JOIN>            Join a mesh via invite token\n",
14            "      --publish                Publish this mesh for discovery\n",
15            "      --local-model-only       Serve one local model without mesh networking or management APIs\n",
16            "      --port <PORT>            OpenAI-compatible API port [default: 9337]\n",
17            "      --console <CONSOLE>      Management console/API port [default: 3131]\n",
18            "      --log-format <FORMAT>    Terminal output format [default: pretty]\n\n",
19            "Bare `mesh-llm serve` loads startup models from ~/.mesh-llm/config.toml.\n",
20            "Add [[models]] there or pass --model / --gguf explicitly.\n",
21            "With --local-model-only, --model, --gguf, and --mmproj must be absolute, non-symlink paths.\n",
22            "Run `mesh-llm --help-advanced` for the full runtime option surface.\n"
23        )
24        .to_string(),
25        RuntimeSurface::Client => concat!(
26            "Run as a client-only mesh node with no local model required.\n\n",
27            "Usage: mesh-llm client [OPTIONS]\n\n",
28            "Common client options:\n",
29            "      --auto                   Auto-join the best discovered mesh\n",
30            "      --discover [NAME]        Discover and join a mesh by name\n",
31            "      --join <JOIN>            Join a mesh via invite token\n",
32            "      --port <PORT>            Local OpenAI-compatible proxy port [default: 9337]\n",
33            "      --console <CONSOLE>      Management console/API port [default: 3131]\n",
34            "      --log-format <FORMAT>    Terminal output format [default: pretty]\n\n",
35            "Run `mesh-llm --help-advanced` for the full runtime option surface.\n"
36        )
37        .to_string(),
38    }
39}
40
41#[cfg(test)]
42mod tests {
43    use super::*;
44
45    #[test]
46    fn serve_surface_help_describes_serving_options() {
47        let help = runtime_surface_help(RuntimeSurface::Serve);
48
49        assert!(help.contains("Usage: mesh-llm serve"));
50        assert!(help.contains("--model"));
51        assert!(help.contains("--gguf"));
52        assert!(help.contains("--local-model-only"));
53        assert!(help.contains("startup models"));
54        assert!(!help.contains("Pool GPUs over the internet for LLM inference\n\nUsage: mesh-llm"));
55    }
56
57    #[test]
58    fn client_surface_help_describes_client_options() {
59        let help = runtime_surface_help(RuntimeSurface::Client);
60
61        assert!(help.contains("Usage: mesh-llm client"));
62        assert!(help.contains("--auto"));
63        assert!(help.contains("--discover"));
64        assert!(help.contains("client-only"));
65        assert!(!help.contains("--model <MODEL>"));
66    }
67}