Skip to content

Commit 4c9927e

Browse files
committed
2 parents b4a61c0 + 2b0b8bc commit 4c9927e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,11 @@ There are also individual properties to check for each specific AI CLI
178178
<a id='snippet-AiCliDetectorProps'></a>
179179
```cs
180180
var isCopilot = AiCliDetector.IsCopilot;
181+
var isCursor = AiCliDetector.IsCursor;
181182
var isAider = AiCliDetector.IsAider;
182183
var isClaudeCode = AiCliDetector.IsClaudeCode;
183184
```
184-
<sup><a href='/src/DiffEngine.Tests/AiCliDetectorTest.cs#L9-L15' title='Snippet source file'>snippet source</a> | <a href='#snippet-AiCliDetectorProps' title='Start of snippet'>anchor</a></sup>
185+
<sup><a href='/src/DiffEngine.Tests/AiCliDetectorTest.cs#L9-L16' title='Snippet source file'>snippet source</a> | <a href='#snippet-AiCliDetectorProps' title='Start of snippet'>anchor</a></sup>
185186
<!-- endSnippet -->
186187

187188

src/DiffEngine.Tests/AiCliDetectorTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public void Props()
99
#region AiCliDetectorProps
1010

1111
var isCopilot = AiCliDetector.IsCopilot;
12+
var isCursor = AiCliDetector.IsCursor;
1213
var isAider = AiCliDetector.IsAider;
1314
var isClaudeCode = AiCliDetector.IsClaudeCode;
1415

src/DiffEngine/AiCliDetector.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@ static AiCliDetector()
1818
// https://docs.anthropic.com/en/docs/build-with-claude/claude-cli
1919
IsClaudeCode = variables.Contains("CLAUDECODE") || variables.Contains("CLAUDE_CODE_ENTRYPOINT");
2020

21+
// Cursor
22+
// https://cursor.com/docs/agent/terminal
23+
IsCursor = variables.Contains("CURSOR_AGENT");
24+
2125
Detected = IsCopilot ||
2226
IsAider ||
23-
IsClaudeCode;
27+
IsClaudeCode ||
28+
IsCursor;
2429
}
2530

31+
public static bool IsCursor { get; set; }
32+
2633
public static bool IsCopilot { get; }
2734

2835
public static bool IsAider { get; }

0 commit comments

Comments
 (0)