@hasnaxyz/hook-checktasks 1.0.6 → 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 +12 -20
- package/dist/hook.js +12 -19
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
+
import { createRequire } from "node:module";
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __export = (target, all) => {
|
|
5
6
|
for (var name in all)
|
|
@@ -11,6 +12,7 @@ var __export = (target, all) => {
|
|
|
11
12
|
});
|
|
12
13
|
};
|
|
13
14
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
15
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
14
16
|
|
|
15
17
|
// src/hook.ts
|
|
16
18
|
var exports_hook = {};
|
|
@@ -57,8 +59,7 @@ function getSessionName(transcriptPath) {
|
|
|
57
59
|
return null;
|
|
58
60
|
try {
|
|
59
61
|
const content = readFileSync(transcriptPath, "utf-8");
|
|
60
|
-
let
|
|
61
|
-
let slug = null;
|
|
62
|
+
let lastTitle = null;
|
|
62
63
|
let searchStart = 0;
|
|
63
64
|
while (true) {
|
|
64
65
|
const titleIndex = content.indexOf('"custom-title"', searchStart);
|
|
@@ -72,18 +73,12 @@ function getSessionName(transcriptPath) {
|
|
|
72
73
|
try {
|
|
73
74
|
const entry = JSON.parse(line);
|
|
74
75
|
if (entry.type === "custom-title" && entry.customTitle) {
|
|
75
|
-
|
|
76
|
+
lastTitle = entry.customTitle;
|
|
76
77
|
}
|
|
77
78
|
} catch {}
|
|
78
79
|
searchStart = titleIndex + 1;
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
-
const slugMatch = content.match(/"slug"\s*:\s*"([^"]+)"/);
|
|
82
|
-
if (slugMatch) {
|
|
83
|
-
slug = slugMatch[1];
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return customTitle || slug;
|
|
81
|
+
return lastTitle;
|
|
87
82
|
} catch {
|
|
88
83
|
return null;
|
|
89
84
|
}
|
|
@@ -145,15 +140,10 @@ function run() {
|
|
|
145
140
|
if (hookInput?.transcript_path) {
|
|
146
141
|
sessionName = getSessionName(hookInput.transcript_path);
|
|
147
142
|
}
|
|
143
|
+
const nameToCheck = sessionName || config.taskListId || "";
|
|
148
144
|
const keywords = config.keywords || ["dev"];
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
return true;
|
|
152
|
-
if (!sessionName)
|
|
153
|
-
return false;
|
|
154
|
-
return keywords.some((keyword) => sessionName.toLowerCase().includes(keyword.toLowerCase()));
|
|
155
|
-
};
|
|
156
|
-
if (!sessionMatchesKeywords()) {
|
|
145
|
+
const matchesKeyword = keywords.some((keyword) => nameToCheck.toLowerCase().includes(keyword.toLowerCase()));
|
|
146
|
+
if (!matchesKeyword && keywords.length > 0 && nameToCheck) {
|
|
157
147
|
approve();
|
|
158
148
|
}
|
|
159
149
|
let listsToCheck = [];
|
|
@@ -196,7 +186,7 @@ function run() {
|
|
|
196
186
|
const prompt = `
|
|
197
187
|
STOP BLOCKED: You have ${remainingCount} tasks remaining${listInfo} (${allPending.length} pending, ${allInProgress.length} in progress, ${allCompleted.length} completed).
|
|
198
188
|
|
|
199
|
-
DO NOT STOP. DO NOT ASK QUESTIONS. DO NOT WAIT FOR USER INPUT.
|
|
189
|
+
⛔ DO NOT STOP. DO NOT ASK QUESTIONS. DO NOT WAIT FOR USER INPUT.
|
|
200
190
|
|
|
201
191
|
You MUST continue working AUTONOMOUSLY until ALL tasks are completed.
|
|
202
192
|
|
|
@@ -227,7 +217,9 @@ START WORKING NOW. Use TaskList tool in your next response.
|
|
|
227
217
|
approve();
|
|
228
218
|
}
|
|
229
219
|
var CONFIG_KEY = "checkTasksConfig";
|
|
230
|
-
var init_hook = () => {
|
|
220
|
+
var init_hook = __esm(() => {
|
|
221
|
+
if (false) {}
|
|
222
|
+
});
|
|
231
223
|
|
|
232
224
|
// src/cli.ts
|
|
233
225
|
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync, mkdirSync, readdirSync as readdirSync2 } from "fs";
|
package/dist/hook.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __export = (target, all) => {
|
|
4
5
|
for (var name in all)
|
|
@@ -10,6 +11,7 @@ var __export = (target, all) => {
|
|
|
10
11
|
});
|
|
11
12
|
};
|
|
12
13
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
14
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
13
15
|
|
|
14
16
|
// src/hook.ts
|
|
15
17
|
import { readdirSync, readFileSync, existsSync } from "fs";
|
|
@@ -53,8 +55,7 @@ function getSessionName(transcriptPath) {
|
|
|
53
55
|
return null;
|
|
54
56
|
try {
|
|
55
57
|
const content = readFileSync(transcriptPath, "utf-8");
|
|
56
|
-
let
|
|
57
|
-
let slug = null;
|
|
58
|
+
let lastTitle = null;
|
|
58
59
|
let searchStart = 0;
|
|
59
60
|
while (true) {
|
|
60
61
|
const titleIndex = content.indexOf('"custom-title"', searchStart);
|
|
@@ -68,18 +69,12 @@ function getSessionName(transcriptPath) {
|
|
|
68
69
|
try {
|
|
69
70
|
const entry = JSON.parse(line);
|
|
70
71
|
if (entry.type === "custom-title" && entry.customTitle) {
|
|
71
|
-
|
|
72
|
+
lastTitle = entry.customTitle;
|
|
72
73
|
}
|
|
73
74
|
} catch {}
|
|
74
75
|
searchStart = titleIndex + 1;
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
-
const slugMatch = content.match(/"slug"\s*:\s*"([^"]+)"/);
|
|
78
|
-
if (slugMatch) {
|
|
79
|
-
slug = slugMatch[1];
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return customTitle || slug;
|
|
77
|
+
return lastTitle;
|
|
83
78
|
} catch {
|
|
84
79
|
return null;
|
|
85
80
|
}
|
|
@@ -141,15 +136,10 @@ function run() {
|
|
|
141
136
|
if (hookInput?.transcript_path) {
|
|
142
137
|
sessionName = getSessionName(hookInput.transcript_path);
|
|
143
138
|
}
|
|
139
|
+
const nameToCheck = sessionName || config.taskListId || "";
|
|
144
140
|
const keywords = config.keywords || ["dev"];
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
return true;
|
|
148
|
-
if (!sessionName)
|
|
149
|
-
return false;
|
|
150
|
-
return keywords.some((keyword) => sessionName.toLowerCase().includes(keyword.toLowerCase()));
|
|
151
|
-
};
|
|
152
|
-
if (!sessionMatchesKeywords()) {
|
|
141
|
+
const matchesKeyword = keywords.some((keyword) => nameToCheck.toLowerCase().includes(keyword.toLowerCase()));
|
|
142
|
+
if (!matchesKeyword && keywords.length > 0 && nameToCheck) {
|
|
153
143
|
approve();
|
|
154
144
|
}
|
|
155
145
|
let listsToCheck = [];
|
|
@@ -192,7 +182,7 @@ function run() {
|
|
|
192
182
|
const prompt = `
|
|
193
183
|
STOP BLOCKED: You have ${remainingCount} tasks remaining${listInfo} (${allPending.length} pending, ${allInProgress.length} in progress, ${allCompleted.length} completed).
|
|
194
184
|
|
|
195
|
-
DO NOT STOP. DO NOT ASK QUESTIONS. DO NOT WAIT FOR USER INPUT.
|
|
185
|
+
⛔ DO NOT STOP. DO NOT ASK QUESTIONS. DO NOT WAIT FOR USER INPUT.
|
|
196
186
|
|
|
197
187
|
You MUST continue working AUTONOMOUSLY until ALL tasks are completed.
|
|
198
188
|
|
|
@@ -222,6 +212,9 @@ START WORKING NOW. Use TaskList tool in your next response.
|
|
|
222
212
|
}
|
|
223
213
|
approve();
|
|
224
214
|
}
|
|
215
|
+
if (__require.main == __require.module) {
|
|
216
|
+
run();
|
|
217
|
+
}
|
|
225
218
|
export {
|
|
226
219
|
run
|
|
227
220
|
};
|