token-goat 2.9.13 → 2.9.15

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 (52) hide show
  1. package/README.md +28 -1
  2. package/dist/token-goat-chunk-2X2EBBC6.mjs +277 -0
  3. package/dist/token-goat-chunk-3BTK54F3.mjs +1733 -0
  4. package/dist/token-goat-chunk-3NSDDTGL.mjs +34 -0
  5. package/dist/token-goat-chunk-4EXFN2AW.mjs +29 -0
  6. package/dist/token-goat-chunk-5V7DAC7V.mjs +123 -0
  7. package/dist/token-goat-chunk-6DLVZDB6.mjs +34 -0
  8. package/dist/token-goat-chunk-7ZYK25AO.mjs +24 -0
  9. package/dist/token-goat-chunk-A4JYKD5H.mjs +144 -0
  10. package/dist/token-goat-chunk-AH6QILZM.mjs +26 -0
  11. package/dist/token-goat-chunk-ASYEPR3S.mjs +212 -0
  12. package/dist/{token-goat-chunk-RDITECDL.mjs → token-goat-chunk-ATIFTMRC.mjs} +31 -13
  13. package/dist/{token-goat-chunk-ZZI3IDQZ.mjs → token-goat-chunk-BL5LNGBG.mjs} +3935 -11949
  14. package/dist/{token-goat-chunk-4NXUKV7D.mjs → token-goat-chunk-C5JIO6HK.mjs} +8 -4
  15. package/dist/{token-goat-chunk-FZU7GMUS.mjs → token-goat-chunk-DQ4J5AFF.mjs} +50 -18
  16. package/dist/token-goat-chunk-ERTXEKB6.mjs +228 -0
  17. package/dist/{token-goat-chunk-6B44WLIF.mjs → token-goat-chunk-GIIHUSZX.mjs} +142 -21
  18. package/dist/token-goat-chunk-GMOUBOX4.mjs +386 -0
  19. package/dist/{token-goat-chunk-3ESRORNM.mjs → token-goat-chunk-GMQQA7E4.mjs} +12576 -12326
  20. package/dist/token-goat-chunk-IVUQLQWN.mjs +2046 -0
  21. package/dist/token-goat-chunk-K7F2BFIK.mjs +2430 -0
  22. package/dist/{token-goat-chunk-U7X6LQD2.mjs → token-goat-chunk-LCZBPOIN.mjs} +10197 -9717
  23. package/dist/token-goat-chunk-LMFO66YD.mjs +331 -0
  24. package/dist/token-goat-chunk-LT7JRU6K.mjs +22 -0
  25. package/dist/token-goat-chunk-MZDIJJ3R.mjs +420 -0
  26. package/dist/token-goat-chunk-NDPO7GAH.mjs +177 -0
  27. package/dist/token-goat-chunk-NDRP4KJQ.mjs +4371 -0
  28. package/dist/token-goat-chunk-NEI4NC54.mjs +424 -0
  29. package/dist/token-goat-chunk-NU7TLMQK.mjs +585 -0
  30. package/dist/token-goat-chunk-OSUFN2FV.mjs +326 -0
  31. package/dist/token-goat-chunk-OUGNPMDA.mjs +959 -0
  32. package/dist/token-goat-chunk-PM76YS22.mjs +1341 -0
  33. package/dist/token-goat-chunk-S4XRY446.mjs +2637 -0
  34. package/dist/{token-goat-chunk-YOA4N6WA.mjs → token-goat-chunk-SFAS46RE.mjs} +5 -3
  35. package/dist/{token-goat-chunk-QWSUZWFP.mjs → token-goat-chunk-SZWYESBS.mjs} +793 -650
  36. package/dist/{token-goat-chunk-B3CTCQTH.mjs → token-goat-chunk-XEPXYDPI.mjs} +3 -2
  37. package/dist/token-goat-chunk-XTQAOTSO.mjs +89 -0
  38. package/dist/token-goat-chunk-Y4AFKTHK.mjs +22 -0
  39. package/dist/token-goat-chunk-YKG35VHC.mjs +228 -0
  40. package/dist/{token-goat-chunk-JOXLE672.mjs → token-goat-chunk-YQ7WI2CO.mjs} +990 -106
  41. package/dist/{token-goat-chunk-2WC4ZUXN.mjs → token-goat-chunk-YZX7EFG4.mjs} +1 -1
  42. package/dist/token-goat-chunk-Z6UXPYJA.mjs +62 -0
  43. package/dist/token-goat-hook.mjs +16 -8
  44. package/dist/token-goat.core.mjs +27 -10
  45. package/docs/cli.md +9 -6
  46. package/package.json +4 -2
  47. package/dist/token-goat-chunk-FQCNJV4V.mjs +0 -693
  48. package/dist/token-goat-chunk-JVNPCQB7.mjs +0 -31
  49. package/dist/token-goat-chunk-P2PU4CR5.mjs +0 -26
  50. package/dist/token-goat-chunk-QKXBGBQR.mjs +0 -3653
  51. package/dist/token-goat-chunk-UM47DRD3.mjs +0 -242
  52. package/dist/token-goat-chunk-UMXJN7DI.mjs +0 -5521
@@ -3,7 +3,7 @@ const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  deliveredOutputBytes,
5
5
  wrappedShell
6
- } from "./token-goat-chunk-2WC4ZUXN.mjs";
6
+ } from "./token-goat-chunk-YZX7EFG4.mjs";
7
7
  import {
8
8
  ToolFilter,
9
9
  capTokens,
@@ -12,14 +12,22 @@ import {
12
12
  dispatchArgv,
13
13
  filterByName,
14
14
  selectFilter,
15
- shlexSplit
16
- } from "./token-goat-chunk-JOXLE672.mjs";
15
+ shlexSplit,
16
+ storeBashOutputSync
17
+ } from "./token-goat-chunk-YQ7WI2CO.mjs";
18
+ import "./token-goat-chunk-2X2EBBC6.mjs";
17
19
  import {
18
- loadConfig,
19
20
  recordStat
20
- } from "./token-goat-chunk-UMXJN7DI.mjs";
21
+ } from "./token-goat-chunk-IVUQLQWN.mjs";
22
+ import "./token-goat-chunk-K7F2BFIK.mjs";
23
+ import {
24
+ loadConfig
25
+ } from "./token-goat-chunk-S4XRY446.mjs";
21
26
  import "./token-goat-chunk-EEIDFMEM.mjs";
22
- import "./token-goat-chunk-QKXBGBQR.mjs";
27
+ import "./token-goat-chunk-OSUFN2FV.mjs";
28
+ import "./token-goat-chunk-PM76YS22.mjs";
29
+ import "./token-goat-chunk-ERTXEKB6.mjs";
30
+ import "./token-goat-chunk-GMOUBOX4.mjs";
23
31
  import {
24
32
  init_define_import_meta_env
25
33
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -49,8 +57,8 @@ function resolveFilter(command, filterName, cwd) {
49
57
  if (split === null) return { filter: null, argv };
50
58
  return { filter: selectFilter(split, cwd), argv };
51
59
  }
52
- function baseSpawnOptions(timeout, cwd, env) {
53
- return { shell: wrappedShell(), timeout: timeout * 1e3, cwd, env };
60
+ function baseSpawnOptions(timeout, cwd, env, nativeShell) {
61
+ return { shell: nativeShell ? true : wrappedShell(), timeout: timeout * 1e3, cwd, env };
54
62
  }
55
63
  function signalExitCode(signal) {
56
64
  const num = os.constants.signals[signal];
@@ -77,18 +85,18 @@ function run(command, opts = {}) {
77
85
  const timeout = opts.timeout ?? DEFAULT_TIMEOUT_SECONDS;
78
86
  const { filter, argv } = resolveFilter(command, opts.filterName, opts.cwd);
79
87
  if (filter === null) {
80
- if ((opts.maxTokens ?? 0) > 0) {
88
+ if ((opts.maxTokens ?? 0) > 0 || opts.quietSuccess) {
81
89
  return wrapAndCompress(command, argv, new IdentityFilter(), timeout, resolveProfile(opts.compressionProfile), opts);
82
90
  }
83
- return passthrough(command, timeout, opts.cwd, opts.env);
91
+ return passthrough(command, timeout, opts.cwd, opts.env, opts.nativeShell);
84
92
  }
85
93
  return wrapAndCompress(command, argv, filter, timeout, resolveProfile(opts.compressionProfile), opts);
86
94
  }
87
95
  function runRaw(command, timeout = DEFAULT_TIMEOUT_SECONDS) {
88
96
  return passthrough(command, timeout, void 0, void 0);
89
97
  }
90
- function passthrough(command, timeout, cwd, env) {
91
- const result = spawnSync(command, { ...baseSpawnOptions(timeout, cwd, env), stdio: "inherit" });
98
+ function passthrough(command, timeout, cwd, env, nativeShell) {
99
+ const result = spawnSync(command, { ...baseSpawnOptions(timeout, cwd, env, nativeShell), stdio: "inherit" });
92
100
  if (isTimeout(result.error)) return 124;
93
101
  if (result.status !== null) return result.status;
94
102
  if (result.signal) return signalExitCode(result.signal);
@@ -103,8 +111,9 @@ function decode(buf) {
103
111
  }
104
112
  function wrapAndCompress(command, argv, filter, timeout, profile, opts) {
105
113
  const writeStdout = opts.writeStdout ?? ((s) => process.stdout.write(s));
114
+ const startTime = Date.now();
106
115
  const result = spawnSync(command, {
107
- ...baseSpawnOptions(timeout, opts.cwd, opts.env),
116
+ ...baseSpawnOptions(timeout, opts.cwd, opts.env, opts.nativeShell),
108
117
  stdio: ["ignore", "pipe", "pipe"],
109
118
  maxBuffer: MAX_CAPTURE_BYTES
110
119
  });
@@ -127,6 +136,15 @@ function wrapAndCompress(command, argv, filter, timeout, profile, opts) {
127
136
  } else {
128
137
  exitCode = 0;
129
138
  }
139
+ if (opts.quietSuccess && exitCode === 0) {
140
+ const duration = ((Date.now() - startTime) / 1e3).toFixed(1) + "s";
141
+ const fullRaw = (stdoutText + (stderrText ? "\n" + stderrText : "")).trim();
142
+ const id = storeBashOutputSync(command, fullRaw, 0, opts.cwd ?? null);
143
+ const summary = `[tg: ok] ${command} (${duration}, recall: token-goat bash-output ${id})
144
+ `;
145
+ writeStdout(summary);
146
+ return 0;
147
+ }
130
148
  const limits = resolveCompressLimits();
131
149
  const { applied, marker, compressed, text: delivered } = deliverCompressed(filter, stdoutText, stderrText, exitCode, argv, {
132
150
  compressionProfile: profile,