feat(cli): expand AI agent detection#1261
Merged
MichaelHogers merged 2 commits intomainfrom Mar 17, 2026
Merged
Conversation
…i CLI, and OpenCode Add detection for four new AI coding agents that were missing compared to similar tooling (e.g. Stripe CLI). Also add CURSOR_AGENT as a fallback env var for Cursor detection alongside the existing CURSOR_TRACE_ID. New operators and their env vars: - Cline: CLINE_ACTIVE - Codex CLI: CODEX_SANDBOX, CODEX_THREAD_ID - Gemini CLI: GEMINI_CLI - OpenCode: OPENCODE - Cursor (additional): CURSOR_AGENT
Cline (and potentially other future agents) are VS Code extensions, so TERM_PROGRAM=vscode is always set when they're active. The previous ordering would misclassify Cline as 'vscode' (interactive) instead of 'cline' (agent). Moving the VS Code check after all agent-specific checks ensures extensions are correctly detected as agents.
thebiglabasky
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expands operator detection to cover AI coding agents we were missing compared to similar CLIs
CLINE_ACTIVECODEX_SANDBOX,CODEX_THREAD_IDGEMINI_CLIOPENCODECURSOR_AGENTas fallback alongside existingCURSOR_TRACE_IDAll new operators map to
agentCLI mode, so they get the same non-interactive confirmation flow as existing agents.Before / After
CLINE_ACTIVECODEX_SANDBOX/CODEX_THREAD_IDGEMINI_CLIOPENCODECURSOR_TRACE_IDonlyCURSOR_TRACE_IDorCURSOR_AGENTContext
Compared our detection with other CLIs. Other CLIs covered 7 agents; we covered 5. This PR closes the gap and adds a second env var for Cursor (Stripe uses
CURSOR_AGENT, we usedCURSOR_TRACE_ID— now we check both).Test plan
cli-mode.spec.ts)