clawsage 1.0.2 → 1.0.7

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/parser.js +6 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawsage",
3
- "version": "1.0.2",
3
+ "version": "1.0.7",
4
4
  "description": "CLI tool for analyzing OpenClaw token usage and costs from local session logs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,10 +26,10 @@
26
26
  "license": "MIT",
27
27
  "repository": {
28
28
  "type": "git",
29
- "url": "git+https://github.com/its-clawdia/ocusage.git"
29
+ "url": "git+https://github.com/its-clawdia/clawsage.git"
30
30
  },
31
- "homepage": "https://github.com/its-clawdia/ocusage#readme",
31
+ "homepage": "https://github.com/its-clawdia/clawsage#readme",
32
32
  "engines": {
33
- "node": ">=18"
33
+ "node": ">=20"
34
34
  }
35
35
  }
package/src/parser.js CHANGED
@@ -22,7 +22,7 @@ export function resolveSessionDir(customPath) {
22
22
  export function listSessionFiles(dir) {
23
23
  try {
24
24
  return fs.readdirSync(dir)
25
- .filter(f => f.endsWith('.jsonl') && !f.includes('.reset.'))
25
+ .filter(f => f.includes('.jsonl'))
26
26
  .map(f => path.join(dir, f));
27
27
  } catch (err) {
28
28
  throw new Error(`Cannot read session directory: ${dir}\n${err.message}`);
@@ -34,8 +34,12 @@ export function listSessionFiles(dir) {
34
34
  * Returns: { id, timestamp, date, models, messages: [{timestamp, model, usage}] }
35
35
  */
36
36
  export async function parseSessionFile(filePath) {
37
+ // Handle both regular (.jsonl) and reset (.jsonl.reset.<timestamp>) files
38
+ const basename = path.basename(filePath);
39
+ const id = basename.replace(/\.jsonl(?:\.(?:reset|deleted)\..+)?$/, '');
40
+
37
41
  const session = {
38
- id: path.basename(filePath, '.jsonl'),
42
+ id,
39
43
  filePath,
40
44
  timestamp: null,
41
45
  date: null,