useragent

package
v0.0.0-...-8c45bc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildUserAgent

func BuildUserAgent(cliVersion string) string

BuildUserAgent constructs the HTTP User-Agent header value for the CLI. The base format is "slack-cli/<version> (os: <goos>)". If an AI agent is detected, an " AI-Agent (name: ..., entry: ...)" suffix is appended.

Examples:

slack-cli/2.38.1 (os: darwin)
slack-cli/2.38.1 (os: darwin) AI-Agent (name: claude-code, entry: cli)
slack-cli/2.38.1 (os: linux) AI-Agent (name: cursor)

func EmitAgentPluginHint

func EmitAgentPluginHint(w io.Writer, processName string)

EmitAgentPluginHint writes the Slack plugin recommendation to a writer that should be stderr when a coding agent is detected.

Claude Code is included alongside the EmitClaudeCodePluginHint marker, since the marker shows no install prompt on some setups, such as Amazon Bedrock or with telemetry turned off.

func EmitClaudeCodePluginHint

func EmitClaudeCodePluginHint(w io.Writer)

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 GetAIAgentName

func GetAIAgentName() string

GetAIAgentName returns the normalized name of the detected AI agent, or an empty string if no agent is detected.

Types

type AIAgent

type AIAgent struct {
	Name  string
	Entry string
}

AIAgent represents a detected AI coding agent that invoked the CLI.

func GetAIAgent

func GetAIAgent() *AIAgent

GetAIAgent checks environment variables to determine if the CLI is being run by an AI coding agent. Returns nil if no agent is detected. Detection priority: CLAUDECODE > CODEX_CI > GEMINI_CLI > CLINE_ACTIVE > CURSOR_AGENT > OPENCODE > AGENT.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL