From 44d1482e4b2af9ca570a919c4f546659d89aa319 Mon Sep 17 00:00:00 2001 From: Andrew Watkins Date: Wed, 18 Nov 2026 11:23:00 -0600 Subject: [PATCH 1/2] feat(claude): hide and deprecate depot claude (DEP-8856) Remote Agents is deprecated in favor of Depot Managed Agents. Hide the command from help and completion and print a deprecation notice on stderr. The command keeps working: customers still use it and the API boots every Remote Agent sandbox with `depot claude`. Co-Authored-By: Claude Opus 5.5 --- pkg/cmd/claude/claude.go | 2 ++ pkg/cmd/root/root_test.go | 53 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/pkg/cmd/claude/claude.go b/pkg/cmd/claude/claude.go index 00da8a84..9f2d5ee6 100644 --- a/pkg/cmd/claude/claude.go +++ b/pkg/cmd/claude/claude.go @@ -90,6 +90,8 @@ Subcommands: depot claude secrets remove GITHUB_TOKEN`, Args: cobra.ArbitraryArgs, DisableFlagParsing: true, + Hidden: true, + Deprecated: "use Depot Managed Agents instead: https://depot.dev/docs/managed-agents/claude-code-self-hosted", RunE: func(cmd *cobra.Command, args []string) error { if len(args) > 0 { switch args[0] { diff --git a/pkg/cmd/root/root_test.go b/pkg/cmd/root/root_test.go index b9e0d6ef..d6147e33 100644 --- a/pkg/cmd/root/root_test.go +++ b/pkg/cmd/root/root_test.go @@ -4,6 +4,8 @@ import ( "bytes" "encoding/base64" "errors" + "io" + "os" "strings" "testing" ) @@ -53,6 +55,57 @@ func TestMergeRequestsAreHiddenButDirectlyAvailable(t *testing.T) { } } +func TestClaudeIsHiddenDeprecatedAndStillRuns(t *testing.T) { + cmd := NewCmdRoot("test-version", "test-date") + var out bytes.Buffer + cmd.SetOut(&out) + cmd.SetErr(&out) + for _, args := range [][]string{{"--help"}, {"__complete", ""}} { + out.Reset() + cmd.SetArgs(args) + if err := cmd.Execute(); err != nil { + t.Fatal(err) + } + if strings.Contains(out.String(), "claude") { + t.Fatalf("%v lists claude:\n%s", args, out.String()) + } + } + + claude, remaining, err := cmd.Find([]string{"claude"}) + if err != nil || len(remaining) != 0 || claude.Name() != "claude" { + t.Fatalf("claude command not registered: %v, %v, %v", claude, remaining, err) + } + + // Sandboxes and scripts read stdout, so the notice must only reach the real stderr. + outR, outW, err := os.Pipe() + if err != nil { + t.Fatal(err) + } + errR, errW, err := os.Pipe() + if err != nil { + t.Fatal(err) + } + origOut, origErr := os.Stdout, os.Stderr + os.Stdout, os.Stderr = outW, errW + cmd = NewCmdRoot("test-version", "test-date") + cmd.SetArgs([]string{"claude", "secrets"}) + runErr := cmd.Execute() + os.Stdout, os.Stderr = origOut, origErr + outW.Close() + errW.Close() + stdout, _ := io.ReadAll(outR) + stderr, _ := io.ReadAll(errR) + if runErr != nil { + t.Fatal(runErr) + } + if !strings.Contains(string(stderr), "use Depot Managed Agents instead") { + t.Errorf("stderr has no deprecation notice: %q", stderr) + } + if strings.Contains(string(stdout), "deprecated") || !strings.Contains(string(stdout), "Manage secrets") { + t.Errorf("stdout changed: %q", stdout) + } +} + func TestBuildkitRegistryProxyIsHiddenAndRunsInternalCommand(t *testing.T) { t.Setenv("CA_CERT", "invalid-base64!") cmd := NewCmdRoot("test-version", "test-date") From c85174d6b08119794a3aa394b113e305fadce0e8 Mon Sep 17 00:00:00 2001 From: Andrew Watkins Date: Wed, 18 Nov 2026 11:32:16 -0600 Subject: [PATCH 2/2] fix(claude): print deprecation notice to stderr in plugin mode (DEP-8856) cobra's Deprecated prints via OutOrStderr, which is docker's stdout when depot runs as a Docker CLI plugin. Print the notice to ErrOrStderr in RunE instead. Co-Authored-By: Claude Opus 5.5 --- pkg/cmd/claude/claude.go | 3 ++- pkg/cmd/root/root_test.go | 35 ++++++++++------------------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/pkg/cmd/claude/claude.go b/pkg/cmd/claude/claude.go index 9f2d5ee6..27e9a69b 100644 --- a/pkg/cmd/claude/claude.go +++ b/pkg/cmd/claude/claude.go @@ -91,8 +91,9 @@ Subcommands: Args: cobra.ArbitraryArgs, DisableFlagParsing: true, Hidden: true, - Deprecated: "use Depot Managed Agents instead: https://depot.dev/docs/managed-agents/claude-code-self-hosted", RunE: func(cmd *cobra.Command, args []string) error { + // Not cobra's Deprecated: it prints to OutOrStderr, which is stdout when run as a Docker CLI plugin. + fmt.Fprintln(cmd.ErrOrStderr(), "depot claude is deprecated; use Depot Managed Agents instead: https://depot.dev/docs/managed-agents/claude-code-self-hosted") if len(args) > 0 { switch args[0] { case "list-sessions": diff --git a/pkg/cmd/root/root_test.go b/pkg/cmd/root/root_test.go index d6147e33..03c7a85e 100644 --- a/pkg/cmd/root/root_test.go +++ b/pkg/cmd/root/root_test.go @@ -4,8 +4,6 @@ import ( "bytes" "encoding/base64" "errors" - "io" - "os" "strings" "testing" ) @@ -76,33 +74,20 @@ func TestClaudeIsHiddenDeprecatedAndStillRuns(t *testing.T) { t.Fatalf("claude command not registered: %v, %v, %v", claude, remaining, err) } - // Sandboxes and scripts read stdout, so the notice must only reach the real stderr. - outR, outW, err := os.Pipe() - if err != nil { - t.Fatal(err) - } - errR, errW, err := os.Pipe() - if err != nil { - t.Fatal(err) - } - origOut, origErr := os.Stdout, os.Stderr - os.Stdout, os.Stderr = outW, errW + // Sandboxes and scripts parse stdout, and the Docker plugin wrapper sets its own stdout writer. + var stdout, stderr bytes.Buffer cmd = NewCmdRoot("test-version", "test-date") + cmd.SetOut(&stdout) + cmd.SetErr(&stderr) cmd.SetArgs([]string{"claude", "secrets"}) - runErr := cmd.Execute() - os.Stdout, os.Stderr = origOut, origErr - outW.Close() - errW.Close() - stdout, _ := io.ReadAll(outR) - stderr, _ := io.ReadAll(errR) - if runErr != nil { - t.Fatal(runErr) + if err := cmd.Execute(); err != nil { + t.Fatal(err) } - if !strings.Contains(string(stderr), "use Depot Managed Agents instead") { - t.Errorf("stderr has no deprecation notice: %q", stderr) + if !strings.Contains(stderr.String(), "use Depot Managed Agents instead") { + t.Errorf("stderr has no deprecation notice: %q", stderr.String()) } - if strings.Contains(string(stdout), "deprecated") || !strings.Contains(string(stdout), "Manage secrets") { - t.Errorf("stdout changed: %q", stdout) + if strings.Contains(stdout.String(), "deprecated") { + t.Errorf("deprecation notice on stdout: %q", stdout.String()) } }