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
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
runGit
|
|
5
|
+
} from "./token-goat-chunk-HU4TORC5.mjs";
|
|
6
|
+
import {
|
|
7
|
+
init_define_import_meta_env
|
|
8
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
9
|
+
|
|
10
|
+
// src/repomap.ts
|
|
11
|
+
init_define_import_meta_env();
|
|
12
|
+
import * as fs from "fs";
|
|
13
|
+
import * as path from "path";
|
|
14
|
+
function getTrackedFiles(cwd = process.cwd()) {
|
|
15
|
+
try {
|
|
16
|
+
let dir = cwd;
|
|
17
|
+
let onlyFile = "";
|
|
18
|
+
try {
|
|
19
|
+
if (fs.statSync(cwd).isFile()) {
|
|
20
|
+
dir = path.dirname(cwd);
|
|
21
|
+
onlyFile = path.basename(cwd);
|
|
22
|
+
}
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
const args = onlyFile === "" ? ["ls-files"] : ["ls-files", "--error-unmatch", "--", onlyFile];
|
|
26
|
+
const result = runGit(args, { cwd: dir });
|
|
27
|
+
if (result.exitCode !== 0 || !result.stdout) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
return result.stdout.split("\n").filter((line) => line.trim().length > 0).map((rel) => path.join(dir, rel));
|
|
31
|
+
} catch {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
getTrackedFiles
|
|
38
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
fenceFileFieldIfMatched,
|
|
5
|
+
fenceJsonStrings
|
|
6
|
+
} from "./token-goat-chunk-4NAPX7BA.mjs";
|
|
7
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
8
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
9
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
10
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
11
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
12
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
13
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
14
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
15
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
16
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
17
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
18
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
19
|
+
import {
|
|
20
|
+
echoedValue
|
|
21
|
+
} from "./token-goat-chunk-GGGG7RWB.mjs";
|
|
22
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
23
|
+
import {
|
|
24
|
+
displaySafeJson,
|
|
25
|
+
displaySafePath,
|
|
26
|
+
displaySafeText
|
|
27
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
28
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
29
|
+
import {
|
|
30
|
+
init_define_import_meta_env
|
|
31
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
32
|
+
|
|
33
|
+
// src/describe_sqlite.ts
|
|
34
|
+
init_define_import_meta_env();
|
|
35
|
+
async function describeSqliteFile(target, absPath, table, json) {
|
|
36
|
+
try {
|
|
37
|
+
const { isSqliteFile, getSqliteSchema, formatSqliteSchema } = await import("./token-goat-chunk-MHX7XCC3.mjs");
|
|
38
|
+
const fenceCap = await import("./token-goat-chunk-YMTG2YA5.mjs");
|
|
39
|
+
const capAndFence = (text) => fenceCap.guardAndFenceFileText(text, "describe");
|
|
40
|
+
if (isSqliteFile(absPath)) {
|
|
41
|
+
const schema = getSqliteSchema(absPath);
|
|
42
|
+
if (table) {
|
|
43
|
+
const found = schema.tables.find((t) => t.name.toLowerCase() === table.toLowerCase());
|
|
44
|
+
if (!found) {
|
|
45
|
+
const avail = schema.tables.map((t) => displaySafeText(t.name)).join(", ");
|
|
46
|
+
return { exitCode: 1, text: `Table ${echoedValue(table)} not found in SQLite database ${displaySafePath(target)}. Available tables: ${avail}` };
|
|
47
|
+
}
|
|
48
|
+
if (json === true) {
|
|
49
|
+
return { exitCode: 0, text: fenceCap.capListField(found, "columns", (o) => displaySafeJson(fenceJsonStrings(o, fenceFileFieldIfMatched))) };
|
|
50
|
+
}
|
|
51
|
+
const lines = [
|
|
52
|
+
`# SQLite Table: ${displaySafeText(found.name)} (${displaySafeText(found.kind)}) in ${displaySafePath(target)}`,
|
|
53
|
+
`Row Count: ${found.rowCount ?? "unknown"}`,
|
|
54
|
+
"",
|
|
55
|
+
"| Column | Type | Nullable | Default | PK |",
|
|
56
|
+
"| :--- | :--- | :--- | :--- | :--- |"
|
|
57
|
+
];
|
|
58
|
+
for (const col of found.columns) {
|
|
59
|
+
lines.push(`| \`${displaySafeText(col.name)}\` | \`${col.type}\` | ${col.notNull ? "NO" : "YES"} | ${col.defaultValue ?? "NULL"} | ${col.primaryKey ? "YES" : "NO"} |`);
|
|
60
|
+
}
|
|
61
|
+
if (found.createSql !== void 0) lines.push("", `Module ${displaySafeText(found.module ?? "?")} is not loaded here, so columns are not available. Declared as:`, displaySafeText(found.createSql));
|
|
62
|
+
return { exitCode: 0, text: capAndFence(lines.join("\n")) };
|
|
63
|
+
}
|
|
64
|
+
if (json === true) {
|
|
65
|
+
return { exitCode: 0, text: fenceCap.capListField(schema, "tables", (o) => displaySafeJson(fenceJsonStrings(o, fenceFileFieldIfMatched))) };
|
|
66
|
+
}
|
|
67
|
+
return { exitCode: 0, text: capAndFence(formatSqliteSchema(schema)) };
|
|
68
|
+
}
|
|
69
|
+
} catch (err) {
|
|
70
|
+
return { exitCode: 1, text: `Error reading SQLite database ${displaySafePath(target)}: ${err instanceof Error ? err.message : String(err)}` };
|
|
71
|
+
}
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
describeSqliteFile
|
|
76
|
+
};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
scanAndRecord
|
|
6
|
-
} from "./token-goat-chunk-67TQJ76B.mjs";
|
|
7
|
-
import {
|
|
8
|
-
enqueueDirtyPathSafe
|
|
9
|
-
} from "./token-goat-chunk-H2PHHGM5.mjs";
|
|
10
|
-
import {
|
|
4
|
+
CHANGES_WHAT_RUNS_NAMES,
|
|
11
5
|
extractCatFile,
|
|
12
6
|
extractHeadFile,
|
|
13
7
|
extractLineRangeRead,
|
|
@@ -16,39 +10,54 @@ import {
|
|
|
16
10
|
isTscCommand,
|
|
17
11
|
splitShellSegments,
|
|
18
12
|
stripLeadingAssignments
|
|
19
|
-
} from "./token-goat-chunk-
|
|
13
|
+
} from "./token-goat-chunk-DGS2LVNA.mjs";
|
|
20
14
|
import {
|
|
21
15
|
detectFromCommand,
|
|
22
16
|
filterByName
|
|
23
|
-
} from "./token-goat-chunk-
|
|
17
|
+
} from "./token-goat-chunk-INNPTRUX.mjs";
|
|
18
|
+
import {
|
|
19
|
+
enqueueDirtyPathSafe,
|
|
20
|
+
requestReconcileSafe
|
|
21
|
+
} from "./token-goat-chunk-CIMQ2BB3.mjs";
|
|
24
22
|
import {
|
|
25
23
|
RECALL_DEFAULT_LIMIT,
|
|
26
24
|
isBuildCommand,
|
|
27
25
|
isTestRunnerCommand,
|
|
28
26
|
listRecentRecall,
|
|
27
|
+
parsePorcelainZ,
|
|
29
28
|
searchRecall
|
|
30
|
-
} from "./token-goat-chunk-
|
|
29
|
+
} from "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
30
|
+
import {
|
|
31
|
+
fenceIfScanMatched,
|
|
32
|
+
fenceUntrusted
|
|
33
|
+
} from "./token-goat-chunk-4NAPX7BA.mjs";
|
|
34
|
+
import {
|
|
35
|
+
hasBareBackgroundOrNewline,
|
|
36
|
+
hasUnquotedOperator,
|
|
37
|
+
maskQuotedSpans,
|
|
38
|
+
shlexSplit
|
|
39
|
+
} from "./token-goat-chunk-4GILLLWY.mjs";
|
|
40
|
+
import {
|
|
41
|
+
appendWorkerErrorLog
|
|
42
|
+
} from "./token-goat-chunk-F6PAUIEK.mjs";
|
|
31
43
|
import {
|
|
32
44
|
shortFingerprint
|
|
33
|
-
} from "./token-goat-chunk-
|
|
45
|
+
} from "./token-goat-chunk-4GBVPH3D.mjs";
|
|
34
46
|
import {
|
|
35
47
|
pad,
|
|
36
48
|
runGit
|
|
37
|
-
} from "./token-goat-chunk-
|
|
49
|
+
} from "./token-goat-chunk-HU4TORC5.mjs";
|
|
38
50
|
import {
|
|
39
51
|
UNTRUSTED_TOOL_TAG,
|
|
40
52
|
UNTRUSTED_WEB_TAG,
|
|
41
53
|
displaySafeJson,
|
|
42
|
-
|
|
54
|
+
displaySafeText,
|
|
43
55
|
normalizePath,
|
|
44
56
|
resolveIndexPath
|
|
45
57
|
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
46
58
|
import {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
maskQuotedSpans,
|
|
50
|
-
shlexSplit
|
|
51
|
-
} from "./token-goat-chunk-KWPNJBDH.mjs";
|
|
59
|
+
dataDir
|
|
60
|
+
} from "./token-goat-chunk-CO3UYX6G.mjs";
|
|
52
61
|
import {
|
|
53
62
|
init_define_import_meta_env
|
|
54
63
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -75,9 +84,7 @@ function fenceRecallListing(text, hits) {
|
|
|
75
84
|
return fenceUntrusted(text, tag);
|
|
76
85
|
}
|
|
77
86
|
function fenceSnippetIfMatched(hit) {
|
|
78
|
-
|
|
79
|
-
if (matches.length === 0) return hit.snippet;
|
|
80
|
-
return fenceUntrustedContent(hit.snippet, matches, fenceTagForCacheType(hit.cacheType));
|
|
87
|
+
return fenceIfScanMatched(hit.snippet, fenceTagForCacheType(hit.cacheType));
|
|
81
88
|
}
|
|
82
89
|
function printHits(query, hits) {
|
|
83
90
|
const w = (text) => {
|
|
@@ -124,6 +131,13 @@ function runRecallCommand(query, opts = {}) {
|
|
|
124
131
|
|
|
125
132
|
// src/hooks_bash_commands.ts
|
|
126
133
|
var CD_PREFIX_RE = /^(?:cd\s+(?:"[^"]*"|'[^']*'|\S+)[ \t]*(?:&&|;|\r?\n)\s*)+/;
|
|
134
|
+
var EXPORT_VALUE = String.raw`(?:[\w./:@%+,=-]*|"[^"$\`\\\r\n]*"|'[^'\r\n]*')`;
|
|
135
|
+
var EXPORT_NAME = String.raw`(?!(?:${CHANGES_WHAT_RUNS_NAMES})=)[A-Za-z_]\w*`;
|
|
136
|
+
var EXPORT_PREFIX_RE = new RegExp(String.raw`^(?:export[ \t]+${EXPORT_NAME}=${EXPORT_VALUE}(?:[ \t]+${EXPORT_NAME}=${EXPORT_VALUE})*[ \t]*(?:&&|;|\r?\n)\s*)+`);
|
|
137
|
+
function stripExportPrefix(cmd) {
|
|
138
|
+
const stripped = cmd.replace(EXPORT_PREFIX_RE, "");
|
|
139
|
+
return stripped.trim() || cmd;
|
|
140
|
+
}
|
|
127
141
|
function stripCdPrefix(cmd) {
|
|
128
142
|
const stripped = cmd.replace(CD_PREFIX_RE, "");
|
|
129
143
|
return stripped.trim() || cmd;
|
|
@@ -139,8 +153,11 @@ function stripSubshellGroup(cmd) {
|
|
|
139
153
|
}
|
|
140
154
|
return cmd;
|
|
141
155
|
}
|
|
156
|
+
function stripGroupAndExports(rawCmd) {
|
|
157
|
+
return stripExportPrefix(stripSubshellGroup(rawCmd));
|
|
158
|
+
}
|
|
142
159
|
function stripCommandPrefix(rawCmd) {
|
|
143
|
-
return stripLeadingAssignments(stripCdPrefix(
|
|
160
|
+
return stripLeadingAssignments(stripExportPrefix(stripCdPrefix(stripGroupAndExports(rawCmd))));
|
|
144
161
|
}
|
|
145
162
|
function stripTrailingStderrRedirect(cmd) {
|
|
146
163
|
const stripped = cmd.replace(/\s*2>&1\s*$/, "");
|
|
@@ -155,7 +172,7 @@ function isDirectTestRunnerCommand(cmd) {
|
|
|
155
172
|
return /^(?:pytest|(?:npx\s+)?(?:jest|vitest)|go\s+test|cargo\s+test)\b/i.test(cmd);
|
|
156
173
|
}
|
|
157
174
|
function extractCdPrefixDirs(rawCmd) {
|
|
158
|
-
const prefixMatch =
|
|
175
|
+
const prefixMatch = stripGroupAndExports(rawCmd).match(CD_PREFIX_RE);
|
|
159
176
|
if (prefixMatch === null) return [];
|
|
160
177
|
const dirs = [];
|
|
161
178
|
const segmentPattern = /cd\s+(?:"([^"]*)"|'([^']*)'|(\S+))[ \t]*(?:&&|;|\r?\n)/g;
|
|
@@ -233,7 +250,7 @@ function firstTopLevelPipe(cmd) {
|
|
|
233
250
|
function pipelineDivergenceNote(cmd, entryCommand) {
|
|
234
251
|
if (entryCommand === cmd) return "";
|
|
235
252
|
const preview = entryCommand.length > 60 ? entryCommand.slice(0, 57).trimEnd() + "..." : entryCommand;
|
|
236
|
-
return " (cached from a differently-piped run, `" + preview + "` \u2014 verify it covers what you need before trusting it)";
|
|
253
|
+
return " (cached from a differently-piped run, `" + displaySafeText(preview) + "` \u2014 verify it covers what you need before trusting it)";
|
|
237
254
|
}
|
|
238
255
|
function outputSlice(cmd) {
|
|
239
256
|
const pipe = firstTopLevelPipe(cmd);
|
|
@@ -265,7 +282,7 @@ function extractCommand(event) {
|
|
|
265
282
|
const cmd = event.toolInput["command"];
|
|
266
283
|
return typeof cmd === "string" && cmd.trim() !== "" ? cmd.trim() : void 0;
|
|
267
284
|
}
|
|
268
|
-
var HEAD_MOVING_GIT_RE = /^\s*git\s+(?:checkout|switch|pull|merge|rebase|reset|cherry-pick)\b/i;
|
|
285
|
+
var HEAD_MOVING_GIT_RE = /^\s*git\s+(?:checkout|switch|pull|merge|rebase|reset|cherry-pick|stash\s+branch)\b/i;
|
|
269
286
|
var PATH_SCOPED_CHECKOUT_RE = /^\s*git\s+checkout\s+(?:\S.*?\s)?--(?:\s|$)/i;
|
|
270
287
|
function isHeadMovingGitCommand(cmd) {
|
|
271
288
|
if (!HEAD_MOVING_GIT_RE.test(cmd)) return false;
|
|
@@ -276,7 +293,28 @@ var ORIG_HEAD_ELIGIBLE_GIT_RE = /^\s*git\s+(?:pull|merge|rebase)\b/i;
|
|
|
276
293
|
var ORIG_HEAD_REFLOG_MSG_RE = /^(merge\s|rebase\s\(|pull\s)/i;
|
|
277
294
|
var GIT_RESTORE_RE = /^\s*git\s+restore\b/i;
|
|
278
295
|
var GIT_RESTORE_STAGED_ONLY_RE = /(?:^|\s)(?:--staged|-S)(?:\s|$)/;
|
|
279
|
-
var
|
|
296
|
+
var GIT_STASH_REWRITE_SUBCOMMANDS = /* @__PURE__ */ new Set(["pop", "apply", "branch", "push", "save"]);
|
|
297
|
+
var GIT_OPTIONS_WITH_VALUE = /* @__PURE__ */ new Set(["-C", "-c", "--git-dir", "--work-tree", "--namespace", "--super-prefix", "--config-env"]);
|
|
298
|
+
function gitStashRewriteDir(segment, runDir) {
|
|
299
|
+
const tokens = safeShlexSplit(segment);
|
|
300
|
+
if (tokens === null) return null;
|
|
301
|
+
let i = 0;
|
|
302
|
+
while (i < tokens.length && /^[A-Za-z_][A-Za-z0-9_]*=/.test(tokens[i])) i++;
|
|
303
|
+
const head = tokens[i];
|
|
304
|
+
if (head === void 0 || path.basename(head.replace(/\\/g, "/")).replace(/\.exe$/i, "").toLowerCase() !== "git") return null;
|
|
305
|
+
let dir = runDir;
|
|
306
|
+
for (i++; i < tokens.length && tokens[i].startsWith("-"); i++) {
|
|
307
|
+
const t = tokens[i];
|
|
308
|
+
if (!GIT_OPTIONS_WITH_VALUE.has(t)) continue;
|
|
309
|
+
const value = tokens[++i];
|
|
310
|
+
if (t === "-C" && value !== void 0 && value !== "") dir = path.resolve(dir, value);
|
|
311
|
+
}
|
|
312
|
+
if (tokens[i] !== "stash") return null;
|
|
313
|
+
const rest = tokens.slice(i + 1);
|
|
314
|
+
if (rest.some((t) => t === "-h" || t === "--help")) return null;
|
|
315
|
+
const sub = rest[0];
|
|
316
|
+
return sub === void 0 || sub.startsWith("-") || GIT_STASH_REWRITE_SUBCOMMANDS.has(sub) ? dir : null;
|
|
317
|
+
}
|
|
280
318
|
var PATCH_APPLY_SEGMENT_RE = /^\s*(?:\S*[/\\])?(?:git\s+apply|patch)\b/i;
|
|
281
319
|
var PATCH_APPLY_INSPECT_ONLY_RE = /(?:^|\s)--(?:check|stat|numstat|summary|dry-run)(?:\s|=|$)/i;
|
|
282
320
|
function isFormatterWriteSegment(segment) {
|
|
@@ -359,38 +397,54 @@ function extractGitRestorePathspecs(cmd) {
|
|
|
359
397
|
}
|
|
360
398
|
return specs;
|
|
361
399
|
}
|
|
362
|
-
function
|
|
400
|
+
function gitRepoRootOrNull(gitDir) {
|
|
363
401
|
const toplevel = runGit(["rev-parse", "--show-toplevel"], { cwd: gitDir, timeoutMs: 5e3 });
|
|
364
|
-
return toplevel.exitCode === 0 && toplevel.stdout.trim() !== "" ? toplevel.stdout.trim() :
|
|
402
|
+
return toplevel.exitCode === 0 && toplevel.stdout.trim() !== "" ? toplevel.stdout.trim() : null;
|
|
403
|
+
}
|
|
404
|
+
function reconcileIfGitTimedOut(result, gitDir, what, gitCommand) {
|
|
405
|
+
if (result.timedOut !== true) return;
|
|
406
|
+
const recorded = requestReconcileSafe(gitDir);
|
|
407
|
+
appendWorkerErrorLog(dataDir(), `${(/* @__PURE__ */ new Date()).toISOString()} post-bash ${what} in ${gitDir}: ${gitCommand} did not answer in time (${result.stderr.trim().slice(0, 200)}); ${recorded ? "asked the worker to reconcile the project" : "could not record a reconcile request, so the index may stay stale until the next index run"}
|
|
408
|
+
`);
|
|
365
409
|
}
|
|
366
410
|
function expandGitPathspecs(specs, gitDir) {
|
|
367
411
|
if (specs.length === 0) return [];
|
|
368
|
-
const listed = runGit(["ls-files", "--full-name", "--", ...specs], { cwd: gitDir, timeoutMs: 5e3 });
|
|
412
|
+
const listed = runGit(["ls-files", "-z", "--full-name", "--", ...specs], { cwd: gitDir, timeoutMs: 5e3 });
|
|
413
|
+
reconcileIfGitTimedOut(listed, gitDir, "git restore", "git ls-files");
|
|
369
414
|
if (listed.exitCode !== 0) return [];
|
|
370
|
-
const repoRoot =
|
|
371
|
-
|
|
415
|
+
const repoRoot = gitRepoRootOrNull(gitDir);
|
|
416
|
+
if (repoRoot === null) {
|
|
417
|
+
requestReconcileSafe(gitDir);
|
|
418
|
+
return [];
|
|
419
|
+
}
|
|
420
|
+
return listed.stdout.split("\0").filter((rel) => rel.length > 0).map((rel) => resolveIndexPath(rel, repoRoot));
|
|
372
421
|
}
|
|
422
|
+
var STATUS_SWEEP_CAP = 2e3;
|
|
373
423
|
function workingTreeStatusPaths(gitDir) {
|
|
374
|
-
const status = runGit(["status", "--porcelain"], { cwd: gitDir, timeoutMs: 5e3 });
|
|
424
|
+
const status = runGit(["status", "--porcelain", "-z", "--untracked-files=all"], { cwd: gitDir, timeoutMs: 5e3 });
|
|
425
|
+
reconcileIfGitTimedOut(status, gitDir, "status sweep", "git status");
|
|
426
|
+
const stamp = `${(/* @__PURE__ */ new Date()).toISOString()} post-bash status sweep in ${gitDir}`;
|
|
427
|
+
if (status.exitCode === -1 && status.timedOut !== true && /ENOBUFS/.test(status.stderr)) {
|
|
428
|
+
const recorded2 = requestReconcileSafe(gitDir);
|
|
429
|
+
appendWorkerErrorLog(dataDir(), `${stamp}: git status listed more than the output buffer holds; ${recorded2 ? "asked the worker to reconcile the project" : "could not record a reconcile request, so the index may stay stale until the next index run"}
|
|
430
|
+
`);
|
|
431
|
+
}
|
|
375
432
|
if (status.exitCode !== 0) return [];
|
|
376
|
-
const
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
if (rel.startsWith('"')) {
|
|
385
|
-
try {
|
|
386
|
-
rel = JSON.parse(rel);
|
|
387
|
-
} catch {
|
|
388
|
-
continue;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
out.push(resolveIndexPath(rel, repoRoot));
|
|
433
|
+
const recorded = requestReconcileSafe(gitDir);
|
|
434
|
+
const repoRoot = gitRepoRootOrNull(gitDir);
|
|
435
|
+
if (repoRoot === null) return [];
|
|
436
|
+
const entries = parsePorcelainZ(status.stdout);
|
|
437
|
+
const rels = [...entries.filter((e) => e.untracked === true), ...entries.filter((e) => e.untracked !== true)].flatMap((e) => e.origPath === void 0 ? [e.path] : [e.path, e.origPath]);
|
|
438
|
+
if (!recorded && rels.length <= STATUS_SWEEP_CAP) {
|
|
439
|
+
appendWorkerErrorLog(dataDir(), `${stamp}: could not record a reconcile request, so a file this sweep could not see may stay stale until the next index run
|
|
440
|
+
`);
|
|
392
441
|
}
|
|
393
|
-
|
|
442
|
+
if (rels.length > STATUS_SWEEP_CAP) {
|
|
443
|
+
const untrackedDropped = Math.max(0, entries.filter((e) => e.untracked === true).length - STATUS_SWEEP_CAP);
|
|
444
|
+
appendWorkerErrorLog(dataDir(), `${stamp}: git listed ${rels.length} paths, so only the first ${STATUS_SWEEP_CAP} were queued, untracked ones first; ${untrackedDropped > 0 ? `${untrackedDropped} untracked ${untrackedDropped === 1 ? "file was" : "files were"} left out, which no reconcile finds, and ` : ""}${recorded ? "asked the worker to reconcile the project for the rest of the tracked files" : "could not record a reconcile request, so the index may stay stale until the next index run"}
|
|
445
|
+
`);
|
|
446
|
+
}
|
|
447
|
+
return rels.slice(0, STATUS_SWEEP_CAP).map((rel) => resolveIndexPath(rel, repoRoot));
|
|
394
448
|
}
|
|
395
449
|
function enqueueRewrittenPath(absPath) {
|
|
396
450
|
if (/(?:^|[/\\])(?:NUL|nul)$/.test(absPath) || absPath.replace(/\\/g, "/").endsWith("/dev/null")) return;
|
|
@@ -404,19 +458,32 @@ function enqueueRewrittenPath(absPath) {
|
|
|
404
458
|
function enqueueNonHeadMovingRewrites(cmd, runDir) {
|
|
405
459
|
const atRunDir = (f) => resolveIndexPath(f, runDir);
|
|
406
460
|
const paths = [];
|
|
407
|
-
|
|
461
|
+
const sweepDirs = /* @__PURE__ */ new Set();
|
|
408
462
|
if (GIT_RESTORE_RE.test(cmd) && !GIT_RESTORE_STAGED_ONLY_RE.test(cmd)) {
|
|
409
|
-
|
|
463
|
+
const specs = extractGitRestorePathspecs(cmd);
|
|
464
|
+
paths.push(...expandGitPathspecs(specs, runDir));
|
|
465
|
+
for (const spec of specs) if (spec !== "." && !spec.startsWith(":") && !/[*?[]/.test(spec)) paths.push(atRunDir(spec));
|
|
410
466
|
}
|
|
411
467
|
for (const segment of splitShellSegments(cmd)) {
|
|
412
|
-
if (PATCH_APPLY_SEGMENT_RE.test(segment) && !PATCH_APPLY_INSPECT_ONLY_RE.test(segment))
|
|
413
|
-
if (isFormatterWriteSegment(segment))
|
|
468
|
+
if (PATCH_APPLY_SEGMENT_RE.test(segment) && !PATCH_APPLY_INSPECT_ONLY_RE.test(segment)) sweepDirs.add(runDir);
|
|
469
|
+
if (isFormatterWriteSegment(segment)) sweepDirs.add(runDir);
|
|
470
|
+
const stashDir = gitStashRewriteDir(segment, runDir);
|
|
471
|
+
if (stashDir !== null) sweepDirs.add(stashDir);
|
|
414
472
|
for (const f of extractSedInPlaceFiles(segment)) paths.push(atRunDir(f));
|
|
415
473
|
for (const f of extractTeeFiles(segment)) paths.push(atRunDir(f));
|
|
416
474
|
for (const f of extractRedirectTargets(segment)) paths.push(atRunDir(f));
|
|
417
475
|
}
|
|
418
|
-
|
|
419
|
-
for (const p of
|
|
476
|
+
for (const p of new Set(paths)) enqueueRewrittenPath(p);
|
|
477
|
+
for (const dir of sweepDirs) for (const p of workingTreeStatusPaths(dir)) enqueueSweptPath(p);
|
|
478
|
+
}
|
|
479
|
+
function enqueueSweptPath(absPath) {
|
|
480
|
+
try {
|
|
481
|
+
if (!statSync(absPath).isFile()) return;
|
|
482
|
+
} catch (err) {
|
|
483
|
+
const code = err.code;
|
|
484
|
+
if (code !== "ENOENT" && code !== "ENOTDIR") return;
|
|
485
|
+
}
|
|
486
|
+
enqueueDirtyPathSafe(absPath, { alreadyResolved: true });
|
|
420
487
|
}
|
|
421
488
|
var PIPELINE_PASSTHROUGH_HEADS = /* @__PURE__ */ new Set(["head", "tail", "cat", "tee", "less", "more"]);
|
|
422
489
|
var CI_FILTER_NAMES = /^(?:generic-ci|jest|vitest|pytest|go_test|cargo_test|cargo|go|make|cmake|gradle|maven|dotnet|turbo|nx|lerna|webpack|eslint|ruff|clippy|flake8|mypy|prettier|tsc)$/;
|
|
@@ -702,7 +769,7 @@ function detectUnbalancedShellSyntax(cmd) {
|
|
|
702
769
|
export {
|
|
703
770
|
runRecallCommand,
|
|
704
771
|
stripCdPrefix,
|
|
705
|
-
|
|
772
|
+
stripGroupAndExports,
|
|
706
773
|
stripCommandPrefix,
|
|
707
774
|
stripTrailingStderrRedirect,
|
|
708
775
|
hasTestRunScopeOrBudget,
|
|
@@ -718,7 +785,7 @@ export {
|
|
|
718
785
|
isHeadMovingGitCommand,
|
|
719
786
|
ORIG_HEAD_ELIGIBLE_GIT_RE,
|
|
720
787
|
ORIG_HEAD_REFLOG_MSG_RE,
|
|
721
|
-
|
|
788
|
+
gitRepoRootOrNull,
|
|
722
789
|
enqueueNonHeadMovingRewrites,
|
|
723
790
|
PIPELINE_PASSTHROUGH_HEADS,
|
|
724
791
|
pipelineShapeFilter,
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
evaluateVerification
|
|
5
|
+
} from "./token-goat-chunk-2WLPWKHV.mjs";
|
|
6
|
+
import {
|
|
7
|
+
dropsStopContext
|
|
8
|
+
} from "./token-goat-chunk-PJZXIS3G.mjs";
|
|
9
|
+
import {
|
|
10
|
+
sessionSidecarPath
|
|
11
|
+
} from "./token-goat-chunk-WBA5SKT4.mjs";
|
|
12
|
+
import "./token-goat-chunk-KQBLRPBN.mjs";
|
|
13
|
+
import "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
14
|
+
import {
|
|
15
|
+
sessionStateKey
|
|
16
|
+
} from "./token-goat-chunk-C75NA7PL.mjs";
|
|
17
|
+
import {
|
|
18
|
+
contextOutput,
|
|
19
|
+
passOutput
|
|
20
|
+
} from "./token-goat-chunk-76FGDLRO.mjs";
|
|
21
|
+
import "./token-goat-chunk-GL3ETKSC.mjs";
|
|
22
|
+
import "./token-goat-chunk-IK2DRMFX.mjs";
|
|
23
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
24
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
25
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
26
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
27
|
+
import "./token-goat-chunk-4GILLLWY.mjs";
|
|
28
|
+
import "./token-goat-chunk-BFCWY73P.mjs";
|
|
29
|
+
import "./token-goat-chunk-KGEFFSHD.mjs";
|
|
30
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
31
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
32
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
33
|
+
import {
|
|
34
|
+
loadConfig
|
|
35
|
+
} from "./token-goat-chunk-7EZTZOMC.mjs";
|
|
36
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
37
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
38
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
39
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
40
|
+
import {
|
|
41
|
+
ensureDirSync,
|
|
42
|
+
isWithinQuietHours
|
|
43
|
+
} from "./token-goat-chunk-HU4TORC5.mjs";
|
|
44
|
+
import {
|
|
45
|
+
echoedCommand,
|
|
46
|
+
nameSubject
|
|
47
|
+
} from "./token-goat-chunk-GGGG7RWB.mjs";
|
|
48
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
49
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
50
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
51
|
+
import {
|
|
52
|
+
init_define_import_meta_env
|
|
53
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
54
|
+
|
|
55
|
+
// src/hooks_stop.ts
|
|
56
|
+
init_define_import_meta_env();
|
|
57
|
+
import { createHash } from "node:crypto";
|
|
58
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
59
|
+
import { dirname } from "node:path";
|
|
60
|
+
var ADVISED_SUFFIX = ".stop-advised";
|
|
61
|
+
var MAX_NAMED_FILES = 5;
|
|
62
|
+
function stopAdvisoryText(state) {
|
|
63
|
+
const parts = [];
|
|
64
|
+
if (state.editedSinceLastPass.length > 0) {
|
|
65
|
+
const named = state.editedSinceLastPass.slice(0, MAX_NAMED_FILES).map((name) => nameSubject("file", name)).join(", ");
|
|
66
|
+
const more = state.editedSinceLastPass.length - MAX_NAMED_FILES;
|
|
67
|
+
parts.push(`edited since the last passing check: ${named}${more > 0 ? ` (+${more} more)` : ""}`);
|
|
68
|
+
}
|
|
69
|
+
if (state.failingUnresolved && state.latestRun !== void 0) parts.push(`the last check failed: ${echoedCommand(state.latestRun.command)} (exit ${state.latestRun.exitCode})`);
|
|
70
|
+
else if (state.editedSinceLastPass.length > 0 && state.latestRun !== void 0) parts.push(`last check run: ${echoedCommand(state.latestRun.command)}`);
|
|
71
|
+
else if (state.editedSinceLastPass.length > 0) parts.push("no test, lint, typecheck or build was run this session");
|
|
72
|
+
return parts.length === 0 ? null : `token-goat: unverified work before you stop. ${parts.join("; ")}.`;
|
|
73
|
+
}
|
|
74
|
+
function readAdvised(target) {
|
|
75
|
+
try {
|
|
76
|
+
return readFileSync(target, "utf8");
|
|
77
|
+
} catch {
|
|
78
|
+
return "";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function stopHandler(event) {
|
|
82
|
+
try {
|
|
83
|
+
if (event.raw["stop_hook_active"] === true) return passOutput();
|
|
84
|
+
const config = loadConfig().hints;
|
|
85
|
+
if (!config.stop_verification_advisory || isWithinQuietHours(config.quiet_hours) || dropsStopContext()) return passOutput();
|
|
86
|
+
const key = sessionStateKey(event);
|
|
87
|
+
const state = evaluateVerification(key);
|
|
88
|
+
const text = stopAdvisoryText(state);
|
|
89
|
+
const target = sessionSidecarPath(key, ADVISED_SUFFIX);
|
|
90
|
+
const signature = text === null ? "" : createHash("sha256").update(text).digest("hex").slice(0, 16);
|
|
91
|
+
if (target !== null) {
|
|
92
|
+
if (readAdvised(target) === signature) return passOutput();
|
|
93
|
+
try {
|
|
94
|
+
ensureDirSync(dirname(target));
|
|
95
|
+
writeFileSync(target, signature, "utf8");
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return text === null ? passOutput() : contextOutput(text);
|
|
100
|
+
} catch {
|
|
101
|
+
return passOutput();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
stopAdvisoryText,
|
|
106
|
+
stopHandler
|
|
107
|
+
};
|