codeam-cli 1.4.16 → 1.4.17
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/index.js +22 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -115,7 +115,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
|
|
|
115
115
|
// package.json
|
|
116
116
|
var package_default = {
|
|
117
117
|
name: "codeam-cli",
|
|
118
|
-
version: "1.4.
|
|
118
|
+
version: "1.4.17",
|
|
119
119
|
description: "Remote control Claude Code from your mobile device",
|
|
120
120
|
main: "dist/index.js",
|
|
121
121
|
bin: {
|
|
@@ -1411,6 +1411,23 @@ var HistoryService = class {
|
|
|
1411
1411
|
setCurrentConversationId(id) {
|
|
1412
1412
|
this.currentConversationId = id;
|
|
1413
1413
|
}
|
|
1414
|
+
/** Detect the active conversation by finding the most recently modified JSONL file */
|
|
1415
|
+
detectCurrentConversation() {
|
|
1416
|
+
const dir = this.projectDir;
|
|
1417
|
+
try {
|
|
1418
|
+
const files = fs4.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
1419
|
+
try {
|
|
1420
|
+
return { name: e.name, mtime: fs4.statSync(path4.join(dir, e.name)).mtimeMs };
|
|
1421
|
+
} catch {
|
|
1422
|
+
return { name: e.name, mtime: 0 };
|
|
1423
|
+
}
|
|
1424
|
+
}).sort((a, b) => b.mtime - a.mtime);
|
|
1425
|
+
if (files.length > 0) {
|
|
1426
|
+
this.currentConversationId = path4.basename(files[0].name, ".jsonl");
|
|
1427
|
+
}
|
|
1428
|
+
} catch {
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1414
1431
|
/** Extract conversation ID from Claude output (e.g., from session resume messages) */
|
|
1415
1432
|
tryExtractConversationIdFromOutput(output) {
|
|
1416
1433
|
const patterns = [
|
|
@@ -1450,17 +1467,9 @@ var HistoryService = class {
|
|
|
1450
1467
|
}
|
|
1451
1468
|
}).sort((a, b) => b.mtime - a.mtime);
|
|
1452
1469
|
if (files.length === 0) return null;
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
return this.extractUsageFromFile(path4.join(dir, conversationFile));
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
for (const file of files) {
|
|
1460
|
-
const result = this.extractUsageFromFile(path4.join(dir, file.name));
|
|
1461
|
-
if (result) return result;
|
|
1462
|
-
}
|
|
1463
|
-
return null;
|
|
1470
|
+
const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
|
|
1471
|
+
if (!files.some((f) => f.name === targetFile)) return null;
|
|
1472
|
+
return this.extractUsageFromFile(path4.join(dir, targetFile));
|
|
1464
1473
|
}
|
|
1465
1474
|
extractUsageFromFile(filePath) {
|
|
1466
1475
|
let raw;
|
|
@@ -1785,6 +1794,7 @@ async function start() {
|
|
|
1785
1794
|
process.once("SIGINT", sigintHandler);
|
|
1786
1795
|
claude.spawn();
|
|
1787
1796
|
setTimeout(() => {
|
|
1797
|
+
historySvc.detectCurrentConversation();
|
|
1788
1798
|
historySvc.load().catch(() => {
|
|
1789
1799
|
});
|
|
1790
1800
|
}, 2e3);
|