Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agentenv/agentenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type agentSource struct {
}

var sources = []agentSource{
{"CLAUDE_CODE", "claude-code"},
{"CLAUDECODE", "claude-code"},
{"ANTIGRAVITY_AGENT", "antigravity"},
{"AI_AGENT", ""},
{"LLM_AGENT", ""},
Comment thread
SeanAlexanderHarris marked this conversation as resolved.
Expand Down
8 changes: 4 additions & 4 deletions agentenv/agentenv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
},
{
Expand All @@ -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: "",
},
{
Expand Down
10 changes: 5 additions & 5 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
},
{
Expand Down Expand Up @@ -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, "")
}

Expand Down Expand Up @@ -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) {
Expand Down
Loading