@hasnaxyz/hook-checktasks 1.0.3 → 1.0.4
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 +8 -16
- package/dist/hook.js +8 -16
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -148,32 +148,24 @@ function run() {
|
|
|
148
148
|
sessionName = getSessionName(hookInput.transcript_path);
|
|
149
149
|
}
|
|
150
150
|
const keywords = config.keywords || ["dev"];
|
|
151
|
-
const
|
|
152
|
-
if (!name)
|
|
153
|
-
return false;
|
|
151
|
+
const sessionMatchesKeywords = () => {
|
|
154
152
|
if (keywords.length === 0)
|
|
155
153
|
return true;
|
|
156
|
-
|
|
154
|
+
if (!sessionName)
|
|
155
|
+
return false;
|
|
156
|
+
return keywords.some((keyword) => sessionName.toLowerCase().includes(keyword.toLowerCase()));
|
|
157
157
|
};
|
|
158
|
+
if (!sessionMatchesKeywords()) {
|
|
159
|
+
approve();
|
|
160
|
+
}
|
|
158
161
|
let listsToCheck = [];
|
|
159
162
|
if (config.taskListId) {
|
|
160
|
-
const taskListMatches = matchesKeywords(config.taskListId);
|
|
161
|
-
const sessionMatches = matchesKeywords(sessionName);
|
|
162
|
-
if (keywords.length > 0 && !taskListMatches && !sessionMatches) {
|
|
163
|
-
approve();
|
|
164
|
-
}
|
|
165
163
|
listsToCheck = [config.taskListId];
|
|
166
164
|
} else {
|
|
167
165
|
const projectLists = getProjectTaskLists(cwd);
|
|
168
166
|
if (projectLists.length > 0) {
|
|
169
167
|
if (keywords.length > 0) {
|
|
170
|
-
|
|
171
|
-
const matchingLists = projectLists.filter((list) => matchesKeywords(list));
|
|
172
|
-
if (sessionMatches || matchingLists.length > 0) {
|
|
173
|
-
listsToCheck = matchingLists.length > 0 ? matchingLists : projectLists;
|
|
174
|
-
} else {
|
|
175
|
-
approve();
|
|
176
|
-
}
|
|
168
|
+
listsToCheck = projectLists.filter((list) => keywords.some((keyword) => list.toLowerCase().includes(keyword.toLowerCase())));
|
|
177
169
|
} else {
|
|
178
170
|
listsToCheck = projectLists;
|
|
179
171
|
}
|
package/dist/hook.js
CHANGED
|
@@ -144,32 +144,24 @@ function run() {
|
|
|
144
144
|
sessionName = getSessionName(hookInput.transcript_path);
|
|
145
145
|
}
|
|
146
146
|
const keywords = config.keywords || ["dev"];
|
|
147
|
-
const
|
|
148
|
-
if (!name)
|
|
149
|
-
return false;
|
|
147
|
+
const sessionMatchesKeywords = () => {
|
|
150
148
|
if (keywords.length === 0)
|
|
151
149
|
return true;
|
|
152
|
-
|
|
150
|
+
if (!sessionName)
|
|
151
|
+
return false;
|
|
152
|
+
return keywords.some((keyword) => sessionName.toLowerCase().includes(keyword.toLowerCase()));
|
|
153
153
|
};
|
|
154
|
+
if (!sessionMatchesKeywords()) {
|
|
155
|
+
approve();
|
|
156
|
+
}
|
|
154
157
|
let listsToCheck = [];
|
|
155
158
|
if (config.taskListId) {
|
|
156
|
-
const taskListMatches = matchesKeywords(config.taskListId);
|
|
157
|
-
const sessionMatches = matchesKeywords(sessionName);
|
|
158
|
-
if (keywords.length > 0 && !taskListMatches && !sessionMatches) {
|
|
159
|
-
approve();
|
|
160
|
-
}
|
|
161
159
|
listsToCheck = [config.taskListId];
|
|
162
160
|
} else {
|
|
163
161
|
const projectLists = getProjectTaskLists(cwd);
|
|
164
162
|
if (projectLists.length > 0) {
|
|
165
163
|
if (keywords.length > 0) {
|
|
166
|
-
|
|
167
|
-
const matchingLists = projectLists.filter((list) => matchesKeywords(list));
|
|
168
|
-
if (sessionMatches || matchingLists.length > 0) {
|
|
169
|
-
listsToCheck = matchingLists.length > 0 ? matchingLists : projectLists;
|
|
170
|
-
} else {
|
|
171
|
-
approve();
|
|
172
|
-
}
|
|
164
|
+
listsToCheck = projectLists.filter((list) => keywords.some((keyword) => list.toLowerCase().includes(keyword.toLowerCase())));
|
|
173
165
|
} else {
|
|
174
166
|
listsToCheck = projectLists;
|
|
175
167
|
}
|