main.cpp¶
src/cli/main.cpp
@file main.cpp @brief entropic CLI binary — top-level dispatcher for subcommands.
Owners: @tvanfossen
main
int main(int argc, char *argv[])
CLI entry point — dispatch to subcommand.
src/cli/main.cpp:120
Source · 16 lines
int main(int argc, char* argv[])
{
std::string sub = (argc >= 2) ? argv[1] : "";
for (const auto& entry : kSubcommands) {
if (sub == entry.name) {
return entry.run(argc - 1, argv + 1);
}
}
bool help = (sub == "--help" || sub == "-h" || sub == "help");
if (!help && !sub.empty()) {
std::fprintf(stderr, "entropic: unknown subcommand '%s'\n\n",
sub.c_str());
}
print_usage();
return help ? 0 : 1;
}Activity · 9 steps
Requirements
Flows
print_usage
static void print_usage()
Print top-level usage to stderr.
src/cli/main.cpp:43
Source · 37 lines
static void print_usage()
{
std::fprintf(stderr,
"Usage: entropic <subcommand> [options]\n"
"\n"
"Subcommands:\n"
" mcp-bridge Relay MCP/stdio to a running engine's unix socket\n"
" serve Host the engine for every MCP client over HTTP\n"
" download Fetch a bundled GGUF model\n"
" version Print engine version\n"
"\n"
"Options for mcp-bridge:\n"
" --project-dir DIR Project directory whose engine to bridge to\n"
" (default: cwd). The bridge does NOT start an\n"
" engine; one must already be running for the\n"
" same project directory.\n"
" --socket PATH Override socket discovery (bypasses the\n"
" project_dir hash). For non-standard engine\n"
" deployments and deterministic testing.\n"
"\n"
"Options for serve (v2.14.0):\n"
" --config FILE Engine config (YAML)\n"
" --port N Serve MCP at http://127.0.0.1:N/mcp; clients send\n"
" the bearer token in ~/.entropic/serve/N.token\n"
" SIGUSR1 frees model weights and keeps serving\n"
"\n"
"Options for download:\n"
" --list List available model keys\n"
" --dir DIR Override target directory\n"
" (default: $ENTROPIC_MODEL_DIR or ~/.entropic/models)\n"
"\n"
"Example .mcp.json — connect Claude Code to a running engine:\n"
" {\"mcpServers\": {\"entropic\": {\n"
" \"type\": \"stdio\", \"command\": \"entropic\",\n"
" \"args\": [\"mcp-bridge\"]\n"
" }}}\n");
}