@hasnaxyz/hook-checktasks 1.0.1 → 1.0.2
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/cli.js +10 -3
- package/dist/hook.js +10 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -59,7 +59,8 @@ function getSessionName(transcriptPath) {
|
|
|
59
59
|
return null;
|
|
60
60
|
try {
|
|
61
61
|
const content = readFileSync(transcriptPath, "utf-8");
|
|
62
|
-
let
|
|
62
|
+
let customTitle = null;
|
|
63
|
+
let slug = null;
|
|
63
64
|
let searchStart = 0;
|
|
64
65
|
while (true) {
|
|
65
66
|
const titleIndex = content.indexOf('"custom-title"', searchStart);
|
|
@@ -73,12 +74,18 @@ function getSessionName(transcriptPath) {
|
|
|
73
74
|
try {
|
|
74
75
|
const entry = JSON.parse(line);
|
|
75
76
|
if (entry.type === "custom-title" && entry.customTitle) {
|
|
76
|
-
|
|
77
|
+
customTitle = entry.customTitle;
|
|
77
78
|
}
|
|
78
79
|
} catch {}
|
|
79
80
|
searchStart = titleIndex + 1;
|
|
80
81
|
}
|
|
81
|
-
|
|
82
|
+
if (!customTitle) {
|
|
83
|
+
const slugMatch = content.match(/"slug"\s*:\s*"([^"]+)"/);
|
|
84
|
+
if (slugMatch) {
|
|
85
|
+
slug = slugMatch[1];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return customTitle || slug;
|
|
82
89
|
} catch {
|
|
83
90
|
return null;
|
|
84
91
|
}
|
package/dist/hook.js
CHANGED
|
@@ -55,7 +55,8 @@ function getSessionName(transcriptPath) {
|
|
|
55
55
|
return null;
|
|
56
56
|
try {
|
|
57
57
|
const content = readFileSync(transcriptPath, "utf-8");
|
|
58
|
-
let
|
|
58
|
+
let customTitle = null;
|
|
59
|
+
let slug = null;
|
|
59
60
|
let searchStart = 0;
|
|
60
61
|
while (true) {
|
|
61
62
|
const titleIndex = content.indexOf('"custom-title"', searchStart);
|
|
@@ -69,12 +70,18 @@ function getSessionName(transcriptPath) {
|
|
|
69
70
|
try {
|
|
70
71
|
const entry = JSON.parse(line);
|
|
71
72
|
if (entry.type === "custom-title" && entry.customTitle) {
|
|
72
|
-
|
|
73
|
+
customTitle = entry.customTitle;
|
|
73
74
|
}
|
|
74
75
|
} catch {}
|
|
75
76
|
searchStart = titleIndex + 1;
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
if (!customTitle) {
|
|
79
|
+
const slugMatch = content.match(/"slug"\s*:\s*"([^"]+)"/);
|
|
80
|
+
if (slugMatch) {
|
|
81
|
+
slug = slugMatch[1];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return customTitle || slug;
|
|
78
85
|
} catch {
|
|
79
86
|
return null;
|
|
80
87
|
}
|