token-goat 2.6.34 → 2.6.35
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/SECURITY.md +11 -10
- package/dist/{token-goat-chunk-IYYQOPY4.mjs → token-goat-chunk-D5IZEGN2.mjs} +18 -4
- package/dist/{token-goat-chunk-WA2ER6TZ.mjs → token-goat-chunk-DQIT5JIF.mjs} +1 -1
- package/dist/{token-goat-chunk-L7QLEVO7.mjs → token-goat-chunk-DRAIYVUI.mjs} +16 -14
- package/dist/{token-goat-chunk-GXBPEQR2.mjs → token-goat-chunk-HW4VUKJ5.mjs} +14 -8
- package/dist/{token-goat-chunk-CN7GUPX6.mjs → token-goat-chunk-I2KCEGIP.mjs} +378 -54
- package/dist/{token-goat-chunk-7FWBSPCT.mjs → token-goat-chunk-K7W3P2TJ.mjs} +139 -6
- package/dist/{token-goat-chunk-OA3GFKP2.mjs → token-goat-chunk-SIHYQCTM.mjs} +2 -2
- package/dist/{token-goat-chunk-I6EQH27G.mjs → token-goat-chunk-UIZVX3HN.mjs} +2 -2
- package/dist/{token-goat-chunk-FRMEOIRU.mjs → token-goat-chunk-Y2NH6DGZ.mjs} +208 -13
- package/dist/{token-goat-chunk-CKRATWCJ.mjs → token-goat-chunk-YF67EWRH.mjs} +5 -5
- package/dist/{token-goat-hook-chunk-CNLMPHXT.mjs → token-goat-hook-chunk-2O7P4Z6Q.mjs} +139 -6
- package/dist/{token-goat-hook-chunk-I5VM5PO5.mjs → token-goat-hook-chunk-3AAH72SO.mjs} +14 -8
- package/dist/{token-goat-hook-chunk-BU5OFDGQ.mjs → token-goat-hook-chunk-4POU6OHK.mjs} +208 -13
- package/dist/{token-goat-hook-chunk-6C5RN3CM.mjs → token-goat-hook-chunk-CRBMPT74.mjs} +2 -2
- package/dist/{token-goat-hook-chunk-QTZ6YUMQ.mjs → token-goat-hook-chunk-D6UJEFHX.mjs} +2 -2
- package/dist/{token-goat-hook-chunk-ATEGFQAU.mjs → token-goat-hook-chunk-J4HKWUWZ.mjs} +5 -5
- package/dist/{token-goat-hook-chunk-2ISZ4AZR.mjs → token-goat-hook-chunk-NIPXIAPA.mjs} +1 -1
- package/dist/{token-goat-hook-chunk-KGLMNOGD.mjs → token-goat-hook-chunk-NXVT4F3S.mjs} +18 -4
- package/dist/{token-goat-hook-chunk-OQML5EMA.mjs → token-goat-hook-chunk-VU6VGZBM.mjs} +16 -14
- package/dist/{token-goat-hook-chunk-6QTWMSRO.mjs → token-goat-hook-chunk-XM4W3WCO.mjs} +378 -54
- package/dist/token-goat-hook.mjs +5 -5
- package/dist/token-goat.core.mjs +5 -5
- package/package.json +4 -3
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
walkProject,
|
|
51
51
|
yamlLineClosesQuote,
|
|
52
52
|
yamlOpenQuoteAfter
|
|
53
|
-
} from "./token-goat-hook-chunk-
|
|
53
|
+
} from "./token-goat-hook-chunk-XM4W3WCO.mjs";
|
|
54
54
|
import {
|
|
55
55
|
PER_FILE_COUNTERFACTUAL_CEILING,
|
|
56
56
|
_detectOpenQuote,
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
unsupportedLanguageName,
|
|
101
101
|
windowsCmdQuoteArg,
|
|
102
102
|
withExtension
|
|
103
|
-
} from "./token-goat-hook-chunk-
|
|
103
|
+
} from "./token-goat-hook-chunk-2O7P4Z6Q.mjs";
|
|
104
104
|
import {
|
|
105
105
|
registerReset
|
|
106
106
|
} from "./token-goat-hook-chunk-BUOCULAM.mjs";
|
|
@@ -7644,10 +7644,16 @@ function buildChangedRefHint(cwd, ref) {
|
|
|
7644
7644
|
const commitWord = commitCount === 1 ? "1 commit" : `${commitCount} commits`;
|
|
7645
7645
|
return `Hint: this repo has only ${commitWord}; '${ref}' does not exist. Try: token-goat changed --since ${suggestedRef}`;
|
|
7646
7646
|
}
|
|
7647
|
+
function refIsSafe(ref) {
|
|
7648
|
+
return !ref.startsWith("-");
|
|
7649
|
+
}
|
|
7650
|
+
function emitUnsafeRef(ref) {
|
|
7651
|
+
emitErr(`Refusing a git ref that starts with '-': ${ref}`);
|
|
7652
|
+
}
|
|
7647
7653
|
function runChanged(opts = {}) {
|
|
7648
7654
|
const ref = opts.ref ?? "HEAD~5";
|
|
7649
|
-
if (ref
|
|
7650
|
-
|
|
7655
|
+
if (!refIsSafe(ref)) {
|
|
7656
|
+
emitUnsafeRef(ref);
|
|
7651
7657
|
return 1;
|
|
7652
7658
|
}
|
|
7653
7659
|
const cwd = opts.projectRoot ?? process.cwd();
|
|
@@ -7824,6 +7830,10 @@ function resolveSymbolSpecOrEmitError(commandName, spec, projectRoot) {
|
|
|
7824
7830
|
return resolution.entry;
|
|
7825
7831
|
}
|
|
7826
7832
|
function runDiff(opts) {
|
|
7833
|
+
if (opts.ref !== void 0 && !refIsSafe(opts.ref)) {
|
|
7834
|
+
emitUnsafeRef(opts.ref);
|
|
7835
|
+
return 1;
|
|
7836
|
+
}
|
|
7827
7837
|
const match = resolveSymbolSpecOrEmitError("diff", opts.spec, opts.projectRoot);
|
|
7828
7838
|
if (match === null) return 1;
|
|
7829
7839
|
const cwd = opts.projectRoot ?? process.cwd();
|
|
@@ -7911,6 +7921,10 @@ function parseLogDashLOutput(stdout) {
|
|
|
7911
7921
|
return entries;
|
|
7912
7922
|
}
|
|
7913
7923
|
function runLog(opts) {
|
|
7924
|
+
if (opts.ref !== void 0 && !refIsSafe(opts.ref)) {
|
|
7925
|
+
emitUnsafeRef(opts.ref);
|
|
7926
|
+
return 1;
|
|
7927
|
+
}
|
|
7914
7928
|
const match = resolveSymbolSpecOrEmitError("log", opts.spec, opts.projectRoot);
|
|
7915
7929
|
if (match === null) return 1;
|
|
7916
7930
|
const cwd = opts.projectRoot ?? process.cwd();
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
runSkeleton,
|
|
26
26
|
runSymbol,
|
|
27
27
|
withPinnedReads
|
|
28
|
-
} from "./token-goat-hook-chunk-
|
|
28
|
+
} from "./token-goat-hook-chunk-NXVT4F3S.mjs";
|
|
29
29
|
import {
|
|
30
30
|
buildProjectMap,
|
|
31
31
|
embeddingsDepsAvailable,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
getProjectIndexCounts,
|
|
35
35
|
isWorkerRunning,
|
|
36
36
|
mapLookupBytesSaved
|
|
37
|
-
} from "./token-goat-hook-chunk-
|
|
37
|
+
} from "./token-goat-hook-chunk-XM4W3WCO.mjs";
|
|
38
38
|
import {
|
|
39
39
|
VERSION,
|
|
40
40
|
dataDir,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
normalizePath,
|
|
46
46
|
recordStat,
|
|
47
47
|
resolveProjectRoot
|
|
48
|
-
} from "./token-goat-hook-chunk-
|
|
48
|
+
} from "./token-goat-hook-chunk-2O7P4Z6Q.mjs";
|
|
49
49
|
import "./token-goat-hook-chunk-BUOCULAM.mjs";
|
|
50
50
|
import "./token-goat-hook-chunk-RFRLWOQH.mjs";
|
|
51
51
|
|
|
@@ -126,7 +126,19 @@ function forCompare(p) {
|
|
|
126
126
|
return process.platform === "win32" ? p.toLowerCase() : p;
|
|
127
127
|
}
|
|
128
128
|
function resolveToolRoot(projectRoot) {
|
|
129
|
-
|
|
129
|
+
const resolved = resolveProjectRoot(projectRoot !== void 0 ? { project: projectRoot } : {});
|
|
130
|
+
assertRootAllowed(resolved);
|
|
131
|
+
return resolved;
|
|
132
|
+
}
|
|
133
|
+
var RootNotAllowedError = class extends Error {
|
|
134
|
+
};
|
|
135
|
+
function assertRootAllowed(resolvedRoot) {
|
|
136
|
+
const allowedRoots = loadConfig().mcp.allowed_roots;
|
|
137
|
+
if (allowedRoots.length === 0) return;
|
|
138
|
+
if (allowedRoots.some((allowed) => checkWithinProjectRoot(resolvedRoot, allowed).inside)) return;
|
|
139
|
+
throw new RootNotAllowedError(
|
|
140
|
+
`refused: "${resolvedRoot}" is not inside any root listed in mcp.allowed_roots. A caller-supplied projectRoot is untrusted input, so this deployment pins which roots may be named; add the root to mcp.allowed_roots (or TOKEN_GOAT_MCP_ALLOWED_ROOTS) to permit it.`
|
|
141
|
+
);
|
|
130
142
|
}
|
|
131
143
|
function checkWithinProjectRoot(target, resolvedRoot) {
|
|
132
144
|
const root = forCompare(normalizePath(realPathOrSelf(resolvedRoot)));
|
|
@@ -150,16 +162,6 @@ function specFilePart(spec) {
|
|
|
150
162
|
var NO_PINS = /* @__PURE__ */ new Map();
|
|
151
163
|
function confineTargets(targets, resolvedRoot, splitCommas = true) {
|
|
152
164
|
if (!loadConfig(resolvedRoot).mcp.confine_reads_to_project_root) return { ok: true, targets, pins: NO_PINS };
|
|
153
|
-
const allowedRoots = loadConfig().mcp.allowed_roots;
|
|
154
|
-
if (allowedRoots.length > 0 && !allowedRoots.some((allowed) => checkWithinProjectRoot(resolvedRoot, allowed).inside)) {
|
|
155
|
-
return {
|
|
156
|
-
ok: false,
|
|
157
|
-
refusal: toCallToolResult({
|
|
158
|
-
text: `refused: "${resolvedRoot}" is not inside any root listed in mcp.allowed_roots. A caller-supplied projectRoot is untrusted input, so this deployment pins which roots may be named; add the root to mcp.allowed_roots (or TOKEN_GOAT_MCP_ALLOWED_ROOTS) to permit it.`,
|
|
159
|
-
code: 1
|
|
160
|
-
})
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
165
|
const checked = [];
|
|
164
166
|
const pins = /* @__PURE__ */ new Map();
|
|
165
167
|
for (const raw of targets) {
|