diff --git a/agentenv/agentenv.go b/agentenv/agentenv.go index f1f36c1..0bd53eb 100644 --- a/agentenv/agentenv.go +++ b/agentenv/agentenv.go @@ -12,7 +12,7 @@ type agentSource struct { } var sources = []agentSource{ - {"CLAUDE_CODE", "claude-code"}, + {"CLAUDECODE", "claude-code"}, {"ANTIGRAVITY_AGENT", "antigravity"}, {"AI_AGENT", ""}, {"LLM_AGENT", ""}, diff --git a/agentenv/agentenv_test.go b/agentenv/agentenv_test.go index 5077319..4f438d5 100644 --- a/agentenv/agentenv_test.go +++ b/agentenv/agentenv_test.go @@ -8,7 +8,7 @@ func TestDetected(t *testing.T) { // Every env var Detected looks at. Each subtest zeroes all of them first // so it's isolated from whatever environment its running in (e.g. running // inside an AI agent, or a local dev machine) has set. - knownVars := []string{"CLAUDE_CODE", "ANTIGRAVITY_AGENT", "AI_AGENT", "LLM_AGENT"} + knownVars := []string{"CLAUDECODE", "ANTIGRAVITY_AGENT", "AI_AGENT", "LLM_AGENT"} tests := []struct { name string @@ -22,7 +22,7 @@ func TestDetected(t *testing.T) { }, { name: "claude code, branded slug regardless of value", - env: map[string]string{"CLAUDE_CODE": "1"}, + env: map[string]string{"CLAUDECODE": "1"}, want: "claude-code", }, { @@ -38,12 +38,12 @@ func TestDetected(t *testing.T) { { // tricky scenario, decision for branded name: "branded wins over generic (precedence)", - env: map[string]string{"CLAUDE_CODE": "1", "AI_AGENT": "cursor"}, + env: map[string]string{"CLAUDECODE": "1", "AI_AGENT": "cursor"}, want: "claude-code", }, { name: "empty string treated as unset", - env: map[string]string{"CLAUDE_CODE": ""}, + env: map[string]string{"CLAUDECODE": ""}, want: "", }, { diff --git a/client/client_test.go b/client/client_test.go index 48b9057..a390168 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -56,7 +56,7 @@ func TestFormatBatchErrorBody(t *testing.T) { } } func TestComposeUserAgent(t *testing.T) { - knownVars := []string{"CLAUDE_CODE", "ANTIGRAVITY_AGENT", "AI_AGENT", "LLM_AGENT"} + knownVars := []string{"CLAUDECODE", "ANTIGRAVITY_AGENT", "AI_AGENT", "LLM_AGENT"} tests := []struct { name string @@ -77,7 +77,7 @@ func TestComposeUserAgent(t *testing.T) { { name: "agent and skill together", skill: "cli-command-create", - agentEnv: map[string]string{"CLAUDE_CODE": "1"}, + agentEnv: map[string]string{"CLAUDECODE": "1"}, want: "prolific-oss/cli/" + version.Get() + " agent/claude-code skill/cli-command-create", }, { @@ -105,7 +105,7 @@ func TestComposeUserAgent(t *testing.T) { func TestExecuteSetsSkillInUserAgent(t *testing.T) { // Isolate from ambient agent env vars (this shell has AI_AGENT set). - for _, k := range []string{"CLAUDE_CODE", "ANTIGRAVITY_AGENT", "AI_AGENT", "LLM_AGENT"} { + for _, k := range []string{"CLAUDECODE", "ANTIGRAVITY_AGENT", "AI_AGENT", "LLM_AGENT"} { t.Setenv(k, "") } @@ -134,10 +134,10 @@ func TestExecuteSetsSkillInUserAgent(t *testing.T) { func TestExecuteSetsAgentInUserAgent(t *testing.T) { // Isolate from ambient agent env vars (this shell has AI_AGENT set). - for _, k := range []string{"CLAUDE_CODE", "ANTIGRAVITY_AGENT", "AI_AGENT", "LLM_AGENT"} { + for _, k := range []string{"CLAUDECODE", "ANTIGRAVITY_AGENT", "AI_AGENT", "LLM_AGENT"} { t.Setenv(k, "") } - t.Setenv("CLAUDE_CODE", "1") + t.Setenv("CLAUDECODE", "1") var gotUserAgent string server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {