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,34 +1,40 @@
|
|
|
1
1
|
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
commandPathIsTouchable
|
|
5
|
-
|
|
6
|
-
grepLinesHint,
|
|
7
|
-
leadWithCommand
|
|
8
|
-
} from "./token-goat-chunk-ATCPY7EQ.mjs";
|
|
4
|
+
commandPathIsTouchable
|
|
5
|
+
} from "./token-goat-chunk-P6VGNTQT.mjs";
|
|
9
6
|
import {
|
|
7
|
+
dropFileLineRangesIfChanged,
|
|
10
8
|
getFileLineRanges
|
|
11
|
-
} from "./token-goat-chunk-
|
|
9
|
+
} from "./token-goat-chunk-GL3ETKSC.mjs";
|
|
10
|
+
import {
|
|
11
|
+
hasBareBackgroundOrNewline,
|
|
12
|
+
hasUnquotedOperator,
|
|
13
|
+
isRedirectAmpersand
|
|
14
|
+
} from "./token-goat-chunk-4GILLLWY.mjs";
|
|
12
15
|
import {
|
|
13
16
|
isUnderSystemTemp
|
|
14
|
-
} from "./token-goat-chunk-
|
|
17
|
+
} from "./token-goat-chunk-4GBVPH3D.mjs";
|
|
15
18
|
import {
|
|
16
19
|
FALSY_ENV_VALUES
|
|
17
20
|
} from "./token-goat-chunk-IVE6U7KV.mjs";
|
|
18
21
|
import {
|
|
19
22
|
escapeRegExp
|
|
20
|
-
} from "./token-goat-chunk-
|
|
23
|
+
} from "./token-goat-chunk-HU4TORC5.mjs";
|
|
24
|
+
import {
|
|
25
|
+
configGetCommand,
|
|
26
|
+
docSectionHint,
|
|
27
|
+
grepLinesHint,
|
|
28
|
+
leadWithCommand,
|
|
29
|
+
quotedArg,
|
|
30
|
+
quotedArgs
|
|
31
|
+
} from "./token-goat-chunk-GGGG7RWB.mjs";
|
|
21
32
|
import {
|
|
22
33
|
TOOL_RESULTS_ID_CHARS,
|
|
23
34
|
hostPathOfIndexKey,
|
|
24
35
|
normalizePath,
|
|
25
36
|
resolveIndexPath
|
|
26
37
|
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
27
|
-
import {
|
|
28
|
-
hasBareBackgroundOrNewline,
|
|
29
|
-
hasUnquotedOperator,
|
|
30
|
-
isRedirectAmpersand
|
|
31
|
-
} from "./token-goat-chunk-KWPNJBDH.mjs";
|
|
32
38
|
import {
|
|
33
39
|
init_define_import_meta_env
|
|
34
40
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -37,14 +43,14 @@ import {
|
|
|
37
43
|
init_define_import_meta_env();
|
|
38
44
|
import { statSync, openSync, readSync, closeSync } from "node:fs";
|
|
39
45
|
function outlineCommand(shown) {
|
|
40
|
-
return
|
|
46
|
+
return "token-goat outline " + quotedArg(shown);
|
|
41
47
|
}
|
|
42
48
|
function structuredDataHint(hintPath, target, reason = "") {
|
|
43
49
|
const ext = /\.(json|ya?ml)$/i.exec(hintPath)?.[1];
|
|
44
50
|
if (ext === void 0) return null;
|
|
45
51
|
const fmt = ext.toLowerCase() === "json" ? "json" : "yaml";
|
|
46
|
-
const outline = "token-goat " + fmt +
|
|
47
|
-
const query = (path2) => "token-goat " + fmt +
|
|
52
|
+
const outline = "token-goat " + fmt + "-outline " + quotedArg(hintPath);
|
|
53
|
+
const query = (path2) => "token-goat " + fmt + "-query " + quotedArgs(hintPath, path2).join(" ");
|
|
48
54
|
if (target === null || /["'`$\\]/.test(target)) {
|
|
49
55
|
return leadWithCommand(outline, "to list the top-level keys with their type and size (`--filter TEXT` narrows a large one), then `" + query("KEY") + "` to read one value (`\"['a.b']\"` for a key holding a dot)", reason);
|
|
50
56
|
}
|
|
@@ -52,27 +58,27 @@ function structuredDataHint(hintPath, target, reason = "") {
|
|
|
52
58
|
return leadWithCommand(query(path), "to read that value, or `" + outline + "` for every top-level key with its type and size", reason);
|
|
53
59
|
}
|
|
54
60
|
function sqlTableHint(hintPath, target, reason = "") {
|
|
55
|
-
return leadWithCommand(
|
|
61
|
+
return leadWithCommand("token-goat read " + quotedArg(hintPath + "::" + target.name), "to pull one CREATE TABLE / CREATE TYPE block", reason);
|
|
56
62
|
}
|
|
57
63
|
function surgicalHintFor(hintPath, isEnv, isConfig, isDoc, isXml, target, reason = "") {
|
|
58
64
|
const outline = outlineCommand(hintPath);
|
|
59
|
-
if (isXml) return leadWithCommand(
|
|
60
|
-
if (isEnv) return leadWithCommand(
|
|
65
|
+
if (isXml) return leadWithCommand("token-goat xml-outline " + quotedArg(hintPath), "to inspect structure, or `token-goat xml-query " + quotedArgs(hintPath, "<selector>").join(" ") + "` to query specific nodes", reason);
|
|
66
|
+
if (isEnv) return leadWithCommand(configGetCommand(hintPath, target.name), "to read a specific variable", reason);
|
|
61
67
|
if (isConfig && /\.properties$/i.test(hintPath)) {
|
|
62
|
-
return target.real ? leadWithCommand(
|
|
68
|
+
return target.real ? leadWithCommand(configGetCommand(hintPath, target.name), "to read a specific value", reason) : grepLinesHint("<key>", hintPath, reason);
|
|
63
69
|
}
|
|
64
70
|
if (isConfig) {
|
|
65
71
|
const structured = structuredDataHint(hintPath, target.real ? target.name : null, reason);
|
|
66
72
|
if (structured !== null) return structured;
|
|
67
|
-
return target.slice === "key" ? leadWithCommand(
|
|
73
|
+
return target.slice === "key" ? leadWithCommand(configGetCommand(hintPath, target.name), "to read a specific value, or `" + outline + "` for every key with line ranges", reason) : leadWithCommand("token-goat section " + quotedArg(hintPath + "::" + target.name), "to read one table, or `" + outline + "` for every key with line ranges", reason);
|
|
68
74
|
}
|
|
69
75
|
if (isDoc) return docSectionHint(hintPath, target.name, reason);
|
|
70
|
-
return target.real ? leadWithCommand(
|
|
76
|
+
return target.real ? leadWithCommand("token-goat read " + quotedArg(hintPath + "::" + target.name), "to read one function or class, or `" + outline + "` for all of them", reason) : leadWithCommand(outline, "to list every function and class with its line range", reason);
|
|
71
77
|
}
|
|
72
78
|
function surgicalHintForConfigDoc(filePath, isConfig, isDoc, isSql, isXml, target, reason = "") {
|
|
73
79
|
if (isXml || isConfig || isDoc) return surgicalHintFor(filePath, false, isConfig, isDoc, isXml, target, reason);
|
|
74
80
|
if (isSql) return sqlTableHint(filePath, target, reason);
|
|
75
|
-
return leadWithCommand(outlineCommand(filePath),
|
|
81
|
+
return leadWithCommand(outlineCommand(filePath), "or `token-goat skeleton " + quotedArg(filePath) + "` to see the file structure", reason);
|
|
76
82
|
}
|
|
77
83
|
function splitShellSegments(cmd) {
|
|
78
84
|
const segments = [];
|
|
@@ -624,8 +630,9 @@ function substituteSentence(filePath, ranges, sub) {
|
|
|
624
630
|
const allReads = reads.length === 2 ? reads.join(" and ") : reads.length >= 3 ? reads.slice(0, -1).join(", ") + ", and " + reads[reads.length - 1] : reads[0];
|
|
625
631
|
return "Lines " + spans + " of " + filePath + " cost " + sub.requestedBytes + " bytes; " + allReads + " returns the same content as " + sub.replacementBytes + " bytes, resolved to whole regions and robust to line shifts.";
|
|
626
632
|
}
|
|
627
|
-
function leadingLinesHint(lead, hintPath, start, end, preHookCwd, substitute) {
|
|
633
|
+
function leadingLinesHint(lead, hintPath, start, end, preHookCwd, substitute, event) {
|
|
628
634
|
const key = resolveIndexPath(hintPath, preHookCwd ?? process.cwd());
|
|
635
|
+
if (commandPathIsTouchable(hintPath, event)) dropFileLineRangesIfChanged(key);
|
|
629
636
|
const prior = findRangeOverlap(getFileLineRanges(key), start, end);
|
|
630
637
|
if (prior !== null) return sedOverlapHint(hintPath, prior, start, end);
|
|
631
638
|
if (substitute === null) return null;
|
|
@@ -651,7 +658,7 @@ function sedOverlapHint(filePath, prior, start, end) {
|
|
|
651
658
|
if (segments.length === 0) {
|
|
652
659
|
return base + "These lines were already served - recall them from your earlier output instead of re-reading.";
|
|
653
660
|
}
|
|
654
|
-
const reads = segments.map(([s, e]) =>
|
|
661
|
+
const reads = segments.map(([s, e]) => "`token-goat read " + quotedArg(filePath + "@" + s + "-" + e) + "`").join(" and ");
|
|
655
662
|
return base + "For only the new lines, " + reads + ".";
|
|
656
663
|
}
|
|
657
664
|
function extractNodeFileRead(cmd) {
|
|
@@ -926,16 +933,18 @@ function stripHeredocBodies(cmd) {
|
|
|
926
933
|
}
|
|
927
934
|
var ASSIGNMENT_PREFIX_WORDS = /* @__PURE__ */ new Set(["env", "export", "time", "command", "nohup", "exec", "!", "{", "do", "then", "else"]);
|
|
928
935
|
var ENV_VALUE_FLAGS = /* @__PURE__ */ new Set(["-u", "--unset", "-C", "--chdir"]);
|
|
936
|
+
var ENV_CHDIR_FLAG = /^(?:--c|-[A-BD-Za-z]*C)/;
|
|
929
937
|
var ENV_PREFIX_WORDS = /* @__PURE__ */ new Set(["env"]);
|
|
930
938
|
function walkCommandPrefix(words, prefixWords) {
|
|
931
939
|
const assignments = [];
|
|
932
940
|
let prefixed = false;
|
|
941
|
+
let chdir = false;
|
|
933
942
|
for (let i = 0; i < words.length; i++) {
|
|
934
943
|
const word = words[i];
|
|
935
944
|
const pwsh = /^\$env:([A-Za-z_]\w*)(?:=(.*))?$/i.exec(word);
|
|
936
945
|
if (pwsh !== null) {
|
|
937
946
|
assignments.push({ name: pwsh[1].toUpperCase(), value: pwsh[2] ?? (words[i + 1] === "=" ? words[i + 2] : void 0) });
|
|
938
|
-
return { command: i, assignments };
|
|
947
|
+
return { command: i, assignments, chdir };
|
|
939
948
|
}
|
|
940
949
|
const posix = /^([A-Za-z_]\w*)=(.*)$/.exec(word);
|
|
941
950
|
if (posix !== null) {
|
|
@@ -947,17 +956,24 @@ function walkCommandPrefix(words, prefixWords) {
|
|
|
947
956
|
continue;
|
|
948
957
|
}
|
|
949
958
|
if (prefixed && word.startsWith("-")) {
|
|
950
|
-
if (
|
|
959
|
+
if (ENV_CHDIR_FLAG.test(word)) chdir = true;
|
|
960
|
+
if (ENV_VALUE_FLAGS.has(word) || /^-[A-Za-z]+C$/.test(word)) i++;
|
|
951
961
|
continue;
|
|
952
962
|
}
|
|
953
|
-
return { command: i, assignments };
|
|
963
|
+
return { command: i, assignments, chdir };
|
|
954
964
|
}
|
|
955
|
-
return { command: words.length, assignments };
|
|
965
|
+
return { command: words.length, assignments, chdir };
|
|
956
966
|
}
|
|
967
|
+
var caseless = (literal) => literal.replace(/[A-Za-z]/g, (c) => `[${c.toUpperCase()}${c.toLowerCase()}]`);
|
|
968
|
+
var CHANGES_WHAT_RUNS_NAMES = ["PATH", "BASH_ENV", "ENV", "CDPATH", "HOME", "SHELL", "IFS", "PROMPT_COMMAND", "USERPROFILE", "APPDATA", "LOCALAPPDATA"].map(caseless).join("|") + `|(?:${caseless("LD_")}|${caseless("DYLD_")}|${caseless("XDG_")}|${caseless("GIT_")}|${caseless("NPM_CONFIG_")}|${caseless("PIP_")}|${caseless("UV_")}|${caseless("PERL")}|${caseless("RUBY")})\\w*|${caseless("NODE_")}(?!${caseless("ENV")}\\b)\\w*|${caseless("PYTHON")}(?!${["IOENCODING", "UTF8", "UNBUFFERED", "DONTWRITEBYTECODE"].map(caseless).join("|")}\\b)\\w*|${caseless("TOKEN_GOAT_")}(?!${caseless("BASH_COMPRESS")}\\b)\\w*`;
|
|
969
|
+
var CHANGES_WHAT_RUNS = new RegExp(`^(?:${CHANGES_WHAT_RUNS_NAMES})$`);
|
|
957
970
|
function stripLeadingAssignments(cmd) {
|
|
958
971
|
const { words, starts } = splitCommandWordsAt(cmd);
|
|
959
|
-
const
|
|
972
|
+
const { command, assignments, chdir } = walkCommandPrefix(words, ENV_PREFIX_WORDS);
|
|
973
|
+
const at = starts[command];
|
|
960
974
|
if (at === void 0 || at === 0) return cmd;
|
|
975
|
+
if (chdir) return cmd;
|
|
976
|
+
if (assignments.some(({ name }) => CHANGES_WHAT_RUNS.test(name))) return cmd;
|
|
961
977
|
return isCompressibleSingleCommand(cmd.slice(0, at + 1)) ? cmd.slice(at) : cmd;
|
|
962
978
|
}
|
|
963
979
|
function commandOptsOutOfCompression(cmd) {
|
|
@@ -1257,6 +1273,7 @@ export {
|
|
|
1257
1273
|
extractMarkdownHeadingGrep,
|
|
1258
1274
|
extractRgStructuralSearch,
|
|
1259
1275
|
extractGrepPipeChain,
|
|
1276
|
+
CHANGES_WHAT_RUNS_NAMES,
|
|
1260
1277
|
stripLeadingAssignments,
|
|
1261
1278
|
compressionOptedOut,
|
|
1262
1279
|
extractCurlUrl,
|
|
@@ -2,7 +2,7 @@ import { createRequire as __cjsRequire } from 'node:module';
|
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
detectHarness
|
|
5
|
-
} from "./token-goat-chunk-
|
|
5
|
+
} from "./token-goat-chunk-QYHO5CPH.mjs";
|
|
6
6
|
import {
|
|
7
7
|
init_define_import_meta_env
|
|
8
8
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -0,0 +1,71 @@
|
|
|
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/languages/markup_scan.ts
|
|
8
|
+
init_define_import_meta_env();
|
|
9
|
+
function charFinder(text, ch) {
|
|
10
|
+
let cached = -2;
|
|
11
|
+
return (from) => {
|
|
12
|
+
if (cached === -1) return -1;
|
|
13
|
+
if (cached >= from) return cached;
|
|
14
|
+
cached = text.indexOf(ch, from);
|
|
15
|
+
return cached;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function gtFinder(text) {
|
|
19
|
+
return charFinder(text, ">");
|
|
20
|
+
}
|
|
21
|
+
function findOpenTags(text, open) {
|
|
22
|
+
const out = [];
|
|
23
|
+
open.lastIndex = 0;
|
|
24
|
+
let m;
|
|
25
|
+
while ((m = open.exec(text)) !== null) {
|
|
26
|
+
const nameEnd = m.index + m[0].length;
|
|
27
|
+
const gt = text.indexOf(">", nameEnd);
|
|
28
|
+
if (gt < 0) break;
|
|
29
|
+
out.push({ start: m.index, nameEnd, end: gt + 1 });
|
|
30
|
+
open.lastIndex = gt + 1;
|
|
31
|
+
}
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
function findElements(text, open, close, limit = Infinity) {
|
|
35
|
+
const out = [];
|
|
36
|
+
const next = elementCursor(text, open, close);
|
|
37
|
+
let el;
|
|
38
|
+
while (out.length < limit && (el = next()) !== null) out.push(el);
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
function elementCursor(text, open, close) {
|
|
42
|
+
open.lastIndex = 0;
|
|
43
|
+
let done = false;
|
|
44
|
+
return () => {
|
|
45
|
+
if (done) return null;
|
|
46
|
+
const m = open.exec(text);
|
|
47
|
+
if (m !== null) {
|
|
48
|
+
const nameEnd = m.index + m[0].length;
|
|
49
|
+
const gt = text.indexOf(">", nameEnd);
|
|
50
|
+
if (gt >= 0) {
|
|
51
|
+
close.lastIndex = gt + 1;
|
|
52
|
+
const c = close.exec(text);
|
|
53
|
+
if (c !== null) {
|
|
54
|
+
const end = c.index + c[0].length;
|
|
55
|
+
open.lastIndex = end;
|
|
56
|
+
return { start: m.index, nameEnd, end, attrs: text.slice(nameEnd, gt), body: text.slice(gt + 1, c.index), bodyEnd: c.index };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
done = true;
|
|
61
|
+
return null;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
charFinder,
|
|
67
|
+
gtFinder,
|
|
68
|
+
findOpenTags,
|
|
69
|
+
findElements,
|
|
70
|
+
elementCursor
|
|
71
|
+
};
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
isIgnoredIndexPath
|
|
5
|
+
} from "./token-goat-chunk-ZNMNUPAZ.mjs";
|
|
6
|
+
import {
|
|
7
|
+
isSecretFileName
|
|
8
|
+
} from "./token-goat-chunk-32ZOY4N5.mjs";
|
|
9
|
+
import {
|
|
10
|
+
hasSkipSegmentBelowRoot
|
|
11
|
+
} from "./token-goat-chunk-NISNMD7T.mjs";
|
|
12
|
+
import {
|
|
13
|
+
getOwnProjectFileEntries
|
|
14
|
+
} from "./token-goat-chunk-IK2DRMFX.mjs";
|
|
15
|
+
import {
|
|
16
|
+
loadConfig
|
|
17
|
+
} from "./token-goat-chunk-7EZTZOMC.mjs";
|
|
18
|
+
import {
|
|
19
|
+
fileIsAbsent,
|
|
20
|
+
findProject
|
|
21
|
+
} from "./token-goat-chunk-4GBVPH3D.mjs";
|
|
22
|
+
import {
|
|
23
|
+
isUnderBlockedRoot
|
|
24
|
+
} from "./token-goat-chunk-HU4TORC5.mjs";
|
|
25
|
+
import {
|
|
26
|
+
foldPath,
|
|
27
|
+
isInsideRoot
|
|
28
|
+
} from "./token-goat-chunk-AM5V6GSX.mjs";
|
|
29
|
+
import {
|
|
30
|
+
init_define_import_meta_env
|
|
31
|
+
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
32
|
+
|
|
33
|
+
// src/path_suggest.ts
|
|
34
|
+
init_define_import_meta_env();
|
|
35
|
+
import { existsSync, opendirSync, realpathSync } from "node:fs";
|
|
36
|
+
import * as path from "node:path";
|
|
37
|
+
|
|
38
|
+
// src/indexed_file_names.ts
|
|
39
|
+
init_define_import_meta_env();
|
|
40
|
+
function indexedFileList(rootDir) {
|
|
41
|
+
const out = [];
|
|
42
|
+
for (const [folded, indexed] of getOwnProjectFileEntries(rootDir)) {
|
|
43
|
+
if (isIgnoredIndexPath(folded, rootDir)) continue;
|
|
44
|
+
out.push({ filePath: indexed.filePath, base: folded.slice(Math.max(folded.lastIndexOf("/"), folded.lastIndexOf("\\")) + 1) });
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
function filesNamed(list, name) {
|
|
49
|
+
const want = foldPath(name);
|
|
50
|
+
const matches = [];
|
|
51
|
+
for (const { filePath, base } of list) {
|
|
52
|
+
const dot = base.lastIndexOf(".");
|
|
53
|
+
if (base === want || dot > 0 && base.slice(0, dot) === want) matches.push(filePath);
|
|
54
|
+
}
|
|
55
|
+
return [...new Set(matches)].sort();
|
|
56
|
+
}
|
|
57
|
+
function indexedFilesNamed(name, rootDir) {
|
|
58
|
+
return filesNamed(indexedFileList(rootDir), name);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/util_suggest.ts
|
|
62
|
+
init_define_import_meta_env();
|
|
63
|
+
function levenshteinDistance(a, b, cap = 3) {
|
|
64
|
+
if (Math.abs(a.length - b.length) > cap) return cap + 1;
|
|
65
|
+
const prev = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
66
|
+
for (let i = 1; i <= a.length; i++) {
|
|
67
|
+
const curr = [i];
|
|
68
|
+
for (let j = 1; j <= b.length; j++) {
|
|
69
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
70
|
+
curr.push(Math.min((curr[j - 1] ?? 0) + 1, (prev[j] ?? 0) + 1, (prev[j - 1] ?? 0) + cost));
|
|
71
|
+
}
|
|
72
|
+
prev.splice(0, prev.length, ...curr);
|
|
73
|
+
}
|
|
74
|
+
return prev[b.length] ?? cap + 1;
|
|
75
|
+
}
|
|
76
|
+
function suggestPackageNames(query, names) {
|
|
77
|
+
return [...new Set(names)].map((n) => ({ n, d: levenshteinDistance(query.toLowerCase(), n.toLowerCase()) })).filter((x) => x.d <= 3).sort((a, b) => a.d - b.d).slice(0, 5).map((x) => x.n);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/path_suggest.ts
|
|
81
|
+
var MAX_PATH_SUGGESTIONS = 3;
|
|
82
|
+
var MAX_PATH_CHARS = 1024;
|
|
83
|
+
var MAX_DIR_ENTRIES = 5e3;
|
|
84
|
+
var UNICODE_SPACES = /[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g;
|
|
85
|
+
var TRAILING_LOCATION = /(?::\d+(?:-\d+)?|#L\d+(?:-L?\d+)?)$/;
|
|
86
|
+
var SPELLING_REWRITES = [
|
|
87
|
+
(name) => name.replace(UNICODE_SPACES, " "),
|
|
88
|
+
(name) => name.replace(/ (AM|PM)\b/g, "\u202F$1"),
|
|
89
|
+
(name) => name.replace(/ (AM|PM)\b/g, "\xA0$1"),
|
|
90
|
+
(name) => name.normalize("NFC"),
|
|
91
|
+
(name) => name.normalize("NFD"),
|
|
92
|
+
(name) => name.replace(/'/g, "\u2019"),
|
|
93
|
+
(name) => name.replace(/[\u2018\u2019]/g, "'")
|
|
94
|
+
];
|
|
95
|
+
function withoutDecoration(missing) {
|
|
96
|
+
const trimmed = missing.trim();
|
|
97
|
+
const unmentioned = trimmed.startsWith("@") && trimmed.length > 1 ? trimmed.slice(1) : trimmed;
|
|
98
|
+
return unmentioned.replace(TRAILING_LOCATION, "");
|
|
99
|
+
}
|
|
100
|
+
function spellingVariants(missing) {
|
|
101
|
+
const seen = /* @__PURE__ */ new Set([withoutDecoration(missing)]);
|
|
102
|
+
for (const rewrite of SPELLING_REWRITES) {
|
|
103
|
+
for (const spelling of [...seen]) seen.add(rewrite(spelling));
|
|
104
|
+
}
|
|
105
|
+
seen.delete(missing);
|
|
106
|
+
return [...seen].filter((spelling) => spelling !== "");
|
|
107
|
+
}
|
|
108
|
+
function scopeFor(cwd, rootDir) {
|
|
109
|
+
const cfg = loadConfig();
|
|
110
|
+
const project = rootDir !== null ? findProject(rootDir) : null;
|
|
111
|
+
const indexed = rootDir !== null && project !== null && samePath(project.root, rootDir);
|
|
112
|
+
return { root: indexed && rootDir !== null ? rootDir : cwd, indexed, skipDirs: cfg.indexing.skip_dirs, blockedRoots: cfg.worker.blocked_roots };
|
|
113
|
+
}
|
|
114
|
+
function permitted(abs, scope) {
|
|
115
|
+
if (isSecretFileName(abs)) return false;
|
|
116
|
+
if (isIgnoredIndexPath(abs, scope.root) || hasSkipSegmentBelowRoot(abs, scope.root, (segment) => scope.skipDirs.includes(segment))) return false;
|
|
117
|
+
if (isUnderBlockedRoot(abs, scope.blockedRoots)) return false;
|
|
118
|
+
return isInsideRoot(abs, scope.root);
|
|
119
|
+
}
|
|
120
|
+
function entriesOf(dir, scope) {
|
|
121
|
+
if (!isInsideRoot(dir, scope.root)) return [];
|
|
122
|
+
const names = [];
|
|
123
|
+
try {
|
|
124
|
+
const handle = opendirSync(dir);
|
|
125
|
+
try {
|
|
126
|
+
while (names.length < MAX_DIR_ENTRIES) {
|
|
127
|
+
const entry = handle.readSync();
|
|
128
|
+
if (entry === null) break;
|
|
129
|
+
names.push(entry.name);
|
|
130
|
+
}
|
|
131
|
+
} finally {
|
|
132
|
+
handle.closeSync();
|
|
133
|
+
}
|
|
134
|
+
} catch {
|
|
135
|
+
}
|
|
136
|
+
return names;
|
|
137
|
+
}
|
|
138
|
+
function displayPath(abs, cwd) {
|
|
139
|
+
const full = path.resolve(abs);
|
|
140
|
+
for (const base of [path.resolve(cwd), realCwd(path.resolve(cwd))]) {
|
|
141
|
+
const rel = path.relative(foldPath(base), foldPath(full));
|
|
142
|
+
if (rel !== "" && !rel.startsWith("..") && !path.isAbsolute(rel)) return full.split(/[\\/]/).slice(-rel.split(/[\\/]/).length).join("/");
|
|
143
|
+
}
|
|
144
|
+
return abs.replace(/\\/g, "/");
|
|
145
|
+
}
|
|
146
|
+
function realCwd(cwd) {
|
|
147
|
+
try {
|
|
148
|
+
return realpathSync.native(cwd);
|
|
149
|
+
} catch {
|
|
150
|
+
return cwd;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function sharedParents(a, b) {
|
|
154
|
+
const left = path.dirname(a).split(/[\\/]/).reverse();
|
|
155
|
+
const right = path.dirname(b).split(/[\\/]/).reverse();
|
|
156
|
+
let shared = 0;
|
|
157
|
+
while (shared < left.length && shared < right.length && left[shared].toLowerCase() === right[shared].toLowerCase()) shared++;
|
|
158
|
+
return shared;
|
|
159
|
+
}
|
|
160
|
+
function samePath(a, b) {
|
|
161
|
+
return foldPath(path.resolve(a)) === foldPath(path.resolve(b));
|
|
162
|
+
}
|
|
163
|
+
function resolveIndexed(file, rootDir) {
|
|
164
|
+
return path.resolve(rootDir, file);
|
|
165
|
+
}
|
|
166
|
+
function sameNameFiles(missingAbs, rootDir, files, scope) {
|
|
167
|
+
const base = path.basename(missingAbs);
|
|
168
|
+
const dot = base.lastIndexOf(".");
|
|
169
|
+
const names = dot > 0 ? [base, base.slice(0, dot)] : [base];
|
|
170
|
+
const found = [...new Set(names.flatMap((name) => filesNamed(files, name)))].map((file) => resolveIndexed(file, rootDir)).filter((abs) => !samePath(abs, missingAbs) && !fileIsAbsent(abs) && permitted(abs, scope));
|
|
171
|
+
const ranked = found.sort((a, b) => sharedParents(b, missingAbs) - sharedParents(a, missingAbs) || a.localeCompare(b));
|
|
172
|
+
return ranked.length <= MAX_PATH_SUGGESTIONS ? ranked : ranked.filter((abs) => sharedParents(abs, missingAbs) > 0);
|
|
173
|
+
}
|
|
174
|
+
function typoBudget(base) {
|
|
175
|
+
const dot = base.lastIndexOf(".");
|
|
176
|
+
if ((dot > 0 ? dot : base.length) < 3) return 0;
|
|
177
|
+
return base.length >= 8 ? 2 : 1;
|
|
178
|
+
}
|
|
179
|
+
function nearNameFiles(missingAbs, rootDir, files, scope) {
|
|
180
|
+
const base = path.basename(missingAbs);
|
|
181
|
+
const budget = typoBudget(base);
|
|
182
|
+
if (budget === 0) return [];
|
|
183
|
+
const dir = path.dirname(missingAbs);
|
|
184
|
+
const lower = base.toLowerCase();
|
|
185
|
+
const scored = [];
|
|
186
|
+
const consider = (abs, sameDir) => {
|
|
187
|
+
const name = path.basename(abs);
|
|
188
|
+
if (name === base) return;
|
|
189
|
+
const distance = levenshteinDistance(name.toLowerCase(), lower, budget);
|
|
190
|
+
if (distance > budget) return;
|
|
191
|
+
scored.push({ abs, rank: sameDir ? 0 : 1, distance });
|
|
192
|
+
};
|
|
193
|
+
for (const name of entriesOf(dir, scope)) consider(path.join(dir, name), true);
|
|
194
|
+
for (const file of files ?? []) consider(resolveIndexed(file.filePath, rootDir), false);
|
|
195
|
+
return scored.sort((a, b) => a.rank - b.rank || a.distance - b.distance || a.abs.localeCompare(b.abs)).map((entry) => entry.abs).filter((abs) => !samePath(abs, missingAbs) && !fileIsAbsent(abs) && permitted(abs, scope));
|
|
196
|
+
}
|
|
197
|
+
function caseCorrected(abs, scope) {
|
|
198
|
+
const root = path.parse(abs).root;
|
|
199
|
+
let current = root;
|
|
200
|
+
let changed = false;
|
|
201
|
+
for (const segment of abs.slice(root.length).split(/[\\/]/).filter((s) => s !== "")) {
|
|
202
|
+
const next = path.join(current, segment);
|
|
203
|
+
if (existsSync(next)) {
|
|
204
|
+
current = next;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
const matches = entriesOf(current, scope).filter((entry) => entry.toLowerCase() === segment.toLowerCase());
|
|
208
|
+
if (matches.length !== 1) return null;
|
|
209
|
+
current = path.join(current, matches[0]);
|
|
210
|
+
changed = true;
|
|
211
|
+
}
|
|
212
|
+
return changed && permitted(current, scope) ? current : null;
|
|
213
|
+
}
|
|
214
|
+
function suggestPaths(missing, cwd, rootDir) {
|
|
215
|
+
if (missing === "" || missing.length > MAX_PATH_CHARS || /[\r\n\0]/.test(missing)) return [];
|
|
216
|
+
const scope = scopeFor(cwd, rootDir);
|
|
217
|
+
const missingAbs = path.resolve(cwd, missing);
|
|
218
|
+
const variants = spellingVariants(missing).map((spelling) => path.resolve(cwd, spelling)).filter((abs) => !samePath(abs, missingAbs) && permitted(abs, scope) && existsSync(abs));
|
|
219
|
+
if (variants.length > 0) return [...new Set(variants)].slice(0, MAX_PATH_SUGGESTIONS).map((abs) => displayPath(abs, cwd));
|
|
220
|
+
const stripped = path.resolve(cwd, withoutDecoration(missing));
|
|
221
|
+
const found = [];
|
|
222
|
+
const add = (list) => {
|
|
223
|
+
for (const abs of list) if (!samePath(abs, missingAbs) && !found.some((seen) => samePath(seen, abs))) found.push(abs);
|
|
224
|
+
};
|
|
225
|
+
let files = null;
|
|
226
|
+
if (scope.indexed) {
|
|
227
|
+
try {
|
|
228
|
+
files = indexedFileList(scope.root);
|
|
229
|
+
add(sameNameFiles(stripped, scope.root, files, scope));
|
|
230
|
+
} catch {
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const corrected = caseCorrected(stripped, scope);
|
|
234
|
+
add(nearNameFiles(stripped, scope.root, files, scope));
|
|
235
|
+
if (corrected !== null) add([corrected]);
|
|
236
|
+
return found.slice(0, MAX_PATH_SUGGESTIONS).map((abs) => displayPath(abs, cwd));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export {
|
|
240
|
+
levenshteinDistance,
|
|
241
|
+
suggestPackageNames,
|
|
242
|
+
indexedFilesNamed,
|
|
243
|
+
suggestPaths
|
|
244
|
+
};
|
|
@@ -3,6 +3,9 @@ const require = __cjsRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
DocumentRefusedError
|
|
5
5
|
} from "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
6
|
+
import {
|
|
7
|
+
echoedValue
|
|
8
|
+
} from "./token-goat-chunk-GGGG7RWB.mjs";
|
|
6
9
|
import {
|
|
7
10
|
init_define_import_meta_env
|
|
8
11
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -15,7 +18,7 @@ var STREAM_CHUNK_BYTES = 64 * 1024;
|
|
|
15
18
|
var ZipOutputTooLargeError = class extends DocumentRefusedError {
|
|
16
19
|
constructor(entryName, limitBytes, decompressedSoFarBytes) {
|
|
17
20
|
super(
|
|
18
|
-
`zip entry
|
|
21
|
+
`zip entry ${echoedValue(entryName)} is over the ${Math.round(limitBytes / (1024 * 1024))}MB decompressed-size limit (over ${Math.round(decompressedSoFarBytes / (1024 * 1024))}MB decompressed so far)`,
|
|
19
22
|
"ZipOutputTooLargeError"
|
|
20
23
|
);
|
|
21
24
|
}
|
|
@@ -2,27 +2,27 @@ import { createRequire as __cjsRequire } from 'node:module';
|
|
|
2
2
|
const require = __cjsRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
resolveBashCall
|
|
5
|
-
} from "./token-goat-chunk-
|
|
6
|
-
import {
|
|
7
|
-
copilotCliUserRoot,
|
|
8
|
-
readCopilotMcpTools
|
|
9
|
-
} from "./token-goat-chunk-VPBBTSJR.mjs";
|
|
5
|
+
} from "./token-goat-chunk-ODBT2USM.mjs";
|
|
10
6
|
import {
|
|
11
7
|
accumulateResidentLine,
|
|
12
8
|
createResidentContextStats,
|
|
13
9
|
summarizeResidentContext
|
|
14
|
-
} from "./token-goat-chunk-
|
|
10
|
+
} from "./token-goat-chunk-WDH44VAU.mjs";
|
|
11
|
+
import {
|
|
12
|
+
projectTranscriptsDir
|
|
13
|
+
} from "./token-goat-chunk-BPGCUMR7.mjs";
|
|
15
14
|
import {
|
|
16
15
|
commandHash,
|
|
17
16
|
getBashOutput,
|
|
18
17
|
normalizeCommandForCacheKey
|
|
19
|
-
} from "./token-goat-chunk-
|
|
18
|
+
} from "./token-goat-chunk-KQBLRPBN.mjs";
|
|
20
19
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
copilotCliUserRoot,
|
|
21
|
+
readCopilotMcpTools
|
|
22
|
+
} from "./token-goat-chunk-76FGDLRO.mjs";
|
|
23
23
|
import {
|
|
24
24
|
estimateTokens
|
|
25
|
-
} from "./token-goat-chunk-
|
|
25
|
+
} from "./token-goat-chunk-BFCWY73P.mjs";
|
|
26
26
|
import {
|
|
27
27
|
canonicalize
|
|
28
28
|
} from "./token-goat-chunk-AM5V6GSX.mjs";
|
|
@@ -462,6 +462,9 @@ function ownClaudeTranscript(projectRoot) {
|
|
|
462
462
|
return null;
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
+
function noSessionTranscriptMessage(projectRoot) {
|
|
466
|
+
return [`no session transcript found for ${projectRoot}`, "Pass --transcript <path> to specify one explicitly."];
|
|
467
|
+
}
|
|
465
468
|
function findProjectSession(projectRoot) {
|
|
466
469
|
const copilotSession = findActiveCopilotSession(projectRoot) ?? findLatestCopilotSession(projectRoot);
|
|
467
470
|
const claudeTranscript = findLatestTranscript(projectRoot);
|
|
@@ -602,6 +605,7 @@ export {
|
|
|
602
605
|
buildWasteReport,
|
|
603
606
|
isCopilotTranscript,
|
|
604
607
|
findLatestCopilotSession,
|
|
608
|
+
noSessionTranscriptMessage,
|
|
605
609
|
findProjectSession,
|
|
606
610
|
unusedMcpServers,
|
|
607
611
|
MCP_DISABLE_NOTE,
|
|
@@ -27,18 +27,20 @@ import {
|
|
|
27
27
|
reconstructLayout,
|
|
28
28
|
resolveDestPage,
|
|
29
29
|
withPdfDocument
|
|
30
|
-
} from "./token-goat-chunk-
|
|
31
|
-
import "./token-goat-chunk-
|
|
32
|
-
import "./token-goat-chunk-
|
|
33
|
-
import "./token-goat-chunk-
|
|
30
|
+
} from "./token-goat-chunk-25TRAWET.mjs";
|
|
31
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
32
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
33
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
34
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
34
35
|
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
35
36
|
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
36
37
|
import "./token-goat-chunk-AH6QILZM.mjs";
|
|
37
38
|
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
38
|
-
import "./token-goat-chunk-
|
|
39
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
40
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
39
41
|
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
40
42
|
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
41
|
-
import "./token-goat-chunk-
|
|
43
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
42
44
|
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
43
45
|
export {
|
|
44
46
|
MAX_LOCATE_CONTEXT_CHARS,
|