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,135 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
readSessionStateFile
|
|
5
|
+
} from "./token-goat-chunk-WBA5SKT4.mjs";
|
|
6
|
+
import {
|
|
7
|
+
isLintCommand
|
|
8
|
+
} from "./token-goat-chunk-KQBLRPBN.mjs";
|
|
9
|
+
import {
|
|
10
|
+
isTestRunnerCommand
|
|
11
|
+
} from "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
12
|
+
import {
|
|
13
|
+
recordVerificationRun
|
|
14
|
+
} from "./token-goat-chunk-GL3ETKSC.mjs";
|
|
15
|
+
import {
|
|
16
|
+
detectLanguage,
|
|
17
|
+
languageHasFlag
|
|
18
|
+
} from "./token-goat-chunk-GVB2MUST.mjs";
|
|
19
|
+
import {
|
|
20
|
+
redactSecrets
|
|
21
|
+
} from "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
22
|
+
import {
|
|
23
|
+
detectHarness
|
|
24
|
+
} from "./token-goat-chunk-QYHO5CPH.mjs";
|
|
25
|
+
import {
|
|
26
|
+
displaySafePath
|
|
27
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
28
|
+
import {
|
|
29
|
+
init_define_import_meta_env
|
|
30
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
31
|
+
|
|
32
|
+
// src/verification_state.ts
|
|
33
|
+
init_define_import_meta_env();
|
|
34
|
+
var OTHER_VERIFICATION_PATTERNS = [
|
|
35
|
+
/^(?:npx\s+)?tsc(?:\s|$)/i,
|
|
36
|
+
/^(?:npm|pnpm|yarn)\s+(?:run(?:-script)?\s+)?(?:test|build|lint|typecheck|type-check|check|compile|verify)(?::[\w:-]+)?(?:\s|$)/i,
|
|
37
|
+
/^cargo\s+(?:build|check|clippy|test)\b/i,
|
|
38
|
+
/^go\s+(?:build|vet|test)\b/i,
|
|
39
|
+
/^dotnet\s+(?:build|test)\b/i,
|
|
40
|
+
/^(?:mypy|pyright)(?:\s|$)/i,
|
|
41
|
+
/^python3?\s+-m\s+(?:mypy|pyright|ruff|pytest)\b/i
|
|
42
|
+
];
|
|
43
|
+
var ENV_ASSIGNMENT_PREFIX = /^(?:[A-Za-z_][A-Za-z0-9_]*=\S*\s+)+/;
|
|
44
|
+
var COMMAND_SEPARATOR = /(&&|\|\||[;|\n]|(?<![>&|])&(?![>&]))/;
|
|
45
|
+
function isVerificationSegment(segment) {
|
|
46
|
+
const trimmed = segment.trim().replace(ENV_ASSIGNMENT_PREFIX, "");
|
|
47
|
+
return trimmed !== "" && (isTestRunnerCommand(trimmed) || isLintCommand(trimmed) || OTHER_VERIFICATION_PATTERNS.some((re) => re.test(trimmed)));
|
|
48
|
+
}
|
|
49
|
+
function isVerificationCommand(command) {
|
|
50
|
+
return command.split(COMMAND_SEPARATOR).some(isVerificationSegment);
|
|
51
|
+
}
|
|
52
|
+
var PIPEFAIL_STATEMENT = /^set\s+(?:[-+]\w+\s+|[-+]o\s+\w+\s+)*([-+])\w*o\s+pipefail\b/;
|
|
53
|
+
function exitStatusIsCheckVerdict(command) {
|
|
54
|
+
const parts = command.replace(/[;\s]+$/, "").split(COMMAND_SEPARATOR);
|
|
55
|
+
const first = parts.findIndex(isVerificationSegment);
|
|
56
|
+
let pipefail = false;
|
|
57
|
+
parts.slice(0, first).forEach((part, i) => {
|
|
58
|
+
const statement = i % 2 === 0 ? PIPEFAIL_STATEMENT.exec(part.trim()) : null;
|
|
59
|
+
if (statement !== null) pipefail = statement[1] === "-";
|
|
60
|
+
});
|
|
61
|
+
const allowed = pipefail ? ["&&", "|"] : ["&&"];
|
|
62
|
+
return first >= 0 && parts[first - 1] !== "||" && parts.slice(first + 1).every((part, i) => i % 2 === 1 || allowed.includes(part));
|
|
63
|
+
}
|
|
64
|
+
function successImpliedWithoutStatus() {
|
|
65
|
+
const harness = detectHarness();
|
|
66
|
+
return harness === "claudecode" || harness === "copilot_cli";
|
|
67
|
+
}
|
|
68
|
+
var STORED_COMMAND_MAX_CHARS = 200;
|
|
69
|
+
function storedCommand(command) {
|
|
70
|
+
const checks = command.split(COMMAND_SEPARATOR).filter((_part, i) => i % 2 === 0).map((segment) => segment.trim()).filter(isVerificationSegment).map((segment) => segment.replace(ENV_ASSIGNMENT_PREFIX, "").replace(/\s+/g, " ")).map((segment) => redactSecrets(allowListed(segment)).text);
|
|
71
|
+
return checks.join("; ").slice(0, STORED_COMMAND_MAX_CHARS);
|
|
72
|
+
}
|
|
73
|
+
var CHECK_HEAD = /^(?:(?:npx\s+)?(?:jest|vitest(?:\s+(?:run|watch))?|eslint|tsc|mypy|pyright)|pytest|(?:uv\s+run\s+)?ruff(?:\s+(?:check|format))?|go\s+(?:test|build|vet)|cargo\s+(?:test|build|check|clippy)|dotnet\s+(?:build|test)|(?:npm|pnpm|yarn)\s+(?:run(?:-script)?\s+)?(?:test|build|lint|typecheck|type-check|check|compile|verify)(?::[\w:-]+)?|python3?\s+-m\s+(?:mypy|pyright|ruff|pytest))(?=\s|$)/i;
|
|
74
|
+
var SAFE_FLAGS = /* @__PURE__ */ new Set(["--", "--ci", "--run", "--watch", "--watch=false", "--watchAll=false", "--coverage", "--bail", "--verbose", "--silent", "--no-color", "--noEmit", "--passWithNoTests", "--release", "--locked", "--all-targets", "-x", "-q", "-v", "-vv"]);
|
|
75
|
+
var SAFE_REPORTER = /^--reporter=(?:default|verbose|dot|basic|json|junit|tap|spec|min|list|agent)$/;
|
|
76
|
+
var PATH_SHAPE = /^[\w./@~][\w./@:\\-]*$/;
|
|
77
|
+
var PATH_EVIDENCE = /[/\\]|::|\.[A-Za-z]\w*$/;
|
|
78
|
+
var DRIVE_PREFIX = /^[A-Za-z]:[/\\]/;
|
|
79
|
+
var JWT_SHAPE = /^eyJ[\w-]*\.[\w-]+\.[\w-]*$/;
|
|
80
|
+
var DROPPED_MARK = "\u2026";
|
|
81
|
+
function looksLikePathOrSelector(word) {
|
|
82
|
+
if (!PATH_SHAPE.test(word) || !PATH_EVIDENCE.test(word)) return false;
|
|
83
|
+
return !JWT_SHAPE.test(word) && !word.replace(DRIVE_PREFIX, "").replace(/::/g, "").includes(":");
|
|
84
|
+
}
|
|
85
|
+
function allowListed(segment) {
|
|
86
|
+
const headMatch = CHECK_HEAD.exec(segment);
|
|
87
|
+
const head = headMatch?.[0] ?? /^[A-Za-z]+/.exec(segment)?.[0] ?? "";
|
|
88
|
+
const kept = [head];
|
|
89
|
+
let dropped = headMatch === null;
|
|
90
|
+
let afterDroppedFlag = false;
|
|
91
|
+
for (const word of segment.slice(head.length).split(" ")) {
|
|
92
|
+
if (word === "") continue;
|
|
93
|
+
const safe = SAFE_FLAGS.has(word) || SAFE_REPORTER.test(word) || !afterDroppedFlag && looksLikePathOrSelector(word);
|
|
94
|
+
if (safe) kept.push(word);
|
|
95
|
+
else dropped = true;
|
|
96
|
+
afterDroppedFlag = !safe && word.startsWith("-") && !word.includes("=");
|
|
97
|
+
}
|
|
98
|
+
if (dropped) kept.push(DROPPED_MARK);
|
|
99
|
+
return kept.filter((w) => w !== "").join(" ");
|
|
100
|
+
}
|
|
101
|
+
function noteVerificationRun(command, exitCode, runInBackground) {
|
|
102
|
+
if (runInBackground || !isVerificationCommand(command) || !exitStatusIsCheckVerdict(command)) return;
|
|
103
|
+
recordVerificationRun(storedCommand(command), exitCode ?? (successImpliedWithoutStatus() ? 0 : null));
|
|
104
|
+
}
|
|
105
|
+
var EXIT_CODE_IN_ERROR = /^Exit code (\d+)/;
|
|
106
|
+
function noteFailedVerificationRun(command, errorText, isInterrupt) {
|
|
107
|
+
if (isInterrupt || !isVerificationCommand(command)) return;
|
|
108
|
+
const status = EXIT_CODE_IN_ERROR.exec(errorText);
|
|
109
|
+
const exitCode = status !== null && Number(status[1]) !== 0 ? Number(status[1]) : 1;
|
|
110
|
+
recordVerificationRun(storedCommand(command), exitCode);
|
|
111
|
+
}
|
|
112
|
+
function evaluateVerification(stateKey) {
|
|
113
|
+
const state = readSessionStateFile(stateKey);
|
|
114
|
+
const runs = state?.verificationRuns ?? [];
|
|
115
|
+
const latestRun = runs.reduce((latest, run) => latest === void 0 || run.at >= latest.at ? run : latest, void 0);
|
|
116
|
+
const lastPassAt = runs.reduce((at, run) => run.exitCode === null || run.exitCode === 0 ? Math.max(at, run.at) : at, -1);
|
|
117
|
+
const edited = (state?.files ?? []).filter((f) => f.wasEdited && f.lastEditedAt !== void 0 && languageHasFlag(detectLanguage(f.path), "sourceHints"));
|
|
118
|
+
const names = (files) => [...new Set(files.map((f) => displaySafePath(f.path.split(/[/\\]/).pop() ?? f.path)))].sort();
|
|
119
|
+
return {
|
|
120
|
+
runs,
|
|
121
|
+
...latestRun !== void 0 ? { latestRun } : {},
|
|
122
|
+
failingUnresolved: latestRun !== void 0 && latestRun.exitCode !== null && latestRun.exitCode !== 0,
|
|
123
|
+
editedFiles: names(edited),
|
|
124
|
+
editedAnyFile: (state?.files ?? []).some((f) => f.wasEdited),
|
|
125
|
+
editedSinceLastPass: names(edited.filter((f) => (f.lastEditedAt ?? 0) > lastPassAt))
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
isVerificationCommand,
|
|
131
|
+
exitStatusIsCheckVerdict,
|
|
132
|
+
noteVerificationRun,
|
|
133
|
+
noteFailedVerificationRun,
|
|
134
|
+
evaluateVerification
|
|
135
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
getDb
|
|
5
|
+
} from "./token-goat-chunk-GVB2MUST.mjs";
|
|
6
|
+
import {
|
|
7
|
+
compileGuardedRegex,
|
|
8
|
+
extractErrorMessage
|
|
9
|
+
} from "./token-goat-chunk-HU4TORC5.mjs";
|
|
10
|
+
import {
|
|
11
|
+
SYMBOL_BODY_CHAR_CAP
|
|
12
|
+
} from "./token-goat-chunk-CO3UYX6G.mjs";
|
|
13
|
+
import {
|
|
14
|
+
init_define_import_meta_env
|
|
15
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
16
|
+
|
|
17
|
+
// src/cli_commands.ts
|
|
18
|
+
init_define_import_meta_env();
|
|
19
|
+
function toEntry(cmd) {
|
|
20
|
+
return {
|
|
21
|
+
name: cmd.name(),
|
|
22
|
+
description: cmd.description(),
|
|
23
|
+
aliases: cmd.aliases(),
|
|
24
|
+
options: cmd.options.map((o) => ({ flags: o.flags, description: o.description })),
|
|
25
|
+
arguments: cmd.registeredArguments.map((a) => ({ name: a.name(), description: a.description, required: a.required })),
|
|
26
|
+
subcommands: cmd.commands.filter((sub) => sub.name() !== "help").map(toEntry)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function buildCommandManifest(program) {
|
|
30
|
+
return program.commands.filter((cmd) => cmd.name() !== "help").map(toEntry);
|
|
31
|
+
}
|
|
32
|
+
function flattenCommandNames(manifest) {
|
|
33
|
+
const names = [];
|
|
34
|
+
for (const entry of manifest) {
|
|
35
|
+
names.push(entry.name);
|
|
36
|
+
for (const sub of entry.subcommands) {
|
|
37
|
+
names.push(`${entry.name} ${sub.name}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return names;
|
|
41
|
+
}
|
|
42
|
+
function entryMatches(entry, re, pattern) {
|
|
43
|
+
const haystacks = [entry.name, entry.description, ...entry.aliases];
|
|
44
|
+
return haystacks.some((h) => re !== null ? re.test(h) : h.includes(pattern));
|
|
45
|
+
}
|
|
46
|
+
function filterCommandManifest(manifest, pattern) {
|
|
47
|
+
const guarded = compileGuardedRegex(pattern);
|
|
48
|
+
const re = guarded.ok ? guarded.re : null;
|
|
49
|
+
const result = [];
|
|
50
|
+
for (const entry of manifest) {
|
|
51
|
+
if (entryMatches(entry, re, pattern)) {
|
|
52
|
+
result.push(entry);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const matchingSubs = entry.subcommands.filter((sub) => entryMatches(sub, re, pattern));
|
|
56
|
+
if (matchingSubs.length > 0) {
|
|
57
|
+
result.push({ ...entry, subcommands: matchingSubs });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
function formatCommandManifest(manifest) {
|
|
63
|
+
const lines = [];
|
|
64
|
+
lines.push("# token-goat commands");
|
|
65
|
+
lines.push("");
|
|
66
|
+
for (const entry of manifest) {
|
|
67
|
+
lines.push(`## ${entry.name}${entry.aliases.length ? " (alias: " + entry.aliases.join(", ") + ")" : ""}${entry.description ? " -- " + entry.description : ""}`);
|
|
68
|
+
for (const arg of entry.arguments) {
|
|
69
|
+
lines.push(` arg: ${arg.name}${arg.required ? "" : " (optional)"}${arg.description ? " -- " + arg.description : ""}`);
|
|
70
|
+
}
|
|
71
|
+
for (const opt of entry.options) {
|
|
72
|
+
lines.push(` ${opt.flags}${opt.description ? " -- " + opt.description : ""}`);
|
|
73
|
+
}
|
|
74
|
+
for (const sub of entry.subcommands) {
|
|
75
|
+
lines.push(` ${entry.name} ${sub.name}${sub.description ? " -- " + sub.description : ""}`);
|
|
76
|
+
}
|
|
77
|
+
lines.push("");
|
|
78
|
+
}
|
|
79
|
+
return lines.join("\n").trimEnd();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/symbol_body_probe.ts
|
|
83
|
+
init_define_import_meta_env();
|
|
84
|
+
import * as fs from "fs";
|
|
85
|
+
var OVERSIZED_BODY_PROBE_SQL = `SELECT 1 FROM symbols WHERE LENGTH(body) > ${SYMBOL_BODY_CHAR_CAP} LIMIT 1`;
|
|
86
|
+
function checkSymbolBodySize(dbPath) {
|
|
87
|
+
if (!fs.existsSync(dbPath)) {
|
|
88
|
+
return { name: "Symbol body size", status: "ok", message: "no database yet" };
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const db = getDb(dbPath);
|
|
92
|
+
const row = db.prepare(OVERSIZED_BODY_PROBE_SQL).get();
|
|
93
|
+
if (row !== void 0) {
|
|
94
|
+
return {
|
|
95
|
+
name: "Symbol body size",
|
|
96
|
+
status: "warn",
|
|
97
|
+
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`
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return { name: "Symbol body size", status: "ok", message: "no stored symbol body exceeds the cap" };
|
|
101
|
+
} catch (err) {
|
|
102
|
+
return {
|
|
103
|
+
name: "Symbol body size",
|
|
104
|
+
status: "warn",
|
|
105
|
+
message: `could not query symbol body size: ${extractErrorMessage(err)}`
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// src/session_reminder.ts
|
|
111
|
+
init_define_import_meta_env();
|
|
112
|
+
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.';
|
|
113
|
+
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.';
|
|
114
|
+
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.';
|
|
115
|
+
function buildReminder(indexed) {
|
|
116
|
+
return (indexed ? INDEXED_REMINDER : GENERIC_REMINDER) + NOTE_REMINDER;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
buildCommandManifest,
|
|
121
|
+
flattenCommandNames,
|
|
122
|
+
filterCommandManifest,
|
|
123
|
+
formatCommandManifest,
|
|
124
|
+
checkSymbolBodySize,
|
|
125
|
+
buildReminder
|
|
126
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
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/secret_file_names.ts
|
|
8
|
+
init_define_import_meta_env();
|
|
9
|
+
var ENV_TEMPLATES = /* @__PURE__ */ new Set([".env.example", ".env.sample"]);
|
|
10
|
+
var SECRET_BASE_NAMES = /* @__PURE__ */ new Set([".pgpass", ".git-credentials"]);
|
|
11
|
+
function isSecretFileName(path) {
|
|
12
|
+
const parts = path.split(/[\\/]/);
|
|
13
|
+
const lower = (parts[parts.length - 1] ?? "").toLowerCase();
|
|
14
|
+
const parent = (parts[parts.length - 2] ?? "").toLowerCase();
|
|
15
|
+
if (lower === ".env" || lower.startsWith(".env.")) return !ENV_TEMPLATES.has(lower);
|
|
16
|
+
if (lower.startsWith("id_")) return !lower.endsWith(".pub");
|
|
17
|
+
if (lower === "config" && parent === ".aws") return true;
|
|
18
|
+
return SECRET_BASE_NAMES.has(lower) || /\.(?:pem|key|p12|pfx|kdbx?|tfstate(?:\.backup)?)$|^\.n(?:pm|et)rc$|^credentials|^secrets\.ya?ml$/.test(lower);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
isSecretFileName
|
|
23
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
suggestPaths
|
|
5
|
+
} from "./token-goat-chunk-EC5F37F4.mjs";
|
|
6
|
+
import "./token-goat-chunk-ZNMNUPAZ.mjs";
|
|
7
|
+
import "./token-goat-chunk-32ZOY4N5.mjs";
|
|
8
|
+
import {
|
|
9
|
+
splitShellSegments
|
|
10
|
+
} from "./token-goat-chunk-DGS2LVNA.mjs";
|
|
11
|
+
import "./token-goat-chunk-INNPTRUX.mjs";
|
|
12
|
+
import "./token-goat-chunk-QH7YVYOY.mjs";
|
|
13
|
+
import "./token-goat-chunk-NOSS5VWY.mjs";
|
|
14
|
+
import "./token-goat-chunk-NMD42SFQ.mjs";
|
|
15
|
+
import "./token-goat-chunk-SAMFDIS2.mjs";
|
|
16
|
+
import {
|
|
17
|
+
applyHintTracking,
|
|
18
|
+
uncorrelatedHint
|
|
19
|
+
} from "./token-goat-chunk-4SMRO4TO.mjs";
|
|
20
|
+
import {
|
|
21
|
+
sessionSidecarPath
|
|
22
|
+
} from "./token-goat-chunk-WBA5SKT4.mjs";
|
|
23
|
+
import "./token-goat-chunk-MNWKPRAL.mjs";
|
|
24
|
+
import "./token-goat-chunk-CIMQ2BB3.mjs";
|
|
25
|
+
import "./token-goat-chunk-WDH44VAU.mjs";
|
|
26
|
+
import "./token-goat-chunk-BPGCUMR7.mjs";
|
|
27
|
+
import "./token-goat-chunk-KQBLRPBN.mjs";
|
|
28
|
+
import "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
29
|
+
import {
|
|
30
|
+
sessionStateKey
|
|
31
|
+
} from "./token-goat-chunk-C75NA7PL.mjs";
|
|
32
|
+
import "./token-goat-chunk-P6VGNTQT.mjs";
|
|
33
|
+
import {
|
|
34
|
+
contextOutput,
|
|
35
|
+
getCwd
|
|
36
|
+
} from "./token-goat-chunk-76FGDLRO.mjs";
|
|
37
|
+
import "./token-goat-chunk-GL3ETKSC.mjs";
|
|
38
|
+
import "./token-goat-chunk-OXFMP75N.mjs";
|
|
39
|
+
import "./token-goat-chunk-NISNMD7T.mjs";
|
|
40
|
+
import "./token-goat-chunk-EVMZJ27Z.mjs";
|
|
41
|
+
import "./token-goat-chunk-IK2DRMFX.mjs";
|
|
42
|
+
import "./token-goat-chunk-5Y6ZYL6U.mjs";
|
|
43
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
44
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
45
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
46
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
47
|
+
import "./token-goat-chunk-3BTK54F3.mjs";
|
|
48
|
+
import "./token-goat-chunk-4GILLLWY.mjs";
|
|
49
|
+
import "./token-goat-chunk-BFCWY73P.mjs";
|
|
50
|
+
import "./token-goat-chunk-KGEFFSHD.mjs";
|
|
51
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
52
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
53
|
+
import "./token-goat-chunk-F6PAUIEK.mjs";
|
|
54
|
+
import "./token-goat-chunk-65N4RHP4.mjs";
|
|
55
|
+
import "./token-goat-chunk-X2SUP3EI.mjs";
|
|
56
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
57
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
58
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
59
|
+
import {
|
|
60
|
+
resolveProjectRoot
|
|
61
|
+
} from "./token-goat-chunk-4GBVPH3D.mjs";
|
|
62
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
63
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
64
|
+
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
65
|
+
import {
|
|
66
|
+
atomicWriteText,
|
|
67
|
+
ensureDirSync
|
|
68
|
+
} from "./token-goat-chunk-HU4TORC5.mjs";
|
|
69
|
+
import {
|
|
70
|
+
canQuoteArg,
|
|
71
|
+
echoedValue,
|
|
72
|
+
fencedCommand,
|
|
73
|
+
quotedArg
|
|
74
|
+
} from "./token-goat-chunk-GGGG7RWB.mjs";
|
|
75
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
76
|
+
import {
|
|
77
|
+
displaySafeText
|
|
78
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
79
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
80
|
+
import {
|
|
81
|
+
init_define_import_meta_env
|
|
82
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
83
|
+
|
|
84
|
+
// src/path_miss.ts
|
|
85
|
+
init_define_import_meta_env();
|
|
86
|
+
import { createHash } from "node:crypto";
|
|
87
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
88
|
+
import { dirname, resolve } from "node:path";
|
|
89
|
+
var SEEN_SUFFIX = ".path-miss";
|
|
90
|
+
var MAX_SEEN = 50;
|
|
91
|
+
var MAX_MISSING_PATHS = 2;
|
|
92
|
+
var MAX_PATH_CHARS = 512;
|
|
93
|
+
var MAX_LINE_CHARS = 2048;
|
|
94
|
+
var TOOL_PATH_KEYS = ["file_path", "notebook_path", "path", "TargetFile"];
|
|
95
|
+
var QUOTED_PATH_PATTERNS = [
|
|
96
|
+
/(?:cannot|can't|could not) (?:access|open|stat|read|find)(?: file)? '([^']+)'.*No such file or directory/,
|
|
97
|
+
/ENOENT: no such file or directory, \w+ '([^']+)'/
|
|
98
|
+
];
|
|
99
|
+
var SHELL_PREFIX = /^(?:(?:[\w.+-]+|line \d+): )+/;
|
|
100
|
+
var NO_SUCH_FILE = /:\s*No such file or directory\s*$/;
|
|
101
|
+
function missingPathsFromStderr(errorText) {
|
|
102
|
+
const found = [];
|
|
103
|
+
for (const raw of errorText.split(/\r?\n/)) {
|
|
104
|
+
const line = raw.trim();
|
|
105
|
+
if (raw.length > MAX_LINE_CHARS || !/No such file or directory/i.test(line)) continue;
|
|
106
|
+
let target;
|
|
107
|
+
for (const pattern of QUOTED_PATH_PATTERNS) {
|
|
108
|
+
target = pattern.exec(line)?.[1];
|
|
109
|
+
if (target !== void 0) break;
|
|
110
|
+
}
|
|
111
|
+
if (target === void 0 && NO_SUCH_FILE.test(line)) target = line.replace(NO_SUCH_FILE, "").replace(SHELL_PREFIX, "");
|
|
112
|
+
if (target !== void 0 && target !== "" && target.length <= MAX_PATH_CHARS && !found.includes(target)) found.push(target);
|
|
113
|
+
}
|
|
114
|
+
return found;
|
|
115
|
+
}
|
|
116
|
+
var FILE_TOOLS = /* @__PURE__ */ new Set(["read", "view", "edit", "multiedit", "write", "create", "notebookedit", "grep", "glob", "str_replace_editor", "str_replace_based_edit_tool", "view_file", "read_file", "write_to_file", "replace_file_content", "create_file", "replace_string_in_file", "list_dir"]);
|
|
117
|
+
function pathFromToolInput(event, toolName) {
|
|
118
|
+
if (toolName === void 0 || !FILE_TOOLS.has(toolName.toLowerCase())) return void 0;
|
|
119
|
+
for (const key of TOOL_PATH_KEYS) {
|
|
120
|
+
const value = event.toolInput[key];
|
|
121
|
+
if (typeof value === "string" && value !== "") return value;
|
|
122
|
+
}
|
|
123
|
+
return void 0;
|
|
124
|
+
}
|
|
125
|
+
function seenPath(event) {
|
|
126
|
+
return event.sessionId ? sessionSidecarPath(sessionStateKey(event), SEEN_SUFFIX) : null;
|
|
127
|
+
}
|
|
128
|
+
function readSeen(target) {
|
|
129
|
+
try {
|
|
130
|
+
const parsed = JSON.parse(readFileSync(target, "utf8"));
|
|
131
|
+
return Array.isArray(parsed) ? parsed.filter((entry) => typeof entry === "string") : [];
|
|
132
|
+
} catch {
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function writeSeen(target, seen) {
|
|
137
|
+
try {
|
|
138
|
+
ensureDirSync(dirname(target));
|
|
139
|
+
atomicWriteText(target, JSON.stringify(seen.slice(-MAX_SEEN)));
|
|
140
|
+
} catch {
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function signatureOf(cwd, missing) {
|
|
144
|
+
return createHash("sha256").update(`${cwd}\0${missing}`).digest("hex").slice(0, 16);
|
|
145
|
+
}
|
|
146
|
+
function fencedCandidate(candidate) {
|
|
147
|
+
const shown = displaySafeText(candidate);
|
|
148
|
+
if (shown !== candidate || shown.includes("`") || !canQuoteArg(shown)) return null;
|
|
149
|
+
return fencedCommand(quotedArg(shown));
|
|
150
|
+
}
|
|
151
|
+
function commandWords(command) {
|
|
152
|
+
return splitShellSegments(command).flatMap((segment) => Array.from(segment.matchAll(/"([^"]*)"|'([^']*)'|(\S+)/g), (m) => m[1] ?? m[2] ?? m[3] ?? ""));
|
|
153
|
+
}
|
|
154
|
+
function isMissingArgument(path, command, cwd) {
|
|
155
|
+
return commandWords(command).includes(path) && !existsSync(resolve(cwd, path));
|
|
156
|
+
}
|
|
157
|
+
function pathMissAfterFailure(event, failure) {
|
|
158
|
+
try {
|
|
159
|
+
const target = seenPath(event);
|
|
160
|
+
if (target === null) return null;
|
|
161
|
+
const cwd = getCwd(event) ?? process.cwd();
|
|
162
|
+
const reported = failure.toolName === "Bash" ? missingPathsFromStderr(failure.errorText) : [pathFromToolInput(event, failure.toolName)].filter((p) => p !== void 0);
|
|
163
|
+
const ranCommand = failure.ranCommand;
|
|
164
|
+
const named = ranCommand === void 0 ? reported : reported.filter((p) => isMissingArgument(p, ranCommand, cwd));
|
|
165
|
+
if (named.length === 0) return null;
|
|
166
|
+
const rootDir = resolveProjectRoot({ project: cwd });
|
|
167
|
+
const seen = readSeen(target);
|
|
168
|
+
const lines = [];
|
|
169
|
+
for (const missing of named.slice(0, MAX_MISSING_PATHS)) {
|
|
170
|
+
const signature = signatureOf(cwd, missing);
|
|
171
|
+
if (seen.includes(signature)) continue;
|
|
172
|
+
seen.push(signature);
|
|
173
|
+
const fenced = suggestPaths(missing, cwd, rootDir).map(fencedCandidate).filter((c) => c !== null);
|
|
174
|
+
if (fenced.length === 0) continue;
|
|
175
|
+
lines.push(`[token-goat] ${echoedValue(missing)} does not exist. Existing paths that look like it:`, ...fenced);
|
|
176
|
+
}
|
|
177
|
+
writeSeen(target, seen);
|
|
178
|
+
if (lines.length === 0) return null;
|
|
179
|
+
const out = applyHintTracking(event, contextOutput(lines.join("\n")), uncorrelatedHint("path_miss"));
|
|
180
|
+
return out.hookType === "context" ? out.context : null;
|
|
181
|
+
} catch {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
export {
|
|
186
|
+
missingPathsFromStderr,
|
|
187
|
+
pathMissAfterFailure
|
|
188
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
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-UZOROKIS.mjs";
|
|
8
|
+
import "./token-goat-chunk-M3LFJDPU.mjs";
|
|
9
|
+
import "./token-goat-chunk-ZNMNUPAZ.mjs";
|
|
10
|
+
import "./token-goat-chunk-PFWIMH2E.mjs";
|
|
11
|
+
import "./token-goat-chunk-OBOFIHKN.mjs";
|
|
12
|
+
import "./token-goat-chunk-QH7YVYOY.mjs";
|
|
13
|
+
import "./token-goat-chunk-NOSS5VWY.mjs";
|
|
14
|
+
import "./token-goat-chunk-NMD42SFQ.mjs";
|
|
15
|
+
import "./token-goat-chunk-SAMFDIS2.mjs";
|
|
16
|
+
import "./token-goat-chunk-4SMRO4TO.mjs";
|
|
17
|
+
import "./token-goat-chunk-WBA5SKT4.mjs";
|
|
18
|
+
import "./token-goat-chunk-MNWKPRAL.mjs";
|
|
19
|
+
import "./token-goat-chunk-CIMQ2BB3.mjs";
|
|
20
|
+
import "./token-goat-chunk-WDH44VAU.mjs";
|
|
21
|
+
import "./token-goat-chunk-BPGCUMR7.mjs";
|
|
22
|
+
import "./token-goat-chunk-KQBLRPBN.mjs";
|
|
23
|
+
import "./token-goat-chunk-4ZBFWLXF.mjs";
|
|
24
|
+
import "./token-goat-chunk-C75NA7PL.mjs";
|
|
25
|
+
import "./token-goat-chunk-P6VGNTQT.mjs";
|
|
26
|
+
import "./token-goat-chunk-76FGDLRO.mjs";
|
|
27
|
+
import "./token-goat-chunk-GL3ETKSC.mjs";
|
|
28
|
+
import "./token-goat-chunk-OXFMP75N.mjs";
|
|
29
|
+
import "./token-goat-chunk-NISNMD7T.mjs";
|
|
30
|
+
import "./token-goat-chunk-EVMZJ27Z.mjs";
|
|
31
|
+
import "./token-goat-chunk-IK2DRMFX.mjs";
|
|
32
|
+
import "./token-goat-chunk-5Y6ZYL6U.mjs";
|
|
33
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
34
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
35
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
36
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
37
|
+
import "./token-goat-chunk-3BTK54F3.mjs";
|
|
38
|
+
import "./token-goat-chunk-4GILLLWY.mjs";
|
|
39
|
+
import "./token-goat-chunk-BFCWY73P.mjs";
|
|
40
|
+
import "./token-goat-chunk-KGEFFSHD.mjs";
|
|
41
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
42
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
43
|
+
import "./token-goat-chunk-F6PAUIEK.mjs";
|
|
44
|
+
import "./token-goat-chunk-65N4RHP4.mjs";
|
|
45
|
+
import "./token-goat-chunk-X2SUP3EI.mjs";
|
|
46
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
47
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
48
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
49
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
50
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
51
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
52
|
+
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
53
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
54
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
55
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
56
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
57
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
58
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
59
|
+
export {
|
|
60
|
+
INSTALL_INDEX_ENV,
|
|
61
|
+
formatInstallIndexResult,
|
|
62
|
+
queueInstallIndex
|
|
63
|
+
};
|