@hasnaxyz/hook-checktasks 0.2.1 → 0.2.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 +28 -12
- package/dist/hook.js +22 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -83,7 +83,7 @@ function getSessionName(transcriptPath) {
|
|
|
83
83
|
return null;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function getAllTaskLists() {
|
|
87
87
|
const tasksDir = join(homedir(), ".claude", "tasks");
|
|
88
88
|
if (!existsSync(tasksDir))
|
|
89
89
|
return [];
|
|
@@ -93,6 +93,20 @@ function getTaskLists() {
|
|
|
93
93
|
return [];
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
function getProjectTaskLists(cwd) {
|
|
97
|
+
const allLists = getAllTaskLists();
|
|
98
|
+
const dirName = cwd.split("/").filter(Boolean).pop() || "";
|
|
99
|
+
const projectLists = allLists.filter((list) => {
|
|
100
|
+
const listLower = list.toLowerCase();
|
|
101
|
+
const dirLower = dirName.toLowerCase();
|
|
102
|
+
if (listLower.startsWith(dirLower + "-"))
|
|
103
|
+
return true;
|
|
104
|
+
if (listLower === dirLower)
|
|
105
|
+
return true;
|
|
106
|
+
return false;
|
|
107
|
+
});
|
|
108
|
+
return projectLists;
|
|
109
|
+
}
|
|
96
110
|
function getTasksFromList(listId) {
|
|
97
111
|
const tasksDir = join(homedir(), ".claude", "tasks", listId);
|
|
98
112
|
if (!existsSync(tasksDir))
|
|
@@ -136,11 +150,13 @@ function run() {
|
|
|
136
150
|
if (config.taskListId) {
|
|
137
151
|
listsToCheck = [config.taskListId];
|
|
138
152
|
} else {
|
|
139
|
-
const
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
153
|
+
const projectLists = getProjectTaskLists(cwd);
|
|
154
|
+
if (projectLists.length > 0) {
|
|
155
|
+
if (keywords.length > 0) {
|
|
156
|
+
listsToCheck = projectLists.filter((list) => keywords.some((keyword) => list.toLowerCase().includes(keyword.toLowerCase())));
|
|
157
|
+
} else {
|
|
158
|
+
listsToCheck = projectLists;
|
|
159
|
+
}
|
|
144
160
|
}
|
|
145
161
|
}
|
|
146
162
|
if (listsToCheck.length === 0) {
|
|
@@ -325,7 +341,7 @@ async function prompt(question) {
|
|
|
325
341
|
});
|
|
326
342
|
});
|
|
327
343
|
}
|
|
328
|
-
function
|
|
344
|
+
function getAllTaskLists2() {
|
|
329
345
|
const tasksDir = join2(homedir2(), ".claude", "tasks");
|
|
330
346
|
if (!existsSync2(tasksDir))
|
|
331
347
|
return [];
|
|
@@ -335,8 +351,8 @@ function getAllTaskLists() {
|
|
|
335
351
|
return [];
|
|
336
352
|
}
|
|
337
353
|
}
|
|
338
|
-
function
|
|
339
|
-
const allLists =
|
|
354
|
+
function getProjectTaskLists2(projectPath) {
|
|
355
|
+
const allLists = getAllTaskLists2();
|
|
340
356
|
const dirName = projectPath.split("/").filter(Boolean).pop() || "";
|
|
341
357
|
const projectLists = allLists.filter((list) => {
|
|
342
358
|
const listLower = list.toLowerCase();
|
|
@@ -400,7 +416,7 @@ async function resolveTarget(args) {
|
|
|
400
416
|
}
|
|
401
417
|
async function promptForConfig(existingConfig = {}, projectPath) {
|
|
402
418
|
const config = { ...existingConfig };
|
|
403
|
-
const availableLists = projectPath ?
|
|
419
|
+
const availableLists = projectPath ? getProjectTaskLists2(projectPath) : getAllTaskLists2();
|
|
404
420
|
console.log(`
|
|
405
421
|
${c.bold("Configuration")}
|
|
406
422
|
`);
|
|
@@ -545,13 +561,13 @@ ${c.bold("hook-checktasks status")}
|
|
|
545
561
|
} else {
|
|
546
562
|
console.log(c.dim("\xB7"), "Project:", c.dim("No .claude/settings.json"));
|
|
547
563
|
}
|
|
548
|
-
const projectLists =
|
|
564
|
+
const projectLists = getProjectTaskLists2(cwd);
|
|
549
565
|
if (projectLists.length > 0) {
|
|
550
566
|
console.log();
|
|
551
567
|
console.log(c.bold("Task lists for this project:"));
|
|
552
568
|
projectLists.forEach((list) => console.log(c.dim(` - ${list}`)));
|
|
553
569
|
} else {
|
|
554
|
-
const allLists =
|
|
570
|
+
const allLists = getAllTaskLists2();
|
|
555
571
|
if (allLists.length > 0) {
|
|
556
572
|
console.log();
|
|
557
573
|
console.log(c.bold("All task lists:"), c.dim("(none match this project)"));
|
package/dist/hook.js
CHANGED
|
@@ -79,7 +79,7 @@ function getSessionName(transcriptPath) {
|
|
|
79
79
|
return null;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function getAllTaskLists() {
|
|
83
83
|
const tasksDir = join(homedir(), ".claude", "tasks");
|
|
84
84
|
if (!existsSync(tasksDir))
|
|
85
85
|
return [];
|
|
@@ -89,6 +89,20 @@ function getTaskLists() {
|
|
|
89
89
|
return [];
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
+
function getProjectTaskLists(cwd) {
|
|
93
|
+
const allLists = getAllTaskLists();
|
|
94
|
+
const dirName = cwd.split("/").filter(Boolean).pop() || "";
|
|
95
|
+
const projectLists = allLists.filter((list) => {
|
|
96
|
+
const listLower = list.toLowerCase();
|
|
97
|
+
const dirLower = dirName.toLowerCase();
|
|
98
|
+
if (listLower.startsWith(dirLower + "-"))
|
|
99
|
+
return true;
|
|
100
|
+
if (listLower === dirLower)
|
|
101
|
+
return true;
|
|
102
|
+
return false;
|
|
103
|
+
});
|
|
104
|
+
return projectLists;
|
|
105
|
+
}
|
|
92
106
|
function getTasksFromList(listId) {
|
|
93
107
|
const tasksDir = join(homedir(), ".claude", "tasks", listId);
|
|
94
108
|
if (!existsSync(tasksDir))
|
|
@@ -132,11 +146,13 @@ function run() {
|
|
|
132
146
|
if (config.taskListId) {
|
|
133
147
|
listsToCheck = [config.taskListId];
|
|
134
148
|
} else {
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
149
|
+
const projectLists = getProjectTaskLists(cwd);
|
|
150
|
+
if (projectLists.length > 0) {
|
|
151
|
+
if (keywords.length > 0) {
|
|
152
|
+
listsToCheck = projectLists.filter((list) => keywords.some((keyword) => list.toLowerCase().includes(keyword.toLowerCase())));
|
|
153
|
+
} else {
|
|
154
|
+
listsToCheck = projectLists;
|
|
155
|
+
}
|
|
140
156
|
}
|
|
141
157
|
}
|
|
142
158
|
if (listsToCheck.length === 0) {
|