Skip to content

Commit fbe9587

Browse files
yeldarbyclaude
andcommitted
feat(cli): v1.3.0 — polish consistency, help, and description
- Bump version to 1.3.0 - Better CLI description: 'Build and deploy computer vision models...' - Hide noisy aliases from --help (login, whoami, upload, import) — keep download - Hide --install-completion/--show-completion (we have 'completion' subcommand) - Add 'roboflow help' as alias for --help - workspace get defaults to current workspace when no ID given - Commands alphabetized in help output 374 tests pass, all linting clean. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f2a893e commit fbe9587

4 files changed

Lines changed: 38 additions & 13 deletions

File tree

roboflow/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from roboflow.models import CLIPModel, GazeModel # noqa: F401
1616
from roboflow.util.general import write_line
1717

18-
__version__ = "1.2.16"
18+
__version__ = "1.3.0"
1919

2020

2121
def check_key(api_key, model, notebook, num_retries=0):

roboflow/cli/__init__.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,15 @@
2020

2121
app = typer.Typer(
2222
name="roboflow",
23-
help="Roboflow CLI: computer vision at your fingertips",
23+
help=(
24+
"Build and deploy computer vision models with Roboflow. "
25+
"Manage datasets, train models, run inference, and deploy "
26+
"workflows \u2014 from the command line or via structured JSON for AI agents."
27+
),
2428
no_args_is_help=True,
2529
pretty_exceptions_enable=False, # We handle errors ourselves via output_error
30+
rich_markup_mode="rich",
31+
add_completion=False, # We have our own 'completion' subcommand
2632
)
2733

2834

@@ -92,6 +98,7 @@ def _root_callback(
9298
from roboflow.cli.handlers.workflow import workflow_app # noqa: E402
9399
from roboflow.cli.handlers.workspace import workspace_app # noqa: E402
94100

101+
# Register command groups (alphabetical order)
95102
app.add_typer(annotation_app, name="annotation")
96103
app.add_typer(auth_app, name="auth")
97104
app.add_typer(batch_app, name="batch")
@@ -112,11 +119,20 @@ def _root_callback(
112119
infer_command(app)
113120
search_command(app)
114121

115-
# Backwards-compat aliases (loaded last)
122+
# "roboflow download" — visible shorthand (common enough to show)
123+
# "roboflow help" — alias for --help
116124
from roboflow.cli.handlers._aliases import register_aliases # noqa: E402
117125

118126
register_aliases(app)
119127

128+
129+
# "roboflow help" command
130+
@app.command("help", hidden=True)
131+
def help_command(ctx: typer.Context) -> None:
132+
"""Show help information."""
133+
print(ctx.parent.get_help() if ctx.parent else ctx.get_help()) # noqa: T201
134+
135+
120136
# ---------------------------------------------------------------------------
121137
# Backwards-compat: build_parser returns None (argparse is gone)
122138
# ---------------------------------------------------------------------------

roboflow/cli/handlers/_aliases.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
def register_aliases(app: typer.Typer) -> None:
2020
"""Register top-level aliases for common commands."""
2121

22-
# --- roboflow login (visible alias for auth login) ---
22+
# --- roboflow login (hidden alias for auth login) ---
2323

24-
@app.command("login")
24+
@app.command("login", hidden=True)
2525
def login_alias(
2626
ctx: typer.Context,
2727
login_api_key: Annotated[
@@ -35,19 +35,19 @@ def login_alias(
3535
args = ctx_to_args(ctx, login_api_key=login_api_key, force=force)
3636
_login(args)
3737

38-
# --- roboflow whoami (visible alias for auth status) ---
38+
# --- roboflow whoami (hidden alias for auth status) ---
3939

40-
@app.command("whoami")
40+
@app.command("whoami", hidden=True)
4141
def whoami_alias(ctx: typer.Context) -> None:
4242
"""Show current user (alias for 'auth status')."""
4343
from roboflow.cli.handlers.auth import _status
4444

4545
args = ctx_to_args(ctx)
4646
_status(args)
4747

48-
# --- roboflow upload (visible alias for image upload) ---
48+
# --- roboflow upload (hidden alias for image upload) ---
4949

50-
@app.command("upload")
50+
@app.command("upload", hidden=True)
5151
def upload_alias(
5252
ctx: typer.Context,
5353
path: Annotated[str, typer.Argument(help="Path to image file or directory")],
@@ -81,9 +81,9 @@ def upload_alias(
8181
)
8282
_handle_upload(args)
8383

84-
# --- roboflow import (visible alias for image upload with directory) ---
84+
# --- roboflow import (hidden alias for image upload with directory) ---
8585

86-
@app.command("import")
86+
@app.command("import", hidden=True)
8787
def import_alias(
8888
ctx: typer.Context,
8989
path: Annotated[str, typer.Argument(metavar="folder", help="Path to dataset folder")],

roboflow/cli/handlers/workspace.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Annotated
5+
from typing import Annotated, Optional
66

77
import typer
88

@@ -21,9 +21,18 @@ def list_workspaces(ctx: typer.Context) -> None:
2121
@workspace_app.command("get")
2222
def get_workspace(
2323
ctx: typer.Context,
24-
workspace_id: Annotated[str, typer.Argument(help="Workspace URL or ID")],
24+
workspace_id: Annotated[
25+
Optional[str], typer.Argument(help="Workspace URL or ID (defaults to current workspace)")
26+
] = None,
2527
) -> None:
2628
"""Get workspace details."""
29+
# Default to current workspace if not specified
30+
if not workspace_id:
31+
from roboflow.cli._resolver import resolve_default_workspace
32+
33+
workspace_id = (ctx.obj or {}).get("workspace") or resolve_default_workspace(
34+
api_key=(ctx.obj or {}).get("api_key")
35+
)
2736
args = ctx_to_args(ctx, workspace_id=workspace_id)
2837
_get_workspace(args)
2938

0 commit comments

Comments
 (0)