diff --git a/cmd/blocks/blocks.go b/cmd/blocks/blocks.go index 47d71b44..d0666fd0 100644 --- a/cmd/blocks/blocks.go +++ b/cmd/blocks/blocks.go @@ -17,19 +17,14 @@ package blocks import ( "github.com/slackapi/slack-cli/internal/shared" "github.com/slackapi/slack-cli/internal/style" - "github.com/slackapi/slack-cli/internal/useragent" "github.com/spf13/cobra" ) -// aiAgentFunc is a package variable so it can be stubbed in tests. -var aiAgentFunc = useragent.GetAIAgent - func NewCommand(clients *shared.ClientFactory) *cobra.Command { cmd := &cobra.Command{ - Use: "blocks [flags]", - Short: "Build with Block Kit", - Long: "Build layouts using Block Kit and iterate on designs with Block Kit Builder.", - Hidden: aiAgentFunc() == nil, + Use: "blocks [flags]", + Short: "Build with Block Kit", + Long: "Build layouts using Block Kit and iterate on designs with Block Kit Builder.", Example: style.ExampleCommandsf([]style.ExampleCommand{ { Meaning: "Preview blocks in Block Kit Builder", diff --git a/cmd/blocks/blocks_test.go b/cmd/blocks/blocks_test.go index d2980383..fe741f1e 100644 --- a/cmd/blocks/blocks_test.go +++ b/cmd/blocks/blocks_test.go @@ -19,10 +19,8 @@ import ( "testing" "github.com/slackapi/slack-cli/internal/shared" - "github.com/slackapi/slack-cli/internal/useragent" "github.com/slackapi/slack-cli/test/testutil" "github.com/spf13/cobra" - "github.com/stretchr/testify/assert" ) func Test_Blocks_Command(t *testing.T) { @@ -39,30 +37,3 @@ func Test_Blocks_Command(t *testing.T) { return NewCommand(cf) }) } - -func Test_Blocks_Command_Hidden(t *testing.T) { - tests := map[string]struct { - aiAgent *useragent.AIAgent - expectedHidden bool - }{ - "hidden when no AI coding tool is detected": { - aiAgent: nil, - expectedHidden: true, - }, - "visible when an AI coding tool is detected": { - aiAgent: &useragent.AIAgent{Name: "claude-code"}, - expectedHidden: false, - }, - } - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - restore := stubAIAgent(tc.aiAgent) - defer restore() - - clientsMock := shared.NewClientsMock() - clients := shared.NewClientFactory(clientsMock.MockClientFactory()) - cmd := NewCommand(clients) - assert.Equal(t, tc.expectedHidden, cmd.Hidden) - }) - } -} diff --git a/cmd/blocks/preview_test.go b/cmd/blocks/preview_test.go index ed4bb673..3e016f7d 100644 --- a/cmd/blocks/preview_test.go +++ b/cmd/blocks/preview_test.go @@ -23,7 +23,6 @@ import ( "github.com/slackapi/slack-cli/internal/shared/types" "github.com/slackapi/slack-cli/internal/slackerror" "github.com/slackapi/slack-cli/internal/slacktrace" - "github.com/slackapi/slack-cli/internal/useragent" "github.com/slackapi/slack-cli/test/testutil" "github.com/spf13/cobra" "github.com/stretchr/testify/assert" @@ -31,14 +30,6 @@ import ( "github.com/stretchr/testify/require" ) -// stubAIAgent stubs the detected AI coding tool and returns a function that -// restores the original detection. -func stubAIAgent(agent *useragent.AIAgent) func() { - original := aiAgentFunc - aiAgentFunc = func() *useragent.AIAgent { return agent } - return func() { aiAgentFunc = original } -} - func Test_Blocks_PreviewCommand(t *testing.T) { // teamlessURL is the Block Kit Builder URL rendered when no team can be // resolved. The browser resolves the team from its own session.