diff --git a/cmd/root.go b/cmd/root.go index f8468a3e58..3fc341b370 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -193,6 +193,9 @@ func Execute() { if err != nil { fmt.Fprintln(utils.GetDebugLogger(), err) } + if hint := utils.SuggestClaudePlugin(); hint != "" { + fmt.Fprintln(os.Stderr, hint) + } if semver.Compare(version, "v"+utils.Version) > 0 { fmt.Fprintln(os.Stderr, suggestUpgrade(version)) } 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/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 149dfee320..9a1c420fc4 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" ) @@ -38,6 +39,15 @@ func ShortContainerImageName(imageName string) string { const SuggestDebugFlag = "Try rerunning the command with --debug to troubleshoot the error." +const claudeCodeHint = `` + +func SuggestClaudePlugin() string { + if agent.IsClaudeCode() { + return claudeCodeHint + } + return "" +} + var ( CmdSuggestion string CurrentDirAbs string