From 17995ed5cdfcbc2974dfb17858b265b3e82e6dc6 Mon Sep 17 00:00:00 2001 From: jhcipar Date: Thu, 5 Feb 2026 16:25:56 -0500 Subject: [PATCH] fix: standardize cli cmd names --- docs/Flash_Apps_and_Environments.md | 5 ++--- docs/Flash_Deploy_Guide.md | 12 ++++++------ src/runpod_flash/cli/commands/deploy.py | 12 ++++++------ src/runpod_flash/cli/main.py | 4 ++-- .../cli/utils/skeleton_template/README.md | 2 +- tests/unit/cli/test_deploy.py | 18 ++++++++++-------- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/docs/Flash_Apps_and_Environments.md b/docs/Flash_Apps_and_Environments.md index 69fb06fa..c725fc43 100644 --- a/docs/Flash_Apps_and_Environments.md +++ b/docs/Flash_Apps_and_Environments.md @@ -13,15 +13,14 @@ Flash apps are the top-level packaging unit for Flash projects. Each app tracks - `FlashApp` instances call `_hydrate()` to fetch or create the remote app ID before doing any work. - CLI helpers (`flash app ...`, `flash deploy ...`) call `discover_flash_project()` when `--app-name` is omitted, then hydrate via `FlashApp.from_name` or eager constructors. 2. **Environment Creation** - - `flash deploy new ` calls `FlashApp.create_environment_and_app` to ensure the parent app exists and to create the environment in a single async transaction. + - `flash deploy create ` calls `FlashApp.create_environment_and_app` to ensure the parent app exists and to create the environment in a single async transaction. - Once created, the CLI prints both a confirmation panel and a table summarizing the environment metadata so operators can confirm IDs/states. 3. **Build Upload & Resource Provisioning** - `flash build` generates `.flash/artifact.tar.gz` artifacts containing source code and flash_manifest.json. `flash deploy send ` uploads the archive and provisions all resources upfront before environment activation, extracting the manifest on each resource during boot. 4. **Inspection & Operations** - `flash app list/get` surface app-level metadata: environment counts, build history, IDs. - - `flash deploy list/info` zoom into environment state, showing associated endpoints and volumes, while `flash deploy delete` undeploys associated resources before deleting the environment (aborting on failures) with confirmation prompts. + - `flash deploy list/get` zoom into environment state, showing associated endpoints and volumes, while `flash deploy delete` undeploys associated resources before deleting the environment (aborting on failures) with confirmation prompts. ## Operational Notes - Flash app CLI entrypoint wraps async helpers with `asyncio.run`, so tests patch that boundary and the shared Rich `console` to keep assertions deterministic. - Environment deletion requires confirmation because the API call is irreversible. The CLI renders a warning `Panel` with the app/env IDs before prompting. - diff --git a/docs/Flash_Deploy_Guide.md b/docs/Flash_Deploy_Guide.md index 6a98656f..2078429d 100644 --- a/docs/Flash_Deploy_Guide.md +++ b/docs/Flash_Deploy_Guide.md @@ -55,7 +55,7 @@ graph TB ### Key Concepts -**Mothership**: The orchestration endpoint responsible for deployment, resource provisioning, and manifest distribution. Created via `flash deploy new `. +**Mothership**: The orchestration endpoint responsible for deployment, resource provisioning, and manifest distribution. Created via `flash deploy create `. **Child Endpoints**: Worker endpoints that execute `@remote` functions. One per resource config (e.g., `gpu_config`, `cpu_config`). @@ -69,12 +69,12 @@ graph TB ## CLI Commands Reference -### flash deploy new +### flash deploy create Create a new deployment environment (mothership). ```bash -flash deploy new [--app-name ] +flash deploy create [--app-name ] ``` **Arguments:** @@ -90,7 +90,7 @@ flash deploy new [--app-name ] **Example:** ```bash -flash deploy new production +flash deploy create production # Output: Environment 'production' created successfully # Environment ID: flash-prod-abc123 # Next: flash deploy send production @@ -154,12 +154,12 @@ flash deploy list [--app-name ] --- -### flash deploy info +### flash deploy get Show detailed information about a deployment environment. ```bash -flash deploy info [--app-name ] +flash deploy get [--app-name ] ``` **Arguments:** diff --git a/src/runpod_flash/cli/commands/deploy.py b/src/runpod_flash/cli/commands/deploy.py index 93e9e271..cb3fba0b 100644 --- a/src/runpod_flash/cli/commands/deploy.py +++ b/src/runpod_flash/cli/commands/deploy.py @@ -102,7 +102,7 @@ def list_command( asyncio.run(list_flash_environments(app_name)) -async def new_flash_deployment_environment(app_name: str, env_name: str): +async def create_flash_deployment_environment(app_name: str, env_name: str): """ Create a new flash deployment environment. Creates a flash app if it doesn't already exist. """ @@ -133,7 +133,7 @@ async def new_flash_deployment_environment(app_name: str, env_name: str): console.print(f"\nNext: [bold]flash deploy send {env_name}[/bold]") -async def info_flash_environment(app_name: str, env_name: str): +async def get_flash_environment(app_name: str, env_name: str): """ Get detailed information about a flash deployment environment. """ @@ -202,7 +202,7 @@ async def list_flash_environments(app_name: str): console.print(table) -def new_command( +def create_command( app_name: str | None = typer.Option( None, "--app-name", "-a", help="Flash app name to create a new environment in" ), @@ -214,7 +214,7 @@ def new_command( if not app_name: _, app_name = discover_flash_project() assert app_name is not None - asyncio.run(new_flash_deployment_environment(app_name, name)) + asyncio.run(create_flash_deployment_environment(app_name, name)) return environments = get_deployment_environments() @@ -291,14 +291,14 @@ def send_command( raise typer.Exit(1) -def info_command( +def get_command( env_name: str = typer.Argument(..., help="Name of the deployment environment"), app_name: str = typer.Option(None, "--app-name", "-a", help="Flash app name"), ): """Show detailed information about a deployment environment.""" if not app_name: _, app_name = discover_flash_project() - asyncio.run(info_flash_environment(app_name, env_name)) + asyncio.run(get_flash_environment(app_name, env_name)) async def _fetch_environment_info(app_name: str, env_name: str) -> dict: diff --git a/src/runpod_flash/cli/main.py b/src/runpod_flash/cli/main.py index 04019b2c..ab7ec79a 100644 --- a/src/runpod_flash/cli/main.py +++ b/src/runpod_flash/cli/main.py @@ -49,9 +49,9 @@ def get_version() -> str: ) deploy_app.command("list")(deploy.list_command) -deploy_app.command("new")(deploy.new_command) +deploy_app.command("create")(deploy.create_command) deploy_app.command("send")(deploy.send_command) -deploy_app.command("info")(deploy.info_command) +deploy_app.command("get")(deploy.get_command) deploy_app.command("delete")(deploy.delete_command) # deploy_app.command("report")(deploy.report_command) # deploy_app.command("rollback")(deploy.rollback_command) diff --git a/src/runpod_flash/cli/utils/skeleton_template/README.md b/src/runpod_flash/cli/utils/skeleton_template/README.md index 864b5f21..ca8cd307 100644 --- a/src/runpod_flash/cli/utils/skeleton_template/README.md +++ b/src/runpod_flash/cli/utils/skeleton_template/README.md @@ -168,7 +168,7 @@ flash run flash build # Create deployment environment -flash deploy new production +flash deploy create production # Deploy to Runpod flash deploy send production diff --git a/tests/unit/cli/test_deploy.py b/tests/unit/cli/test_deploy.py index 6d8e8b5b..0de1422b 100644 --- a/tests/unit/cli/test_deploy.py +++ b/tests/unit/cli/test_deploy.py @@ -105,12 +105,12 @@ def test_list_envs_uses_discovery( mock_from_name.assert_awaited_once_with("derived") -class TestDeployNew: +class TestDeployCreate: @patch( "runpod_flash.cli.commands.deploy.FlashApp.create_environment_and_app", new_callable=AsyncMock, ) - def test_new_environment_success( + def test_create_environment_success( self, mock_create, runner, mock_asyncio_run_coro, patched_console ): mock_app = MagicMock() @@ -127,7 +127,9 @@ def test_new_environment_success( "runpod_flash.cli.commands.deploy.asyncio.run", side_effect=mock_asyncio_run_coro, ): - result = runner.invoke(app, ["deploy", "new", "dev", "--app-name", "demo"]) + result = runner.invoke( + app, ["deploy", "create", "dev", "--app-name", "demo"] + ) assert result.exit_code == 0 mock_create.assert_awaited_once_with("demo", "dev") @@ -138,11 +140,11 @@ def test_new_environment_success( assert isinstance(table, Table) -class TestDeployInfo: +class TestDeployGet: @patch( "runpod_flash.cli.commands.deploy.FlashApp.from_name", new_callable=AsyncMock ) - def test_info_includes_children( + def test_get_includes_children( self, mock_from_name, runner, mock_asyncio_run_coro, patched_console ): flash_app = MagicMock() @@ -163,7 +165,7 @@ def test_info_includes_children( "runpod_flash.cli.commands.deploy.asyncio.run", side_effect=mock_asyncio_run_coro, ): - result = runner.invoke(app, ["deploy", "info", "dev", "--app-name", "demo"]) + result = runner.invoke(app, ["deploy", "get", "dev", "--app-name", "demo"]) assert result.exit_code == 0 panel = patched_console.print.call_args_list[0].args[0] @@ -176,7 +178,7 @@ def test_info_includes_children( @patch( "runpod_flash.cli.commands.deploy.FlashApp.from_name", new_callable=AsyncMock ) - def test_info_without_children( + def test_get_without_children( self, mock_from_name, runner, mock_asyncio_run_coro, patched_console ): flash_app = MagicMock() @@ -197,7 +199,7 @@ def test_info_without_children( "runpod_flash.cli.commands.deploy.asyncio.run", side_effect=mock_asyncio_run_coro, ): - result = runner.invoke(app, ["deploy", "info", "dev", "--app-name", "demo"]) + result = runner.invoke(app, ["deploy", "get", "dev", "--app-name", "demo"]) assert result.exit_code == 0 # Only the panel should be printed when there are no child resources