claude-code-watch 0.0.22 → 0.0.23
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/package.json +1 -1
- package/src/watcher/watcher.js +33 -6
package/package.json
CHANGED
package/src/watcher/watcher.js
CHANGED
|
@@ -39,9 +39,37 @@ async function resolveProjectPath(encoded) {
|
|
|
39
39
|
let s = encoded;
|
|
40
40
|
if (s.startsWith('-')) s = s.slice(1);
|
|
41
41
|
if (!s) return '';
|
|
42
|
-
const parts = s.split('-');
|
|
43
42
|
|
|
44
|
-
//
|
|
43
|
+
// Claude path encoding: '/' → '-', '.' → '-' (extra dash)
|
|
44
|
+
// So '--' = '/.' (path separator + dot/hidden dir like .claude)
|
|
45
|
+
// Correct decode: '--' → '/.', then '-' → '/'
|
|
46
|
+
const directDecoded = s.replace(/--/g, '/.').replace(/-/g, '/');
|
|
47
|
+
|
|
48
|
+
// Strategy 1: try direct decoded path on disk (handles dots correctly)
|
|
49
|
+
try {
|
|
50
|
+
await fsp.access('/' + directDecoded);
|
|
51
|
+
_projectPathCache.set(encoded, directDecoded);
|
|
52
|
+
return directDecoded;
|
|
53
|
+
} catch {}
|
|
54
|
+
|
|
55
|
+
// Strategy 2: progressive join for directory names containing dashes
|
|
56
|
+
// First, merge '--' empty elements with the next element as dot-prefix directories
|
|
57
|
+
const rawParts = s.split('-');
|
|
58
|
+
const parts = [];
|
|
59
|
+
for (let i = 0; i < rawParts.length; i++) {
|
|
60
|
+
if (rawParts[i] === '') {
|
|
61
|
+
// Empty element from '--': combine with next as dot-prefix dir (e.g. ".claude")
|
|
62
|
+
if (i + 1 < rawParts.length) {
|
|
63
|
+
parts.push('.' + rawParts[i + 1]);
|
|
64
|
+
i++;
|
|
65
|
+
} else {
|
|
66
|
+
parts.push('.');
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
parts.push(rawParts[i]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
45
73
|
for (let joinFrom = parts.length - 1; joinFrom >= 1; joinFrom--) {
|
|
46
74
|
const pathPart = parts.slice(0, joinFrom).join('/');
|
|
47
75
|
const dirPart = parts.slice(joinFrom).join('-');
|
|
@@ -56,10 +84,9 @@ async function resolveProjectPath(encoded) {
|
|
|
56
84
|
}
|
|
57
85
|
}
|
|
58
86
|
|
|
59
|
-
// Fallback
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return result;
|
|
87
|
+
// Fallback: return direct decoded path (correct even if path no longer exists on disk)
|
|
88
|
+
_projectPathCache.set(encoded, directDecoded);
|
|
89
|
+
return directDecoded;
|
|
63
90
|
}
|
|
64
91
|
|
|
65
92
|
function isMainSessionFile(filePath, stats) {
|