openenv/echo_env
6
1# SPDX-License-Identifier: BSD-3-Clause2 3"""4OpenEnv CLI entry point.5 6This module provides the main entry point for the OpenEnv command-line interface,7following the Hugging Face CLI pattern.8"""9 10import sys11 12import typer13from openenv.cli.commands import (14 build,15 catalog,16 collect,17 fork,18 harbor,19 import_env,20 init,21 push,22 serve,23 skills,24 validate,25)26 27# Create the main CLI app28app = typer.Typer(29 name="openenv",30 help="OpenEnv - An e2e framework for creating, deploying and using isolated execution environments for agentic RL training",31 no_args_is_help=True,32)33 34# Register commands35app.command(name="init", help="Initialize a new OpenEnv environment")(init.init)36app.command(name="import", help="Import a third-party environment into OpenEnv")(37 import_env.import_env38)39app.command(name="build", help="Build Docker images for OpenEnv environments")(40 build.build41)42app.add_typer(43 harbor.app,44 name="harbor",45 help="Run Harbor tasks with token-level capture (requires: pip install openenv\\[harbor])",46)47app.command(name="validate", help="Validate a package against the OpenEnv quality bar")(48 validate.validate49)50app.command(51 name="push",52 help="Push an OpenEnv environment to Hugging Face Spaces or custom registry",53)(push.push)54app.command(name="serve", help="Serve environments locally (TODO: Phase 4)")(55 serve.serve56)57app.command(58 name="fork",59 help="Fork (duplicate) a Hugging Face Space to your account",60)(fork.fork)61app.add_typer(62 skills.app,63 name="skills",64 help="Manage OpenEnv skills for AI assistants",65)66app.command(67 name="collect",68 help="Collect rollouts from a deployed OpenEnv environment",69)(collect.collect)70app.add_typer(catalog.app, name="catalog")71app.command(name="discover")(catalog.discover)72 73 74# Entry point for setuptools75def main() -> None:76 """Main entry point for the CLI."""77 try:78 app()79 except KeyboardInterrupt:80 print("\nOperation cancelled by user.")81 sys.exit(130)82 except Exception as e:83 print(f"Error: {e}", file=sys.stderr)84 sys.exit(1)85 86 87if __name__ == "__main__":88 main()89 