@hasnaxyz/hook-checktasks 1.0.4 → 1.0.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/cli.js CHANGED
@@ -59,8 +59,7 @@ function getSessionName(transcriptPath) {
59
59
  return null;
60
60
  try {
61
61
  const content = readFileSync(transcriptPath, "utf-8");
62
- let customTitle = null;
63
- let slug = null;
62
+ let lastTitle = null;
64
63
  let searchStart = 0;
65
64
  while (true) {
66
65
  const titleIndex = content.indexOf('"custom-title"', searchStart);
@@ -74,18 +73,12 @@ function getSessionName(transcriptPath) {
74
73
  try {
75
74
  const entry = JSON.parse(line);
76
75
  if (entry.type === "custom-title" && entry.customTitle) {
77
- customTitle = entry.customTitle;
76
+ lastTitle = entry.customTitle;
78
77
  }
79
78
  } catch {}
80
79
  searchStart = titleIndex + 1;
81
80
  }
82
- if (!customTitle) {
83
- const slugMatch = content.match(/"slug"\s*:\s*"([^"]+)"/);
84
- if (slugMatch) {
85
- slug = slugMatch[1];
86
- }
87
- }
88
- return customTitle || slug;
81
+ return lastTitle;
89
82
  } catch {
90
83
  return null;
91
84
  }
@@ -147,15 +140,10 @@ function run() {
147
140
  if (hookInput?.transcript_path) {
148
141
  sessionName = getSessionName(hookInput.transcript_path);
149
142
  }
143
+ const nameToCheck = sessionName || config.taskListId || "";
150
144
  const keywords = config.keywords || ["dev"];
151
- const sessionMatchesKeywords = () => {
152
- if (keywords.length === 0)
153
- return true;
154
- if (!sessionName)
155
- return false;
156
- return keywords.some((keyword) => sessionName.toLowerCase().includes(keyword.toLowerCase()));
157
- };
158
- if (!sessionMatchesKeywords()) {
145
+ const matchesKeyword = keywords.some((keyword) => nameToCheck.toLowerCase().includes(keyword.toLowerCase()));
146
+ if (!matchesKeyword && keywords.length > 0 && nameToCheck) {
159
147
  approve();
160
148
  }
161
149
  let listsToCheck = [];
package/dist/hook.js CHANGED
@@ -55,8 +55,7 @@ function getSessionName(transcriptPath) {
55
55
  return null;
56
56
  try {
57
57
  const content = readFileSync(transcriptPath, "utf-8");
58
- let customTitle = null;
59
- let slug = null;
58
+ let lastTitle = null;
60
59
  let searchStart = 0;
61
60
  while (true) {
62
61
  const titleIndex = content.indexOf('"custom-title"', searchStart);
@@ -70,18 +69,12 @@ function getSessionName(transcriptPath) {
70
69
  try {
71
70
  const entry = JSON.parse(line);
72
71
  if (entry.type === "custom-title" && entry.customTitle) {
73
- customTitle = entry.customTitle;
72
+ lastTitle = entry.customTitle;
74
73
  }
75
74
  } catch {}
76
75
  searchStart = titleIndex + 1;
77
76
  }
78
- if (!customTitle) {
79
- const slugMatch = content.match(/"slug"\s*:\s*"([^"]+)"/);
80
- if (slugMatch) {
81
- slug = slugMatch[1];
82
- }
83
- }
84
- return customTitle || slug;
77
+ return lastTitle;
85
78
  } catch {
86
79
  return null;
87
80
  }
@@ -143,15 +136,10 @@ function run() {
143
136
  if (hookInput?.transcript_path) {
144
137
  sessionName = getSessionName(hookInput.transcript_path);
145
138
  }
139
+ const nameToCheck = sessionName || config.taskListId || "";
146
140
  const keywords = config.keywords || ["dev"];
147
- const sessionMatchesKeywords = () => {
148
- if (keywords.length === 0)
149
- return true;
150
- if (!sessionName)
151
- return false;
152
- return keywords.some((keyword) => sessionName.toLowerCase().includes(keyword.toLowerCase()));
153
- };
154
- if (!sessionMatchesKeywords()) {
141
+ const matchesKeyword = keywords.some((keyword) => nameToCheck.toLowerCase().includes(keyword.toLowerCase()));
142
+ if (!matchesKeyword && keywords.length > 0 && nameToCheck) {
155
143
  approve();
156
144
  }
157
145
  let listsToCheck = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasnaxyz/hook-checktasks",
3
- "version": "1.0.4",
3
+ "version": "1.0.7",
4
4
  "description": "Claude Code hook that prevents stopping when there are pending tasks",
5
5
  "type": "module",
6
6
  "bin": {