Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Detected string
Detected is the canonical slug of the AI agent driving the CLI when agent mode is active (e.g. "claude-code", "cursor", "aider"). It is "unknown" when agent mode is enabled explicitly via the flag or DASH0_AGENT_MODE but no known agent env var was found, and "" when agent mode is disabled.
var Enabled bool
Enabled reports whether agent mode is active. The result is determined once, during Init, and cached for the lifetime of the process.
Functions ¶
func Init ¶
func Init(flagValue bool)
Init resolves whether agent mode should be active according to the following priority (first match wins):
- DASH0_AGENT_MODE=0|false → disabled (overrides everything)
- --agent-mode flag → enabled (passed as flagValue)
- DASH0_AGENT_MODE=1|true → enabled
- Any known AI-agent env var → enabled
Independently of which path enables agent mode, the environment is scanned for known AI-agent markers so Detected holds the most specific slug available (or "unknown" when none is found but agent mode is active anyway).
Call Init once from main, before any output.
func PrintJSONError ¶
PrintJSONError writes err as a JSON object to w. If the error string contains a "\nHint:" section, it is split into the "error" and "hint" fields.
Types ¶
This section is empty.