token-goat 2.9.25 → 2.9.28

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.
Files changed (57) hide show
  1. package/README.md +28 -88
  2. package/SECURITY.md +14 -0
  3. package/dist/{token-goat-chunk-ORO4GOMA.mjs → token-goat-chunk-4JJBFT7V.mjs} +3 -3
  4. package/dist/token-goat-chunk-4JMWPWCS.mjs +96 -0
  5. package/dist/token-goat-chunk-4RN64ZND.mjs +954 -0
  6. package/dist/{token-goat-chunk-6W2FFT6H.mjs → token-goat-chunk-4STDIGYC.mjs} +2 -2
  7. package/dist/{token-goat-chunk-EZVRN44Y.mjs → token-goat-chunk-5NNYIUGV.mjs} +2 -2
  8. package/dist/{token-goat-chunk-ILROZWXE.mjs → token-goat-chunk-66LODAUT.mjs} +1 -1
  9. package/dist/{token-goat-chunk-VAIJUZG6.mjs → token-goat-chunk-6CCQDAYY.mjs} +69 -566
  10. package/dist/{token-goat-chunk-UGCNTVF4.mjs → token-goat-chunk-6DQNNFJ6.mjs} +5 -3
  11. package/dist/{token-goat-chunk-ZWFP4ZU7.mjs → token-goat-chunk-6SGLIPQB.mjs} +40 -20
  12. package/dist/{token-goat-chunk-TWVFMUTZ.mjs → token-goat-chunk-6Z5ULNE5.mjs} +3570 -3970
  13. package/dist/token-goat-chunk-7MAFDRVR.mjs +47 -0
  14. package/dist/{token-goat-chunk-PPNKB5HP.mjs → token-goat-chunk-7R2XYKC5.mjs} +6 -5
  15. package/dist/{token-goat-chunk-KYV7E6ZJ.mjs → token-goat-chunk-BCN2YQC6.mjs} +10 -8
  16. package/dist/token-goat-chunk-BJBRGPBX.mjs +244 -0
  17. package/dist/{token-goat-chunk-Z5ZTBSHL.mjs → token-goat-chunk-CBMY2FGI.mjs} +479 -544
  18. package/dist/{token-goat-chunk-UTKNLKYE.mjs → token-goat-chunk-CC2PYJM7.mjs} +2 -1
  19. package/dist/{token-goat-chunk-7PQYG6TN.mjs → token-goat-chunk-D5ICEPSB.mjs} +14 -14
  20. package/dist/token-goat-chunk-D7GHQKQD.mjs +30 -0
  21. package/dist/{token-goat-chunk-NNXCBELZ.mjs → token-goat-chunk-EL7M26WP.mjs} +7623 -8455
  22. package/dist/{token-goat-chunk-TVTDINTO.mjs → token-goat-chunk-F7QZRIWM.mjs} +69 -20
  23. package/dist/{token-goat-chunk-MBRX5AP6.mjs → token-goat-chunk-FSTWAOW6.mjs} +3 -3
  24. package/dist/token-goat-chunk-GGLEE35R.mjs +564 -0
  25. package/dist/{token-goat-chunk-YZ67F2HJ.mjs → token-goat-chunk-HUDC5GS5.mjs} +2 -2
  26. package/dist/{token-goat-chunk-BIBZQRC6.mjs → token-goat-chunk-HXNAC4ZF.mjs} +22 -964
  27. package/dist/token-goat-chunk-I7CB3X4K.mjs +1379 -0
  28. package/dist/{token-goat-chunk-KMCVX3P2.mjs → token-goat-chunk-IFORDBGC.mjs} +32 -27
  29. package/dist/{token-goat-chunk-25NRXKIW.mjs → token-goat-chunk-IHKZ3QNA.mjs} +26 -15
  30. package/dist/token-goat-chunk-IZXKVT4A.mjs +711 -0
  31. package/dist/{token-goat-chunk-UEQUZDHQ.mjs → token-goat-chunk-JXK2HQXS.mjs} +22 -8
  32. package/dist/{token-goat-chunk-YE4TGC4Z.mjs → token-goat-chunk-L45ZQRT7.mjs} +1 -1
  33. package/dist/{token-goat-chunk-IEF2NZFZ.mjs → token-goat-chunk-L7SDVGBT.mjs} +196 -14
  34. package/dist/token-goat-chunk-LEG3JNJ6.mjs +139 -0
  35. package/dist/{token-goat-chunk-3FSAZR32.mjs → token-goat-chunk-M56BWPBN.mjs} +1 -1
  36. package/dist/{token-goat-chunk-QZZPWFVF.mjs → token-goat-chunk-MAMQPC43.mjs} +2 -87
  37. package/dist/{token-goat-chunk-OHMKCBZI.mjs → token-goat-chunk-MMLMALWK.mjs} +5 -3
  38. package/dist/{token-goat-chunk-KOL5WXDW.mjs → token-goat-chunk-MVSWBNMD.mjs} +7 -231
  39. package/dist/{token-goat-chunk-J2PRBQ24.mjs → token-goat-chunk-NILVK7XM.mjs} +4 -4
  40. package/dist/{token-goat-chunk-OUQIGPW3.mjs → token-goat-chunk-Q4S3UQGO.mjs} +1 -1
  41. package/dist/{token-goat-chunk-EX2DVKAT.mjs → token-goat-chunk-QM76S6YS.mjs} +3 -3
  42. package/dist/{token-goat-chunk-G7YWBH25.mjs → token-goat-chunk-RJH64KQH.mjs} +86 -72
  43. package/dist/{token-goat-chunk-RLDBVMXR.mjs → token-goat-chunk-RSS3TLXU.mjs} +2 -2
  44. package/dist/{token-goat-chunk-T6652D3F.mjs → token-goat-chunk-SJEKA7Y2.mjs} +21 -16
  45. package/dist/{token-goat-chunk-II5WBDFB.mjs → token-goat-chunk-UBUKHVYW.mjs} +1 -1
  46. package/dist/{token-goat-chunk-2SSDSUSF.mjs → token-goat-chunk-VE27HPIF.mjs} +14 -10
  47. package/dist/{token-goat-chunk-Y463KPAQ.mjs → token-goat-chunk-VWZKZPSR.mjs} +100 -23
  48. package/dist/{token-goat-chunk-K4TNHLGS.mjs → token-goat-chunk-XI2VFAV6.mjs} +6 -6
  49. package/dist/{token-goat-chunk-ZDFDCXU2.mjs → token-goat-chunk-XKY4VKJ4.mjs} +1 -1
  50. package/dist/{token-goat-chunk-BQ6ZDLTF.mjs → token-goat-chunk-YWSP6IU7.mjs} +1 -1
  51. package/dist/token-goat-hook.mjs +23 -17
  52. package/dist/token-goat.core.mjs +32 -27
  53. package/docs/cli.md +32 -21
  54. package/docs/install.md +2 -0
  55. package/package.json +1 -1
  56. package/dist/token-goat-chunk-EDCVQLBR.mjs +0 -26
  57. package/dist/token-goat-chunk-WEYODFTA.mjs +0 -41
@@ -4,14 +4,16 @@ import {
4
4
  accumulateResidentLine,
5
5
  claudeConfigDir,
6
6
  createResidentContextStats,
7
- estimateTokens,
8
7
  summarizeResidentContext
9
- } from "./token-goat-chunk-QZZPWFVF.mjs";
8
+ } from "./token-goat-chunk-MAMQPC43.mjs";
10
9
  import {
11
10
  commandHash,
12
11
  getBashOutput,
13
12
  normalizeCommandForCacheKey
14
- } from "./token-goat-chunk-BIBZQRC6.mjs";
13
+ } from "./token-goat-chunk-HXNAC4ZF.mjs";
14
+ import {
15
+ estimateTokens
16
+ } from "./token-goat-chunk-4JMWPWCS.mjs";
15
17
  import {
16
18
  init_define_import_meta_env
17
19
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -25,11 +25,11 @@ import {
25
25
  extractSwift,
26
26
  extractThrift,
27
27
  extractWgsl
28
- } from "./token-goat-chunk-ILROZWXE.mjs";
28
+ } from "./token-goat-chunk-66LODAUT.mjs";
29
29
  import {
30
30
  extractShellBannerHeading
31
- } from "./token-goat-chunk-7PQYG6TN.mjs";
32
- import "./token-goat-chunk-YZ67F2HJ.mjs";
31
+ } from "./token-goat-chunk-D5ICEPSB.mjs";
32
+ import "./token-goat-chunk-HUDC5GS5.mjs";
33
33
  import {
34
34
  GENERIC_CLAUSE,
35
35
  assignBraceBlockSpans,
@@ -59,15 +59,15 @@ import {
59
59
  stripMultilineStringSpan,
60
60
  stripStringLiterals,
61
61
  stripXmlComments
62
- } from "./token-goat-chunk-3FSAZR32.mjs";
63
- import "./token-goat-chunk-UTKNLKYE.mjs";
62
+ } from "./token-goat-chunk-M56BWPBN.mjs";
63
+ import "./token-goat-chunk-CC2PYJM7.mjs";
64
64
  import "./token-goat-chunk-EEIDFMEM.mjs";
65
65
  import "./token-goat-chunk-OSUFN2FV.mjs";
66
66
  import {
67
67
  countContentLines,
68
68
  escapeRegExp,
69
69
  pushAll
70
- } from "./token-goat-chunk-YE4TGC4Z.mjs";
70
+ } from "./token-goat-chunk-L45ZQRT7.mjs";
71
71
  import "./token-goat-chunk-NMTKNYGF.mjs";
72
72
  import "./token-goat-chunk-Y4AFKTHK.mjs";
73
73
  import "./token-goat-chunk-GMOUBOX4.mjs";
@@ -3704,6 +3704,7 @@ function stripLeadingAttributes2(text) {
3704
3704
  var FUNC_RE7 = new RegExp(`^(?:function|filter|workflow|configuration)\\s+(?:(?:global|local|script|private):)?(${FUNC_IDENT})`, "i");
3705
3705
  var CLASS_RE5 = new RegExp(`^(class|enum)\\s+(${IDENT2})`, "i");
3706
3706
  var PESTER_RE = /^(Describe|Context|It)\b(?:\s+-[A-Za-z0-9_-]+(?:\s+(?:'[^']*'|"[^"]*"|[^\s{]+))?)*\s*(?:'([^']*)'|"([^"]*)"|([A-Za-z0-9_.-]+))/i;
3707
+ var PESTER_SETUP_RE = /^(BeforeAll|BeforeEach|AfterAll|AfterEach)\b(?:\s+-[A-Za-z0-9_-]+(?:\s+(?:'[^']*'|"[^"]*"|[^\s{]+))?)*\s*(?:'([^']*)'|"([^"]*)"|([A-Za-z0-9_.-]+))?/i;
3707
3708
  var METHOD_NAME_RE = new RegExp(
3708
3709
  `^(?!(?:if|elseif|else|while|for|foreach|do|switch|return|throw|try|catch|finally|param|begin|process|end)\\b)(${IDENT2})\\s*\\(`,
3709
3710
  "i"
@@ -3773,32 +3774,51 @@ function extractPowershell(content, filePath) {
3773
3774
  if (!stripped) {
3774
3775
  continue;
3775
3776
  }
3776
- if (braceDepth === 0 && currentClass === null) {
3777
+ const isPesterScope = openBlocks.some((b) => b.kind === "test" || b.kind === "context" || b.kind === "setup" || b.kind === "describe");
3778
+ if ((braceDepth === 0 || isPesterScope) && currentClass === null) {
3777
3779
  const funcMatch = FUNC_RE7.exec(stripped);
3778
3780
  if (funcMatch) {
3779
3781
  const fname = funcMatch[1] ?? "";
3780
3782
  if (symbols.length < MAX_SYMBOLS9) {
3781
3783
  const pushIdx = symbols.length;
3782
- symbols.push(makeLineSymbol(filePath, fname, "function", lineNum, line.trimEnd().slice(0, 200), void 0, lines, "hash"));
3784
+ const parentBlock = [...openBlocks].reverse().find((b) => b.kind === "test" || b.kind === "context" || b.kind === "setup" || b.kind === "describe");
3785
+ const parentName = parentBlock !== void 0 ? symbols[parentBlock.symbolIndex]?.name : void 0;
3786
+ symbols.push(makeLineSymbol(filePath, fname, "function", lineNum, line.trimEnd().slice(0, 200), parentName, lines, "hash"));
3783
3787
  openBlocks.push({ symbolIndex: pushIdx, kind: "function", braceDepth, entered: false });
3784
3788
  }
3785
3789
  }
3786
3790
  }
3787
3791
  if (currentClass === null) {
3788
- const pesterTrigger = /^(?:Describe|Context|It)\b/i.exec(stripped);
3792
+ const pesterTrigger = /^(?:Describe|Context|It|BeforeAll|BeforeEach|AfterAll|AfterEach)\b/i.exec(stripped);
3789
3793
  if (pesterTrigger) {
3790
3794
  const rawLine = sourceLine.trimStart();
3791
- const pesterMatch = PESTER_RE.exec(rawLine);
3792
- if (pesterMatch) {
3793
- const blockType = (pesterMatch[1] ?? "").toLowerCase();
3794
- const testName = (pesterMatch[2] ?? pesterMatch[3] ?? pesterMatch[4] ?? "").trim();
3795
- if (testName && symbols.length < MAX_SYMBOLS9) {
3796
- const kind = blockType === "context" ? "context" : "test";
3797
- const parentBlock = [...openBlocks].reverse().find((b) => b.kind === "test" || b.kind === "context");
3798
- const parentName = parentBlock !== void 0 ? symbols[parentBlock.symbolIndex]?.name : void 0;
3799
- const pushIdx = symbols.length;
3800
- symbols.push(makeLineSymbol(filePath, testName, kind, lineNum, sourceLine.trimEnd().slice(0, 200), parentName, lines, "hash"));
3801
- openBlocks.push({ symbolIndex: pushIdx, kind, braceDepth, entered: false });
3795
+ const isSetupBlock = /^(?:BeforeAll|BeforeEach|AfterAll|AfterEach)\b/i.test(stripped);
3796
+ if (isSetupBlock) {
3797
+ const pesterMatch = PESTER_SETUP_RE.exec(rawLine);
3798
+ if (pesterMatch) {
3799
+ const explicitName = (pesterMatch[2] ?? pesterMatch[3] ?? pesterMatch[4] ?? "").trim();
3800
+ const testName = explicitName || (pesterMatch[1] ?? "BeforeAll");
3801
+ if (testName && symbols.length < MAX_SYMBOLS9) {
3802
+ const parentBlock = [...openBlocks].reverse().find((b) => b.kind === "test" || b.kind === "context" || b.kind === "setup" || b.kind === "describe");
3803
+ const parentName = parentBlock !== void 0 ? symbols[parentBlock.symbolIndex]?.name : void 0;
3804
+ const pushIdx = symbols.length;
3805
+ symbols.push(makeLineSymbol(filePath, testName, "setup", lineNum, sourceLine.trimEnd().slice(0, 200), parentName, lines, "hash"));
3806
+ openBlocks.push({ symbolIndex: pushIdx, kind: "setup", braceDepth, entered: false });
3807
+ }
3808
+ }
3809
+ } else {
3810
+ const pesterMatch = PESTER_RE.exec(rawLine);
3811
+ if (pesterMatch) {
3812
+ const blockType = (pesterMatch[1] ?? "").toLowerCase();
3813
+ const testName = (pesterMatch[2] ?? pesterMatch[3] ?? pesterMatch[4] ?? "").trim();
3814
+ if (testName && symbols.length < MAX_SYMBOLS9) {
3815
+ const kind = blockType === "context" ? "context" : "test";
3816
+ const parentBlock = [...openBlocks].reverse().find((b) => b.kind === "test" || b.kind === "context" || b.kind === "setup" || b.kind === "describe");
3817
+ const parentName = parentBlock !== void 0 ? symbols[parentBlock.symbolIndex]?.name : void 0;
3818
+ const pushIdx = symbols.length;
3819
+ symbols.push(makeLineSymbol(filePath, testName, kind, lineNum, sourceLine.trimEnd().slice(0, 200), parentName, lines, "hash"));
3820
+ openBlocks.push({ symbolIndex: pushIdx, kind, braceDepth, entered: false });
3821
+ }
3802
3822
  }
3803
3823
  }
3804
3824
  }