@vectorize-io/hindsight-coding-agents 0.2.0 → 0.3.0
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 +18 -7
- package/dist/antigravity-hook.js +143 -42
- package/dist/antigravity-statusline.js +28 -7
- package/dist/antigravity-stop-hook.js +202 -82
- package/dist/claude-hook.js +143 -42
- package/dist/claude-sessionstart-hook.js +202 -52
- package/dist/claude-stop-hook.js +202 -82
- package/dist/cline.js +245 -91
- package/dist/codex-hook.js +143 -42
- package/dist/codex-sessionstart-hook.js +202 -52
- package/dist/codex-stop-hook.js +202 -82
- package/dist/copilot-hook.js +143 -42
- package/dist/copilot-sessionstart-hook.js +202 -52
- package/dist/copilot-stop-hook.js +202 -82
- package/dist/cursor-hook.js +143 -42
- package/dist/cursor-sessionstart-hook.js +202 -52
- package/dist/cursor-stop-hook.js +202 -82
- package/dist/daemon-start.js +3 -3
- package/dist/deepen.js +658 -493
- package/dist/devin-hook.js +143 -42
- package/dist/devin-sessionstart-hook.js +202 -52
- package/dist/devin-stop-hook.js +202 -82
- package/dist/grok-hook.js +143 -42
- package/dist/grok-sessionstart-hook.js +202 -52
- package/dist/grok-stop-hook.js +202 -82
- package/dist/hindsight-seed.js +28 -7
- package/dist/index.js +246 -92
- package/dist/installer.js +87 -56
- package/dist/kilo.js +246 -92
- package/dist/mcp-server.js +225 -41
- package/dist/prime-agent.js +16874 -0
- package/dist/status.js +112 -31
- package/package.json +6 -1
package/dist/installer.js
CHANGED
|
@@ -5,13 +5,13 @@ import { execFileSync as execFileSync6 } from "child_process";
|
|
|
5
5
|
import {
|
|
6
6
|
copyFileSync,
|
|
7
7
|
cpSync as cpSync2,
|
|
8
|
-
existsSync as
|
|
8
|
+
existsSync as existsSync9,
|
|
9
9
|
mkdirSync as mkdirSync3,
|
|
10
10
|
mkdtempSync,
|
|
11
11
|
readFileSync as readFileSync10,
|
|
12
12
|
readSync as readSync4,
|
|
13
13
|
realpathSync,
|
|
14
|
-
rmSync,
|
|
14
|
+
rmSync as rmSync2,
|
|
15
15
|
writeFileSync as writeFileSync2
|
|
16
16
|
} from "fs";
|
|
17
17
|
import { homedir as homedir9, tmpdir as tmpdir3 } from "os";
|
|
@@ -20,10 +20,11 @@ import { dirname as dirname8, join as join13 } from "path";
|
|
|
20
20
|
import { fileURLToPath as fileURLToPath5, pathToFileURL } from "url";
|
|
21
21
|
|
|
22
22
|
// src/core/hook.ts
|
|
23
|
-
import { existsSync, readFileSync as readFileSync3 } from "fs";
|
|
23
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3 } from "fs";
|
|
24
24
|
|
|
25
25
|
// src/core/bank.ts
|
|
26
26
|
import { execFileSync } from "child_process";
|
|
27
|
+
import { existsSync } from "fs";
|
|
27
28
|
import { homedir } from "os";
|
|
28
29
|
import { basename, dirname, join, normalize, sep } from "path";
|
|
29
30
|
|
|
@@ -86,6 +87,10 @@ function diag(harness, event, extra = {}) {
|
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
|
|
90
|
+
// src/core/hindsight.ts
|
|
91
|
+
var RETRY_AFTER_FLOOR_MS = 10 * 1e3;
|
|
92
|
+
var RETRY_AFTER_CEILING_MS = 60 * 1e3;
|
|
93
|
+
|
|
89
94
|
// src/core/brand.ts
|
|
90
95
|
function brandWord() {
|
|
91
96
|
const start = [0, 116, 217];
|
|
@@ -101,7 +106,7 @@ function brandWord() {
|
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
// src/core/session-cache.ts
|
|
104
|
-
import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
109
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, rmSync, writeFileSync } from "fs";
|
|
105
110
|
import { tmpdir as tmpdir2 } from "os";
|
|
106
111
|
import { dirname as dirname4, join as join5 } from "path";
|
|
107
112
|
|
|
@@ -307,6 +312,7 @@ function readClaudeTranscript(path) {
|
|
|
307
312
|
if (line.type !== "user" && line.type !== "assistant") continue;
|
|
308
313
|
if (line.isMeta === true) continue;
|
|
309
314
|
if (line.isSidechain === true) continue;
|
|
315
|
+
if (line.isCompactSummary === true) continue;
|
|
310
316
|
if (typeof line.message !== "object" || line.message === null) continue;
|
|
311
317
|
for (const rendered of renderLine(line.message.content, line.type)) {
|
|
312
318
|
const turn = { role: rendered.role, content: rendered.content };
|
|
@@ -329,13 +335,13 @@ import { execFileSync as execFileSync4 } from "child_process";
|
|
|
329
335
|
|
|
330
336
|
// src/core/survey.ts
|
|
331
337
|
import { spawn as realSpawn3 } from "child_process";
|
|
332
|
-
import { accessSync, constants, existsSync as
|
|
338
|
+
import { accessSync, constants, existsSync as existsSync3 } from "fs";
|
|
333
339
|
import { homedir as homedir3 } from "os";
|
|
334
340
|
import { delimiter, dirname as dirname6, join as join7 } from "path";
|
|
335
341
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
336
342
|
|
|
337
343
|
// src/core/skill-sync.ts
|
|
338
|
-
import { cpSync, existsSync as
|
|
344
|
+
import { cpSync, existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
|
|
339
345
|
import { homedir as homedir4 } from "os";
|
|
340
346
|
import { dirname as dirname7, join as join8 } from "path";
|
|
341
347
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
@@ -470,14 +476,14 @@ function readCopilotTranscript(path) {
|
|
|
470
476
|
}
|
|
471
477
|
|
|
472
478
|
// src/core/transcript-grok.ts
|
|
473
|
-
import { existsSync as
|
|
479
|
+
import { existsSync as existsSync5, readFileSync as readFileSync7, readdirSync } from "fs";
|
|
474
480
|
import { homedir as homedir5 } from "os";
|
|
475
481
|
import { join as join9 } from "path";
|
|
476
482
|
var CHAT_HISTORY = "chat_history.jsonl";
|
|
477
483
|
function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME || join9(homedir5(), ".grok")) {
|
|
478
484
|
const sessionsDir = join9(grokHome, "sessions");
|
|
479
485
|
const direct = join9(sessionsDir, encodeURIComponent(cwd), sessionId, CHAT_HISTORY);
|
|
480
|
-
if (
|
|
486
|
+
if (existsSync5(direct)) return direct;
|
|
481
487
|
try {
|
|
482
488
|
for (const candidate of readdirSync(sessionsDir)) {
|
|
483
489
|
const directory = join9(sessionsDir, candidate);
|
|
@@ -517,7 +523,7 @@ function readGrokTranscript(path) {
|
|
|
517
523
|
}
|
|
518
524
|
|
|
519
525
|
// src/core/transcript-devin.ts
|
|
520
|
-
import { existsSync as
|
|
526
|
+
import { existsSync as existsSync6 } from "fs";
|
|
521
527
|
import { createRequire } from "module";
|
|
522
528
|
import { homedir as homedir6 } from "os";
|
|
523
529
|
import { join as join10 } from "path";
|
|
@@ -559,7 +565,7 @@ function readDevinTranscript(sessionId, dbPath = devinSessionDb()) {
|
|
|
559
565
|
diag("devin-cli", "sqlite_unavailable", { node: process.version, dbPath });
|
|
560
566
|
return [];
|
|
561
567
|
}
|
|
562
|
-
if (!
|
|
568
|
+
if (!existsSync6(dbPath)) {
|
|
563
569
|
diag("devin-cli", "session_db_missing", { dbPath });
|
|
564
570
|
return [];
|
|
565
571
|
}
|
|
@@ -867,7 +873,7 @@ var HOOK_HARNESSES = {
|
|
|
867
873
|
// src/core/history.ts
|
|
868
874
|
import {
|
|
869
875
|
closeSync as closeSync2,
|
|
870
|
-
existsSync as
|
|
876
|
+
existsSync as existsSync7,
|
|
871
877
|
openSync as openSync2,
|
|
872
878
|
readdirSync as readdirSync2,
|
|
873
879
|
readFileSync as readFileSync8,
|
|
@@ -919,14 +925,14 @@ function firstLine(path, cap = 1e6) {
|
|
|
919
925
|
}
|
|
920
926
|
}
|
|
921
927
|
function jsonlFiles(dir) {
|
|
922
|
-
if (!
|
|
928
|
+
if (!existsSync7(dir)) return [];
|
|
923
929
|
return readdirSync2(dir).filter((f) => f.endsWith(".jsonl")).map((f) => join11(dir, f));
|
|
924
930
|
}
|
|
925
931
|
function claudeHistory(repoDir, home) {
|
|
926
932
|
const root = join11(home, ".claude", "projects");
|
|
927
933
|
const exact = claudeProjectDir(repoDir, home);
|
|
928
934
|
const prefix = exact + "-";
|
|
929
|
-
const dirs =
|
|
935
|
+
const dirs = existsSync7(root) ? readdirSync2(root).map((d) => join11(root, d)).filter((d) => d === exact || d.startsWith(prefix)) : [];
|
|
930
936
|
const sessions = [];
|
|
931
937
|
let unattributed = 0;
|
|
932
938
|
for (const file of dirs.flatMap(jsonlFiles)) {
|
|
@@ -947,7 +953,7 @@ function claudeHistory(repoDir, home) {
|
|
|
947
953
|
}
|
|
948
954
|
function codexHistory(repoDir, home) {
|
|
949
955
|
const root = join11(home, ".codex", "sessions");
|
|
950
|
-
if (!
|
|
956
|
+
if (!existsSync7(root)) return { supported: true, sessions: [] };
|
|
951
957
|
const files = [];
|
|
952
958
|
const walk = (dir) => {
|
|
953
959
|
for (const entry of readdirSync2(dir)) {
|
|
@@ -995,7 +1001,7 @@ function importLocalHistory(harness, repoDir, home = homedir7()) {
|
|
|
995
1001
|
}
|
|
996
1002
|
|
|
997
1003
|
// src/core/legacy.ts
|
|
998
|
-
import { existsSync as
|
|
1004
|
+
import { existsSync as existsSync8, readFileSync as readFileSync9 } from "fs";
|
|
999
1005
|
import { homedir as homedir8 } from "os";
|
|
1000
1006
|
import { join as join12 } from "path";
|
|
1001
1007
|
var LEGACY_CONFIG_FILES = {
|
|
@@ -1018,7 +1024,7 @@ function readLegacyEndpoint(home = homedir8(), prefer = []) {
|
|
|
1018
1024
|
}
|
|
1019
1025
|
function readOne(harness, home) {
|
|
1020
1026
|
const source = legacyConfigPath(harness, home);
|
|
1021
|
-
if (!
|
|
1027
|
+
if (!existsSync8(source)) return void 0;
|
|
1022
1028
|
let raw;
|
|
1023
1029
|
try {
|
|
1024
1030
|
raw = JSON.parse(readFileSync9(source, "utf8"));
|
|
@@ -1265,7 +1271,7 @@ function parseJsonc(text) {
|
|
|
1265
1271
|
}
|
|
1266
1272
|
function writeJson(path, value) {
|
|
1267
1273
|
mkdirSync3(dirname8(path), { recursive: true });
|
|
1268
|
-
if (
|
|
1274
|
+
if (existsSync9(path) && !existsSync9(`${path}.hindsight-backup`)) {
|
|
1269
1275
|
copyFileSync(path, `${path}.hindsight-backup`);
|
|
1270
1276
|
}
|
|
1271
1277
|
writeFileSync2(path, JSON.stringify(value, null, 2) + "\n");
|
|
@@ -1307,14 +1313,14 @@ function stripHarnessHooks(hooks, harness) {
|
|
|
1307
1313
|
}
|
|
1308
1314
|
function installSkill(c, harness, skillsBase) {
|
|
1309
1315
|
const src = join13(c.pkgRoot, "skill");
|
|
1310
|
-
if (!
|
|
1316
|
+
if (!existsSync9(join13(src, "SKILL.md"))) return;
|
|
1311
1317
|
const dst = join13(skillsBase, "hindsight-coding-agent");
|
|
1312
1318
|
mkdirSync3(skillsBase, { recursive: true });
|
|
1313
1319
|
cpSync2(src, dst, { recursive: true });
|
|
1314
1320
|
c.log?.(`${harness}: skill installed at ${dst}`);
|
|
1315
1321
|
}
|
|
1316
1322
|
function uninstallSkill(c, skillsBase) {
|
|
1317
|
-
|
|
1323
|
+
rmSync2(join13(skillsBase, "hindsight-coding-agent"), { recursive: true, force: true });
|
|
1318
1324
|
}
|
|
1319
1325
|
function onPath2(bin) {
|
|
1320
1326
|
try {
|
|
@@ -1334,7 +1340,7 @@ function runClinePlugin(args) {
|
|
|
1334
1340
|
}
|
|
1335
1341
|
var opencode = {
|
|
1336
1342
|
name: "opencode",
|
|
1337
|
-
detect: (c) => onPath2("opencode") ||
|
|
1343
|
+
detect: (c) => onPath2("opencode") || existsSync9(join13(c.home, ".config", "opencode")),
|
|
1338
1344
|
install(c) {
|
|
1339
1345
|
const path = join13(c.home, ".config", "opencode", "opencode.json");
|
|
1340
1346
|
const cfg = readJson(path);
|
|
@@ -1345,7 +1351,7 @@ var opencode = {
|
|
|
1345
1351
|
},
|
|
1346
1352
|
uninstall(c) {
|
|
1347
1353
|
const path = join13(c.home, ".config", "opencode", "opencode.json");
|
|
1348
|
-
if (!
|
|
1354
|
+
if (!existsSync9(path)) return;
|
|
1349
1355
|
const cfg = readJson(path);
|
|
1350
1356
|
if (Array.isArray(cfg.plugin)) {
|
|
1351
1357
|
cfg.plugin = cfg.plugin.filter((p) => !String(p).includes(MARKER));
|
|
@@ -1355,19 +1361,43 @@ var opencode = {
|
|
|
1355
1361
|
c.log?.("opencode: plugin entry removed");
|
|
1356
1362
|
}
|
|
1357
1363
|
};
|
|
1364
|
+
var primeAgent = {
|
|
1365
|
+
name: "prime-agent",
|
|
1366
|
+
detect: (c) => onPath2("prime-agent") || existsSync9(join13(c.home, ".prime", "agent")),
|
|
1367
|
+
install(c) {
|
|
1368
|
+
const path = join13(c.home, ".prime", "agent", "settings.json");
|
|
1369
|
+
const cfg = readJson(path);
|
|
1370
|
+
const entry = join13(c.pkgRoot, "dist", "prime-agent.js");
|
|
1371
|
+
const exts = Array.isArray(cfg.extensions) ? cfg.extensions : [];
|
|
1372
|
+
cfg.extensions = [...exts.filter((p) => !String(p).includes(MARKER)), entry];
|
|
1373
|
+
writeJson(path, cfg);
|
|
1374
|
+
c.log?.(`prime-agent: extension registered in ${path}`);
|
|
1375
|
+
},
|
|
1376
|
+
uninstall(c) {
|
|
1377
|
+
const path = join13(c.home, ".prime", "agent", "settings.json");
|
|
1378
|
+
if (!existsSync9(path)) return;
|
|
1379
|
+
const cfg = readJson(path);
|
|
1380
|
+
if (Array.isArray(cfg.extensions)) {
|
|
1381
|
+
cfg.extensions = cfg.extensions.filter((p) => !String(p).includes(MARKER));
|
|
1382
|
+
if (!cfg.extensions.length) delete cfg.extensions;
|
|
1383
|
+
writeJson(path, cfg);
|
|
1384
|
+
}
|
|
1385
|
+
c.log?.("prime-agent: extension entry removed");
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1358
1388
|
var KILO_CONFIG_CANDIDATES = ["kilo.jsonc", "kilo.json", "opencode.json"];
|
|
1359
1389
|
function kiloConfigPath(c) {
|
|
1360
1390
|
const dir = join13(c.home, ".config", "kilo");
|
|
1361
|
-
const existing = KILO_CONFIG_CANDIDATES.map((f) => join13(dir, f)).find((p) =>
|
|
1391
|
+
const existing = KILO_CONFIG_CANDIDATES.map((f) => join13(dir, f)).find((p) => existsSync9(p));
|
|
1362
1392
|
return existing ?? join13(dir, "kilo.json");
|
|
1363
1393
|
}
|
|
1364
1394
|
var kilo = {
|
|
1365
1395
|
name: "kilo",
|
|
1366
|
-
detect: (c) => onPath2("kilo") ||
|
|
1396
|
+
detect: (c) => onPath2("kilo") || existsSync9(join13(c.home, ".config", "kilo")),
|
|
1367
1397
|
install(c) {
|
|
1368
1398
|
const path = kiloConfigPath(c);
|
|
1369
1399
|
let cfg = {};
|
|
1370
|
-
if (
|
|
1400
|
+
if (existsSync9(path)) {
|
|
1371
1401
|
const parsed = parseJsonc(readFileSync10(path, "utf8"));
|
|
1372
1402
|
if (!parsed) {
|
|
1373
1403
|
c.log?.(`kilo: SKIPPED \u2014 could not parse ${path}; add the plugin entry manually`);
|
|
@@ -1383,7 +1413,7 @@ var kilo = {
|
|
|
1383
1413
|
},
|
|
1384
1414
|
uninstall(c) {
|
|
1385
1415
|
const path = kiloConfigPath(c);
|
|
1386
|
-
if (!
|
|
1416
|
+
if (!existsSync9(path)) return;
|
|
1387
1417
|
const cfg = parseJsonc(readFileSync10(path, "utf8"));
|
|
1388
1418
|
if (!cfg || !Array.isArray(cfg.plugin)) return;
|
|
1389
1419
|
cfg.plugin = cfg.plugin.filter((p) => !String(p).includes(MARKER));
|
|
@@ -1394,7 +1424,7 @@ var kilo = {
|
|
|
1394
1424
|
};
|
|
1395
1425
|
var claudeCode = {
|
|
1396
1426
|
name: "claude-code",
|
|
1397
|
-
detect: (c) => onPath2("claude") ||
|
|
1427
|
+
detect: (c) => onPath2("claude") || existsSync9(join13(c.home, ".claude")),
|
|
1398
1428
|
install(c) {
|
|
1399
1429
|
const path = join13(c.home, ".claude", "settings.json");
|
|
1400
1430
|
const settings = readJson(path);
|
|
@@ -1425,7 +1455,7 @@ var claudeCode = {
|
|
|
1425
1455
|
},
|
|
1426
1456
|
uninstall(c) {
|
|
1427
1457
|
const path = join13(c.home, ".claude", "settings.json");
|
|
1428
|
-
if (
|
|
1458
|
+
if (existsSync9(path)) {
|
|
1429
1459
|
const settings = readJson(path);
|
|
1430
1460
|
if (settings.hooks) {
|
|
1431
1461
|
stripHarnessHooks(settings.hooks, "claude-code");
|
|
@@ -1449,7 +1479,7 @@ function defaultClaudeMcp(args) {
|
|
|
1449
1479
|
}
|
|
1450
1480
|
var codex = {
|
|
1451
1481
|
name: "codex",
|
|
1452
|
-
detect: (c) => onPath2("codex") ||
|
|
1482
|
+
detect: (c) => onPath2("codex") || existsSync9(join13(c.home, ".codex")),
|
|
1453
1483
|
install(c) {
|
|
1454
1484
|
const hooksPath = join13(c.home, ".codex", "hooks.json");
|
|
1455
1485
|
const cfg = readJson(hooksPath);
|
|
@@ -1458,7 +1488,7 @@ var codex = {
|
|
|
1458
1488
|
writeJson(hooksPath, cfg);
|
|
1459
1489
|
c.log?.(`codex: hooks merged into ${hooksPath}`);
|
|
1460
1490
|
const tomlPath = join13(c.home, ".codex", "config.toml");
|
|
1461
|
-
let toml =
|
|
1491
|
+
let toml = existsSync9(tomlPath) ? readFileSync10(tomlPath, "utf8") : "";
|
|
1462
1492
|
const additions = [];
|
|
1463
1493
|
if (!/^\s*(codex_hooks|hooks)\s*=/m.test(toml)) {
|
|
1464
1494
|
if (/^\[features\]/m.test(toml)) {
|
|
@@ -1477,7 +1507,7 @@ args = ["${join13(c.dist, "mcp-server.js")}"]`
|
|
|
1477
1507
|
);
|
|
1478
1508
|
}
|
|
1479
1509
|
if (additions.length) {
|
|
1480
|
-
if (
|
|
1510
|
+
if (existsSync9(tomlPath) && !existsSync9(`${tomlPath}.hindsight-backup`)) {
|
|
1481
1511
|
copyFileSync(tomlPath, `${tomlPath}.hindsight-backup`);
|
|
1482
1512
|
}
|
|
1483
1513
|
mkdirSync3(dirname8(tomlPath), { recursive: true });
|
|
@@ -1489,7 +1519,7 @@ args = ["${join13(c.dist, "mcp-server.js")}"]`
|
|
|
1489
1519
|
},
|
|
1490
1520
|
uninstall(c) {
|
|
1491
1521
|
const hooksPath = join13(c.home, ".codex", "hooks.json");
|
|
1492
|
-
if (
|
|
1522
|
+
if (existsSync9(hooksPath)) {
|
|
1493
1523
|
const cfg = readJson(hooksPath);
|
|
1494
1524
|
if (cfg.hooks) {
|
|
1495
1525
|
stripHarnessHooks(cfg.hooks, "codex");
|
|
@@ -1498,7 +1528,7 @@ args = ["${join13(c.dist, "mcp-server.js")}"]`
|
|
|
1498
1528
|
}
|
|
1499
1529
|
uninstallSkill(c, join13(c.home, ".agents", "skills"));
|
|
1500
1530
|
const tomlPath = join13(c.home, ".codex", "config.toml");
|
|
1501
|
-
if (
|
|
1531
|
+
if (existsSync9(tomlPath)) {
|
|
1502
1532
|
const toml = readFileSync10(tomlPath, "utf8");
|
|
1503
1533
|
const cleaned = toml.replace(
|
|
1504
1534
|
/\n?\[mcp_servers\.hindsight\]\ncommand = "node"\nargs = \[[^\]]*\]\n?/g,
|
|
@@ -1565,7 +1595,7 @@ var antigravity = {
|
|
|
1565
1595
|
},
|
|
1566
1596
|
uninstall(c) {
|
|
1567
1597
|
const hooksPath = join13(c.home, ".gemini", "config", "hooks.json");
|
|
1568
|
-
if (
|
|
1598
|
+
if (existsSync9(hooksPath)) {
|
|
1569
1599
|
const hooks = readJson(hooksPath);
|
|
1570
1600
|
if (hooks[MARKER]) {
|
|
1571
1601
|
stripHarnessHooks(hooks[MARKER], "antigravity-cli");
|
|
@@ -1577,7 +1607,7 @@ var antigravity = {
|
|
|
1577
1607
|
writeJson(hooksPath, hooks);
|
|
1578
1608
|
}
|
|
1579
1609
|
const mcpPath = join13(c.home, ".gemini", "config", "mcp_config.json");
|
|
1580
|
-
if (
|
|
1610
|
+
if (existsSync9(mcpPath)) {
|
|
1581
1611
|
const mcp = readJson(mcpPath);
|
|
1582
1612
|
if (mcp.mcpServers?.hindsight) {
|
|
1583
1613
|
delete mcp.mcpServers.hindsight;
|
|
@@ -1585,7 +1615,7 @@ var antigravity = {
|
|
|
1585
1615
|
}
|
|
1586
1616
|
}
|
|
1587
1617
|
const settingsPath = join13(c.home, ".gemini", "antigravity-cli", "settings.json");
|
|
1588
|
-
if (
|
|
1618
|
+
if (existsSync9(settingsPath)) {
|
|
1589
1619
|
const settings = readJson(settingsPath);
|
|
1590
1620
|
if (JSON.stringify(settings.statusLine ?? {}).includes(MARKER)) {
|
|
1591
1621
|
delete settings.statusLine;
|
|
@@ -1624,15 +1654,15 @@ function stageRuntime(c) {
|
|
|
1624
1654
|
}
|
|
1625
1655
|
};
|
|
1626
1656
|
if (same(c.pkgRoot, target)) return c;
|
|
1627
|
-
if (!
|
|
1657
|
+
if (!existsSync9(join13(c.dist, "installer.js"))) return c;
|
|
1628
1658
|
try {
|
|
1629
|
-
|
|
1659
|
+
rmSync2(join13(target, "dist"), { recursive: true, force: true });
|
|
1630
1660
|
mkdirSync3(target, { recursive: true });
|
|
1631
1661
|
cpSync2(c.dist, join13(target, "dist"), { recursive: true });
|
|
1632
1662
|
const skill = join13(c.pkgRoot, "skill");
|
|
1633
|
-
if (
|
|
1663
|
+
if (existsSync9(skill)) cpSync2(skill, join13(target, "skill"), { recursive: true });
|
|
1634
1664
|
const pkgJson = join13(c.pkgRoot, "package.json");
|
|
1635
|
-
if (
|
|
1665
|
+
if (existsSync9(pkgJson)) copyFileSync(pkgJson, join13(target, "package.json"));
|
|
1636
1666
|
c.log?.(`runtime staged at ${target}`);
|
|
1637
1667
|
return { ...c, pkgRoot: target, dist: join13(target, "dist") };
|
|
1638
1668
|
} catch (error) {
|
|
@@ -1808,7 +1838,7 @@ function reportDaemonPrereqs(c) {
|
|
|
1808
1838
|
}
|
|
1809
1839
|
var devin = {
|
|
1810
1840
|
name: "devin-cli",
|
|
1811
|
-
detect: (c) => onPath2("devin") ||
|
|
1841
|
+
detect: (c) => onPath2("devin") || existsSync9(join13(c.home, ".config", "devin")),
|
|
1812
1842
|
// Devin is the ONLY harness whose hooks never hand over a transcript: they carry a session id and
|
|
1813
1843
|
// nothing else, so retain can only work by reading the CLI's own sessions.db. That makes SQLite
|
|
1814
1844
|
// support a hard prerequisite here — and one worth checking now, because the alternative is an
|
|
@@ -1841,7 +1871,7 @@ var devin = {
|
|
|
1841
1871
|
},
|
|
1842
1872
|
uninstall(c) {
|
|
1843
1873
|
const configPath = join13(c.home, ".config", "devin", "config.json");
|
|
1844
|
-
if (
|
|
1874
|
+
if (existsSync9(configPath)) {
|
|
1845
1875
|
const config = readJson(configPath);
|
|
1846
1876
|
if (config.hooks) {
|
|
1847
1877
|
stripHarnessHooks(config.hooks, "devin-cli");
|
|
@@ -1850,7 +1880,7 @@ var devin = {
|
|
|
1850
1880
|
}
|
|
1851
1881
|
}
|
|
1852
1882
|
const mcpPath = join13(c.home, ".config", "devin", "mcp_config.json");
|
|
1853
|
-
if (
|
|
1883
|
+
if (existsSync9(mcpPath)) {
|
|
1854
1884
|
const mcp = readJson(mcpPath);
|
|
1855
1885
|
if (mcp.mcpServers?.hindsight) {
|
|
1856
1886
|
delete mcp.mcpServers.hindsight;
|
|
@@ -1862,7 +1892,7 @@ var devin = {
|
|
|
1862
1892
|
};
|
|
1863
1893
|
var cursor = {
|
|
1864
1894
|
name: "cursor-cli",
|
|
1865
|
-
detect: (c) => onPath2("cursor-agent") ||
|
|
1895
|
+
detect: (c) => onPath2("cursor-agent") || existsSync9(join13(c.home, ".cursor")),
|
|
1866
1896
|
install(c) {
|
|
1867
1897
|
const hooksPath = join13(c.home, ".cursor", "hooks.json");
|
|
1868
1898
|
const cfg = readJson(hooksPath);
|
|
@@ -1881,7 +1911,7 @@ var cursor = {
|
|
|
1881
1911
|
},
|
|
1882
1912
|
uninstall(c) {
|
|
1883
1913
|
const hooksPath = join13(c.home, ".cursor", "hooks.json");
|
|
1884
|
-
if (
|
|
1914
|
+
if (existsSync9(hooksPath)) {
|
|
1885
1915
|
const cfg = readJson(hooksPath);
|
|
1886
1916
|
if (cfg.hooks) {
|
|
1887
1917
|
stripHarnessHooks(cfg.hooks, "cursor-cli");
|
|
@@ -1890,7 +1920,7 @@ var cursor = {
|
|
|
1890
1920
|
}
|
|
1891
1921
|
}
|
|
1892
1922
|
const mcpPath = join13(c.home, ".cursor", "mcp.json");
|
|
1893
|
-
if (
|
|
1923
|
+
if (existsSync9(mcpPath)) {
|
|
1894
1924
|
const mcp = readJson(mcpPath);
|
|
1895
1925
|
if (mcp.mcpServers?.hindsight) {
|
|
1896
1926
|
delete mcp.mcpServers.hindsight;
|
|
@@ -1903,7 +1933,7 @@ var cursor = {
|
|
|
1903
1933
|
};
|
|
1904
1934
|
var copilot = {
|
|
1905
1935
|
name: "copilot-cli",
|
|
1906
|
-
detect: (c) => onPath2("copilot") ||
|
|
1936
|
+
detect: (c) => onPath2("copilot") || existsSync9(join13(c.home, ".copilot")),
|
|
1907
1937
|
install(c) {
|
|
1908
1938
|
const hooksPath = join13(c.home, ".copilot", "hooks", "hindsight-coding-agents.json");
|
|
1909
1939
|
const hooks = {};
|
|
@@ -1920,11 +1950,11 @@ var copilot = {
|
|
|
1920
1950
|
c.log?.(`copilot-cli: hooks installed at ${hooksPath}, MCP into ${mcpPath}`);
|
|
1921
1951
|
},
|
|
1922
1952
|
uninstall(c) {
|
|
1923
|
-
|
|
1953
|
+
rmSync2(join13(c.home, ".copilot", "hooks", "hindsight-coding-agents.json"), {
|
|
1924
1954
|
force: true
|
|
1925
1955
|
});
|
|
1926
1956
|
const mcpPath = join13(c.home, ".copilot", "mcp-config.json");
|
|
1927
|
-
if (
|
|
1957
|
+
if (existsSync9(mcpPath)) {
|
|
1928
1958
|
const mcp = readJson(mcpPath);
|
|
1929
1959
|
if (mcp.mcpServers?.hindsight) {
|
|
1930
1960
|
delete mcp.mcpServers.hindsight;
|
|
@@ -1940,10 +1970,10 @@ var GROK_MARKER_END = "# HINDSIGHT_CODING_AGENTS_GROK_END";
|
|
|
1940
1970
|
var GROK_BLOCK_RE = new RegExp(`\\n?${GROK_MARKER_START}[\\s\\S]*?${GROK_MARKER_END}\\n?`);
|
|
1941
1971
|
var grok = {
|
|
1942
1972
|
name: "grok-build",
|
|
1943
|
-
detect: (c) => onPath2("grok") ||
|
|
1973
|
+
detect: (c) => onPath2("grok") || existsSync9(join13(c.home, ".grok")),
|
|
1944
1974
|
install(c) {
|
|
1945
1975
|
const path = join13(c.home, ".grok", "config.toml");
|
|
1946
|
-
const existing =
|
|
1976
|
+
const existing = existsSync9(path) ? readFileSync10(path, "utf8") : "";
|
|
1947
1977
|
const withoutOurs = existing.replace(GROK_BLOCK_RE, "\n");
|
|
1948
1978
|
const command = (entry) => JSON.stringify(`node "${join13(c.dist, entry)}"`);
|
|
1949
1979
|
const tomlString = (value) => JSON.stringify(value);
|
|
@@ -1972,7 +2002,7 @@ command = "node"
|
|
|
1972
2002
|
args = [${tomlString(join13(c.dist, "mcp-server.js"))}]
|
|
1973
2003
|
${GROK_MARKER_END}
|
|
1974
2004
|
`;
|
|
1975
|
-
if (
|
|
2005
|
+
if (existsSync9(path) && !existsSync9(`${path}.hindsight-backup`))
|
|
1976
2006
|
copyFileSync(path, `${path}.hindsight-backup`);
|
|
1977
2007
|
mkdirSync3(dirname8(path), { recursive: true });
|
|
1978
2008
|
writeFileSync2(path, `${withoutOurs.replace(/\n*$/, "\n")}${block}`);
|
|
@@ -1981,7 +2011,7 @@ ${GROK_MARKER_END}
|
|
|
1981
2011
|
},
|
|
1982
2012
|
uninstall(c) {
|
|
1983
2013
|
const path = join13(c.home, ".grok", "config.toml");
|
|
1984
|
-
if (
|
|
2014
|
+
if (existsSync9(path)) {
|
|
1985
2015
|
const existing = readFileSync10(path, "utf8");
|
|
1986
2016
|
const cleaned = existing.replace(GROK_BLOCK_RE, "\n");
|
|
1987
2017
|
if (cleaned !== existing) writeFileSync2(path, cleaned);
|
|
@@ -1997,14 +2027,14 @@ function removeLegacyClineHooks(c) {
|
|
|
1997
2027
|
const hooksDir = join13(c.home, "Documents", "Cline", "Hooks");
|
|
1998
2028
|
for (const event of CLINE_OLD_HOOK_EVENTS) {
|
|
1999
2029
|
const path = join13(hooksDir, event);
|
|
2000
|
-
if (
|
|
2001
|
-
|
|
2030
|
+
if (existsSync9(path) && readFileSync10(path, "utf8").includes(CLINE_HOOK_MARKER)) {
|
|
2031
|
+
rmSync2(path, { force: true });
|
|
2002
2032
|
}
|
|
2003
2033
|
}
|
|
2004
2034
|
}
|
|
2005
2035
|
var cline = {
|
|
2006
2036
|
name: "cline-cli",
|
|
2007
|
-
detect: (c) => onPath2("cline") ||
|
|
2037
|
+
detect: (c) => onPath2("cline") || existsSync9(join13(c.home, ".cline")),
|
|
2008
2038
|
install(c) {
|
|
2009
2039
|
removeLegacyClineHooks(c);
|
|
2010
2040
|
const installed = (c.clinePlugin ?? runClinePlugin)([
|
|
@@ -2033,7 +2063,7 @@ var cline = {
|
|
|
2033
2063
|
removeLegacyClineHooks(c);
|
|
2034
2064
|
(c.clinePlugin ?? runClinePlugin)(["plugin", "uninstall", CLINE_PLUGIN_NAME]);
|
|
2035
2065
|
const mcpPath = join13(c.home, ".cline", "data", "settings", "cline_mcp_settings.json");
|
|
2036
|
-
if (
|
|
2066
|
+
if (existsSync9(mcpPath)) {
|
|
2037
2067
|
const mcp = readJson(mcpPath);
|
|
2038
2068
|
if (mcp.mcpServers?.hindsight) {
|
|
2039
2069
|
delete mcp.mcpServers.hindsight;
|
|
@@ -2047,6 +2077,7 @@ var cline = {
|
|
|
2047
2077
|
var INSTALLERS = [
|
|
2048
2078
|
opencode,
|
|
2049
2079
|
kilo,
|
|
2080
|
+
primeAgent,
|
|
2050
2081
|
claudeCode,
|
|
2051
2082
|
codex,
|
|
2052
2083
|
antigravity,
|