openenv/coding_env
21
1# Copyright (c) Meta Platforms, Inc. and affiliates.2# All rights reserved.3#4# This source code is licensed under the BSD-style license found in the5# LICENSE file in the root directory of this source tree.6 7"""8OpenEnv CLI entry point.9 10This module provides the main entry point for the OpenEnv command-line interface,11following the Hugging Face CLI pattern.12"""13 14import sys15 16import typer17from openenv.cli.commands import build, fork, init, push, serve, skills, validate18 19# Create the main CLI app20app = typer.Typer(21 name="openenv",22 help="OpenEnv - An e2e framework for creating, deploying and using isolated execution environments for agentic RL training",23 no_args_is_help=True,24)25 26# Register commands27app.command(name="init", help="Initialize a new OpenEnv environment")(init.init)28app.command(name="build", help="Build Docker images for OpenEnv environments")(29 build.build30)31app.command(32 name="validate", help="Validate environment structure and deployment readiness"33)(validate.validate)34app.command(35 name="push",36 help="Push an OpenEnv environment to Hugging Face Spaces or custom registry",37)(push.push)38app.command(name="serve", help="Serve environments locally (TODO: Phase 4)")(39 serve.serve40)41app.command(42 name="fork",43 help="Fork (duplicate) a Hugging Face Space to your account",44)(fork.fork)45app.add_typer(46 skills.app,47 name="skills",48 help="Manage OpenEnv skills for AI assistants",49)50 51 52# Entry point for setuptools53def main() -> None:54 """Main entry point for the CLI."""55 try:56 app()57 except KeyboardInterrupt:58 print("\nOperation cancelled by user.")59 sys.exit(130)60 except Exception as e:61 print(f"Error: {e}", file=sys.stderr)62 sys.exit(1)63 64 65if __name__ == "__main__":66 main()67 