token-goat 2.9.28 → 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 (77) hide show
  1. package/README.md +2 -0
  2. package/dist/{token-goat-chunk-OZRSREKR.mjs → token-goat-chunk-2AWQ2R5X.mjs} +2 -2
  3. package/dist/{token-goat-chunk-5NNYIUGV.mjs → token-goat-chunk-2NNUA2LR.mjs} +4 -4
  4. package/dist/{token-goat-chunk-4RN64ZND.mjs → token-goat-chunk-2WOUYWLM.mjs} +2 -1
  5. package/dist/{token-goat-chunk-HUDC5GS5.mjs → token-goat-chunk-435UQTKD.mjs} +5 -3
  6. package/dist/{token-goat-chunk-6DQNNFJ6.mjs → token-goat-chunk-44BM7DDQ.mjs} +3 -3
  7. package/dist/{token-goat-chunk-4JMWPWCS.mjs → token-goat-chunk-52NSDWYY.mjs} +2 -2
  8. package/dist/{token-goat-chunk-IHKZ3QNA.mjs → token-goat-chunk-67BNIKKO.mjs} +19 -16
  9. package/dist/{token-goat-chunk-XBESNWEX.mjs → token-goat-chunk-6AK46ZT7.mjs} +2 -3
  10. package/dist/{token-goat-chunk-M56BWPBN.mjs → token-goat-chunk-7CPMDFGB.mjs} +166 -40
  11. package/dist/token-goat-chunk-ASLWOQ3I.mjs +14 -0
  12. package/dist/{token-goat-chunk-QM76S6YS.mjs → token-goat-chunk-BGYOZ6DO.mjs} +6 -4
  13. package/dist/{token-goat-chunk-JXK2HQXS.mjs → token-goat-chunk-C5YPNZKQ.mjs} +3 -3
  14. package/dist/{token-goat-chunk-MVSWBNMD.mjs → token-goat-chunk-CIQ2FTY3.mjs} +19 -14
  15. package/dist/{token-goat-chunk-BJBRGPBX.mjs → token-goat-chunk-D4ETHJD6.mjs} +6 -4
  16. package/dist/{token-goat-chunk-VE27HPIF.mjs → token-goat-chunk-DNRPXHYH.mjs} +21 -17
  17. package/dist/{token-goat-chunk-YWSP6IU7.mjs → token-goat-chunk-DNSPXQXQ.mjs} +2 -2
  18. package/dist/token-goat-chunk-DPNLUJWB.mjs +220 -0
  19. package/dist/{token-goat-chunk-I7CB3X4K.mjs → token-goat-chunk-E4ZOJIZK.mjs} +10 -7
  20. package/dist/{token-goat-chunk-IZXKVT4A.mjs → token-goat-chunk-E5TK5DNO.mjs} +11 -4
  21. package/dist/{token-goat-chunk-MMLMALWK.mjs → token-goat-chunk-EUSDXRXU.mjs} +60 -12
  22. package/dist/{token-goat-chunk-7R2XYKC5.mjs → token-goat-chunk-FTP4U4QA.mjs} +12 -9
  23. package/dist/{token-goat-chunk-LEG3JNJ6.mjs → token-goat-chunk-G23DWHV4.mjs} +17 -14
  24. package/dist/{token-goat-chunk-L7SDVGBT.mjs → token-goat-chunk-G7IWXCFF.mjs} +49 -23
  25. package/dist/{token-goat-chunk-NILVK7XM.mjs → token-goat-chunk-GLXRTTLE.mjs} +7 -5
  26. package/dist/{token-goat-chunk-6CCQDAYY.mjs → token-goat-chunk-H5J3C56Q.mjs} +35 -16
  27. package/dist/{token-goat-chunk-Q4S3UQGO.mjs → token-goat-chunk-HNFZZHFW.mjs} +2 -2
  28. package/dist/{token-goat-chunk-CBMY2FGI.mjs → token-goat-chunk-HUYUHODZ.mjs} +572 -230
  29. package/dist/token-goat-chunk-IVE6U7KV.mjs +53 -0
  30. package/dist/{token-goat-chunk-F7QZRIWM.mjs → token-goat-chunk-IVWI2OCK.mjs} +8 -30
  31. package/dist/{token-goat-chunk-GMOUBOX4.mjs → token-goat-chunk-JTKCQMQA.mjs} +37 -5
  32. package/dist/{token-goat-chunk-6SGLIPQB.mjs → token-goat-chunk-KOPIR3KZ.mjs} +12 -9
  33. package/dist/token-goat-chunk-L7H3U27L.mjs +35 -0
  34. package/dist/{token-goat-chunk-FSTWAOW6.mjs → token-goat-chunk-LZNBQTDK.mjs} +6 -4
  35. package/dist/token-goat-chunk-MELOKFDJ.mjs +199 -0
  36. package/dist/{token-goat-chunk-VWZKZPSR.mjs → token-goat-chunk-NMBWLRHW.mjs} +76 -39
  37. package/dist/{token-goat-chunk-HXNAC4ZF.mjs → token-goat-chunk-O6I2XU4P.mjs} +12 -10
  38. package/dist/{token-goat-chunk-MAMQPC43.mjs → token-goat-chunk-ONXH6NZ5.mjs} +1 -1
  39. package/dist/token-goat-chunk-ORNFMIER.mjs +295 -0
  40. package/dist/{token-goat-chunk-66LODAUT.mjs → token-goat-chunk-PGTH2U4C.mjs} +1 -1
  41. package/dist/{token-goat-chunk-SJEKA7Y2.mjs → token-goat-chunk-PKRWMHVP.mjs} +76 -64
  42. package/dist/{token-goat-chunk-DA43OE7L.mjs → token-goat-chunk-PQ53BSCF.mjs} +1 -1
  43. package/dist/{token-goat-chunk-RSS3TLXU.mjs → token-goat-chunk-PYSUADX4.mjs} +2 -2
  44. package/dist/{token-goat-chunk-EL7M26WP.mjs → token-goat-chunk-QO3LXVVR.mjs} +185 -104
  45. package/dist/{token-goat-chunk-XI2VFAV6.mjs → token-goat-chunk-RLP6J7WR.mjs} +6 -6
  46. package/dist/token-goat-chunk-RQGGMPCR.mjs +205 -0
  47. package/dist/{token-goat-chunk-6Z5ULNE5.mjs → token-goat-chunk-RTMVLHWX.mjs} +165 -60
  48. package/dist/{token-goat-chunk-E3K3BTEQ.mjs → token-goat-chunk-S4VSXURL.mjs} +8 -6
  49. package/dist/{token-goat-chunk-LKSXAMJB.mjs → token-goat-chunk-SE6E4BKJ.mjs} +1 -1
  50. package/dist/token-goat-chunk-TCQANXYC.mjs +351 -0
  51. package/dist/{token-goat-chunk-GGLEE35R.mjs → token-goat-chunk-TDUT2CL6.mjs} +7 -7
  52. package/dist/{token-goat-chunk-CC2PYJM7.mjs → token-goat-chunk-TGOXNAHW.mjs} +54 -112
  53. package/dist/{token-goat-chunk-XKY4VKJ4.mjs → token-goat-chunk-UA5BKWWQ.mjs} +1 -1
  54. package/dist/{token-goat-chunk-UBUKHVYW.mjs → token-goat-chunk-UXSXQQIY.mjs} +1 -1
  55. package/dist/{token-goat-chunk-D5ICEPSB.mjs → token-goat-chunk-VMFWNHGR.mjs} +79 -68
  56. package/dist/token-goat-chunk-VQ6F6T7X.mjs +36 -0
  57. package/dist/{token-goat-chunk-4STDIGYC.mjs → token-goat-chunk-VZQEWRVH.mjs} +6 -4
  58. package/dist/{token-goat-chunk-OSUFN2FV.mjs → token-goat-chunk-XB5KKOCG.mjs} +5 -25
  59. package/dist/{token-goat-chunk-L45ZQRT7.mjs → token-goat-chunk-XYWPOSCN.mjs} +57 -615
  60. package/dist/{token-goat-chunk-4JJBFT7V.mjs → token-goat-chunk-YAGLESS3.mjs} +8 -5
  61. package/dist/token-goat-chunk-YKSRAWUU.mjs +33 -0
  62. package/dist/{token-goat-chunk-F2ARFHLJ.mjs → token-goat-chunk-YOOVFPTP.mjs} +2 -2
  63. package/dist/{token-goat-chunk-EEIDFMEM.mjs → token-goat-chunk-YZAAZU2S.mjs} +12 -3
  64. package/dist/token-goat-chunk-Z6KBMOBI.mjs +53 -0
  65. package/dist/{token-goat-chunk-RJH64KQH.mjs → token-goat-chunk-ZER6EAXZ.mjs} +3 -3
  66. package/dist/token-goat-hook-client.cjs +475 -0
  67. package/dist/token-goat-hook-client.mjs +26 -0
  68. package/dist/token-goat-hook.mjs +31 -27
  69. package/dist/token-goat.core.mjs +9 -44
  70. package/docs/C4_RUNTIME_ARCHITECTURE.md +2 -2
  71. package/docs/cli.md +3 -2
  72. package/docs/install.md +16 -14
  73. package/package.json +1 -1
  74. package/dist/token-goat-chunk-7MAFDRVR.mjs +0 -47
  75. package/dist/token-goat-chunk-BCN2YQC6.mjs +0 -32
  76. package/dist/token-goat-chunk-D7GHQKQD.mjs +0 -30
  77. package/dist/token-goat-chunk-IFORDBGC.mjs +0 -192
@@ -5,7 +5,7 @@ import {
5
5
  isTextHeavy,
6
6
  ocrImage,
7
7
  ocrIntegrityFailed
8
- } from "./token-goat-chunk-4STDIGYC.mjs";
8
+ } from "./token-goat-chunk-VZQEWRVH.mjs";
9
9
  import {
10
10
  formatSqliteQueryTable,
11
11
  formatSqliteSchema,
@@ -13,7 +13,7 @@ import {
13
13
  getSqliteSchema,
14
14
  getSqliteTables,
15
15
  runReadOnlySqliteQuery
16
- } from "./token-goat-chunk-DA43OE7L.mjs";
16
+ } from "./token-goat-chunk-PQ53BSCF.mjs";
17
17
  import {
18
18
  ImageDecodeError,
19
19
  LARGE_SYMBOL_LINE_THRESHOLD,
@@ -42,17 +42,20 @@ import {
42
42
  urlPolicyDenialReason,
43
43
  virtualIndexedScopeNote,
44
44
  walkProject
45
- } from "./token-goat-chunk-6Z5ULNE5.mjs";
45
+ } from "./token-goat-chunk-RTMVLHWX.mjs";
46
+ import {
47
+ deliveredOutputBytes
48
+ } from "./token-goat-chunk-L7H3U27L.mjs";
46
49
  import {
47
50
  isBlobStale,
48
51
  loadBlob,
49
52
  storeBlob
50
- } from "./token-goat-chunk-BJBRGPBX.mjs";
53
+ } from "./token-goat-chunk-D4ETHJD6.mjs";
51
54
  import {
52
55
  capJsonRows,
53
56
  estimateTokens,
54
57
  trimToBudget
55
- } from "./token-goat-chunk-4JMWPWCS.mjs";
58
+ } from "./token-goat-chunk-52NSDWYY.mjs";
56
59
  import {
57
60
  BYTES_PER_TOKEN,
58
61
  colorStdout,
@@ -60,21 +63,21 @@ import {
60
63
  redactSecrets,
61
64
  savedTokensFromBytes,
62
65
  stripAnsiEscapes
63
- } from "./token-goat-chunk-MVSWBNMD.mjs";
66
+ } from "./token-goat-chunk-CIQ2FTY3.mjs";
64
67
  import {
65
68
  extractPdfMeta,
66
69
  extractPdfOutline,
67
70
  extractPdfText,
68
71
  locatePdfPages,
69
72
  readPdfFileWithinBounds
70
- } from "./token-goat-chunk-LKSXAMJB.mjs";
73
+ } from "./token-goat-chunk-SE6E4BKJ.mjs";
71
74
  import {
72
75
  formatCsvProfile,
73
76
  formatCsvTable,
74
77
  parseWhereSpecs,
75
78
  profileCsv,
76
79
  queryCsv
77
- } from "./token-goat-chunk-YWSP6IU7.mjs";
80
+ } from "./token-goat-chunk-DNSPXQXQ.mjs";
78
81
  import {
79
82
  MAX_ZIP_INPUT_BYTES,
80
83
  MAX_ZIP_OUTPUT_BYTES,
@@ -109,7 +112,7 @@ import {
109
112
  extractSolidity,
110
113
  extractThrift,
111
114
  stripLeadingAttributes
112
- } from "./token-goat-chunk-66LODAUT.mjs";
115
+ } from "./token-goat-chunk-PGTH2U4C.mjs";
113
116
  import {
114
117
  MAX_OVER_FETCH,
115
118
  OVER_FETCH_FACTOR,
@@ -123,7 +126,7 @@ import {
123
126
  mergeNearbyHits,
124
127
  readSection,
125
128
  searchSemantic
126
- } from "./token-goat-chunk-D5ICEPSB.mjs";
129
+ } from "./token-goat-chunk-VMFWNHGR.mjs";
127
130
  import {
128
131
  DEFAULT_QUERY_LIMIT,
129
132
  countRefs,
@@ -136,7 +139,7 @@ import {
136
139
  queryRefsByContext,
137
140
  querySymbols,
138
141
  searchSymbolsFts
139
- } from "./token-goat-chunk-HUDC5GS5.mjs";
142
+ } from "./token-goat-chunk-435UQTKD.mjs";
140
143
  import {
141
144
  FILENAME_LANGUAGE,
142
145
  TREE_SITTER_LANGUAGES,
@@ -151,11 +154,12 @@ import {
151
154
  isPascalSource,
152
155
  isPerlSource,
153
156
  isPrologSource,
157
+ isReadOnlyDb,
154
158
  languageLabel,
155
159
  partialRefsReason,
156
160
  redactIfDotenv,
157
161
  unsupportedLanguageName
158
- } from "./token-goat-chunk-M56BWPBN.mjs";
162
+ } from "./token-goat-chunk-7CPMDFGB.mjs";
159
163
  import {
160
164
  fileIsAbsent,
161
165
  findProject,
@@ -165,40 +169,38 @@ import {
165
169
  loadConfig,
166
170
  resolveProjectRoot,
167
171
  shortFingerprint
168
- } from "./token-goat-chunk-CC2PYJM7.mjs";
172
+ } from "./token-goat-chunk-TGOXNAHW.mjs";
169
173
  import {
170
174
  registerReset
171
- } from "./token-goat-chunk-EEIDFMEM.mjs";
175
+ } from "./token-goat-chunk-YZAAZU2S.mjs";
172
176
  import {
173
177
  PER_FILE_COUNTERFACTUAL_CEILING,
174
- SKELETON_SYMBOL_CAP,
175
178
  atomicWriteBytes,
176
179
  compileGrepMatcher,
177
180
  countNoun,
178
- dataDir,
179
181
  decodeSource,
180
182
  ensureNewline,
181
183
  escapeRegExp,
182
184
  excludeTestsHiddenNote,
183
185
  extractErrorMessage,
184
186
  filtersFilteredToEmptyNotice,
185
- foldCaseForContainment,
186
- foldPath,
187
- globalDbPath,
188
187
  grepFilteredToEmptyNotice,
189
- isInsideRoot,
190
188
  isTestFile,
191
189
  pushAll,
192
190
  redactUrlQuery,
193
191
  requireNonNegativeStrictInt,
194
192
  requirePositiveStrictInt,
195
- resolveOnPath,
196
193
  runGit,
197
194
  stripBom,
198
- supportRequestLine,
199
- windowsCmdQuoteArg,
200
195
  withExtension
201
- } from "./token-goat-chunk-L45ZQRT7.mjs";
196
+ } from "./token-goat-chunk-XYWPOSCN.mjs";
197
+ import {
198
+ foldCaseForContainment,
199
+ foldPath,
200
+ isInsideRoot,
201
+ resolveOnPath,
202
+ windowsCmdQuoteArg
203
+ } from "./token-goat-chunk-TCQANXYC.mjs";
202
204
  import {
203
205
  UNTRUSTED_FILE_TAG,
204
206
  UNTRUSTED_GITHUB_TAG,
@@ -211,9 +213,15 @@ import {
211
213
  resolveIndexPath,
212
214
  toDisplayPath
213
215
  } from "./token-goat-chunk-NMTKNYGF.mjs";
216
+ import {
217
+ SKELETON_SYMBOL_CAP,
218
+ dataDir,
219
+ globalDbPath,
220
+ supportRequestLine
221
+ } from "./token-goat-chunk-MELOKFDJ.mjs";
214
222
  import {
215
223
  compileGuardedRegex
216
- } from "./token-goat-chunk-GMOUBOX4.mjs";
224
+ } from "./token-goat-chunk-JTKCQMQA.mjs";
217
225
  import {
218
226
  init_define_import_meta_env
219
227
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -8097,8 +8105,11 @@ function filterSimilarHeadings(available, query) {
8097
8105
  return sortByLengthCloseness(matched, query);
8098
8106
  }
8099
8107
  function didYouMean(candidates) {
8108
+ return didYouMeanLines(candidates).join("\n");
8109
+ }
8110
+ function didYouMeanLines(candidates) {
8100
8111
  const unique = [...new Set(candidates)];
8101
- if (unique.length === 0) return "";
8112
+ if (unique.length === 0) return [];
8102
8113
  const lines = ["Did you mean:"];
8103
8114
  for (const c of unique.slice(0, DIDYOUMEAN_LIMIT)) {
8104
8115
  lines.push(` - ${c}`);
@@ -8106,7 +8117,7 @@ function didYouMean(candidates) {
8106
8117
  if (unique.length > DIDYOUMEAN_LIMIT) {
8107
8118
  lines.push(` (${unique.length - DIDYOUMEAN_LIMIT} more not shown)`);
8108
8119
  }
8109
- return lines.join("\n");
8120
+ return lines;
8110
8121
  }
8111
8122
  function unknownSymbolSuggestion(name, rootDir) {
8112
8123
  const names = /* @__PURE__ */ new Set();
@@ -8932,7 +8943,7 @@ function changedDiffBaselineBytes(cwd, ref, files) {
8932
8943
  if (files.length === 0) return 0;
8933
8944
  try {
8934
8945
  const result = runGit(["diff", ref, "--unified=0", "--", ...files], { cwd });
8935
- if (result.exitCode === 0) return Buffer.byteLength(result.stdout, "utf8");
8946
+ if (result.exitCode === 0) return deliveredOutputBytes(Buffer.byteLength(result.stdout, "utf8"));
8936
8947
  } catch {
8937
8948
  }
8938
8949
  return 0;
@@ -9004,7 +9015,7 @@ function runChanged(opts = {}) {
9004
9015
  const diffResult = runGit(["diff", ref, "--unified=0", "--", ...changedFiles], { cwd });
9005
9016
  if (diffResult.exitCode === 0) {
9006
9017
  hunksByFile = parseDiffHunks(diffResult.stdout);
9007
- symbolDiffBaselineBytes = Buffer.byteLength(diffResult.stdout, "utf8");
9018
+ symbolDiffBaselineBytes = deliveredOutputBytes(Buffer.byteLength(diffResult.stdout, "utf8"));
9008
9019
  }
9009
9020
  } catch {
9010
9021
  }
@@ -10697,6 +10708,7 @@ function verifyPin(p, pinned) {
10697
10708
  verifyPinnedIdentity(p, pinned);
10698
10709
  }
10699
10710
  function indexFileSyncPinned(resolvedPath, dbPath) {
10711
+ if (isReadOnlyDb(dbPath)) return;
10700
10712
  recordKnownRootThrottled(resolvedPath, dataDir(), dbPath);
10701
10713
  const pinned = activePins?.get(pinKey(path12.resolve(resolvedPath)));
10702
10714
  if (pinned === void 0) {
@@ -10763,6 +10775,7 @@ function resolveBody(entry) {
10763
10775
  return indexedSourceText(entry.filePath, source).split(/\r?\n/).slice(Math.max(0, entry.lineStart - 1), entry.lineEnd).join("\n");
10764
10776
  }
10765
10777
  var STALE_WARNING = "\u26A0 STALE: index is older than the file on disk (worker hasn't reindexed yet \u2014 retry shortly, or read the file directly)";
10778
+ var STALE_READ_ONLY_WARNING = "\u26A0 STALE: index is older than the file on disk and cannot be updated this run (the index is read-only here), so read the file directly";
10766
10779
  var DELETED_WARNING = "\u26A0 DELETED: this file is no longer on disk \u2014 what follows is what the index last saw of it";
10767
10780
  var DELETED_TAG = "\u26A0 DELETED: file no longer on disk";
10768
10781
  var STALE_TAG = "\u26A0 STALE: file changed on disk and could not be reindexed";
@@ -10780,11 +10793,12 @@ function staleWarning(resolvedPath) {
10780
10793
  ` : "";
10781
10794
  }
10782
10795
  if (diskSha === entry.sha) return "";
10783
- return `${STALE_WARNING}
10796
+ return `${isReadOnlyDb(globalDbPath()) ? STALE_READ_ONLY_WARNING : STALE_WARNING}
10784
10797
  `;
10785
10798
  }
10786
10799
  function healStaleIndex(resolvedPath) {
10787
10800
  const entry = getFileEntry(resolvedPath);
10801
+ if (isReadOnlyDb(globalDbPath())) return;
10788
10802
  if (entry === null || entry.sha === "") {
10789
10803
  if (fingerprintFile(resolvedPath) === null) return;
10790
10804
  try {
@@ -10832,9 +10846,8 @@ function warnIfFilesStale(filePaths) {
10832
10846
  healStaleIndex(raw);
10833
10847
  }
10834
10848
  if (staleCount > 0) {
10835
- console.warn(
10836
- `token-goat: ${countNoun(staleCount, "file")} behind these results changed on disk since the index last saw ${staleCount === 1 ? "it" : "them"} -- a reindex just ran, so a repeat of this command will reflect the current version.`
10837
- );
10849
+ const after = isReadOnlyDb(globalDbPath()) ? "the index is read-only this run, so these results are from the older version." : "a reindex just ran, so a repeat of this command will reflect the current version.";
10850
+ console.warn(`token-goat: ${countNoun(staleCount, "file")} behind these results changed on disk since the index last saw ${staleCount === 1 ? "it" : "them"} -- ${after}`);
10838
10851
  }
10839
10852
  }
10840
10853
  function emitGuarded(text, command) {
@@ -10867,11 +10880,21 @@ function sumFileSizes(filePaths) {
10867
10880
  }
10868
10881
  return total;
10869
10882
  }
10883
+ function largestFileSize(filePaths) {
10884
+ let largest = 0;
10885
+ for (const fp of new Set(filePaths)) {
10886
+ try {
10887
+ largest = Math.max(largest, Math.min(fs12.statSync(fp).size, PER_FILE_COUNTERFACTUAL_CEILING));
10888
+ } catch {
10889
+ }
10890
+ }
10891
+ return largest;
10892
+ }
10870
10893
  function refsSearchBaselineBytes(rows) {
10871
10894
  let total = 0;
10872
10895
  for (const ref of rows) total += Buffer.byteLength(`${refsDisplayPath(ref.filePath)}:${ref.line}: ${ref.context}
10873
10896
  `, "utf8");
10874
- return total;
10897
+ return deliveredOutputBytes(total);
10875
10898
  }
10876
10899
  function recordReadStat(kind, fullSourceBytes, emittedText, detail) {
10877
10900
  const emittedBytes = Buffer.byteLength(emittedText, "utf8");
@@ -11024,7 +11047,7 @@ ${emptyIndexMessage(emptyIndexRoot)}`;
11024
11047
  }
11025
11048
  return { text: text2, code: 1 };
11026
11049
  }
11027
- const fullSourceBytes = sumFileSizes(results.map((s) => s.filePath));
11050
+ const fullSourceBytes = largestFileSize(results.map((s) => s.filePath));
11028
11051
  const symbolDisplayRoot = getDisplayRoot(opts.projectRoot);
11029
11052
  const refCounts = opts.stats === true ? queryRefCounts(
11030
11053
  results.map((s) => s.name),
@@ -12167,7 +12190,7 @@ async function runSemantic(query, opts) {
12167
12190
  warning: `Matching on meaning failed (${searchSemanticError}); results come from keyword search alone.`
12168
12191
  } : {}
12169
12192
  });
12170
- recordReadStat("semantic_search", sumFileSizes(hits.map((h) => h.filePath)), text3, query);
12193
+ recordReadStat("semantic_search", largestFileSize(hits.map((h) => h.filePath)), text3, query);
12171
12194
  return { text: text3, code: 0 };
12172
12195
  }
12173
12196
  const blocks = hits.map((h, i) => {
@@ -12189,7 +12212,7 @@ ${previewLines(h.previewText, 3)}`;
12189
12212
  `Matching on meaning found nothing close for '${query}' (closest was ${weakClosestDistance.toFixed(3)}, weak above ${WEAK_MATCH_DISTANCE}); these results may be unrelated. For a known name try token-goat symbol --grep <pattern> or rg, or rephrase the query.`
12190
12213
  );
12191
12214
  }
12192
- recordReadStat("semantic_search", sumFileSizes(hits.map((h) => h.filePath)), text2, query);
12215
+ recordReadStat("semantic_search", largestFileSize(hits.map((h) => h.filePath)), text2, query);
12193
12216
  return { text: text2, code: 0 };
12194
12217
  }
12195
12218
  if (matchesGrep !== void 0 && preFilterCount > 0) {
@@ -12211,7 +12234,7 @@ ${previewLines(h.previewText, 3)}`;
12211
12234
  if (!anyFilter) {
12212
12235
  const evidenceHits = await searchEvidenceSemantically(rootDir, query, n);
12213
12236
  if (evidenceHits.length > 0) {
12214
- const evidenceFullBytes = evidenceHits.reduce((sum, entry) => sum + Buffer.byteLength(entry.text, "utf8"), 0);
12237
+ const evidenceFullBytes = evidenceHits.reduce((sum, entry) => sum + deliveredOutputBytes(Buffer.byteLength(entry.text, "utf8")), 0);
12215
12238
  if (opts.json === true) {
12216
12239
  const items = evidenceHits.map((entry) => ({
12217
12240
  source: toDisplayPath(rootDir, entry.source),
@@ -12704,6 +12727,19 @@ function resolveSymbolSpecOrEmitError(commandName, spec, projectRoot) {
12704
12727
  return resolution.entry;
12705
12728
  }
12706
12729
 
12730
+ // src/handle_stat.ts
12731
+ init_define_import_meta_env();
12732
+ import * as fs14 from "node:fs";
12733
+ var OPEN_FOR_STAT = process.platform === "win32" ? fs14.constants.O_RDONLY : fs14.constants.O_RDONLY | fs14.constants.O_NONBLOCK;
12734
+ function statThroughHandle(p) {
12735
+ const fd = fs14.openSync(p, OPEN_FOR_STAT);
12736
+ try {
12737
+ return fs14.fstatSync(fd, { bigint: true });
12738
+ } finally {
12739
+ fs14.closeSync(fd);
12740
+ }
12741
+ }
12742
+
12707
12743
  // src/content_store.ts
12708
12744
  init_define_import_meta_env();
12709
12745
  import { deflateRawSync } from "node:zlib";
@@ -12866,7 +12902,7 @@ export {
12866
12902
  runOpenApiOp,
12867
12903
  rankSimilarNames,
12868
12904
  filterSimilarHeadings,
12869
- didYouMean,
12905
+ didYouMeanLines,
12870
12906
  extraFileArgsNote,
12871
12907
  parseLineRange,
12872
12908
  parseColonLineSpec,
@@ -12925,6 +12961,7 @@ export {
12925
12961
  runGrep,
12926
12962
  runSemantic,
12927
12963
  runSemanticMulti,
12964
+ statThroughHandle,
12928
12965
  CONTENT_MAX_INPUT_CHARS,
12929
12966
  compressText,
12930
12967
  retrieveText,
@@ -6,32 +6,34 @@ import {
6
6
  isBlobStale,
7
7
  loadBlob,
8
8
  storeBlob
9
- } from "./token-goat-chunk-BJBRGPBX.mjs";
9
+ } from "./token-goat-chunk-D4ETHJD6.mjs";
10
10
  import {
11
11
  hasUnquotedOperator
12
- } from "./token-goat-chunk-4RN64ZND.mjs";
12
+ } from "./token-goat-chunk-2WOUYWLM.mjs";
13
13
  import {
14
14
  redactSecrets
15
- } from "./token-goat-chunk-MVSWBNMD.mjs";
15
+ } from "./token-goat-chunk-CIQ2FTY3.mjs";
16
16
  import {
17
17
  sanitizeFtsQuery
18
- } from "./token-goat-chunk-HUDC5GS5.mjs";
18
+ } from "./token-goat-chunk-435UQTKD.mjs";
19
19
  import {
20
20
  getDb
21
- } from "./token-goat-chunk-M56BWPBN.mjs";
21
+ } from "./token-goat-chunk-7CPMDFGB.mjs";
22
22
  import {
23
23
  shortFingerprint
24
- } from "./token-goat-chunk-CC2PYJM7.mjs";
24
+ } from "./token-goat-chunk-TGOXNAHW.mjs";
25
25
  import {
26
26
  registerReset
27
- } from "./token-goat-chunk-EEIDFMEM.mjs";
27
+ } from "./token-goat-chunk-YZAAZU2S.mjs";
28
28
  import {
29
- globalDbPath,
30
29
  runGit
31
- } from "./token-goat-chunk-L45ZQRT7.mjs";
30
+ } from "./token-goat-chunk-XYWPOSCN.mjs";
32
31
  import {
33
32
  normalizePath
34
33
  } from "./token-goat-chunk-NMTKNYGF.mjs";
34
+ import {
35
+ globalDbPath
36
+ } from "./token-goat-chunk-MELOKFDJ.mjs";
35
37
  import {
36
38
  init_define_import_meta_env
37
39
  } from "./token-goat-chunk-A37V4PBF.mjs";
@@ -846,7 +848,7 @@ function getBashOutput(id) {
846
848
  }
847
849
  registerReset(() => {
848
850
  _byId = /* @__PURE__ */ new Map();
849
- });
851
+ }, { perRequest: true });
850
852
 
851
853
  export {
852
854
  isLockFile,
@@ -2,7 +2,7 @@ import { createRequire as __cjsRequire } from 'node:module';
2
2
  const require = __cjsRequire(import.meta.url);
3
3
  import {
4
4
  estimateTokensFromLength
5
- } from "./token-goat-chunk-4JMWPWCS.mjs";
5
+ } from "./token-goat-chunk-52NSDWYY.mjs";
6
6
  import {
7
7
  displaySafeText
8
8
  } from "./token-goat-chunk-NMTKNYGF.mjs";