token-goat 2.9.26 → 2.9.29

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 (78) hide show
  1. package/README.md +30 -88
  2. package/SECURITY.md +14 -0
  3. package/dist/{token-goat-chunk-OZRSREKR.mjs → token-goat-chunk-2AWQ2R5X.mjs} +2 -2
  4. package/dist/{token-goat-chunk-BH4ZVRB2.mjs → token-goat-chunk-2NNUA2LR.mjs} +4 -4
  5. package/dist/token-goat-chunk-2WOUYWLM.mjs +955 -0
  6. package/dist/{token-goat-chunk-IKZLSRII.mjs → token-goat-chunk-435UQTKD.mjs} +5 -3
  7. package/dist/{token-goat-chunk-62IHOU6L.mjs → token-goat-chunk-44BM7DDQ.mjs} +5 -3
  8. package/dist/token-goat-chunk-52NSDWYY.mjs +96 -0
  9. package/dist/{token-goat-chunk-CXBOFPF4.mjs → token-goat-chunk-67BNIKKO.mjs} +32 -18
  10. package/dist/{token-goat-chunk-XBESNWEX.mjs → token-goat-chunk-6AK46ZT7.mjs} +2 -3
  11. package/dist/{token-goat-chunk-7SXPJOSZ.mjs → token-goat-chunk-7CPMDFGB.mjs} +166 -40
  12. package/dist/token-goat-chunk-ASLWOQ3I.mjs +14 -0
  13. package/dist/{token-goat-chunk-MWID3YOY.mjs → token-goat-chunk-BGYOZ6DO.mjs} +6 -4
  14. package/dist/{token-goat-chunk-PAV6NNY7.mjs → token-goat-chunk-C5YPNZKQ.mjs} +22 -8
  15. package/dist/{token-goat-chunk-D2X7XN5M.mjs → token-goat-chunk-CIQ2FTY3.mjs} +23 -242
  16. package/dist/token-goat-chunk-D4ETHJD6.mjs +246 -0
  17. package/dist/{token-goat-chunk-7Y6GWTII.mjs → token-goat-chunk-DNRPXHYH.mjs} +25 -17
  18. package/dist/{token-goat-chunk-L43RKNHA.mjs → token-goat-chunk-DNSPXQXQ.mjs} +2 -2
  19. package/dist/token-goat-chunk-DPNLUJWB.mjs +220 -0
  20. package/dist/token-goat-chunk-E4ZOJIZK.mjs +1382 -0
  21. package/dist/token-goat-chunk-E5TK5DNO.mjs +718 -0
  22. package/dist/{token-goat-chunk-VVROQBQJ.mjs → token-goat-chunk-EUSDXRXU.mjs} +62 -12
  23. package/dist/{token-goat-chunk-POOI26O6.mjs → token-goat-chunk-FTP4U4QA.mjs} +12 -8
  24. package/dist/token-goat-chunk-G23DWHV4.mjs +142 -0
  25. package/dist/{token-goat-chunk-MDV5VWF4.mjs → token-goat-chunk-G7IWXCFF.mjs} +223 -15
  26. package/dist/{token-goat-chunk-C2PG4K5D.mjs → token-goat-chunk-GLXRTTLE.mjs} +7 -5
  27. package/dist/{token-goat-chunk-M6CVNHTW.mjs → token-goat-chunk-H5J3C56Q.mjs} +95 -573
  28. package/dist/{token-goat-chunk-BAWKGODL.mjs → token-goat-chunk-HNFZZHFW.mjs} +2 -2
  29. package/dist/{token-goat-chunk-TG5ZPD6B.mjs → token-goat-chunk-HUYUHODZ.mjs} +1036 -759
  30. package/dist/token-goat-chunk-IVE6U7KV.mjs +53 -0
  31. package/dist/{token-goat-chunk-ZZT6PVB3.mjs → token-goat-chunk-IVWI2OCK.mjs} +72 -45
  32. package/dist/{token-goat-chunk-GMOUBOX4.mjs → token-goat-chunk-JTKCQMQA.mjs} +37 -5
  33. package/dist/{token-goat-chunk-H2CPLEMP.mjs → token-goat-chunk-KOPIR3KZ.mjs} +46 -23
  34. package/dist/token-goat-chunk-L7H3U27L.mjs +35 -0
  35. package/dist/{token-goat-chunk-FLEYOCAS.mjs → token-goat-chunk-LZNBQTDK.mjs} +6 -4
  36. package/dist/token-goat-chunk-MELOKFDJ.mjs +199 -0
  37. package/dist/{token-goat-chunk-RH27ZSPF.mjs → token-goat-chunk-NMBWLRHW.mjs} +164 -50
  38. package/dist/{token-goat-chunk-43JFN26X.mjs → token-goat-chunk-O6I2XU4P.mjs} +27 -967
  39. package/dist/{token-goat-chunk-G6EYO5CD.mjs → token-goat-chunk-ONXH6NZ5.mjs} +2 -87
  40. package/dist/token-goat-chunk-ORNFMIER.mjs +295 -0
  41. package/dist/{token-goat-chunk-LHUP4DXZ.mjs → token-goat-chunk-PGTH2U4C.mjs} +1 -1
  42. package/dist/{token-goat-chunk-5BQ7W7D7.mjs → token-goat-chunk-PKRWMHVP.mjs} +76 -59
  43. package/dist/{token-goat-chunk-DA43OE7L.mjs → token-goat-chunk-PQ53BSCF.mjs} +1 -1
  44. package/dist/{token-goat-chunk-STYRLQIW.mjs → token-goat-chunk-PYSUADX4.mjs} +2 -2
  45. package/dist/{token-goat-chunk-JALB3KWJ.mjs → token-goat-chunk-QO3LXVVR.mjs} +4247 -5005
  46. package/dist/{token-goat-chunk-L45IWWMC.mjs → token-goat-chunk-RLP6J7WR.mjs} +6 -6
  47. package/dist/token-goat-chunk-RQGGMPCR.mjs +205 -0
  48. package/dist/{token-goat-chunk-MBDJR6HU.mjs → token-goat-chunk-RTMVLHWX.mjs} +3708 -4003
  49. package/dist/{token-goat-chunk-E3K3BTEQ.mjs → token-goat-chunk-S4VSXURL.mjs} +8 -6
  50. package/dist/{token-goat-chunk-LKSXAMJB.mjs → token-goat-chunk-SE6E4BKJ.mjs} +1 -1
  51. package/dist/token-goat-chunk-TCQANXYC.mjs +351 -0
  52. package/dist/token-goat-chunk-TDUT2CL6.mjs +564 -0
  53. package/dist/{token-goat-chunk-LRIZ7K3F.mjs → token-goat-chunk-TGOXNAHW.mjs} +54 -111
  54. package/dist/{token-goat-chunk-WNBSCSAI.mjs → token-goat-chunk-UA5BKWWQ.mjs} +1 -1
  55. package/dist/{token-goat-chunk-RIB6XY2V.mjs → token-goat-chunk-UXSXQQIY.mjs} +1 -1
  56. package/dist/{token-goat-chunk-7EPYB34H.mjs → token-goat-chunk-VMFWNHGR.mjs} +84 -73
  57. package/dist/token-goat-chunk-VQ6F6T7X.mjs +36 -0
  58. package/dist/{token-goat-chunk-5M3NRJD2.mjs → token-goat-chunk-VZQEWRVH.mjs} +6 -4
  59. package/dist/{token-goat-chunk-OSUFN2FV.mjs → token-goat-chunk-XB5KKOCG.mjs} +5 -25
  60. package/dist/{token-goat-chunk-6E2IDLHF.mjs → token-goat-chunk-XYWPOSCN.mjs} +57 -615
  61. package/dist/{token-goat-chunk-CQHY4SL7.mjs → token-goat-chunk-YAGLESS3.mjs} +8 -5
  62. package/dist/token-goat-chunk-YKSRAWUU.mjs +33 -0
  63. package/dist/{token-goat-chunk-F2ARFHLJ.mjs → token-goat-chunk-YOOVFPTP.mjs} +2 -2
  64. package/dist/{token-goat-chunk-EEIDFMEM.mjs → token-goat-chunk-YZAAZU2S.mjs} +12 -3
  65. package/dist/token-goat-chunk-Z6KBMOBI.mjs +53 -0
  66. package/dist/{token-goat-chunk-4GEDH2WU.mjs → token-goat-chunk-ZER6EAXZ.mjs} +81 -70
  67. package/dist/token-goat-hook-client.cjs +475 -0
  68. package/dist/token-goat-hook-client.mjs +26 -0
  69. package/dist/token-goat-hook.mjs +31 -21
  70. package/dist/token-goat.core.mjs +9 -39
  71. package/docs/C4_RUNTIME_ARCHITECTURE.md +2 -2
  72. package/docs/cli.md +35 -23
  73. package/docs/install.md +18 -14
  74. package/package.json +1 -1
  75. package/dist/token-goat-chunk-ADMR3QVF.mjs +0 -41
  76. package/dist/token-goat-chunk-E6B2UFDF.mjs +0 -30
  77. package/dist/token-goat-chunk-GKZ2US5B.mjs +0 -187
  78. package/dist/token-goat-chunk-MZTO4FXH.mjs +0 -26
@@ -5,12 +5,15 @@ import {
5
5
  cmdUpgrade,
6
6
  compareSemver,
7
7
  fetchLatestVersion
8
- } from "./token-goat-chunk-BH4ZVRB2.mjs";
9
- import "./token-goat-chunk-LRIZ7K3F.mjs";
10
- import "./token-goat-chunk-EEIDFMEM.mjs";
11
- import "./token-goat-chunk-6E2IDLHF.mjs";
8
+ } from "./token-goat-chunk-2NNUA2LR.mjs";
9
+ import "./token-goat-chunk-TGOXNAHW.mjs";
10
+ import "./token-goat-chunk-YZAAZU2S.mjs";
11
+ import "./token-goat-chunk-IVE6U7KV.mjs";
12
+ import "./token-goat-chunk-XYWPOSCN.mjs";
13
+ import "./token-goat-chunk-TCQANXYC.mjs";
12
14
  import "./token-goat-chunk-NMTKNYGF.mjs";
13
- import "./token-goat-chunk-GMOUBOX4.mjs";
15
+ import "./token-goat-chunk-MELOKFDJ.mjs";
16
+ import "./token-goat-chunk-JTKCQMQA.mjs";
14
17
  import "./token-goat-chunk-A37V4PBF.mjs";
15
18
  export {
16
19
  checkUpdateStatus,
@@ -0,0 +1,33 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ MAX_RESUME_CHARS,
5
+ MAX_RESUME_TOKENS,
6
+ buildResumePacket
7
+ } from "./token-goat-chunk-RLP6J7WR.mjs";
8
+ import "./token-goat-chunk-G7IWXCFF.mjs";
9
+ import "./token-goat-chunk-H5J3C56Q.mjs";
10
+ import "./token-goat-chunk-TDUT2CL6.mjs";
11
+ import "./token-goat-chunk-ONXH6NZ5.mjs";
12
+ import "./token-goat-chunk-O6I2XU4P.mjs";
13
+ import "./token-goat-chunk-D4ETHJD6.mjs";
14
+ import "./token-goat-chunk-52NSDWYY.mjs";
15
+ import "./token-goat-chunk-2WOUYWLM.mjs";
16
+ import "./token-goat-chunk-CIQ2FTY3.mjs";
17
+ import "./token-goat-chunk-435UQTKD.mjs";
18
+ import "./token-goat-chunk-7CPMDFGB.mjs";
19
+ import "./token-goat-chunk-TGOXNAHW.mjs";
20
+ import "./token-goat-chunk-XB5KKOCG.mjs";
21
+ import "./token-goat-chunk-YZAAZU2S.mjs";
22
+ import "./token-goat-chunk-IVE6U7KV.mjs";
23
+ import "./token-goat-chunk-XYWPOSCN.mjs";
24
+ import "./token-goat-chunk-TCQANXYC.mjs";
25
+ import "./token-goat-chunk-NMTKNYGF.mjs";
26
+ import "./token-goat-chunk-MELOKFDJ.mjs";
27
+ import "./token-goat-chunk-JTKCQMQA.mjs";
28
+ import "./token-goat-chunk-A37V4PBF.mjs";
29
+ export {
30
+ MAX_RESUME_CHARS,
31
+ MAX_RESUME_TOKENS,
32
+ buildResumePacket
33
+ };
@@ -27,10 +27,10 @@ import {
27
27
  reconstructLayout,
28
28
  resolveDestPage,
29
29
  withPdfDocument
30
- } from "./token-goat-chunk-LKSXAMJB.mjs";
30
+ } from "./token-goat-chunk-SE6E4BKJ.mjs";
31
31
  import "./token-goat-chunk-AH6QILZM.mjs";
32
32
  import "./token-goat-chunk-Y4AFKTHK.mjs";
33
- import "./token-goat-chunk-GMOUBOX4.mjs";
33
+ import "./token-goat-chunk-JTKCQMQA.mjs";
34
34
  import "./token-goat-chunk-A37V4PBF.mjs";
35
35
  export {
36
36
  MAX_LOCATE_CONTEXT_CHARS,
@@ -7,12 +7,20 @@ import {
7
7
  // src/reset.ts
8
8
  init_define_import_meta_env();
9
9
  var _resets = [];
10
- function registerReset(fn) {
10
+ var _perRequestResets = [];
11
+ function registerReset(fn, opts = {}) {
11
12
  _resets.push(fn);
13
+ if (opts.perRequest === true) _perRequestResets.push(fn);
12
14
  }
13
15
  function clearModuleCaches() {
16
+ runResets(_resets);
17
+ }
18
+ function clearPerRequestCaches() {
19
+ runResets(_perRequestResets);
20
+ }
21
+ function runResets(resets) {
14
22
  const errors = [];
15
- for (const fn of _resets) {
23
+ for (const fn of resets) {
16
24
  try {
17
25
  fn();
18
26
  } catch (err) {
@@ -29,5 +37,6 @@ function clearModuleCaches() {
29
37
 
30
38
  export {
31
39
  registerReset,
32
- clearModuleCaches
40
+ clearModuleCaches,
41
+ clearPerRequestCaches
33
42
  };
@@ -0,0 +1,53 @@
1
+ import { createRequire as __cjsRequire } from 'node:module';
2
+ const require = __cjsRequire(import.meta.url);
3
+ import {
4
+ RELAY_QUEUE_WAIT_MS,
5
+ buildEvent,
6
+ relay,
7
+ relayInProcess
8
+ } from "./token-goat-chunk-QO3LXVVR.mjs";
9
+ import "./token-goat-chunk-IVWI2OCK.mjs";
10
+ import {
11
+ MAX_STDIN_BYTES,
12
+ readStdinJson
13
+ } from "./token-goat-chunk-DNRPXHYH.mjs";
14
+ import "./token-goat-chunk-RTMVLHWX.mjs";
15
+ import "./token-goat-chunk-L7H3U27L.mjs";
16
+ import "./token-goat-chunk-RRNZMM3A.mjs";
17
+ import "./token-goat-chunk-E4ZOJIZK.mjs";
18
+ import "./token-goat-chunk-E5TK5DNO.mjs";
19
+ import "./token-goat-chunk-ZER6EAXZ.mjs";
20
+ import "./token-goat-chunk-44BM7DDQ.mjs";
21
+ import "./token-goat-chunk-EUSDXRXU.mjs";
22
+ import "./token-goat-chunk-G7IWXCFF.mjs";
23
+ import "./token-goat-chunk-H5J3C56Q.mjs";
24
+ import "./token-goat-chunk-TDUT2CL6.mjs";
25
+ import "./token-goat-chunk-ONXH6NZ5.mjs";
26
+ import "./token-goat-chunk-O6I2XU4P.mjs";
27
+ import "./token-goat-chunk-D4ETHJD6.mjs";
28
+ import "./token-goat-chunk-52NSDWYY.mjs";
29
+ import "./token-goat-chunk-2WOUYWLM.mjs";
30
+ import "./token-goat-chunk-CIQ2FTY3.mjs";
31
+ import "./token-goat-chunk-3BTK54F3.mjs";
32
+ import "./token-goat-chunk-VMFWNHGR.mjs";
33
+ import "./token-goat-chunk-435UQTKD.mjs";
34
+ import "./token-goat-chunk-7CPMDFGB.mjs";
35
+ import "./token-goat-chunk-TGOXNAHW.mjs";
36
+ import "./token-goat-chunk-XB5KKOCG.mjs";
37
+ import "./token-goat-chunk-YZAAZU2S.mjs";
38
+ import "./token-goat-chunk-IVE6U7KV.mjs";
39
+ import "./token-goat-chunk-XYWPOSCN.mjs";
40
+ import "./token-goat-chunk-TCQANXYC.mjs";
41
+ import "./token-goat-chunk-NMTKNYGF.mjs";
42
+ import "./token-goat-chunk-MELOKFDJ.mjs";
43
+ import "./token-goat-chunk-Y4AFKTHK.mjs";
44
+ import "./token-goat-chunk-JTKCQMQA.mjs";
45
+ import "./token-goat-chunk-A37V4PBF.mjs";
46
+ export {
47
+ MAX_STDIN_BYTES,
48
+ RELAY_QUEUE_WAIT_MS,
49
+ buildEvent,
50
+ readStdinJson,
51
+ relay,
52
+ relayInProcess
53
+ };
@@ -44,15 +44,15 @@ import {
44
44
  trimRepeatedPrefix,
45
45
  truncateMiddleSmart,
46
46
  truncateTableRows
47
- } from "./token-goat-chunk-43JFN26X.mjs";
47
+ } from "./token-goat-chunk-2WOUYWLM.mjs";
48
48
  import {
49
49
  redactSecrets,
50
50
  savedTokensFromBytes,
51
51
  stripAnsiEscapes
52
- } from "./token-goat-chunk-D2X7XN5M.mjs";
52
+ } from "./token-goat-chunk-CIQ2FTY3.mjs";
53
53
  import {
54
54
  loadConfig
55
- } from "./token-goat-chunk-LRIZ7K3F.mjs";
55
+ } from "./token-goat-chunk-TGOXNAHW.mjs";
56
56
  import {
57
57
  resolveIndexPath
58
58
  } from "./token-goat-chunk-NMTKNYGF.mjs";
@@ -281,11 +281,11 @@ ${body}`;
281
281
  }
282
282
  };
283
283
 
284
- // src/tool_filters/dispatch.ts
285
- init_define_import_meta_env();
286
-
287
284
  // src/tool_filters/generic.ts
288
285
  init_define_import_meta_env();
286
+ var PassthroughFilter = class extends ToolFilter {
287
+ name = "passthrough";
288
+ };
289
289
  var GenericFilter = class extends ToolFilter {
290
290
  name = "generic";
291
291
  compress(stdout, stderr, _exitCode, _argv) {
@@ -305,6 +305,9 @@ ${errPart}` : errPart;
305
305
  }
306
306
  };
307
307
 
308
+ // src/tool_filters/dispatch.ts
309
+ init_define_import_meta_env();
310
+
308
311
  // src/tool_filters/go_test.ts
309
312
  init_define_import_meta_env();
310
313
  var TEST_RUN_RE = /^=== (RUN|PAUSE|CONT|NAME)\s/;
@@ -717,6 +720,43 @@ function makeNodeTestRunnerFilter(cfg) {
717
720
  }
718
721
  }();
719
722
  }
723
+ function initCountedRules(rules) {
724
+ return rules.map(() => ({ count: 0, lastLine: void 0 }));
725
+ }
726
+ function countedRuleMatches(rule, line) {
727
+ return rule.res ? rule.res.some((r) => r.test(line)) : rule.re?.test(line) ?? false;
728
+ }
729
+ function applyCountedRules(rules, counts, line) {
730
+ for (let i = 0; i < rules.length; i++) {
731
+ if (countedRuleMatches(rules[i], line)) {
732
+ counts[i].count++;
733
+ if (rules[i].keepLast) counts[i].lastLine = line.trim();
734
+ return i;
735
+ }
736
+ }
737
+ return -1;
738
+ }
739
+ function assembleCountedOutput(rules, counts, kept) {
740
+ const out = [];
741
+ for (let i = 0; i < rules.length; i++) {
742
+ if (rules[i].position === "prepend" && counts[i].count > 0)
743
+ out.push(rules[i].note(counts[i].count, counts[i].lastLine));
744
+ }
745
+ out.push(...kept);
746
+ for (let i = 0; i < rules.length; i++) {
747
+ if (rules[i].position === "append" && counts[i].count > 0)
748
+ out.push(rules[i].note(counts[i].count, counts[i].lastLine));
749
+ }
750
+ return out;
751
+ }
752
+ function countedRuleNotes(rules, counts) {
753
+ const notes = [];
754
+ for (let i = 0; i < rules.length; i++) {
755
+ if (rules[i].position === "note" && counts[i].count > 0)
756
+ notes.push(rules[i].note(counts[i].count, counts[i].lastLine));
757
+ }
758
+ return notes;
759
+ }
720
760
  function makeAiCliFilter(cfg) {
721
761
  return new class extends ToolFilter {
722
762
  name = cfg.name;
@@ -732,7 +772,7 @@ function makeAiCliFilter(cfg) {
732
772
  const kept = [];
733
773
  let droppedNoise = 0;
734
774
  const rules = cfg.countedRules ?? [];
735
- const counts = rules.map(() => ({ count: 0, lastLine: void 0 }));
775
+ const counts = initCountedRules(rules);
736
776
  const klRules = cfg.keepLastRules ?? [];
737
777
  const klValues = klRules.map(() => void 0);
738
778
  for (const line of lines) {
@@ -753,18 +793,7 @@ function makeAiCliFilter(cfg) {
753
793
  }
754
794
  }
755
795
  if (dropped) continue;
756
- let counted = false;
757
- for (let i = 0; i < rules.length; i++) {
758
- const rule = rules[i];
759
- const matched = rule.res ? rule.res.some((r) => r.test(line)) : rule.re.test(line);
760
- if (matched) {
761
- counts[i].count++;
762
- if (rule.keepLast) counts[i].lastLine = line.trim();
763
- counted = true;
764
- break;
765
- }
766
- }
767
- if (counted) continue;
796
+ if (applyCountedRules(rules, counts, line) >= 0) continue;
768
797
  let kl = false;
769
798
  for (let i = 0; i < klRules.length; i++) {
770
799
  if (klRules[i].re.test(line)) {
@@ -776,24 +805,8 @@ function makeAiCliFilter(cfg) {
776
805
  if (kl) continue;
777
806
  kept.push(line);
778
807
  }
779
- const out = [];
780
- for (let i = 0; i < rules.length; i++) {
781
- if (rules[i].position === "prepend" && counts[i].count > 0) {
782
- out.push(rules[i].note(counts[i].count, counts[i].lastLine));
783
- }
784
- }
785
- out.push(...kept);
786
- for (let i = 0; i < rules.length; i++) {
787
- if (rules[i].position === "append" && counts[i].count > 0) {
788
- out.push(rules[i].note(counts[i].count, counts[i].lastLine));
789
- }
790
- }
791
- const notes = [];
792
- for (let i = 0; i < rules.length; i++) {
793
- if (rules[i].position === "note" && counts[i].count > 0) {
794
- notes.push(rules[i].note(counts[i].count, counts[i].lastLine));
795
- }
796
- }
808
+ const out = assembleCountedOutput(rules, counts, kept);
809
+ const notes = countedRuleNotes(rules, counts);
797
810
  for (let i = 0; i < klRules.length; i++) {
798
811
  const v = klValues[i];
799
812
  if (v !== void 0) notes.push(klRules[i].note(v));
@@ -822,7 +835,7 @@ function makeLanguageFilter(cfg) {
822
835
  const kept = [];
823
836
  let droppedNoise = 0;
824
837
  const rules = cfg.countedRules ?? [];
825
- const counts = rules.map(() => ({ count: 0, lastLine: void 0 }));
838
+ const counts = initCountedRules(rules);
826
839
  const dRules = cfg.dedupeRules ?? [];
827
840
  const dState = dRules.map(() => ({ elided: 0, seen: /* @__PURE__ */ new Map() }));
828
841
  for (const line of lines) {
@@ -830,18 +843,7 @@ function makeLanguageFilter(cfg) {
830
843
  kept.push(line);
831
844
  continue;
832
845
  }
833
- let counted = false;
834
- for (let i = 0; i < rules.length; i++) {
835
- const rule = rules[i];
836
- const hit = rule.res ? rule.res.some((r) => r.test(line)) : rule.re?.test(line) ?? false;
837
- if (hit) {
838
- counts[i].count++;
839
- if (rule.keepLast) counts[i].lastLine = line.trim();
840
- counted = true;
841
- break;
842
- }
843
- }
844
- if (counted) continue;
846
+ if (applyCountedRules(rules, counts, line) >= 0) continue;
845
847
  let deduped = false;
846
848
  for (let i = 0; i < dRules.length; i++) {
847
849
  if (dRules[i].re.test(line)) {
@@ -862,21 +864,8 @@ function makeLanguageFilter(cfg) {
862
864
  }
863
865
  kept.push(line);
864
866
  }
865
- const out = [];
866
- for (let i = 0; i < rules.length; i++) {
867
- if (rules[i].position === "prepend" && counts[i].count > 0)
868
- out.push(rules[i].note(counts[i].count, counts[i].lastLine));
869
- }
870
- out.push(...kept);
871
- for (let i = 0; i < rules.length; i++) {
872
- if (rules[i].position === "append" && counts[i].count > 0)
873
- out.push(rules[i].note(counts[i].count, counts[i].lastLine));
874
- }
875
- const notes = [];
876
- for (let i = 0; i < rules.length; i++) {
877
- if (rules[i].position === "note" && counts[i].count > 0)
878
- notes.push(rules[i].note(counts[i].count, counts[i].lastLine));
879
- }
867
+ const out = assembleCountedOutput(rules, counts, kept);
868
+ const notes = countedRuleNotes(rules, counts);
880
869
  for (let i = 0; i < dRules.length; i++) {
881
870
  if (dState[i].elided > 0) notes.push(dRules[i].note(dState[i].elided));
882
871
  }
@@ -5063,13 +5052,19 @@ function grepFlagInCluster(argv, short, long) {
5063
5052
  var _GREP_GLUED_VALUE_SHORT_FLAGS = "ABCDdefgm";
5064
5053
  var _RG_GLUED_VALUE_SHORT_FLAGS = "ABCEMTdefgjmrt";
5065
5054
  function gluedValueShortFlags(argv) {
5066
- return pathStem(argv[0] ?? "").toLowerCase() === "rg" ? _RG_GLUED_VALUE_SHORT_FLAGS : _GREP_GLUED_VALUE_SHORT_FLAGS;
5055
+ return isRgCommand(argv) ? _RG_GLUED_VALUE_SHORT_FLAGS : _GREP_GLUED_VALUE_SHORT_FLAGS;
5056
+ }
5057
+ function isRgCommand(argv) {
5058
+ return pathStem(argv[0] ?? "").toLowerCase() === "rg";
5067
5059
  }
5068
5060
  function isFilesOnlySearch(argv) {
5069
- return grepFlagInCluster(argv, "l", "--files-with-matches");
5061
+ if (grepFlagInCluster(argv, "l", "--files-with-matches")) return true;
5062
+ if (argv.includes("--files")) return true;
5063
+ if (isRgCommand(argv)) return argv.includes("--files-without-match");
5064
+ return grepFlagInCluster(argv, "L", "--files-without-match");
5070
5065
  }
5071
5066
  function isCountOnlySearch(argv) {
5072
- return grepFlagInCluster(argv, "c", "--count");
5067
+ return grepFlagInCluster(argv, "c", "--count") || argv.includes("--count-matches");
5073
5068
  }
5074
5069
  function isStructuredOutputSearch(argv) {
5075
5070
  return argv.includes("--json");
@@ -7371,7 +7366,7 @@ var PWSH_PROGRESS_RECORD_RE = /^(?:Processing record\s+\d+\s+of\s+\d+|PROGRESS:\
7371
7366
  var PS_CNF_ERROR_RE = /^(\S.*?) : (?:The term '.*?' is|.*? is) not recognized as the name of a cmdlet, function, script file, or operable program\.\r?\n(?:.*\r?\n)*?[ \t]*\+ CategoryInfo\s*:\s*ObjectNotFound:\s*\(([^:]*):String\)\s*\[\],\s*CommandNotFoundException\r?\n[ \t]*\+ FullyQualifiedErrorId\s*:\s*CommandNotFoundException\r?\n?/gm;
7372
7367
  var PowerShellErrorFilter = class extends ToolFilter {
7373
7368
  name = "powershell";
7374
- binaries = /* @__PURE__ */ new Set(["pwsh", "powershell", "powershell.exe"]);
7369
+ binaries = /* @__PURE__ */ new Set(["pwsh", "powershell", "powershell.exe", "invoke-pester", "pester"]);
7375
7370
  compress(stdout, stderr, _exitCode, _argv) {
7376
7371
  const merged = this.combineOutput(stdout, stderr);
7377
7372
  const collapsed = this._collapseCommandNotFound(merged);
@@ -9230,6 +9225,20 @@ var KUBECTL_GLOBAL_VALUE_FLAGS = /* @__PURE__ */ new Set([
9230
9225
  "--as-group",
9231
9226
  "--request-timeout"
9232
9227
  ]);
9228
+ var _KUBECTL_STRUCTURED_OUTPUT = /^(json|yaml|go-template|template)/;
9229
+ function kubectlOutputFormat(argv) {
9230
+ for (let i = 1; i < argv.length; i++) {
9231
+ const a = argv[i];
9232
+ if (a === "-o" || a === "--output") return (argv[i + 1] ?? "").toLowerCase();
9233
+ if (a.startsWith("--output=")) return a.slice("--output=".length).toLowerCase();
9234
+ if (a.startsWith("-o=")) return a.slice("-o=".length).toLowerCase();
9235
+ if (a.startsWith("-o") && !a.startsWith("--") && a.length > 2) return a.slice(2).toLowerCase();
9236
+ }
9237
+ return "";
9238
+ }
9239
+ function isKubectlStructuredOutput(argv) {
9240
+ return _KUBECTL_STRUCTURED_OUTPUT.test(kubectlOutputFormat(argv));
9241
+ }
9233
9242
  var KubectlFilter = class extends ToolFilter {
9234
9243
  name = "kubectl";
9235
9244
  binaries = /* @__PURE__ */ new Set(["kubectl", "k", "k9s", "oc"]);
@@ -9238,7 +9247,7 @@ var KubectlFilter = class extends ToolFilter {
9238
9247
  const pos = positionalArgs(argv.slice(1), KUBECTL_GLOBAL_VALUE_FLAGS);
9239
9248
  const subcommand = pos[0] ?? "";
9240
9249
  let text = stdout;
9241
- if (subcommand === "get" || subcommand === "top") {
9250
+ if ((subcommand === "get" || subcommand === "top") && !isKubectlStructuredOutput(argv)) {
9242
9251
  if (text.includes("\n")) {
9243
9252
  const resource = pos[1] ?? "";
9244
9253
  if (resource === "events" || resource === "ev" || resource === "event") {
@@ -13443,6 +13452,7 @@ function deliverCompressed(filter, stdout, stderr, exitCode, argv, opts = {}) {
13443
13452
  }
13444
13453
  function filterByName(name) {
13445
13454
  if (name === "generic") return new GenericFilter();
13455
+ if (name === "passthrough") return new PassthroughFilter();
13446
13456
  for (const f of TOOL_FILTERS) if (f.name === name) return f;
13447
13457
  return null;
13448
13458
  }
@@ -13456,6 +13466,7 @@ export {
13456
13466
  compressedTokensSaved,
13457
13467
  CompressedOutput,
13458
13468
  ToolFilter,
13469
+ PassthroughFilter,
13459
13470
  pytestFilter,
13460
13471
  looksLikePytestOutput,
13461
13472
  TOOL_FILTERS,