Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

fix(ActivityParser): Add cross-platform path support for Linux

Open ecielam opened this issue 2 weeks ago • 0 comments

Summary

ActivityParser.ts hardcodes macOS-specific path pattern -Users-${USERNAME}--claude for the Claude Code projects directory. This fails on Linux systems where home directories are under /home/ instead of /Users/.

This is the same issue fixed in #[SessionHarvester PR number] for SessionHarvester.ts.

Changes

+import * as os from "os";

-const USERNAME = process.env.USER || require("os").userInfo().username;
-const PROJECTS_DIR = path.join(CLAUDE_DIR, "projects", `-Users-${USERNAME}--claude`);
+const USERNAME = process.env.USER || os.userInfo().username;
+// Cross-platform support: macOS uses /Users/, Linux uses /home/
+const PATH_PREFIX = os.platform() === "darwin" ? "Users" : "home";
+const PROJECTS_DIR = path.join(CLAUDE_DIR, "projects", `-${PATH_PREFIX}-${USERNAME}--claude`);

Testing

Linux (Ubuntu 24.04):

  • Path correctly resolves to -home-username--claude

macOS (expected):

  • Path resolves to -Users-username--claude (unchanged behavior)

Checklist

  • [x] Tested on Linux
  • [x] Maintains backward compatibility with macOS
  • [x] No new dependencies (uses built-in os module)
  • [x] Consistent with SessionHarvester fix pattern

ecielam avatar Jan 17 '26 20:01 ecielam