getaimeter 0.2.1 → 0.2.2

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 (3) hide show
  1. package/cli.js +12 -0
  2. package/package.json +1 -1
  3. package/watcher.js +18 -0
package/cli.js CHANGED
@@ -5,6 +5,7 @@ const { getApiKey, saveApiKey, getWatchPaths, AIMETER_DIR } = require('./config'
5
5
  const { startWatching } = require('./watcher');
6
6
  const { install, uninstall, isInstalled, startNow, stopNow } = require('./service');
7
7
  const { checkForUpdate, getCurrentVersion } = require('./update-check');
8
+ const { startTray, stopTray } = require('./tray');
8
9
 
9
10
  const command = process.argv[2] || 'help';
10
11
 
@@ -187,8 +188,18 @@ function runWatch() {
187
188
 
188
189
  const cleanup = startWatching();
189
190
 
191
+ // Launch system tray icon (non-blocking, fails silently if systray2 not available)
192
+ const showTray = !process.argv.includes('--no-tray');
193
+ if (showTray) {
194
+ startTray(() => {
195
+ cleanup();
196
+ try { fs.unlinkSync(lockFile); } catch {}
197
+ }).catch(() => {}); // ignore tray errors
198
+ }
199
+
190
200
  const cleanupAll = () => {
191
201
  cleanup();
202
+ stopTray();
192
203
  try { fs.unlinkSync(lockFile); } catch {}
193
204
  process.exit(0);
194
205
  };
@@ -196,6 +207,7 @@ function runWatch() {
196
207
  process.on('SIGINT', cleanupAll);
197
208
  process.on('SIGTERM', cleanupAll);
198
209
  process.on('exit', () => {
210
+ stopTray();
199
211
  try { fs.unlinkSync(lockFile); } catch {}
200
212
  });
201
213
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getaimeter",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Track your Claude AI usage across CLI, VS Code, and Desktop App. One command to start.",
5
5
  "bin": {
6
6
  "aimeter": "cli.js"
package/watcher.js CHANGED
@@ -43,6 +43,24 @@ function detectSource(filePath) {
43
43
  return 'desktop_app';
44
44
  }
45
45
 
46
+ // For subagent files, inherit the parent session's source
47
+ if (normalized.includes('/subagents/')) {
48
+ const parentDir = normalized.replace(/\/[^/]+\/subagents\/.*$/, '');
49
+ // Find the parent JSONL (same dir, .jsonl file)
50
+ try {
51
+ const parentDirNative = parentDir.replace(/\//g, path.sep);
52
+ const entries = fs.readdirSync(parentDirNative);
53
+ for (const entry of entries) {
54
+ if (entry.endsWith('.jsonl')) {
55
+ const parentFile = path.join(parentDirNative, entry);
56
+ const parentSource = detectSource(parentFile); // recursive, will cache
57
+ _sourceCache.set(filePath, parentSource);
58
+ return parentSource;
59
+ }
60
+ }
61
+ } catch {}
62
+ }
63
+
46
64
  // Read first 10KB of the file to find entrypoint or IDE markers
47
65
  let source = 'cli'; // default
48
66
  try {