|
10 | 10 | beforeEach(function (): void { |
11 | 11 | foreach ([ |
12 | 12 | 'AI_AGENT', |
13 | | - 'CURSOR_TRACE_ID', |
14 | 13 | 'CURSOR_AGENT', |
15 | 14 | 'GEMINI_CLI', |
16 | 15 | 'CODEX_SANDBOX', |
|
32 | 31 | afterEach(function (): void { |
33 | 32 | foreach ([ |
34 | 33 | 'AI_AGENT', |
35 | | - 'CURSOR_TRACE_ID', |
36 | 34 | 'CURSOR_AGENT', |
37 | 35 | 'GEMINI_CLI', |
38 | 36 | 'CODEX_SANDBOX', |
|
70 | 68 | }); |
71 | 69 |
|
72 | 70 | // Known agent env var detection |
73 | | -it('detects cursor via CURSOR_TRACE_ID', function (): void { |
74 | | - putenv('CURSOR_TRACE_ID=some-trace-id'); |
| 71 | +it('detects cursor via CURSOR_AGENT', function (): void { |
| 72 | + putenv('CURSOR_AGENT=1'); |
75 | 73 |
|
76 | 74 | $result = AgentDetector::detect(); |
77 | 75 |
|
|
80 | 78 | ->and($result->knownAgent())->toBe(KnownAgent::Cursor); |
81 | 79 | }); |
82 | 80 |
|
83 | | -it('detects cursor-cli via CURSOR_AGENT', function (): void { |
84 | | - putenv('CURSOR_AGENT=true'); |
85 | | - |
86 | | - $result = AgentDetector::detect(); |
87 | | - |
88 | | - expect($result->isAgent)->toBeTrue() |
89 | | - ->and($result->name)->toBe('cursor-cli') |
90 | | - ->and($result->knownAgent())->toBe(KnownAgent::CursorCli); |
91 | | -}); |
92 | | - |
93 | 81 | it('detects gemini via GEMINI_CLI', function (): void { |
94 | 82 | putenv('GEMINI_CLI=true'); |
95 | 83 |
|
|
235 | 223 |
|
236 | 224 | $result = AgentDetector::detect(); |
237 | 225 |
|
238 | | - expect($result->name)->toBe('cursor-cli'); |
| 226 | + expect($result->name)->toBe('cursor'); |
239 | 227 | }); |
240 | 228 |
|
241 | 229 | it('prioritizes CLAUDECODE over REPL_ID', function (): void { |
|
295 | 283 |
|
296 | 284 | expect($result->knownAgent())->toBe($expected); |
297 | 285 | })->with([ |
298 | | - 'cursor' => ['CURSOR_TRACE_ID', 'trace', KnownAgent::Cursor], |
299 | | - 'cursor-cli' => ['CURSOR_AGENT', 'true', KnownAgent::CursorCli], |
| 286 | + 'cursor' => ['CURSOR_AGENT', '1', KnownAgent::Cursor], |
300 | 287 | 'gemini' => ['GEMINI_CLI', 'true', KnownAgent::Gemini], |
301 | 288 | 'codex' => ['CODEX_SANDBOX', 'true', KnownAgent::Codex], |
302 | 289 | 'augment-cli' => ['AUGMENT_AGENT', 'true', KnownAgent::AugmentCli], |
|
316 | 303 |
|
317 | 304 | // Standalone function |
318 | 305 | it('works via standalone detectAgent function', function (): void { |
319 | | - putenv('CURSOR_TRACE_ID=trace'); |
| 306 | + putenv('CURSOR_AGENT=1'); |
320 | 307 |
|
321 | 308 | $result = detectAgent(); |
322 | 309 |
|
|
0 commit comments