ccakashic 0.2.6 → 0.2.7
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/dist/bin/ccakashic.js +3 -3
- package/dist/discover.js +12 -3
- package/package.json +1 -1
package/dist/bin/ccakashic.js
CHANGED
|
@@ -64,7 +64,7 @@ const server = http.createServer(async (req, res) => {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
if (pathname === '/' || pathname === '') {
|
|
67
|
-
const projects = (0, discover_1.listProjects)();
|
|
67
|
+
const projects = await (0, discover_1.listProjects)();
|
|
68
68
|
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
69
69
|
res.end((0, pages_1.generateIndex)(projects));
|
|
70
70
|
return;
|
|
@@ -72,7 +72,7 @@ const server = http.createServer(async (req, res) => {
|
|
|
72
72
|
const projectMatch = pathname.match(/^\/project\/(.+)$/);
|
|
73
73
|
if (projectMatch && !pathname.includes('/session/')) {
|
|
74
74
|
const rawName = decodeURIComponent(projectMatch[1]);
|
|
75
|
-
const projects = (0, discover_1.listProjects)();
|
|
75
|
+
const projects = await (0, discover_1.listProjects)();
|
|
76
76
|
const project = projects.find((p) => p.rawName === rawName);
|
|
77
77
|
if (!project) {
|
|
78
78
|
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
@@ -88,7 +88,7 @@ const server = http.createServer(async (req, res) => {
|
|
|
88
88
|
if (sessionMatch) {
|
|
89
89
|
const rawName = decodeURIComponent(sessionMatch[1]);
|
|
90
90
|
const sessionId = decodeURIComponent(sessionMatch[2]);
|
|
91
|
-
const projects = (0, discover_1.listProjects)();
|
|
91
|
+
const projects = await (0, discover_1.listProjects)();
|
|
92
92
|
const project = projects.find((p) => p.rawName === rawName);
|
|
93
93
|
if (!project) {
|
|
94
94
|
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
package/dist/discover.js
CHANGED
|
@@ -51,7 +51,7 @@ function decodeDirName(dirName) {
|
|
|
51
51
|
}
|
|
52
52
|
return dirName;
|
|
53
53
|
}
|
|
54
|
-
function listProjects() {
|
|
54
|
+
async function listProjects() {
|
|
55
55
|
if (!fs.existsSync(exports.CLAUDE_DIR)) {
|
|
56
56
|
return [];
|
|
57
57
|
}
|
|
@@ -70,8 +70,17 @@ function listProjects() {
|
|
|
70
70
|
if (stat.mtimeMs > lastModified)
|
|
71
71
|
lastModified = stat.mtimeMs;
|
|
72
72
|
}
|
|
73
|
+
// Prefer the real cwd recorded in the session over the lossy directory-name
|
|
74
|
+
// decoding (dots and slashes both collapse to dashes in the dir name).
|
|
75
|
+
let name = decodeDirName(entry.name);
|
|
76
|
+
const latest = latestSessionFile(projectDir);
|
|
77
|
+
if (latest) {
|
|
78
|
+
const cwd = await readCwdFromSession(path.join(projectDir, latest.file));
|
|
79
|
+
if (cwd)
|
|
80
|
+
name = cwd;
|
|
81
|
+
}
|
|
73
82
|
projects.push({
|
|
74
|
-
name
|
|
83
|
+
name,
|
|
75
84
|
rawName: entry.name,
|
|
76
85
|
dir: projectDir,
|
|
77
86
|
sessionCount: jsonlFiles.length,
|
|
@@ -207,7 +216,7 @@ async function findSessionForCwd(cwd) {
|
|
|
207
216
|
// Pick the project whose cwd is the most specific (longest) match for the
|
|
208
217
|
// given cwd. A brand-new session in a specific subdir should win over an
|
|
209
218
|
// older, more-active ancestor project.
|
|
210
|
-
const projects = listProjects();
|
|
219
|
+
const projects = await listProjects();
|
|
211
220
|
let bestMatch = null;
|
|
212
221
|
let bestLen = -1;
|
|
213
222
|
for (const project of projects) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccakashic",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Browse Claude Code session logs (~/.claude/projects/) as beautiful HTML in your browser — an Akashic Record of your Claude Code sessions",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ccakashic": "dist/bin/ccakashic.js"
|