(decodedCmd: string)
| 53 | } |
| 54 | |
| 55 | function checkCommandForTelemetry(decodedCmd: string) { |
| 56 | if (!decodedCmd) { |
| 57 | return; |
| 58 | } |
| 59 | |
| 60 | const normalizedCmd = normalizeCmd(decodedCmd); |
| 61 | |
| 62 | if (normalizedCmd.startsWith("ssh ")) { |
| 63 | recordTEvent("conn:connect", { "conn:conntype": "ssh-manual" }); |
| 64 | return; |
| 65 | } |
| 66 | |
| 67 | const editorsRegex = /^(vim|vi|nano|nvim)\b/; |
| 68 | if (editorsRegex.test(normalizedCmd)) { |
| 69 | recordTEvent("action:term", { "action:type": "cli-edit" }); |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | const tailFollowRegex = /(^|\|\s*)tail\s+-[fF]\b/; |
| 74 | if (tailFollowRegex.test(normalizedCmd)) { |
| 75 | recordTEvent("action:term", { "action:type": "cli-tailf" }); |
| 76 | return; |
| 77 | } |
| 78 | |
| 79 | if (ClaudeCodeRegex.test(normalizedCmd)) { |
| 80 | recordTEvent("action:term", { "action:type": "claude" }); |
| 81 | return; |
| 82 | } |
| 83 | |
| 84 | const opencodeRegex = /^opencode\b/; |
| 85 | if (opencodeRegex.test(normalizedCmd)) { |
| 86 | recordTEvent("action:term", { "action:type": "opencode" }); |
| 87 | return; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | export function isClaudeCodeCommand(decodedCmd: string): boolean { |
| 92 | if (!decodedCmd) { |
no test coverage detected