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
3 changes: 3 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
6 changes: 6 additions & 0 deletions internal/login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}
Expand Down
7 changes: 6 additions & 1 deletion internal/utils/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -37,7 +42,7 @@ func IsAgent() bool {
return true
}
// Claude Code
if os.Getenv("CLAUDECODE") != "" || os.Getenv("CLAUDE_CODE") != "" {
if IsClaudeCode() {
return true
}
// Replit
Expand Down
10 changes: 10 additions & 0 deletions internal/utils/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -38,6 +39,15 @@ func ShortContainerImageName(imageName string) string {

const SuggestDebugFlag = "Try rerunning the command with --debug to troubleshoot the error."

const claudeCodeHint = `<claude-code-hint v="1" type="plugin" value="supabase@claude-plugins-official" />`

func SuggestClaudePlugin() string {
if agent.IsClaudeCode() {
return claudeCodeHint
}
return ""
}

var (
CmdSuggestion string
CurrentDirAbs string
Expand Down
Loading