aicp-tracker 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/log-parser.js +21 -6
- package/src/sender.js +2 -0
package/package.json
CHANGED
package/src/log-parser.js
CHANGED
|
@@ -6,6 +6,20 @@ const state = require('./state');
|
|
|
6
6
|
// Tool names whose input.file_path / input.path we extract
|
|
7
7
|
const FILE_TOOLS = new Set(['Read', 'Edit', 'Write', 'Glob', 'NotebookEdit', 'MultiEdit']);
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Extracts all JIRA-style task keys from a git branch name.
|
|
11
|
+
* Handles all combinations per spec:
|
|
12
|
+
* "STORAGE-56: ASD", "STORAGE-56 ASD", "ASD STORAGE-56", "STORAGE-56",
|
|
13
|
+
* "storage-56 asd" (case-insensitive), "asd :storage-56",
|
|
14
|
+
* "STORAGE-56, STORAGE-57: ASD" (multiple tasks → returns both)
|
|
15
|
+
* Returns uppercase deduplicated keys: ["STORAGE-56", "STORAGE-57"]
|
|
16
|
+
*/
|
|
17
|
+
function extractTasksFromBranch(branch) {
|
|
18
|
+
if (!branch || typeof branch !== 'string') return [];
|
|
19
|
+
const matches = branch.match(/[A-Za-z][A-Za-z0-9]*-\d+/g) || [];
|
|
20
|
+
return [...new Set(matches.map(m => m.toUpperCase()))];
|
|
21
|
+
}
|
|
22
|
+
|
|
9
23
|
function parseNewLines(filePath) {
|
|
10
24
|
const offset = state.getOffset(filePath);
|
|
11
25
|
let stat;
|
|
@@ -49,12 +63,13 @@ function parseNewLines(filePath) {
|
|
|
49
63
|
}
|
|
50
64
|
|
|
51
65
|
records.push({
|
|
52
|
-
sessionId:
|
|
53
|
-
uuid:
|
|
54
|
-
parentUuid:
|
|
55
|
-
timestamp:
|
|
56
|
-
gitBranch:
|
|
57
|
-
|
|
66
|
+
sessionId: entry.sessionId || null,
|
|
67
|
+
uuid: entry.uuid || null,
|
|
68
|
+
parentUuid: entry.parentUuid || null,
|
|
69
|
+
timestamp: entry.timestamp || new Date().toISOString(),
|
|
70
|
+
gitBranch: entry.gitBranch || null,
|
|
71
|
+
task_from_git_branch: extractTasksFromBranch(entry.gitBranch),
|
|
72
|
+
model: entry.message?.model || null,
|
|
58
73
|
|
|
59
74
|
input_tokens: usage.input_tokens || 0,
|
|
60
75
|
cache_creation_input_tokens: usage.cache_creation_input_tokens || 0,
|
package/src/sender.js
CHANGED