Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/prime/src/prime_cli/commands/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ def push(
name: Optional[str] = typer.Option(
None, "--name", "-n", help="Override environment name (defaults to pyproject.toml name)"
),
owner: Optional[str] = typer.Option(
None,
"--owner",
"-o",
help="Owner slug (user or team) to push to (for collaborators with write access)",
),
team: Optional[str] = typer.Option(
None,
"--team",
Expand Down Expand Up @@ -379,7 +385,10 @@ def push(

console.print("Resolving environment...")
resolve_data = {"name": env_name, "visibility": visibility}
if team:
if owner:
# Push to a specific owner (user or team) - for collaborators with write access
resolve_data["owner_slug"] = owner
elif team:
resolve_data["team_slug"] = team
elif client.config.team_id:
resolve_data["team_id"] = client.config.team_id
Expand Down
19 changes: 15 additions & 4 deletions packages/prime/src/prime_cli/commands/sandbox.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import random
import shlex
import string
import time
from typing import Any, Dict, List, Optional
Expand Down Expand Up @@ -679,7 +680,11 @@ def logs(sandbox_id: str) -> None:
@app.command(no_args_is_help=True)
def run(
sandbox_id: str,
command: List[str] = typer.Argument(..., help="Command to execute"),
command: List[str] = typer.Argument(
...,
help="Command to execute. Use -- before commands with options "
"(e.g., -- bash -c 'echo hello')",
),
working_dir: Optional[str] = typer.Option(
None, "-w", "--working-dir", help="Working directory"
),
Expand All @@ -695,7 +700,13 @@ def run(
help="Timeout for the command in seconds",
),
) -> None:
"""Execute a command in a sandbox"""
"""Execute a command in a sandbox.

Use -- to separate sandbox run options from the command arguments when
the command has its own options (starting with -). Example:

prime sandbox run <id> -- bash -c "echo hello"
"""
try:
base_client = APIClient()
sandbox_client = SandboxClient(base_client)
Expand All @@ -710,8 +721,8 @@ def run(
key, value = env_var.split("=", 1)
env_vars[key] = value

# Join command list into a single string
command_str = " ".join(command)
# Join command list into a single string, preserving quoting for arguments with spaces
command_str = shlex.join(command)

console.print(f"[bold blue]Executing command:[/bold blue] {command_str}")
if working_dir:
Expand Down
2 changes: 2 additions & 0 deletions packages/prime/src/prime_cli/commands/whoami.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def whoami() -> None:
user_id = data.get("id")
email = data.get("email")
name = data.get("name")
slug = data.get("slug")
scope = data.get("scope", {})

# Update config
Expand All @@ -39,6 +40,7 @@ def whoami() -> None:
table.add_column("Field", style="cyan")
table.add_column("Value", style="green")
table.add_row("User ID", user_id or "Unknown")
table.add_row("Username", slug or "[dim]Not set[/dim]")
table.add_row("Name", name or "Unknown")
table.add_row("Email", email or "Unknown")
console.print(table)
Expand Down