token-goat 2.9.30 → 2.9.31
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 +24 -7
- package/SECURITY.md +10 -2
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/native/linux-arm64/tg-hook +0 -0
- package/dist/native/linux-x64/tg-hook +0 -0
- package/dist/native/win32-arm64/tg-hook.exe +0 -0
- package/dist/native/win32-x64/tg-hook.exe +0 -0
- package/dist/{token-goat-chunk-QSBRTGM2.mjs → token-goat-chunk-25TRAWET.mjs} +17 -7
- package/dist/token-goat-chunk-2KXO6V2B.mjs +203 -0
- package/dist/{token-goat-chunk-IVKIZWAB.mjs → token-goat-chunk-2M7E4PF7.mjs} +41 -12
- package/dist/{token-goat-chunk-SMVRN2HU.mjs → token-goat-chunk-2UPZGKKY.mjs} +2 -2
- package/dist/token-goat-chunk-2WLPWKHV.mjs +135 -0
- package/dist/token-goat-chunk-2XBMMDBD.mjs +126 -0
- package/dist/token-goat-chunk-32ZOY4N5.mjs +23 -0
- package/dist/token-goat-chunk-3EZRNKTK.mjs +188 -0
- package/dist/token-goat-chunk-4ADZHI7J.mjs +63 -0
- package/dist/token-goat-chunk-4GBVPH3D.mjs +242 -0
- package/dist/{token-goat-chunk-KWPNJBDH.mjs → token-goat-chunk-4GILLLWY.mjs} +7 -4
- package/dist/{token-goat-chunk-67TQJ76B.mjs → token-goat-chunk-4NAPX7BA.mjs} +36 -3
- package/dist/{token-goat-chunk-PU7V3FD6.mjs → token-goat-chunk-4SC7UJYV.mjs} +3354 -2553
- package/dist/token-goat-chunk-4SMRO4TO.mjs +366 -0
- package/dist/{token-goat-chunk-AFLYLHDH.mjs → token-goat-chunk-4ZBFWLXF.mjs} +283 -427
- package/dist/{token-goat-chunk-JDWCRD6M.mjs → token-goat-chunk-57BIAXJL.mjs} +73 -40
- package/dist/token-goat-chunk-5AC66HNP.mjs +115 -0
- package/dist/token-goat-chunk-5IMLKSOP.mjs +145 -0
- package/dist/token-goat-chunk-646E6U44.mjs +398 -0
- package/dist/token-goat-chunk-65N4RHP4.mjs +33 -0
- package/dist/{token-goat-chunk-JN4XMLSD.mjs → token-goat-chunk-6DG6HWP3.mjs} +8 -2
- package/dist/token-goat-chunk-6ENQSNRZ.mjs +573 -0
- package/dist/token-goat-chunk-6ZY4GNF2.mjs +91 -0
- package/dist/{token-goat-chunk-VPBBTSJR.mjs → token-goat-chunk-76FGDLRO.mjs} +262 -255
- package/dist/{token-goat-chunk-7IN2MKDS.mjs → token-goat-chunk-7EZTZOMC.mjs} +121 -289
- package/dist/{token-goat-chunk-OJBNYTJP.mjs → token-goat-chunk-7MAOA6X4.mjs} +640 -80
- package/dist/token-goat-chunk-7R2ZVVAX.mjs +218 -0
- package/dist/{token-goat-chunk-PD5VKH46.mjs → token-goat-chunk-AUNGYYQX.mjs} +2 -2
- package/dist/{token-goat-chunk-HG45AF2B.mjs → token-goat-chunk-AUQYRMMH.mjs} +794 -37
- package/dist/token-goat-chunk-B3PEKBYG.mjs +128 -0
- package/dist/{token-goat-chunk-A3CK6N5Z.mjs → token-goat-chunk-BA4HI6BW.mjs} +1309 -110
- package/dist/{token-goat-chunk-JB6QN6VF.mjs → token-goat-chunk-BFCWY73P.mjs} +59 -23
- package/dist/{token-goat-chunk-B45VMIIH.mjs → token-goat-chunk-BWGFUZZE.mjs} +7 -5
- package/dist/{token-goat-chunk-P4QMM4WK.mjs → token-goat-chunk-C75NA7PL.mjs} +50 -23
- package/dist/token-goat-chunk-CBIQ7WTD.mjs +87 -0
- package/dist/token-goat-chunk-CETM74KC.mjs +307 -0
- package/dist/{token-goat-chunk-H2PHHGM5.mjs → token-goat-chunk-CIMQ2BB3.mjs} +57 -12
- package/dist/{token-goat-chunk-N2NMER56.mjs → token-goat-chunk-CJLS3CDL.mjs} +46 -4
- package/dist/{token-goat-chunk-VES7EL7O.mjs → token-goat-chunk-CO3UYX6G.mjs} +1 -1
- package/dist/token-goat-chunk-COPNXRJM.mjs +154 -0
- package/dist/token-goat-chunk-CSJ5L3NL.mjs +479 -0
- package/dist/{token-goat-chunk-4LCCNRTG.mjs → token-goat-chunk-CVCEVUGK.mjs} +8 -6
- package/dist/{token-goat-chunk-B2RZZCSS.mjs → token-goat-chunk-CXHOFN7R.mjs} +37 -20
- package/dist/token-goat-chunk-D735C4QM.mjs +603 -0
- package/dist/{token-goat-chunk-APGZXSPS.mjs → token-goat-chunk-DGS2LVNA.mjs} +47 -30
- package/dist/{token-goat-chunk-54K3EUV3.mjs → token-goat-chunk-DOWRSMWO.mjs} +1 -1
- package/dist/token-goat-chunk-E45INMY3.mjs +71 -0
- package/dist/token-goat-chunk-EC5F37F4.mjs +244 -0
- package/dist/{token-goat-chunk-XTQAOTSO.mjs → token-goat-chunk-EDBDRVH5.mjs} +4 -1
- package/dist/{token-goat-chunk-5BCIJXMO.mjs → token-goat-chunk-EELTBKDM.mjs} +14 -10
- package/dist/{token-goat-chunk-W3QCJS6G.mjs → token-goat-chunk-F4HYL64R.mjs} +8 -6
- package/dist/token-goat-chunk-F6PAUIEK.mjs +624 -0
- package/dist/token-goat-chunk-FDSREWLX.mjs +692 -0
- package/dist/token-goat-chunk-GGGG7RWB.mjs +236 -0
- package/dist/{token-goat-chunk-C63JQV5K.mjs → token-goat-chunk-GL3ETKSC.mjs} +233 -15
- package/dist/token-goat-chunk-GVB2MUST.mjs +1298 -0
- package/dist/token-goat-chunk-GWFLAUMQ.mjs +307 -0
- package/dist/{token-goat-chunk-ZEJVMUQH.mjs → token-goat-chunk-HLPW63A7.mjs} +2 -2
- package/dist/{token-goat-chunk-GOLEOXZP.mjs → token-goat-chunk-HU4TORC5.mjs} +44 -26
- package/dist/{token-goat-chunk-Z57YODA2.mjs → token-goat-chunk-I7VKZZAW.mjs} +2 -2
- package/dist/{token-goat-chunk-NYKZLXMK.mjs → token-goat-chunk-IA6XSPE3.mjs} +6 -6
- package/dist/{token-goat-chunk-E3OQX2XT.mjs → token-goat-chunk-IAGXMHIK.mjs} +81 -42
- package/dist/{token-goat-chunk-HYBFA5X3.mjs → token-goat-chunk-IK2DRMFX.mjs} +24 -68
- package/dist/{token-goat-chunk-COBQGL5S.mjs → token-goat-chunk-INNPTRUX.mjs} +249 -299
- package/dist/{token-goat-chunk-7NADEDKJ.mjs → token-goat-chunk-JJ5BX4F4.mjs} +6 -1
- package/dist/{token-goat-chunk-PEPTHRFF.mjs → token-goat-chunk-JVFSHVFJ.mjs} +6 -6
- package/dist/token-goat-chunk-KGEFFSHD.mjs +50 -0
- package/dist/token-goat-chunk-KQBLRPBN.mjs +433 -0
- package/dist/{token-goat-chunk-Q5VTGRH7.mjs → token-goat-chunk-LCNQ2CNN.mjs} +55 -319
- package/dist/token-goat-chunk-M3LFJDPU.mjs +58 -0
- package/dist/token-goat-chunk-M52KPT3C.mjs +87 -0
- package/dist/token-goat-chunk-MBEG42H7.mjs +150 -0
- package/dist/{token-goat-chunk-EVC4TOLE.mjs → token-goat-chunk-METECDOH.mjs} +3 -12
- package/dist/{token-goat-chunk-T4FK7VOV.mjs → token-goat-chunk-MHX7XCC3.mjs} +2 -1
- package/dist/token-goat-chunk-N5LSOVSU.mjs +137 -0
- package/dist/{token-goat-chunk-LOBGHXPB.mjs → token-goat-chunk-N5MMR2IW.mjs} +1 -1
- package/dist/token-goat-chunk-N7B3JQ2C.mjs +160 -0
- package/dist/{token-goat-chunk-RHXKCZX3.mjs → token-goat-chunk-NISNMD7T.mjs} +2182 -2959
- package/dist/token-goat-chunk-NMD42SFQ.mjs +434 -0
- package/dist/token-goat-chunk-NOSS5VWY.mjs +174 -0
- package/dist/{token-goat-chunk-KQNZDCBD.mjs → token-goat-chunk-NSNSPPBG.mjs} +25 -3
- package/dist/token-goat-chunk-OBOFIHKN.mjs +38 -0
- package/dist/token-goat-chunk-OBRFJ5O5.mjs +76 -0
- package/dist/{token-goat-chunk-JTQQGXZH.mjs → token-goat-chunk-ODBT2USM.mjs} +124 -57
- package/dist/token-goat-chunk-OS5EM5PP.mjs +107 -0
- package/dist/token-goat-chunk-OUKDTVNU.mjs +1178 -0
- package/dist/token-goat-chunk-OXFMP75N.mjs +566 -0
- package/dist/{token-goat-chunk-DZX2YDPT.mjs → token-goat-chunk-OYIYKDDT.mjs} +2 -2
- package/dist/{token-goat-chunk-QCLDAQTS.mjs → token-goat-chunk-P6HQSWQ3.mjs} +50 -53
- package/dist/token-goat-chunk-P6VGNTQT.mjs +71 -0
- package/dist/{token-goat-chunk-7BXSNBY5.mjs → token-goat-chunk-PFWIMH2E.mjs} +23 -15
- package/dist/token-goat-chunk-PJZXIS3G.mjs +39 -0
- package/dist/token-goat-chunk-PUO5INXP.mjs +606 -0
- package/dist/{token-goat-chunk-GFBSN7BD.mjs → token-goat-chunk-PX5PQWTY.mjs} +22 -250
- package/dist/token-goat-chunk-Q5QDBC6O.mjs +111 -0
- package/dist/token-goat-chunk-QFNQXSDT.mjs +40 -0
- package/dist/{token-goat-chunk-FBNQNSJK.mjs → token-goat-chunk-QH7YVYOY.mjs} +2198 -2782
- package/dist/{token-goat-chunk-64FBPDTK.mjs → token-goat-chunk-QLMUHEPB.mjs} +12 -9
- package/dist/{token-goat-chunk-RZRTDST7.mjs → token-goat-chunk-QQOJIHL3.mjs} +37 -11
- package/dist/{token-goat-chunk-XKI4SEMX.mjs → token-goat-chunk-QQTWJY2O.mjs} +19 -0
- package/dist/{token-goat-chunk-U4N3BN2W.mjs → token-goat-chunk-QYHO5CPH.mjs} +3 -2
- package/dist/token-goat-chunk-RELAVWAD.mjs +27 -0
- package/dist/{token-goat-chunk-ETBHVDB6.mjs → token-goat-chunk-RSLPOBKQ.mjs} +22 -11
- package/dist/token-goat-chunk-SAMFDIS2.mjs +712 -0
- package/dist/token-goat-chunk-SDELXLDM.mjs +48 -0
- package/dist/{token-goat-chunk-4JJS54TR.mjs → token-goat-chunk-SOAFZNNZ.mjs} +161 -38
- package/dist/{token-goat-chunk-664RTTUV.mjs → token-goat-chunk-SRTHT7KV.mjs} +21 -16
- package/dist/{token-goat-chunk-4FVIAHSI.mjs → token-goat-chunk-T5P5ACNQ.mjs} +7 -6
- package/dist/token-goat-chunk-T5YGG4V3.mjs +45 -0
- package/dist/token-goat-chunk-TAUZ4OFS.mjs +110 -0
- package/dist/{token-goat-chunk-COTXZHTS.mjs → token-goat-chunk-TM6MC754.mjs} +4 -3
- package/dist/token-goat-chunk-TWUKBOMP.mjs +72 -0
- package/dist/{token-goat-chunk-3CHUNJ2O.mjs → token-goat-chunk-U2KSB4SG.mjs} +8 -5
- package/dist/{token-goat-chunk-3Z5S4KGM.mjs → token-goat-chunk-U4WHMG6Y.mjs} +29 -49
- package/dist/{token-goat-chunk-PY533T7F.mjs → token-goat-chunk-UGJHGR5A.mjs} +21 -15
- package/dist/{token-goat-chunk-CYCEYAEO.mjs → token-goat-chunk-UOUDVA5U.mjs} +1 -1
- package/dist/{token-goat-chunk-JDHE26RP.mjs → token-goat-chunk-URRJ33GR.mjs} +16 -5
- package/dist/{token-goat-chunk-56EIMS3E.mjs → token-goat-chunk-UZOROKIS.mjs} +23 -17
- package/dist/{token-goat-chunk-CZ3LUXYZ.mjs → token-goat-chunk-VIHGGGEI.mjs} +427 -308
- package/dist/token-goat-chunk-VTJLAA7P.mjs +21 -0
- package/dist/token-goat-chunk-VWDXLT4F.mjs +678 -0
- package/dist/{token-goat-chunk-YARZFCZS.mjs → token-goat-chunk-VWZA2H4P.mjs} +62 -53
- package/dist/{token-goat-chunk-SQSSNQPE.mjs → token-goat-chunk-VXEXMJDL.mjs} +3979 -4745
- package/dist/token-goat-chunk-WBA5SKT4.mjs +547 -0
- package/dist/{token-goat-chunk-SJHWVNDQ.mjs → token-goat-chunk-WDH44VAU.mjs} +7 -4
- package/dist/token-goat-chunk-X2SUP3EI.mjs +107 -0
- package/dist/token-goat-chunk-X3BELZSJ.mjs +125 -0
- package/dist/{token-goat-chunk-FZ3NEW5O.mjs → token-goat-chunk-XLRBNZCC.mjs} +13 -8
- package/dist/{token-goat-chunk-Z44YO3QZ.mjs → token-goat-chunk-XRKUX6CM.mjs} +1 -1
- package/dist/token-goat-chunk-XX6O25RN.mjs +82 -0
- package/dist/token-goat-chunk-XZSUHBVS.mjs +65 -0
- package/dist/{token-goat-chunk-WY3L4DVT.mjs → token-goat-chunk-Y2ZTQOCL.mjs} +13 -8
- package/dist/{token-goat-chunk-UQ5UK2T7.mjs → token-goat-chunk-YB4VMGK2.mjs} +1 -1
- package/dist/token-goat-chunk-YBIIY3HR.mjs +51 -0
- package/dist/{token-goat-chunk-ZQSJMO2R.mjs → token-goat-chunk-YHVDKQBR.mjs} +105 -105
- package/dist/{token-goat-chunk-H2K3QP6H.mjs → token-goat-chunk-YJB5XLWI.mjs} +8 -6
- package/dist/{token-goat-chunk-ZCDTCVIS.mjs → token-goat-chunk-YKB6AQG3.mjs} +5 -2
- package/dist/token-goat-chunk-YMTG2YA5.mjs +35 -0
- package/dist/token-goat-chunk-YPBZYQRV.mjs +40 -0
- package/dist/{token-goat-chunk-HOJLCGDP.mjs → token-goat-chunk-YY6AVUFL.mjs} +2033 -2251
- package/dist/token-goat-chunk-Z7N5OMMP.mjs +98 -0
- package/dist/token-goat-chunk-ZNMNUPAZ.mjs +938 -0
- package/dist/token-goat-hook-client.cjs +1 -1
- package/dist/token-goat-hook-client.mjs +3 -3
- package/dist/token-goat-hook.mjs +67 -38
- package/dist/token-goat.core.mjs +4 -4
- package/docs/C4_RUNTIME_ARCHITECTURE.md +1 -1
- package/docs/cli.md +40 -21
- package/docs/install.md +19 -9
- package/docs/security.md +5 -3
- package/package.json +2 -1
- package/dist/token-goat-chunk-5KDMCMF2.mjs +0 -362
- package/dist/token-goat-chunk-6QMAS7AB.mjs +0 -42
- package/dist/token-goat-chunk-7F2UBPD3.mjs +0 -397
- package/dist/token-goat-chunk-ARDNEC2U.mjs +0 -248
- package/dist/token-goat-chunk-ATCPY7EQ.mjs +0 -134
- package/dist/token-goat-chunk-EFHMMIGP.mjs +0 -68
- package/dist/token-goat-chunk-IVALLT3S.mjs +0 -48
- package/dist/token-goat-chunk-JDU3EXSU.mjs +0 -65
- package/dist/token-goat-chunk-MKPF4CL5.mjs +0 -37
- package/dist/token-goat-chunk-RC35RBUL.mjs +0 -312
- package/dist/token-goat-chunk-USILZ3T3.mjs +0 -53
- package/dist/token-goat-chunk-VL3YIFHZ.mjs +0 -2975
- package/dist/token-goat-chunk-XU4P6Z24.mjs +0 -133
- package/dist/token-goat-chunk-Y776AENC.mjs +0 -1597
|
@@ -1,96 +1,25 @@
|
|
|
1
1
|
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./token-goat-chunk-HYBFA5X3.mjs";
|
|
4
|
+
CliError,
|
|
5
|
+
formatCommandError,
|
|
6
|
+
formatFailedResultText
|
|
7
|
+
} from "./token-goat-chunk-CBIQ7WTD.mjs";
|
|
9
8
|
import {
|
|
10
|
-
|
|
11
|
-
} from "./token-goat-chunk-
|
|
9
|
+
getToolName
|
|
10
|
+
} from "./token-goat-chunk-76FGDLRO.mjs";
|
|
12
11
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
echoedValue,
|
|
13
|
+
fencedCommand,
|
|
14
|
+
quotedArg
|
|
15
|
+
} from "./token-goat-chunk-GGGG7RWB.mjs";
|
|
16
16
|
import {
|
|
17
17
|
displaySafeJson
|
|
18
18
|
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
19
|
-
import {
|
|
20
|
-
SYMBOL_BODY_CHAR_CAP,
|
|
21
|
-
globalDbPath
|
|
22
|
-
} from "./token-goat-chunk-VES7EL7O.mjs";
|
|
23
19
|
import {
|
|
24
20
|
init_define_import_meta_env
|
|
25
21
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
26
22
|
|
|
27
|
-
// src/stdin_json.ts
|
|
28
|
-
init_define_import_meta_env();
|
|
29
|
-
var DEFAULT_STDIN_TIMEOUT_MS = 5e3;
|
|
30
|
-
var MAX_STDIN_WALL_MS = 6e4;
|
|
31
|
-
var MAX_STDIN_BYTES = 64 * 1024 * 1024;
|
|
32
|
-
function readStdinJson(timeoutMs = DEFAULT_STDIN_TIMEOUT_MS, maxBytes = MAX_STDIN_BYTES) {
|
|
33
|
-
return new Promise((resolve2, reject) => {
|
|
34
|
-
const chunks = [];
|
|
35
|
-
let totalBytes = 0;
|
|
36
|
-
let settled = false;
|
|
37
|
-
const finish = (fn) => {
|
|
38
|
-
if (settled) return;
|
|
39
|
-
settled = true;
|
|
40
|
-
clearTimeout(idleTimer);
|
|
41
|
-
clearTimeout(wallTimer);
|
|
42
|
-
process.stdin.removeListener("data", onData);
|
|
43
|
-
process.stdin.removeListener("end", onEnd);
|
|
44
|
-
process.stdin.removeListener("error", onError);
|
|
45
|
-
fn();
|
|
46
|
-
};
|
|
47
|
-
let idleTimer = setTimeout(() => {
|
|
48
|
-
finish(() => reject(new Error("readStdinJson: timed out waiting for stdin")));
|
|
49
|
-
}, timeoutMs);
|
|
50
|
-
const wallTimer = setTimeout(() => {
|
|
51
|
-
finish(() => {
|
|
52
|
-
process.stdin.destroy();
|
|
53
|
-
reject(new Error(`readStdinJson: stdin took longer than ${MAX_STDIN_WALL_MS} ms`));
|
|
54
|
-
});
|
|
55
|
-
}, MAX_STDIN_WALL_MS);
|
|
56
|
-
const onData = (chunk) => {
|
|
57
|
-
clearTimeout(idleTimer);
|
|
58
|
-
idleTimer = setTimeout(() => {
|
|
59
|
-
finish(() => reject(new Error("readStdinJson: timed out waiting for stdin")));
|
|
60
|
-
}, timeoutMs);
|
|
61
|
-
totalBytes += chunk.length;
|
|
62
|
-
if (totalBytes > maxBytes) {
|
|
63
|
-
finish(() => {
|
|
64
|
-
process.stdin.destroy();
|
|
65
|
-
reject(new Error(`readStdinJson: stdin exceeded ${maxBytes} bytes`));
|
|
66
|
-
});
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
chunks.push(chunk);
|
|
70
|
-
};
|
|
71
|
-
const onEnd = () => {
|
|
72
|
-
finish(() => {
|
|
73
|
-
const text = Buffer.concat(chunks).toString("utf8").trim();
|
|
74
|
-
if (text === "") {
|
|
75
|
-
reject(new Error("readStdinJson: empty stdin"));
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
resolve2(JSON.parse(text));
|
|
80
|
-
} catch (err) {
|
|
81
|
-
reject(err instanceof Error ? err : new Error(String(err)));
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
const onError = (err) => {
|
|
86
|
-
finish(() => reject(err instanceof Error ? err : new Error(String(err))));
|
|
87
|
-
};
|
|
88
|
-
process.stdin.on("data", onData);
|
|
89
|
-
process.stdin.on("end", onEnd);
|
|
90
|
-
process.stdin.on("error", onError);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
23
|
// src/session_store_schema.ts
|
|
95
24
|
init_define_import_meta_env();
|
|
96
25
|
import { existsSync } from "node:fs";
|
|
@@ -439,46 +368,14 @@ async function describeTarget(target, table, opts) {
|
|
|
439
368
|
}
|
|
440
369
|
const absPath = resolve(process.cwd(), target);
|
|
441
370
|
if (existsSync(absPath)) {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
if (isSqliteFile(absPath)) {
|
|
445
|
-
const schema = getSqliteSchema(absPath);
|
|
446
|
-
if (table) {
|
|
447
|
-
const found = schema.tables.find((t) => t.name.toLowerCase() === table.toLowerCase());
|
|
448
|
-
if (!found) {
|
|
449
|
-
const avail2 = schema.tables.map((t) => t.name).join(", ");
|
|
450
|
-
return { exitCode: 1, text: `Table '${table}' not found in SQLite database ${target}. Available tables: ${avail2}` };
|
|
451
|
-
}
|
|
452
|
-
if (opts?.json === true) {
|
|
453
|
-
return { exitCode: 0, text: displaySafeJson(found) };
|
|
454
|
-
}
|
|
455
|
-
const lines = [
|
|
456
|
-
`# SQLite Table: ${found.name} (${found.kind}) in ${target}`,
|
|
457
|
-
`Row Count: ${found.rowCount ?? "unknown"}`,
|
|
458
|
-
"",
|
|
459
|
-
"| Column | Type | Nullable | Default | PK |",
|
|
460
|
-
"| :--- | :--- | :--- | :--- | :--- |"
|
|
461
|
-
];
|
|
462
|
-
for (const col of found.columns) {
|
|
463
|
-
lines.push(`| \`${col.name}\` | \`${col.type}\` | ${col.notNull ? "NO" : "YES"} | ${col.defaultValue ?? "NULL"} | ${col.primaryKey ? "YES" : "NO"} |`);
|
|
464
|
-
}
|
|
465
|
-
if (found.createSql !== void 0) lines.push("", `Module ${found.module ?? "?"} is not loaded here, so columns are not available. Declared as:`, found.createSql);
|
|
466
|
-
return { exitCode: 0, text: lines.join("\n") };
|
|
467
|
-
}
|
|
468
|
-
if (opts?.json === true) {
|
|
469
|
-
return { exitCode: 0, text: displaySafeJson(schema) };
|
|
470
|
-
}
|
|
471
|
-
return { exitCode: 0, text: formatSqliteSchema(schema) };
|
|
472
|
-
}
|
|
473
|
-
} catch (err) {
|
|
474
|
-
return { exitCode: 1, text: `Error reading SQLite database ${target}: ${err instanceof Error ? err.message : String(err)}` };
|
|
475
|
-
}
|
|
371
|
+
const sqliteResult = await (await import("./token-goat-chunk-OBRFJ5O5.mjs")).describeSqliteFile(target, absPath, table, opts?.json === true);
|
|
372
|
+
if (sqliteResult !== void 0) return sqliteResult;
|
|
476
373
|
}
|
|
477
374
|
const avail = SESSION_STORE_TABLES.map((t) => t.name).join(", ");
|
|
478
375
|
return {
|
|
479
376
|
exitCode: 1,
|
|
480
|
-
text: `Unknown table or SQLite file
|
|
481
|
-
Run
|
|
377
|
+
text: `Unknown table or SQLite file ${echoedValue(target)}. Available session store tables: ${avail}
|
|
378
|
+
Run \`token-goat session-schema\` to see all tables.`
|
|
482
379
|
};
|
|
483
380
|
}
|
|
484
381
|
function diagnoseSqlFailure(event, errorText) {
|
|
@@ -508,13 +405,13 @@ function diagnoseSqlFailure(event, errorText) {
|
|
|
508
405
|
}
|
|
509
406
|
if (matchedTable) {
|
|
510
407
|
const validCols = matchedTable.columns.map((c) => c.name).join(", ");
|
|
511
|
-
let advice = `[token-goat] Table
|
|
408
|
+
let advice = `[token-goat] Table ${echoedValue(matchedTable.name)} has columns: ${validCols}.`;
|
|
512
409
|
if (badCol && matchedTable.commonMisnomers && matchedTable.commonMisnomers[badCol]) {
|
|
513
|
-
advice += ` (For
|
|
410
|
+
advice += ` (For ${echoedValue(badCol)}, use ${matchedTable.commonMisnomers[badCol]}).`;
|
|
514
411
|
} else if (badCol) {
|
|
515
|
-
advice += ` (Column
|
|
412
|
+
advice += ` (Column ${echoedValue(badCol)} does not exist on ${echoedValue(matchedTable.name)}).`;
|
|
516
413
|
}
|
|
517
|
-
advice += ` Run
|
|
414
|
+
advice += ` Run ${fencedCommand("token-goat session-schema " + quotedArg(matchedTable.name))} to inspect full table structure.`;
|
|
518
415
|
return advice;
|
|
519
416
|
}
|
|
520
417
|
if (isTableError) {
|
|
@@ -524,7 +421,7 @@ function diagnoseSqlFailure(event, errorText) {
|
|
|
524
421
|
return null;
|
|
525
422
|
}
|
|
526
423
|
const knownTables = SESSION_STORE_TABLES.map((t) => t.name).join(", ");
|
|
527
|
-
return `[token-goat] ${badTable ? `Table
|
|
424
|
+
return `[token-goat] ${badTable ? `Table ${echoedValue(badTable)} does not exist.` : "Table not found."} Available session store tables: ${knownTables}. Run \`token-goat session-schema\` for schema details.`;
|
|
528
425
|
}
|
|
529
426
|
return null;
|
|
530
427
|
}
|
|
@@ -536,9 +433,7 @@ function runSessionSchema(opts) {
|
|
|
536
433
|
const found = getSessionStoreTable(opts.table);
|
|
537
434
|
if (!found) {
|
|
538
435
|
const avail = SESSION_STORE_TABLES.map((t) => t.name).join(", ");
|
|
539
|
-
process.stderr.write(`Unknown session store table
|
|
540
|
-
Run 'token-goat session-schema' to see all tables.
|
|
541
|
-
`);
|
|
436
|
+
process.stderr.write(formatCommandError(new CliError([`Unknown session store table ${echoedValue(opts.table)}. Available tables: ${avail}`, "Run `token-goat session-schema` to see all tables."])) + "\n");
|
|
542
437
|
return 1;
|
|
543
438
|
}
|
|
544
439
|
process.stdout.write(formatSessionStoreTable(found, { json: opts.json }) + "\n");
|
|
@@ -547,7 +442,7 @@ Run 'token-goat session-schema' to see all tables.
|
|
|
547
442
|
async function runDescribe(opts) {
|
|
548
443
|
const result = await describeTarget(opts.target, opts.table, { json: opts.json });
|
|
549
444
|
if (result.exitCode !== 0) {
|
|
550
|
-
process.stderr.write(result.text + "\n");
|
|
445
|
+
process.stderr.write(formatFailedResultText(result.text) + "\n");
|
|
551
446
|
} else {
|
|
552
447
|
process.stdout.write(result.text + "\n");
|
|
553
448
|
}
|
|
@@ -560,131 +455,8 @@ async function cmdDescribe(target, table, opts) {
|
|
|
560
455
|
process.exitCode = await runDescribe({ target, table, json: opts?.json });
|
|
561
456
|
}
|
|
562
457
|
|
|
563
|
-
// src/cli_commands.ts
|
|
564
|
-
init_define_import_meta_env();
|
|
565
|
-
function toEntry(cmd) {
|
|
566
|
-
return {
|
|
567
|
-
name: cmd.name(),
|
|
568
|
-
description: cmd.description(),
|
|
569
|
-
aliases: cmd.aliases(),
|
|
570
|
-
options: cmd.options.map((o) => ({ flags: o.flags, description: o.description })),
|
|
571
|
-
arguments: cmd.registeredArguments.map((a) => ({ name: a.name(), description: a.description, required: a.required })),
|
|
572
|
-
subcommands: cmd.commands.filter((sub) => sub.name() !== "help").map(toEntry)
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
function buildCommandManifest(program) {
|
|
576
|
-
return program.commands.filter((cmd) => cmd.name() !== "help").map(toEntry);
|
|
577
|
-
}
|
|
578
|
-
function flattenCommandNames(manifest) {
|
|
579
|
-
const names = [];
|
|
580
|
-
for (const entry of manifest) {
|
|
581
|
-
names.push(entry.name);
|
|
582
|
-
for (const sub of entry.subcommands) {
|
|
583
|
-
names.push(`${entry.name} ${sub.name}`);
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
return names;
|
|
587
|
-
}
|
|
588
|
-
function entryMatches(entry, re, pattern) {
|
|
589
|
-
const haystacks = [entry.name, entry.description, ...entry.aliases];
|
|
590
|
-
return haystacks.some((h) => re !== null ? re.test(h) : h.includes(pattern));
|
|
591
|
-
}
|
|
592
|
-
function filterCommandManifest(manifest, pattern) {
|
|
593
|
-
const guarded = compileGuardedRegex(pattern);
|
|
594
|
-
const re = guarded.ok ? guarded.re : null;
|
|
595
|
-
const result = [];
|
|
596
|
-
for (const entry of manifest) {
|
|
597
|
-
if (entryMatches(entry, re, pattern)) {
|
|
598
|
-
result.push(entry);
|
|
599
|
-
continue;
|
|
600
|
-
}
|
|
601
|
-
const matchingSubs = entry.subcommands.filter((sub) => entryMatches(sub, re, pattern));
|
|
602
|
-
if (matchingSubs.length > 0) {
|
|
603
|
-
result.push({ ...entry, subcommands: matchingSubs });
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
return result;
|
|
607
|
-
}
|
|
608
|
-
function formatCommandManifest(manifest) {
|
|
609
|
-
const lines = [];
|
|
610
|
-
lines.push("# token-goat commands");
|
|
611
|
-
lines.push("");
|
|
612
|
-
for (const entry of manifest) {
|
|
613
|
-
lines.push(`## ${entry.name}${entry.aliases.length ? " (alias: " + entry.aliases.join(", ") + ")" : ""}${entry.description ? " -- " + entry.description : ""}`);
|
|
614
|
-
for (const arg of entry.arguments) {
|
|
615
|
-
lines.push(` arg: ${arg.name}${arg.required ? "" : " (optional)"}${arg.description ? " -- " + arg.description : ""}`);
|
|
616
|
-
}
|
|
617
|
-
for (const opt of entry.options) {
|
|
618
|
-
lines.push(` ${opt.flags}${opt.description ? " -- " + opt.description : ""}`);
|
|
619
|
-
}
|
|
620
|
-
for (const sub of entry.subcommands) {
|
|
621
|
-
lines.push(` ${entry.name} ${sub.name}${sub.description ? " -- " + sub.description : ""}`);
|
|
622
|
-
}
|
|
623
|
-
lines.push("");
|
|
624
|
-
}
|
|
625
|
-
return lines.join("\n").trimEnd();
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
// src/symbol_body_probe.ts
|
|
629
|
-
init_define_import_meta_env();
|
|
630
|
-
import * as fs from "fs";
|
|
631
|
-
var OVERSIZED_BODY_PROBE_SQL = `SELECT 1 FROM symbols WHERE LENGTH(body) > ${SYMBOL_BODY_CHAR_CAP} LIMIT 1`;
|
|
632
|
-
function checkSymbolBodySize(dbPath) {
|
|
633
|
-
if (!fs.existsSync(dbPath)) {
|
|
634
|
-
return { name: "Symbol body size", status: "ok", message: "no database yet" };
|
|
635
|
-
}
|
|
636
|
-
try {
|
|
637
|
-
const db = getDb(dbPath);
|
|
638
|
-
const row = db.prepare(OVERSIZED_BODY_PROBE_SQL).get();
|
|
639
|
-
if (row !== void 0) {
|
|
640
|
-
return {
|
|
641
|
-
name: "Symbol body size",
|
|
642
|
-
status: "warn",
|
|
643
|
-
message: `one or more stored symbol bodies exceed the ${SYMBOL_BODY_CHAR_CAP}-char cap enforced by boundSymbolBody -- likely a pre-fix leftover from a minified/generated file. A plain 'token-goat reclaim-index' (VACUUM only) CANNOT remove these rows -- it only reclaims freed pages, it never deletes row content. Only 'token-goat reclaim-index --rebuild' drops and re-derives them under the cap (stop the worker first with 'token-goat worker stop', since reclaim-index refuses to run while it's live); --rebuild reparses and re-embeds every indexed file across every project and can take a long time on a large multi-project index`
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
return { name: "Symbol body size", status: "ok", message: "no stored symbol body exceeds the cap" };
|
|
647
|
-
} catch (err) {
|
|
648
|
-
return {
|
|
649
|
-
name: "Symbol body size",
|
|
650
|
-
status: "warn",
|
|
651
|
-
message: `could not query symbol body size: ${extractErrorMessage(err)}`
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
// src/session_reminder.ts
|
|
657
|
-
init_define_import_meta_env();
|
|
658
|
-
var GENERIC_REMINDER = 'token-goat: prefer surgical reads over the Read/Grep tools on this codebase; shell commands like `rg`, `grep`, `fd`, `sed`, `cat`, `find`, and `ls` are just commands, not tool names -- `token-goat symbol <name>`, `token-goat read "file::symbol"`, `token-goat section "file::Heading"`, `token-goat semantic "description"`, `token-goat outline <file>`. Run `token-goat index .` if this project is not indexed yet.';
|
|
659
|
-
var INDEXED_REMINDER = 'token-goat: this project is indexed. Prefer `symbol <name>`, `read "file::symbol"`, `section "file::Heading"`, `semantic "description"`, or `outline <file>` over a full Read/Grep tool call; for JSON/YAML use `json-query file \'a.b.c\'` or `yaml-query` (nested keys are not symbols); shell commands like `rg`, `grep`, `fd`, `sed`, `cat`, `find`, and `ls` are still just commands.';
|
|
660
|
-
var NOTE_REMINDER = ' Record a finding that must outlive a compaction with `token-goat note set <key> "<finding>"`; notes come back at every session start.';
|
|
661
|
-
function isIndexedProject(cwd) {
|
|
662
|
-
if (cwd === void 0) return false;
|
|
663
|
-
try {
|
|
664
|
-
return countSymbols({ rootDir: cwd }, globalDbPath()) > 0;
|
|
665
|
-
} catch {
|
|
666
|
-
return false;
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
function buildReminder(indexed) {
|
|
670
|
-
return (indexed ? INDEXED_REMINDER : GENERIC_REMINDER) + NOTE_REMINDER;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
// src/mcp_tool_pattern.ts
|
|
674
|
-
init_define_import_meta_env();
|
|
675
|
-
var MCP_TOOL_PATTERN = "^mcp__";
|
|
676
|
-
|
|
677
458
|
export {
|
|
678
|
-
readStdinJson,
|
|
679
459
|
diagnoseSqlFailure,
|
|
680
460
|
cmdSessionSchema,
|
|
681
|
-
cmdDescribe
|
|
682
|
-
buildCommandManifest,
|
|
683
|
-
flattenCommandNames,
|
|
684
|
-
filterCommandManifest,
|
|
685
|
-
formatCommandManifest,
|
|
686
|
-
checkSymbolBodySize,
|
|
687
|
-
isIndexedProject,
|
|
688
|
-
buildReminder,
|
|
689
|
-
MCP_TOOL_PATTERN
|
|
461
|
+
cmdDescribe
|
|
690
462
|
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
init_define_import_meta_env
|
|
5
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
6
|
+
|
|
7
|
+
// src/stdin_json.ts
|
|
8
|
+
init_define_import_meta_env();
|
|
9
|
+
var DEFAULT_STDIN_TIMEOUT_MS = 5e3;
|
|
10
|
+
var FIRST_BYTE_GRACE_FACTOR = 4;
|
|
11
|
+
var IDLE_CONFIRM_MS = 50;
|
|
12
|
+
var MAX_STDIN_WALL_MS = 6e4;
|
|
13
|
+
var MAX_STDIN_BYTES = 64 * 1024 * 1024;
|
|
14
|
+
function completeDocument(chunks) {
|
|
15
|
+
const text = Buffer.concat(chunks).toString("utf8").trim();
|
|
16
|
+
if (!text.startsWith("{") && !text.startsWith("[")) return void 0;
|
|
17
|
+
try {
|
|
18
|
+
const value = JSON.parse(text);
|
|
19
|
+
return typeof value === "object" && value !== null ? { value } : void 0;
|
|
20
|
+
} catch {
|
|
21
|
+
return void 0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function readStdinJson(timeoutMs = DEFAULT_STDIN_TIMEOUT_MS, maxBytes = MAX_STDIN_BYTES, firstByteGraceFactor = FIRST_BYTE_GRACE_FACTOR) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const chunks = [];
|
|
27
|
+
let totalBytes = 0;
|
|
28
|
+
let settled = false;
|
|
29
|
+
const finish = (fn) => {
|
|
30
|
+
if (settled) return;
|
|
31
|
+
settled = true;
|
|
32
|
+
clearTimeout(idleTimer);
|
|
33
|
+
clearTimeout(wallTimer);
|
|
34
|
+
process.stdin.removeListener("data", onData);
|
|
35
|
+
process.stdin.removeListener("end", onEnd);
|
|
36
|
+
process.stdin.removeListener("error", onError);
|
|
37
|
+
fn();
|
|
38
|
+
};
|
|
39
|
+
const confirmSilence = (confirmMs) => {
|
|
40
|
+
const seen = totalBytes;
|
|
41
|
+
const armedAt = performance.now();
|
|
42
|
+
idleTimer = setTimeout(() => {
|
|
43
|
+
setImmediate(() => {
|
|
44
|
+
if (totalBytes !== seen) return;
|
|
45
|
+
if (performance.now() - armedAt > confirmMs * 2) {
|
|
46
|
+
confirmSilence(confirmMs);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
finish(() => {
|
|
50
|
+
const done = completeDocument(chunks);
|
|
51
|
+
if (done !== void 0) resolve(done.value);
|
|
52
|
+
else reject(new Error("readStdinJson: timed out waiting for stdin"));
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}, confirmMs);
|
|
56
|
+
};
|
|
57
|
+
const armIdle = (ms = timeoutMs) => {
|
|
58
|
+
const confirmMs = Math.min(IDLE_CONFIRM_MS, Math.floor(ms / 2));
|
|
59
|
+
return setTimeout(() => confirmSilence(confirmMs), ms - confirmMs);
|
|
60
|
+
};
|
|
61
|
+
let idleTimer = armIdle(timeoutMs * firstByteGraceFactor);
|
|
62
|
+
const wallTimer = setTimeout(() => {
|
|
63
|
+
finish(() => {
|
|
64
|
+
process.stdin.destroy();
|
|
65
|
+
reject(new Error(`readStdinJson: stdin took longer than ${MAX_STDIN_WALL_MS} ms`));
|
|
66
|
+
});
|
|
67
|
+
}, MAX_STDIN_WALL_MS);
|
|
68
|
+
const onData = (chunk) => {
|
|
69
|
+
clearTimeout(idleTimer);
|
|
70
|
+
idleTimer = armIdle();
|
|
71
|
+
totalBytes += chunk.length;
|
|
72
|
+
if (totalBytes > maxBytes) {
|
|
73
|
+
finish(() => {
|
|
74
|
+
process.stdin.destroy();
|
|
75
|
+
reject(new Error(`readStdinJson: stdin exceeded ${maxBytes} bytes`));
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
chunks.push(chunk);
|
|
80
|
+
};
|
|
81
|
+
const onEnd = () => {
|
|
82
|
+
finish(() => {
|
|
83
|
+
const text = Buffer.concat(chunks).toString("utf8").trim();
|
|
84
|
+
if (text === "") {
|
|
85
|
+
reject(new Error("readStdinJson: empty stdin"));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
resolve(JSON.parse(text));
|
|
90
|
+
} catch (err) {
|
|
91
|
+
reject(err instanceof Error ? err : new Error(String(err)));
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const onError = (err) => {
|
|
96
|
+
finish(() => reject(err instanceof Error ? err : new Error(String(err))));
|
|
97
|
+
};
|
|
98
|
+
process.stdin.on("data", onData);
|
|
99
|
+
process.stdin.on("end", onEnd);
|
|
100
|
+
process.stdin.on("error", onError);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// src/mcp_tool_pattern.ts
|
|
105
|
+
init_define_import_meta_env();
|
|
106
|
+
var MCP_TOOL_PATTERN = "^mcp__";
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
readStdinJson,
|
|
110
|
+
MCP_TOOL_PATTERN
|
|
111
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
evaluateVerification,
|
|
5
|
+
exitStatusIsCheckVerdict,
|
|
6
|
+
isVerificationCommand,
|
|
7
|
+
noteFailedVerificationRun,
|
|
8
|
+
noteVerificationRun
|
|
9
|
+
} from "./token-goat-chunk-2WLPWKHV.mjs";
|
|
10
|
+
import "./token-goat-chunk-WBA5SKT4.mjs";
|
|
11
|
+
import "./token-goat-chunk-KQBLRPBN.mjs";
|
|
12
|
+
import "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
13
|
+
import "./token-goat-chunk-GL3ETKSC.mjs";
|
|
14
|
+
import "./token-goat-chunk-IK2DRMFX.mjs";
|
|
15
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
16
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
17
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
18
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
19
|
+
import "./token-goat-chunk-4GILLLWY.mjs";
|
|
20
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
21
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
22
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
23
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
24
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
25
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
26
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
27
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
28
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
29
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
30
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
31
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
32
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
33
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
34
|
+
export {
|
|
35
|
+
evaluateVerification,
|
|
36
|
+
exitStatusIsCheckVerdict,
|
|
37
|
+
isVerificationCommand,
|
|
38
|
+
noteFailedVerificationRun,
|
|
39
|
+
noteVerificationRun
|
|
40
|
+
};
|