@vectorize-io/hindsight-coding-agents 0.1.0 → 0.1.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/README.md +93 -28
- package/dist/antigravity-hook.js +129 -59
- package/dist/antigravity-statusline.js +3 -1
- package/dist/antigravity-stop-hook.js +241 -71
- package/dist/claude-hook.js +129 -59
- package/dist/claude-sessionstart-hook.js +133 -64
- package/dist/claude-stop-hook.js +241 -71
- package/dist/cline.js +155 -21
- package/dist/codex-hook.js +129 -59
- package/dist/codex-sessionstart-hook.js +133 -64
- package/dist/codex-stop-hook.js +241 -71
- package/dist/copilot-hook.js +129 -59
- package/dist/copilot-sessionstart-hook.js +133 -64
- package/dist/copilot-stop-hook.js +241 -71
- package/dist/cursor-hook.js +129 -59
- package/dist/cursor-sessionstart-hook.js +133 -64
- package/dist/cursor-stop-hook.js +241 -71
- package/dist/daemon-start.js +3 -1
- package/dist/deepen.js +61 -17
- package/dist/devin-hook.js +129 -59
- package/dist/devin-sessionstart-hook.js +133 -64
- package/dist/devin-stop-hook.js +241 -71
- package/dist/grok-hook.js +129 -59
- package/dist/grok-sessionstart-hook.js +133 -64
- package/dist/grok-stop-hook.js +241 -71
- package/dist/hindsight-seed.js +3 -1
- package/dist/index.js +166 -22
- package/dist/installer.js +103 -79
- package/dist/kilo.js +166 -22
- package/dist/mcp-server.js +54 -14
- package/dist/status.js +53 -13
- package/package.json +1 -1
- package/skill/SKILL.md +4 -4
package/dist/installer.js
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
existsSync as existsSync8,
|
|
9
9
|
mkdirSync as mkdirSync3,
|
|
10
10
|
mkdtempSync,
|
|
11
|
-
readFileSync as
|
|
12
|
-
readSync as
|
|
11
|
+
readFileSync as readFileSync10,
|
|
12
|
+
readSync as readSync4,
|
|
13
13
|
realpathSync,
|
|
14
14
|
rmSync,
|
|
15
15
|
writeFileSync as writeFileSync2
|
|
@@ -106,7 +106,13 @@ import { tmpdir as tmpdir2 } from "os";
|
|
|
106
106
|
import { dirname as dirname4, join as join5 } from "path";
|
|
107
107
|
|
|
108
108
|
// src/core/retain-hook.ts
|
|
109
|
-
import { readFileSync as
|
|
109
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
110
|
+
|
|
111
|
+
// src/core/retain-cursor.ts
|
|
112
|
+
import { createHash } from "crypto";
|
|
113
|
+
|
|
114
|
+
// src/core/uuid.ts
|
|
115
|
+
import { createHash as createHash2 } from "crypto";
|
|
110
116
|
|
|
111
117
|
// src/core/daemon.ts
|
|
112
118
|
import { execFileSync as execFileSync2, spawn as realSpawn2 } from "child_process";
|
|
@@ -162,8 +168,66 @@ function onPath(bin) {
|
|
|
162
168
|
}
|
|
163
169
|
}
|
|
164
170
|
|
|
165
|
-
// src/core/
|
|
166
|
-
import {
|
|
171
|
+
// src/core/jsonl.ts
|
|
172
|
+
import { closeSync, openSync, readSync, statSync } from "fs";
|
|
173
|
+
import { StringDecoder } from "string_decoder";
|
|
174
|
+
var CHUNK_BYTES = 64 * 1024;
|
|
175
|
+
var MAX_TRANSCRIPT_BYTES = 32 * 1024 * 1024;
|
|
176
|
+
function readJsonlTail(path, opts) {
|
|
177
|
+
const maxBytes = opts.maxBytes ?? MAX_TRANSCRIPT_BYTES;
|
|
178
|
+
let size;
|
|
179
|
+
try {
|
|
180
|
+
size = statSync(path).size;
|
|
181
|
+
} catch {
|
|
182
|
+
return { lines: emptyLines(), skippedBytes: 0 };
|
|
183
|
+
}
|
|
184
|
+
const skippedBytes = size > maxBytes ? size - maxBytes : 0;
|
|
185
|
+
if (skippedBytes > 0) {
|
|
186
|
+
log.warn(opts.scope, "transcript too large \u2014 retaining the most recent portion only", {
|
|
187
|
+
path,
|
|
188
|
+
sizeBytes: size,
|
|
189
|
+
skippedBytes
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return { lines: streamLines(path, skippedBytes), skippedBytes };
|
|
193
|
+
}
|
|
194
|
+
function* emptyLines() {
|
|
195
|
+
}
|
|
196
|
+
function* streamLines(path, start) {
|
|
197
|
+
let fd;
|
|
198
|
+
try {
|
|
199
|
+
fd = openSync(path, "r");
|
|
200
|
+
} catch {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
const buffer = Buffer.allocUnsafe(CHUNK_BYTES);
|
|
205
|
+
const decoder = new StringDecoder("utf8");
|
|
206
|
+
let pending = "";
|
|
207
|
+
let position = start > 0 ? start - 1 : 0;
|
|
208
|
+
let dropPartial = start > 0;
|
|
209
|
+
for (; ; ) {
|
|
210
|
+
const bytesRead = readSync(fd, buffer, 0, buffer.length, position);
|
|
211
|
+
if (bytesRead <= 0) break;
|
|
212
|
+
position += bytesRead;
|
|
213
|
+
pending += decoder.write(buffer.subarray(0, bytesRead));
|
|
214
|
+
let newline;
|
|
215
|
+
while ((newline = pending.indexOf("\n")) !== -1) {
|
|
216
|
+
const line = pending.slice(0, newline);
|
|
217
|
+
pending = pending.slice(newline + 1);
|
|
218
|
+
if (dropPartial) {
|
|
219
|
+
dropPartial = false;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
yield line;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
pending += decoder.end();
|
|
226
|
+
if (pending && !dropPartial) yield pending;
|
|
227
|
+
} finally {
|
|
228
|
+
closeSync(fd);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
167
231
|
|
|
168
232
|
// src/core/transcript-util.ts
|
|
169
233
|
var MEMORY_TAG_RE = /<(hook_prompt|hindsight_memory|hindsight_memories|hindsight_bank|relevant_memories|user_feedback|hindsight_knowledge|hindsight_knowledge_refresh)\b[\s\S]*?<\/\1>/g;
|
|
@@ -225,14 +289,8 @@ function renderLine(content, type) {
|
|
|
225
289
|
return out;
|
|
226
290
|
}
|
|
227
291
|
function readClaudeTranscript(path) {
|
|
228
|
-
let raw;
|
|
229
|
-
try {
|
|
230
|
-
raw = readFileSync4(path, "utf8");
|
|
231
|
-
} catch {
|
|
232
|
-
return [];
|
|
233
|
-
}
|
|
234
292
|
const turns = [];
|
|
235
|
-
for (const rawLine of
|
|
293
|
+
for (const rawLine of readJsonlTail(path, { scope: "claude-code" }).lines) {
|
|
236
294
|
const trimmed = rawLine.trim();
|
|
237
295
|
if (!trimmed) continue;
|
|
238
296
|
let parsed;
|
|
@@ -257,7 +315,7 @@ function readClaudeTranscript(path) {
|
|
|
257
315
|
}
|
|
258
316
|
|
|
259
317
|
// src/core/session-start.ts
|
|
260
|
-
import { readFileSync as
|
|
318
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
261
319
|
|
|
262
320
|
// src/core/git.ts
|
|
263
321
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
@@ -274,13 +332,12 @@ import { delimiter, dirname as dirname6, join as join7 } from "path";
|
|
|
274
332
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
275
333
|
|
|
276
334
|
// src/core/skill-sync.ts
|
|
277
|
-
import { cpSync, existsSync as existsSync3, readFileSync as
|
|
335
|
+
import { cpSync, existsSync as existsSync3, readFileSync as readFileSync5 } from "fs";
|
|
278
336
|
import { homedir as homedir4 } from "os";
|
|
279
337
|
import { dirname as dirname7, join as join8 } from "path";
|
|
280
338
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
281
339
|
|
|
282
340
|
// src/core/transcript-codex.ts
|
|
283
|
-
import { readFileSync as readFileSync8 } from "fs";
|
|
284
341
|
function isSyntheticUserText(text) {
|
|
285
342
|
const s = text.trimStart();
|
|
286
343
|
return s.startsWith("# AGENTS.md instructions for ") || s.startsWith("<environment_context>");
|
|
@@ -289,14 +346,8 @@ function messageText(payload) {
|
|
|
289
346
|
return (payload.content || []).filter((c) => c && typeof c.text === "string").map((c) => c.text).join("\n");
|
|
290
347
|
}
|
|
291
348
|
function readCodexTranscript(path) {
|
|
292
|
-
let raw;
|
|
293
|
-
try {
|
|
294
|
-
raw = readFileSync8(path, "utf8");
|
|
295
|
-
} catch {
|
|
296
|
-
return [];
|
|
297
|
-
}
|
|
298
349
|
const turns = [];
|
|
299
|
-
for (const rawLine of
|
|
350
|
+
for (const rawLine of readJsonlTail(path, { scope: "codex" }).lines) {
|
|
300
351
|
const trimmed = rawLine.trim();
|
|
301
352
|
if (!trimmed) continue;
|
|
302
353
|
let parsed;
|
|
@@ -330,7 +381,6 @@ function readCodexTranscript(path) {
|
|
|
330
381
|
}
|
|
331
382
|
|
|
332
383
|
// src/core/transcript-cursor.ts
|
|
333
|
-
import { readFileSync as readFileSync9 } from "fs";
|
|
334
384
|
function withTimestamp(turn, timestamp) {
|
|
335
385
|
return timestamp ? { ...turn, timestamp } : turn;
|
|
336
386
|
}
|
|
@@ -340,14 +390,8 @@ function textFrom(content) {
|
|
|
340
390
|
return content.filter((block) => block?.type === "text" && typeof block.text === "string").map((block) => block.text).join("\n");
|
|
341
391
|
}
|
|
342
392
|
function readCursorTranscript(path) {
|
|
343
|
-
let raw;
|
|
344
|
-
try {
|
|
345
|
-
raw = readFileSync9(path, "utf8");
|
|
346
|
-
} catch {
|
|
347
|
-
return [];
|
|
348
|
-
}
|
|
349
393
|
const turns = [];
|
|
350
|
-
for (const rawLine of
|
|
394
|
+
for (const rawLine of readJsonlTail(path, { scope: "cursor-cli" }).lines) {
|
|
351
395
|
let parsed;
|
|
352
396
|
try {
|
|
353
397
|
parsed = JSON.parse(rawLine);
|
|
@@ -383,17 +427,10 @@ function readCursorTranscript(path) {
|
|
|
383
427
|
}
|
|
384
428
|
|
|
385
429
|
// src/core/transcript-antigravity.ts
|
|
386
|
-
import { readFileSync as readFileSync10 } from "fs";
|
|
387
430
|
function readAntigravityTranscript(path) {
|
|
388
431
|
if (!path) return [];
|
|
389
|
-
let raw;
|
|
390
|
-
try {
|
|
391
|
-
raw = readFileSync10(path, "utf8");
|
|
392
|
-
} catch {
|
|
393
|
-
return [];
|
|
394
|
-
}
|
|
395
432
|
const turns = [];
|
|
396
|
-
for (const line of
|
|
433
|
+
for (const line of readJsonlTail(path, { scope: "antigravity-cli" }).lines) {
|
|
397
434
|
try {
|
|
398
435
|
const event = JSON.parse(line);
|
|
399
436
|
const role = event.role ?? event.message?.role ?? event.type;
|
|
@@ -414,16 +451,9 @@ function readAntigravityTranscript(path) {
|
|
|
414
451
|
}
|
|
415
452
|
|
|
416
453
|
// src/core/transcript-copilot.ts
|
|
417
|
-
import { readFileSync as readFileSync11 } from "fs";
|
|
418
454
|
function readCopilotTranscript(path) {
|
|
419
|
-
let raw;
|
|
420
|
-
try {
|
|
421
|
-
raw = readFileSync11(path, "utf8");
|
|
422
|
-
} catch {
|
|
423
|
-
return [];
|
|
424
|
-
}
|
|
425
455
|
const turns = [];
|
|
426
|
-
for (const rawLine of
|
|
456
|
+
for (const rawLine of readJsonlTail(path, { scope: "copilot-cli" }).lines) {
|
|
427
457
|
try {
|
|
428
458
|
const event = JSON.parse(rawLine);
|
|
429
459
|
const role = event.type === "user.message" ? "user" : event.type === "assistant.message" ? "assistant" : void 0;
|
|
@@ -437,7 +467,7 @@ function readCopilotTranscript(path) {
|
|
|
437
467
|
}
|
|
438
468
|
|
|
439
469
|
// src/core/transcript-grok.ts
|
|
440
|
-
import { existsSync as existsSync4, readFileSync as
|
|
470
|
+
import { existsSync as existsSync4, readFileSync as readFileSync7, readdirSync } from "fs";
|
|
441
471
|
import { homedir as homedir5 } from "os";
|
|
442
472
|
import { join as join9 } from "path";
|
|
443
473
|
var CHAT_HISTORY = "chat_history.jsonl";
|
|
@@ -448,7 +478,7 @@ function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME ||
|
|
|
448
478
|
try {
|
|
449
479
|
for (const candidate of readdirSync(sessionsDir)) {
|
|
450
480
|
const directory = join9(sessionsDir, candidate);
|
|
451
|
-
if (
|
|
481
|
+
if (readFileSync7(join9(directory, ".cwd"), "utf8").trim() === cwd) {
|
|
452
482
|
return join9(directory, sessionId, CHAT_HISTORY);
|
|
453
483
|
}
|
|
454
484
|
}
|
|
@@ -457,14 +487,8 @@ function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME ||
|
|
|
457
487
|
return direct;
|
|
458
488
|
}
|
|
459
489
|
function readGrokTranscript(path) {
|
|
460
|
-
let raw;
|
|
461
|
-
try {
|
|
462
|
-
raw = readFileSync12(path, "utf8");
|
|
463
|
-
} catch {
|
|
464
|
-
return [];
|
|
465
|
-
}
|
|
466
490
|
const turns = [];
|
|
467
|
-
for (const rawLine of
|
|
491
|
+
for (const rawLine of readJsonlTail(path, { scope: "grok-build" }).lines) {
|
|
468
492
|
try {
|
|
469
493
|
const event = JSON.parse(rawLine);
|
|
470
494
|
if (event.type !== "user" && event.type !== "assistant") continue;
|
|
@@ -839,13 +863,13 @@ var HOOK_HARNESSES = {
|
|
|
839
863
|
|
|
840
864
|
// src/core/history.ts
|
|
841
865
|
import {
|
|
842
|
-
closeSync,
|
|
866
|
+
closeSync as closeSync2,
|
|
843
867
|
existsSync as existsSync6,
|
|
844
|
-
openSync,
|
|
868
|
+
openSync as openSync2,
|
|
845
869
|
readdirSync as readdirSync2,
|
|
846
|
-
readFileSync as
|
|
847
|
-
readSync,
|
|
848
|
-
statSync
|
|
870
|
+
readFileSync as readFileSync8,
|
|
871
|
+
readSync as readSync2,
|
|
872
|
+
statSync as statSync2
|
|
849
873
|
} from "fs";
|
|
850
874
|
import { homedir as homedir7 } from "os";
|
|
851
875
|
import { join as join11 } from "path";
|
|
@@ -857,7 +881,7 @@ function withinRepo(dir, repoDir) {
|
|
|
857
881
|
}
|
|
858
882
|
function claudeSessionCwd(file) {
|
|
859
883
|
try {
|
|
860
|
-
for (const line of
|
|
884
|
+
for (const line of readFileSync8(file, "utf8").split("\n", 400)) {
|
|
861
885
|
if (!line.includes('"cwd"')) continue;
|
|
862
886
|
const cwd = JSON.parse(line).cwd;
|
|
863
887
|
if (cwd) return cwd;
|
|
@@ -875,12 +899,12 @@ function toSession(id, turns) {
|
|
|
875
899
|
return prose.length ? { id, turns: prose } : void 0;
|
|
876
900
|
}
|
|
877
901
|
function firstLine(path, cap = 1e6) {
|
|
878
|
-
const fd =
|
|
902
|
+
const fd = openSync2(path, "r");
|
|
879
903
|
try {
|
|
880
904
|
const chunk = Buffer.alloc(64 * 1024);
|
|
881
905
|
let acc = "";
|
|
882
906
|
while (acc.length < cap) {
|
|
883
|
-
const n =
|
|
907
|
+
const n = readSync2(fd, chunk, 0, chunk.length, null);
|
|
884
908
|
if (n <= 0) break;
|
|
885
909
|
acc += chunk.subarray(0, n).toString("utf8");
|
|
886
910
|
const nl = acc.indexOf("\n");
|
|
@@ -888,7 +912,7 @@ function firstLine(path, cap = 1e6) {
|
|
|
888
912
|
}
|
|
889
913
|
return acc.length && acc.length < cap ? acc : void 0;
|
|
890
914
|
} finally {
|
|
891
|
-
|
|
915
|
+
closeSync2(fd);
|
|
892
916
|
}
|
|
893
917
|
}
|
|
894
918
|
function jsonlFiles(dir) {
|
|
@@ -925,7 +949,7 @@ function codexHistory(repoDir, home) {
|
|
|
925
949
|
const walk = (dir) => {
|
|
926
950
|
for (const entry of readdirSync2(dir)) {
|
|
927
951
|
const p = join11(dir, entry);
|
|
928
|
-
if (
|
|
952
|
+
if (statSync2(p).isDirectory()) walk(p);
|
|
929
953
|
else if (entry.endsWith(".jsonl")) files.push(p);
|
|
930
954
|
}
|
|
931
955
|
};
|
|
@@ -968,7 +992,7 @@ function importLocalHistory(harness, repoDir, home = homedir7()) {
|
|
|
968
992
|
}
|
|
969
993
|
|
|
970
994
|
// src/core/legacy.ts
|
|
971
|
-
import { existsSync as existsSync7, readFileSync as
|
|
995
|
+
import { existsSync as existsSync7, readFileSync as readFileSync9 } from "fs";
|
|
972
996
|
import { homedir as homedir8 } from "os";
|
|
973
997
|
import { join as join12 } from "path";
|
|
974
998
|
var LEGACY_CONFIG_FILES = {
|
|
@@ -994,7 +1018,7 @@ function readOne(harness, home) {
|
|
|
994
1018
|
if (!existsSync7(source)) return void 0;
|
|
995
1019
|
let raw;
|
|
996
1020
|
try {
|
|
997
|
-
raw = JSON.parse(
|
|
1021
|
+
raw = JSON.parse(readFileSync9(source, "utf8"));
|
|
998
1022
|
} catch {
|
|
999
1023
|
return void 0;
|
|
1000
1024
|
}
|
|
@@ -1022,7 +1046,7 @@ function readOne(harness, home) {
|
|
|
1022
1046
|
|
|
1023
1047
|
// src/install-ui.ts
|
|
1024
1048
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
1025
|
-
import { readSync as
|
|
1049
|
+
import { readSync as readSync3 } from "fs";
|
|
1026
1050
|
function fitSelectRow(label, hint, width) {
|
|
1027
1051
|
const room = Math.max(10, width - 6);
|
|
1028
1052
|
let hintText = hint ? ` \u2014 ${hint}` : "";
|
|
@@ -1148,7 +1172,7 @@ function createInstallerUi(o) {
|
|
|
1148
1172
|
for (; ; ) {
|
|
1149
1173
|
let n;
|
|
1150
1174
|
try {
|
|
1151
|
-
n =
|
|
1175
|
+
n = readSync3(0, buf, 0, buf.length, null);
|
|
1152
1176
|
} catch (e) {
|
|
1153
1177
|
if (e.code !== "EAGAIN") return null;
|
|
1154
1178
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 25);
|
|
@@ -1222,7 +1246,7 @@ function createInstallerUi(o) {
|
|
|
1222
1246
|
var MARKER = "coding-agents";
|
|
1223
1247
|
function readJson(path) {
|
|
1224
1248
|
try {
|
|
1225
|
-
return JSON.parse(
|
|
1249
|
+
return JSON.parse(readFileSync10(path, "utf8"));
|
|
1226
1250
|
} catch {
|
|
1227
1251
|
return {};
|
|
1228
1252
|
}
|
|
@@ -1341,7 +1365,7 @@ var kilo = {
|
|
|
1341
1365
|
const path = kiloConfigPath(c);
|
|
1342
1366
|
let cfg = {};
|
|
1343
1367
|
if (existsSync8(path)) {
|
|
1344
|
-
const parsed = parseJsonc(
|
|
1368
|
+
const parsed = parseJsonc(readFileSync10(path, "utf8"));
|
|
1345
1369
|
if (!parsed) {
|
|
1346
1370
|
c.log?.(`kilo: SKIPPED \u2014 could not parse ${path}; add the plugin entry manually`);
|
|
1347
1371
|
return;
|
|
@@ -1357,7 +1381,7 @@ var kilo = {
|
|
|
1357
1381
|
uninstall(c) {
|
|
1358
1382
|
const path = kiloConfigPath(c);
|
|
1359
1383
|
if (!existsSync8(path)) return;
|
|
1360
|
-
const cfg = parseJsonc(
|
|
1384
|
+
const cfg = parseJsonc(readFileSync10(path, "utf8"));
|
|
1361
1385
|
if (!cfg || !Array.isArray(cfg.plugin)) return;
|
|
1362
1386
|
cfg.plugin = cfg.plugin.filter((p) => !String(p).includes(MARKER));
|
|
1363
1387
|
if (!cfg.plugin.length) delete cfg.plugin;
|
|
@@ -1431,7 +1455,7 @@ var codex = {
|
|
|
1431
1455
|
writeJson(hooksPath, cfg);
|
|
1432
1456
|
c.log?.(`codex: hooks merged into ${hooksPath}`);
|
|
1433
1457
|
const tomlPath = join13(c.home, ".codex", "config.toml");
|
|
1434
|
-
let toml = existsSync8(tomlPath) ?
|
|
1458
|
+
let toml = existsSync8(tomlPath) ? readFileSync10(tomlPath, "utf8") : "";
|
|
1435
1459
|
const additions = [];
|
|
1436
1460
|
if (!/^\s*(codex_hooks|hooks)\s*=/m.test(toml)) {
|
|
1437
1461
|
if (/^\[features\]/m.test(toml)) {
|
|
@@ -1472,7 +1496,7 @@ args = ["${join13(c.dist, "mcp-server.js")}"]`
|
|
|
1472
1496
|
uninstallSkill(c, join13(c.home, ".agents", "skills"));
|
|
1473
1497
|
const tomlPath = join13(c.home, ".codex", "config.toml");
|
|
1474
1498
|
if (existsSync8(tomlPath)) {
|
|
1475
|
-
const toml =
|
|
1499
|
+
const toml = readFileSync10(tomlPath, "utf8");
|
|
1476
1500
|
const cleaned = toml.replace(
|
|
1477
1501
|
/\n?\[mcp_servers\.hindsight\]\ncommand = "node"\nargs = \[[^\]]*\]\n?/g,
|
|
1478
1502
|
"\n"
|
|
@@ -1669,7 +1693,7 @@ function readLineSync(c, prompt) {
|
|
|
1669
1693
|
const buf = Buffer.alloc(1024);
|
|
1670
1694
|
for (; ; ) {
|
|
1671
1695
|
try {
|
|
1672
|
-
const n =
|
|
1696
|
+
const n = readSync4(0, buf, 0, buf.length, null);
|
|
1673
1697
|
return buf.subarray(0, n).toString("utf8");
|
|
1674
1698
|
} catch (e) {
|
|
1675
1699
|
if (e.code !== "EAGAIN") {
|
|
@@ -1916,7 +1940,7 @@ var grok = {
|
|
|
1916
1940
|
detect: (c) => onPath2("grok") || existsSync8(join13(c.home, ".grok")),
|
|
1917
1941
|
install(c) {
|
|
1918
1942
|
const path = join13(c.home, ".grok", "config.toml");
|
|
1919
|
-
const existing = existsSync8(path) ?
|
|
1943
|
+
const existing = existsSync8(path) ? readFileSync10(path, "utf8") : "";
|
|
1920
1944
|
const withoutOurs = existing.replace(GROK_BLOCK_RE, "\n");
|
|
1921
1945
|
const command = (entry) => JSON.stringify(`node "${join13(c.dist, entry)}"`);
|
|
1922
1946
|
const tomlString = (value) => JSON.stringify(value);
|
|
@@ -1955,7 +1979,7 @@ ${GROK_MARKER_END}
|
|
|
1955
1979
|
uninstall(c) {
|
|
1956
1980
|
const path = join13(c.home, ".grok", "config.toml");
|
|
1957
1981
|
if (existsSync8(path)) {
|
|
1958
|
-
const existing =
|
|
1982
|
+
const existing = readFileSync10(path, "utf8");
|
|
1959
1983
|
const cleaned = existing.replace(GROK_BLOCK_RE, "\n");
|
|
1960
1984
|
if (cleaned !== existing) writeFileSync2(path, cleaned);
|
|
1961
1985
|
}
|
|
@@ -1970,7 +1994,7 @@ function removeLegacyClineHooks(c) {
|
|
|
1970
1994
|
const hooksDir = join13(c.home, "Documents", "Cline", "Hooks");
|
|
1971
1995
|
for (const event of CLINE_OLD_HOOK_EVENTS) {
|
|
1972
1996
|
const path = join13(hooksDir, event);
|
|
1973
|
-
if (existsSync8(path) &&
|
|
1997
|
+
if (existsSync8(path) && readFileSync10(path, "utf8").includes(CLINE_HOOK_MARKER)) {
|
|
1974
1998
|
rmSync(path, { force: true });
|
|
1975
1999
|
}
|
|
1976
2000
|
}
|
|
@@ -2151,7 +2175,7 @@ if (isMain || mainPath?.endsWith("installer.js")) {
|
|
|
2151
2175
|
const pkgRoot = dirname8(dist);
|
|
2152
2176
|
let version;
|
|
2153
2177
|
try {
|
|
2154
|
-
version = JSON.parse(
|
|
2178
|
+
version = JSON.parse(readFileSync10(join13(pkgRoot, "package.json"), "utf8")).version;
|
|
2155
2179
|
} catch {
|
|
2156
2180
|
version = void 0;
|
|
2157
2181
|
}
|