wafer-cli 0.2.11__py3-none-any.whl → 0.2.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wafer/cli.py CHANGED
@@ -54,6 +54,19 @@ _command_start_time: float | None = None
54
54
  _command_outcome: str = "failure"
55
55
 
56
56
 
57
+ def _show_version() -> None:
58
+ """Show CLI version and environment, then exit."""
59
+ from .analytics import _get_cli_version
60
+ from .global_config import load_global_config
61
+
62
+ version = _get_cli_version()
63
+ config = load_global_config()
64
+ environment = config.environment
65
+
66
+ typer.echo(f"wafer-cli {version} ({environment})")
67
+ raise typer.Exit()
68
+
69
+
57
70
  def _get_command_path(ctx: typer.Context) -> tuple[str, str | None]:
58
71
  """Extract command and subcommand from Typer context.
59
72
 
@@ -84,9 +97,20 @@ def _mark_command_success() -> None:
84
97
  _command_outcome = "success"
85
98
 
86
99
 
87
- @app.callback()
88
- def main_callback(ctx: typer.Context) -> None:
100
+ @app.callback(invoke_without_command=True)
101
+ def main_callback(
102
+ ctx: typer.Context,
103
+ version: bool = typer.Option(
104
+ False,
105
+ "--version",
106
+ help="Show version and exit",
107
+ ),
108
+ ) -> None:
89
109
  """Initialize analytics and track command execution."""
110
+ if version:
111
+ _show_version()
112
+ return
113
+
90
114
  global _command_start_time, _command_outcome
91
115
  _command_start_time = time.time()
92
116
  _command_outcome = "success" # Default to success, mark failure on exceptions
@@ -4615,9 +4639,6 @@ def workspaces_ssh(
4615
4639
  ) -> None:
4616
4640
  """SSH into a workspace.
4617
4641
 
4618
- Uses workspace SSH credentials once the workspace is running.
4619
- If workspace is not specified, uses the default workspace.
4620
-
4621
4642
  Examples:
4622
4643
  wafer workspaces ssh dev
4623
4644
  wafer workspaces ssh # uses default workspace
@@ -4626,52 +4647,37 @@ def workspaces_ssh(
4626
4647
 
4627
4648
  from .workspaces import get_workspace_raw, resolve_workspace
4628
4649
 
4629
- # Resolve workspace
4650
+ # Resolve workspace name/ID
4630
4651
  try:
4631
4652
  resolved_workspace = resolve_workspace(workspace)
4632
4653
  except RuntimeError as e:
4633
4654
  typer.echo(f"Error: {e}", err=True)
4634
4655
  raise typer.Exit(1) from None
4635
4656
 
4636
- typer.echo(f"Connecting to workspace: {resolved_workspace}...", err=True)
4637
-
4638
- # Get SSH credentials from workspace
4657
+ # Get workspace SSH credentials
4639
4658
  try:
4640
4659
  ws = get_workspace_raw(resolved_workspace)
4641
4660
  except RuntimeError as e:
4642
4661
  typer.echo(f"Error: {e}", err=True)
4643
4662
  raise typer.Exit(1) from None
4644
4663
 
4645
- from .workspaces import VALID_STATUSES
4646
-
4647
- workspace_status = ws.get("status")
4648
- assert workspace_status in VALID_STATUSES, (
4649
- f"Workspace {resolved_workspace} has invalid status '{workspace_status}'. "
4650
- f"Valid statuses: {VALID_STATUSES}"
4651
- )
4664
+ ssh_host = ws.get("ssh_host")
4665
+ ssh_port = ws.get("ssh_port")
4666
+ ssh_user = ws.get("ssh_user")
4652
4667
 
4653
- if workspace_status != "running":
4654
- typer.echo(f"Error: Workspace is {workspace_status}. Wait for it to be running.", err=True)
4655
- raise typer.Exit(1)
4656
- if not ws.get("ssh_host") or not ws.get("ssh_port") or not ws.get("ssh_user"):
4657
- typer.echo("Error: SSH credentials not available yet.", err=True)
4668
+ if not ssh_host or not ssh_port or not ssh_user:
4669
+ typer.echo("Error: Workspace not ready. Wait a few seconds and retry.", err=True)
4658
4670
  raise typer.Exit(1)
4659
4671
 
4660
- # Build SSH args - key_path is None for BYOK model (uses default SSH key)
4661
- ssh_args = ["ssh"]
4662
- ssh_args.extend([
4663
- "-p",
4664
- str(ws.get("ssh_port")),
4665
- "-o",
4666
- "StrictHostKeyChecking=no",
4667
- "-o",
4668
- "UserKnownHostsFile=/dev/null",
4669
- f"{ws.get('ssh_user')}@{ws.get('ssh_host')}",
4672
+ # Connect via SSH
4673
+ os.execvp("ssh", [
4674
+ "ssh",
4675
+ "-p", str(ssh_port),
4676
+ "-o", "StrictHostKeyChecking=no",
4677
+ "-o", "UserKnownHostsFile=/dev/null",
4678
+ f"{ssh_user}@{ssh_host}",
4670
4679
  ])
4671
4680
 
4672
- # Replace current process with SSH
4673
- os.execvp("ssh", ssh_args)
4674
-
4675
4681
 
4676
4682
  @workspaces_app.command("sync")
4677
4683
  def workspaces_sync(
wafer/workspaces.py CHANGED
@@ -214,11 +214,12 @@ def list_workspaces(json_output: bool = False) -> str:
214
214
  status_icon = {"running": "●", "creating": "◐"}.get(status, "?")
215
215
  lines.append(f" {status_icon} {ws['name']} ({ws['id']})")
216
216
  lines.append(f" GPU: {ws.get('gpu_type', 'N/A')} | Image: {ws.get('image', 'N/A')}")
217
- lines.append(f" Status: {status} | Created: {ws.get('created_at', 'N/A')}")
218
- if status == "running" and ws.get("ssh_host") and ws.get("ssh_port") and ws.get("ssh_user"):
217
+ if ws.get("ssh_host") and ws.get("ssh_port") and ws.get("ssh_user"):
219
218
  lines.append(
220
219
  f" SSH: ssh -p {ws['ssh_port']} {ws['ssh_user']}@{ws['ssh_host']}"
221
220
  )
221
+ else:
222
+ lines.append(" SSH: Not ready (run: wafer workspaces ssh <name>)")
222
223
  lines.append("")
223
224
 
224
225
  return "\n".join(lines)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wafer-cli
3
- Version: 0.2.11
3
+ Version: 0.2.13
4
4
  Summary: CLI tool for running commands on remote GPUs and GPU kernel optimization agent
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: typer>=0.12.0
@@ -5,7 +5,7 @@ wafer/api_client.py,sha256=i_Az2b2llC3DSW8yOL-BKqa7LSKuxOr8hSN40s-oQXY,6313
5
5
  wafer/auth.py,sha256=acBVOz-3la6avztDGjtLRopdjNRIqbrV4tRMM1FAmHI,13682
6
6
  wafer/autotuner.py,sha256=6gH0Ho7T58EFerMQcHQxshWe3DF4qU7fb5xthAh5SPM,44364
7
7
  wafer/billing.py,sha256=jbLB2lI4_9f2KD8uEFDi_ixLlowe5hasC0TIZJyIXRg,7163
8
- wafer/cli.py,sha256=c7IEKZ-Ge-w4LQ1GVAqvuKkodBYtT6NnxNeGf6me9pc,252787
8
+ wafer/cli.py,sha256=PaWvp7h130Pct5U6Kx_9_zyy20GDPaIQzri2VIDtv5Q,252625
9
9
  wafer/config.py,sha256=h5Eo9_yfWqWGoPNdVQikI9GoZVUeysunSYiixf1mKcw,3411
10
10
  wafer/corpus.py,sha256=x5aFhCsTSAtgzFG9AMFpqq92Ej63mXofL-vvvpjj1sM,12913
11
11
  wafer/evaluate.py,sha256=Lf_H6Afrdo4k9JOnI27wchFwEteqy73gKt5gLQgaXSE,172671
@@ -27,14 +27,14 @@ wafer/targets.py,sha256=9r-iRWoKSH5cQl1LcamaX-T7cNVOg99ngIm_hlRk-qU,26922
27
27
  wafer/targets_ops.py,sha256=FJQhlQ4MfOMN5ZNaVfqUvrkRwGjOXI22cNTIEVSKeSE,21488
28
28
  wafer/tracelens.py,sha256=g9ZIeFyNojZn4uTd3skPqIrRiL7aMJOz_-GOd3aiyy4,7998
29
29
  wafer/wevin_cli.py,sha256=4cZ05GFCGBq11ekVQH_AgaqnITVq6IUfwwHo6CeHFN4,22179
30
- wafer/workspaces.py,sha256=kN8-XFffodFflI9cuIllqd6VQGFnlV1h-Z28oBh4Lms,30100
30
+ wafer/workspaces.py,sha256=w6VHhCV189BdVZNLZ6obL71qlB5N4iLWX5fvyqFB87c,30085
31
31
  wafer/skills/wafer-guide/SKILL.md,sha256=KWetJw2TVTbz11_nzqazqOJWWRlbHRFShs4sOoreiWo,3255
32
32
  wafer/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  wafer/templates/ask_docs.py,sha256=Lxs-faz9v5m4Qa4NjF2X_lE8KwM9ES9MNJkxo7ep56o,2256
34
34
  wafer/templates/optimize_kernel.py,sha256=u6AL7Q3uttqlnBLzcoFdsiPq5lV2TV3bgqwCYYlK9gk,2357
35
35
  wafer/templates/trace_analyze.py,sha256=XE1VqzVkIUsZbXF8EzQdDYgg-AZEYAOFpr6B_vnRELc,2880
36
- wafer_cli-0.2.11.dist-info/METADATA,sha256=JK2VwDV7PgVjmRA5utdsWOLsT1xY1CRbp8WkqpFO4cA,560
37
- wafer_cli-0.2.11.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
38
- wafer_cli-0.2.11.dist-info/entry_points.txt,sha256=WqB7hB__WhtPY8y1cO2sZiUz7fCq6Ik-usAigpeFvWE,41
39
- wafer_cli-0.2.11.dist-info/top_level.txt,sha256=2MK1IVMWfpLL8BZCQ3E9aG6L6L666gSA_teYlwan4fs,6
40
- wafer_cli-0.2.11.dist-info/RECORD,,
36
+ wafer_cli-0.2.13.dist-info/METADATA,sha256=wRWRnySLYOqvUTJT6NPPVBY5KBLL0CGquHK98fQ_Y_g,560
37
+ wafer_cli-0.2.13.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
38
+ wafer_cli-0.2.13.dist-info/entry_points.txt,sha256=WqB7hB__WhtPY8y1cO2sZiUz7fCq6Ik-usAigpeFvWE,41
39
+ wafer_cli-0.2.13.dist-info/top_level.txt,sha256=2MK1IVMWfpLL8BZCQ3E9aG6L6L666gSA_teYlwan4fs,6
40
+ wafer_cli-0.2.13.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.10.1)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5