-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathclientIcons.ts
More file actions
56 lines (53 loc) · 2.08 KB
/
Copy pathclientIcons.ts
File metadata and controls
56 lines (53 loc) · 2.08 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
/**
* Known client name patterns mapped to icon keys.
* Sorted by specificity (longer patterns first) so that more specific
* names like "claude desktop" match before the shorter "claude".
*/
const KNOWN_CLIENT_PATTERNS: { pattern: string; iconKey: string }[] = [
{ pattern: 'visual studio code', iconKey: 'vscode' },
{ pattern: 'android studio', iconKey: 'android-studio' },
{ pattern: 'claude desktop', iconKey: 'claude' },
{ pattern: 'claude code', iconKey: 'claude' },
{ pattern: 'vs code', iconKey: 'vscode' },
{ pattern: 'windsurf', iconKey: 'windsurf' },
{ pattern: 'codeium', iconKey: 'windsurf' },
{ pattern: 'intellij', iconKey: 'jetbrains' },
{ pattern: 'webstorm', iconKey: 'jetbrains' },
{ pattern: 'pycharm', iconKey: 'jetbrains' },
{ pattern: 'phpstorm', iconKey: 'jetbrains' },
{ pattern: 'rustrover', iconKey: 'jetbrains' },
{ pattern: 'goland', iconKey: 'jetbrains' },
{ pattern: 'rider', iconKey: 'jetbrains' },
{ pattern: 'clion', iconKey: 'jetbrains' },
{ pattern: 'jetbrains', iconKey: 'jetbrains' },
{ pattern: 'cursor', iconKey: 'cursor' },
{ pattern: 'opencode', iconKey: 'opencode' },
{ pattern: 'vscode', iconKey: 'vscode' },
{ pattern: 'claude', iconKey: 'claude' },
];
/**
* Resolves a client name to a known icon key.
*
* Handles exact matches ("Cursor") as well as names that include extra
* context such as "Claude Code (mcpmux)" — the parenthesised suffix
* is ignored as long as the prefix matches a known client pattern.
*
* Returns the icon key (e.g. "claude", "cursor") or null when the name
* is not recognised.
*/
export function resolveKnownClientKey(clientName: string): string | null {
const normalized = clientName.toLowerCase().trim();
for (const { pattern, iconKey } of KNOWN_CLIENT_PATTERNS) {
if (normalized === pattern) {
return iconKey;
}
// Accept prefix match only when followed by a word boundary (' ' or '(')
if (
normalized.startsWith(pattern) &&
(normalized[pattern.length] === ' ' || normalized[pattern.length] === '(')
) {
return iconKey;
}
}
return null;
}