Documentation
¶
Overview ¶
Package agentdetect provides functionality to detect when azd is invoked by known AI coding agents (Claude Code, GitHub Copilot, Gemini, OpenCode) and enables automatic adjustment of behavior (e.g., no-prompt mode).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRunningInAgent ¶
func IsRunningInAgent() bool
IsRunningInAgent returns true if azd was invoked by a known AI coding agent.
func ResetDetection ¶
func ResetDetection()
ResetDetection clears the cached detection result. This is primarily useful for testing.
Types ¶
type AgentInfo ¶
type AgentInfo struct {
// Type is the identified agent type.
Type AgentType
// Name is a human-readable name for the agent.
Name string
// Source indicates how the agent was detected.
Source DetectionSource
// Detected is true if an agent was detected.
Detected bool
// Details contains additional detection information (e.g., matched env var or process name).
Details string
}
AgentInfo contains information about a detected AI coding agent.
func GetCallingAgent ¶
func GetCallingAgent() AgentInfo
GetCallingAgent detects if azd was invoked by a known AI coding agent. The result is cached after the first call.
type AgentType ¶
type AgentType string
AgentType represents a known AI coding agent.
const ( // AgentTypeUnknown indicates no agent was detected. AgentTypeUnknown AgentType = "" // AgentTypeClaudeCode is Anthropic's Claude Code agent. AgentTypeClaudeCode AgentType = "claude-code" // AgentTypeGitHubCopilotCLI is GitHub's Copilot CLI agent. AgentTypeGitHubCopilotCLI AgentType = "github-copilot-cli" // AgentTypeVSCodeCopilot is VS Code GitHub Copilot extension. AgentTypeVSCodeCopilot AgentType = "vscode-copilot" // AgentTypeGemini is Google's Gemini CLI. AgentTypeGemini AgentType = "gemini" // AgentTypeOpenCode is the OpenCode AI coding CLI. AgentTypeOpenCode AgentType = "opencode" )
func (AgentType) DisplayName ¶
DisplayName returns a human-readable name for the agent type.
type DetectionSource ¶
type DetectionSource string
DetectionSource indicates how an agent was detected.
const ( // DetectionSourceNone indicates no detection occurred. DetectionSourceNone DetectionSource = "" // DetectionSourceEnvVar indicates detection via environment variable. DetectionSourceEnvVar DetectionSource = "env-var" // DetectionSourceParentProcess indicates detection via parent process inspection. DetectionSourceParentProcess DetectionSource = "parent-process" // DetectionSourceUserAgent indicates detection via AZURE_DEV_USER_AGENT. DetectionSourceUserAgent DetectionSource = "user-agent" )