From 15210997a753d5019efb744f40ad8e99bace6e99 Mon Sep 17 00:00:00 2001 From: Hemang Date: Thu, 10 Apr 2025 22:29:38 +0200 Subject: [PATCH] Add the invariant-gateway CLI script. --- gateway/__main__.py | 36 ++++++++++++++++++++++++++++++++++++ pyproject.toml | 5 ++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 gateway/__main__.py diff --git a/gateway/__main__.py b/gateway/__main__.py new file mode 100644 index 0000000..b351c45 --- /dev/null +++ b/gateway/__main__.py @@ -0,0 +1,36 @@ +"""Script is used to run actions using the Invariant Gateway.""" + +import sys + + +def main(): + """Entry point for the Invariant Gateway.""" + actions = { + "mcp": "Runs the Invariant Gateway against MCP (Model Context Protocol) servers with guardrailing and push to Explorer features", + "llm": "Runs the Invariant Gateway against LLM providers with guardrailing and push to Explorer features", + "help": "Shows this help message", + } + + def _help(): + """Prints the help message.""" + print("\nSupported Commands by invariant-gateway:\n") + for verb, description in actions.items(): + print(f"{verb}: {description}") + + if len(sys.argv) < 2: + _help() + sys.exit(1) + + verb = sys.argv[1] + if verb == "mcp": + # Use sys.argv[2:] to pass arguments to the MCP gateway + return 0 + if verb == "llm": + # Use sys.argv[2:] to pass arguments to the LLM gateway + print("LLM gateway via the invariant-gateway command is not implemented yet.") + return 1 + if verb == "help": + _help() + return 0 + print(f"Unknown action: {verb}") + return 1 diff --git a/pyproject.toml b/pyproject.toml index befa096..61edb73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "invariant-gateway" -version = "0.1.0" +version = "0.0.1" description = "LLM proxy to observe and debug what your AI agents are doing" readme = "README.md" requires-python = ">=3.12" @@ -16,6 +16,9 @@ dependencies = [ [tool.setuptools.packages.find] where = ["."] +[project.scripts] +invariant-gateway = "gateway.__main__:main" + [build-system] requires = ["setuptools>=61.0", "wheel"] build-backend = "setuptools.build_meta" \ No newline at end of file