Skip to content
Open
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
3 changes: 3 additions & 0 deletions internal/scanner/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type ProcessInfo struct {
PID int32
PPID int32
Name string
Exe string
Cmdline string
Args string
CreateTime time.Time
Expand Down Expand Up @@ -66,6 +67,7 @@ func processToInfo(p *process.Process, portMap map[int32][]uint32) *ProcessInfo
}

ppid, _ := p.Ppid()
exe, _ := p.Exe()
cmdline, _ := p.Cmdline()
createMs, _ := p.CreateTime()
terminal, _ := p.Terminal()
Expand All @@ -92,6 +94,7 @@ func processToInfo(p *process.Process, portMap map[int32][]uint32) *ProcessInfo
PID: p.Pid,
PPID: ppid,
Name: name,
Exe: exe,
Cmdline: cmdline,
Args: args,
CreateTime: createTime,
Expand Down
3 changes: 2 additions & 1 deletion internal/scanner/scorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var ideSignatures = []ideSignature{
// Claude Code CLI — match the actual binary, not anything with "claude" in it
{pathContains: "/node_modules/.bin/claude"},
{pathContains: "/@anthropic-ai/claude-code"},
{pathContains: "/.local/share/claude/"},

// Windsurf
{pathContains: "/Windsurf.app/"},
Expand Down Expand Up @@ -145,7 +146,7 @@ func checkIDERunningFromList(procs []ProcessInfo) bool {

for _, p := range procs {
for _, sig := range ideSignatures {
if sig.pathContains != "" && strings.Contains(p.Cmdline, sig.pathContains) {
if sig.pathContains != "" && (strings.Contains(p.Cmdline, sig.pathContains) || strings.Contains(p.Exe, sig.pathContains)) {
return true
}
if sig.exactName != "" && p.Name == sig.exactName {
Expand Down
16 changes: 14 additions & 2 deletions internal/scanner/scorer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,27 @@ func TestIDEDetectionClaude(t *testing.T) {
t.Error("Random claude-helper should NOT be detected as an IDE")
}

// Actual Claude Code CLI should be detected
// Actual Claude Code CLI (node_modules install) should be detected
procs = []ProcessInfo{
{
Name: "node",
Cmdline: "/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js",
},
}
if !checkIDERunningFromList(procs) {
t.Error("Claude Code CLI should be detected as an IDE")
t.Error("Claude Code CLI (node_modules) should be detected as an IDE")
}

// Claude Code native binary should be detected via Exe path
procs = []ProcessInfo{
{
Name: "claude",
Exe: "/Users/testuser/.local/share/claude/versions/2.1.74",
Cmdline: "claude --dangerously-skip-permissions",
},
}
if !checkIDERunningFromList(procs) {
t.Error("Claude Code native binary should be detected as an IDE via Exe path")
}
}

Expand Down