From 48ff239512be919947b879c3f7058eeffd826174 Mon Sep 17 00:00:00 2001 From: Pedro Rodrigues Date: Thu, 30 Apr 2026 15:55:03 +0200 Subject: [PATCH 1/3] feat: emit Claude Code plugin hint from CLI Adds a claude-code-hint tag to stderr when running inside Claude Code (CLAUDECODE env var set). Claude Code strips the tag before it reaches the model and shows a one-time prompt to install the Supabase plugin. Emits on every invocation via Execute() for maximum coverage, and again after login success so users in a setup flow are reached too. Co-Authored-By: Claude Sonnet 4.6 --- cmd/root.go | 3 +++ internal/login/login.go | 6 ++++++ internal/utils/misc.go | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/cmd/root.go b/cmd/root.go index f8468a3e58..f503e22fdf 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -196,6 +196,9 @@ func Execute() { if semver.Compare(version, "v"+utils.Version) > 0 { fmt.Fprintln(os.Stderr, suggestUpgrade(version)) } + if hint := utils.SuggestClaudePlugin(); hint != "" { + fmt.Fprintln(os.Stderr, hint) + } if len(utils.CmdSuggestion) > 0 { fmt.Fprintln(os.Stderr, utils.CmdSuggestion) } diff --git a/internal/login/login.go b/internal/login/login.go index 18ba9ee640..8394db2c6d 100644 --- a/internal/login/login.go +++ b/internal/login/login.go @@ -172,6 +172,9 @@ func Run(ctx context.Context, stdout io.Writer, params RunParams) error { } handleTelemetryAfterLogin(ctx, params) fmt.Println(loggedInMsg) + if hint := utils.SuggestClaudePlugin(); hint != "" { + fmt.Fprintln(os.Stderr, hint) + } return nil } @@ -223,6 +226,9 @@ func Run(ctx context.Context, stdout io.Writer, params RunParams) error { fmt.Fprintf(stdout, "Token %s created successfully.\n\n", utils.Bold(params.TokenName)) fmt.Fprintln(stdout, loggedInMsg) + if hint := utils.SuggestClaudePlugin(); hint != "" { + fmt.Fprintln(os.Stderr, hint) + } return nil } diff --git a/internal/utils/misc.go b/internal/utils/misc.go index 937519aa53..4d2b075c91 100644 --- a/internal/utils/misc.go +++ b/internal/utils/misc.go @@ -38,6 +38,15 @@ func ShortContainerImageName(imageName string) string { const SuggestDebugFlag = "Try rerunning the command with --debug to troubleshoot the error." +const claudeCodeHint = `` + +func SuggestClaudePlugin() string { + if os.Getenv("CLAUDECODE") != "" { + return claudeCodeHint + } + return "" +} + var ( CmdSuggestion string CurrentDirAbs string From 5e2f09fc39f510a7829f479b25050f10b5957f9b Mon Sep 17 00:00:00 2001 From: Pedro Rodrigues Date: Thu, 30 Apr 2026 16:38:34 +0200 Subject: [PATCH 2/3] feat: emit Claude Code plugin hint from CLI Adds a claude-code-hint tag to stderr when running inside Claude Code (CLAUDECODE env var set). Claude Code strips the tag before it reaches the model and shows a one-time prompt to install the Supabase plugin. Emits on every invocation via Execute() for maximum coverage, and again after login success so users in a setup flow are reached too. Co-Authored-By: Claude Sonnet 4.6 --- cmd/root.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index f503e22fdf..3fc341b370 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -193,12 +193,12 @@ func Execute() { if err != nil { fmt.Fprintln(utils.GetDebugLogger(), err) } - if semver.Compare(version, "v"+utils.Version) > 0 { - fmt.Fprintln(os.Stderr, suggestUpgrade(version)) - } if hint := utils.SuggestClaudePlugin(); hint != "" { fmt.Fprintln(os.Stderr, hint) } + if semver.Compare(version, "v"+utils.Version) > 0 { + fmt.Fprintln(os.Stderr, suggestUpgrade(version)) + } if len(utils.CmdSuggestion) > 0 { fmt.Fprintln(os.Stderr, utils.CmdSuggestion) } From f34f25ac7104874e67b52e743f44077eb48a4aad Mon Sep 17 00:00:00 2001 From: Pedro Rodrigues Date: Thu, 30 Apr 2026 16:41:33 +0200 Subject: [PATCH 3/3] refactor: centralize Claude Code detection via IsClaudeCode() Extracts IsClaudeCode() from the existing IsAgent() check in agent.go and reuses it in SuggestClaudePlugin(). This ensures both places check the same env vars (CLAUDECODE and CLAUDE_CODE) consistently. Co-Authored-By: Claude Sonnet 4.6 --- internal/utils/agent/agent.go | 7 ++++++- internal/utils/misc.go | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/utils/agent/agent.go b/internal/utils/agent/agent.go index 65846ea62a..e3b0d7f88f 100644 --- a/internal/utils/agent/agent.go +++ b/internal/utils/agent/agent.go @@ -5,6 +5,11 @@ import ( "strings" ) +// IsClaudeCode reports whether the CLI is running inside Claude Code. +func IsClaudeCode() bool { + return os.Getenv("CLAUDECODE") != "" || os.Getenv("CLAUDE_CODE") != "" +} + // IsAgent checks environment variables to detect if the CLI is being invoked // by an AI coding agent. Based on the detection logic from Vercel's // @vercel/functions/ai package. @@ -37,7 +42,7 @@ func IsAgent() bool { return true } // Claude Code - if os.Getenv("CLAUDECODE") != "" || os.Getenv("CLAUDE_CODE") != "" { + if IsClaudeCode() { return true } // Replit diff --git a/internal/utils/misc.go b/internal/utils/misc.go index 4d2b075c91..9844770d01 100644 --- a/internal/utils/misc.go +++ b/internal/utils/misc.go @@ -17,6 +17,7 @@ import ( "github.com/go-git/go-git/v5/plumbing/format/gitignore" "github.com/spf13/afero" "github.com/spf13/viper" + "github.com/supabase/cli/internal/utils/agent" "github.com/supabase/cli/pkg/migration" ) @@ -41,7 +42,7 @@ const SuggestDebugFlag = "Try rerunning the command with --debug to troubleshoot const claudeCodeHint = `` func SuggestClaudePlugin() string { - if os.Getenv("CLAUDECODE") != "" { + if agent.IsClaudeCode() { return claudeCodeHint } return ""