Skip to content

Commit 6d1423f

Browse files
authored
Merge pull request #1325 from wakatime/develop
Release v2.2.0
2 parents 610322c + 602bb48 commit 6d1423f

4 files changed

Lines changed: 1352 additions & 5 deletions

File tree

pkg/ai/ai.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,17 @@ const (
5151
ClaudeParser
5252
// CodexParser is the parser ID for Codex.
5353
CodexParser
54+
// CopilotParser is the parser ID for GitHub Copilot Chat.
55+
CopilotParser
5456
// CursorParser is the parser ID for Cursor.
5557
CursorParser
5658
)
5759

5860
const (
59-
claudeParserString = "claude-parser"
60-
codexParserString = "codex-parser"
61-
cursorParserString = "cursor-parser"
61+
claudeParserString = "claude-parser"
62+
codexParserString = "codex-parser"
63+
copilotParserString = "copilot-parser"
64+
cursorParserString = "cursor-parser"
6265
)
6366

6467
// String implements fmt.Stringer interface.
@@ -68,6 +71,8 @@ func (d ParserID) String() string {
6871
return claudeParserString
6972
case CodexParser:
7073
return codexParserString
74+
case CopilotParser:
75+
return copilotParserString
7176
case CursorParser:
7277
return cursorParserString
7378
case UnknownParser:
@@ -203,13 +208,20 @@ func parseAIHeartbeats(
203208
UserAgents: userAgents,
204209
FallbackUserAgent: fallbackUserAgent,
205210
},
211+
Copilot{
212+
After: after,
213+
UserAgents: userAgents,
214+
FallbackUserAgent: fallbackUserAgent,
215+
},
206216
Cursor{
207217
After: after,
208218
UserAgents: userAgents,
209219
FallbackUserAgent: fallbackUserAgent,
210220
},
211221
}
212222

223+
var aiHeartbeats Heartbeats
224+
213225
for _, p := range parsers {
214226
logger.Debugf("execute %s", p.ID().String())
215227

@@ -220,11 +232,11 @@ func parseAIHeartbeats(
220232
}
221233

222234
if len(heartbeats) > 0 {
223-
return heartbeats, nil
235+
aiHeartbeats = append(aiHeartbeats, heartbeats...)
224236
}
225237
}
226238

227-
return nil, nil
239+
return aiHeartbeats, nil
228240
}
229241

230242
func applyProject(heartbeats Heartbeats, config Config) Heartbeats {

0 commit comments

Comments
 (0)