@uxcontinuum/ccwrapped 1.0.3 → 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.
- package/index.js +7 -28
- 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
|
|
17
|
+
function findClaudeDirs() {
|
|
18
18
|
const candidates = [path.join(os.homedir(), '.claude', 'projects')];
|
|
19
19
|
if (os.homedir() === '/root') {
|
|
20
20
|
try {
|
|
@@ -24,31 +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()
|
|
30
|
+
if (fs.statSync(c).isDirectory()) dirs.push(c);
|
|
30
31
|
} catch (_) {}
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
if (fs.statSync(c).isDirectory()) return c;
|
|
35
|
-
} catch (_) {}
|
|
36
|
-
}
|
|
37
|
-
return candidates[0];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function hasJsonl(dir) {
|
|
41
|
-
let entries;
|
|
42
|
-
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch (_) { return false; }
|
|
43
|
-
for (const e of entries) {
|
|
44
|
-
if (e.name === 'subagents') continue;
|
|
45
|
-
const full = path.join(dir, e.name);
|
|
46
|
-
if (e.isDirectory()) { if (hasJsonl(full)) return true; continue; }
|
|
47
|
-
if (e.name.endsWith('.jsonl')) return true;
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
33
|
+
return dirs.length ? dirs : [candidates[0]];
|
|
50
34
|
}
|
|
51
|
-
const
|
|
35
|
+
const CLAUDE_DIRS = findClaudeDirs();
|
|
36
|
+
const CLAUDE_DIR = CLAUDE_DIRS.join(', ');
|
|
52
37
|
|
|
53
38
|
// ── FILE SCAN ─────────────────────────────────────────────────────────────────
|
|
54
39
|
function findJsonl(dir, cutoffMs, out = []) {
|
|
@@ -741,13 +726,7 @@ if (hasFlag('--no-color') || hasFlag('--no-colour')) noColor();
|
|
|
741
726
|
const days = getArg('--days', 30);
|
|
742
727
|
const cutoffMs = Date.now() - days * 86400000;
|
|
743
728
|
|
|
744
|
-
|
|
745
|
-
pr(`No Claude projects directory found.`);
|
|
746
|
-
pr(`Expected: ${CLAUDE_DIR}`);
|
|
747
|
-
process.exit(0);
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
const files = findJsonl(CLAUDE_DIR, cutoffMs);
|
|
729
|
+
const files = CLAUDE_DIRS.flatMap(d => findJsonl(d, cutoffMs));
|
|
751
730
|
const sessions = files.map(f => parseSession(f, cutoffMs)).filter(Boolean);
|
|
752
731
|
|
|
753
732
|
if (!sessions.length) {
|