diff --git a/pkg/cmd/root/root.go b/pkg/cmd/root/root.go index 9b3692dc..2d2a42c2 100644 --- a/pkg/cmd/root/root.go +++ b/pkg/cmd/root/root.go @@ -12,7 +12,6 @@ import ( cargoCmd "github.com/depot/cli/pkg/cmd/cargo" ciCmd "github.com/depot/cli/pkg/cmd/ci" claudeCmd "github.com/depot/cli/pkg/cmd/claude" - computeCmd "github.com/depot/cli/pkg/cmd/compute" dockerCmd "github.com/depot/cli/pkg/cmd/docker" "github.com/depot/cli/pkg/cmd/exec" "github.com/depot/cli/pkg/cmd/gocache" @@ -27,6 +26,7 @@ import ( "github.com/depot/cli/pkg/cmd/pulltoken" "github.com/depot/cli/pkg/cmd/push" "github.com/depot/cli/pkg/cmd/registry" + sandboxCmd "github.com/depot/cli/pkg/cmd/sandbox" versionCmd "github.com/depot/cli/pkg/cmd/version" "github.com/depot/cli/pkg/config" ) @@ -84,7 +84,7 @@ func NewCmdRoot(version, buildDate string) *cobra.Command { cmd.AddCommand(gocache.NewCmdGoCache()) cmd.AddCommand(exec.NewCmdExec()) cmd.AddCommand(ciCmd.NewCmdCI()) - cmd.AddCommand(computeCmd.NewCmdCompute()) + cmd.AddCommand(sandboxCmd.NewCmdSandbox()) return cmd } diff --git a/pkg/cmd/compute/exec-pipe.go b/pkg/cmd/sandbox/exec-pipe.go similarity index 94% rename from pkg/cmd/compute/exec-pipe.go rename to pkg/cmd/sandbox/exec-pipe.go index aaf5537c..01c7efde 100644 --- a/pkg/cmd/compute/exec-pipe.go +++ b/pkg/cmd/sandbox/exec-pipe.go @@ -1,4 +1,4 @@ -package compute +package sandbox import ( "context" @@ -13,17 +13,17 @@ import ( "github.com/spf13/cobra" ) -func newComputeExecPipe() *cobra.Command { +func newSandboxExecPipe() *cobra.Command { cmd := &cobra.Command{ Use: "exec-pipe [flags]", Short: "Execute a command within the compute, then stream bytes to stdin", Long: "Execute a command within the compute, then stream bytes to stdin", Example: ` # Pipe text into a file in the compute - echo "Hello Depot" | depot compute exec-pipe --sandbox-id 1234567890 --session-id 1234567890 -- /bin/bash -lc "tee /tmp/hello.txt" + echo "Hello Depot" | depot sandbox exec-pipe --sandbox-id 1234567890 --session-id 1234567890 -- /bin/bash -lc "tee /tmp/hello.txt" # Pipe a tarball into the compute - tar czf - ./src | depot compute exec-pipe --sandbox-id 1234567890 --session-id 1234567890 -- /bin/bash -lc "tar xzf - -C /workspace" + tar czf - ./src | depot sandbox exec-pipe --sandbox-id 1234567890 --session-id 1234567890 -- /bin/bash -lc "tar xzf - -C /workspace" `, Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/pkg/cmd/compute/exec.go b/pkg/cmd/sandbox/exec.go similarity index 90% rename from pkg/cmd/compute/exec.go rename to pkg/cmd/sandbox/exec.go index 5e8a75c5..07bf8d16 100644 --- a/pkg/cmd/compute/exec.go +++ b/pkg/cmd/sandbox/exec.go @@ -1,4 +1,4 @@ -package compute +package sandbox import ( "fmt" @@ -11,20 +11,20 @@ import ( "github.com/spf13/cobra" ) -func newComputeExec() *cobra.Command { +func newSandboxExec() *cobra.Command { cmd := &cobra.Command{ Use: "exec [flags]", Short: "Execute a command within the compute", Long: "Execute a command within the compute", Example: ` # execute command within the compute - depot compute exec --sandbox-id 1234567890 --session-id 1234567890 -- /bin/bash -lc whoami + depot sandbox exec --sandbox-id 1234567890 --session-id 1234567890 -- /bin/bash -lc whoami # execute command with timeout (30 seconds) - depot compute exec --sandbox-id 1234567890 --session-id 1234567890 --timeout 30000 -- /bin/bash -lc whoami + depot sandbox exec --sandbox-id 1234567890 --session-id 1234567890 --timeout 30000 -- /bin/bash -lc whoami # execute complex command - depot compute exec --sandbox-id 1234567890 --session-id 1234567890 -- /bin/bash -lc 'for i in {1..10}; do echo $i; sleep 1; done' + depot sandbox exec --sandbox-id 1234567890 --session-id 1234567890 -- /bin/bash -lc 'for i in {1..10}; do echo $i; sleep 1; done' `, Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/pkg/cmd/compute/pty.go b/pkg/cmd/sandbox/pty.go similarity index 95% rename from pkg/cmd/compute/pty.go rename to pkg/cmd/sandbox/pty.go index 347eeb6b..95515450 100644 --- a/pkg/cmd/compute/pty.go +++ b/pkg/cmd/sandbox/pty.go @@ -1,4 +1,4 @@ -package compute +package sandbox import ( "context" @@ -17,20 +17,20 @@ import ( "golang.org/x/term" ) -func newComputePty() *cobra.Command { +func newSandboxPty() *cobra.Command { cmd := &cobra.Command{ Use: "pty [flags]", Short: "Open a pseudo-terminal within the compute", Long: "Open a pseudo-terminal within the compute", Example: ` # open a pseudo-terminal within the compute - depot compute pty --sandbox-id 1234567890 --session-id 1234567890 + depot sandbox pty --sandbox-id 1234567890 --session-id 1234567890 # set terminal workdir - depot compute pty --sandbox-id 1234567890 --session-id 1234567890 --cwd /tmp + depot sandbox pty --sandbox-id 1234567890 --session-id 1234567890 --cwd /tmp # set terminal environment variables - depot compute pty --sandbox-id 1234567890 --session-id 1234567890 --env FOO=BAR --env BAR=FOO + depot sandbox pty --sandbox-id 1234567890 --session-id 1234567890 --env FOO=BAR --env BAR=FOO `, RunE: func(cmd *cobra.Command, args []string) error { ctx := cmd.Context() diff --git a/pkg/cmd/compute/pty_resize_unix.go b/pkg/cmd/sandbox/pty_resize_unix.go similarity index 98% rename from pkg/cmd/compute/pty_resize_unix.go rename to pkg/cmd/sandbox/pty_resize_unix.go index f1cca3ac..17474f43 100644 --- a/pkg/cmd/compute/pty_resize_unix.go +++ b/pkg/cmd/sandbox/pty_resize_unix.go @@ -1,6 +1,6 @@ //go:build !windows -package compute +package sandbox import ( "context" diff --git a/pkg/cmd/compute/pty_resize_windows.go b/pkg/cmd/sandbox/pty_resize_windows.go similarity index 94% rename from pkg/cmd/compute/pty_resize_windows.go rename to pkg/cmd/sandbox/pty_resize_windows.go index 66246fb8..8ae64efc 100644 --- a/pkg/cmd/compute/pty_resize_windows.go +++ b/pkg/cmd/sandbox/pty_resize_windows.go @@ -1,4 +1,4 @@ -package compute +package sandbox import ( "context" diff --git a/pkg/cmd/compute/compute.go b/pkg/cmd/sandbox/sandbox.go similarity index 73% rename from pkg/cmd/compute/compute.go rename to pkg/cmd/sandbox/sandbox.go index fcc8b7b5..be10f0c2 100644 --- a/pkg/cmd/compute/compute.go +++ b/pkg/cmd/sandbox/sandbox.go @@ -1,12 +1,12 @@ -package compute +package sandbox import ( "github.com/spf13/cobra" ) -func NewCmdCompute() *cobra.Command { +func NewCmdSandbox() *cobra.Command { cmd := &cobra.Command{ - Use: "compute [flags] [compute args...]", + Use: "sandbox [flags] [compute args...]", Short: "Manage Depot compute", Long: `Compute is the building block of Depot CI. @@ -20,9 +20,9 @@ Subcommands: cmd.PersistentFlags().String("token", "", "Depot API token") - cmd.AddCommand(newComputeExec()) - cmd.AddCommand(newComputePty()) - cmd.AddCommand(newComputeExecPipe()) + cmd.AddCommand(newSandboxExec()) + cmd.AddCommand(newSandboxPty()) + cmd.AddCommand(newSandboxExecPipe()) return cmd }