token-goat 2.9.16 → 2.9.18
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 +2 -5
- package/dist/{token-goat-chunk-ULA4WCED.mjs → token-goat-chunk-2KTZ6J7T.mjs} +7 -7
- package/dist/{token-goat-chunk-LJL6FGDS.mjs → token-goat-chunk-34OUJ2IE.mjs} +11 -11
- package/dist/{token-goat-chunk-OCI25AXY.mjs → token-goat-chunk-52IMXJ2L.mjs} +3 -3
- package/dist/{token-goat-chunk-MIL62GMN.mjs → token-goat-chunk-5MMJAJF3.mjs} +6 -6
- package/dist/{token-goat-chunk-NOBZV7PM.mjs → token-goat-chunk-6LGVCCMY.mjs} +12 -12
- package/dist/{token-goat-chunk-MA5BZ2KI.mjs → token-goat-chunk-7VLWNQDQ.mjs} +1 -1
- package/dist/{token-goat-chunk-2IEIBVVD.mjs → token-goat-chunk-ARNRFR6M.mjs} +1 -1
- package/dist/{token-goat-chunk-XOHTFRDH.mjs → token-goat-chunk-BFEWOMA3.mjs} +11 -9
- package/dist/{token-goat-chunk-QMZMHQRR.mjs → token-goat-chunk-BWCRC23L.mjs} +18 -18
- package/dist/{token-goat-chunk-H3DXI6VD.mjs → token-goat-chunk-CA6V36KW.mjs} +1 -1
- package/dist/{token-goat-chunk-5USHO7B6.mjs → token-goat-chunk-CTOYJ232.mjs} +18 -41
- package/dist/{token-goat-chunk-GIMGT34T.mjs → token-goat-chunk-EPXNOKIV.mjs} +1 -1
- package/dist/{token-goat-chunk-YPS64ACE.mjs → token-goat-chunk-GRI6HWX3.mjs} +1 -1
- package/dist/{token-goat-chunk-EJCY6KHO.mjs → token-goat-chunk-H3FONFBO.mjs} +2 -2
- package/dist/{token-goat-chunk-VVIYEFBI.mjs → token-goat-chunk-HIZXQVNU.mjs} +3 -3
- package/dist/{token-goat-chunk-DMQ32ZSR.mjs → token-goat-chunk-HPOFR6QX.mjs} +3 -3
- package/dist/{token-goat-chunk-63QWJ6UM.mjs → token-goat-chunk-I67CPTDD.mjs} +2 -2
- package/dist/{token-goat-chunk-M2R4UQ3B.mjs → token-goat-chunk-K4DG6EEF.mjs} +2 -2
- package/dist/{token-goat-chunk-R3X5TCPB.mjs → token-goat-chunk-L7VCX33I.mjs} +1 -1
- package/dist/{token-goat-chunk-NAMH252H.mjs → token-goat-chunk-LA3O4JGD.mjs} +2 -2
- package/dist/{token-goat-chunk-Z5VPAXTC.mjs → token-goat-chunk-LTYWLKAG.mjs} +61 -31
- package/dist/{token-goat-chunk-ZEHFYJ7Z.mjs → token-goat-chunk-OWSJJY5R.mjs} +4 -4
- package/dist/{token-goat-chunk-3H6FQT62.mjs → token-goat-chunk-QIDLJGXZ.mjs} +1 -1
- package/dist/{token-goat-chunk-2PCFAQAS.mjs → token-goat-chunk-QML7ITHJ.mjs} +87 -10
- package/dist/{token-goat-chunk-UXHDBVUR.mjs → token-goat-chunk-RHHFEXKF.mjs} +1 -1
- package/dist/{token-goat-chunk-NQZCSVN2.mjs → token-goat-chunk-UENEL6KX.mjs} +1 -1
- package/dist/{token-goat-chunk-UMXD2M7O.mjs → token-goat-chunk-V3ZWBEHM.mjs} +8 -8
- package/dist/{token-goat-chunk-BFNTLGVA.mjs → token-goat-chunk-W3E65QOW.mjs} +31 -9
- package/dist/{token-goat-chunk-GMXBQS6O.mjs → token-goat-chunk-WFX2V3OF.mjs} +58 -47
- package/dist/{token-goat-chunk-4DC6DDIB.mjs → token-goat-chunk-YQZE5NS6.mjs} +5 -5
- package/dist/token-goat-hook.mjs +11 -11
- package/dist/token-goat.core.mjs +18 -18
- package/docs/cli.md +3 -2
- package/package.json +1 -1
|
@@ -56,6 +56,7 @@ import {
|
|
|
56
56
|
runJsonOutline,
|
|
57
57
|
runJsonQuery,
|
|
58
58
|
runListSections,
|
|
59
|
+
runLocate,
|
|
59
60
|
runLog,
|
|
60
61
|
runNoteGet,
|
|
61
62
|
runNoteList,
|
|
@@ -90,7 +91,7 @@ import {
|
|
|
90
91
|
symbolNamesInFile,
|
|
91
92
|
upsertNote,
|
|
92
93
|
warnIfFilesStale
|
|
93
|
-
} from "./token-goat-chunk-
|
|
94
|
+
} from "./token-goat-chunk-QML7ITHJ.mjs";
|
|
94
95
|
import {
|
|
95
96
|
DEFAULT_RECONCILE_BUDGET_MS,
|
|
96
97
|
HOOK_EVENTS,
|
|
@@ -107,7 +108,7 @@ import {
|
|
|
107
108
|
readStdinJson,
|
|
108
109
|
runReconcile,
|
|
109
110
|
storeWebOutput
|
|
110
|
-
} from "./token-goat-chunk-
|
|
111
|
+
} from "./token-goat-chunk-V3ZWBEHM.mjs";
|
|
111
112
|
import {
|
|
112
113
|
AGENT_SALT_MARKER,
|
|
113
114
|
CONTEXT_AUTOCOMPACT_TOKENS,
|
|
@@ -243,7 +244,7 @@ import {
|
|
|
243
244
|
visualStudioUserMcpPath,
|
|
244
245
|
walkProject,
|
|
245
246
|
writeCompact
|
|
246
|
-
} from "./token-goat-chunk-
|
|
247
|
+
} from "./token-goat-chunk-BFEWOMA3.mjs";
|
|
247
248
|
import {
|
|
248
249
|
BASH_OUTPUT_SUBDIR,
|
|
249
250
|
CompressedOutput,
|
|
@@ -261,7 +262,7 @@ import {
|
|
|
261
262
|
listRecentRecall,
|
|
262
263
|
normalizeCommandForCacheKey,
|
|
263
264
|
searchRecall
|
|
264
|
-
} from "./token-goat-chunk-
|
|
265
|
+
} from "./token-goat-chunk-CTOYJ232.mjs";
|
|
265
266
|
import {
|
|
266
267
|
C,
|
|
267
268
|
DEFAULT_MAX_AGE_MS,
|
|
@@ -283,19 +284,19 @@ import {
|
|
|
283
284
|
savedTokensFromBytes,
|
|
284
285
|
stripAnsi,
|
|
285
286
|
summarize
|
|
286
|
-
} from "./token-goat-chunk-
|
|
287
|
+
} from "./token-goat-chunk-HPOFR6QX.mjs";
|
|
287
288
|
import {
|
|
288
289
|
docxOutline,
|
|
289
290
|
docxTables,
|
|
290
291
|
docxText,
|
|
291
292
|
formatDocxTables
|
|
292
|
-
} from "./token-goat-chunk-
|
|
293
|
+
} from "./token-goat-chunk-UENEL6KX.mjs";
|
|
293
294
|
import {
|
|
294
295
|
pptxNotesText,
|
|
295
296
|
pptxOutline,
|
|
296
297
|
pptxSlideText,
|
|
297
298
|
pptxTextGrep
|
|
298
|
-
} from "./token-goat-chunk-
|
|
299
|
+
} from "./token-goat-chunk-ARNRFR6M.mjs";
|
|
299
300
|
import {
|
|
300
301
|
formatXlsxColumns,
|
|
301
302
|
formatXlsxRange,
|
|
@@ -304,11 +305,11 @@ import {
|
|
|
304
305
|
querySheet,
|
|
305
306
|
rangeSheet,
|
|
306
307
|
xlsxColumns
|
|
307
|
-
} from "./token-goat-chunk-
|
|
308
|
+
} from "./token-goat-chunk-LA3O4JGD.mjs";
|
|
308
309
|
import {
|
|
309
310
|
formatCsvTable,
|
|
310
311
|
parseWhereSpecs
|
|
311
|
-
} from "./token-goat-chunk-
|
|
312
|
+
} from "./token-goat-chunk-EPXNOKIV.mjs";
|
|
312
313
|
import {
|
|
313
314
|
PARSER_FINGERPRINT,
|
|
314
315
|
embeddingBackendLoadError,
|
|
@@ -331,11 +332,11 @@ import {
|
|
|
331
332
|
readSection,
|
|
332
333
|
treeSitterCoreAvailable,
|
|
333
334
|
treeSitterCoreLoadError
|
|
334
|
-
} from "./token-goat-chunk-
|
|
335
|
+
} from "./token-goat-chunk-W3E65QOW.mjs";
|
|
335
336
|
import {
|
|
336
337
|
getFileEntry,
|
|
337
338
|
querySymbols
|
|
338
|
-
} from "./token-goat-chunk-
|
|
339
|
+
} from "./token-goat-chunk-I67CPTDD.mjs";
|
|
339
340
|
import {
|
|
340
341
|
TREE_SITTER_LANGUAGES,
|
|
341
342
|
detectLanguage,
|
|
@@ -346,7 +347,7 @@ import {
|
|
|
346
347
|
matchGroovySlashy,
|
|
347
348
|
nonTreeSitterLanguageCount,
|
|
348
349
|
redactIfDotenv
|
|
349
|
-
} from "./token-goat-chunk-
|
|
350
|
+
} from "./token-goat-chunk-L7VCX33I.mjs";
|
|
350
351
|
import {
|
|
351
352
|
CONFIG_KEY_ENV_OVERRIDES,
|
|
352
353
|
PROJECT_LOCKED_KEYS,
|
|
@@ -375,7 +376,7 @@ import {
|
|
|
375
376
|
stringify,
|
|
376
377
|
validateEnumField,
|
|
377
378
|
validateNumericField
|
|
378
|
-
} from "./token-goat-chunk-
|
|
379
|
+
} from "./token-goat-chunk-CA6V36KW.mjs";
|
|
379
380
|
import {
|
|
380
381
|
ENV_KEYS,
|
|
381
382
|
LOCK_WAIT_MS_HARDENED,
|
|
@@ -435,7 +436,7 @@ import {
|
|
|
435
436
|
withRetryOnLock,
|
|
436
437
|
writeIfDifferent,
|
|
437
438
|
writeJsonSettings
|
|
438
|
-
} from "./token-goat-chunk-
|
|
439
|
+
} from "./token-goat-chunk-QIDLJGXZ.mjs";
|
|
439
440
|
import {
|
|
440
441
|
UNTRUSTED_FILE_TAG,
|
|
441
442
|
UNTRUSTED_TOOL_TAG,
|
|
@@ -7285,6 +7286,20 @@ function checkSecurityPosture(cfg, dataDirPath) {
|
|
|
7285
7286
|
|
|
7286
7287
|
// src/cli_doctor.ts
|
|
7287
7288
|
var DB_SIZE_WARN_BYTES = 1024 * 1024 * 1024;
|
|
7289
|
+
function freelistBytes(header) {
|
|
7290
|
+
if (header.length < 40) return 0;
|
|
7291
|
+
const rawPageSize = header.readUInt16BE(16);
|
|
7292
|
+
return (rawPageSize === 1 ? 65536 : rawPageSize) * header.readUInt32BE(36);
|
|
7293
|
+
}
|
|
7294
|
+
function oversizeDbMessage(dbPath, sizeBytes, freeBytes, tempRows) {
|
|
7295
|
+
const mb = (bytes) => Math.round(bytes / (1024 * 1024));
|
|
7296
|
+
const advice = [];
|
|
7297
|
+
if (freeBytes >= sizeBytes / 10) advice.push(`'token-goat reclaim-index' returns the ${mb(freeBytes)} MB of it that is free pages`);
|
|
7298
|
+
if (tempRows > 0) advice.push(`'token-goat project prune' removes ${countNoun(tempRows, "scratch file")} indexed under the OS temp dir`);
|
|
7299
|
+
const head = `global.db is ${mb(sizeBytes)} MB at ${displaySafeText(dbPath)} (larger than recommended). `;
|
|
7300
|
+
if (advice.length > 0) return `${head}${advice.join("; ")}.`;
|
|
7301
|
+
return `${head}Only ${mb(freeBytes)} MB of it is free pages and none of it is temp-dir scratch, so it is live index data that neither 'reclaim-index' nor 'project prune' will shrink.`;
|
|
7302
|
+
}
|
|
7288
7303
|
function checkDbExists(dataDir2) {
|
|
7289
7304
|
const dbPath = path17.join(dataDir2, "global.db");
|
|
7290
7305
|
if (!fs18.existsSync(dbPath)) {
|
|
@@ -7297,12 +7312,14 @@ function checkDbExists(dataDir2) {
|
|
|
7297
7312
|
const sizeBytes = fs18.statSync(dbPath).size;
|
|
7298
7313
|
const SQLITE_HEADER = "SQLite format 3\0";
|
|
7299
7314
|
let header = "";
|
|
7315
|
+
let headerBytes = Buffer.alloc(0);
|
|
7300
7316
|
try {
|
|
7301
7317
|
const fd = fs18.openSync(dbPath, "r");
|
|
7302
7318
|
try {
|
|
7303
|
-
const buf = Buffer.alloc(
|
|
7319
|
+
const buf = Buffer.alloc(100);
|
|
7304
7320
|
const bytesRead = fs18.readSync(fd, buf, 0, buf.length, 0);
|
|
7305
|
-
|
|
7321
|
+
headerBytes = buf.subarray(0, bytesRead);
|
|
7322
|
+
header = buf.toString("latin1", 0, Math.min(bytesRead, SQLITE_HEADER.length));
|
|
7306
7323
|
} finally {
|
|
7307
7324
|
fs18.closeSync(fd);
|
|
7308
7325
|
}
|
|
@@ -7316,12 +7333,12 @@ function checkDbExists(dataDir2) {
|
|
|
7316
7333
|
};
|
|
7317
7334
|
}
|
|
7318
7335
|
if (sizeBytes > DB_SIZE_WARN_BYTES) {
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
};
|
|
7336
|
+
let tempRows = 0;
|
|
7337
|
+
try {
|
|
7338
|
+
tempRows = findSystemTempFiles(dbPath).length;
|
|
7339
|
+
} catch {
|
|
7340
|
+
}
|
|
7341
|
+
return { name: "Database", status: "warn", message: oversizeDbMessage(dbPath, sizeBytes, freelistBytes(headerBytes), tempRows) };
|
|
7325
7342
|
}
|
|
7326
7343
|
return {
|
|
7327
7344
|
name: "Database",
|
|
@@ -7778,12 +7795,15 @@ function checkUnmappedTools(dbPath) {
|
|
|
7778
7795
|
message: `${shown2.join("; ")}${more2} -- these differ only by case or separators, so that bridge's tool-rename step is very likely not being applied and every handler behind those names is inert`
|
|
7779
7796
|
};
|
|
7780
7797
|
}
|
|
7781
|
-
const
|
|
7782
|
-
const
|
|
7798
|
+
const byName = /* @__PURE__ */ new Map();
|
|
7799
|
+
for (const r of rows) byName.set(r.tool_name, Math.max(byName.get(r.tool_name) ?? 0, r.hits));
|
|
7800
|
+
const names = [...byName].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
|
|
7801
|
+
const shown = names.slice(0, UNMAPPED_TOOL_SAMPLE).map(([tool, hits]) => `${tool} (${hits}x)`);
|
|
7802
|
+
const more = names.length > UNMAPPED_TOOL_SAMPLE ? `, +${names.length - UNMAPPED_TOOL_SAMPLE} more` : "";
|
|
7783
7803
|
return {
|
|
7784
7804
|
name,
|
|
7785
7805
|
status: "ok",
|
|
7786
|
-
message: `${
|
|
7806
|
+
message: `${names.length} tool name(s) seen with no handler, none resembling one token-goat handles: ${shown.join(", ")}${more}`
|
|
7787
7807
|
};
|
|
7788
7808
|
} catch (e) {
|
|
7789
7809
|
return { name, status: "warn", message: `could not read the tool-name histogram: ${extractErrorMessage(e)}` };
|
|
@@ -8038,7 +8058,7 @@ async function runDoctorAndExit(opts) {
|
|
|
8038
8058
|
}
|
|
8039
8059
|
}
|
|
8040
8060
|
try {
|
|
8041
|
-
const { checkUpdateStatus } = await import("./token-goat-chunk-
|
|
8061
|
+
const { checkUpdateStatus } = await import("./token-goat-chunk-K4DG6EEF.mjs");
|
|
8042
8062
|
const update = await checkUpdateStatus(1500);
|
|
8043
8063
|
if (update.updateAvailable && update.latest) {
|
|
8044
8064
|
console.log(`
|
|
@@ -15307,6 +15327,16 @@ function registerAnalysisCommands(program2, guard) {
|
|
|
15307
15327
|
})
|
|
15308
15328
|
)
|
|
15309
15329
|
);
|
|
15330
|
+
program2.command("locate <spec>").description("locate symbol or landmark with exact line spans (supports name or file::name, with fuzzy fallback)").option("-j, --json", "output as JSON").option("-l, --limit <n>", "max results (default: 25)").option("-f, --file <path>", "restrict search to a specific file").action(
|
|
15331
|
+
(spec, opts) => runExit(
|
|
15332
|
+
() => runLocate({
|
|
15333
|
+
spec,
|
|
15334
|
+
...opts.file !== void 0 ? { file: opts.file } : {},
|
|
15335
|
+
...opts.json === true ? { json: true } : {},
|
|
15336
|
+
...opts.limit !== void 0 ? { limit: requireNonNegativeInt("--limit", opts.limit) } : {}
|
|
15337
|
+
})
|
|
15338
|
+
)
|
|
15339
|
+
);
|
|
15310
15340
|
program2.command("grep <pattern> [paths...]").description("regex search over files, caching nothing (session-aware grep)").option("-j, --json", "output as JSON").option("--max-lines <n>", "max matching lines to print").option("--no-recursive", "do not descend into subdirectories").option("-C, --context <n>", "lines of context to show before and after each match").option("--symbol", "annotate each hit with its enclosing symbol (name and kind)").action(
|
|
15311
15341
|
(pattern, paths, opts) => runExit(
|
|
15312
15342
|
() => runGrep({
|
|
@@ -20066,7 +20096,7 @@ async function cmdMcpServe() {
|
|
|
20066
20096
|
let StdioServerTransport;
|
|
20067
20097
|
try {
|
|
20068
20098
|
;
|
|
20069
|
-
({ createMcpServer } = await import("./token-goat-chunk-
|
|
20099
|
+
({ createMcpServer } = await import("./token-goat-chunk-6LGVCCMY.mjs"));
|
|
20070
20100
|
({ StdioServerTransport } = await import("./token-goat-chunk-EVC4TOLE.mjs"));
|
|
20071
20101
|
} catch (err2) {
|
|
20072
20102
|
process.stderr.write(
|
|
@@ -20091,7 +20121,7 @@ async function cmdHook(event, opts) {
|
|
|
20091
20121
|
if (typeof opts.harness === "string" && opts.harness.length > 0) {
|
|
20092
20122
|
process.env[ENV_KEYS.HARNESS_OVERRIDE] = opts.harness;
|
|
20093
20123
|
}
|
|
20094
|
-
const { relay } = await import("./token-goat-chunk-
|
|
20124
|
+
const { relay } = await import("./token-goat-chunk-34OUJ2IE.mjs");
|
|
20095
20125
|
await relay(event);
|
|
20096
20126
|
}
|
|
20097
20127
|
function projectHooksCommitNote(pathFiles, hooksConfigPath) {
|
|
@@ -20128,7 +20158,7 @@ async function cmdInstall(opts) {
|
|
|
20128
20158
|
if (opts.project === true && opts.user === true) {
|
|
20129
20159
|
throw new Error("install takes either -p/--project or --user, not both.");
|
|
20130
20160
|
}
|
|
20131
|
-
await import("./token-goat-chunk-
|
|
20161
|
+
await import("./token-goat-chunk-34OUJ2IE.mjs");
|
|
20132
20162
|
const scope = opts.project === true ? "project" : "user";
|
|
20133
20163
|
if (wantsClaudeCodeBase(opts)) {
|
|
20134
20164
|
const result = installHooks(scope);
|
|
@@ -20718,7 +20748,7 @@ async function cmdCompress(commandArgs, opts = {}) {
|
|
|
20718
20748
|
process.exitCode = 1;
|
|
20719
20749
|
return;
|
|
20720
20750
|
}
|
|
20721
|
-
const bashRunner = await import("./token-goat-chunk-
|
|
20751
|
+
const bashRunner = await import("./token-goat-chunk-2KTZ6J7T.mjs");
|
|
20722
20752
|
if (opts.compress === false) {
|
|
20723
20753
|
process.exitCode = bashRunner.runRaw(command, parseTimeout(opts.timeout, bashRunner.DEFAULT_TIMEOUT_SECONDS));
|
|
20724
20754
|
return;
|
|
@@ -20968,7 +20998,7 @@ function buildProgram() {
|
|
|
20968
20998
|
program2.command("compress [command...]").alias("bash").alias("run").description("run a shell command (under a POSIX shell / bash) and emit a compressed view of its output").allowUnknownOption(true).option("-c, --cmd <command>", "the shell command to run, as one string (use / for paths across platforms)").option("--cmd-b64 <payload>", "the shell command as a base64-encoded string (preserves quotes, backslashes, and symbols across platforms)").option("-f, --filter <name>", "filter name (auto-detected from the command when omitted)").option("--timeout <seconds>", "wall-clock timeout in seconds (0 = built-in default)").option("--no-compress", "stream output raw without compression (debug the wrapper)").option("--profile <name>", "compression profile: aggressive | balanced | minimal").option("--max-tokens <n>", "post-compress token cap (0 = no cap)").option("-q, --quiet-success", "on exit code 0, emit only [tg: ok] summary and store full output for recall via bash-output").option("--native", "use native platform shell (e.g. cmd.exe on Windows) instead of bash, preserving Windows path backslashes").action(cmdCompress);
|
|
20969
20999
|
program2.command("upgrade").alias("update").description("check for updates and upgrade token-goat to the latest version").option("--check", "check whether an update is available without installing").option("-j, --json", "emit version check status as JSON").action(
|
|
20970
21000
|
(opts) => guard(async () => {
|
|
20971
|
-
const { cmdUpgrade } = await import("./token-goat-chunk-
|
|
21001
|
+
const { cmdUpgrade } = await import("./token-goat-chunk-K4DG6EEF.mjs");
|
|
20972
21002
|
await cmdUpgrade(opts, () => cmdInstall({}));
|
|
20973
21003
|
})()
|
|
20974
21004
|
);
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
querySheet,
|
|
11
11
|
rangeSheet,
|
|
12
12
|
xlsxColumns
|
|
13
|
-
} from "./token-goat-chunk-
|
|
14
|
-
import "./token-goat-chunk-
|
|
13
|
+
} from "./token-goat-chunk-LA3O4JGD.mjs";
|
|
14
|
+
import "./token-goat-chunk-EPXNOKIV.mjs";
|
|
15
15
|
import "./token-goat-chunk-3BTK54F3.mjs";
|
|
16
|
-
import "./token-goat-chunk-
|
|
16
|
+
import "./token-goat-chunk-7VLWNQDQ.mjs";
|
|
17
17
|
import "./token-goat-chunk-XTQAOTSO.mjs";
|
|
18
18
|
import "./token-goat-chunk-AH6QILZM.mjs";
|
|
19
|
-
import "./token-goat-chunk-
|
|
19
|
+
import "./token-goat-chunk-QIDLJGXZ.mjs";
|
|
20
20
|
import "./token-goat-chunk-ERTXEKB6.mjs";
|
|
21
21
|
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
22
22
|
import "./token-goat-chunk-GMOUBOX4.mjs";
|
|
@@ -21,7 +21,7 @@ init_define_import_meta_env();
|
|
|
21
21
|
import { createRequire } from "node:module";
|
|
22
22
|
function resolveVersion() {
|
|
23
23
|
if (true) {
|
|
24
|
-
return "2.9.
|
|
24
|
+
return "2.9.18";
|
|
25
25
|
}
|
|
26
26
|
const require2 = createRequire(import.meta.url);
|
|
27
27
|
const pkg = require2("../package.json");
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isTextHeavy,
|
|
6
6
|
ocrImage,
|
|
7
7
|
ocrIntegrityFailed
|
|
8
|
-
} from "./token-goat-chunk-
|
|
8
|
+
} from "./token-goat-chunk-H3FONFBO.mjs";
|
|
9
9
|
import {
|
|
10
10
|
formatSqliteQueryTable,
|
|
11
11
|
formatSqliteSchema,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
urlPolicyDenialReason,
|
|
43
43
|
virtualIndexedScopeNote,
|
|
44
44
|
walkProject
|
|
45
|
-
} from "./token-goat-chunk-
|
|
45
|
+
} from "./token-goat-chunk-BFEWOMA3.mjs";
|
|
46
46
|
import {
|
|
47
47
|
colorStdout,
|
|
48
48
|
isBlobStale,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
savedTokensFromBytes,
|
|
53
53
|
storeBlob,
|
|
54
54
|
stripAnsi
|
|
55
|
-
} from "./token-goat-chunk-
|
|
55
|
+
} from "./token-goat-chunk-HPOFR6QX.mjs";
|
|
56
56
|
import {
|
|
57
57
|
extractPdfMeta,
|
|
58
58
|
extractPdfOutline,
|
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
parseWhereSpecs,
|
|
67
67
|
profileCsv,
|
|
68
68
|
queryCsv
|
|
69
|
-
} from "./token-goat-chunk-
|
|
69
|
+
} from "./token-goat-chunk-EPXNOKIV.mjs";
|
|
70
70
|
import {
|
|
71
71
|
MAX_ZIP_INPUT_BYTES,
|
|
72
72
|
MAX_ZIP_OUTPUT_BYTES,
|
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
extractSolidity,
|
|
102
102
|
extractThrift,
|
|
103
103
|
stripLeadingAttributes
|
|
104
|
-
} from "./token-goat-chunk-
|
|
104
|
+
} from "./token-goat-chunk-GRI6HWX3.mjs";
|
|
105
105
|
import {
|
|
106
106
|
MAX_OVER_FETCH,
|
|
107
107
|
OVER_FETCH_FACTOR,
|
|
@@ -114,7 +114,7 @@ import {
|
|
|
114
114
|
mergeNearbyHits,
|
|
115
115
|
readSection,
|
|
116
116
|
searchSemantic
|
|
117
|
-
} from "./token-goat-chunk-
|
|
117
|
+
} from "./token-goat-chunk-W3E65QOW.mjs";
|
|
118
118
|
import {
|
|
119
119
|
DEFAULT_QUERY_LIMIT,
|
|
120
120
|
countRefs,
|
|
@@ -127,7 +127,7 @@ import {
|
|
|
127
127
|
queryRefsByContext,
|
|
128
128
|
querySymbols,
|
|
129
129
|
searchSymbolsFts
|
|
130
|
-
} from "./token-goat-chunk-
|
|
130
|
+
} from "./token-goat-chunk-I67CPTDD.mjs";
|
|
131
131
|
import {
|
|
132
132
|
FILENAME_LANGUAGE,
|
|
133
133
|
TREE_SITTER_LANGUAGES,
|
|
@@ -146,7 +146,7 @@ import {
|
|
|
146
146
|
partialRefsReason,
|
|
147
147
|
redactIfDotenv,
|
|
148
148
|
unsupportedLanguageName
|
|
149
|
-
} from "./token-goat-chunk-
|
|
149
|
+
} from "./token-goat-chunk-L7VCX33I.mjs";
|
|
150
150
|
import {
|
|
151
151
|
fileIsAbsent,
|
|
152
152
|
findProject,
|
|
@@ -156,7 +156,7 @@ import {
|
|
|
156
156
|
loadConfig,
|
|
157
157
|
resolveProjectRoot,
|
|
158
158
|
shortFingerprint
|
|
159
|
-
} from "./token-goat-chunk-
|
|
159
|
+
} from "./token-goat-chunk-CA6V36KW.mjs";
|
|
160
160
|
import {
|
|
161
161
|
registerReset
|
|
162
162
|
} from "./token-goat-chunk-EEIDFMEM.mjs";
|
|
@@ -188,7 +188,7 @@ import {
|
|
|
188
188
|
supportRequestLine,
|
|
189
189
|
windowsCmdQuoteArg,
|
|
190
190
|
withExtension
|
|
191
|
-
} from "./token-goat-chunk-
|
|
191
|
+
} from "./token-goat-chunk-QIDLJGXZ.mjs";
|
|
192
192
|
import {
|
|
193
193
|
UNTRUSTED_FILE_TAG,
|
|
194
194
|
UNTRUSTED_GITHUB_TAG,
|
|
@@ -10198,6 +10198,78 @@ function runFind(opts) {
|
|
|
10198
10198
|
}
|
|
10199
10199
|
return 0;
|
|
10200
10200
|
}
|
|
10201
|
+
function runLocate(opts) {
|
|
10202
|
+
if (opts.limit !== void 0 && opts.limit <= 0) {
|
|
10203
|
+
emitErr4(`--limit must be a positive number, got: ${opts.limit}`);
|
|
10204
|
+
return 1;
|
|
10205
|
+
}
|
|
10206
|
+
const rootDir = opts.projectRoot ?? resolveProjectRoot({ project: process.cwd() });
|
|
10207
|
+
let targetSpec = opts.spec;
|
|
10208
|
+
let targetFile = opts.file;
|
|
10209
|
+
if (targetSpec.includes("::")) {
|
|
10210
|
+
const colonIdx = targetSpec.indexOf("::");
|
|
10211
|
+
targetFile = targetSpec.slice(0, colonIdx);
|
|
10212
|
+
targetSpec = targetSpec.slice(colonIdx + 2);
|
|
10213
|
+
}
|
|
10214
|
+
const queryOpts = {
|
|
10215
|
+
limit: FIND_SCAN_LIMIT2
|
|
10216
|
+
};
|
|
10217
|
+
if (targetFile !== void 0) {
|
|
10218
|
+
queryOpts.filePath = resolveIndexPath(targetFile, rootDir);
|
|
10219
|
+
healStaleIndex(queryOpts.filePath);
|
|
10220
|
+
} else {
|
|
10221
|
+
queryOpts.rootDir = rootDir;
|
|
10222
|
+
}
|
|
10223
|
+
let rawSymbols = querySymbols(queryOpts);
|
|
10224
|
+
if (targetFile === void 0) {
|
|
10225
|
+
const heal = healStaleResultFiles(rawSymbols.map((s) => s.filePath));
|
|
10226
|
+
if (heal.healed) rawSymbols = querySymbols(queryOpts);
|
|
10227
|
+
}
|
|
10228
|
+
const specLower = targetSpec.toLowerCase();
|
|
10229
|
+
const exactMatches = rawSymbols.filter((s) => s.name.toLowerCase() === specLower);
|
|
10230
|
+
const partialMatches = rawSymbols.filter(
|
|
10231
|
+
(s) => s.name.toLowerCase() !== specLower && s.name.toLowerCase().includes(specLower)
|
|
10232
|
+
);
|
|
10233
|
+
const combined = [...exactMatches, ...partialMatches];
|
|
10234
|
+
let fuzzyNames = [];
|
|
10235
|
+
if (combined.length === 0) {
|
|
10236
|
+
fuzzyNames = rankSimilarNames(rawSymbols.map((s) => s.name), targetSpec);
|
|
10237
|
+
}
|
|
10238
|
+
const matched = fuzzyNames.length > 0 ? fuzzyNames.flatMap((n) => rawSymbols.filter((s) => s.name === n)) : combined;
|
|
10239
|
+
const limit = opts.limit ?? 25;
|
|
10240
|
+
const shown = matched.slice(0, limit);
|
|
10241
|
+
if (shown.length === 0) {
|
|
10242
|
+
emitErr4(`No landmark or symbol located for '${targetSpec}'`);
|
|
10243
|
+
return 1;
|
|
10244
|
+
}
|
|
10245
|
+
const hits = shown.map((s) => ({
|
|
10246
|
+
filePath: toDisplayPath(rootDir, s.filePath),
|
|
10247
|
+
name: s.name,
|
|
10248
|
+
kind: s.kind,
|
|
10249
|
+
lineStart: s.lineStart,
|
|
10250
|
+
lineEnd: s.lineEnd,
|
|
10251
|
+
span: `${s.lineStart}-${s.lineEnd}`
|
|
10252
|
+
}));
|
|
10253
|
+
if (opts.json === true) {
|
|
10254
|
+
emit4(displaySafeJson({
|
|
10255
|
+
items: hits,
|
|
10256
|
+
totalCount: matched.length,
|
|
10257
|
+
truncated: matched.length > limit,
|
|
10258
|
+
...fuzzyNames.length > 0 ? { fuzzy: true, matchedNames: fuzzyNames } : {}
|
|
10259
|
+
}));
|
|
10260
|
+
return 0;
|
|
10261
|
+
}
|
|
10262
|
+
if (fuzzyNames.length > 0) {
|
|
10263
|
+
emitErr4(`No exact landmark for '${targetSpec}'; nearest matches: ${fuzzyNames.join(", ")}`);
|
|
10264
|
+
}
|
|
10265
|
+
for (const hit of hits) {
|
|
10266
|
+
emit4(`${displaySafeText(hit.filePath)}:${hit.span} [${displaySafeText(hit.kind)}] ${displaySafeText(hit.name)}`);
|
|
10267
|
+
}
|
|
10268
|
+
if (matched.length > limit) {
|
|
10269
|
+
emitErr4(`Showing ${limit} of ${matched.length} locations; rerun with --limit ${matched.length} to see them all`);
|
|
10270
|
+
}
|
|
10271
|
+
return 0;
|
|
10272
|
+
}
|
|
10201
10273
|
function runListSections(opts) {
|
|
10202
10274
|
const sections = listSections(opts.file);
|
|
10203
10275
|
if (sections.length === 0) {
|
|
@@ -11729,6 +11801,10 @@ function runGrep(opts) {
|
|
|
11729
11801
|
}
|
|
11730
11802
|
if (hits.length > maxLines) {
|
|
11731
11803
|
emitErr4(`... (${hits.length - maxLines} more lines omitted)`);
|
|
11804
|
+
emitErr4(`Tip: To avoid broad grepping and reduce token expenditure, locate specific symbols with:`);
|
|
11805
|
+
emitErr4(` token-goat symbol <name>`);
|
|
11806
|
+
emitErr4(` token-goat locate <name>`);
|
|
11807
|
+
emitErr4(` token-goat outline <file> / token-goat skeleton <file>`);
|
|
11732
11808
|
}
|
|
11733
11809
|
return 0;
|
|
11734
11810
|
}
|
|
@@ -12490,6 +12566,7 @@ export {
|
|
|
12490
12566
|
runNoteGet,
|
|
12491
12567
|
runNoteList,
|
|
12492
12568
|
runFind,
|
|
12569
|
+
runLocate,
|
|
12493
12570
|
runListSections,
|
|
12494
12571
|
AMBIGUOUS_HEADING_LIMIT,
|
|
12495
12572
|
runSection,
|
|
@@ -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-CA6V36KW.mjs";
|
|
6
6
|
import {
|
|
7
7
|
init_define_import_meta_env
|
|
8
8
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -4,31 +4,31 @@ import {
|
|
|
4
4
|
enqueueDirtyPathSafe,
|
|
5
5
|
getToolName,
|
|
6
6
|
getTrackedFiles
|
|
7
|
-
} from "./token-goat-chunk-
|
|
7
|
+
} from "./token-goat-chunk-BFEWOMA3.mjs";
|
|
8
8
|
import {
|
|
9
9
|
indexRecallEntry
|
|
10
|
-
} from "./token-goat-chunk-
|
|
10
|
+
} from "./token-goat-chunk-CTOYJ232.mjs";
|
|
11
11
|
import {
|
|
12
12
|
isBlobStale,
|
|
13
13
|
loadBlob,
|
|
14
14
|
redactSecrets,
|
|
15
15
|
storeBlob
|
|
16
|
-
} from "./token-goat-chunk-
|
|
16
|
+
} from "./token-goat-chunk-HPOFR6QX.mjs";
|
|
17
17
|
import {
|
|
18
18
|
PARSER_FINGERPRINT
|
|
19
|
-
} from "./token-goat-chunk-
|
|
19
|
+
} from "./token-goat-chunk-W3E65QOW.mjs";
|
|
20
20
|
import {
|
|
21
21
|
getProjectFileEntries,
|
|
22
22
|
projectScopeClause
|
|
23
|
-
} from "./token-goat-chunk-
|
|
23
|
+
} from "./token-goat-chunk-I67CPTDD.mjs";
|
|
24
24
|
import {
|
|
25
25
|
getDb
|
|
26
|
-
} from "./token-goat-chunk-
|
|
26
|
+
} from "./token-goat-chunk-L7VCX33I.mjs";
|
|
27
27
|
import {
|
|
28
28
|
fingerprintFile,
|
|
29
29
|
getDisplayRoot,
|
|
30
30
|
shortFingerprint
|
|
31
|
-
} from "./token-goat-chunk-
|
|
31
|
+
} from "./token-goat-chunk-CA6V36KW.mjs";
|
|
32
32
|
import {
|
|
33
33
|
registerReset
|
|
34
34
|
} from "./token-goat-chunk-EEIDFMEM.mjs";
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
extractErrorMessage,
|
|
39
39
|
foldPath,
|
|
40
40
|
globalDbPath
|
|
41
|
-
} from "./token-goat-chunk-
|
|
41
|
+
} from "./token-goat-chunk-QIDLJGXZ.mjs";
|
|
42
42
|
import {
|
|
43
43
|
displaySafeJson,
|
|
44
44
|
normalizePath,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
pathEqClause,
|
|
5
5
|
projectScopeClause,
|
|
6
6
|
querySymbols
|
|
7
|
-
} from "./token-goat-chunk-
|
|
7
|
+
} from "./token-goat-chunk-I67CPTDD.mjs";
|
|
8
8
|
import {
|
|
9
9
|
TREE_SITTER_LANGUAGES,
|
|
10
10
|
_detectOpenQuote,
|
|
@@ -21,11 +21,11 @@ import {
|
|
|
21
21
|
stripJsComments,
|
|
22
22
|
stripStringLiterals,
|
|
23
23
|
stripXmlComments
|
|
24
|
-
} from "./token-goat-chunk-
|
|
24
|
+
} from "./token-goat-chunk-L7VCX33I.mjs";
|
|
25
25
|
import {
|
|
26
26
|
fingerprintContent,
|
|
27
27
|
loadConfig
|
|
28
|
-
} from "./token-goat-chunk-
|
|
28
|
+
} from "./token-goat-chunk-CA6V36KW.mjs";
|
|
29
29
|
import {
|
|
30
30
|
registerReset
|
|
31
31
|
} from "./token-goat-chunk-EEIDFMEM.mjs";
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
foldPath,
|
|
40
40
|
globalDbPath,
|
|
41
41
|
isCaseInsensitiveFs
|
|
42
|
-
} from "./token-goat-chunk-
|
|
42
|
+
} from "./token-goat-chunk-QIDLJGXZ.mjs";
|
|
43
43
|
import {
|
|
44
44
|
displaySafeText,
|
|
45
45
|
normalizePath
|
|
@@ -74,11 +74,11 @@ async function extractEmbeddableDocumentText(filePath) {
|
|
|
74
74
|
return text;
|
|
75
75
|
}
|
|
76
76
|
case ".docx":
|
|
77
|
-
return await (await import("./token-goat-chunk-
|
|
77
|
+
return await (await import("./token-goat-chunk-HIZXQVNU.mjs")).docxText(filePath);
|
|
78
78
|
case ".pptx":
|
|
79
|
-
return await (await import("./token-goat-chunk-
|
|
79
|
+
return await (await import("./token-goat-chunk-52IMXJ2L.mjs")).pptxAllSlidesText(filePath, true);
|
|
80
80
|
case ".xlsx":
|
|
81
|
-
return await (await import("./token-goat-chunk-
|
|
81
|
+
return await (await import("./token-goat-chunk-OWSJJY5R.mjs")).allSheetsHeadText(filePath, XLSX_SHEET_ROW_CAP);
|
|
82
82
|
default:
|
|
83
83
|
return null;
|
|
84
84
|
}
|
|
@@ -1413,7 +1413,7 @@ function _pathPriorityPenalty(filePath) {
|
|
|
1413
1413
|
|
|
1414
1414
|
// src/parser_fingerprint.ts
|
|
1415
1415
|
init_define_import_meta_env();
|
|
1416
|
-
var PARSER_FINGERPRINT = "
|
|
1416
|
+
var PARSER_FINGERPRINT = "0d80572d3abdfb19";
|
|
1417
1417
|
|
|
1418
1418
|
// src/parser.ts
|
|
1419
1419
|
init_define_import_meta_env();
|
|
@@ -1996,6 +1996,28 @@ function extractTsJsSymbols(root, filePath, lines2) {
|
|
|
1996
1996
|
out.push(makeSymbol(filePath, fieldName.text, "method", node, lines2, "c"));
|
|
1997
1997
|
}
|
|
1998
1998
|
}
|
|
1999
|
+
if (node.type === "method_definition" && node.parent?.type === "object") {
|
|
2000
|
+
const name = nodeName(node);
|
|
2001
|
+
if (name !== null && name !== "") {
|
|
2002
|
+
out.push(makeSymbol(filePath, name, "method", node, lines2, "c"));
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
if (node.type === "pair" && node.parent?.type === "object") {
|
|
2006
|
+
const key = node.childForFieldName("key");
|
|
2007
|
+
const value = node.childForFieldName("value");
|
|
2008
|
+
if (key !== null && value !== null) {
|
|
2009
|
+
const keyName = key.type === "identifier" || key.type === "property_identifier" || key.type === "string" ? key.text.replace(/^['"]|['"]$/g, "") : null;
|
|
2010
|
+
if (keyName !== null && keyName !== "") {
|
|
2011
|
+
const isFn = value.type === "arrow_function" || value.type === "function_expression" || value.type === "function";
|
|
2012
|
+
const isObjectOrArray = value.type === "object" || value.type === "array";
|
|
2013
|
+
if (isFn) {
|
|
2014
|
+
out.push(makeSymbol(filePath, keyName, "method", node, lines2, "c"));
|
|
2015
|
+
} else if (isObjectOrArray && node.endPosition.row - node.startPosition.row >= 1) {
|
|
2016
|
+
out.push(makeSymbol(filePath, keyName, "config", node, lines2, "c"));
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
1999
2021
|
const childInside = insideFunction || TSJS_FN_SCOPE_TYPES.has(node.type);
|
|
2000
2022
|
for (const child of node.namedChildren) {
|
|
2001
2023
|
visit(child, childInside);
|
|
@@ -3672,7 +3694,7 @@ function parseSourceSymbolsTreeSitterOnly(content, filePath, language) {
|
|
|
3672
3694
|
var REGEX_ADAPTERS_SLOT = /* @__PURE__ */ Symbol.for("token-goat.regex-adapters");
|
|
3673
3695
|
var adapterSlot = globalThis;
|
|
3674
3696
|
async function loadRegexExtractors() {
|
|
3675
|
-
adapterSlot[REGEX_ADAPTERS_SLOT] ??= await import("./token-goat-chunk-
|
|
3697
|
+
adapterSlot[REGEX_ADAPTERS_SLOT] ??= await import("./token-goat-chunk-5MMJAJF3.mjs");
|
|
3676
3698
|
}
|
|
3677
3699
|
function regexAdapters() {
|
|
3678
3700
|
const loaded = adapterSlot[REGEX_ADAPTERS_SLOT];
|