-
Notifications
You must be signed in to change notification settings - Fork 37
feat: recommend the official Slack plugin to Claude Code users #615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2c6fba8
4b298d1
bba55af
6c1ac82
cbb8bff
b179a30
e5c008d
0adfdf5
c43b3c3
7c560ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // Copyright 2022-2026 Salesforce, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package useragent | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "io" | ||
| "os" | ||
| ) | ||
|
|
||
| // claudeCodePluginHint is the marker to recommend the official Slack plugin to | ||
| // users of Claude Code. | ||
| // | ||
| // https://code.claude.com/docs/en/plugin-hints | ||
| const claudeCodePluginHint = `<claude-code-hint v="1" type="plugin" value="slack@claude-plugins-official" />` | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you double check that the plugin was not already installed on your system?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not seeing the marker prompt either. I spent some time digging into this and I have a lead:
I'll test on my personal computer and share the results.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mwbrooks Fantastic intuition! 🧠 ✨ It makes me eager to test with a different build as well!
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: I agree that |
||
|
|
||
| // EmitClaudeCodePluginHint writes the Claude Code plugin recommendation marker | ||
| // to a writer that must be stderr to prompt installation without an appearance | ||
| // in actual outputs. | ||
| func EmitClaudeCodePluginHint(w io.Writer) { | ||
| if os.Getenv("CLAUDECODE") == "" { | ||
| return | ||
| } | ||
| fmt.Fprintln(w, claudeCodePluginHint) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // Copyright 2022-2026 Salesforce, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package useragent | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func Test_EmitClaudeCodePluginHint(t *testing.T) { | ||
| tests := map[string]struct { | ||
| claudeCode string | ||
| expected string | ||
| }{ | ||
| "emits the hint on its own line inside claude code": { | ||
| claudeCode: "1", | ||
| expected: claudeCodePluginHint + "\n", | ||
| }, | ||
| "emits the hint for any non-empty CLAUDECODE value": { | ||
| claudeCode: "true", | ||
| expected: claudeCodePluginHint + "\n", | ||
| }, | ||
| "emits nothing when CLAUDECODE is unset": { | ||
| claudeCode: "", | ||
| expected: "", | ||
| }, | ||
| } | ||
| for name, tc := range tests { | ||
| t.Run(name, func(t *testing.T) { | ||
| clearEnvVars(t) | ||
| t.Setenv("CLAUDECODE", tc.claudeCode) | ||
|
|
||
| var buf bytes.Buffer | ||
| EmitClaudeCodePluginHint(&buf) | ||
|
|
||
| assert.Equal(t, tc.expected, buf.String()) | ||
| }) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: Nice catch on the two call sites. This is likely a high-hit-rate call site and is subtle enough for most people to miss.