token-goat 2.9.29 → 2.9.30
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 +34 -40
- package/SECURITY.md +28 -10
- package/THIRD_PARTY_NOTICES.md +40 -3
- package/dist/native/linux-arm64/tg-hook +0 -0
- package/dist/native/linux-x64/tg-hook +0 -0
- package/dist/ort-wasm-simd-threaded.mjs +59 -0
- package/dist/token-goat-chunk-3CHUNJ2O.mjs +53 -0
- package/dist/token-goat-chunk-3Z5S4KGM.mjs +918 -0
- package/dist/token-goat-chunk-4FVIAHSI.mjs +211 -0
- package/dist/{token-goat-chunk-PGTH2U4C.mjs → token-goat-chunk-4JJS54TR.mjs} +4 -3
- package/dist/token-goat-chunk-4LCCNRTG.mjs +313 -0
- package/dist/{token-goat-chunk-L7H3U27L.mjs → token-goat-chunk-54K3EUV3.mjs} +1 -1
- package/dist/token-goat-chunk-56EIMS3E.mjs +159 -0
- package/dist/token-goat-chunk-5BCIJXMO.mjs +609 -0
- package/dist/token-goat-chunk-5KDMCMF2.mjs +362 -0
- package/dist/token-goat-chunk-5RG5SBL6.mjs +221 -0
- package/dist/{token-goat-chunk-RRNZMM3A.mjs → token-goat-chunk-5Y6ZYL6U.mjs} +21 -2
- package/dist/{token-goat-chunk-GLXRTTLE.mjs → token-goat-chunk-64FBPDTK.mjs} +12 -8
- package/dist/{token-goat-chunk-G23DWHV4.mjs → token-goat-chunk-664RTTUV.mjs} +28 -15
- package/dist/token-goat-chunk-67TQJ76B.mjs +57 -0
- package/dist/token-goat-chunk-6QMAS7AB.mjs +42 -0
- package/dist/token-goat-chunk-7BXSNBY5.mjs +253 -0
- package/dist/{token-goat-chunk-IVWI2OCK.mjs → token-goat-chunk-7F2UBPD3.mjs} +40 -11
- package/dist/{token-goat-chunk-TGOXNAHW.mjs → token-goat-chunk-7IN2MKDS.mjs} +682 -501
- package/dist/token-goat-chunk-7NADEDKJ.mjs +124 -0
- package/dist/{token-goat-chunk-KOPIR3KZ.mjs → token-goat-chunk-A3CK6N5Z.mjs} +618 -72
- package/dist/{token-goat-chunk-O6I2XU4P.mjs → token-goat-chunk-AFLYLHDH.mjs} +44 -31
- package/dist/{token-goat-chunk-TCQANXYC.mjs → token-goat-chunk-AM5V6GSX.mjs} +18 -2
- package/dist/{token-goat-chunk-E4ZOJIZK.mjs → token-goat-chunk-APGZXSPS.mjs} +39 -146
- package/dist/{token-goat-chunk-D4ETHJD6.mjs → token-goat-chunk-ARDNEC2U.mjs} +9 -7
- package/dist/token-goat-chunk-ATCPY7EQ.mjs +134 -0
- package/dist/token-goat-chunk-B2RZZCSS.mjs +354 -0
- package/dist/{token-goat-chunk-BGYOZ6DO.mjs → token-goat-chunk-B45VMIIH.mjs} +6 -7
- package/dist/token-goat-chunk-BPGCUMR7.mjs +30 -0
- package/dist/{token-goat-chunk-TDUT2CL6.mjs → token-goat-chunk-C63JQV5K.mjs} +45 -6
- package/dist/{token-goat-chunk-ZER6EAXZ.mjs → token-goat-chunk-COBQGL5S.mjs} +2661 -2440
- package/dist/token-goat-chunk-COTXZHTS.mjs +39 -0
- package/dist/{token-goat-chunk-RQGGMPCR.mjs → token-goat-chunk-CYCEYAEO.mjs} +76 -16
- package/dist/token-goat-chunk-CZ3LUXYZ.mjs +4115 -0
- package/dist/{token-goat-chunk-ASLWOQ3I.mjs → token-goat-chunk-DZX2YDPT.mjs} +2 -1
- package/dist/token-goat-chunk-E3OQX2XT.mjs +824 -0
- package/dist/token-goat-chunk-EFHMMIGP.mjs +68 -0
- package/dist/token-goat-chunk-ETBHVDB6.mjs +328 -0
- package/dist/token-goat-chunk-EVMZJ27Z.mjs +147 -0
- package/dist/token-goat-chunk-EXKGNHEG.mjs +2096 -0
- package/dist/{token-goat-chunk-RTMVLHWX.mjs → token-goat-chunk-FBNQNSJK.mjs} +2555 -5127
- package/dist/{token-goat-chunk-NMTKNYGF.mjs → token-goat-chunk-FNFBKLRD.mjs} +74 -9
- package/dist/{token-goat-chunk-RLP6J7WR.mjs → token-goat-chunk-FZ3NEW5O.mjs} +33 -19
- package/dist/token-goat-chunk-G5PJ7AGM.mjs +36 -0
- package/dist/{token-goat-chunk-DNRPXHYH.mjs → token-goat-chunk-GFBSN7BD.mjs} +29 -401
- package/dist/{token-goat-chunk-XYWPOSCN.mjs → token-goat-chunk-GOLEOXZP.mjs} +763 -211
- package/dist/token-goat-chunk-H2K3QP6H.mjs +24 -0
- package/dist/token-goat-chunk-H2PHHGM5.mjs +188 -0
- package/dist/token-goat-chunk-HAVAOB3S.mjs +87 -0
- package/dist/token-goat-chunk-HG45AF2B.mjs +2228 -0
- package/dist/{token-goat-chunk-HUYUHODZ.mjs → token-goat-chunk-HOJLCGDP.mjs} +12965 -11748
- package/dist/{token-goat-chunk-435UQTKD.mjs → token-goat-chunk-HYBFA5X3.mjs} +118 -19
- package/dist/token-goat-chunk-IVALLT3S.mjs +48 -0
- package/dist/{token-goat-chunk-UXSXQQIY.mjs → token-goat-chunk-IVKIZWAB.mjs} +3 -3
- package/dist/{token-goat-chunk-52NSDWYY.mjs → token-goat-chunk-JB6QN6VF.mjs} +6 -4
- package/dist/{token-goat-chunk-HNFZZHFW.mjs → token-goat-chunk-JDHE26RP.mjs} +10 -3
- package/dist/{token-goat-chunk-FTP4U4QA.mjs → token-goat-chunk-JDU3EXSU.mjs} +12 -11
- package/dist/token-goat-chunk-JDWCRD6M.mjs +253 -0
- package/dist/{token-goat-chunk-6AK46ZT7.mjs → token-goat-chunk-JN4XMLSD.mjs} +5 -1
- package/dist/token-goat-chunk-JTQQGXZH.mjs +733 -0
- package/dist/token-goat-chunk-KKUFXAPD.mjs +25 -0
- package/dist/token-goat-chunk-KQNZDCBD.mjs +47 -0
- package/dist/{token-goat-chunk-2WOUYWLM.mjs → token-goat-chunk-KWPNJBDH.mjs} +27 -3
- package/dist/{token-goat-chunk-DPNLUJWB.mjs → token-goat-chunk-LOBGHXPB.mjs} +30 -8
- package/dist/token-goat-chunk-MKPF4CL5.mjs +37 -0
- package/dist/token-goat-chunk-MNWKPRAL.mjs +13 -0
- package/dist/{token-goat-chunk-DNSPXQXQ.mjs → token-goat-chunk-N2NMER56.mjs} +25 -15
- package/dist/token-goat-chunk-NYKZLXMK.mjs +218 -0
- package/dist/token-goat-chunk-OJBNYTJP.mjs +3087 -0
- package/dist/token-goat-chunk-P4QMM4WK.mjs +295 -0
- package/dist/token-goat-chunk-PD5VKH46.mjs +184 -0
- package/dist/token-goat-chunk-PEPTHRFF.mjs +129 -0
- package/dist/{token-goat-chunk-NMBWLRHW.mjs → token-goat-chunk-PU7V3FD6.mjs} +8721 -11104
- package/dist/token-goat-chunk-PY533T7F.mjs +46 -0
- package/dist/token-goat-chunk-Q5VTGRH7.mjs +761 -0
- package/dist/{token-goat-chunk-67BNIKKO.mjs → token-goat-chunk-QCLDAQTS.mjs} +31 -20
- package/dist/{token-goat-chunk-SE6E4BKJ.mjs → token-goat-chunk-QSBRTGM2.mjs} +9 -2
- package/dist/{token-goat-chunk-VZQEWRVH.mjs → token-goat-chunk-RC35RBUL.mjs} +4 -4
- package/dist/{token-goat-chunk-VMFWNHGR.mjs → token-goat-chunk-RHXKCZX3.mjs} +873 -504
- package/dist/{token-goat-chunk-PYSUADX4.mjs → token-goat-chunk-RZRTDST7.mjs} +17 -7
- package/dist/{token-goat-chunk-ONXH6NZ5.mjs → token-goat-chunk-SJHWVNDQ.mjs} +15 -21
- package/dist/token-goat-chunk-SMVRN2HU.mjs +188 -0
- package/dist/{token-goat-chunk-QO3LXVVR.mjs → token-goat-chunk-SQSSNQPE.mjs} +2295 -1718
- package/dist/{token-goat-chunk-2AWQ2R5X.mjs → token-goat-chunk-T4FK7VOV.mjs} +2 -2
- package/dist/token-goat-chunk-U4N3BN2W.mjs +92 -0
- package/dist/token-goat-chunk-UA5V6P3P.mjs +122 -0
- package/dist/{token-goat-chunk-UA5BKWWQ.mjs → token-goat-chunk-UQ5UK2T7.mjs} +15 -4
- package/dist/token-goat-chunk-USILZ3T3.mjs +53 -0
- package/dist/{token-goat-chunk-MELOKFDJ.mjs → token-goat-chunk-VES7EL7O.mjs} +7 -1
- package/dist/{token-goat-chunk-7CPMDFGB.mjs → token-goat-chunk-VL3YIFHZ.mjs} +389 -14
- package/dist/{token-goat-chunk-E5TK5DNO.mjs → token-goat-chunk-VPBBTSJR.mjs} +356 -129
- package/dist/{token-goat-chunk-YOOVFPTP.mjs → token-goat-chunk-W3QCJS6G.mjs} +10 -2
- package/dist/{token-goat-chunk-LZNBQTDK.mjs → token-goat-chunk-WY3L4DVT.mjs} +11 -7
- package/dist/token-goat-chunk-XKI4SEMX.mjs +66 -0
- package/dist/token-goat-chunk-XU4P6Z24.mjs +133 -0
- package/dist/{token-goat-chunk-H5J3C56Q.mjs → token-goat-chunk-Y776AENC.mjs} +112 -26
- package/dist/token-goat-chunk-YARZFCZS.mjs +359 -0
- package/dist/{token-goat-chunk-S4VSXURL.mjs → token-goat-chunk-Z44YO3QZ.mjs} +4 -0
- package/dist/token-goat-chunk-Z57YODA2.mjs +35 -0
- package/dist/{token-goat-chunk-PQ53BSCF.mjs → token-goat-chunk-ZCDTCVIS.mjs} +48 -29
- package/dist/token-goat-chunk-ZEJVMUQH.mjs +48 -0
- package/dist/{token-goat-chunk-BGHSSJUA.mjs → token-goat-chunk-ZFOBKUWH.mjs} +1 -1
- package/dist/token-goat-chunk-ZMBL6UVV.mjs +110 -0
- package/dist/{token-goat-chunk-PKRWMHVP.mjs → token-goat-chunk-ZQSJMO2R.mjs} +338 -170
- package/dist/token-goat-hook-client.cjs +87 -23
- package/dist/token-goat-hook-client.mjs +3 -3
- package/dist/token-goat-hook.mjs +46 -30
- package/dist/token-goat.core.mjs +6 -6
- package/docs/C4_RUNTIME_ARCHITECTURE.md +1 -1
- package/docs/cli.md +80 -46
- package/docs/install.md +47 -14
- package/docs/security.md +7 -7
- package/package.json +17 -7
- package/scripts/verify-native-dist.mjs +386 -0
- package/dist/token-goat-chunk-2NNUA2LR.mjs +0 -143
- package/dist/token-goat-chunk-44BM7DDQ.mjs +0 -294
- package/dist/token-goat-chunk-C5YPNZKQ.mjs +0 -318
- package/dist/token-goat-chunk-CIQ2FTY3.mjs +0 -1990
- package/dist/token-goat-chunk-EUSDXRXU.mjs +0 -1429
- package/dist/token-goat-chunk-G7IWXCFF.mjs +0 -456
- package/dist/token-goat-chunk-JTKCQMQA.mjs +0 -418
- package/dist/token-goat-chunk-ORNFMIER.mjs +0 -295
- package/dist/token-goat-chunk-VQ6F6T7X.mjs +0 -36
- package/dist/token-goat-chunk-YAGLESS3.mjs +0 -23
- package/dist/token-goat-chunk-YKSRAWUU.mjs +0 -33
- package/dist/token-goat-chunk-Z6KBMOBI.mjs +0 -53
|
@@ -2,24 +2,21 @@ import { createRequire as __cjsRequire } from 'node:module';
|
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
getDb
|
|
5
|
-
} from "./token-goat-chunk-
|
|
5
|
+
} from "./token-goat-chunk-VL3YIFHZ.mjs";
|
|
6
6
|
import {
|
|
7
7
|
foldPath,
|
|
8
8
|
isCaseInsensitiveFs
|
|
9
|
-
} from "./token-goat-chunk-
|
|
9
|
+
} from "./token-goat-chunk-AM5V6GSX.mjs";
|
|
10
10
|
import {
|
|
11
11
|
normalizePath
|
|
12
|
-
} from "./token-goat-chunk-
|
|
12
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
13
13
|
import {
|
|
14
14
|
globalDbPath
|
|
15
|
-
} from "./token-goat-chunk-
|
|
15
|
+
} from "./token-goat-chunk-VES7EL7O.mjs";
|
|
16
16
|
import {
|
|
17
17
|
init_define_import_meta_env
|
|
18
18
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
19
19
|
|
|
20
|
-
// src/index_reader.ts
|
|
21
|
-
init_define_import_meta_env();
|
|
22
|
-
|
|
23
20
|
// src/sql_path.ts
|
|
24
21
|
init_define_import_meta_env();
|
|
25
22
|
function pathEqClause(column) {
|
|
@@ -51,6 +48,100 @@ function projectScopeClause(column) {
|
|
|
51
48
|
};
|
|
52
49
|
}
|
|
53
50
|
|
|
51
|
+
// src/index_reader.ts
|
|
52
|
+
init_define_import_meta_env();
|
|
53
|
+
|
|
54
|
+
// src/nested_worktrees.ts
|
|
55
|
+
init_define_import_meta_env();
|
|
56
|
+
import fs from "node:fs";
|
|
57
|
+
import path from "node:path";
|
|
58
|
+
var cache = /* @__PURE__ */ new Map();
|
|
59
|
+
function commonGitDir(root) {
|
|
60
|
+
const dotGit = path.join(root, ".git");
|
|
61
|
+
let st;
|
|
62
|
+
try {
|
|
63
|
+
st = fs.statSync(dotGit);
|
|
64
|
+
} catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
if (st.isDirectory()) return dotGit;
|
|
68
|
+
if (!st.isFile()) return null;
|
|
69
|
+
try {
|
|
70
|
+
const m = /^gitdir:(.*)$/m.exec(fs.readFileSync(dotGit, "utf8"));
|
|
71
|
+
const target = m?.[1]?.trim();
|
|
72
|
+
if (target === void 0 || target === "") return null;
|
|
73
|
+
const gitDir = path.resolve(root, target);
|
|
74
|
+
const common = fs.readFileSync(path.join(gitDir, "commondir"), "utf8").trim();
|
|
75
|
+
return path.resolve(gitDir, common);
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function strictlyInside(child, parent) {
|
|
81
|
+
const base = parent.endsWith("/") ? parent : `${parent}/`;
|
|
82
|
+
return child.startsWith(base) && child.length > base.length;
|
|
83
|
+
}
|
|
84
|
+
function nestedWorktreeRoots(root) {
|
|
85
|
+
const common = commonGitDir(root);
|
|
86
|
+
if (common === null) return [];
|
|
87
|
+
const listDir = path.join(common, "worktrees");
|
|
88
|
+
let listMtimeMs;
|
|
89
|
+
try {
|
|
90
|
+
listMtimeMs = fs.statSync(listDir).mtimeMs;
|
|
91
|
+
} catch {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
const hit = cache.get(root);
|
|
95
|
+
if (hit?.listMtimeMs === listMtimeMs) return hit.roots;
|
|
96
|
+
const rootPath = normalizePath(root);
|
|
97
|
+
const rootKey = foldPath(rootPath);
|
|
98
|
+
let realPath;
|
|
99
|
+
try {
|
|
100
|
+
realPath = normalizePath(fs.realpathSync.native(root));
|
|
101
|
+
} catch {
|
|
102
|
+
realPath = null;
|
|
103
|
+
}
|
|
104
|
+
const roots = [];
|
|
105
|
+
let names;
|
|
106
|
+
try {
|
|
107
|
+
names = fs.readdirSync(listDir);
|
|
108
|
+
} catch {
|
|
109
|
+
names = [];
|
|
110
|
+
}
|
|
111
|
+
for (const name of names) {
|
|
112
|
+
const entryDir = path.join(listDir, name);
|
|
113
|
+
let target;
|
|
114
|
+
try {
|
|
115
|
+
target = fs.readFileSync(path.join(entryDir, "gitdir"), "utf8").trim();
|
|
116
|
+
} catch {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (target === "") continue;
|
|
120
|
+
const wtRoot = normalizePath(path.dirname(path.resolve(entryDir, target)));
|
|
121
|
+
if (strictlyInside(foldPath(wtRoot), rootKey)) roots.push(wtRoot);
|
|
122
|
+
else if (realPath !== null && strictlyInside(foldPath(wtRoot), foldPath(realPath))) roots.push(rootPath.replace(/\/+$/, "") + wtRoot.slice(realPath.replace(/\/+$/, "").length));
|
|
123
|
+
}
|
|
124
|
+
roots.sort();
|
|
125
|
+
cache.set(root, { listMtimeMs, roots });
|
|
126
|
+
return roots;
|
|
127
|
+
}
|
|
128
|
+
function ownProjectScope(column, root) {
|
|
129
|
+
const scope = projectScopeClause(column);
|
|
130
|
+
const excluded = nestedWorktreeExclusions(column, root);
|
|
131
|
+
if (excluded.clauses.length === 0) return { clause: scope.clause, params: scope.params(root) };
|
|
132
|
+
return { clause: `(${[scope.clause, ...excluded.clauses].join(" AND ")})`, params: [...scope.params(root), ...excluded.params] };
|
|
133
|
+
}
|
|
134
|
+
function nestedWorktreeExclusions(column, root) {
|
|
135
|
+
const scope = projectScopeClause(column);
|
|
136
|
+
const clauses = [];
|
|
137
|
+
const params = [];
|
|
138
|
+
for (const wt of nestedWorktreeRoots(root)) {
|
|
139
|
+
clauses.push(`NOT ${scope.clause}`);
|
|
140
|
+
params.push(...scope.params(wt));
|
|
141
|
+
}
|
|
142
|
+
return { clauses, params };
|
|
143
|
+
}
|
|
144
|
+
|
|
54
145
|
// src/index_reader.ts
|
|
55
146
|
function indexKey(p) {
|
|
56
147
|
return normalizePath(p);
|
|
@@ -78,9 +169,9 @@ function toRefEntry(row) {
|
|
|
78
169
|
}
|
|
79
170
|
function applyRootDirScope(rootDir, column, where, params) {
|
|
80
171
|
if (rootDir === void 0) return;
|
|
81
|
-
const
|
|
82
|
-
where.push(clause);
|
|
83
|
-
params.push(...
|
|
172
|
+
const scope = ownProjectScope(column, indexKey(rootDir));
|
|
173
|
+
where.push(scope.clause);
|
|
174
|
+
params.push(...scope.params);
|
|
84
175
|
}
|
|
85
176
|
function buildSymbolWhere(opts) {
|
|
86
177
|
const where = [];
|
|
@@ -196,9 +287,15 @@ function queryRefCounts(names, dbPath = globalDbPath(), rootDir) {
|
|
|
196
287
|
return counts;
|
|
197
288
|
}
|
|
198
289
|
function getProjectFileEntries(rootDir, dbPath = globalDbPath()) {
|
|
199
|
-
const db = getDb(dbPath);
|
|
200
290
|
const { clause, params } = projectScopeClause("path");
|
|
201
|
-
|
|
291
|
+
return fileEntriesWhere(clause, params(indexKey(rootDir)), dbPath);
|
|
292
|
+
}
|
|
293
|
+
function getOwnProjectFileEntries(rootDir, dbPath = globalDbPath()) {
|
|
294
|
+
const { clause, params } = ownProjectScope("path", indexKey(rootDir));
|
|
295
|
+
return fileEntriesWhere(clause, params, dbPath);
|
|
296
|
+
}
|
|
297
|
+
function fileEntriesWhere(clause, params, dbPath) {
|
|
298
|
+
const rows = getDb(dbPath).prepare(`SELECT path, sha, mtime, language, indexed_at, embed_sha, parser_sha FROM files WHERE ${clause}`).all(...params);
|
|
202
299
|
const out = /* @__PURE__ */ new Map();
|
|
203
300
|
for (const row of rows) {
|
|
204
301
|
out.set(foldPath(row.path), {
|
|
@@ -240,12 +337,10 @@ function sanitizeFtsQuery(query, join = "AND") {
|
|
|
240
337
|
const terms = query.split(/\s+/).filter((t) => t.length > 0).map((t) => '"' + t.replace(/"/g, '""') + '"');
|
|
241
338
|
return terms.join(join === "OR" ? " OR " : " ");
|
|
242
339
|
}
|
|
243
|
-
function runFtsQuery(db, match, limit, scope
|
|
340
|
+
function runFtsQuery(db, match, limit, scope) {
|
|
244
341
|
const sql = `SELECT s.file_path, s.name, s.kind, s.line_start, s.line_end, s.body, s.docstring, s.parent FROM symbols_fts JOIN symbols s ON s.id = symbols_fts.rowid WHERE symbols_fts MATCH ?${scope !== void 0 ? ` AND ${scope.clause}` : ""} ORDER BY bm25(symbols_fts) LIMIT ?`;
|
|
245
342
|
const params = [match];
|
|
246
|
-
if (scope !== void 0
|
|
247
|
-
params.push(...scope.params(rootDir));
|
|
248
|
-
}
|
|
343
|
+
if (scope !== void 0) params.push(...scope.params);
|
|
249
344
|
params.push(limit);
|
|
250
345
|
const rows = db.prepare(sql).all(...params);
|
|
251
346
|
return rows.map(toSymbolEntry);
|
|
@@ -254,13 +349,13 @@ function searchSymbolsFts(query, limit = 50, dbPath = globalDbPath(), rootDir) {
|
|
|
254
349
|
const andMatch = sanitizeFtsQuery(query, "AND");
|
|
255
350
|
if (andMatch === "") return [];
|
|
256
351
|
const db = getDb(dbPath);
|
|
257
|
-
const scope = rootDir !== void 0 ?
|
|
352
|
+
const scope = rootDir !== void 0 ? ownProjectScope("s.file_path", indexKey(rootDir)) : void 0;
|
|
258
353
|
try {
|
|
259
|
-
const andResults = runFtsQuery(db, andMatch, limit, scope
|
|
354
|
+
const andResults = runFtsQuery(db, andMatch, limit, scope);
|
|
260
355
|
if (andResults.length > 0) return andResults;
|
|
261
356
|
const orMatch = sanitizeFtsQuery(query, "OR");
|
|
262
357
|
if (orMatch === andMatch) return andResults;
|
|
263
|
-
return runFtsQuery(db, orMatch, limit, scope
|
|
358
|
+
return runFtsQuery(db, orMatch, limit, scope);
|
|
264
359
|
} catch {
|
|
265
360
|
return [];
|
|
266
361
|
}
|
|
@@ -268,7 +363,10 @@ function searchSymbolsFts(query, limit = 50, dbPath = globalDbPath(), rootDir) {
|
|
|
268
363
|
|
|
269
364
|
export {
|
|
270
365
|
pathEqClause,
|
|
366
|
+
pathSuffixClause,
|
|
271
367
|
projectScopeClause,
|
|
368
|
+
ownProjectScope,
|
|
369
|
+
nestedWorktreeExclusions,
|
|
272
370
|
DEFAULT_QUERY_LIMIT,
|
|
273
371
|
querySymbols,
|
|
274
372
|
distinctSymbolKinds,
|
|
@@ -278,6 +376,7 @@ export {
|
|
|
278
376
|
queryRefsByContext,
|
|
279
377
|
queryRefCounts,
|
|
280
378
|
getProjectFileEntries,
|
|
379
|
+
getOwnProjectFileEntries,
|
|
281
380
|
getFileEntry,
|
|
282
381
|
sanitizeFtsQuery,
|
|
283
382
|
searchSymbolsFts
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
INSTALL_INDEX_ENV,
|
|
5
|
+
formatInstallIndexResult,
|
|
6
|
+
queueInstallIndex
|
|
7
|
+
} from "./token-goat-chunk-56EIMS3E.mjs";
|
|
8
|
+
import "./token-goat-chunk-7BXSNBY5.mjs";
|
|
9
|
+
import "./token-goat-chunk-FBNQNSJK.mjs";
|
|
10
|
+
import "./token-goat-chunk-MNWKPRAL.mjs";
|
|
11
|
+
import "./token-goat-chunk-H2PHHGM5.mjs";
|
|
12
|
+
import "./token-goat-chunk-P4QMM4WK.mjs";
|
|
13
|
+
import "./token-goat-chunk-5KDMCMF2.mjs";
|
|
14
|
+
import "./token-goat-chunk-ATCPY7EQ.mjs";
|
|
15
|
+
import "./token-goat-chunk-VPBBTSJR.mjs";
|
|
16
|
+
import "./token-goat-chunk-Y776AENC.mjs";
|
|
17
|
+
import "./token-goat-chunk-SJHWVNDQ.mjs";
|
|
18
|
+
import "./token-goat-chunk-AFLYLHDH.mjs";
|
|
19
|
+
import "./token-goat-chunk-BPGCUMR7.mjs";
|
|
20
|
+
import "./token-goat-chunk-C63JQV5K.mjs";
|
|
21
|
+
import "./token-goat-chunk-JB6QN6VF.mjs";
|
|
22
|
+
import "./token-goat-chunk-RHXKCZX3.mjs";
|
|
23
|
+
import "./token-goat-chunk-EVMZJ27Z.mjs";
|
|
24
|
+
import "./token-goat-chunk-HYBFA5X3.mjs";
|
|
25
|
+
import "./token-goat-chunk-5Y6ZYL6U.mjs";
|
|
26
|
+
import "./token-goat-chunk-ARDNEC2U.mjs";
|
|
27
|
+
import "./token-goat-chunk-3Z5S4KGM.mjs";
|
|
28
|
+
import "./token-goat-chunk-VL3YIFHZ.mjs";
|
|
29
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
30
|
+
import "./token-goat-chunk-3BTK54F3.mjs";
|
|
31
|
+
import "./token-goat-chunk-4FVIAHSI.mjs";
|
|
32
|
+
import "./token-goat-chunk-7IN2MKDS.mjs";
|
|
33
|
+
import "./token-goat-chunk-U4N3BN2W.mjs";
|
|
34
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
35
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
36
|
+
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
37
|
+
import "./token-goat-chunk-GOLEOXZP.mjs";
|
|
38
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
39
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
40
|
+
import "./token-goat-chunk-VES7EL7O.mjs";
|
|
41
|
+
import "./token-goat-chunk-KWPNJBDH.mjs";
|
|
42
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
43
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
44
|
+
export {
|
|
45
|
+
INSTALL_INDEX_ENV,
|
|
46
|
+
formatInstallIndexResult,
|
|
47
|
+
queueInstallIndex
|
|
48
|
+
};
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
createLazyModuleLoader
|
|
12
12
|
} from "./token-goat-chunk-AH6QILZM.mjs";
|
|
13
|
-
import {
|
|
14
|
-
pushAll
|
|
15
|
-
} from "./token-goat-chunk-XYWPOSCN.mjs";
|
|
16
13
|
import {
|
|
17
14
|
DocumentRefusedError,
|
|
18
15
|
MAX_DOCUMENT_WORK_MILLIS
|
|
19
16
|
} from "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
17
|
+
import {
|
|
18
|
+
pushAll
|
|
19
|
+
} from "./token-goat-chunk-GOLEOXZP.mjs";
|
|
20
20
|
import {
|
|
21
21
|
init_define_import_meta_env
|
|
22
22
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -2,12 +2,14 @@ import { createRequire as __cjsRequire } from 'node:module';
|
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
classifyContent,
|
|
5
|
-
guardDivisor
|
|
6
|
-
|
|
7
|
-
} from "./token-goat-chunk-CIQ2FTY3.mjs";
|
|
5
|
+
guardDivisor
|
|
6
|
+
} from "./token-goat-chunk-3Z5S4KGM.mjs";
|
|
8
7
|
import {
|
|
9
8
|
safeSlice
|
|
10
|
-
} from "./token-goat-chunk-
|
|
9
|
+
} from "./token-goat-chunk-GOLEOXZP.mjs";
|
|
10
|
+
import {
|
|
11
|
+
stripAnsiEscapes
|
|
12
|
+
} from "./token-goat-chunk-HAVAOB3S.mjs";
|
|
11
13
|
import {
|
|
12
14
|
init_define_import_meta_env
|
|
13
15
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
redactSecrets
|
|
5
|
+
} from "./token-goat-chunk-4FVIAHSI.mjs";
|
|
6
|
+
import {
|
|
7
|
+
loadConfig
|
|
8
|
+
} from "./token-goat-chunk-7IN2MKDS.mjs";
|
|
3
9
|
import {
|
|
4
10
|
NotAnOfficeDocumentError,
|
|
5
11
|
assertOoxmlWithinDeadline,
|
|
@@ -12,10 +18,10 @@ import {
|
|
|
12
18
|
parseOoxmlPart,
|
|
13
19
|
readOoxmlZip,
|
|
14
20
|
sortNumberedParts
|
|
15
|
-
} from "./token-goat-chunk-
|
|
21
|
+
} from "./token-goat-chunk-IVKIZWAB.mjs";
|
|
16
22
|
import {
|
|
17
23
|
compileGuardedRegex
|
|
18
|
-
} from "./token-goat-chunk-
|
|
24
|
+
} from "./token-goat-chunk-GOLEOXZP.mjs";
|
|
19
25
|
import {
|
|
20
26
|
init_define_import_meta_env
|
|
21
27
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -194,10 +200,11 @@ async function pptxTextGrep(filePath, pattern, deadline = ooxmlWorkDeadline()) {
|
|
|
194
200
|
if (!guarded.ok) throw new Error(`invalid --grep pattern: ${pattern} -- the pattern ${guarded.reason}`);
|
|
195
201
|
const re = guarded.re;
|
|
196
202
|
const out = [];
|
|
203
|
+
const config = loadConfig();
|
|
197
204
|
for (let i = 0; i < slidePaths.length; i++) {
|
|
198
205
|
assertOoxmlWithinDeadline(deadline, "Narrow the read to specific slides with pptx-slide, or use a smaller deck.");
|
|
199
206
|
const parsed = await parseSlide(entries, slidePaths[i], budget);
|
|
200
|
-
const text = flatSlideText(parsed);
|
|
207
|
+
const text = redactSecrets(flatSlideText(parsed), config).text;
|
|
201
208
|
if (re.test(text)) {
|
|
202
209
|
const idx = text.search(re);
|
|
203
210
|
const snippet = text.slice(Math.max(0, idx - 40), idx + 80).trim();
|
|
@@ -20,23 +20,24 @@ import {
|
|
|
20
20
|
setOcrTimeoutForTesting,
|
|
21
21
|
setTesseractEntryForTesting,
|
|
22
22
|
verifyOcrLangCache
|
|
23
|
-
} from "./token-goat-chunk-
|
|
24
|
-
import "./token-goat-chunk-
|
|
25
|
-
import "./token-goat-chunk-
|
|
26
|
-
import "./token-goat-chunk-
|
|
23
|
+
} from "./token-goat-chunk-RC35RBUL.mjs";
|
|
24
|
+
import "./token-goat-chunk-ARDNEC2U.mjs";
|
|
25
|
+
import "./token-goat-chunk-3Z5S4KGM.mjs";
|
|
26
|
+
import "./token-goat-chunk-VL3YIFHZ.mjs";
|
|
27
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
28
|
+
import "./token-goat-chunk-4FVIAHSI.mjs";
|
|
27
29
|
import {
|
|
28
30
|
DEFAULT_OCR_LANG,
|
|
29
31
|
isSupportedOcrLang,
|
|
30
32
|
resolveOcrLangs
|
|
31
|
-
} from "./token-goat-chunk-
|
|
32
|
-
import "./token-goat-chunk-
|
|
33
|
+
} from "./token-goat-chunk-7IN2MKDS.mjs";
|
|
34
|
+
import "./token-goat-chunk-U4N3BN2W.mjs";
|
|
33
35
|
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
34
36
|
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
35
|
-
import "./token-goat-chunk-
|
|
36
|
-
import "./token-goat-chunk-
|
|
37
|
-
import "./token-goat-chunk-
|
|
38
|
-
import "./token-goat-chunk-
|
|
39
|
-
import "./token-goat-chunk-JTKCQMQA.mjs";
|
|
37
|
+
import "./token-goat-chunk-GOLEOXZP.mjs";
|
|
38
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
39
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
40
|
+
import "./token-goat-chunk-VES7EL7O.mjs";
|
|
40
41
|
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
41
42
|
export {
|
|
42
43
|
DEFAULT_OCR_LANG,
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
GROK_HOOK_SCRIPT,
|
|
5
|
+
grokConfigPath,
|
|
6
|
+
grokHookScriptPath,
|
|
7
|
+
installAntigravity,
|
|
8
|
+
installGemini,
|
|
9
|
+
installGrok,
|
|
10
|
+
installKimi,
|
|
11
|
+
installOpenclaw,
|
|
12
|
+
installOpencode,
|
|
13
|
+
installPi,
|
|
14
|
+
installQwen,
|
|
15
|
+
isAntigravityInstalled,
|
|
16
|
+
isGeminiInstalled,
|
|
17
|
+
isGrokInstalled,
|
|
18
|
+
isKimiInstalled,
|
|
19
|
+
isOpenclawInstalled,
|
|
20
|
+
isOpencodeInstalled,
|
|
21
|
+
isPiInstalled,
|
|
22
|
+
isQwenInstalled,
|
|
23
|
+
kimiConfigPath,
|
|
24
|
+
kimiHookScriptPath,
|
|
25
|
+
wiredGrokHookWords,
|
|
26
|
+
wiredKimiHookWords
|
|
27
|
+
} from "./token-goat-chunk-HG45AF2B.mjs";
|
|
28
|
+
import {
|
|
29
|
+
CLAUDECODE_HOOK_SCRIPT,
|
|
30
|
+
CODEX_HOOK_SCRIPT,
|
|
31
|
+
COPILOT_CLI_HOOK_SCRIPT,
|
|
32
|
+
claudeHookScriptPath,
|
|
33
|
+
codexConfigPath,
|
|
34
|
+
codexHookScriptPath,
|
|
35
|
+
copilotCliConfigPath,
|
|
36
|
+
copilotCliHooksDir,
|
|
37
|
+
copilotCliInstructionsPath,
|
|
38
|
+
copilotCliScriptPath,
|
|
39
|
+
hookEventGaps,
|
|
40
|
+
installCodex,
|
|
41
|
+
installCopilotHooksFile,
|
|
42
|
+
installHooks,
|
|
43
|
+
isCodexInstalled,
|
|
44
|
+
isCopilotCliInstalled,
|
|
45
|
+
isInstalled,
|
|
46
|
+
wiredCodexHookWords,
|
|
47
|
+
wiredCopilotHookWords,
|
|
48
|
+
writeCopilotInstructionsBlock
|
|
49
|
+
} from "./token-goat-chunk-OJBNYTJP.mjs";
|
|
50
|
+
import "./token-goat-chunk-B2RZZCSS.mjs";
|
|
51
|
+
import "./token-goat-chunk-XKI4SEMX.mjs";
|
|
52
|
+
import "./token-goat-chunk-G5PJ7AGM.mjs";
|
|
53
|
+
import "./token-goat-chunk-P4QMM4WK.mjs";
|
|
54
|
+
import "./token-goat-chunk-VPBBTSJR.mjs";
|
|
55
|
+
import "./token-goat-chunk-BPGCUMR7.mjs";
|
|
56
|
+
import "./token-goat-chunk-JB6QN6VF.mjs";
|
|
57
|
+
import "./token-goat-chunk-3Z5S4KGM.mjs";
|
|
58
|
+
import "./token-goat-chunk-VL3YIFHZ.mjs";
|
|
59
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
60
|
+
import "./token-goat-chunk-4FVIAHSI.mjs";
|
|
61
|
+
import "./token-goat-chunk-7IN2MKDS.mjs";
|
|
62
|
+
import "./token-goat-chunk-U4N3BN2W.mjs";
|
|
63
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
64
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
65
|
+
import {
|
|
66
|
+
extractErrorMessage
|
|
67
|
+
} from "./token-goat-chunk-GOLEOXZP.mjs";
|
|
68
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
69
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
70
|
+
import "./token-goat-chunk-VES7EL7O.mjs";
|
|
71
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
72
|
+
import {
|
|
73
|
+
init_define_import_meta_env
|
|
74
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
75
|
+
|
|
76
|
+
// src/cli_doctor_hooks.ts
|
|
77
|
+
init_define_import_meta_env();
|
|
78
|
+
import * as fs from "node:fs";
|
|
79
|
+
import * as path from "node:path";
|
|
80
|
+
function shimIsCurrent(scriptPath, expected) {
|
|
81
|
+
try {
|
|
82
|
+
return fs.readFileSync(scriptPath, "utf-8").replace(/\r\n/g, "\n") === expected.replace(/\r\n/g, "\n");
|
|
83
|
+
} catch {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function hasHookEventGaps(gaps) {
|
|
88
|
+
return gaps !== null && (gaps.missing.length > 0 || gaps.outdated.length > 0 || gaps.broken.length > 0);
|
|
89
|
+
}
|
|
90
|
+
function repairHarnessHooks(rootDir = process.cwd()) {
|
|
91
|
+
const repairs = [];
|
|
92
|
+
const errors = [];
|
|
93
|
+
const projectRoot = path.resolve(rootDir ?? process.cwd());
|
|
94
|
+
try {
|
|
95
|
+
const userShim = claudeHookScriptPath();
|
|
96
|
+
const userInstalled = isInstalled("user") || fs.existsSync(userShim);
|
|
97
|
+
if (userInstalled) {
|
|
98
|
+
const isStaleShim = fs.existsSync(userShim) && !shimIsCurrent(userShim, CLAUDECODE_HOOK_SCRIPT);
|
|
99
|
+
if (isStaleShim || hasHookEventGaps(hookEventGaps("user"))) {
|
|
100
|
+
installHooks("user");
|
|
101
|
+
repairs.push("Repaired Claude Code (user) hooks and shim");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
} catch (e) {
|
|
105
|
+
errors.push(`Failed to repair Claude Code (user) hooks: ${extractErrorMessage(e)}`);
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const projShim = claudeHookScriptPath();
|
|
109
|
+
const projInstalled = isInstalled("project");
|
|
110
|
+
if (projInstalled) {
|
|
111
|
+
const isStaleShim = fs.existsSync(projShim) && !shimIsCurrent(projShim, CLAUDECODE_HOOK_SCRIPT);
|
|
112
|
+
if (isStaleShim || hasHookEventGaps(hookEventGaps("project"))) {
|
|
113
|
+
installHooks("project");
|
|
114
|
+
repairs.push("Repaired Claude Code (project) hooks and shim");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} catch (e) {
|
|
118
|
+
errors.push(`Failed to repair Claude Code (project) hooks: ${extractErrorMessage(e)}`);
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const userShim = copilotCliScriptPath();
|
|
122
|
+
const userConfig = copilotCliConfigPath();
|
|
123
|
+
const userInstalled = isCopilotCliInstalled() || fs.existsSync(userConfig) || fs.existsSync(userShim);
|
|
124
|
+
if (userInstalled) {
|
|
125
|
+
const isStaleShim = fs.existsSync(userShim) && !shimIsCurrent(userShim, COPILOT_CLI_HOOK_SCRIPT);
|
|
126
|
+
const hasOutdatedEntries = wiredCopilotHookWords().some((e) => e.current === false);
|
|
127
|
+
if (isStaleShim || hasOutdatedEntries) {
|
|
128
|
+
installCopilotHooksFile(copilotCliHooksDir(), "copilot");
|
|
129
|
+
writeCopilotInstructionsBlock(copilotCliInstructionsPath());
|
|
130
|
+
repairs.push("Repaired Copilot CLI (user) hooks and shim");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} catch (e) {
|
|
134
|
+
errors.push(`Failed to repair Copilot CLI (user) hooks: ${extractErrorMessage(e)}`);
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
const copilotLocalOpts = { local: true, projectRoot };
|
|
138
|
+
const projShim = copilotCliScriptPath(copilotLocalOpts);
|
|
139
|
+
const projConfig = copilotCliConfigPath(copilotLocalOpts);
|
|
140
|
+
const projInstalled = isCopilotCliInstalled(copilotLocalOpts) || fs.existsSync(projConfig) || fs.existsSync(projShim);
|
|
141
|
+
if (projInstalled) {
|
|
142
|
+
const isStaleShim = fs.existsSync(projShim) && !shimIsCurrent(projShim, COPILOT_CLI_HOOK_SCRIPT);
|
|
143
|
+
const hasOutdatedEntries = wiredCopilotHookWords(copilotLocalOpts).some((e) => e.current === false);
|
|
144
|
+
if (isStaleShim || hasOutdatedEntries) {
|
|
145
|
+
installCopilotHooksFile(copilotCliHooksDir(copilotLocalOpts), "copilot");
|
|
146
|
+
writeCopilotInstructionsBlock(copilotCliInstructionsPath(copilotLocalOpts));
|
|
147
|
+
repairs.push("Repaired Copilot CLI (project) hooks and shim");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
} catch (e) {
|
|
151
|
+
errors.push(`Failed to repair Copilot CLI (project) hooks: ${extractErrorMessage(e)}`);
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
const codexShim = codexHookScriptPath();
|
|
155
|
+
const codexCfg = codexConfigPath();
|
|
156
|
+
const codexInstalled = isCodexInstalled() || fs.existsSync(codexCfg) || fs.existsSync(codexShim);
|
|
157
|
+
if (codexInstalled) {
|
|
158
|
+
const isStaleShim = fs.existsSync(codexShim) && !shimIsCurrent(codexShim, CODEX_HOOK_SCRIPT);
|
|
159
|
+
const hasOutdatedEntries = wiredCodexHookWords().some((e) => e.current === false);
|
|
160
|
+
if (isStaleShim || hasOutdatedEntries) {
|
|
161
|
+
installCodex();
|
|
162
|
+
repairs.push("Repaired Codex CLI hooks and shim");
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
} catch (e) {
|
|
166
|
+
errors.push(`Failed to repair Codex CLI hooks: ${extractErrorMessage(e)}`);
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
const grokShim = grokHookScriptPath();
|
|
170
|
+
const grokCfg = grokConfigPath();
|
|
171
|
+
const grokInstalled = isGrokInstalled() || fs.existsSync(grokCfg) || fs.existsSync(grokShim);
|
|
172
|
+
if (grokInstalled) {
|
|
173
|
+
const isStaleShim = fs.existsSync(grokShim) && !shimIsCurrent(grokShim, GROK_HOOK_SCRIPT);
|
|
174
|
+
const hasOutdatedEntries = wiredGrokHookWords().some((e) => e.current === false);
|
|
175
|
+
if (isStaleShim || hasOutdatedEntries) {
|
|
176
|
+
installGrok();
|
|
177
|
+
repairs.push("Repaired Grok CLI hooks and shim");
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
} catch (e) {
|
|
181
|
+
errors.push(`Failed to repair Grok CLI hooks: ${extractErrorMessage(e)}`);
|
|
182
|
+
}
|
|
183
|
+
try {
|
|
184
|
+
const kimiShim = kimiHookScriptPath();
|
|
185
|
+
const kimiCfg = kimiConfigPath();
|
|
186
|
+
const kimiInstalled = isKimiInstalled() || fs.existsSync(kimiCfg) || fs.existsSync(kimiShim);
|
|
187
|
+
if (kimiInstalled) {
|
|
188
|
+
const hasOutdatedEntries = wiredKimiHookWords().some((e) => e.current === false);
|
|
189
|
+
if (hasOutdatedEntries || fs.existsSync(kimiShim) && fs.statSync(kimiShim).size === 0) {
|
|
190
|
+
installKimi();
|
|
191
|
+
repairs.push("Repaired Kimi Code hooks and shim");
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
} catch (e) {
|
|
195
|
+
errors.push(`Failed to repair Kimi Code hooks: ${extractErrorMessage(e)}`);
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
if (isGeminiInstalled()) {
|
|
199
|
+
const res = installGemini();
|
|
200
|
+
if (!res.alreadyInstalled) repairs.push("Repaired Gemini CLI hooks");
|
|
201
|
+
}
|
|
202
|
+
} catch (e) {
|
|
203
|
+
errors.push(`Failed to repair Gemini CLI hooks: ${extractErrorMessage(e)}`);
|
|
204
|
+
}
|
|
205
|
+
try {
|
|
206
|
+
if (isQwenInstalled()) {
|
|
207
|
+
const res = installQwen();
|
|
208
|
+
if (!res.alreadyInstalled) repairs.push("Repaired Qwen Code hooks");
|
|
209
|
+
}
|
|
210
|
+
} catch (e) {
|
|
211
|
+
errors.push(`Failed to repair Qwen Code hooks: ${extractErrorMessage(e)}`);
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
if (isOpencodeInstalled()) {
|
|
215
|
+
const res = installOpencode();
|
|
216
|
+
if (!res.alreadyInstalled) repairs.push("Repaired opencode plugin");
|
|
217
|
+
}
|
|
218
|
+
} catch (e) {
|
|
219
|
+
errors.push(`Failed to repair opencode plugin: ${extractErrorMessage(e)}`);
|
|
220
|
+
}
|
|
221
|
+
try {
|
|
222
|
+
if (isOpenclawInstalled()) {
|
|
223
|
+
const res = installOpenclaw();
|
|
224
|
+
if (!res.alreadyInstalled) repairs.push("Repaired OpenClaw plugin");
|
|
225
|
+
}
|
|
226
|
+
} catch (e) {
|
|
227
|
+
errors.push(`Failed to repair OpenClaw plugin: ${extractErrorMessage(e)}`);
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
if (isPiInstalled()) {
|
|
231
|
+
const res = installPi();
|
|
232
|
+
if (!res.alreadyInstalled) repairs.push("Repaired pi extension");
|
|
233
|
+
} else if (isPiInstalled({ local: true })) {
|
|
234
|
+
const res = installPi({ local: true });
|
|
235
|
+
if (!res.alreadyInstalled) repairs.push("Repaired pi (project) extension");
|
|
236
|
+
}
|
|
237
|
+
} catch (e) {
|
|
238
|
+
errors.push(`Failed to repair pi extension: ${extractErrorMessage(e)}`);
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
if (isAntigravityInstalled()) {
|
|
242
|
+
const res = installAntigravity();
|
|
243
|
+
if (!res.alreadyInstalled) repairs.push("Repaired Antigravity CLI integration");
|
|
244
|
+
}
|
|
245
|
+
} catch (e) {
|
|
246
|
+
errors.push(`Failed to repair Antigravity CLI integration: ${extractErrorMessage(e)}`);
|
|
247
|
+
}
|
|
248
|
+
return { repairs, errors };
|
|
249
|
+
}
|
|
250
|
+
export {
|
|
251
|
+
repairHarnessHooks,
|
|
252
|
+
shimIsCurrent
|
|
253
|
+
};
|
|
@@ -91,6 +91,10 @@ var McpServer = class {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
async handleMessage(message) {
|
|
94
|
+
if (message === null || typeof message !== "object" || Array.isArray(message)) {
|
|
95
|
+
await this.sendError(void 0, JSONRPC_INVALID_REQUEST, "Invalid Request: a JSON-RPC message must be a JSON object");
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
94
98
|
if (!isRequest(message)) return;
|
|
95
99
|
const { id, method } = message;
|
|
96
100
|
const params = message.params ?? {};
|
|
@@ -117,7 +121,7 @@ var McpServer = class {
|
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
123
|
async sendError(id, code, message) {
|
|
120
|
-
await this.send({ jsonrpc: "2.0", id, error: { code, message } });
|
|
124
|
+
await this.send(id === void 0 ? { jsonrpc: "2.0", error: { code, message } } : { jsonrpc: "2.0", id, error: { code, message } });
|
|
121
125
|
}
|
|
122
126
|
initializeResult(params) {
|
|
123
127
|
const requested = params["protocolVersion"];
|