@uxcontinuum/ccwrapped 1.0.2 → 1.0.4

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/index.js +9 -13
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -14,7 +14,7 @@ let C = {
14
14
  function noColor() { Object.keys(C).forEach(k => C[k] = ''); }
15
15
 
16
16
  // ── PATHS ─────────────────────────────────────────────────────────────────────
17
- function findClaudeDir() {
17
+ function findClaudeDirs() {
18
18
  const candidates = [path.join(os.homedir(), '.claude', 'projects')];
19
19
  if (os.homedir() === '/root') {
20
20
  try {
@@ -24,14 +24,16 @@ function findClaudeDir() {
24
24
  }
25
25
  } catch (_) {}
26
26
  }
27
+ const dirs = [];
27
28
  for (const c of candidates) {
28
29
  try {
29
- if (fs.statSync(c).isDirectory()) return c;
30
+ if (fs.statSync(c).isDirectory()) dirs.push(c);
30
31
  } catch (_) {}
31
32
  }
32
- return candidates[0];
33
+ return dirs.length ? dirs : [candidates[0]];
33
34
  }
34
- const CLAUDE_DIR = findClaudeDir();
35
+ const CLAUDE_DIRS = findClaudeDirs();
36
+ const CLAUDE_DIR = CLAUDE_DIRS.join(', ');
35
37
 
36
38
  // ── FILE SCAN ─────────────────────────────────────────────────────────────────
37
39
  function findJsonl(dir, cutoffMs, out = []) {
@@ -55,8 +57,8 @@ function projName(filePath) {
55
57
  const idx = parts.lastIndexOf('projects');
56
58
  if (idx < 0 || idx + 1 >= parts.length) return 'unknown';
57
59
  let raw = parts[idx + 1];
58
- const prefix = `-home-${os.userInfo().username}-`;
59
- if (raw.startsWith(prefix)) raw = raw.slice(prefix.length);
60
+ const m = raw.match(/^-home-[^-]+-(.+)$/);
61
+ if (m) raw = m[1];
60
62
  else if (raw.startsWith('-home-')) raw = raw.replace(/^-+/, '');
61
63
  return raw || '(home)';
62
64
  }
@@ -724,13 +726,7 @@ if (hasFlag('--no-color') || hasFlag('--no-colour')) noColor();
724
726
  const days = getArg('--days', 30);
725
727
  const cutoffMs = Date.now() - days * 86400000;
726
728
 
727
- try { fs.statSync(CLAUDE_DIR); } catch (_) {
728
- pr(`No Claude projects directory found.`);
729
- pr(`Expected: ${CLAUDE_DIR}`);
730
- process.exit(0);
731
- }
732
-
733
- const files = findJsonl(CLAUDE_DIR, cutoffMs);
729
+ const files = CLAUDE_DIRS.flatMap(d => findJsonl(d, cutoffMs));
734
730
  const sessions = files.map(f => parseSession(f, cutoffMs)).filter(Boolean);
735
731
 
736
732
  if (!sessions.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxcontinuum/ccwrapped",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Spotify Wrapped, but for your Claude Code sessions. Zero install: npx @uxcontinuum/ccwrapped",
5
5
  "main": "index.js",
6
6
  "bin": {