Repository navigation
Expand file tree
/
Copy pathtestcases.json
More file actions
301 lines (280 loc) · 7.74 KB
/
Copy pathtestcases.json
File metadata and controls
301 lines (280 loc) · 7.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
[
{ "name": "no agent when nothing set", "env": {}, "expectedIsAgent": false },
{
"name": "detects custom agent from AI_AGENT",
"env": { "AI_AGENT": "custom-agent" },
"expectedIsAgent": true,
"expectedName": "custom-agent"
},
{
"name": "detects github copilot from AI_AGENT=github-copilot",
"env": { "AI_AGENT": "github-copilot" },
"expectedIsAgent": true,
"expectedAgentKey": "GITHUB_COPILOT"
},
{
"name": "detects github copilot from COPILOT_MODEL",
"env": { "COPILOT_MODEL": "gpt-5" },
"expectedIsAgent": true,
"expectedAgentKey": "GITHUB_COPILOT"
},
{
"name": "detects github copilot from COPILOT_ALLOW_ALL",
"env": { "COPILOT_ALLOW_ALL": "true" },
"expectedIsAgent": true,
"expectedAgentKey": "GITHUB_COPILOT"
},
{
"name": "detects github copilot from COPILOT_GITHUB_TOKEN",
"env": { "COPILOT_GITHUB_TOKEN": "ghp_xxx" },
"expectedIsAgent": true,
"expectedAgentKey": "GITHUB_COPILOT"
},
{
"name": "detects cursor from CURSOR_TRACE_ID",
"env": { "CURSOR_TRACE_ID": "some-uuid" },
"expectedIsAgent": true,
"expectedAgentKey": "CURSOR"
},
{
"name": "detects cursor cli from CURSOR_AGENT",
"env": { "CURSOR_AGENT": "1" },
"expectedIsAgent": true,
"expectedAgentKey": "CURSOR_CLI"
},
{
"name": "detects cursor cli from CURSOR_EXTENSION_HOST_ROLE=agent-exec",
"env": { "CURSOR_EXTENSION_HOST_ROLE": "agent-exec" },
"expectedIsAgent": true,
"expectedAgentKey": "CURSOR_CLI"
},
{
"name": "detects kimi from KIMI_PLUGIN_ROOT",
"env": { "KIMI_PLUGIN_ROOT": "/tmp/kimi-plugin" },
"expectedIsAgent": true,
"expectedAgentKey": "KIMI"
},
{
"name": "does not detect kimi from KIMI_CODE_HOME alone",
"env": { "KIMI_CODE_HOME": "/tmp/kimi" },
"expectedIsAgent": false
},
{
"name": "detects grok from GROK_PLUGIN_ROOT",
"env": { "GROK_PLUGIN_ROOT": "/tmp/grok-plugin" },
"expectedIsAgent": true,
"expectedAgentKey": "GROK"
},
{
"name": "detects grok from GROK_PLUGIN_DATA before Claude compatibility markers",
"env": {
"GROK_PLUGIN_DATA": "/tmp/grok-data",
"CLAUDE_CODE": "1"
},
"expectedIsAgent": true,
"expectedAgentKey": "GROK"
},
{
"name": "detects gemini_cli from GEMINI_CLI",
"env": { "GEMINI_CLI": "1" },
"expectedIsAgent": true,
"expectedAgentKey": "GEMINI"
},
{
"name": "detects codex_cli from CODEX_SANDBOX",
"env": { "CODEX_SANDBOX": "seatbelt" },
"expectedIsAgent": true,
"expectedAgentKey": "CODEX"
},
{
"name": "detects codex_cli from CODEX_CI",
"env": { "CODEX_CI": "1" },
"expectedIsAgent": true,
"expectedAgentKey": "CODEX"
},
{
"name": "detects codex_cli from CODEX_THREAD_ID",
"env": { "CODEX_THREAD_ID": "thread-123" },
"expectedIsAgent": true,
"expectedAgentKey": "CODEX"
},
{
"name": "detects antigravity from ANTIGRAVITY_AGENT",
"env": { "ANTIGRAVITY_AGENT": "1" },
"expectedIsAgent": true,
"expectedAgentKey": "ANTIGRAVITY"
},
{
"name": "detects augment cli from AUGMENT_AGENT",
"env": { "AUGMENT_AGENT": "1" },
"expectedIsAgent": true,
"expectedAgentKey": "AUGMENT_CLI"
},
{
"name": "detects open_code from OPENCODE_CLIENT",
"env": { "OPENCODE_CLIENT": "opencode" },
"expectedIsAgent": true,
"expectedAgentKey": "OPENCODE"
},
{
"name": "detects open_code from OPENCODE",
"env": { "OPENCODE": "1" },
"expectedIsAgent": true,
"expectedAgentKey": "OPENCODE"
},
{
"name": "detects goose from GOOSE_PROVIDER",
"env": { "GOOSE_PROVIDER": "anthropic" },
"expectedIsAgent": true,
"expectedAgentKey": "GOOSE"
},
{
"name": "detects junie from JUNIE_DATA",
"env": { "JUNIE_DATA": "/tmp/junie" },
"expectedIsAgent": true,
"expectedAgentKey": "JUNIE"
},
{
"name": "detects junie from JUNIE_SHIM_PATH",
"env": { "JUNIE_SHIM_PATH": "/tmp/junie/shim" },
"expectedIsAgent": true,
"expectedAgentKey": "JUNIE"
},
{
"name": "detects pi from PATH containing .pi/agent",
"env": { "PATH": "/usr/bin:/home/me/.pi/agent/bin" },
"expectedIsAgent": true,
"expectedAgentKey": "PI"
},
{
"name": "detects kiro when TERM_PROGRAM=kiro and no TTY",
"env": { "TERM_PROGRAM": "kiro" },
"tty": false,
"expectedIsAgent": true,
"expectedAgentKey": "KIRO"
},
{
"name": "does not detect kiro when TERM_PROGRAM=kiro with a TTY",
"env": { "TERM_PROGRAM": "kiro" },
"tty": true,
"expectedIsAgent": false
},
{
"name": "detects claude_code from CLAUDE_CODE",
"env": { "CLAUDE_CODE": "1" },
"expectedIsAgent": true,
"expectedAgentKey": "CLAUDE"
},
{
"name": "detects claude_code from CLAUDECODE",
"env": { "CLAUDECODE": "1" },
"expectedIsAgent": true,
"expectedAgentKey": "CLAUDE"
},
{
"name": "detects cowork from CLAUDECODE + CLAUDE_CODE_IS_COWORK",
"env": { "CLAUDECODE": "1", "CLAUDE_CODE_IS_COWORK": "1" },
"expectedIsAgent": true,
"expectedAgentKey": "COWORK"
},
{
"name": "detects cowork from CLAUDE_CODE + CLAUDE_CODE_IS_COWORK",
"env": { "CLAUDE_CODE": "1", "CLAUDE_CODE_IS_COWORK": "1" },
"expectedIsAgent": true,
"expectedAgentKey": "COWORK"
},
{
"name": "CLAUDE_CODE_IS_COWORK alone returns no agent",
"env": { "CLAUDE_CODE_IS_COWORK": "1" },
"expectedIsAgent": false
},
{
"name": "detects devin when /opt/.devin exists",
"env": {},
"files": ["/opt/.devin"],
"expectedIsAgent": true,
"expectedAgentKey": "DEVIN",
"skipGo": true
},
{
"name": "detects replit from REPL_ID",
"env": { "REPL_ID": "1" },
"expectedIsAgent": true,
"expectedAgentKey": "REPLIT"
},
{
"name": "AI_AGENT takes highest priority",
"env": {
"AI_AGENT": "custom-priority",
"CURSOR_TRACE_ID": "some-uuid",
"CURSOR_AGENT": "1",
"GEMINI_CLI": "1",
"CODEX_SANDBOX": "seatbelt",
"ANTIGRAVITY_AGENT": "1",
"AUGMENT_AGENT": "1",
"OPENCODE_CLIENT": "opencode",
"CLAUDE_CODE": "1",
"REPL_ID": "1",
"COPILOT_MODEL": "gpt-5",
"COPILOT_ALLOW_ALL": "true",
"COPILOT_GITHUB_TOKEN": "ghp_xxx"
},
"expectedIsAgent": true,
"expectedName": "custom-priority"
},
{
"name": "CURSOR_TRACE_ID takes priority over other agents",
"env": {
"CURSOR_TRACE_ID": "some-uuid",
"CURSOR_AGENT": "1",
"GEMINI_CLI": "1",
"CODEX_SANDBOX": "seatbelt",
"ANTIGRAVITY_AGENT": "1",
"AUGMENT_AGENT": "1",
"OPENCODE_CLIENT": "opencode",
"CLAUDE_CODE": "1",
"REPL_ID": "1",
"COPILOT_MODEL": "gpt-5"
},
"expectedIsAgent": true,
"expectedAgentKey": "CURSOR"
},
{
"name": "CURSOR_AGENT takes priority over remaining agents",
"env": {
"CURSOR_AGENT": "1",
"GEMINI_CLI": "1",
"CODEX_SANDBOX": "seatbelt",
"ANTIGRAVITY_AGENT": "1",
"AUGMENT_AGENT": "1",
"OPENCODE_CLIENT": "opencode",
"CLAUDE_CODE": "1",
"REPL_ID": "1",
"COPILOT_MODEL": "gpt-5"
},
"expectedIsAgent": true,
"expectedAgentKey": "CURSOR_CLI"
},
{
"name": "empty string values return no agent",
"env": { "AI_AGENT": "", "CURSOR_TRACE_ID": "" },
"expectedIsAgent": false
},
{
"name": "whitespace-only AI_AGENT returns no agent",
"env": { "AI_AGENT": " " },
"expectedIsAgent": false
},
{
"name": "special characters in AI_AGENT are preserved",
"env": { "AI_AGENT": "my-custom-agent@v1.0" },
"expectedIsAgent": true,
"expectedName": "my-custom-agent@v1.0"
},
{
"name": "leading and trailing whitespace in AI_AGENT is trimmed",
"env": { "AI_AGENT": " custom-agent " },
"expectedIsAgent": true,
"expectedName": "custom-agent"
}
]